contrail: add vrouter VIF plugin type support
The VIF plugin will provide support OpenContrail SDN Controller driver in nova. It will initially be used for OpenContrail dpdk driver. The plugin is located here: https://github.com/Juniper/contrail-nova-vif-driver Implements: blueprint opencontrail-nova-vif-plugin Change-Id: Ic23effc05c901575f608f2b4c5ccd2b1fb3c2d5a
This commit is contained in:
parent
e88dd0034b
commit
1ba834c0e4
nova
releasenotes/notes
@ -82,6 +82,10 @@ VIF_DETAILS_VHOSTUSER_OVS_PLUG = 'vhostuser_ovs_plug'
|
||||
# Specifies whether vhost-user socket should be used to
|
||||
# create a fp netdevice interface.
|
||||
VIF_DETAILS_VHOSTUSER_FP_PLUG = 'vhostuser_fp_plug'
|
||||
# Specifies whether vhost-user socket should be used to
|
||||
# create a vrouter netdevice interface
|
||||
# TODO(mhenkel): Consider renaming this to be contrail-specific.
|
||||
VIF_DETAILS_VHOSTUSER_VROUTER_PLUG = 'vhostuser_vrouter_plug'
|
||||
# ovs vhost user interface type name
|
||||
OVS_VHOSTUSER_INTERFACE_TYPE = 'dpdkvhostuser'
|
||||
|
||||
|
@ -333,6 +333,12 @@ def _nova_to_osvif_vif_vhostuser(vif):
|
||||
obj.bridge_name = vif["network"]["bridge"]
|
||||
_set_vhostuser_settings(vif, obj)
|
||||
return obj
|
||||
elif vif['details'].get(model.VIF_DETAILS_VHOSTUSER_VROUTER_PLUG, False):
|
||||
obj = _get_vif_instance(vif, objects.vif.VIFVHostUser,
|
||||
plugin="contrail_vrouter",
|
||||
vif_name=_get_vif_name(vif))
|
||||
_set_vhostuser_settings(vif, obj)
|
||||
return obj
|
||||
else:
|
||||
raise NotImplementedError()
|
||||
|
||||
|
@ -816,3 +816,59 @@ class OSVIFUtilTestCase(test.NoDBTestCase):
|
||||
self.assertRaises(exception.NovaException,
|
||||
os_vif_util.nova_to_osvif_vif,
|
||||
vif)
|
||||
|
||||
def test_nova_to_osvif_vhostuser_vrouter(self):
|
||||
vif = model.VIF(
|
||||
id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
type=model.VIF_TYPE_VHOSTUSER,
|
||||
address="22:52:25:62:e2:aa",
|
||||
network=model.Network(
|
||||
id="b82c1929-051e-481d-8110-4669916c7915",
|
||||
label="Demo Net",
|
||||
subnets=[]),
|
||||
details={
|
||||
model.VIF_DETAILS_VHOSTUSER_MODE: 'client',
|
||||
model.VIF_DETAILS_VHOSTUSER_VROUTER_PLUG: True,
|
||||
model.VIF_DETAILS_VHOSTUSER_SOCKET: '/fake/socket',
|
||||
}
|
||||
)
|
||||
|
||||
actual = os_vif_util.nova_to_osvif_vif(vif)
|
||||
|
||||
expect = osv_objects.vif.VIFVHostUser(
|
||||
id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
active=False,
|
||||
address="22:52:25:62:e2:aa",
|
||||
plugin="contrail_vrouter",
|
||||
vif_name="nicdc065497-3c",
|
||||
path='/fake/socket',
|
||||
mode='client',
|
||||
has_traffic_filtering=False,
|
||||
preserve_on_delete=False,
|
||||
network=osv_objects.network.Network(
|
||||
id="b82c1929-051e-481d-8110-4669916c7915",
|
||||
bridge_interface=None,
|
||||
label="Demo Net",
|
||||
subnets=osv_objects.subnet.SubnetList(
|
||||
objects=[])))
|
||||
|
||||
self.assertObjEqual(expect, actual)
|
||||
|
||||
def test_nova_to_osvif_vhostuser_vrouter_no_socket_path(self):
|
||||
vif = model.VIF(
|
||||
id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
type=model.VIF_TYPE_VHOSTUSER,
|
||||
address="22:52:25:62:e2:aa",
|
||||
network=model.Network(
|
||||
id="b82c1929-051e-481d-8110-4669916c7915",
|
||||
label="Demo Net",
|
||||
subnets=[]),
|
||||
details={
|
||||
model.VIF_DETAILS_VHOSTUSER_MODE: 'client',
|
||||
model.VIF_DETAILS_VHOSTUSER_VROUTER_PLUG: True,
|
||||
}
|
||||
)
|
||||
|
||||
self.assertRaises(exception.VifDetailsMissingVhostuserSockPath,
|
||||
os_vif_util.nova_to_osvif_vif,
|
||||
vif)
|
||||
|
@ -0,0 +1,9 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The model name vhostuser_vrouter_plug is set by the neutron contrail
|
||||
plugin during a VM (network port) creation.
|
||||
The libvirt compute driver now supports plugging virtual interfaces
|
||||
of type "contrail_vrouter" which are provided by
|
||||
the contrail-nova-vif-driver plugin [1].
|
||||
[1] https://github.com/Juniper/contrail-nova-vif-driver
|
Loading…
x
Reference in New Issue
Block a user