Beispiel #1
0
    def test_wide_configuration(self):
        """
        Test wide configuration for this recipe involves creating a bonding
        device using the two matched physical devices as slaves on host1.
        The bonding mode and miimon interval is configured on the bonding device
        according to the recipe parameters. IPv4 and IPv6 addresses are added to
        the bonding device and to the matched ethernet device on host2.

        | host1.bond0 = 192.168.101.1/24 and fc00::1/64
        | host2.eth0 = 192.168.101.2/24 and fc00::2/64
        """

        host1, host2 = self.matched.host1, self.matched.host2
        host1.bond0 = BondDevice(mode=self.params.bonding_mode,
                                 miimon=self.params.miimon_value)
        configuration = super().test_wide_configuration()
        configuration.test_wide_devices = []

        for dev in [host1.eth0, host1.eth1]:
            dev.down()
            host1.bond0.slave_add(dev)

        net_addr = "192.168.101"
        net_addr6 = "fc00:0:0:0"
        for i, dev in enumerate([host1.bond0, host2.eth0]):
            dev.ip_add(ipaddress(net_addr + "." + str(i + 1) + "/24"))
            dev.ip_add(ipaddress(net_addr6 + "::" + str(i + 1) + "/64"))
            configuration.test_wide_devices.append(dev)

        for dev in [host1.eth0, host1.eth1, host1.bond0, host2.eth0]:
            dev.up()

        self.wait_tentative_ips(configuration.test_wide_devices)

        return configuration
Beispiel #2
0
    def test_wide_configuration(self):
        host1, host2 = self.matched.host1, self.matched.host2

        host1.team0 = TeamDevice(config={'runner': {'name': self.params.runner_name}})

        host2.bond0 = BondDevice(mode=self.params.bonding_mode,
            miimon=self.params.miimon_value)

        configuration = super().test_wide_configuration()
        configuration.test_wide_devices = [host1.team0, host2.bond0]

        net_addr_1 = "192.168.10"
        net_addr6_1 = "fc00:0:0:1"

        for i, (host, dev) in enumerate([(host1, host1.team0), (host2,
            host2.bond0)]):
            host.eth0.down()
            host.eth1.down()
            dev.slave_add(host.eth0)
            dev.slave_add(host.eth1)
            dev.ip_add(ipaddress(net_addr_1 + "." + str(i+1) + "/24"))
            dev.ip_add(ipaddress(net_addr6_1 + "::" + str(i+1) + "/64"))

        for host, dev in [(host1, host1.team0), (host2, host2.bond0)]:
            host.eth0.up()
            host.eth1.up()
            dev.up()

        self.wait_tentative_ips(configuration.test_wide_devices)

        return configuration
Beispiel #3
0
    def test_wide_configuration(self):
        host1, host2 = self.matched.host1, self.matched.host2

        #The config argument needs to be used with a team device normally
        #(e.g  to specify the runner mode), but it is not used here due to
        #a bug in the TeamDevice module
        host1.team0 = TeamDevice()

        host2.bond0 = BondDevice(mode=self.params.bonding_mode,
                                 miimon=self.params.miimon_value)

        configuration = super().test_wide_configuration()
        configuration.test_wide_devices = [host1.team0, host2.bond0]

        net_addr_1 = "192.168.10"
        net_addr6_1 = "fc00:0:0:1"

        for i, (host, dev) in enumerate([(host1, host1.team0),
                                         (host2, host2.bond0)]):
            host.eth0.down()
            host.eth1.down()
            dev.slave_add(host.eth0)
            dev.slave_add(host.eth1)
            dev.ip_add(ipaddress(net_addr_1 + "." + str(i + 1) + "/24"))
            dev.ip_add(ipaddress(net_addr6_1 + "::" + str(i + 1) + "/64"))

        for host, dev in [(host1, host1.team0), (host2, host2.bond0)]:
            host.eth0.up()
            host.eth1.up()
            dev.up()

        self.wait_tentative_ips(configuration.test_wide_devices)

        return configuration
