From: Andy Bavier Date: Fri, 4 Feb 2011 20:13:46 +0000 (-0500) Subject: Fix for VINI, due to change of site ID in RSpec to site's login base. X-Git-Tag: sfa-1.0-14~8 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=66b145ee9c63f12f281210aa00fcb2ed0b781754;p=sfa.git Fix for VINI, due to change of site ID in RSpec to site's login base. The site ID in the RSpec has been changed to be the site's login base. This afftected the lookupSite() function, which AFAIK is only used by VINI's Aggregate Manager. --- diff --git a/sfa/plc/network.py b/sfa/plc/network.py index 41bae485..dd0b4b4c 100644 --- a/sfa/plc/network.py +++ b/sfa/plc/network.py @@ -327,12 +327,25 @@ class Network: self.tags = self.get_slice_tags(api) self.tagtypes = self.get_tag_types(api) self.slice = None + self.sitemap = {} + for s in self.sites: + site = self.sites[s] + self.sitemap[site.idtag] = site.id + + def lookupSiteIdtag(self, name): + """ Lookup site id from name """ + val = None + try: + val = self.sitemap[name] + except: + raise InvalidRSpec("site name '%s' not found" % name) + return val def lookupSite(self, id): """ Lookup site based on id or idtag value """ val = None if isinstance(id, basestring): - id = int(id.lstrip('s')) + id = self.lookupSiteIdtag(id) try: val = self.sites[id] except: