Cord Api Test directory structure and template files

Change-Id: Ib584b291ec1b4286c179991f2916c6e2cf7642a9
diff --git a/src/test/cord-api/Framework/utils/readProperties.py b/src/test/cord-api/Framework/utils/readProperties.py
new file mode 100644
index 0000000..6bd8c6f
--- /dev/null
+++ b/src/test/cord-api/Framework/utils/readProperties.py
@@ -0,0 +1,33 @@
+import sys
+
+class readProperties(object):
+    def __init__(self, strPropertiesFile):
+        self.strPropertiesFile = strPropertiesFile
+
+    @staticmethod
+    def parse_line(input):
+        key, value = input.split('=')
+        key = key.strip()
+        value = value.strip()
+        return key, value
+
+    @staticmethod
+    def getProperties(self):
+        data = {}
+
+        with open(self.strPropertiesFile) as fp:
+            for line in fp:
+                line = line.strip()
+                if not line or line.startswith('#') or line.startswith('import'):
+                   continue
+
+                key, value = readProperties.parse_line(line)
+                data[key] = value
+
+        return data
+
+    def getValueProperties(self, key):
+        datas = readProperties.getProperties(self)
+        value = datas[key]
+
+        return value
diff --git a/src/test/cord-api/Framework/utils/utils.py b/src/test/cord-api/Framework/utils/utils.py
new file mode 100644
index 0000000..5c4efb5
--- /dev/null
+++ b/src/test/cord-api/Framework/utils/utils.py
@@ -0,0 +1,29 @@
+import pexpect,os
+import time
+import json
+import collections
+import sys
+import robot
+import os.path
+from os.path import expanduser
+
+class utils(object):
+
+    @staticmethod
+    def listToDict(alist, intListIndex):
+        dictInfo = alist[int(intListIndex)]
+        return dictInfo
+
+    @staticmethod
+    def jsonToList(strFile, strListName):
+        data = json.loads(open(strFile).read())
+        #print "data...",data
+        dataList = data[strListName]
+        return dataList
+
+#Test
+#test = utils()
+#data=test.jsonToList("Subscribers.json","SubscriberInfo")
+#print  test.jsonToList("Subscribers.json","SubscriberInfo")
+#print "index 1...",test.listToDict(data,1)
+
diff --git a/src/test/cord-api/Properties/RestApiProperties.py b/src/test/cord-api/Properties/RestApiProperties.py
new file mode 100644
index 0000000..9a040f2
--- /dev/null
+++ b/src/test/cord-api/Properties/RestApiProperties.py
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+SERVER_IP = 'localhost'
+SERVER_PORT = '8000'
+USER = 'padmin@vicci.org'
+PASSWD = 'letmein'
+HEADERS_JSON = {'Content-Type': 'application/json'}
+UTILS_POST_LOGIN = '/api/utility/login/'
diff --git a/src/test/cord-api/Tests/Robot-TemplateTest.txt b/src/test/cord-api/Tests/Robot-TemplateTest.txt
new file mode 100644
index 0000000..ec0f5d2
--- /dev/null
+++ b/src/test/cord-api/Tests/Robot-TemplateTest.txt
@@ -0,0 +1,51 @@
+*** Settings ***
+Documentation     Test suite for Subscriber verification
+Suite Setup       Read InputFile
+Test Template     Verify Subscriber functionality
+Library           Collections
+Library           String
+Library           OperatingSystem
+Library           XML
+Library           RequestsLibrary
+Library           ../Framework/restapi/RestApiTest.py
+Library           ../Framework/restapi/utils.py
+
+*** Variables ***
+${USER}           admin
+${PASSWORD}       admin
+${PATHFILE}       ${CURDIR}/../Framework/restapi/Subscribers.json
+
+*** Test Cases ***    TYPE        LISTINDEX
+Test Subscriber-1     CREATEP     0
+
+Test Get_Subscriber-1
+                      RETRIEVE    0
+
+Test Subscriber-2     CREATEP     1
+
+Test Get_Subscriber-2
+                      RETRIEVE    1
+
+*** Keywords ***
+Read InputFile
+    ${subscriberList} =    utils.jsonToList    ${PATHFILE}    SubscriberInfo
+    Set Suite Variable    ${slist}    ${subscriberList}
+
+Verify Subscriber functionality
+    [Arguments]    ${type}    ${listIndex}
+    Run Keyword If    "${type}" == "CREATEP"    Test Post Subscriber API    ${listIndex}
+    Run Keyword If    "${type}" == "RETRIEVE"    Test Get Subscriber API    ${listIndex}
+
+Test Post Subscriber API
+    [Arguments]    ${listIndex}
+    ${subscriberList} =    Get Variable Value    ${slist}
+    ${subscriberDict}=    utils.listToDict    ${subscriberList}    ${listIndex}
+    ${api_result}=    RestApiTest.TestPost    ${subscriberDict}
+    Should Be True    ${api_result}
+
+Test Get Subscriber API
+    [Arguments]    ${listIndex}
+    ${json_result}=    RestApiTest.TestGet
+    Log    ${json_result}
+    #${actual_json}=    Get From Dictionary    ${subscriber.json}    Subscriber
+    #Dictionaries Should Be Equal    ${json_result}    ${actual_json}
diff --git a/src/test/cord-api/Tests/data/Subscriber.json b/src/test/cord-api/Tests/data/Subscriber.json
new file mode 100644
index 0000000..db9685f
--- /dev/null
+++ b/src/test/cord-api/Tests/data/Subscriber.json
@@ -0,0 +1,2 @@
+# Test data
+