コード例 #1
0
    def test_l3_network_connectivity(self):
        tenant_uuid = uuidutils.generate_uuid()

        bgpvpn = self.safe_client.create_bgpvpn(tenant_uuid,
                                                route_targets=['64512:1'])

        network_ids = list()
        for subnet_cidr in (base.SUBNET_CIDR1, base.SUBNET_CIDR2):
            network_ids.append(
                self._create_net_subnet_bgpvpn_assoc(tenant_uuid, subnet_cidr,
                                                     bgpvpn['id'])[0]
            )

        fake_machines = list()
        for network_id in network_ids:
            fake_machines.extend([
                self.useFixture(
                    machine.FakeFullstackMachine(
                        self.environment.hosts[i],
                        network_id,
                        tenant_uuid,
                        self.safe_client))
                for i in
                range(self.compute_node_count)*self.port_per_compute_per_net])

        vms = machine.FakeFullstackMachinesList(fake_machines)

        vms.block_until_all_boot()
        vms.ping_all()
コード例 #2
0
    def _prepare_vms(self):
        sgs = [self.safe_client.create_security_group(self.tenant_id)
               for _ in range(2)]

        port1 = self.safe_client.create_port(
            self.tenant_id, self.network['id'],
            self.environment.hosts[0].hostname,
            device_owner="compute:test_ovs_dhcp",
            security_groups=[sgs[0]['id']])

        port2 = self.safe_client.create_port(
            self.tenant_id, self.network['id'],
            self.environment.hosts[0].hostname,
            device_owner="compute:test_ovs_dhcp",
            security_groups=[sgs[1]['id']])

        # insert security-group-rules allow icmp
        self.safe_client.create_security_group_rule(
            self.tenant_id, sgs[0]['id'],
            direction=constants.INGRESS_DIRECTION,
            ethertype=constants.IPv4,
            protocol=constants.PROTO_NAME_ICMP)
        self.safe_client.create_security_group_rule(
            self.tenant_id, sgs[0]['id'],
            direction=constants.INGRESS_DIRECTION,
            ethertype=constants.IPv6,
            protocol=constants.PROTO_NAME_ICMP)

        # insert security-group-rules allow icmp
        self.safe_client.create_security_group_rule(
            self.tenant_id, sgs[1]['id'],
            direction=constants.INGRESS_DIRECTION,
            ethertype=constants.IPv4,
            protocol=constants.PROTO_NAME_ICMP)
        self.safe_client.create_security_group_rule(
            self.tenant_id, sgs[1]['id'],
            direction=constants.INGRESS_DIRECTION,
            ethertype=constants.IPv6,
            protocol=constants.PROTO_NAME_ICMP)

        vm1 = self.useFixture(
            machine.FakeFullstackMachine(
                self.environment.hosts[0],
                self.network['id'],
                self.tenant_id,
                self.safe_client,
                neutron_port=port1,
                use_dhcp=True,
                use_dhcp6=True))

        vm2 = self.useFixture(
            machine.FakeFullstackMachine(
                self.environment.hosts[0],
                self.network['id'],
                self.tenant_id,
                self.safe_client,
                neutron_port=port2,
                use_dhcp=True,
                use_dhcp6=True))
        return machine.FakeFullstackMachinesList([vm1, vm2])
コード例 #3
0
    def _prepare_vms_in_net(self, tenant_uuid, network):
        vms = machine.FakeFullstackMachinesList(
            self.useFixture(
                machine.FakeFullstackMachine(host, network['id'], tenant_uuid,
                                             self.safe_client))
            for host in self.environment.hosts)

        vms.block_until_all_boot()
        return vms
コード例 #4
0
    def _prepare_vms_in_net(self, tenant_uuid, network, use_dhcp=False):
        vms = machine.FakeFullstackMachinesList(
            self.useFixture(
                machine.FakeFullstackMachine(host,
                                             network['id'],
                                             tenant_uuid,
                                             self.safe_client,
                                             use_dhcp=use_dhcp))
            for host in self.environment.hosts)

        vms.block_until_all_boot()
        if use_dhcp:
            vms.block_until_all_dhcp_config_done()
        return vms
コード例 #5
0
    def test_connectivity(self):
        tenant_uuid = uuidutils.generate_uuid()

        network = self.safe_client.create_network(tenant_uuid)
        self.safe_client.create_subnet(tenant_uuid, network['id'],
                                       base.SUBNET_CIDR1)

        vms = machine.FakeFullstackMachinesList([
            self.useFixture(
                machine.FakeFullstackMachine(self.environment.hosts[i],
                                             network['id'], tenant_uuid,
                                             self.safe_client))
            for i in range(3)
        ])

        vms.block_until_all_boot()
        vms.ping_all()
