From a43f9b15e0c1fb00edaac70bf3ccc8238cef5e67 Mon Sep 17 00:00:00 2001 From: Francesco Santoro Date: Sun, 23 Oct 2016 16:53:45 +0200 Subject: [PATCH] os-vif: add new port profiles to enable fast path vhostuser The 6WIND fast path technology provides connectivity for vhostuser ports in traditional networks (including ovs, linuxbridge, calico). This patch defines new port profiles to model fast path vhostuser vifs in order to provide os-vif plugin with enough information for plug/unplug ports. Signed-off-by: Francesco Santoro Change-Id: Ibae8e2ae145b2b9ad2b4955825638dee9b56f0aa --- doc/source/vif_types.rst | 18 +++++++++ os_vif/objects/vif.py | 39 +++++++++++++++++++ os_vif/tests/test_vif.py | 31 +++++++++++++++ ...th-vhostuser-support-fe87e558326909b6.yaml | 7 ++++ 4 files changed, 95 insertions(+) create mode 100644 releasenotes/notes/add-fast-path-vhostuser-support-fe87e558326909b6.yaml diff --git a/doc/source/vif_types.rst b/doc/source/vif_types.rst index 180d8cb7..24c7fa81 100644 --- a/doc/source/vif_types.rst +++ b/doc/source/vif_types.rst @@ -97,6 +97,24 @@ VIFPortProfile8021Qbh This profile provides the metadata required to associate a VIF with a VEPA host device supporting the 801.1Qbg spec. +VIFPortProfileFPOpenVSwitch +--------------------------- + +This profile provides the metadata required to associate a fast path +vhostuser VIF with an openvswitch port. + +VIFPortProfileFPBridge +---------------------- + +This profile provides the metadata required to associate a fast path +vhostuser VIF with a linuxbridge port. + +VIFPortProfileFPTap +------------------- + +This profile provides the metadata required to associate a fast path +vhostuser VIF with a calico port. + VIF network objects =================== diff --git a/os_vif/objects/vif.py b/os_vif/objects/vif.py index 1504018b..0f812c3f 100644 --- a/os_vif/objects/vif.py +++ b/os_vif/objects/vif.py @@ -180,6 +180,45 @@ class VIFPortProfileOpenVSwitch(VIFPortProfileBase): } +@base.VersionedObjectRegistry.register +class VIFPortProfileFPOpenVSwitch(VIFPortProfileOpenVSwitch): + # Port profile info for OpenVSwitch networks using fastpath + + VERSION = '1.0' + + fields = { + # Name of the bridge (managed by fast path) to connect to + 'bridge_name': fields.StringField(), + + # Whether the OpenVSwitch network is using hybrid plug + 'hybrid_plug': fields.BooleanField(default=False), + } + + +@base.VersionedObjectRegistry.register +class VIFPortProfileFPBridge(VIFPortProfileBase): + # Port profile info for LinuxBridge networks using fastpath + + VERSION = '1.0' + + fields = { + # Name of the bridge (managed by fast path) to connect to + 'bridge_name': fields.StringField(), + } + + +@base.VersionedObjectRegistry.register +class VIFPortProfileFPTap(VIFPortProfileBase): + # Port profile info for Calico networks using fastpath + + VERSION = '1.0' + + fields = { + # The mac address of the host vhostuser port + 'mac_address': fields.MACAddressField(nullable=True), + } + + @base.VersionedObjectRegistry.register class VIFPortProfile8021Qbg(VIFPortProfileBase): # Port profile info for VEPA 802.1qbg networks diff --git a/os_vif/tests/test_vif.py b/os_vif/tests/test_vif.py index 229188b6..9a780f0c 100644 --- a/os_vif/tests/test_vif.py +++ b/os_vif/tests/test_vif.py @@ -94,6 +94,34 @@ class TestVIFS(base.TestCase): mode=objects.fields.VIFVHostUserMode.CLIENT, vif_name="vhu123") + def test_vif_vhost_user_fp_ovs(self): + prof = objects.vif.VIFPortProfileFPOpenVSwitch( + interface_id="07bd6cea-fb37-4594-b769-90fc51854ee8", + profile_id="fishfood", + bridge_name="br-int", + hybrid_plug=False) + self._test_vif(objects.vif.VIFVHostUser, + path="/some/socket.path", + mode=objects.fields.VIFVHostUserMode.CLIENT, + vif_name="tap123", + port_profile=prof) + + def test_vif_vhost_user_fp_lb(self): + prof = objects.vif.VIFPortProfileFPBridge(bridge_name="brq456") + self._test_vif(objects.vif.VIFVHostUser, + path="/some/socket.path", + mode=objects.fields.VIFVHostUserMode.CLIENT, + vif_name="tap123", + port_profile=prof) + + def test_vif_vhost_user_fp_tap(self): + prof = objects.vif.VIFPortProfileFPTap(mac_address="fa:16:3e:4c:2c:30") + self._test_vif(objects.vif.VIFVHostUser, + path="/some/socket.path", + mode=objects.fields.VIFVHostUserMode.CLIENT, + vif_name="tap123", + port_profile=prof) + def test_vif_host_dev_plain(self): self._test_vif( objects.vif.VIFHostDevice, @@ -129,6 +157,9 @@ object_data = { 'VIFPortProfile8021Qbh': '1.0-4b945f07d2666ab00a48d1dc225669b1', 'VIFPortProfileBase': '1.0-77509ea1ea0dd750d5864b9bd87d3f9d', 'VIFPortProfileOpenVSwitch': '1.0-533126c2a16b1a40ddf38c33e7b1f1c5', + 'VIFPortProfileFPOpenVSwitch': '1.0-9fc1799cb0adcd469481653b0420dc5e', + 'VIFPortProfileFPBridge': '1.0-d50872b3cddd245ffebef6053dfbe27a', + 'VIFPortProfileFPTap': '1.0-11670d8dbabd772ff0da26961adadc5a', 'VIFVHostUser': '1.1-1f95b43be1f884f090ca1f4d79adfd35', } diff --git a/releasenotes/notes/add-fast-path-vhostuser-support-fe87e558326909b6.yaml b/releasenotes/notes/add-fast-path-vhostuser-support-fe87e558326909b6.yaml new file mode 100644 index 00000000..b70666de --- /dev/null +++ b/releasenotes/notes/add-fast-path-vhostuser-support-fe87e558326909b6.yaml @@ -0,0 +1,7 @@ +--- +features: + - New port profiles have been added to describe vhostuser fast path VIFs. + In particular fast path vhostuser ports can be used with ovs, + linuxbridge and calico networks. + Thus for each kind of network a dedicated port profile class has been + defined.