Merge "Add ability to add linux network interface into OVS dpdk bridge"
diff --git a/README.rst b/README.rst
index 7853293..fea2e1a 100644
--- a/README.rst
+++ b/README.rst
@@ -1478,6 +1478,60 @@
             enabled: true
             type: dpdk_ovs_bridge
 
+**DPDK OVS LACP Bond with vlan tag**
+
+.. code-block:: yaml
+
+    linux:
+      network:
+        bridge: openvswitch
+        dpdk:
+          enabled: true
+          driver: uio
+        openvswitch:
+          pmd_cpu_mask: "0x6"
+          dpdk_socket_mem: "1024,1024"
+          dpdk_lcore_mask: "0x400"
+          memory_channels: "2"
+        interface:
+          eth3:
+            enabled: true
+            type: eth
+            proto: manual
+            name: ${_param:tenant_first_nic}
+          eth4:
+            enabled: true
+            type: eth
+            proto: manual
+            name: ${_param:tenant_second_nic}
+          dpdk0:
+            name: ${_param:tenant_first_nic}
+            pci: "0000:81:00.0"
+            driver: igb_uio
+            bond: bond1
+            enabled: true
+            type: dpdk_ovs_port
+            n_rxq: 2
+          dpdk1:
+            name: ${_param:tenant_second_nic}
+            pci: "0000:81:00.1"
+            driver: igb_uio
+            bond: bond1
+            enabled: true
+            type: dpdk_ovs_port
+            n_rxq: 2
+          bond1:
+            enabled: true
+            bridge: br-prv
+            type: dpdk_ovs_bond
+            mode: balance-slb
+          br-prv:
+            enabled: true
+            type: dpdk_ovs_bridge
+            tag: ${_param:tenant_vlan}
+            address: ${_param:tenant_address}
+            netmask: ${_param:tenant_network_netmask}
+
 **DPDK OVS bridge for VXLAN**
 
 If VXLAN is used as tenant segmentation then ip address must be set on br-prv
diff --git a/linux/files/telegraf.conf b/linux/files/telegraf.conf
new file mode 100644
index 0000000..6a45b6b
--- /dev/null
+++ b/linux/files/telegraf.conf
@@ -0,0 +1,9 @@
+[[inputs.bond]]
+{%- include 'telegraf/files/input/_common.conf' %}
+{%- if values.bond_interfaces is defined %}
+  bond_interfaces = {{ values.bond_interfaces | json }}
+{%- endif %}
+{%- if values.host_proc is defined %}
+  host_proc = "{{ values.host_proc | json }}"
+{%- endif %}
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/linux/meta/prometheus.yml b/linux/meta/prometheus.yml
index b2911d5..153705c 100644
--- a/linux/meta/prometheus.yml
+++ b/linux/meta/prometheus.yml
@@ -142,3 +142,25 @@
       annotations:
         summary: 'Swap output throughput too high on {{ $labels.host }}'
         description: 'The rate of swap output bytes is too high on node {{ $labels.host }} (current value={{ $value }}b/s, threshold={% endraw %}{{ swap_out_threshold }}b/s).'
+{%- if monitoring.bond_status.interfaces is defined and monitoring.bond_status.interfaces %}
+    BondInterfaceDown:
+      if: 'bond_status < 1'
+      {% raw %}
+      labels:
+        severity: critical
+        service: system
+      annotations:
+        summary: 'Bond status interface {{ $labels.bond }} is DOWN on {{ $labels.host }}'
+        description: 'The bond interface ({{ $labels.bond }) has all ifaces in a down state on {{ $labels.host }}.'
+      {% endraw %}
+    BondSlaveInterfaceStatus:
+      if: 'bond_slave_status < 1'
+      {% raw %}
+      labels:
+        severity: warning
+        service: system
+      annotations:
+        summary: 'Bond slave interface {{ $labels.interface }} is DOWN on {{ $labels.host }} for {{ $labels.bond }}'
+        description: 'The bond slave interface ({{ $labels.interface }) is in DOWN state for {{ $labels.bond }} on {{ $labels.host }}.'
+      {% endraw %}
+{%- endif %}
diff --git a/linux/meta/telegraf.yml b/linux/meta/telegraf.yml
index 45fef5c..854bf26 100644
--- a/linux/meta/telegraf.yml
+++ b/linux/meta/telegraf.yml
@@ -1,3 +1,4 @@
+{%- from "linux/map.jinja" import monitoring with context %}
 agent:
   input:
     cpu:
@@ -23,3 +24,13 @@
     swap:
     system:
     linux_sysctl_fs:
+{%- if monitoring.bond_status.interfaces is defined and monitoring.bond_status.interfaces %}
+    bond:
+      template: linux/files/telegraf.conf
+{%- if monitoring.bond_status.interfaces is list %}
+      bond_interfaces: {{ monitoring.bond_status.interfaces }}
+{%- endif %}
+{%- if monitoring.bond_status.host_proc is defined %}
+      host_proc: {{ monitoring.bond_status.host_proc }}
+{%- endif %}
+{%- endif %}
diff --git a/linux/network/dpdk.sls b/linux/network/dpdk.sls
index 4b73f7f..fb2da30 100644
--- a/linux/network/dpdk.sls
+++ b/linux/network/dpdk.sls
@@ -111,7 +111,7 @@
 
 linux_network_dpdk_bond_mode_{{ interface_name }}:
   cmd.run:
-    - name: "ovs-vsctl set port {{ interface_name }} bond_mode={{ interface.mode }}"
+    - name: "ovs-vsctl set port {{ interface_name }} bond_mode={{ interface.mode }}{%- if interface.mode == 'balance-slb' %} lacp=active{%- endif %}"
     - unless: "ovs-appctl bond/show {{ interface_name }} | grep {{ interface.mode }}"
     - require:
         - cmd: linux_network_dpdk_bond_interface_{{ interface_name }}
diff --git a/tests/pillar/network_openvswitch_dpdk.sls b/tests/pillar/network_openvswitch_dpdk.sls
index d202c5e..be8ed98 100644
--- a/tests/pillar/network_openvswitch_dpdk.sls
+++ b/tests/pillar/network_openvswitch_dpdk.sls
@@ -39,14 +39,39 @@
         bond: dpdkbond0
         enabled: true
         type: dpdk_ovs_port
+      dpdk2:
+        name: enp6s0f1
+        pci: "0000:06:00.1"
+        driver: igb_uio
+        bond: dpdkbond1
+        enabled: true
+        type: dpdk_ovs_port
+      dpdk3:
+        name: enp6s0f2
+        pci: "0000:06:00.2"
+        driver: igb_uio
+        bond: dpdkbond1
+        enabled: true
+        type: dpdk_ovs_port
       dpdkbond0:
         enabled: true
         bridge: br-prv
         type: dpdk_ovs_bond
         mode: active-backup
+      dpdkbond1:
+        enabled: true
+        bridge: br-mesh
+        type: dpdk_ovs_bond
+        mode: balance-slb
       br-prv:
         enabled: true
         type: dpdk_ovs_bridge
+      br-mesh:
+        tag: 1302
+        enabled: true
+        type: dpdk_ovs_bridge
+        address: 1.2.3.4
+        netmask: 255.255.255.252
       dummy0:
         enabled: true
         name: dummy0