Beispiel #4
0
    def test_wide_configuration(self):
        host1, host2 = self.matched.host1, self.matched.host2

        host1.bond0 = BondDevice(mode=self.params.bonding_mode,
                                 miimon=self.params.miimon_value)
        for dev in [host1.eth0, host1.eth1]:
            dev.down()
            host1.bond0.slave_add(dev)

        host1.vlan0 = VlanDevice(realdev=host1.bond0, vlan_id=10)
        host1.vlan1 = VlanDevice(realdev=host1.bond0, vlan_id=20)
        host1.vlan2 = VlanDevice(realdev=host1.bond0, vlan_id=30)
        host2.vlan0 = VlanDevice(realdev=host2.eth0, vlan_id=10)
        host2.vlan1 = VlanDevice(realdev=host2.eth0, vlan_id=20)
        host2.vlan2 = VlanDevice(realdev=host2.eth0, vlan_id=30)

        configuration = super().test_wide_configuration()
        configuration.test_wide_devices = []
        for host in [host1, host2]:
            configuration.test_wide_devices.extend(
                [host.vlan0, host.vlan1, host.vlan2])
        configuration.test_wide_devices.append(host1.bond0)

        net_addr = "192.168"
        net_addr6 = "fc00:0:0"

        for i, host in enumerate([host1, host2]):
            host.vlan0.ip_add(
                ipaddress(net_addr + '.10' + '.' + str(i + 1) + "/24"))
            host.vlan0.ip_add(
                ipaddress(net_addr6 + ":1::" + str(i + 1) + "/64"))
            host.vlan1.ip_add(
                ipaddress(net_addr + '.20' + '.' + str(i + 1) + "/24"))
            host.vlan1.ip_add(
                ipaddress(net_addr6 + ":2::" + str(i + 1) + "/64"))
            host.vlan2.ip_add(
                ipaddress(net_addr + '.30' + '.' + str(i + 1) + "/24"))
            host.vlan2.ip_add(
                ipaddress(net_addr6 + ":3::" + str(i + 1) + "/64"))

        for dev in [
                host1.eth0, host1.eth1, host1.bond0, host1.vlan0, host1.vlan1,
                host1.vlan2, host2.eth0, host2.vlan0, host2.vlan1, host2.vlan2
        ]:
            dev.up()

        self.wait_tentative_ips(configuration.test_wide_devices)

        return configuration
Beispiel #5
0
    def configure_underlying_network(self, configuration):
        """
        The underlying network for the tunnel consists of two Ethernet
        devices bonded together by bonding device on both of the matched
        hosts.
        """
        host1, host2 = self.matched.host1, self.matched.host2

        host1.bond = BondDevice(mode=self.params.bonding_mode,
                                miimon=self.params.miimon_value)
        host2.bond = BondDevice(mode=self.params.bonding_mode,
                                miimon=self.params.miimon_value)

        for host, devices in [
            (host1, [host1.eth0, host1.eth1]),
            (host2, [host2.eth0, host2.eth1]),
        ]:
            for dev in devices:
                dev.down()
                host.bond.slave_add(dev)

        for i, device in enumerate([host1.bond, host2.bond]):
            device.ip_add(ipaddress("192.168.101." + str(i + 1) + "/24"))
            configuration.test_wide_devices.append(device)

        for dev in [
                host1.eth0,
                host1.eth1,
                host1.bond,
                host2.eth0,
                host2.eth0,
                host2.bond,
        ]:
            dev.up()

        configuration.tunnel_endpoints = (host1.bond, host2.bond)
Beispiel #6
0
    def test_wide_configuration(self):
        host1, host2 = self.matched.host1, self.matched.host2

        net_addr = "192.168.101"
        net_addr6 = "fc00:0:0:0"
        for i, host in enumerate([host1, host2]):
            host.bond0 = BondDevice(mode=self.params.bonding_mode,
                                    miimon=self.params.miimon_value)
            for dev in [host.eth0, host.eth1]:
                dev.down()
                host.bond0.slave_add(dev)
            host.bond0.ip_add(ipaddress(net_addr + "." + str(i + 1) + "/24"))
            host.bond0.ip_add(ipaddress(net_addr6 + "::" + str(i + 1) + "/64"))
            for dev in [host.eth0, host.eth1, host.bond0]:
                dev.up()

        configuration = super().test_wide_configuration()
        configuration.test_wide_devices = [host1.bond0, host2.bond0]

        self.wait_tentative_ips(configuration.test_wide_devices)

        return configuration
