Browse Source

Add test coverage for managed_physnets without HPB

Change-Id: I15ff2a95632f6066310023ce204e59946b292815
changes/64/790164/1 2018.2.14
Mitchell Jameson 6 months ago
parent
commit
a4e5ef8949
  1. 74
      networking_arista/tests/unit/ml2/test_mechanism_arista.py

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

@ -1293,6 +1293,80 @@ class ManagedFabricManagedFabricHpbTestCase(ml2_test_base.MechTestBase):
self.assertPortBindingDeleted((port['id'], port_host))
class ManagedPhysnetNoHpbTestCase(ml2_test_base.MechTestBase):
def setUp(self):
self.physnet = 'physnet1'
cfg.CONF.set_override('managed_physnets', [self.physnet],
"ml2_arista")
super(ManagedPhysnetNoHpbTestCase, self).setUp()
def test_managed_physnet_no_hpb(self):
network_tenant = 'net-ten'
net_dict = {'network':
{'name': 'net',
'tenant_id': network_tenant,
'admin_state_up': True,
'shared': False,
'provider:physical_network': self.physnet,
'provider:network_type': 'vlan'}}
network, _ = self.create_network(net_dict)
other_net_dict = {'network':
{'name': 'net',
'tenant_id': network_tenant,
'admin_state_up': True,
'shared': False,
'provider:physical_network': self.physnet2,
'provider:network_type': 'vlan'}}
other_network, _ = self.create_network(other_net_dict)
# Create VM port
device_id_1 = 'vm-1'
port_tenant = 'port-ten'
port_host_1 = self.host1
port_dict_1 = {'name': 'port1',
'tenant_id': port_tenant,
'network_id': network['id'],
'admin_state_up': True,
'fixed_ips': [],
'device_id': device_id_1,
'device_owner': 'compute:',
'binding:host_id': port_host_1}
port_1, _ = self.create_port(port_dict_1)
self.assertTenantCreated(port_tenant)
self.assertVmCreated(device_id_1)
self.assertVmPortCreated(port_1['id'])
self.assertPortBindingCreated((port_1['id'], port_host_1))
# Create VM port on unmanaged physnet
device_id_2 = 'vm-2'
port_host_2 = self.host3
port_dict_2 = {'name': 'port2',
'tenant_id': port_tenant,
'network_id': other_network['id'],
'admin_state_up': True,
'fixed_ips': [],
'device_id': device_id_2,
'device_owner': 'compute:',
'binding:host_id': port_host_2}
port_2, _ = self.create_port(port_dict_2)
# The VM/Port should not have been created
self.assertVmDeleted(device_id_2)
self.assertVmPortDeleted(port_2['id'])
self.assertPortBindingDeleted((port_2['id'], port_host_2))
# Delete VM port
self.delete_port(port_1['id'])
self.assertVmDeleted(device_id_1)
self.assertVmPortDeleted(port_1['id'])
self.assertPortBindingDeleted((port_1['id'], port_host_1))
# Delete other unmanaged VM port
self.delete_port(port_2['id'])
self.assertTenantDeleted(port_tenant)
class BasicL3HARouterTests(object):
def test_create_delete_router(self):

Loading…
Cancel
Save