예제 #1
0
    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_tn_link_resource(l, manager_):
                logger.info("Skipping this link, not a TN-res: %s", (l,))
                continue

            l_ = Link(l.attrib.get("client_id"), 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_
예제 #2
0
    def get_links(self, rspec):
        tn_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_tn_link_resource(l, manager):
                logger.info("Skipping this link, not a TN-res: %s", (l,))
                continue

            tn_link = Link(l.attrib.get("client_id"),
                           manager.attrib.get("name"),
                           l.attrib.get("vlantag"))

            self.update_protogeni_cm_uuid(l, tn_link)

            for i in l.iterfind("{%s}interface_ref" % (self.none)):
                tn_link.add_interface_ref(i.attrib.get("client_id"))

            for p in l.iterfind("{%s}property" % (self.none)):
                tn_link.add_property(p.attrib.get("source_id"),
                                     p.attrib.get("dest_id"),
                                     p.attrib.get("capacity"))

            tn_links.append(tn_link.serialize())
        return tn_links
예제 #3
0
    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"))

            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_