Beispiel #7
0
    def test_wide_configuration(self):
        host1, host2, guest1, guest2, guest3, guest4 = (self.matched.host1,
                                                        self.matched.host2,
                                                        self.matched.guest1,
                                                        self.matched.guest2,
                                                        self.matched.guest3,
                                                        self.matched.guest4)

        for host in [host1, host2]:
            for dev in [host.eth0, host.eth1, host.tap0, host.tap1]:
                dev.down()
            host.bond0 = BondDevice(mode=self.params.bonding_mode,
                                    miimon=self.params.miimon_value)
            host.bond0.slave_add(host.eth0)
            host.bond0.slave_add(host.eth1)
            host.br0 = BridgeDevice()
            host.br0.slave_add(host.tap0)
            host.br1 = BridgeDevice()
            host.br1.slave_add(host.tap1)

        for guest in (guest1, guest2, guest3, guest4):
            guest.eth0.down()

        host1.vlan0 = VlanDevice(realdev=host1.bond0,
                                 vlan_id=10,
                                 master=host1.br0)
        host1.vlan1 = VlanDevice(realdev=host1.bond0,
                                 vlan_id=20,
                                 master=host1.br1)
        host2.vlan0 = VlanDevice(realdev=host2.bond0,
                                 vlan_id=10,
                                 master=host2.br0)
        host2.vlan1 = VlanDevice(realdev=host2.bond0,
                                 vlan_id=20,
                                 master=host2.br1)

        configuration = super().test_wide_configuration()
        configuration.test_wide_devices = [
            host1.br0, host2.br0, guest1.eth0, guest2.eth0, guest3.eth0,
            guest4.eth0
        ]

        net_addr = "192.168"
        net_addr6 = "fc00:0:0"
        for host, (guest_a, guest_b), n in [(host1, (guest1, guest2), 1),
                                            (host2, (guest3, guest4), 3)]:
            host.br0.ip_add(ipaddress(net_addr + ".10." + str(n) + "/24"))
            host.br1.ip_add(ipaddress(net_addr + ".20." + str(n) + "/24"))
            guest_a.eth0.ip_add(
                ipaddress(net_addr + ".10." + str(n + 1) + "/24"))
            guest_a.eth0.ip_add(
                ipaddress(net_addr6 + ":1::" + str(n + 1) + "/64"))
            guest_b.eth0.ip_add(
                ipaddress(net_addr + ".20." + str(n + 1) + "/24"))
            guest_b.eth0.ip_add(
                ipaddress(net_addr6 + ":2::" + str(n + 1) + "/64"))

        for host in [host1, host2]:
            for dev in [
                    host.eth0, host.eth1, host.tap0, host.tap1, host.bond0,
                    host.vlan0, host.vlan1, host.br0, host.br1
            ]:
                dev.up()
        for guest in [guest1, guest2, guest3, guest4]:
            guest.eth0.up()

        if "perf_tool_cpu" in self.params:
            logging.info("'perf_tool_cpu' param (%d) to be set to None" %
                         self.params.perf_tool_cpu)
            self.params.perf_tool_cpu = None

        self.wait_tentative_ips(configuration.test_wide_devices)

        return configuration
Beispiel #8
0
    def test(self):
        self.matched.m1.eth0.ip_add(ipaddress("192.168.1.1/24"))
        self.matched.m1.eth0.up()
        self.matched.m2.eth0.ip_add(ipaddress("192.168.1.2/24"))
        self.matched.m2.eth0.up()
        ping_job = self.matched.m1.run(
            Ping(dst=self.matched.m2.eth0,
                 interval=0,
                 iface=self.matched.m1.eth0))

        netserver_job = self.matched.m1.run(
            Netserver(bind=self.matched.m1.eth0), bg=True)

        netperf_job = self.matched.m2.run(
            Netperf(server=self.matched.m1.eth0,
                    duration=1,
                    confidence="99,5",
                    runs="5",
                    debug=0,
                    max_deviation={
                        'type': "percent",
                        'value': 20.0
                    },
                    testname="TCP_STREAM"))

        netserver_job.kill(signal=signal.SIGINT)

        #examples of how to create soft devices
        self.matched.m1.eth0.down()

        m1 = self.matched.m1
        eth0 = m1.eth0

        #Bonding
        m1.bond = BondDevice(mode="active-backup", name="my_bond0")
        m1.bond.slave_add(eth0)
        m1.bond.up()
        m1.run("ip a")
        m1.bond.destroy()

        #Bridging
        m1.br = BridgeDevice()
        m1.br.slave_add(eth0)
        m1.br.up()
        m1.run("ip a")
        m1.br.destroy()

        #Teaming
        m1.team = TeamDevice()
        m1.team.slave_add(eth0)
        m1.team.up()
        m1.run("ip a")
        m1.team.destroy()

        #VethPair
        m1.veth0, m1.veth1 = VethPair()
        m1.veth0.up()
        m1.veth1.up()
        m1.run("ip a")
        m1.veth0.destroy()

        #Macvlan
        m1.mvlan = MacvlanDevice(realdev=eth0)
        m1.mvlan.up()
        m1.run("ip a")
        m1.mvlan.destroy()

        #Vlan
        eth0.up()
        m1.vlan = VlanDevice(realdev=eth0, vlan_id=123)
        m1.vlan.up()
        m1.run("ip a")
        m1.vlan.destroy()
        eth0.down()

        #Vti
        m1.vti = VtiDevice(local="1.2.3.4", ikey=123, okey=321)
        m1.vti.up()
        m1.run("ip a")
        m1.vti.destroy()

        #Vxlan
        m1.vxlan0 = VxlanDevice(vxlan_id=123, remote='1.2.3.4')
        m1.vxlan0.up()
        self.matched.m1.run("ip a")
        m1.vxlan0.destroy()
