import sqlalchemy as sa
+from quantum.api.v2 import attributes
from quantum.db import model_base
from quantum.openstack.common import log as logging
def put_port_hostid(context, port_id, host_id):
+ if not attributes.is_attr_set(host_id):
+ LOG.warning(_("No host_id in port request to track port location."))
+ return
if port_id == '':
LOG.warning(_("Received an empty port ID for host '%s'"), host_id)
return
cfg.CONF.set_override('vif_type', 'ivs', 'NOVA')
+class TestNoHostIDVIFOverride(test_plugin.TestPortsV2,
+ BigSwitchProxyPluginV2TestCase,
+ test_bindings.PortBindingsTestCase):
+ VIF_TYPE = portbindings.VIF_TYPE_OVS
+ HAS_PORT_FILTER = False
+
+ def setUp(self):
+ super(TestNoHostIDVIFOverride, self).setUp()
+ cfg.CONF.set_override('vif_type', 'ovs', 'NOVA')
+
+ def test_port_vif_details(self):
+ kwargs = {'name': 'name', 'device_id': 'override_dev'}
+ with self.port(**kwargs) as port:
+ self.assertEqual(port['port']['binding:vif_type'],
+ portbindings.VIF_TYPE_OVS)
+
+
class TestBigSwitchVIFOverride(test_plugin.TestPortsV2,
BigSwitchProxyPluginV2TestCase,
test_bindings.PortBindingsTestCase):