def setUp(self):

        self.droplets = {
            "d2":
            droplet("d2",
                    droplet_type="linux",
                    control_ip='10.0.0.104',
                    benchmark=True,
                    phy_itf='enp2s0f0'),
            "d3":
            droplet("d3",
                    droplet_type="linux",
                    control_ip='10.0.0.180',
                    benchmark=True,
                    phy_itf='enp2s0f0'),
        }

        c = controller(self.droplets)

        self.endpoints = []

        c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        c.create_network(3, 1, cidr("16", "10.0.0.0"), ["d2"])

        self.ep0 = c.create_simple_endpoint(3, 1, "10.0.0.2", "d2")
        self.ep1 = c.create_simple_endpoint(3, 1, "10.0.0.3", "d3")
示例#2
0
    def setUp(self):

        self.droplets = {
            "d0": droplet("d0"),
            "d1": droplet("d1"),
            "d2": droplet("d2"),
            "d3": droplet("d3"),
            "d4": droplet("d4"),
            "d5": droplet("d5"),
            "d6": droplet("d6")
        }
        self.c = controller(self.droplets)

        self.c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        self.c.create_network(3, 1, cidr("16", "10.0.0.0"), ["d0"])
        self.ep0 = self.c.create_simple_endpoint(3, 1, "10.0.0.2", "d0")
        self.ep1 = self.c.create_simple_endpoint(3, 1, "10.0.0.3", "d2")
        self.ep2 = self.c.create_simple_endpoint(3, 1, "10.0.0.4", "d3")
        self.ep3 = self.c.create_simple_endpoint(3, 1, "10.0.0.5", "d4")
        self.ep4 = self.c.create_simple_endpoint(3, 1, "10.0.0.6", "d5")
        self.ep5 = self.c.create_simple_endpoint(3, 1, "10.0.0.7", "d6")

        self.sep_backend = [self.ep1, self.ep2, self.ep3, self.ep4, self.ep5]
        self.sep = self.c.create_scaled_endpoint(3, 1, "10.0.0.8",
                                                 self.sep_backend)
    def setUp(self):

        self.droplets = {
            "d1": droplet("d1"),
            "d2": droplet("d2"),
            "switch-1": droplet("switch-1"),
            "router-1": droplet("router-1")
        }

        c = controller(self.droplets)

        # Create two co-hosted VPCs each with one endpoint
        c.create_vpc(3, cidr("16", "10.0.0.0"), ["router-1"])
        c.create_network(3, 10, cidr("24", "10.0.0.0"), ["switch-1"])
        self.ep1 = c.create_simple_endpoint(3, 10, "10.0.0.2", "d1")

        c.create_vpc(4, cidr("16", "20.0.0.0"), ["router-1"])
        c.create_network(4, 20, cidr("24", "20.0.0.0"), ["switch-1"])
        self.ep5 = c.create_simple_endpoint(4, 20, "20.0.0.2", "d1")

        # Delete their networks
        c.delete_network(3, 10)
        c.delete_network(4, 20)

        # Recreate the networks and endpoints
        c.create_network(3, 10, cidr("24", "10.0.0.0"), ["switch-1"])
        c.create_network(4, 20, cidr("24", "20.0.0.0"), ["switch-1"])

        self.ep1 = c.create_simple_endpoint(3, 10, "10.0.0.2", "d1")
        self.ep5 = c.create_simple_endpoint(4, 20, "20.0.0.2", "d1")

        # Delete the VPC
        c.delete_vpc(4)
        c.delete_vpc(3)
    def setUp(self):

        self.droplets = {
            "d1":
            droplet("d1",
                    droplet_type="linux",
                    control_ip='10.0.0.104',
                    benchmark=True,
                    phy_itf='enp2s0f0'),
            "d2":
            droplet("d2",
                    droplet_type="linux",
                    control_ip='10.0.0.180',
                    benchmark=True,
                    phy_itf='enp2s0f0'),
            "d3":
            droplet("d3",
                    droplet_type="linux",
                    control_ip='10.0.0.45',
                    benchmark=True,
                    phy_itf='enp2s0f0'),
        }

        c = controller(self.droplets)

        self.endpoints = []

        c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        net = c.create_network(3, 1, cidr("16", "10.0.0.0"), ["d1"])

        for i in range(2, 101):
            c.create_vxlan_endpoint(3, 1, "10.0.0." + str(i), "d2")
示例#5
0
    def setUp(self):
        self.droplets = {
            "left": droplet("left"),
            "right": droplet("right"),
            "switch": droplet("switch")
        }
        c = controller(self.droplets)

        c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        c.create_network(3, 1, cidr("24", "10.0.0.0"), ["switch"])
        self.ep_left = c.create_simple_endpoint(3, 1, "10.0.0.2", "left")
        self.ep_right = c.create_simple_endpoint(3, 1, "10.0.0.3", "right")
