Browse Source

Use DEVICE_ID_RESERVED_DHCP_PORT constant defined in neutron-lib

Change-Id: If6a99219ff63490b5cd677d5268f4d160b98f6db
changes/22/492222/1
Mark McClain 5 years ago
parent
commit
1ff386cdc9
  1. 6
      networking_arista/ml2/mechanism_arista.py
  2. 5
      networking_arista/tests/unit/ml2/test_mechanism_arista.py

6
networking_arista/ml2/mechanism_arista.py

@ -22,8 +22,6 @@ from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from neutron.common import constants as neutron_const
from networking_arista._i18n import _, _LI, _LE
from networking_arista.common import constants
from networking_arista.common import db
@ -700,7 +698,7 @@ class AristaDriver(driver_api.MechanismDriver):
port_down = context.status == n_const.PORT_STATUS_DOWN
if orig_host and (port_down or host != orig_host or
device_id == neutron_const.DEVICE_ID_RESERVED_DHCP_PORT):
device_id == n_const.DEVICE_ID_RESERVED_DHCP_PORT):
LOG.info("Deleting the port %s" % str(orig_port))
# The port moved to a different host or the VM
# connected to the port was deleted or its in DOWN
@ -708,7 +706,7 @@ class AristaDriver(driver_api.MechanismDriver):
self._delete_port(orig_port, orig_host, tenant_id)
if(port_provisioned and net_provisioned and hostname and
is_vm_boot and not port_down and
device_id != neutron_const.DEVICE_ID_RESERVED_DHCP_PORT):
device_id != n_const.DEVICE_ID_RESERVED_DHCP_PORT):
LOG.info(_LI("Port plugged into network"))
# Plug port into the network only if it exists in the db
# and is bound to a host and the port is up.

5
networking_arista/tests/unit/ml2/test_mechanism_arista.py

@ -18,7 +18,6 @@ from neutron_lib.api.definitions import portbindings
from neutron_lib import constants as n_const
from neutron_lib.plugins.ml2 import api as driver_api
from neutron.common import constants as neutron_const
from neutron.tests.unit import testlib_api
from networking_arista.ml2 import mechanism_arista
@ -989,7 +988,7 @@ class AristaDriverTestCase(testlib_api.SqlTestCase):
network_id = 'n1'
old_device_id = 'old_device_id'
new_device_id = 'new_device_id'
reserved_device = neutron_const.DEVICE_ID_RESERVED_DHCP_PORT
reserved_device = n_const.DEVICE_ID_RESERVED_DHCP_PORT
old_host = 'ubuntu1'
new_host = 'ubuntu2'
port_id = 101
@ -1138,7 +1137,7 @@ class AristaDriverTestCase(testlib_api.SqlTestCase):
network_id = 'n1'
old_device_id = 'old_device_id'
new_device_id = 'new_device_id'
reserved_device = neutron_const.DEVICE_ID_RESERVED_DHCP_PORT
reserved_device = n_const.DEVICE_ID_RESERVED_DHCP_PORT
old_host = 'ubuntu1'
new_host = 'ubuntu2'
port_id = 101

Loading…
Cancel
Save