Flush IP address on change for ovs_port

The patch makes IP address flush for external network
interface where IP address is assigned automatically
however an IP address from the same IP range is hardcoded in
the model.

Change-Id: I4220a635a96a031ad74dca1034c917e7d87d4b11
Related-PROD: PROD-19504
diff --git a/linux/network/interface.sls b/linux/network/interface.sls
index 180f912..21ec084 100644
--- a/linux/network/interface.sls
+++ b/linux/network/interface.sls
@@ -249,25 +249,6 @@
   - mode: {{ interface.mode }}
   {%- endif %}
 
-{%- if interface.get('ipflush_onchange', False) %}
-
-linux_interface_ipflush_onchange_{{ interface_name }}:
-  cmd.run:
-  - name: "/sbin/ip address flush dev {{ interface_name }}"
-  - onchanges:
-    - network: linux_interface_{{ interface_name }}
-
-{%- if interface.get('restart_on_ipflush', False) %}
-
-linux_interface_restart_on_ipflush_{{ interface_name }}:
-  cmd.run:
-  - name: "ifdown {{ interface_name }}; ifup {{ interface_name }};"
-  - onchanges:
-    - cmd: linux_interface_ipflush_onchange_{{ interface_name }}
-
-{%- endif %}
-
-{%- endif %}
 
 {%- if salt['grains.get']('saltversion') < '2017.7' %}
 # TODO(ddmitriev): Remove this 'if .. endif' block completely when
@@ -379,6 +360,34 @@
 
 {%- endif %}
 
+{%- if interface.type in ('eth','ovs_port') %}
+{%- if interface.get('ipflush_onchange', False) %}
+
+linux_interface_ipflush_onchange_{{ interface_name }}:
+  cmd.run:
+  - name: "/sbin/ip address flush dev {{ interface_name }}"
+{%- if interface.type == 'eth' %}
+  - onchanges:
+    - network: linux_interface_{{ interface_name }}
+{%- elif interface.type == 'ovs_port' %}
+  - onchanges:
+    - file: ovs_port_{{ interface_name }}
+{%- endif %}
+
+{%- if interface.get('restart_on_ipflush', False) %}
+
+linux_interface_restart_on_ipflush_{{ interface_name }}:
+  cmd.run:
+  - name: "ifdown {{ interface_name }}; ifup {{ interface_name }};"
+  - onchanges:
+    - cmd: linux_interface_ipflush_onchange_{{ interface_name }}
+
+{%- endif %}
+
+{%- endif %}
+
+{%- endif %}
+
 {%- endfor %}
 
 {%- if network.bridge != 'none' %}