示例#6
0
    def setUp(self):
        # Testing the following basic scenario
        #
        # +------------+      +------------+
        # |    Left    |      |   Right    |
        # | +--------+ |      | +--------+ |
        # | |  ns0   | |      | |  ns1   | |
        # | |        | |      | |        | |
        # | +--------+ |      | +--------+ |
        # | | veth0  | |      | | veth0  | |
        # | |10.0.0.1| |      | |10.0.0.2| |
        # | +--------+ |      | +--------+ |
        # |      |     |      |      |     |
        # |      |     |      |      |     |
        # |      |     |      |      |     |
        # | +--------+ |      | +--------+ |
        # | |Transit | |      | |Transit | |
        # | | Agent  | |      | | Agent  | |
        # | | peer0  | |      | | peer1  | |
        # | +--------+ |      | +--------+ |
        # +------------+      +------------+
        # |Transit XDP |      |Transit XDP |
        # |    eth0    |      |    eth0    |
        # +------------+      +------------+
        #        |                   |
        #        |   +------------+  |
        #        |   |   Switch   |  |
        #        |   |            |  |
        #        +---+------------+--+
        #            |Transit XDP |
        #            |    eth0    |
        #            +------------+

        self.droplets = {
            "left": droplet("left"),
            "right": droplet("right"),
            "switch": droplet("switch"),
        }
        c = controller(self.droplets)

        c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        c.create_network(3, 1, cidr("16", "10.0.0.0"), ["switch"])

        c.create_vpc(4, cidr("16", "20.0.0.0"), [])
        c.create_network(4, 2, cidr("16", "20.0.0.0"), ["switch"])

        self.ep1 = c.create_simple_endpoint(3, 1, "10.0.0.2", "left")
        self.ep2 = c.create_simple_endpoint(4, 2, "20.0.0.2", "left")

        self.ep3 = c.create_simple_endpoint(3, 1, "10.0.0.3", "right")
        self.ep4 = c.create_simple_endpoint(4, 2, "20.0.0.3", "right")
示例#7
0
    def setUp(self):
        # Testing the following basic scenario
        #
        # +------------+      +------------+
        # |    Left    |      |   Right    |
        # | +--------+ |      | +--------+ |
        # | |  ns0   | |      | |  ns1   | |
        # | |        | |      | |        | |
        # | +--------+ |      | +--------+ |
        # | | veth0  | |      | | veth0  | |
        # | |10.0.0.1| |      | |10.0.0.2| |
        # | +--------+ |      | +--------+ |
        # |      |     |      |      |     |
        # |      |     |      |      |     |
        # |      |     |      |      |     |
        # | +--------+ |      | +--------+ |
        # | |Transit | |      | |Transit | |
        # | | Agent  | |      | | Agent  | |
        # | | peer0  | |      | | peer1  | |
        # | +--------+ |      | +--------+ |
        # +------------+      +------------+
        # |Transit XDP |      |Transit XDP |
        # |    eth0    |      |    eth0    |
        # +------------+      +------------+
        #        |                   |
        #        |   +------------+  |
        #        |   |   Switch   |  |
        #        |   |            |  |
        #        +---+------------+--+
        #            |Transit XDP |
        #            |    eth0    |
        #            +------------+
        self.droplets = {
            "d0": droplet("d0"),
            "d1": droplet("d1"),
            "d2": droplet("d2"),
            "d3": droplet("d3"),
            "d4": droplet("d4"),
            "d5": droplet("d5")
        }
        self.c = controller(self.droplets)

        self.c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        self.c.create_network(3, 1, cidr("16", "10.0.0.0"), ["d0"])
        self.ep0 = self.c.create_simple_endpoint(3, 1, "10.0.0.2", "d0")
        self.ep1 = self.c.create_simple_endpoint(3, 1, "10.0.0.3", "d1")
        self.ep2 = self.c.create_simple_endpoint(3, 1, "10.0.0.4", "d2")
        self.ep3 = self.c.create_simple_endpoint(3, 1, "10.0.0.5", "d3")

        self.sep = self.c.create_scaled_endpoint(3, 1, "10.0.0.6", [self.ep2])
    def setUp(self):
        # Testing the basic scenario with multiple switches
        # +------------+     +------------+
        # |    left    |     |   right    |
        # | +--------+ |     | +--------+ |
        # | |  ns0   | |     | |  ns1   | |
        # | |        | |     | |        | |
        # | +--------+ |     | +--------+ |
        # | | veth0  | |     | | veth0  | |
        # | |10.0.0.1| |     | |10.0.0.2| |
        # | +--------+ |     | +--------+ |
        # |      |     |     |      |     |
        # |      |     |     |      |     |
        # |      |     |     |      |     |
        # | +--------+ |     | +--------+ |
        # | |Transit | |     | |Transit | |
        # | | Agent  | |     | | Agent  | |
        # | | peer0  | |     | | peer1  | |
        # | +--------+ |     | +--------+ |
        # +------------+     +------------+
        # |Transit XDP |     |Transit XDP |
        # |    eth0    |     |    eth0    |
        # +------------+     +------------+
        #        |                  ^
        #        |  +----------+    |
        #        |  | Switch1  |    |
        #        |  |  +-------+--+ |
        #        +->|  | Switch2  | |
        #           |  |          | |
        #           +--+          |-+
        #              |          |
        #              +----------+

        self.droplets = {
            "left": droplet("left"),
            "right": droplet("right"),
            "switch-1": droplet("switch-1"),
            "switch-2": droplet("switch-2")
        }
        c = controller(self.droplets)

        c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        c.create_network(3, 1, cidr("16", "10.0.0.0"),
                         ["switch-1", "switch-2"])
        self.ep_left = c.create_simple_endpoint(3, 1, "10.0.0.2", "left")
        self.ep_right = c.create_simple_endpoint(3, 1, "10.0.0.3", "right")

        self.ep_vxlan_left = c.create_vxlan_endpoint(3, 1, "10.0.0.4", "left")
        self.ep_vxlan_right = c.create_vxlan_endpoint(3, 1, "10.0.0.5",
                                                      "right")
