コード例 #1
0
ファイル: ovsctl.py プロジェクト: modulexcite/enos
def newDPID(name=None):
    with ovsCtlLock:
        global userSwitchIndex
        if name == None:
            name = "user"
        else:
            name = name[:4]
        dpid = encodeDPID(vendor=Vendors.OVS,role=Roles.UserSwSwitch,location=name,id=userSwitchIndex)
        userSwitchIndex += 1
        return dpid
コード例 #2
0
    def addSDNPop(self, popname, hwswitchname, coreroutername, swswitchname,
                  links):
        """
        Configure the various elements of an SDN POP
        :param popname: Name of POP
        :param hwswitchname: Name of hardware SDN switch
        :param coreroutername: Name of core router
        :param swswitchname: Name of software SDN switch
        :param links: Set of physical links within the POP
        :return: None
        """
        pop = SDNPop(name=popname,
                     hwswitchname=hwswitchname,
                     coreroutername=coreroutername,
                     swswitchname=swswitchname)

        hwSwitch = pop.props['hwSwitch']
        swSwitch = pop.props['swSwitch']
        coreRouter = pop.props['coreRouter']
        hwSwitch.props['dpid'] = dpid.encodeDPID(location=popname,
                                                 vendor=dpid.Vendors.Corsa,
                                                 role=dpid.Roles.POPHwSwitch,
                                                 id=1)
        swSwitch.props['dpid'] = dpid.encodeDPID(location=popname,
                                                 vendor=dpid.Vendors.OVS,
                                                 role=dpid.Roles.POPSwSwitch,
                                                 id=1)
        self.addSwitch(hwSwitch)
        self.addSwitch(coreRouter)
        self.addSwitch(swSwitch)
        self.popIndex[popname] = pop

        for [n1, p1, n2, p2] in links:
            node1 = self.getNode(n1)
            node2 = self.getNode(n2)
            port1 = Port(name=p1, node=node1)
            port2 = Port(name=p2, node=node2)
            node1.addPort(port1)
            node2.addPort(port2)
            link = Link(ports=[port1, port2])
            self.linkIndex[link.name] = link
コード例 #3
0
ファイル: builder.py プロジェクト: esnet/enos
    def addSDNPop(self, popname, hwswitchname, coreroutername, swswitchname,links):
        """
        Configure the various elements of an SDN POP
        :param popname: Name of POP
        :param hwswitchname: Name of hardware SDN switch
        :param coreroutername: Name of core router
        :param swswitchname: Name of software SDN switch
        :param links: Set of physical links within the POP
        :return: None
        """
        pop = SDNPop(name=popname,
                     hwswitchname=hwswitchname,
                     coreroutername=coreroutername,
                     swswitchname=swswitchname)

        hwSwitch = pop.props['hwSwitch']
        swSwitch = pop.props['swSwitch']
        coreRouter = pop.props['coreRouter']
        hwSwitch.props['dpid'] = dpid.encodeDPID(location=popname,
                                                 vendor=dpid.Vendors.Corsa,
                                                 role=dpid.Roles.POPHwSwitch,
                                                 id=1)
        swSwitch.props['dpid'] = dpid.encodeDPID(location=popname,
                                                 vendor=dpid.Vendors.OVS,
                                                 role=dpid.Roles.POPSwSwitch,
                                                 id=1)
        self.addSwitch(hwSwitch)
        self.addSwitch(coreRouter)
        self.addSwitch(swSwitch)
        self.popIndex[popname] = pop

        for [n1,p1,n2,p2] in links:
            node1 = self.getNode(n1)
            node2 = self.getNode(n2)
            port1 = Port(name=p1,node=node1)
            port2 = Port(name=p2,node=node2)
            node1.addPort(port1)
            node2.addPort(port2)
            link = Link(ports = [port1,port2])
            self.linkIndex[link.name] = link
コード例 #4
0
ファイル: ovsctl.py プロジェクト: cygmris/enos
def newDPID(name=None):
    with ovsCtlLock:
        if name == None:
            name = "user"
        else:
            name = name[:4]
        container = Container.getContainer(getContinerName())
        userSwitchIndex = 1
        if ("userSwitchIndex" in container.properties):
            userSwitchIndex = container.properties["userSwitchIndex"]
        dpid = encodeDPID(vendor=Vendors.OVS,role=Roles.UserSwSwitch,location=name,id=userSwitchIndex)
        container.properties["userSwitchIndex"] = userSwitchIndex + 1
        container.save()
        return dpid