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!") l_ = Link(l.attrib.get("client_id"), 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 links(self): links_ = [] for l in self.rspec.iterchildren("{%s}link" % (self.none)): component_manager = l.find("{%s}component_manager" % (self.none)) if component_manager is None: self.raise_exception("Component_manager tag not found!") l_ = Link(l.attrib.get("component_id"), component_manager.attrib.get("name")) 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!") l_ = Link(l.attrib.get("client_id"), 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_