Merge "Remove stacklight1"
diff --git a/opencontrail40-upgrade.groovy b/opencontrail40-upgrade.groovy
index 76243e5..bf35d97 100644
--- a/opencontrail40-upgrade.groovy
+++ b/opencontrail40-upgrade.groovy
@@ -26,13 +26,16 @@
 def command = 'cmd.shell'
 
 def controlPkgs = 'contrail-config,contrail-config-openstack,contrail-control,contrail-dns,contrail-lib,contrail-nodemgr,contrail-utils,contrail-web-controller,contrail-web-core,neutron-plugin-contrail,python-contrail,contrail-database'
+def thirdPartyControlPkgsToRemove = 'redis-server,ifmap-server,supervisor'
 def analyticsPkgs = 'contrail-analytics,contrail-lib,contrail-nodemgr,contrail-utils,python-contrail,contrail-database'
+def thirdPartyAnalyticsPkgsToRemove = 'redis-server,supervisor'
 //def cmpPkgs = ['contrail-lib', 'contrail-nodemgr', 'contrail-utils', 'contrail-vrouter-agent', 'contrail-vrouter-utils', 'python-contrail', 'python-contrail-vrouter-api', 'python-opencontrail-vrouter-netns', 'contrail-vrouter-dkms']
 def CMP_PKGS = 'contrail-lib contrail-nodemgr contrail-utils contrail-vrouter-agent contrail-vrouter-utils python-contrail python-contrail-vrouter-api python-opencontrail-vrouter-netns contrail-vrouter-dkms'
 def KERNEL_MODULE_RELOAD = 'service supervisor-vrouter stop;ifdown vhost0;rmmod vrouter;modprobe vrouter;ifup vhost0;service supervisor-vrouter start;'
-def analyticsServices = ['supervisor-analytics', 'supervisor-database', 'zookeeper']
+def analyticsServices = ['supervisor-analytics', 'supervisor-database', 'zookeeper', 'redis-server']
 def configServices = ['contrail-webui-jobserver', 'contrail-webui-webserver', 'supervisor-config', 'supervisor-database', 'zookeeper']
-def controlServices = ['ifmap-server', 'supervisor-control']
+def controlServices = ['ifmap-server', 'supervisor-control', 'redis-server']
+def thirdPartyServicesToDisable = ['kafka', 'zookeeper', 'cassandra']
 def config4Services = ['zookeeper', 'contrail-webui-middleware', 'contrail-webui', 'contrail-api', 'contrail-schema', 'contrail-svc-monitor', 'contrail-device-manager', 'contrail-config-nodemgr', 'contrail-database']
 
 def void runCommonCommands(target, command, args, check, salt, pepperEnv, common) {
@@ -107,7 +110,7 @@
                     common.errorMsg('Cassandra failed to backup. Please fix it before continuing.')
                     throw er
                 }
-                
+
                 salt.runSaltProcessStep(pepperEnv, 'I@neutron:server', 'service.stop', ['neutron-server'])
 
                 try {
@@ -167,14 +170,14 @@
             salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'archive.tar', ['zcvf', '/root/contrail-zookeeper.tgz', '/var/lib/zoopeeker'])
             salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector', 'archive.tar', ['zcvf', '/root/contrail-analytics-database.tgz', '/var/lib/cassandra'])
             salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector', 'archive.tar', ['zcvf', '/root/contrail-analytics-zookeeper.tgz', '/var/lib/zookeeper'])
-            //salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'pkg.remove', [controlPkgs])
-            //salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector', 'pkg.remove', [analyticsPkgs])
-            for (service in controlServices) {
+            for (service in (controlServices + thirdPartyServicesToDisable)) {
                 salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'service.disable', [service])
             }
-            for (service in analyticsServices) {
+            for (service in (analyticsServices + thirdPartyServicesToDisable)) {
                 salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector', 'service.disable', [service])
-                }
+            }
+            salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'pkg.remove', [controlPkgs + ',' + thirdPartyControlPkgsToRemove])
+            salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector', 'pkg.remove', [analyticsPkgs + ',' + thirdPartyAnalyticsPkgsToRemove])
         }
 
 
@@ -305,6 +308,12 @@
 
                 salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control and *01*', 'cmd.shell', ['cd /etc/docker/compose/opencontrail/; docker-compose down'], null, true)
                 salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control and *01*', 'state.sls', ['opencontrail', 'exclude=opencontrail.client'])
+                for (service in (controlServices + thirdPartyServicesToDisable)) {
+                    salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'service.enable', [service])
+                }
+                for (service in (analyticsServices + thirdPartyServicesToDisable)) {
+                    salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector', 'service.enable', [service])
+                }
             }
         }
 
diff --git a/test-cookiecutter-reclass.groovy b/test-cookiecutter-reclass.groovy
index 5184926..6e85801 100644
--- a/test-cookiecutter-reclass.groovy
+++ b/test-cookiecutter-reclass.groovy
@@ -18,6 +18,7 @@
 python = new com.mirantis.mk.Python()
 
 slaveNode = env.SLAVE_NODE ?: 'docker'
+checkIncludeOrder = env.CHECK_INCLUDE_ORDER ?: false
 
 // Global var's
 alreadyMerged = false
@@ -440,41 +441,46 @@
                 currentBuild.description = currentBuild.description ? currentBuild.description + result : result
             }
             stage('Check include order') {
-                def correctIncludeOrder = ["service", "system", "cluster"]
-                dir(reclassInfoPatchedPath) {
-                    def nodeInfoFiles = findFiles(glob: "**/*.reclass.nodeinfo")
-                    def messages = ["<b>Wrong include ordering found</b><ul>"]
-                    def stepsForParallel = [:]
-                    nodeInfoFiles.each { nodeInfo ->
-                        stepsForParallel.put("Checking ${nodeInfo.path}:", {
-                            def node = readYaml file: nodeInfo.path
-                            def classes = node['classes']
-                            def curClassID = 0
-                            def prevClassID = 0
-                            def wrongOrder = false
-                            for(String className in classes) {
-                                def currentClass = className.tokenize('.')[0]
-                                curClassID = correctIncludeOrder.indexOf(currentClass)
-                                if (currentClass != correctIncludeOrder[prevClassID]) {
-                                    if (prevClassID > curClassID) {
-                                        wrongOrder = true
-                                        common.warningMsg("File ${nodeInfo.path} contains wrong order of classes including: Includes for ${className} should be declared before ${correctIncludeOrder[prevClassID]} includes")
-                                    } else {
-                                        prevClassID = curClassID
+                if (!checkIncludeOrder) {
+                    common.infoMsg('Check include order require to much time, and currently disabled!')
+
+                } else {
+                    def correctIncludeOrder = ["service", "system", "cluster"]
+                    dir(reclassInfoPatchedPath) {
+                        def nodeInfoFiles = findFiles(glob: "**/*.reclass.nodeinfo")
+                        def messages = ["<b>Wrong include ordering found</b><ul>"]
+                        def stepsForParallel = [:]
+                        nodeInfoFiles.each { nodeInfo ->
+                            stepsForParallel.put("Checking ${nodeInfo.path}:", {
+                                def node = readYaml file: nodeInfo.path
+                                def classes = node['classes']
+                                def curClassID = 0
+                                def prevClassID = 0
+                                def wrongOrder = false
+                                for (String className in classes) {
+                                    def currentClass = className.tokenize('.')[0]
+                                    curClassID = correctIncludeOrder.indexOf(currentClass)
+                                    if (currentClass != correctIncludeOrder[prevClassID]) {
+                                        if (prevClassID > curClassID) {
+                                            wrongOrder = true
+                                            common.warningMsg("File ${nodeInfo.path} contains wrong order of classes including: Includes for ${className} should be declared before ${correctIncludeOrder[prevClassID]} includes")
+                                        } else {
+                                            prevClassID = curClassID
+                                        }
                                     }
                                 }
-                            }
-                            if(wrongOrder) {
-                                messages.add("<li>${nodeInfo.path} contains wrong order of classes including</li>")
-                            }
-                        })
+                                if (wrongOrder) {
+                                    messages.add("<li>${nodeInfo.path} contains wrong order of classes including</li>")
+                                }
+                            })
+                        }
+                        parallel stepsForParallel
+                        def includerOrder = '<b>No wrong include order</b>'
+                        if (messages.size() != 1) {
+                            includerOrder = messages.join('')
+                        }
+                        currentBuild.description = currentBuild.description ? currentBuild.description + includerOrder : includerOrder
                     }
-                    parallel stepsForParallel
-                    def includerOrder = '<b>No wrong include order</b>'
-                    if (messages.size() != 1) {
-                        includerOrder = messages.join('')
-                    }
-                    currentBuild.description = currentBuild.description ? currentBuild.description + includerOrder : includerOrder
                 }
             }
             sh(script: 'find . -mindepth 1 -delete > /dev/null || true')