summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-08-11 00:20:18 +0000
committerGerrit Code Review <review@openstack.org>2018-08-11 00:20:18 +0000
commit5835647e146b0049aa7bb6ac44df48217a947704 (patch)
tree754e96a85c40e65ae7f8d60627640d5995105725
parent4b59e0fbfb94c02d09f775a65e3452158d1d9a83 (diff)
parent40c9c7f0bcf1ba96806cf24b2d19db03d566b492 (diff)
Merge "Use OVO for tests/unit/plugins/ml2/drivers/l2pop/test_db.py"
-rw-r--r--neutron/tests/unit/plugins/ml2/drivers/l2pop/test_db.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_db.py b/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_db.py
index a75d282..693662e 100644
--- a/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_db.py
+++ b/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_db.py
@@ -12,6 +12,7 @@
12# License for the specific language governing permissions and limitations 12# License for the specific language governing permissions and limitations
13# under the License. 13# under the License.
14 14
15import netaddr
15from neutron_lib.api.definitions import portbindings 16from neutron_lib.api.definitions import portbindings
16from neutron_lib import constants 17from neutron_lib import constants
17from neutron_lib import context 18from neutron_lib import context
@@ -20,9 +21,9 @@ from oslo_utils import uuidutils
20 21
21from neutron.common import constants as n_const 22from neutron.common import constants as n_const
22from neutron.db.models import l3 as l3_models 23from neutron.db.models import l3 as l3_models
23from neutron.db import models_v2
24from neutron.objects import l3_hamode 24from neutron.objects import l3_hamode
25from neutron.objects import network as network_obj 25from neutron.objects import network as network_obj
26from neutron.objects import ports as port_obj
26from neutron.objects import router as l3_objs 27from neutron.objects import router as l3_objs
27from neutron.plugins.ml2.drivers.l2pop import db as l2pop_db 28from neutron.plugins.ml2.drivers.l2pop import db as l2pop_db
28from neutron.plugins.ml2 import models 29from neutron.plugins.ml2 import models
@@ -101,17 +102,19 @@ class TestL2PopulationDBTestCase(testlib_api.SqlTestCase):
101 102
102 def _setup_port_binding(self, **kwargs): 103 def _setup_port_binding(self, **kwargs):
103 with self.ctx.session.begin(subtransactions=True): 104 with self.ctx.session.begin(subtransactions=True):
104 mac = net.get_random_mac('fa:16:3e:00:00:00'.split(':')) 105 mac = netaddr.EUI(
106 net.get_random_mac('fa:16:3e:00:00:00'.split(':')),
107 dialect=netaddr.mac_unix_expanded)
105 port_id = uuidutils.generate_uuid() 108 port_id = uuidutils.generate_uuid()
106 network_id = kwargs.get('network_id', TEST_NETWORK_ID) 109 network_id = kwargs.get('network_id', TEST_NETWORK_ID)
107 device_owner = kwargs.get('device_owner', '') 110 device_owner = kwargs.get('device_owner', '')
108 device_id = kwargs.get('device_id', '') 111 device_id = kwargs.get('device_id', uuidutils.generate_uuid())
109 host = kwargs.get('host', helpers.HOST) 112 host = kwargs.get('host', helpers.HOST)
110 113
111 self.ctx.session.add(models_v2.Port( 114 port_obj.Port(self.ctx,
112 id=port_id, network_id=network_id, mac_address=mac, 115 id=port_id, network_id=network_id, mac_address=mac,
113 admin_state_up=True, status=constants.PORT_STATUS_ACTIVE, 116 admin_state_up=True, status=constants.PORT_STATUS_ACTIVE,
114 device_id=device_id, device_owner=device_owner)) 117 device_id=device_id, device_owner=device_owner).create()
115 118
116 port_binding_cls = models.PortBinding 119 port_binding_cls = models.PortBinding
117 binding_kwarg = {'port_id': port_id, 120 binding_kwarg = {'port_id': port_id,