Install Neutron services prior to client state

It was found that if neutron flat network is being created
when neutron-openvswitch-agent is not running the network
and subnet are created without errors however the corresponding
neutron port will be in unusable state - binding:vif_type parameter
will have "binding_failed" value and port admin state will be DOWN.
More information could be found on the following link:
https://bugs.launchpad.net/neutron/+bug/1399249
As a result full neutron state is invoked on neutron:gateway nodes and
neutron.client state invocation order was changed to ensure it runs
after neutron agents are installed

Related-PROD: PROD-18590

Change-Id: I9031c844519a34d7355cbeb134610fbe93c60503
diff --git a/src/com/mirantis/mk/Orchestrate.groovy b/src/com/mirantis/mk/Orchestrate.groovy
index 47ee7cf..694aa4f 100644
--- a/src/com/mirantis/mk/Orchestrate.groovy
+++ b/src/com/mirantis/mk/Orchestrate.groovy
@@ -270,11 +270,6 @@
         }
     }
 
-    // Create neutron resources
-    if (salt.testTarget(master, 'I@neutron:client')) {
-        salt.enforceState(master, 'I@neutron:client', 'neutron.client')
-    }
-
     // Install heat service
     if (salt.testTarget(master, 'I@heat:server')) {
         // run on first node first
@@ -414,6 +409,20 @@
 
 def installOpenstackNetwork(master, physical = "false") {
     def salt = new com.mirantis.mk.Salt()
+    //run full neutron state on neutron.gateway - this will install
+    //neutron agents in addition to neutron server. Once neutron agents
+    //are up neutron resources can be created without hitting the situation when neutron resources are created
+    //prior to neutron agents which results in creating ports in non-usable state
+    if (salt.testTarget(master, 'I@neutron:gateway')) {
+            salt.enforceState(master, 'I@neutron:gateway', 'neutron')
+    }
+
+    // Create neutron resources - this step was moved here to ensure that
+    //neutron resources are created after neutron agens are up. In this case neutron ports will be in
+    //usable state. More information: https://bugs.launchpad.net/neutron/+bug/1399249
+    if (salt.testTarget(master, 'I@neutron:client')) {
+        salt.enforceState(master, 'I@neutron:client', 'neutron.client')
+    }
 
     salt.enforceHighstate(master, 'I@neutron:gateway')