示例#9
0
    def setUp(self):
        # Testing the following basic scenario
        #
        # +------------+      +------------+
        # |    Left    |      |   Right    |
        # | +--------+ |      | +--------+ |
        # | |  ns0   | |      | |  ns1   | |
        # | |        | |      | |        | |
        # | +--------+ |      | +--------+ |
        # | | veth0  | |      | | veth0  | |
        # | |10.0.0.1| |      | |10.0.0.2| |
        # | +--------+ |      | +--------+ |
        # |      |     |      |      |     |
        # |      |     |      |      |     |
        # |      |     |      |      |     |
        # | +--------+ |      | +--------+ |
        # | |Transit | |      | |Transit | |
        # | | Agent  | |      | | Agent  | |
        # | | peer0  | |      | | peer1  | |
        # | +--------+ |      | +--------+ |
        # +------------+      +------------+
        # |Transit XDP |      |Transit XDP |
        # |    eth0    |      |    eth0    |
        # +------------+      +------------+
        #        |                   |
        #        |   +------------+  |
        #        |   |   Switch   |  |
        #        |   |            |  |
        #        +---+------------+--+
        #            |Transit XDP |
        #            |    eth0    |
        #            +------------+
        self.droplets = {
            "left": droplet("left"),
            "right": droplet("right"),
            "switch": droplet("switch"),
        }
        self.c = controller(self.droplets)

        self.c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        self.c.create_network(3, 1, cidr("16", "10.0.0.0"), ["switch"])
        self.ep_right = self.c.create_simple_endpoint(3, 1, "10.0.0.3",
                                                      "right")
        # Clear all droplet update state before we create and delete ep_left
        self.droplets["switch"].clear_update_call_state()
        self.droplets["right"].clear_update_call_state()

        self.ep_left = self.c.create_simple_endpoint(3, 1, "10.0.0.2", "left")
        self.ep_left = self.c.delete_simple_endpoint(3, 1, "10.0.0.2")
示例#10
0
    def setUp(self):
        # Testing the following basic scenario
        #
        # +------------+      +------------+
        # |    Left    |      |   Right    |
        # | +--------+ |      | +--------+ |
        # | |  ns0   | |      | |  ns1   | |
        # | |        | |      | |        | |
        # | +--------+ |      | +--------+ |
        # | | veth0  | |      | | veth0  | |
        # | |10.0.0.1| |      | |10.0.0.2| |
        # | +--------+ |      | +--------+ |
        # |      |     |      |      |     |
        # |      |     |      |      |     |
        # |      |     |      |      |     |
        # | +--------+ |      | +--------+ |
        # | |Transit | |      | |Transit | |
        # | | Agent  | |      | | Agent  | |
        # | | peer0  | |      | | peer1  | |
        # | +--------+ |      | +--------+ |
        # +------------+      +------------+
        # |Transit XDP |      |Transit XDP |
        # |    eth0    |      |    eth0    |
        # +------------+      +------------+
        #        |                   |
        #        |   +------------+  |
        #        |   |   Switch   |  |
        #        |   |            |  |
        #        +---+------------+--+
        #            |Transit XDP |
        #            |    eth0    |
        #            +------------+
        self.droplets = {
            "left": droplet("left"),
            "right": droplet("right"),
            "switch": droplet("switch"),
        }
        self.c = controller(self.droplets)

        self.c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        self.c.create_network(3, 1, cidr("16", "10.0.0.0"), ["switch"])
        self.ep_left = self.c.create_simple_endpoint(3, 1, "10.0.0.2", "left")
        self.ep_right = self.c.create_simple_endpoint(
            3, 1, "10.0.0.3", "right")

        # Delete ep_left and create a ep_new in its place with a different IP
        self.ep_left = self.c.delete_simple_endpoint(3, 1, "10.0.0.2")
        self.ep_new = self.c.create_simple_endpoint(3, 1, "10.0.0.4", "left")
示例#11
0
    def setUp(self):

        self.droplets = {
            "d1": droplet("d1"),
            "d2": droplet("d2"),
            "d3": droplet("d3"),
            "d4": droplet("d4"),
            "d5": droplet("d5"),
            "d6": droplet("d6"), }

        self.c = controller(self.droplets)
        self.c.create_vpc(3, cidr("16", "10.0.0.0"), ["d1"])
        self.c.create_network(3, 10, cidr("24", "10.0.0.0"), ["d2"])
        self.c.create_network(3, 20, cidr("24", "10.0.20.0"), ["d3"])

        self.ep1 = self.c.create_simple_endpoint(3, 10, "10.0.0.2", "d4")
        self.ep2 = self.c.create_simple_endpoint(3, 20, "10.0.20.2", "d5")
        self.ep_host = self.c.create_host_endpoint(3, 10, "10.0.0.3", "d6")
示例#12
0
    def setUp(self):
        self.droplets = {
            "switch1": droplet("switch1"),
            "router1": droplet("router1"),
            "d1": droplet("d1"),
            "d2": droplet("d2"),
            "d3": droplet("d3")
        }
        self.c = controller(self.droplets)

        self.c.create_vpc(3, cidr("16", "10.0.0.0"), ["router1"])
        self.c.create_network(3, 1, cidr("24", "10.0.0.0"), ["switch1"])
        self.ep0 = self.c.create_simple_endpoint(3, 1, "10.0.0.2", "switch1")
        self.ep1 = self.c.create_simple_endpoint(3, 1, "10.0.0.3", "d2")
        self.ep2 = self.c.create_simple_endpoint(3, 1, "10.0.0.4", "d3")

        self.sep_backend = [self.ep1, self.ep2]
        self.sep = self.c.create_scaled_endpoint(3, 1, "10.0.0.5",
                                                 self.sep_backend)
示例#13
0
    def setUp(self):

        self.droplets = {
            "d1": droplet("d1", droplet_type="linux", control_ip='172.31.30.230', benchmark=False, phy_itf='eth0'),
            "d2": droplet("d2", droplet_type="linux", control_ip='172.31.30.6', benchmark=False, phy_itf='eth0'),
            "d3": droplet("d3", droplet_type="linux", control_ip='172.31.29.230', benchmark=False, phy_itf='eth0'),
            "d4": droplet("d4", droplet_type="linux", control_ip='172.31.21.76', benchmark=False, phy_itf='eth0'), }

        c = controller(self.droplets)

        self.endpoints = []

        c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        c.create_network(3, 1, cidr("16", "10.0.0.0"), ["d1"])

        c.create_simple_endpoint(3, 1, "10.0.0.2", "d2")
        c.create_simple_endpoint(3, 1, "10.0.0.3", "d3")
        c.create_host_endpoint(3, 1, "172.31.21.76", "d4")
        while(True):
            sleep(100000)
示例#14
0
    def setUp(self):

        self.droplets = {
            "d1": droplet("d1"),
            "d2": droplet("d2"),
            "d3": droplet("d3"),
            "d4": droplet("d4"),
            "d5": droplet("d5"),
            "switch-1": droplet("switch-1"),
            "switch-4": droplet("switch-4"),
            "router-1": droplet("router-1"),
            "router-2": droplet("router-2"),
        }

        self.c = controller(self.droplets)

        self.c.create_vpc(3, cidr("16", "10.0.0.0"),
                          ["router-1", "router-2", "d5"])

        self.c.create_network(3, 10, cidr("24", "10.0.0.0"),
                              ["switch-1", "d3", "d5"])

        self.c.create_network(3, 20, cidr("24", "10.20.0.0"),
                              ["switch-4", "d2", "d5"])

        self.ep1 = self.c.create_simple_endpoint(3, 10, "10.0.0.2", "d1")
        self.ep2 = self.c.create_simple_endpoint(3, 10, "10.0.0.3", "d2")

        self.ep3 = self.c.create_simple_endpoint(3, 20, "10.20.0.4", "d3")
        self.ep4 = self.c.create_simple_endpoint(3, 20, "10.20.0.5", "d4")
        self.ep5 = self.c.create_simple_endpoint(3, 20, "10.20.0.6", "d4")
        self.ep6 = self.c.create_simple_endpoint(3, 20, "10.20.0.7", "d5")
        self.ep7 = self.c.create_simple_endpoint(3, 20, "10.20.0.8",
                                                 "router-1")
        self.ep8 = self.c.create_simple_endpoint(3, 20, "10.20.0.9",
                                                 "router-2")
        self.ep7 = self.c.create_simple_endpoint(3, 20, "10.20.0.10",
                                                 "switch-1")
        self.ep8 = self.c.create_simple_endpoint(3, 20, "10.20.0.11",
                                                 "switch-4")
        self.c.delete_vpc(3)
示例#15
0
    def setUp(self):
        # Testing the following basic scenario
        # +-------------------------+       +-------------------------+
        # |           left          |       |   right (and switch)    |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # | |  ns0   |   |  ns2   | |       | |  ns1   |   |  ns3   | |
        # | |        |   |        | |       | |        |   |        | |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # | | veth0  |   | veth0  | |       | | veth0  |   | veth0  | |
        # | |10.0.0.1|   |10.0.0.3| |       | |10.0.0.2|   |10.0.0.4| |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # |      |            |     |       |      |            |     |
        # |      |            |     |       |      |            |     |
        # |      |            |     |       |      |            |     |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # | |Transit |   |Transit | |       | |Transit |   |Transit | |
        # | | Agent  |   | Agent  | |       | | Agent  |   | Agent  | |
        # | | peer0  |   | peer2  | |       | | peer1  |   | peer3  | |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # +-------------------------+       +-------------------------+
        # |       Transit XDP       |       |       Transit XDP       |
        # |          eth0           |       |  eth0 (Switch is here)  |
        # +-------------------------+       +-------------------------+

        self.droplets = {
            "left": droplet("left"),
            "right": droplet("right"),
        }
        c = controller(self.droplets)

        c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        c.create_network(3, 1, cidr("16", "10.0.0.0"), ["right"])

        self.ep0 = c.create_simple_endpoint(3, 1, "10.0.0.2", "left")
        print("######## epip {}".format(self.ep0.ip))
        self.ep1 = c.create_simple_endpoint(3, 1, "10.0.0.4", "left")
        self.ep2 = c.create_simple_endpoint(3, 1, "10.0.0.3", "right")
        self.ep3 = c.create_simple_endpoint(3, 1, "10.0.0.5", "right")
示例#16
0
    def setUp(self):

        self.droplets = {
            "d1":
            droplet("d1",
                    droplet_type="linux",
                    control_ip='172.31.47.2',
                    phy_itf='ens5'),
            "d2":
            droplet("d2",
                    droplet_type="linux",
                    control_ip='172.31.35.238',
                    phy_itf='ens5'),
        }

        c = controller(self.droplets)

        c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        net = c.create_network(3, 1, cidr("16", "10.0.0.0"), ["d1"])

        self.ep_left = c.create_simple_endpoint(3, 1, "10.0.0.2", "d1")
        self.ep_right = c.create_simple_endpoint(3, 1, "10.0.0.3", "d2")
        self.ep_left.host.attach_vm(self.ep_left)