コード例 #6
0
    def test_l3_router_connectivity(self):
        tenant_uuid = uuidutils.generate_uuid()

        bgpvpn = self.safe_client.create_bgpvpn(tenant_uuid,
                                                route_targets=['64512:1'])

        network1 = self.safe_client.create_network(tenant_uuid)
        subnet1 = self.safe_client.create_subnet(
            tenant_uuid, network1['id'], '10.0.0.0/24')

        network2 = self.safe_client.create_network(tenant_uuid)
        subnet2 = self.safe_client.create_subnet(
            tenant_uuid, network2['id'], '20.0.0.0/24')

        router = self.safe_client.create_router(tenant_uuid)
        self.safe_client.add_router_interface(router['id'], subnet1['id'])
        self.safe_client.add_router_interface(router['id'], subnet2['id'])

        self.safe_client.create_router_association(tenant_uuid,
                                                   bgpvpn['id'],
                                                   router['id'])

        network3 = self.safe_client.create_network(tenant_uuid)
        self.safe_client.create_subnet(
            tenant_uuid, network3['id'], '30.0.0.0/24')
        self.safe_client.create_network_association(tenant_uuid,
                                                    bgpvpn['id'],
                                                    network3['id'])

        fake_machines = list()
        for network in (network1, network2, network3):
            fake_machines.extend([
                self.useFixture(
                    machine.FakeFullstackMachine(
                        self.environment.hosts[i],
                        network['id'],
                        tenant_uuid,
                        self.safe_client))
                for i in
                range(self.compute_node_count)*self.port_per_compute_per_net])

        vms = machine.FakeFullstackMachinesList(fake_machines)

        vms.block_until_all_boot()
        vms.ping_all()
コード例 #7
0
    def _prepare_resources(self):
        self.tenant_uuid = uuidutils.generate_uuid()
        network = self.safe_client.create_network(self.tenant_uuid)
        self.safe_client.create_subnet(self.tenant_uuid,
                                       network['id'],
                                       '20.0.0.0/24',
                                       enable_dhcp=False)
        vms = machine.FakeFullstackMachinesList(
            self.useFixture(
                machine.FakeFullstackMachine(self.environment.hosts[0],
                                             network['id'],
                                             self.tenant_uuid,
                                             self.safe_client,
                                             use_dhcp=False))
            for i in range(2))
        vms.block_until_all_boot()

        for vm in vms:
            self._add_icmp_security_group_rule(vm)

        return vms
コード例 #8
0
ファイル: test_local_ip.py プロジェクト: stackhpc/neutron
    def _prepare_vms(self):
        port1 = self.safe_client.create_port(
            self.project_id,
            self.network['id'],
            self.environment.hosts[0].hostname,
            device_owner="compute:test_local_ip")

        port2 = self.safe_client.create_port(
            self.project_id,
            self.network['id'],
            self.environment.hosts[0].hostname,
            device_owner="compute:test_local_ip")

        port3 = self.safe_client.create_port(
            self.project_id,
            self.network['id'],
            self.environment.hosts[1].hostname,
            device_owner="compute:test_local_ip")

        vm1 = self.useFixture(
            machine.FakeFullstackMachine(self.environment.hosts[0],
                                         self.network['id'],
                                         self.project_id,
                                         self.safe_client,
                                         neutron_port=port1))

        vm2 = self.useFixture(
            machine.FakeFullstackMachine(self.environment.hosts[0],
                                         self.network['id'],
                                         self.project_id,
                                         self.safe_client,
                                         neutron_port=port2))

        vm_diff_host = self.useFixture(
            machine.FakeFullstackMachine(self.environment.hosts[1],
                                         self.network['id'],
                                         self.project_id,
                                         self.safe_client,
                                         neutron_port=port3))
        return machine.FakeFullstackMachinesList([vm1, vm2, vm_diff_host])
コード例 #9
0
    def test_l2_network_connectivity(self):
        # create <n> fake machines in 2 different networks, all using
        # the same IP subnet, and check that each machine can reach all the
        # others. We create machines so that we confirm that connectivity
        # still works *inside* a given network, both locally on a compute
        # node, and across different compute nodes

        if self.evpn_driver is 'dummy':
            self.skipTest("L2VPN unsupported for this scenario")

        tenant_uuid = uuidutils.generate_uuid()

        bgpvpn = self.safe_client.create_bgpvpn(tenant_uuid,
                                                type="l2",
                                                route_targets=['64512:10'])

        fake_machines = list()
        for network in range(2):

            # we'll use the same subnet range for all networks, but
            # choose in this range distinct IP addresses for each fake machine

            network_id, subnet_id = self._create_net_subnet_bgpvpn_assoc(
                tenant_uuid,
                base.SUBNET_CIDR1,
                bgpvpn['id']
            )

            for compute, port_i in itertools.product(
                    range(self.compute_node_count),
                    range(self.port_per_compute_per_net)):

                # NOTE(tmorin): choice of fixed IP done this way for sake
                # of simplicity, of course, this breaks e.g. for
                # compute_node_count > 10
                fixed_ip = (base.SUBNET_CIDR1[:base.SUBNET_CIDR1.find('0/24')]
                            + str(100 * network + 10 * (compute+1) + port_i))

                neutron_port = self.safe_client.create_port(
                    network_id=network_id,
                    tenant_id=tenant_uuid,
                    hostname=self.environment.hosts[compute].hostname,
                    fixed_ips=[{"subnet_id": subnet_id,
                                "ip_address": fixed_ip}]
                )

                fake_machines.append(
                    self.useFixture(
                        machine.FakeFullstackMachine(
                            self.environment.hosts[compute],
                            network_id,
                            tenant_uuid,
                            self.safe_client,
                            neutron_port=neutron_port
                        )
                    )
                )

        vms = machine.FakeFullstackMachinesList(fake_machines)

        vms.block_until_all_boot()
        vms.ping_all()