Add ability to add linux network interface into OVS dpdk bridge
Change-Id: I1c78c9ccbc14cefff8226db50258b56a713abfd5
Related-Prod: PROD-18111
diff --git a/README.rst b/README.rst
index ed21934..7853293 100644
--- a/README.rst
+++ b/README.rst
@@ -1496,6 +1496,25 @@
tag: 101
mtu: 9000
+
+
+**DPDK OVS bridge with Linux network interface**
+
+.. code-block:: yaml
+
+ linux:
+ network:
+ ...
+ interface:
+ eth0:
+ type: eth
+ ovs_bridge: br-prv
+ ...
+ br-prv:
+ enabled: true
+ type: dpdk_ovs_bridge
+ ...
+
Linux storage
-------------
diff --git a/linux/network/interface.sls b/linux/network/interface.sls
index 3e79847..fa37e5e 100644
--- a/linux/network/interface.sls
+++ b/linux/network/interface.sls
@@ -62,6 +62,25 @@
{%- set interface_name = interface.get('name', interface_name) %}
+{# add linux network interface into OVS dpdk bridge #}
+
+{%- if interface.type == 'dpdk_ovs_bridge' %}
+
+{%- for int_name, int in network.interface.items() %}
+
+{%- set int_name = int.get('name', int_name) %}
+
+{%- if int.ovs_bridge is defined and interface_name == int.ovs_bridge %}
+
+add_int_{{ int_name }}_to_ovs_dpdk_bridge_{{ interface_name }}:
+ cmd.run:
+ - unless: ovs-vsctl show | grep -w {{ int_name }}
+ - name: ovs-vsctl add-port {{ interface_name }} {{ int_name }}
+
+{%- endif %}
+{%- endfor %}
+{%- endif %}
+
{# it is not used for any interface with type preffix dpdk,eg. dpdk_ovs_port #}
{%- if interface.get('managed', True) and not 'dpdk' in interface.type %}
diff --git a/tests/pillar/network_openvswitch_dpdk.sls b/tests/pillar/network_openvswitch_dpdk.sls
index d4e6785..d202c5e 100644
--- a/tests/pillar/network_openvswitch_dpdk.sls
+++ b/tests/pillar/network_openvswitch_dpdk.sls
@@ -20,6 +20,11 @@
name: "openvswitch-vhost"
path: "/run/openvswitch-vhost"
interface:
+ eth0:
+ enabled: true
+ type: eth
+ proto: manual
+ ovs_bridge: br-prv
dpdk0:
name: enp5s0f1
pci: "0000:05:00.1"