示例#17
0
    def setUp(self):
        # Testing the following multiple subnetwork scenario
        # +------------+      +------------+        +------------+      +------------+
        # |     D1     |      |     D2     |        |     D3     |      |     D4     |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | |  ns1   | |      | |  ns2   | |        | |  ns3   | |      | |  ns4   | |
        # | |        | |      | |        | |        | |        | |      | |        | |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | | veth0  | |      | | veth0  | |        | | veth0  | |      | | veth0  | |
        # | |10.0.0.1| |      | |10.0.0.2| |        | |20.0.0.1| |      | |20.0.0.2| |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | |Transit | |      | |Transit | |        | |Transit | |      | |Transit | |
        # | | Agent  | |      | | Agent  | |        | | Agent  | |      | | Agent  | |
        # | | peer1  | |      | | peer2  | |        | | peer3  | |      | | peer4  | |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # +------------+      +------------+        +------------+      +------------+
        # |Transit XDP |      |Transit XDP |        |Transit XDP |      |Transit XDP |
        # |    eth0    |      |    eth0    |        |    eth0    |      |    eth0    |
        # +------------+      +------------+        +------------+      +------------+
        #       |                   |                     |                   |
        #       |   +------------+  |                     |   +------------+  |
        #       |   |  Switch1   |  |                     |   |  Switch2   |  |
        #       |   |10.0.0.0/16 |  |                     |   |20.0.0.0/16 |  |
        #       |   |            |  |                     |   |            |  |
        #       |   |            |  |                     |   |            |  |
        #       |   |            |  |                     |   |            |  |
        #       +---|            |--+                     +---|            |--+
        #           |            |                            |            |
        #           |            |                            |            |
        #           +------------+                            +------------+
        #           |Transit XDP |                            |Transit XDP |
        #           |    eth0    |                            |    eth0    |
        #           +------------+                            +------------+
        #                  |              +------------+             |
        #                  |              |  Router1   |             |
        #                  |              |    VPC3    |             |
        #                  |              |            |             |
        #                  |              |            |             |
        #                  |              |            |             |
        #                  +--------------|            |-------------+
        #                                 |            |
        #                                 |            |
        #                                 +------------+
        #                                 |Transit XDP |
        #                                 |    eth0    |
        #                                 +------------+

        self.droplets = {
            "d1": droplet("d1"),
            "d2": droplet("d2"),
            "d3": droplet("d3"),
            "d4": droplet("d4"),
            "switch-1": droplet("switch-1"),
            "switch-2": droplet("switch-2"),
            "router-1": droplet("router-1")
        }

        c = controller(self.droplets)

        c.create_vpc(3, cidr("16", "10.0.0.0"), ["router-1"])
        c.create_network(3, 10, cidr("24", "10.0.0.0"), ["switch-1"])
        c.create_network(3, 20, cidr("24", "10.20.0.0"), ["switch-2"])

        self.ep1 = c.create_simple_endpoint(3, 10, "10.0.0.2", "d1")
        self.ep2 = c.create_simple_endpoint(3, 10, "10.0.0.3", "d2")

        self.ep3 = c.create_simple_endpoint(3, 20, "10.20.0.4", "d3")
        self.ep4 = c.create_simple_endpoint(3, 20, "10.20.0.5", "d4")

        # Delete an endpoint in subnet, delete the parent subnet, then parent VPC.
        self.ep3 = c.delete_simple_endpoint(3, 20, "10.20.0.4", "d3")
        c.delete_network(3, 20, cidr("24", "10.20.0.0"), ["switch-2"])
        c.delete_vpc(3, cidr("16", "10.0.0.0"), ["router-1"])
