Add possibility to define list of services/modules/packages to skip

Change-Id: Ice289221e6e99181682ddf9155f390c388e590ad
Related-Prod: #PROD-27215(PROD:27215)
diff --git a/cvp-sanity/cvp_checks/global_config.yaml b/cvp-sanity/cvp_checks/global_config.yaml
index 47a28cd..1521383 100644
--- a/cvp-sanity/cvp_checks/global_config.yaml
+++ b/cvp-sanity/cvp_checks/global_config.yaml
@@ -81,3 +81,12 @@
 # ntp test setting
 # this test may skip specific node (use fqdn)
 ntp_skipped_nodes: [""]
+
+# packages need to skip in
+# test_check_package_versions
+skipped_packages: [""]
+# test_check_module_versions
+skipped_modules: [""]
+# test_check_services
+skipped_services: [""]
+
diff --git a/cvp-sanity/cvp_checks/tests/test_packet_checker.py b/cvp-sanity/cvp_checks/tests/test_packet_checker.py
index f76c339..21a6a6b 100644
--- a/cvp-sanity/cvp_checks/tests/test_packet_checker.py
+++ b/cvp-sanity/cvp_checks/tests/test_packet_checker.py
@@ -1,34 +1,37 @@
 import pytest
 import json
-
+from cvp_checks import utils
 
 def test_check_package_versions(local_salt_client, nodes_in_group):
-    output = local_salt_client.cmd("L@"+','.join(nodes_in_group),
-                                   'lowpkg.list_pkgs',
-                                   expr_form='compound')
+    exclude_packages = utils.get_configuration().get("skipped_packages", [])
+    packages_versions = local_salt_client.cmd("L@"+','.join(nodes_in_group),
+                                               'lowpkg.list_pkgs',
+                                               expr_form='compound')
     # Let's exclude cid01 and dbs01 nodes from this check
     exclude_nodes = local_salt_client.cmd("I@galera:master or I@gerrit:client",
                                           'test.ping',
                                           expr_form='compound').keys()
-    total_nodes = [i for i in output.keys() if i not in exclude_nodes]
+    total_nodes = [i for i in packages_versions.keys() if i not in exclude_nodes]
     if len(total_nodes) < 2:
         pytest.skip("Nothing to compare - only 1 node")
 
     nodes = []
     pkts_data = []
-    my_set = set()
+    packages_names = set()
 
     for node in total_nodes:
         nodes.append(node)
-        my_set.update(output[node].keys())
+        packages_names.update(packages_versions[node].keys())
 
-    for deb in my_set:
+    for deb in packages_names:
+        if deb in exclude_packages:
+            continue
         diff = []
         row = []
         for node in nodes:
-            if deb in output[node].keys():
-                diff.append(output[node][deb])
-                row.append("{}: {}".format(node, output[node][deb]))
+            if deb in packages_versions[node].keys():
+                diff.append(packages_versions[node][deb])
+                row.append("{}: {}".format(node, packages_versions[node][deb]))
             else:
                 row.append("{}: No package".format(node))
         if diff.count(diff[0]) < len(nodes):
@@ -41,6 +44,7 @@
 
 
 def test_check_module_versions(local_salt_client, nodes_in_group):
+    exclude_modules = utils.get_configuration().get("skipped_modules", [])
     pre_check = local_salt_client.cmd(
         "L@"+','.join(nodes_in_group),
         'cmd.run',
@@ -56,26 +60,28 @@
 
     if len(total_nodes) < 2:
         pytest.skip("Nothing to compare - only 1 node")
-    output = local_salt_client.cmd("L@"+','.join(nodes_in_group),
+    list_of_pip_packages = local_salt_client.cmd("L@"+','.join(nodes_in_group),
                                    'pip.freeze', expr_form='compound')
 
     nodes = []
 
     pkts_data = []
-    my_set = set()
+    packages_names = set()
 
     for node in total_nodes:
         nodes.append(node)
-        my_set.update([x.split("=")[0] for x in output[node]])
-        output[node] = dict([x.split("==") for x in output[node]])
+        packages_names.update([x.split("=")[0] for x in list_of_pip_packages[node]])
+        list_of_pip_packages[node] = dict([x.split("==") for x in list_of_pip_packages[node]])
 
-    for deb in my_set:
+    for deb in packages_names:
+        if deb in exclude_modules:
+            continue
         diff = []
         row = []
         for node in nodes:
-            if deb in output[node].keys():
-                diff.append(output[node][deb])
-                row.append("{}: {}".format(node, output[node][deb]))
+            if deb in list_of_pip_packages[node].keys():
+                diff.append(list_of_pip_packages[node][deb])
+                row.append("{}: {}".format(node, list_of_pip_packages[node][deb]))
             else:
                 row.append("{}: No module".format(node))
         if diff.count(diff[0]) < len(nodes):
diff --git a/cvp-sanity/cvp_checks/tests/test_services.py b/cvp-sanity/cvp_checks/tests/test_services.py
index fc1d0a5..4afad0b 100644
--- a/cvp-sanity/cvp_checks/tests/test_services.py
+++ b/cvp-sanity/cvp_checks/tests/test_services.py
@@ -15,7 +15,7 @@
     Skips services if they are not consistent for all node.
     Inconsistent services will be checked with another test case
     """
-    exclude_services = utils.get_configuration().get("exclude_services", [])
+    exclude_services = utils.get_configuration().get("skipped_services", [])
     services_by_nodes = local_salt_client.cmd("L@"+','.join(nodes_in_group), 'service.get_all', expr_form='compound')
 
     if len(services_by_nodes.keys()) < 2: