Beispiel #1
0
 def _connect_aro(self):
     # Adding to ARO api
     self.aro = Endpoint("0.0.0.0", 2284, DCnetwork=self)
     self.aro.connectVIM(self.dc1)
     self.aro.connectVIM(self.dc2)
     self.aro.connectVIM(self.dc3)
     self.aro.connectVIM(self.dc4)
Beispiel #2
0
class Topology(DCNetwork):

    def __init__(self):
        super(Topology, self).__init__(
            monitor=False,
            enable_learning=True
        )

    def _get_next_dpid(self):
        global EXTSWDPID_BASE
        EXTSWDPID_BASE += 1
        return EXTSWDPID_BASE

    def setup_topo(self):
        self._create_dcs()
        self._create_switches()
        self._create_links()
        self._connect_aro()

    def _create_dcs(self):
        self.dc1 = self.addDatacenter("dc1")
        self.dc2 = self.addDatacenter("dc2", topo='star', sw_param=3)
        self.dc3 = self.addDatacenter("dc3", topo='mesh', sw_param=3)
        self.dc4 = self.addDatacenter("dc4", topo='grid', sw_param=[3,4])
        # self.dc5 = self.addDatacenter("dc5", topo='tree', numswitch=3)

    def _create_switches(self):
        self.sw1 = self.addSwitch("sw1", dpid=hex(self._get_next_dpid())[2:])

    def _create_links(self):
        self.addLink(self.dc1, self.sw1)
        self.addLink(self.dc2, self.sw1)
        self.addLink(self.dc3, self.sw1)
        self.addLink(self.dc4, self.sw1)

    def _connect_aro(self):
        self.aro = Endpoint("0.0.0.0", 2284, DCnetwork=self)
        self.aro.connectVIM(self.dc1)
        self.aro.connectVIM(self.dc2)
        self.aro.connectVIM(self.dc3)
        self.aro.connectVIM(self.dc4)

    def start_topo(self):
        self.start()
        self.aro.start()

    def stop_topo(self):
        self.aro.stop()
        self.stop()
Beispiel #3
0
 def _connect_aro(self):
     self.aro = Endpoint("0.0.0.0", 2284, DCnetwork=self)
     self.aro.connectVIM(self.dc1)
     self.aro.connectVIM(self.dc2)
Beispiel #4
0
class Topology(DCNetwork):
    def __init__(self):
        super(Topology, self).__init__(monitor=False, enable_learning=True)

    def _get_next_dpid(self):
        global EXTSWDPID_BASE
        EXTSWDPID_BASE += 1
        return EXTSWDPID_BASE

    def setup_topo(self):
        self._create_dcs()
        self._create_switches()
        self._create_links()
        self._create_vnfhosts()
        self._connect_aro()

    def _create_dcs(self):
        rm0 = UpbSimpleCloudDcRM(max_cu=100, max_mu=2048)
        rm1 = ARORM(max_cu=4, max_mu=512)
        rm2 = ARORM(max_cu=6, max_mu=512)

        self.dc1 = self.addDatacenter("dc1")
        self.dc1.assignResourceModel(rm0)

        self.dc2 = self.addDatacenter("dc2", topo='star', sw_param=3)
        self.dc2.assignResourceModel(rm0)

    def _create_switches(self):
        self.sw1 = self.addSwitch("sw1", dpid=hex(self._get_next_dpid())[2:])

    def _create_links(self):
        self.addLink(self.dc1, self.sw1)
        self.addLink(self.dc2, self.sw1)

    def _create_vnfhosts(self):
        self.vnf1 = self.dc1.startCompute('vnf1',
                                          network=[{
                                              'id': 'intf1',
                                              'ip': '10.0.10.1/24'
                                          }]
                                          # flavor_name = 'medium'
                                          )

        self.vnf2 = self.dc2.startCompute('vnf2',
                                          network=[{
                                              'id': 'intf1',
                                              'ip': '10.0.10.2/24'
                                          }]
                                          # flavor_name = 'medium'
                                          )

    def _connect_aro(self):
        self.aro = Endpoint("0.0.0.0", 2284, DCnetwork=self)
        self.aro.connectVIM(self.dc1)
        self.aro.connectVIM(self.dc2)

    def start_topo(self):
        self.start()
        self.aro.start()

    def stop_topo(self):
        self.aro.stop()
        self.stop()
Beispiel #5
0
 def _connect_aro(self):
     self.aro = Endpoint("0.0.0.0", 2284)
     self.aro.connectWIM(self)
     self.aro.connectVIM(self.dc1)
     self.aro.connectVIM(self.dc2)
Beispiel #6
0
class Topology(DCNetwork):
    """
    Topology with 2 switches and 2 datacenters:
        dc1 <--> sw1 <--> sw2 <--> dc2
    """
    def __init__(self):
        """
        Initialize multi PoP emulator network.
        """
        super(Topology, self).__init__(monitor=False, enable_learning=True)
        # define members for later use
        self.dc1 = None
        self.dc2 = None
        self.sw1 = None
        self.sw2 = None

    def _get_next_dpid(self):
        global EXTSWDPID_BASE
        EXTSWDPID_BASE += 1
        return EXTSWDPID_BASE

    def setup_topo(self):
        self._create_dcs()
        self._create_switches()
        self._create_links()
        # self._connect_openstack()
        # self._connect_restapi()
        self._connect_aro()
        self._create_hostvnf()

    def _create_dcs(self):
        self.dc1 = self.addDatacenter("dc1")
        self.dc2 = self.addDatacenter("dc2", topo='star', numswitch=3)
        # self.dc3 = self.addDatacenter("dc3", topo='mesh', numswitch=3)

    def _create_switches(self):
        self.sw1 = self.addSwitch("sw1", dpid=hex(self._get_next_dpid())[2:])
        self.sw2 = self.addSwitch("sw2", dpid=hex(self._get_next_dpid())[2:])

    def _create_links(self):
        self.addLink(self.dc1, self.sw1)
        self.addLink(self.dc2, self.sw2)
        self.addLink(self.sw1, self.sw2)

    def _create_hostvnf(self):
        self.vnf1 = self.dc1.startCompute("vnf1",
                                          network=[{
                                              'id': 'intf1',
                                              'ip': '10.0.10.1/24'
                                          }])
        self.vnf2 = self.dc2.startCompute("vnf2",
                                          network=[{
                                              'id': 'intf1',
                                              'ip': '10.0.10.2/24'
                                          }])

    # def _connect_openstack():
    #     # add OpenStack-like APIs to the emulated DC
    #     self.api1 = OpenstackApiEndpoint("172.31.255.1", 6001)
    #     self.api1.connect_datacenter(self.dc1)
    #     self.api1.connect_dc_network(self)
    #
    #     self.api2 = OpenstackApiEndpoint("172.31.255.1", 6002)
    #     self.api2.connect_datacenter(self.dc2)
    #     self.api2.connect_dc_network(self)
    #
    # def _connect_restapi():
    #     # add the command line interface endpoint to the emulated DC (REST API)
    #     self.rapi1 = RestApiEndpoint("0.0.0.0", 5001)
    #     self.rapi1.connectDCNetwork(self)
    #     self.rapi1.connectDatacenter(self.dc1)
    #     self.rapi1.connectDatacenter(self.dc2)

    def _connect_aro(self):
        self.aro = Endpoint("0.0.0.0", 2284)
        self.aro.connectWIM(self)
        self.aro.connectVIM(self.dc1)
        self.aro.connectVIM(self.dc2)

    def start_topo(self):
        self.start()
        # self.api1.start()
        # self.api2.start()
        # self.rapi1.start()
        self.aro.start()

    def stop_topo(self):
        self.aro.stop()
        # self.rapi1.stop()
        # self.api1.stop()
        # self.api2.stop()
        self.stop()
Beispiel #7
0
class Topology(DCNetwork):
    def __init__(self):
        super(Topology, self).__init__(monitor=False, enable_learning=True)

    def _get_next_dpid(self):
        global EXTSWDPID_BASE
        EXTSWDPID_BASE += 1
        return EXTSWDPID_BASE

    def setup_topo(self):
        self._create_dcs()
        self._create_switches()
        self._create_links()
        self._create_vnfhosts()
        self._connect_aro()

    def _create_RM(self, cpu, ram):
        return ARORM(max_cu=cpu, max_mu=ram)

    def _create_dcs(self):
        self.dc1 = self.addDatacenter("pop1")
        for sw in self.dc1.switch:
            self.dc1.assignResourceModeltoSw(self._create_RM(10, 1024),
                                             sw.name)

        self.dc2 = self.addDatacenter("dc2", topo='star', sw_param=3)
        for sw in self.dc2.switch:
            self.dc2.assignResourceModeltoSw(self._create_RM(10, 1024),
                                             sw.name)

    def _create_switches(self):
        self.sw1 = self.addSwitch("sw1", dpid=hex(self._get_next_dpid())[2:])

    def _create_links(self):
        self.addLink(self.dc1, self.sw1)
        self.addLink(self.dc2, self.sw1)

    def _create_vnfhosts(self):
        self.vnf1 = self.dc1.startCompute('vnf1',
                                          network=[{
                                              'id': 'intf1',
                                              'ip': '10.0.10.1/24'
                                          }],
                                          flavor_name='medium')

        self.vnf2 = self.dc2.startCompute('vnf2',
                                          network=[{
                                              'id': 'intf1',
                                              'ip': '10.0.10.2/24'
                                          }],
                                          flavor_name='large')

    def _connect_aro(self):
        self.aro = Endpoint("0.0.0.0", 2284, DCnetwork=self)
        self.aro.connectVIM(self.dc1)
        self.aro.connectVIM(self.dc2)

    def start_topo(self):
        self.start()
        self.aro.start()

    def stop_topo(self):
        self.aro.stop()
        self.stop()
Beispiel #8
0
class Topology(DCNetwork):
    def __init__(self):
        super(Topology, self).__init__(monitor=False, enable_learning=True)

    def _get_next_dpid(self):
        # Creating unique dpid
        global EXTSWDPID_BASE
        EXTSWDPID_BASE += 1
        return EXTSWDPID_BASE

    def setup_topo(self):
        # Creating and configuring the Topology
        self._create_dcs()
        self._create_switches()
        self._create_links()
        self._create_hostvnf()
        self._connect_aro()

    def _create_RM(self, cpu, ram):
        # Creating resource models
        return ARORM(max_cu=cpu, max_mu=ram)

    def _create_dcs(self):
        # Creating Datacenter with resource models assigned to each switch.
        self.dc1 = self.addDatacenter("dc1")
        self.dc1.assignResourceModeltoSw(self._create_RM(8, 1024),
                                         self.dc1.switch[0].name)

        self.dc2 = self.addDatacenter("dc2", topo='star', sw_param=3)
        for sw in self.dc2.switch:
            self.dc2.assignResourceModeltoSw(self._create_RM(4, 1024), sw.name)

        self.dc3 = self.addDatacenter("dc3", topo='mesh', sw_param=3)
        for sw in self.dc3.switch:
            self.dc3.assignResourceModeltoSw(self._create_RM(8, 1024), sw.name)

        self.dc4 = self.addDatacenter("dc4", topo='grid', sw_param=[3, 4])
        for sw in self.dc4.switch:
            self.dc4.assignResourceModeltoSw(self._create_RM(4, 1024), sw.name)
        # self.dc5 = self.addDatacenter("dc5", topo='tree', numswitch=3)

    def _create_switches(self):
        # Creating switches
        self.sw1 = self.addSwitch("sw1", dpid=hex(self._get_next_dpid())[2:])

    def _create_links(self):
        # Creating links
        self.addLink(self.dc1, self.sw1)
        self.addLink(self.dc2, self.sw1)
        self.addLink(self.dc3, self.sw1)
        self.addLink(self.dc4, self.sw1)

    def _create_hostvnf(self):
        # Creating dummy vnfs
        self.vnf1 = self.dc1.startCompute("vnf1",
                                          network=[{
                                              'id': 'intf1',
                                              'ip': '10.0.10.1/24'
                                          }])
        self.vnf2 = self.dc2.startCompute("vnf2",
                                          network=[{
                                              'id': 'intf1',
                                              'ip': '10.0.10.2/24'
                                          }],
                                          flavor_name='small')
        self.vnf3 = self.dc3.startCompute("vnf3",
                                          network=[{
                                              'id': 'intf1',
                                              'ip': '10.0.10.3/24'
                                          }],
                                          flavor_name='medium')
        self.vnf4 = self.dc4.startCompute("vnf4",
                                          network=[{
                                              'id': 'intf1',
                                              'ip': '10.0.10.4/24'
                                          }],
                                          flavor_name='large')

    def _connect_aro(self):
        # Adding to ARO api
        self.aro = Endpoint("0.0.0.0", 2284, DCnetwork=self)
        self.aro.connectVIM(self.dc1)
        self.aro.connectVIM(self.dc2)
        self.aro.connectVIM(self.dc3)
        self.aro.connectVIM(self.dc4)

    def start_topo(self):
        # Starting Topology
        self.start()
        self.aro.start()

    def stop_topo(self):
        # Stoping Topology
        self.aro.stop()
        self.stop()
