Пример #1
0
 def __datapath(self, element):
     d = Datapath(element.attrib.get("component_id"),
                  element.attrib.get("component_manager_id"),
                  element.attrib.get("dpid"))
     for p in element.iterfind("{%s}port" % (self.__of)):
         d.add_port(p.attrib.get("num"), p.attrib.get("name"))
     return d.serialize()
Пример #2
0
    def links(self):
        links_ = []
        for l in self.rspec.findall(".//{%s}link" % (self.__of)):
            if l.find(".//{%s}datapath" % (self.__of)) is not None:
                of_ = Link(l.attrib.get("component_id"))
                for dpid in l.iterchildren("{%s}datapath" % (self.__of)):
                    d = Datapath(dpid.attrib.get("component_id"),
                                 dpid.attrib.get("component_manager_id"),
                                 dpid.attrib.get("dpid"))
                    of_.add_datapath(d.serialize())

                for port in l.iterchildren("{%s}port" % (self.__of)):
                    of_.add_port(port.attrib.get("port_num"))

            elif l.find(".//{%s}interface_ref" % (self.__of)) is not None:
                of_ = FEDLink(l.attrib.get("component_id"))
                link_type = l.find(".//{%s}link_type" % (self.__of))
                if link_type is not None:
                    of_.set_link_type(link_type.attrib.get("name"))
                cmgr = l.find(".//{%s}component_manager" % (self.__of))
                if cmgr is not None:
                    of_.set_component_manager(cmgr.attrib.get("name"))

                for ref in l.iterchildren("{%s}interface_ref" % (self.__of)):
                    of_.add_interface_id(ref.attrib.get("component_id"))
            else:
                self.raise_exception("Unknown link type!")

            links_.append(of_.serialize())
        return links_
Пример #3
0
    def links(self):
        links_ = []
        for l in self.rspec.findall(".//{%s}link" % (self.__of)):
            if l.find(".//{%s}datapath" % (self.__of)) is not None:
                of_ = Link(l.attrib.get("component_id"))
                for dpid in l.iterchildren("{%s}datapath" % (self.__of)):
                    d = Datapath(dpid.attrib.get("component_id"),
                                 dpid.attrib.get("component_manager_id"),
                                 dpid.attrib.get("dpid"))
                    of_.add_datapath(d.serialize())

                for port in l.iterchildren("{%s}port" % (self.__of)):
                    of_.add_port(port.attrib.get("port_num"))

            elif l.find(".//{%s}interface_ref" % (self.__of)) is not None:
                of_ = FEDLink(l.attrib.get("component_id"))
                link_type = l.find(".//{%s}link_type" % (self.__of))
                if link_type is not None:
                    of_.set_link_type(link_type.attrib.get("name"))
                cmgr = l.find(".//{%s}component_manager" % (self.__of))
                if cmgr is not None:
                    of_.set_component_manager(cmgr.attrib.get("name"))

                for ref in l.iterchildren("{%s}interface_ref" % (self.__of)):
                    of_.add_interface_id(ref.attrib.get("component_id"))
            else:
                self.raise_exception("Unknown link type!")

            links_.append(of_.serialize())
        return links_
Пример #4
0
 def __datapath(self, element):
     d = Datapath(element.attrib.get("component_id"),
                  element.attrib.get("component_manager_id"),
                  element.attrib.get("dpid"))
     for p in element.iterfind("{%s}port" % (self.__of)):
         d.add_port(p.attrib.get("num"), p.attrib.get("name"))
     return d.serialize()
Пример #5
0
    def datapaths(self):
        ofdps_ = []
        for ofd in self.rspec.iterchildren("{%s}datapath" % (self.__of)):
            of_ = Datapath(ofd.attrib.get("component_id"),
                           ofd.attrib.get("component_manager_id"),
                           ofd.attrib.get("dpid"))

            [of_.add_port(p.attrib.get("num"), p.attrib.get("name"))
             for p in ofd.findall(".//{%s}port" % (self.__of))]

            ofdps_.append(of_.serialize())
        return ofdps_
Пример #6
0
    def datapaths(self):
        ofdps_ = []
        for ofd in self.rspec.iterchildren("{%s}datapath" % (self.__of)):
            of_ = Datapath(ofd.attrib.get("component_id"),
                           ofd.attrib.get("component_manager_id"),
                           ofd.attrib.get("dpid"))

            [
                of_.add_port(p.attrib.get("num"), p.attrib.get("name"))
                for p in ofd.findall(".//{%s}port" % (self.__of))
            ]

            ofdps_.append(of_.serialize())
        return ofdps_