示例#18
0
    def setUp(self):
        # Testing the following basic scenario
        # +-------------------------+       +-------------------------+
        # |           left          |       |   right (and switch)    |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # | |  ns0   |   |  ns2   | |       | |  ns1   |   |  ns3   | |
        # | |        |   |        | |       | |        |   |        | |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # | | veth0  |   | veth0  | |       | | veth0  |   | veth0  | |
        # | |10.0.0.1|   |10.0.0.3| |       | |10.0.0.2|   |10.0.0.4| |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # |      |            |     |       |      |            |     |
        # |      |            |     |       |      |            |     |
        # |      |            |     |       |      |            |     |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # | |Transit |   |Transit | |       | |Transit |   |Transit | |
        # | | Agent  |   | Agent  | |       | | Agent  |   | Agent  | |
        # | | peer0  |   | peer2  | |       | | peer1  |   | peer3  | |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # +-------------------------+       +-------------------------+
        # |       Transit XDP       |       |       Transit XDP       |
        # |          eth0           |       |  eth0 (Switch is here)  |
        # +-------------------------+       +-------------------------+

        open('/dev/shm/update_ep_times.txt', 'w').close()
        n_switches = 4
        self.droplets = {
            "d0": droplet("d0", benchmark=True),
            "d1": droplet("d1", benchmark=True),
        }
        c = controller(self.droplets)

        switches = []
        for i in range(n_switches - 1):
            name = "d" + str(i+2)
            switches.append(name)
            self.droplets[name] = droplet(
                name, benchmark=True)

        c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        net = c.create_network(3, 1, cidr("16", "10.0.0.0"), switches)

        self.endpoints = []

        n_endpoints = 10

        start = datetime.datetime.now()
        for i in range(2, n_endpoints, 2):
            c.create_simple_endpoint(3, 1, "10.0.0." + str(i), "d0")
            c.create_simple_endpoint(3, 1, "10.0.0." + str(i + 1), "d1")
        end = datetime.datetime.now()

        t = end - start
        a = t * 1.0 / n_endpoints

        print("################# Provisioned in: {}, avg: {}".format(t, a))
        output = open("/dev/shm/update_ep_times.txt", "r")
        updates = output.read().split('###')
        updates.pop(0)
        delta_sum = 0
        for update in updates:
            lines = update.split("\n")
            lines.pop(len(lines) - 1)
            lines.sort()
            first = float(lines[0])
            last = float(lines[len(lines) - 1])
            delta = last - first
            print("delta between each update for every ep " +
                  str(delta) + "seconds")
            delta_sum += delta
        print("Total delta is " + str(delta_sum) + "seconds")
    def setUp(self):
        # Testing the following multiple subnetwork scenario
        # +------------+      +------------+        +------------+      +------------+
        # |     D1     |      |     D2     |        |     D3     |      |     D4     |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | |  ns1   | |      | |  ns2   | |        | |  ns3   | |      | |  ns4   | |
        # | |        | |      | |        | |        | |        | |      | |        | |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | | veth0  | |      | | veth0  | |        | | veth0  | |      | | veth0  | |
        # | |10.0.0.1| |      | |10.0.0.2| |        | |20.0.0.1| |      | |20.0.0.2| |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | |Transit | |      | |Transit | |        | |Transit | |      | |Transit | |
        # | | Agent  | |      | | Agent  | |        | | Agent  | |      | | Agent  | |
        # | | peer1  | |      | | peer2  | |        | | peer3  | |      | | peer4  | |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # +------------+      +------------+        +------------+      +------------+
        # |Transit XDP |      |Transit XDP |        |Transit XDP |      |Transit XDP |
        # |    eth0    |      |    eth0    |        |    eth0    |      |    eth0    |
        # +------------+      +------------+        +------------+      +------------+
        #       |                   |                     |                   |
        #       |   +------------+  |                     |   +------------+  |
        #       |   |  Switch1   |  |                     |   |  Switch4   |  |
        #       |   |  Switch2   |  |                     |   |  Switch5   |  |
        #       |   |  Switch3   |  |                     |   |  Switch6   |  |
        #       |   |10.0.0.0/16 |  |                     |   |20.0.0.0/16 |  |
        #       |   |            |  |                     |   |            |  |
        #       +---|            |--+                     +---|            |--+
        #           |            |                            |            |
        #           |            |                            |            |
        #           +------------+                            +------------+
        #           |Transit XDP |                            |Transit XDP |
        #           |    eth0    |                            |    eth0    |
        #           +------------+                            +------------+
        #                  |              +------------+             |
        #                  |              |  Router1   |             |
        #                  |              |  Router2   |             |
        #                  |              |  Router3   |             |
        #                  |              |            |             |
        #                  |              |    VPC3    |             |
        #                  +--------------|            |-------------+
        #                                 |            |
        #                                 |            |
        #                                 +------------+
        #                                 |Transit XDP |
        #                                 |    eth0    |
        #                                 +------------+

        # a. Switch 3, Switch6 and Router3 are all hosted on the same
        # host
        # b. Switch 2 is hosted on D3
        # c. Switch 5 is hosted on D2

        self.droplets = {
            "d1": droplet("d1"),
            "d2": droplet("d2"),
            "d3": droplet("d3"),
            "d4": droplet("d4"),
            "d5": droplet("d5"),
            "switch-1": droplet("switch-1"),
            "switch-4": droplet("switch-4"),
            "router-1": droplet("router-1"),
            "router-2": droplet("router-2"),
        }

        c = controller(self.droplets)

        c.create_vpc(3, cidr("16", "10.0.0.0"), ["router-1", "router-2", "d5"])

        c.create_network(3, 10, cidr("24", "10.0.0.0"),
                         ["switch-1", "d3", "d5"])

        c.create_network(3, 20, cidr("24", "10.20.0.0"),
                         ["switch-4", "d2", "d5"])

        self.ep1 = c.create_simple_endpoint(3, 10, "10.0.0.2", "d1")
        self.ep2 = c.create_simple_endpoint(3, 10, "10.0.0.3", "d2")

        self.ep3 = c.create_simple_endpoint(3, 20, "10.20.0.4", "d3")
        self.ep4 = c.create_simple_endpoint(3, 20, "10.20.0.5", "d4")
        self.ep5 = c.create_simple_endpoint(3, 20, "10.20.0.6", "d4")
        self.ep6 = c.create_simple_endpoint(3, 20, "10.20.0.7", "d5")
        self.ep7 = c.create_simple_endpoint(3, 20, "10.20.0.8", "router-1")
        self.ep8 = c.create_simple_endpoint(3, 20, "10.20.0.9", "router-2")
        self.ep7 = c.create_simple_endpoint(3, 20, "10.20.0.10", "switch-1")
        self.ep8 = c.create_simple_endpoint(3, 20, "10.20.0.11", "switch-4")
        c.delete_vpc(3, cidr("16", "10.0.0.0"), ["router-1", "router-2", "d5"])
        for d in self.droplets.values():
            d.dump_rpc_calls()
            print()
    def setUp(self):
        # Testing the following basic scenario
        # +-------------------------+       +-------------------------+
        # |           left          |       |   right (and switch)    |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # | |  ns0   |   |  ns2   | |       | |  ns1   |   |  ns3   | |
        # | |        |   |        | |       | |        |   |        | |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # | | veth0  |   | veth0  | |       | | veth0  |   | veth0  | |
        # | |10.0.0.1|   |10.0.0.3| |       | |10.0.0.2|   |10.0.0.4| |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # |      |            |     |       |      |            |     |
        # |      |            |     |       |      |            |     |
        # |      |            |     |       |      |            |     |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # | |Transit |   |Transit | |       | |Transit |   |Transit | |
        # | | Agent  |   | Agent  | |       | | Agent  |   | Agent  | |
        # | | peer0  |   | peer2  | |       | | peer1  |   | peer3  | |
        # | +--------+   +--------+ |       | +--------+   +--------+ |
        # +-------------------------+       +-------------------------+
        # |       Transit XDP       |       |       Transit XDP       |
        # |          eth0           |       |  eth0 (Switch is here)  |
        # +-------------------------+       +-------------------------+

        n_switches = 10
        self.droplets = {
            "d1":
            droplet("d1",
                    droplet_type="linux",
                    control_ip='10.0.0.194',
                    benchmark=True,
                    phy_itf='eth0'),
            # "d2": droplet("d2", droplet_type="linux", control_ip='10.0.0.92', benchmark=True, phy_itf='eth0'),
            # "d3": droplet("d3", droplet_type="linux", control_ip='10.0.0.62', benchmark=True, phy_itf='eth0'),
            # "d4": droplet("d4", droplet_type="linux", control_ip='10.0.0.183', benchmark=True, phy_itf='eth0'),
            # "d5": droplet("d5", droplet_type="linux", control_ip='10.0.0.89', benchmark=True, phy_itf='eth0'),
            # "d6": droplet("d6", droplet_type="linux", control_ip='10.0.0.215', benchmark=True, phy_itf='eth0'),
            # "d7": droplet("d7", droplet_type="linux", control_ip='10.0.0.145', benchmark=True, phy_itf='eth0'),
            # "d8": droplet("d8", droplet_type="linux", control_ip='10.0.0.97', benchmark=True, phy_itf='eth0'),
            # "d9": droplet("d9", droplet_type="linux", control_ip='10.0.0.9', benchmark=True, phy_itf='eth0'),
            # "d10": droplet("d10", droplet_type="linux", control_ip='10.0.0.151', benchmark=True, phy_itf='eth0'),
            "d11":
            droplet("d11",
                    droplet_type="linux",
                    control_ip='10.0.0.181',
                    benchmark=True,
                    phy_itf='eth0'),
            "d12":
            droplet("d12",
                    droplet_type="linux",
                    control_ip='10.0.0.204',
                    benchmark=True,
                    phy_itf='eth0'),
        }
        c = controller(self.droplets)

        switches = []
        # for i in range(1,n_switches):
        #    name = "d" + str(i)
        #    switches.append(name)
        switches.append("d1")
        # switches.append("d2")
        # switches.append("d3")
        # switches.append("d4")
        # switches.append("d5")
        # switches.append("d6")
        # switches.append("d7")
        # switches.append("d8")
        # switches.append("d9")
        # switches.append("d10")
        c.create_vpc(3, cidr("16", "10.0.0.0"), [])
        net = c.create_network(3, 1, cidr("16", "10.0.0.0"), switches)

        self.endpoints = []

        n_endpoints = 10

        start = datetime.datetime.now()
        for i in range(2, n_endpoints, 2):
            c.create_simple_endpoint(3, 1, "10.0.0." + str(i), "d11")
            c.create_simple_endpoint(3, 1, "10.0.0." + str(i + 1), "d12")
        end = datetime.datetime.now()

        t = end - start
        a = t * 1.0 / n_endpoints

        print("################# Provisioned in: {}, avg: {}".format(t, a))
