Fix broken unit tests

Commit I0a1c128858c1d639e80763cac0df358949c56cfb broke ipv6
unit tests, becasue it prevents setting a new port as compute

Change-Id: Id5d27a0971bd2f8be072261ee23933043f77518f
This commit is contained in:
asarfaty 2020-01-08 09:23:23 +02:00
parent 89bf73715b
commit 2d95529bb6
1 changed files with 8 additions and 4 deletions

View File

@ -1270,7 +1270,9 @@ class TestPortsV2(NsxVPluginV2TestCase,
data['port']['fixed_ips'])
def _update_port_index(self, port_id, device_id, index):
data = {'port': {'device_id': device_id, 'vnic_index': index}}
data = {'port': {'device_owner': 'compute:None',
'device_id': device_id,
'vnic_index': index}}
req = self.new_update_request('ports',
data, port_id)
res = self.deserialize('json', req.get_response(self.api))
@ -1291,9 +1293,11 @@ class TestPortsV2(NsxVPluginV2TestCase,
with self.port(subnet=subnet,
device_id=device_id,
mac_address=port_mac,
fixed_ips=fixed_ip_data,
device_owner='compute:None') as port:
self.assertIsNone(port['port']['vnic_index'])
fixed_ips=fixed_ip_data) as port:
# set port as compute first
res = self._update_port_index(
port['port']['id'], device_id, None)
self.assertIsNone(res['port']['vnic_index'])
self.fc2.approve_assigned_addresses = (
mock.Mock().approve_assigned_addresses)