Service sanity check from REST API

Change-Id: I98d869aea82ea654d51edd9149ad6cffc9840381
diff --git a/src/test/cord-api/Framework/utils/utils.py b/src/test/cord-api/Framework/utils/utils.py
index 7bedeff..8b3b576 100644
--- a/src/test/cord-api/Framework/utils/utils.py
+++ b/src/test/cord-api/Framework/utils/utils.py
@@ -60,6 +60,26 @@
         return True
 
     '''
+    @method compare_list_of_dicts
+    @Description: validates if contents of dicts in list1 exists in dicts of list2
+    returns True if for each dict in list1, there's a dict in list2 that contains its content
+    '''
+    def compare_list_of_dicts(self, list1, list2):
+        for dict1 in list1:
+            if dict1 == {}:
+                continue
+            key = dict1.keys()[0]
+            value = dict1[key]
+            dict2 = self.getDictFromListOfDict(list2, key, value)
+            if dict2 == {}:
+                print "Comparison failed: no dictionaries found in list2 with key", key, "and value", value
+                return False
+            if self.compare_dict(dict1, dict2) == False:
+                print "Comparison failed: dictionary", dict1, "is not a subset of dictionary", dict2
+                return False
+        return True
+
+    '''
     @method search_dictionary
     @Description: Searches for a key in the provided nested dictionary
     @params: input_dict = dictionary to be searched
diff --git a/src/test/cord-api/Tests/ServiceSanity.txt b/src/test/cord-api/Tests/ServiceSanity.txt
new file mode 100644
index 0000000..a46d61e
--- /dev/null
+++ b/src/test/cord-api/Tests/ServiceSanity.txt
@@ -0,0 +1,35 @@
+*** Settings ***
+Documentation     Test suite for Service sanity verification
+Suite Setup       Read InputFile
+Test Template     Verify Service Sanity
+Library           Collections
+Library           String
+Library           OperatingSystem
+Library           XML
+Library           RequestsLibrary
+Library           ../Framework/utils/utils.py
+Library           ../Framework/restApi.py
+
+*** Variables ***
+${USER}           admin
+${PASSWORD}       admin
+${PATHFILE}       ${CURDIR}/data/defaultServices.json
+
+*** Test Cases ***      TYPE
+Test Service Sanity     SANITY
+
+*** Keywords ***
+Read InputFile
+    ${serviceList}=    utils.jsonToList    ${PATHFILE}    ServiceInfo
+    Set Suite Variable    ${slist}    ${serviceList}
+
+Verify Service Sanity
+    [Arguments]    ${type}
+    Run Keyword If    "${type}" == "SANITY"    Test Service Sanity
+
+Test Service Sanity
+    ${json_result}=    restApi.ApiGet   CORE_SERVICES
+    Log    ${json_result}
+    ${serviceList}=    Get Variable Value    ${slist}
+    ${test_result}=    utils.compare_list_of_dicts    ${serviceList}    ${json_result}
+    Should Be True    ${test_result}
diff --git a/src/test/cord-api/Tests/data/defaultServices.json b/src/test/cord-api/Tests/data/defaultServices.json
new file mode 100644
index 0000000..4128481
--- /dev/null
+++ b/src/test/cord-api/Tests/data/defaultServices.json
@@ -0,0 +1,13 @@
+{
+    "ServiceInfo":
+    [
+        {"name": "ONOS_CORD"},
+        {"name": "vtn"},
+        {"name": "fabric"},
+        {"name": "ONOS_Fabric"},
+        {"name": "vrouter"},
+        {"name": "vsg"},
+        {"name": "volt"},
+        {"name": "vtr"}
+    ]
+}