Beispiel #9
0
    def test_wide_configuration(self):
        """
        Test wide configuration for this recipe involves creating one bonding
        device on the first host. This device bonds two NICs matched by the
        recipe. The bonding mode and miimon interval is configured on the
        bonding device according to the recipe parameters. Then three
        VLAN (802.1Q) tunnels are created on top of the bonding device on the
        first host and on the matched NIC on the second host. The tunnels are
        configured with VLAN ids from vlan0_id, vlan1_id and vlan2_id params (by
        default: 10, 20, 30).

        An IPv4 and IPv6 address is configured on each tunnel endpoint.

        | host1.vlan0 = 192.168.10.1/24 and fc00:0:0:1::1/64
        | host1.vlan1 = 192.168.20.1/24 and fc00:0:0:2::1/64
        | host1.vlan2 = 192.168.30.1/24 and fc00:0:0:3::1/64

        | host2.vlan0 = 192.168.10.2/24 and fc00:0:0:1::2/64
        | host2.vlan1 = 192.168.20.2/24 and fc00:0:0:2::2/64
        | host2.vlan2 = 192.168.30.2/24 and fc00:0:0:3::2/64
        """
        host1, host2 = self.matched.host1, self.matched.host2

        host1.bond0 = BondDevice(mode=self.params.bonding_mode,
            miimon=self.params.miimon_value)
        for dev in [host1.eth0, host1.eth1]:
            dev.down()
            host1.bond0.slave_add(dev)

        host1.vlan0 = VlanDevice(realdev=host1.bond0, vlan_id=self.params.vlan0_id)
        host1.vlan1 = VlanDevice(realdev=host1.bond0, vlan_id=self.params.vlan1_id)
        host1.vlan2 = VlanDevice(realdev=host1.bond0, vlan_id=self.params.vlan2_id)
        host2.vlan0 = VlanDevice(realdev=host2.eth0, vlan_id=self.params.vlan0_id)
        host2.vlan1 = VlanDevice(realdev=host2.eth0, vlan_id=self.params.vlan1_id)
        host2.vlan2 = VlanDevice(realdev=host2.eth0, vlan_id=self.params.vlan2_id)

        configuration = super().test_wide_configuration()
        configuration.test_wide_devices = []
        for host in [host1, host2]:
            configuration.test_wide_devices.extend([host.vlan0,
                host.vlan1, host.vlan2])
        configuration.test_wide_devices.append(host1.bond0)

        net_addr = "192.168"
        net_addr6 = "fc00:0:0"

        for i, host in enumerate([host1, host2]):
            host.vlan0.ip_add(ipaddress('{}.10.{}/24'.format(net_addr, i+1)))
            host.vlan1.ip_add(ipaddress('{}.20.{}/24'.format(net_addr, i+1)))
            host.vlan2.ip_add(ipaddress('{}.30.{}/24'.format(net_addr, i+1)))
            host.vlan0.ip_add(ipaddress('{}:1::{}/64'.format(net_addr6, i+1)))
            host.vlan1.ip_add(ipaddress('{}:2::{}/64'.format(net_addr6, i+1)))
            host.vlan2.ip_add(ipaddress('{}:3::{}/64'.format(net_addr6, i+1)))

        for dev in [host1.eth0, host1.eth1, host1.bond0, host1.vlan0,
            host1.vlan1, host1.vlan2, host2.eth0, host2.vlan0,
            host2.vlan1, host2.vlan2]:
            dev.up()

        self.wait_tentative_ips(configuration.test_wide_devices)

        return configuration