示例#21
0
    def setUp(self):
        # Testing the following multiple subnetwork scenario, while
        # adding switchs and routers during connection
        # +------------+      +------------+        +------------+      +------------+
        # |     D1     |      |     D2     |        |     D3     |      |     D4     |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | |  ns1   | |      | |  ns2   | |        | |  ns3   | |      | |  ns4   | |
        # | |        | |      | |        | |        | |        | |      | |        | |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | | veth0  | |      | | veth0  | |        | | veth0  | |      | | veth0  | |
        # | |10.0.0.1| |      | |10.0.0.2| |        | |20.0.0.1| |      | |20.0.0.2| |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | |Transit | |      | |Transit | |        | |Transit | |      | |Transit | |
        # | | Agent  | |      | | Agent  | |        | | Agent  | |      | | Agent  | |
        # | | peer1  | |      | | peer2  | |        | | peer3  | |      | | peer4  | |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # +------------+      +------------+        +------------+      +------------+
        # |Transit XDP |      |Transit XDP |        |Transit XDP |      |Transit XDP |
        # |    eth0    |      |    eth0    |        |    eth0    |      |    eth0    |
        # +------------+      +------------+        +------------+      +------------+
        #       |                   |                     |                   |
        #       |   +------------+  |                     |   +------------+  |
        #       |   |  Switch1   |  |                     |   |  Switch4   |  |
        #       |   |  Switch2   |  |                     |   |  Switch5   |  |
        #       |   |  Switch3   |  |                     |   |  Switch6   |  |
        #       |   |10.0.0.0/16 |  |                     |   |20.0.0.0/16 |  |
        #       |   |            |  |                     |   |            |  |
        #       +---|            |--+                     +---|            |--+
        #           |            |                            |            |
        #           |            |                            |            |
        #           +------------+                            +------------+
        #           |Transit XDP |                            |Transit XDP |
        #           |    eth0    |                            |    eth0    |
        #           +------------+                            +------------+
        #                  |              +------------+             |
        #                  |              |  Router1   |             |
        #                  |              |  Router2   |             |
        #                  |              |  Router3   |             |
        #                  |              |            |             |
        #                  |              |    VPC3    |             |
        #                  +--------------|            |-------------+
        #                                 |            |
        #                                 |            |
        #                                 +------------+
        #                                 |Transit XDP |
        #                                 |    eth0    |
        #                                 +------------+

        # a. Switch 3, Switch6 and Router3 are all hosted on the same
        # host
        # b. Switch 2 is hosted on D3
        # c. Switch 5 is hosted on D2

        self.droplets = {
            "d1": droplet("d1"),
            "d2": droplet("d2"),
            "d3": droplet("d3"),
            "d4": droplet("d4"),
            "d5": droplet("d5"),
            "switch-1": droplet("switch-1"),
            "switch-4": droplet("switch-4"),
            "router-1": droplet("router-1"),
            "router-2": droplet("router-2"),
        }

        self.c = controller(self.droplets)

        self.c.create_vpc(3, cidr("16", "10.0.0.0"), ["router-1"])

        self.c.create_network(3, 10, cidr("24", "10.0.0.0"), ["switch-1"])

        self.c.create_network(3, 20, cidr("24", "10.20.0.0"), ["switch-4"])

        self.ep1 = self.c.create_simple_endpoint(3, 10, "10.0.0.2", "d1")
        self.ep2 = self.c.create_simple_endpoint(3, 10, "10.0.0.3", "d2")

        self.ep3 = self.c.create_simple_endpoint(3, 20, "10.20.0.4", "d3")
        self.ep4 = self.c.create_simple_endpoint(3, 20, "10.20.0.5", "d4")
