def links(self): links_ = [] for l in self.rspec.iterchildren("{%s}link" % (self.none)): c_ = None component_manager = l.find("{%s}component_manager" % (self.none)) if component_manager is not None: c_ = component_manager.attrib.get("name") link_type = l.find("{%s}link_type" % (self.none)) if link_type is None: self.raise_exception("Link_type tag not found!") l_ = SELink(l.attrib.get("component_id"), link_type.attrib.get("name"), c_) self.__update_protogeni_cm_uuid(l, l_) for ref in l.iterchildren("{%s}interface_ref" % (self.none)): l_.add_interface_ref(ref.attrib.get("component_id")) for p in l.iterchildren("{%s}property" % (self.none)): l_.add_property(p.attrib.get("source_id"), p.attrib.get("dest_id"), p.attrib.get("capacity")) links_.append(l_.serialize()) return links_
def get_links(self, rspec): links_ = [] for l in rspec.findall(".//{%s}link" % (self.none)): manager_ = l.find("{%s}component_manager" % (self.none)) if manager_ is None: self.raise_exception("Component-Mgr tag not found in link!") if not self.check_se_link_resource(l, manager_): logger.info("Skipping this link, not a SE-res: %s", (l, )) continue type_ = l.find("{%s}link_type" % (self.none)) if type_ is None: self.raise_exception("Link-Type tag not found in link!") l_ = SELink(l.attrib.get("client_id"), type_.attrib.get("name"), manager_.attrib.get("name")) self.update_protogeni_cm_uuid(l, l_) [ l_.add_interface_ref(i.attrib.get("client_id")) for i in l.iterfind("{%s}interface_ref" % (self.none)) ] [ l_.add_property(p.attrib.get("source_id"), p.attrib.get("dest_id"), p.attrib.get("capacity")) for p in l.iterfind("{%s}property" % (self.none)) ] links_.append(l_.serialize()) return links_
def get_links(self, rspec): links_ = [] for l in rspec.findall(".//{%s}link" % (self.none)): manager_ = l.find("{%s}component_manager" % (self.none)) if manager_ is None: self.raise_exception("Component-Mgr tag not found in virtual link!") if not self.check_vlink_resource(l, manager_): logger.info("Skipping this link, not a virtual link: %s", (l,)) continue type_ = l.find("{%s}link_type" % (self.none)) if type_ is None: self.raise_exception("Link-Type tag not found in link!") l_ = SELink(l.attrib.get("client_id"), type_.attrib.get("name"), manager_.attrib.get("name")) [l_.add_interface_ref(i.attrib.get("client_id")) for i in l.iterfind("{%s}interface_ref" % (self.none))] [l_.add_property(p.attrib.get("source_id"), p.attrib.get("dest_id"), p.attrib.get("capacity")) for p in l.iterfind("{%s}property" % (self.none))] links_.append(l_.serialize()) return links_
def get_links(self, rspec): links_ = [] for l in rspec.findall(".//{%s}link" % (self.none)): manager_ = l.find("{%s}component_manager" % (self.none)) if manager_ is None: self.raise_exception("Component-Mgr tag not found in link!") if not self.check_se_link_resource(l, manager_): logger.info("Skipping this link, not a SE-res: %s", (l,)) continue type_ = l.find("{%s}link_type" % (self.none)) if type_ is None: self.raise_exception("Link-Type tag not found in link!") # Note: client_id for a link may follow one of the formats: # Original: "urn:publicid:IDN+fms:psnc:serm+link+ # <dpid1>_6_<dpid2>_7", # New: "urn:publicid:IDN+fms:psnc:serm+link+ # <dpid1>_6?vlan=1_<dpid2>_7?vlan=2", # In case of receiving the new one, it must be translated to # the original one (advertised by SERM); otherwise it will not be # possible to find the link in the Mongo serm.link collection client_id = l.attrib.get("client_id") # client_id_2 = URNUtils.convert_se_link_id_to_adv_id(client_id) l_ = SELink(client_id, type_.attrib.get("name"), manager_.attrib.get("name")) self.update_protogeni_cm_uuid(l, l_) # FIXME: VLAN seems not properly added to interface for i in l.iterfind("{%s}interface_ref" % (self.none)): # 1st check new SERM RSpec format client_id, vlan = URNUtils.get_fields_from_domain_iface_id(i.attrib.get("client_id")) if not vlan: vlan = i.attrib.get("{%s}vlan" % (self.__felix)) l_.add_interface_ref(client_id, vlan) [ l_.add_property(p.attrib.get("source_id"), p.attrib.get("dest_id"), p.attrib.get("capacity")) for p in l.iterfind("{%s}property" % (self.none)) ] links_.append(l_.serialize()) return links_