Beispiel #1
0
    def test_get_port_from_device_mac(self):
        network_id = 'foo-network-id'
        port_id = 'foo-port-id'
        self._setup_neutron_network(network_id)
        port = self._setup_neutron_port(network_id, port_id)

        observed_port = ml2_db.get_port_from_device_mac(port['mac_address'])
        self.assertEqual(port_id, observed_port.id)
Beispiel #2
0
    def test_get_port_from_device_mac(self):
        network_id = 'foo-network-id'
        port_id = 'foo-port-id'
        self._setup_neutron_network(network_id)
        port = self._setup_neutron_port(network_id, port_id)

        observed_port = ml2_db.get_port_from_device_mac(port['mac_address'])
        self.assertEqual(port_id, observed_port.id)
Beispiel #3
0
    def test_get_port_from_device_mac(self):
        network_id = uuidutils.generate_uuid()
        port_id = uuidutils.generate_uuid()
        self._setup_neutron_network(network_id)
        port = self._setup_neutron_port(network_id, port_id)

        observed_port = ml2_db.get_port_from_device_mac(
            self.ctx, port['mac_address'])
        self.assertEqual(port_id, observed_port.id)
Beispiel #4
0
    def test_get_port_from_device_mac(self):
        network_id = uuidutils.generate_uuid()
        port_id = uuidutils.generate_uuid()
        self._setup_neutron_network(network_id)
        port = self._setup_neutron_port(network_id, port_id)

        observed_port = ml2_db.get_port_from_device_mac(self.ctx,
                                                        port['mac_address'])
        self.assertEqual(port_id, observed_port.id)
Beispiel #5
0
 def _device_to_port_id(cls, device):
     # REVISIT(rkukura): Consider calling into MechanismDrivers to
     # process device names, or having MechanismDrivers supply list
     # of device prefixes to strip.
     if device.startswith(TAP_DEVICE_PREFIX):
         return device[TAP_DEVICE_PREFIX_LENGTH:]
     else:
         # REVISIT(irenab): Consider calling into bound MD to
         # handle the get_device_details RPC, then remove the 'else' clause
         if not uuidutils.is_uuid_like(device):
             port = db.get_port_from_device_mac(device)
             if port:
                 return port.id
     return device
Beispiel #6
0
 def _device_to_port_id(cls, device):
     # REVISIT(rkukura): Consider calling into MechanismDrivers to
     # process device names, or having MechanismDrivers supply list
     # of device prefixes to strip.
     if device.startswith(TAP_DEVICE_PREFIX):
         return device[TAP_DEVICE_PREFIX_LENGTH:]
     else:
         # REVISIT(irenab): Consider calling into bound MD to
         # handle the get_device_details RPC, then remove the 'else' clause
         if not uuidutils.is_uuid_like(device):
             port = db.get_port_from_device_mac(device)
             if port:
                 return port.id
     return device