示例#22
0
    def setUp(self):
        # Testing the following multiple subnetwork scenario
        # +------------+      +------------+        +------------+      +------------+
        # |     D1     |      |     D2     |        |     D3     |      |     D4     |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | |  ns1   | |      | |  ns2   | |        | |  ns3   | |      | |  ns4   | |
        # | |        | |      | |        | |        | |        | |      | |        | |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | | veth0  | |      | | veth0  | |        | | veth0  | |      | | veth0  | |
        # | |10.0.0.1| |      | |10.0.0.2| |        | |20.0.0.1| |      | |20.0.0.2| |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # |      |     |      |      |     |        |      |     |      |      |     |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # | |Transit | |      | |Transit | |        | |Transit | |      | |Transit | |
        # | | Agent  | |      | | Agent  | |        | | Agent  | |      | | Agent  | |
        # | | peer1  | |      | | peer2  | |        | | peer3  | |      | | peer4  | |
        # | +--------+ |      | +--------+ |        | +--------+ |      | +--------+ |
        # +------------+      +------------+        +------------+      +------------+
        # |Transit XDP |      |Transit XDP |        |Transit XDP |      |Transit XDP |
        # |    eth0    |      |    eth0    |        |    eth0    |      |    eth0    |
        # +------------+      +------------+        +------------+      +------------+
        #       |                   |                     |                   |
        #       |   +------------+  |                     |   +------------+  |
        #       |   |  Switch1   |  |                     |   |  Switch2   |  |
        #       |   |10.0.0.0/16 |  |                     |   |20.0.0.0/16 |  |
        #       |   |            |  |                     |   |            |  |
        #       |   |            |  |                     |   |            |  |
        #       |   |            |  |                     |   |            |  |
        #       +---|            |--+                     +---|            |--+
        #           |            |                            |            |
        #           |            |                            |            |
        #           +------------+                            +------------+
        #           |Transit XDP |                            |Transit XDP |
        #           |    eth0    |                            |    eth0    |
        #           +------------+                            +------------+
        #                  |              +------------+             |
        #                  |              |  Router1   |             |
        #                  |              |    VPC3    |             |
        #                  |              |            |             |
        #                  |              |            |             |
        #                  |              |            |             |
        #                  +--------------|            |-------------+
        #                                 |            |
        #                                 |            |
        #                                 +------------+
        #                                 |Transit XDP |
        #                                 |    eth0    |
        #                                 +------------+

        self.droplets = {
            "d1": droplet("d1"),
            "d2": droplet("d2"),
            "d3": droplet("d3"),
            "d4": droplet("d4"),
            "switch-1": droplet("switch-1"),
            "switch-2": droplet("switch-2"),
            "router-1": droplet("router-1")
        }

        self.c = controller(self.droplets)

        self.c.create_vpc(3, cidr("16", "10.0.0.0"), ["router-1"])
        self.c.create_network(3, 10, cidr("24", "10.0.0.0"), ["switch-1"])

        # Clear update information about "10.0.0.0" subnet
        # When comparing update and delete RPC calls, we don't delete subnet "10.0.0.0".
        # Thus, there is no corresponding delete_net in the droplet's rpc_deletes map
        self.droplets["router-1"].clear_update_call_state()

        self.c.create_network(3, 20, cidr("24", "10.20.0.0"), ["switch-2"])

        self.ep1 = self.c.create_simple_endpoint(3, 10, "10.0.0.2", "d1")
        self.ep2 = self.c.create_simple_endpoint(3, 10, "10.0.0.3", "d2")

        self.ep3 = self.c.create_simple_endpoint(3, 20, "10.20.0.4", "d3")
        self.ep4 = self.c.create_simple_endpoint(3, 20, "10.20.0.5", "d4")

        # Delete the network and its corresponding endpoints
        self.c.delete_network(3, 20)