Make vmware unit tests work with CONF.use_neutron=True

This makes the vmware unit tests work with
CONF.use_neutron=True by default which we're going to
eventually set by the end of the Ocata release.

Part of blueprint use-neutron-by-default

Change-Id: Ic38d5eeb84e5d5659276e414bc3fa6637c3a7742
This commit is contained in:
Matt Riedemann 2016-11-12 18:54:25 -05:00
parent 6d594bfba5
commit 5969b63c02
4 changed files with 14 additions and 3 deletions

View File

@ -162,11 +162,15 @@ def get_test_network_info(count=1):
vlan=FAKE_NETWORK_VLAN,
bridge_interface=FAKE_NETWORK_INTERFACE,
injected=False)
if CONF.use_neutron:
vif_type = network_model.VIF_TYPE_OVS
else:
vif_type = network_model.VIF_TYPE_BRIDGE
vif = network_model.VIF(
id=FAKE_VIF_UUID,
address=FAKE_VIF_MAC,
network=network,
type=network_model.VIF_TYPE_BRIDGE,
type=vif_type,
devname=None,
ovs_interfaceid=None)

View File

@ -19,8 +19,11 @@ Stubouts for the test suite
from oslo_vmware import exceptions as vexc
import nova.conf
from nova.tests.unit.virt.vmwareapi import fake
CONF = nova.conf.CONF
def fake_get_vim_object(arg):
"""Stubs out the VMwareAPISession's get_vim_object method."""
@ -75,3 +78,7 @@ def set_stubs(test):
fake_vim_prop)
test.stub_out('nova.virt.vmwareapi.driver.VMwareAPISession._is_vim_object',
fake_is_vim_object)
if CONF.use_neutron:
test.stub_out(
'nova.network.neutronv2.api.API.update_instance_vnic_index',
lambda *args, **kwargs: None)

View File

@ -2158,7 +2158,7 @@ class VMwareAPIVMTestCase(test.NoDBTestCase):
vif_bridge_neutron = network_model.VIF(id='new-vif-xxx-yyy-zzz',
address='ca:fe:de:ad:be:ef',
network=network_neutron,
type=None,
type=network_model.VIF_TYPE_OVS,
devname='tap-xxx-yyy-zzz',
ovs_interfaceid='aaa-bbb-ccc')
return vif_bridge_neutron

View File

@ -127,7 +127,7 @@ class VMwareVMOpsTestCase(test.NoDBTestCase):
'id': None,
'address': 'DE:AD:BE:EF:00:00',
'network': network,
'type': None,
'type': network_model.VIF_TYPE_OVS,
'devname': None,
'ovs_interfaceid': None,
'rxtx_cap': 3