Beispiel #9
0
class Topology(DCNetwork):
    def __init__(self):
        super(Topology, self).__init__(monitor=False, enable_learning=True)

    def setup_topo(self):
        self._create_dcs()
        # self._create_switches()
        self._create_links()
        self._create_openstack_api_endpoints()
        self._connect_aro()
        # self._create_hostvnf()
        self._create_vnf()

    def _create_dcs(self):
        rm = ARORM(max_cu=32, max_mu=8192)

        self.dc1 = self.addDatacenter("dc1")
        self.dc1.assignResourceModel(rm)

        self.dc2 = self.addDatacenter("dc2")
        self.dc2.assignResourceModel(rm)

    def _create_links(self):
        self.addLink(self.dc1, self.dc2)

    def _create_hostvnf(self):
        self.hostvnf1 = self.dc1.startCompute('hostvnf1',
                                              network=[{
                                                  'id': 'intf1',
                                                  'ip': '10.0.10.1/24'
                                              }],
                                              flavor_name='medium')
        self.hostvnf2 = self.dc2.startCompute('hostvnf2',
                                              network=[{
                                                  'id': 'intf1',
                                                  'ip': '10.0.10.2/24'
                                              }],
                                              flavor_name='medium')

    def _create_vnf(self):
        placement = RoundRobinDC()

        self.vnf1 = placevnf('vnf1',
                             network=[{
                                 'id': 'intf1',
                                 'ip': '10.0.10.1/24'
                             }],
                             flavor_name='medium',
                             placement=placement)
        self.vnf2 = placevnf('vnf2',
                             network=[{
                                 'id': 'intf1',
                                 'ip': '10.0.10.2/24'
                             }],
                             flavor_name='medium',
                             placement=placement)
        self.vnf3 = placevnf('vnf3',
                             network=[{
                                 'id': 'intf1',
                                 'ip': '10.0.10.3/24'
                             }],
                             flavor_name='medium',
                             placement=placement)
        self.vnf4 = placevnf('vnf4',
                             network=[{
                                 'id': 'intf1',
                                 'ip': '10.0.10.4/24'
                             }],
                             flavor_name='medium',
                             placement=placement)

    def _create_openstack_api_endpoints(self):
        self.api1 = OpenstackApiEndpoint("172.31.255.1", 6001)
        self.api1.connect_dc_network(self)
        self.api1.connect_datacenter(self.dc1)

        self.api2 = OpenstackApiEndpoint("172.31.255.1", 6002)
        self.api2.connect_dc_network(self)
        self.api2.connect_datacenter(self.dc2)

    def _connect_aro(self):
        self.aro = Endpoint("0.0.0.0", 2284, DCnetwork=self)
        self.aro.connectVIM(self.dc1)
        self.aro.connectVIM(self.dc2)

    def start_topo(self):
        self.start()
        self.api1.start()
        self.api2.start()
        self.aro.start()

    def stop_topo(self):
        self.aro.stop()
        # self.api1.stop()
        # self.api2.stop()
        self.stop()