def test_get_physical_network_not_found(self):
        pnet = nwa_l2_utils.get_physical_network('network:router_interface1',
                                                 self.resource_group)
        self.assertIsNone(pnet)

        pnet = nwa_l2_utils.get_physical_network('compute:AZ1',
                                                 self.resource_group,
                                                 'Common/KVM/Pod2')
        self.assertIsNone(pnet)
    def test_get_physical_network(self):
        pnet = nwa_l2_utils.get_physical_network('compute:AZ1',
                                                 self.resource_group)
        self.assertEqual(pnet, 'Common/KVM/Pod1-1')

        pnet = nwa_l2_utils.get_physical_network('compute:AZ1',
                                                 self.resource_group,
                                                 'Common/KVM/Pod1')
        self.assertEqual(pnet, 'Common/KVM/Pod1-1')
Пример #3
0
    def test_get_physical_network_not_found(self):
        pnet = nwa_l2_utils.get_physical_network('network:router_interface1',
                                                 self.resource_group)
        self.assertIsNone(pnet)

        pnet = nwa_l2_utils.get_physical_network('compute:AZ1',
                                                 self.resource_group,
                                                 'Common/KVM/Pod2')
        self.assertIsNone(pnet)
Пример #4
0
    def test_get_physical_network(self):
        pnet = nwa_l2_utils.get_physical_network('compute:AZ1',
                                                 self.resource_group)
        self.assertEqual(pnet, 'Common/KVM/Pod1-1')

        pnet = nwa_l2_utils.get_physical_network('compute:AZ1',
                                                 self.resource_group,
                                                 'Common/KVM/Pod1')
        self.assertEqual(pnet, 'Common/KVM/Pod1-1')
Пример #5
0
    def _bind_port_nwa_debug_message(self, context):
        network_name, network_id = nwa_l2_utils.get_network_info(context)
        device_owner = context._port['device_owner']

        subnet_ids = []
        if 'fixed_ips' in context._port:
            for fixed_ip in context._port['fixed_ips']:
                subnet_ids.append(fixed_ip['subnet_id'])

        segmentation_id = 0
        if prov_net.PHYSICAL_NETWORK in context.network.current:
            segmentation_id = context.network.current[prov_net.SEGMENTATION_ID]
        else:
            for provider in context.network.current['segments']:
                if (provider.get(prov_net.PHYSICAL_NETWORK) ==
                        nwa_l2_utils.get_physical_network(
                            device_owner, self.resource_groups)):
                    segmentation_id = provider[prov_net.SEGMENTATION_ID]
                    break

        LOG.debug("provider segmentation_id = %s", segmentation_id)
        LOG.debug(
            "_bind_port_nwa %(network_name)s "
            "%(network_id)s %(device_id)s %(device_owner)s "
            "%(port_id)s %(mac_address)s %(subnet_ids)s "
            "%(segmentation_id)s", {
                'network_name': network_name,
                'network_id': network_id,
                'device_id': context._port['device_id'],
                'device_owner': device_owner,
                'port_id': context._port['id'],
                'mac_address': context._port['mac_address'],
                'subnet_ids': subnet_ids,
                'segmentation_id': segmentation_id
            })
Пример #6
0
    def _bind_port_nwa_debug_message(self, context):
        network_name, network_id = nwa_l2_utils.get_network_info(context)
        device_owner = context._port['device_owner']

        subnet_ids = []
        if 'fixed_ips' in context._port:
            for fixed_ip in context._port['fixed_ips']:
                subnet_ids.append(fixed_ip['subnet_id'])

        segmentation_id = 0
        if prov_net.PHYSICAL_NETWORK in context.network.current:
            segmentation_id = context.network.current[prov_net.SEGMENTATION_ID]
        else:
            for provider in context.network.current['segments']:
                if (provider.get(prov_net.PHYSICAL_NETWORK) ==
                        nwa_l2_utils.get_physical_network(
                            device_owner, self.resource_groups)):
                    segmentation_id = provider[prov_net.SEGMENTATION_ID]
                    break

        LOG.debug("provider segmentation_id = %s", segmentation_id)
        LOG.debug("_bind_port_nwa %(network_name)s "
                  "%(network_id)s %(device_id)s %(device_owner)s "
                  "%(port_id)s %(mac_address)s %(subnet_ids)s "
                  "%(segmentation_id)s",
                  {'network_name': network_name,
                   'network_id': network_id,
                   'device_id': context._port['device_id'],
                   'device_owner': device_owner,
                   'port_id': context._port['id'],
                   'mac_address': context._port['mac_address'],
                   'subnet_ids': subnet_ids,
                   'segmentation_id': segmentation_id})