X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fsfidata.py;h=fb98ac5541d5ac0094775802bfeb82d8cf6d5d7a;hp=7b52b56d246f6bda2fa2e72ad8457d1620c94689;hb=37dfde8c6c59f3c33d1225d3c73cb5ec11c12306;hpb=c4ae31dd3f7402ab6f6e2f563f887e0e6220c1e0 diff --git a/sface/sfidata.py b/sface/sfidata.py index 7b52b56..fb98ac5 100644 --- a/sface/sfidata.py +++ b/sface/sfidata.py @@ -3,7 +3,7 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * from lxml import etree -from sfa.util.record import SfaRecord, SliceRecord, AuthorityRecord +from sfa.util.record import SfaRecord, SliceRecord, AuthorityRecord, UserRecord from sfa.rspecs.rspec_parser import parse_rspec from sface.config import config @@ -35,7 +35,25 @@ class SfiData: return rec return None + def getUserRecord(self): + rec_file = config.getUserRecordFile() + if os.path.exists(rec_file): + xml = open(rec_file).read() + rec = UserRecord() + rec.load_from_string(xml) + return rec + return None + + def getUserSliceHrns(self): + rec = self.getUserRecord() + if rec: + return rec.get_field("slices") + + return [] + def purgeNonSliceResources(self, rspec): + # This can probably go away once the new slice manager is fully + # deployed. networks = rspec.get_networks() for network in networks: all_nodes = rspec.get_nodes(network)