Initial isolation test integrated with robot framework
authorBasheeruddin Ahmed <syedbahm@cisco.com>
Fri, 5 Sep 2014 20:16:08 +0000 (13:16 -0700)
committerBasheeruddin Ahmed <syedbahm@cisco.com>
Fri, 12 Sep 2014 16:53:19 +0000 (09:53 -0700)
Usage:
pybot -v LEADER:<leader_ip> -v PORT:8080 -v FOLLOWER1:<flwr1_ip> -v FOLLOWER2:<flwr2_ip> ~/integration/test/csit/suites/clustering/datastore/basic/<testname.txt>
Adding start/stop controller util methods

Change-Id: I512275595cd90d35c350456388420496d6633734
Signed-off-by: Basheeruddin Ahmed <syedbahm@cisco.com>
Signed-off-by: Harman Singh <harmasin@cisco.com>
test/csit/libraries/CrudLibrary.py [new file with mode: 0644]
test/csit/libraries/SettingsLibrary.py [new file with mode: 0644]
test/csit/libraries/UtilLibrary.py [new file with mode: 0644]
test/csit/suites/clustering/datastore/basic/010_restconf_rpc_crud_test_01_execute_on_leader.txt [new file with mode: 0644]
test/csit/suites/clustering/datastore/basic/010_restconf_rpc_crud_test_02_execute_on_follower1.txt [new file with mode: 0644]
test/csit/suites/clustering/datastore/basic/010_restconf_rpc_crud_test_03_execute_on_follower2.txt [new file with mode: 0644]
test/csit/suites/clustering/datastore/basic/__init__.txt [new file with mode: 0644]

diff --git a/test/csit/libraries/CrudLibrary.py b/test/csit/libraries/CrudLibrary.py
new file mode 100644 (file)
index 0000000..44cb149
--- /dev/null
@@ -0,0 +1,248 @@
+__author__ = "Basheeruddin Ahmed"
+__copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
+__license__ = "New-style BSD"
+__email__ = "syedbahm@cisco.com"
+import sys
+import UtilLibrary
+import SettingsLibrary
+
+
+#
+#Creates the specified number of cars based on Cars yang model
+# using RESTCONF
+#
+
+def addCar(hostname,port,numberOfCars):
+
+    for x in range(1, numberOfCars+1):
+        strId = str(x)
+        payload = SettingsLibrary.add_car_payload_template.substitute(id=strId,category="category"+strId,model="model"+strId,
+                                                           manufacturer="manufacturer"+strId,
+                                                           year=(2000+x%100))
+        print("payload formed after template substitution=")
+        print(payload)
+        # Send the POST request
+        resp = UtilLibrary.post(SettingsLibrary.getAddCarUrl(hostname,port),"admin", "admin",payload)
+
+        print("the response of the POST to add car=")
+        print(resp)
+
+    return resp
+
+    #TBD: Detailed validation
+
+
+#
+#Creates the specified number of persons based on People yang model
+# using main RPC
+# <note>
+#   To enable RPC a non-user input person entry is created with personId=user0
+# </note>
+#
+def addPerson(hostname,port,numberOfPersons):
+    #FOR RPC TO WORK PROPERLY THE FIRST ENTRY SHOULD BE VIA RESTCONF
+    if(numberOfPersons==0):
+        strId =str(numberOfPersons)
+        payload = SettingsLibrary.add_person_payload_template.substitute(personId="user"+strId,gender="unknown",age=0,
+                                                                  address=strId + "Way, Some Country, Some Zip  "+strId,
+                                                                  contactNo= "some number"+strId)
+        # Send the POST request using RESTCONF
+        resp = UtilLibrary.nonprintpost(SettingsLibrary.getAddPersonUrl(hostname,port),"admin", "admin",payload)
+        return resp
+
+    genderToggle = "Male"
+    for x in range(1, numberOfPersons+1):
+        if(genderToggle == "Male"):
+            genderToggle = "Female"
+        else:
+            genderToggle = "Male"
+
+        strId = str(x)
+
+        payload = SettingsLibrary.add_person_rpc_payload_template.substitute(personId="user"+strId,gender=genderToggle,age=(20+x%100),
+                                                                      address=strId + "Way, Some Country, Some Zip  "+str(x%1000),
+                                                                      contactNo= "some number"+strId)
+        # Send the POST request using RPC
+        resp = UtilLibrary.post(SettingsLibrary.getAddPersonRpcUrl(hostname,port),"admin", "admin",payload)
+
+        print("payload formed after template substitution=")
+        print(payload)
+        print("the response of the POST to add person=")
+        print(resp)
+
+    return resp
+
+
+    #TBD: Detailed validation
+
+#This method is not exposed via commands as only getCarPersons is of interest
+#addCarPerson entry happens when buyCar is called
+# <note>
+#   To enable RPC a non-user input car-person entry is created with personId=user0
+# </note>
+#
+def addCarPerson(hostname,port,numberOfCarPersons):
+
+    #FOR RPC TO WORK PROPERLY THE FIRST ENTRY SHOULD BE VIA RESTCONF
+    if(numberOfCarPersons==0):
+        payload = SettingsLibrary.add_car_person_template.substitute(Id=str(numberOfCarPersons),personId="user"+str(numberOfCarPersons))
+        # Send the POST request REST CONF
+        resp = UtilLibrary.nonprintpost(SettingsLibrary.getAddCarPersonUrl(hostname,port),"admin", "admin",payload)
+
+        return
+
+    for x in range(1, numberOfCarPersons+1):
+        strId = str(x)
+
+        payload = SettingsLibrary.add_car_person_template.substitute(Id=strId,personId="user"+strId)
+
+        # Send the POST request REST CONF
+        resp = UtilLibrary.post(SettingsLibrary.getAddCarPersonUrl(hostname,port),"admin", "admin",payload)
+
+        print("payload formed after template substitution=")
+        print(payload)
+
+        print("the response of the POST to add car_person=")
+        print(resp)
+
+    print("getting the car_persons for verification")
+    resp=getCarPersonMappings(hostname,port,0)
+
+    #TBD detailed validation
+
+#
+# Invokes an RPC REST call that does a car purchase by a person id
+# <note>
+# It is expected that the Car and Person entries are already created
+# before invoking this method
+# </note>
+#
+
+def buyCar(hostname,port,numberOfCarBuyers):
+    for x in range(1, numberOfCarBuyers+1):
+        strId = str(x)
+
+        payload = SettingsLibrary.buy_car_rpc_template.substitute(personId="user"+strId,carId=strId)
+
+        # Send the POST request using RPC
+        resp = UtilLibrary.post(SettingsLibrary.getBuyCarRpcUrl(hostname,port),"admin", "admin",payload)
+
+        print("payload formed after template substitution=")
+        print(payload)
+
+        print("the response of the POST to buycar=")
+        print(resp)
+
+    print("getting the car_persons for verification")
+    resp=getCarPersonMappings(hostname,port,0)
+
+
+#
+# Uses the GET on car:cars resource
+# to get all cars in the store using RESTCONF
+#
+#
+def getCars(hostname,port,ignore):
+    resp = UtilLibrary.get(SettingsLibrary.getCarsUrl(hostname,port),"admin", "admin")
+    resp.encoding = 'utf-8'
+    print (resp.text)
+    return resp
+
+#
+# Uses the GET on people:people resource
+# to get all persons in the store using RESTCONF
+#<note>
+#This also returns the dummy entry created for routed RPC
+# with personId being user0
+#</note>
+#
+#
+def getPersons(hostname,port,ignore):
+    resp = UtilLibrary.get(SettingsLibrary.getPersonsUrl(hostname,port),"admin","admin")
+    resp.encoding = 'utf-8'
+    print (resp.text)
+    return resp
+
+#
+# Uses the GET on car-people:car-people resource
+# to get all car-persons entry in the store using RESTCONF
+#<note>
+#This also returns the dummy entry created for routed RPC
+# with personId being user0
+#</note>
+#
+def getCarPersonMappings(hostname,port,ignore):
+    resp = UtilLibrary.get(SettingsLibrary.getCarPersonUrl(hostname,port),"admin","admin")
+    resp.encoding = 'utf-8'
+    print (resp)
+    
+    return resp
+
+#
+#delete all cars in the store using RESTCONF
+#
+#
+def deleteAllCars(hostname,port,ignore):
+    UtilLibrary.delete(SettingsLibrary.getCarsUrl(hostname,port),"admin","admin")
+    resp = getCars(hostname,port,ignore)
+    print("Cars in store after deletion:"+ str(resp))
+
+#
+#delete all persons in the store using RESTCONF
+#
+#
+def deleteAllPersons(hostname,port,ignore):
+    UtilLibrary.delete(SettingsLibrary.getPersonsUrl(hostname,port),"admin","admin")
+    resp = getPersons(hostname,port,ignore)
+    print("Persons in store after deletion:"+ str(resp))
+
+#
+# Usage message shown to user
+#
+
+def options():
+
+    command = 'ac=Add Car\n\t\tap=Add Person \n\t\tbc=Buy Car\n\t\tgc=Get Cars\n\t\tgp=Get Persons\n\t\t' \
+              'gcp=Get Car-Person Mappings\n\t\tdc=Delete All Cars\n\t\tdp=Delete All Persons)'
+
+    param =  '\n\t<param> is\n\t\t' \
+             'number of cars to be added if <command>=ac\n\t\t' \
+             'number of persons to be added if <command>=ap\n\t\t' \
+             'number of car buyers if <command>=bc\n\t\t'\
+             'pass 0 if <command>=gc or gp or gcp or dc or dp'\
+
+
+    usageString = 'usage: python crud <ipaddress> <command> <param>\nwhere\n\t<ipaddress> = ODL server ip address' \
+                  '\n\t<command> = any of the following commands \n\t\t'
+
+    usageString = usageString + command +param
+
+    print (usageString)
+
+
+#
+# entry point for command executions
+#
+
+def main():
+    if len(sys.argv) < 4:
+        options()
+        quit(0)
+    SettingsLibrary.hostname = sys.argv[1]
+    SettingsLibrary.port = '8080'
+    call = dict(ac=addCar, ap=addPerson, bc=buyCar,
+                gc=getCars, gp=getPersons, gcp=getCarPersonMappings,dc=deleteAllCars,dp=deleteAllPersons)
+
+    #FOR RPC TO WORK PROPERLY THE FIRST PERSON SHOULD BE ADDED VIA RESTCONF
+    addPerson(SettingsLibrary.hostname,SettingsLibrary.port,0)
+
+    #FOR RPC TO WORK PROPERLY THE FIRST PERSON SHOULD BE ADDED VIA RESTCONF
+    addCarPerson(SettingsLibrary.hostname,SettingsLibrary.port,0)
+
+
+    call[sys.argv[2]](SettingsLibrary.hostname,SettingsLibrary.port,int(sys.argv[3]))
+
+#
+# main invoked
+if __name__ == "__main__":
+ main()
diff --git a/test/csit/libraries/SettingsLibrary.py b/test/csit/libraries/SettingsLibrary.py
new file mode 100644 (file)
index 0000000..cab12a3
--- /dev/null
@@ -0,0 +1,113 @@
+__author__ = "Basheeruddin Ahmed"
+__copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
+__license__ = "New-style BSD"
+__email__ = "syedbahm@cisco.com"
+
+from string import Template
+
+# helps in taking the hostname entered by the user
+#global hostname 
+#global port
+
+#def setHostname(host):
+#     hostname=host
+
+#def getServer():
+#    return hostname +":"+"8080"
+
+#Cars resource URL for GET
+def getCarsUrl(hostname,port):
+
+    return "http://"+hostname+":"+port+"/restconf/config/car:cars"
+
+#People resouce URL for GET
+def getPersonsUrl(hostname,port):
+
+    return "http://"+hostname+":"+port+"/restconf/config/people:people"
+
+#GET cars persons mapping resource URL
+def getCarPersonUrl(hostname,port):
+
+    return "http://"+hostname+":"+port+"/restconf/config/car-people:car-people"
+
+#POST or DELETE URL
+def getAddCarUrl(hostname,port):
+    return "http://"+hostname+":"+port+"/restconf/config"
+#POST or DELETE URL
+def getAddPersonUrl(hostname,port):
+    return "http://"+hostname+":"+port+"/restconf/config"
+
+#POST URL -using rpc
+def getAddPersonRpcUrl(hostname,port):
+    return "http://"+hostname+":"+port+"/restconf/operations/people:add-person"
+
+#POST URL for car person mapping
+def getAddCarPersonUrl(hostname,port):
+   return "http://"+hostname+":"+port+"/restconf/config"
+#POST URL for buy car rpc
+def getBuyCarRpcUrl(hostname,port):
+    return "http://"+hostname+":"+port+"/restconf/operations/car-purchase:buy-car"
+
+
+# Template for Car resource payload
+add_car_payload_template = Template( '{\"car:cars\":{'
+    '\"car-entry\": ['
+        '{'
+            '\"id\": \"$id\",'
+            '\"category\": \"$category\",'
+            '\"model\": \"$model\",'
+            '\"manufacturer\": \"$manufacturer\",'
+            '\"year\": \"$year\"'
+        '}'
+    ']'
+'}'
+'}')
+
+# Template for Person resource payload
+add_person_payload_template =  Template( '{\"people:people":{'
+    '\"person\": ['
+        '{'
+            '\"id\": \"$personId\",'
+            '\"gender\": \"$gender\",'
+            '\"age\": \"$age\",'
+            '\"address\": \"$address\",'
+            '\"contactNo\":\"$contactNo\"'
+        '}'
+            ']'
+     '}}')
+
+# Template for Car Person mapping  payload
+add_car_person_template = Template('{\"car-people:car-people\":{'
+    '\"car-person\": ['
+        '{'
+           ' \"car-id\": \"$Id\",'
+            '\"person-id\": \"$personId\"'
+        '}'
+    ']'
+'}'
+'}')
+
+# Template for adding person using RPC
+add_person_rpc_payload_template = Template ( '{'
+                                                 '\"input\":'
+                                                     '{'
+                                                         '\"people:id\" : \"$personId\",'
+                                                         '\"people:gender\":\"$gender\",'
+                                                         '\"people:address\" : \"$address\",'
+                                                         '\"people:contactNo\":\"$contactNo\",'
+                                                         '\"people:age\":\"$age\"'
+                                                     '}'
+                                             '}')
+
+# Template for buing car rpc
+buy_car_rpc_template = Template ( '{'
+    '\"input\" :'
+        '{'
+            '\"car-purchase:person\" : \"/people:people/people:person[people:id=\'$personId\']\",'
+            '\"car-purchase:person-id\" : \"$personId\",'
+            '\"car-purchase:car-id\" : \"$carId\"'
+        '}'
+'}')
+
+
+
diff --git a/test/csit/libraries/UtilLibrary.py b/test/csit/libraries/UtilLibrary.py
new file mode 100644 (file)
index 0000000..07810f1
--- /dev/null
@@ -0,0 +1,89 @@
+__author__ = "Basheeruddin Ahmed"
+__copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
+__license__ = "New-style BSD"
+__email__ = "syedbahm@cisco.com"
+
+
+import requests
+from SSHLibrary import SSHLibrary
+
+#
+#Helps in making GET REST calls
+#
+
+def get(url, userId, password):
+
+    headers = {}
+    headers['Accept']= 'application/xml'
+
+    # Send the GET request
+    req = requests.get(url, params=None, headers=headers)
+
+    # Read the response
+    return req
+
+#
+#Helps in making POST REST calls without outputs
+#
+def nonprintpost(url, userId, password,data):
+
+    headers = {}
+    headers['Content-Type'] = 'application/json'
+    #headers['Accept']= 'application/xml'
+
+    resp = requests.post(url,data.encode(),headers=headers)
+
+
+    return resp
+
+#
+#Helps in making POST REST calls
+#
+def post(url, userId, password,data):
+    print("post request with url "+url)
+    print("post request with data "+data)
+    headers = {}
+    headers['Content-Type'] = 'application/json'
+    #headers['Accept']= 'application/xml'
+
+    resp = requests.post(url,data.encode(),headers=headers)
+
+    #print (resp.raise_for_status())
+    print (resp.headers)
+
+    return resp
+
+#
+#Helps in making DELET REST calls
+#
+def delete(url,userId,password):
+    print("delete all resources belonging to url"+url)
+    resp=requests.delete(url)
+
+#
+# use username and password of controller server for ssh and need
+# karaf distribution location like /root/Documents/dist
+#
+def startcontroller(ip,username,password,karafHome):
+
+    print "start controller"
+    lib = SSHLibrary()
+    lib.open_connection(ip)
+    lib.login(username=username,password=password)
+    print "login done"
+    lib.execute_command(karafHome+"/bin/start")
+    print "Starting server"
+    lib.close_connection()
+
+def stopcontroller(ip,username,password,karafHome):
+
+    print "stop controller"
+    lib = SSHLibrary()
+    lib.open_connection(ip)
+    lib.login(username=username,password=password)
+    print "login done"
+    lib.execute_command(karafHome+"/bin/stop")
+    print "Stopped server"
+    lib.close_connection()
+
+
diff --git a/test/csit/suites/clustering/datastore/basic/010_restconf_rpc_crud_test_01_execute_on_leader.txt b/test/csit/suites/clustering/datastore/basic/010_restconf_rpc_crud_test_01_execute_on_leader.txt
new file mode 100644 (file)
index 0000000..8a37f89
--- /dev/null
@@ -0,0 +1,67 @@
+*** Settings ***
+Documentation     Test suite for RESTCONF RPC CAR PERSON 
+Library           Collections
+Library           ../../../../libraries/RequestsLibrary.py
+Library           ../../../../libraries/Common.py
+Library           ../../../../libraries/CrudLibrary.py
+Library           ../../../../libraries/SettingsLibrary.py
+Library           ../../../../libraries/UtilLibrary.py
+Variables         ../../../../variables/Variables.py
+
+*** Variables ***
+${REST_CONTEXT}    /restconf/config/
+
+
+*** Test Cases *** 
+Add cars and get cars from Leader 
+    [Documentation]    Add 100 cars and get added cars from Leader
+       ${resp}         AddCar  ${LEADER}       ${PORT} ${100}  
+       ${resp}         Getcars ${LEADER}       ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   manufacturer1      
+               
+Add persons and get persons from Leader 
+    [Documentation]    Add 100 persons and get persons
+    [Documentation]    Note: There should be one person added first to enable rpc
+       ${resp}         AddPerson       ${LEADER}       ${PORT} ${0}    
+       ${resp}         AddPerson       ${LEADER}       ${PORT} ${100}  
+       ${resp}         GetPersons      ${LEADER}       ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user5      
+
+Add car-person mapping and get car-person mapping from Leader 
+    [Documentation]    Add car-person and get car-person from Leader 
+    [Documentation]  Note: This is done to enable working of rpc 
+
+       ${resp}         AddCarPerson    ${LEADER}       ${PORT} ${0}    
+       ${resp}         GetCarPersonMappings    ${LEADER}       ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user0
+       
+Purchase 100 cars using Leader 
+    [Documentation]  Purchase 100 cars using Leader
+
+       ${resp}         BuyCar  ${LEADER}       ${PORT} ${100}  
+       ${resp}         GetCarPersonMappings    ${LEADER}       ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+
+Get car-person mappings using Leader
+   [Documentation]     Get car-person mappings using Leader to see 100 entry
+       ${resp}         GetCarPersonMappings    ${LEADER}       ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user100
+
+Get car-person mappings using Follower1
+   [Documentation]     Get car-person mappings using Follower1 to see 100 entry
+       ${resp}         GetCarPersonMappings    ${FOLLOWER1}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user100
+       Should Contain     ${resp.content}   user5
+
+
+Get car-person mappings using Follower2
+   [Documentation]     Get car-person mappings using Follower2 to see 100 entry
+       ${resp}         GetCarPersonMappings    ${FOLLOWER2}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user0
+       Should Contain     ${resp.content}   user100
diff --git a/test/csit/suites/clustering/datastore/basic/010_restconf_rpc_crud_test_02_execute_on_follower1.txt b/test/csit/suites/clustering/datastore/basic/010_restconf_rpc_crud_test_02_execute_on_follower1.txt
new file mode 100644 (file)
index 0000000..ebd3d87
--- /dev/null
@@ -0,0 +1,67 @@
+*** Settings ***
+Documentation     Test suite for RESTCONF RPC CAR PERSON 
+Library           Collections
+Library           ../../../../libraries/RequestsLibrary.py
+Library           ../../../../libraries/Common.py
+Library           ../../../../libraries/CrudLibrary.py
+Library           ../../../../libraries/SettingsLibrary.py
+Library           ../../../../libraries/UtilLibrary.py
+Variables         ../../../../variables/Variables.py
+
+*** Variables ***
+${REST_CONTEXT}    /restconf/config/
+
+
+*** Test Cases *** 
+Add cars and get cars from Leader 
+    [Documentation]    Add 100 cars and get added cars from Leader
+       ${resp}         AddCar  ${FOLLOWER1}    ${PORT} ${100}  
+       ${resp}         Getcars ${FOLLOWER1}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   manufacturer1      
+               
+Add persons and get persons from Leader 
+    [Documentation]    Add 100 persons and get persons
+    [Documentation]    Note: There should be one person added first to enable rpc
+       ${resp}         AddPerson       ${FOLLOWER1}    ${PORT} ${0}    
+       ${resp}         AddPerson       ${FOLLOWER1}    ${PORT} ${100}  
+       ${resp}         GetPersons      ${FOLLOWER1}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user5      
+
+Add car-person mapping and get car-person mapping from Leader 
+    [Documentation]    Add car-person and get car-person from Leader 
+    [Documentation]  Note: This is done to enable working of rpc 
+
+       ${resp}         AddCarPerson    ${FOLLOWER1}    ${PORT} ${0}    
+       ${resp}         GetCarPersonMappings    ${FOLLOWER1}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user0
+       
+Purchase 100 cars using Leader 
+    [Documentation]  Purchase 100 cars using Leader
+
+       ${resp}         BuyCar  ${FOLLOWER1}    ${PORT} ${100}  
+       ${resp}         GetCarPersonMappings    ${FOLLOWER1}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+
+Get car-person mappings using Leader
+   [Documentation]     Get car-person mappings using Leader to see 100 entry
+       ${resp}         GetCarPersonMappings    ${FOLLOWER1}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user100
+
+Get car-person mappings using Leader
+   [Documentation]     Get car-person mappings using Leader to see 100 entry
+       ${resp}         GetCarPersonMappings    ${LEADER}       ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user100
+       Should Contain     ${resp.content}   user5
+
+
+Get car-person mappings using Follower2
+   [Documentation]     Get car-person mappings using Follower2 to see 100 entry
+       ${resp}         GetCarPersonMappings    ${FOLLOWER2}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user0
+       Should Contain     ${resp.content}   user100
diff --git a/test/csit/suites/clustering/datastore/basic/010_restconf_rpc_crud_test_03_execute_on_follower2.txt b/test/csit/suites/clustering/datastore/basic/010_restconf_rpc_crud_test_03_execute_on_follower2.txt
new file mode 100644 (file)
index 0000000..0ccf3c1
--- /dev/null
@@ -0,0 +1,67 @@
+*** Settings ***
+Documentation     Test suite for RESTCONF RPC CAR PERSON 
+Library           Collections
+Library           ../../../../libraries/RequestsLibrary.py
+Library           ../../../../libraries/Common.py
+Library           ../../../../libraries/CrudLibrary.py
+Library           ../../../../libraries/SettingsLibrary.py
+Library           ../../../../libraries/UtilLibrary.py
+Variables         ../../../../variables/Variables.py
+
+*** Variables ***
+${REST_CONTEXT}    /restconf/config/
+
+
+*** Test Cases *** 
+Add cars and get cars from Leader 
+    [Documentation]    Add 100 cars and get added cars from Leader
+       ${resp}         AddCar  ${FOLLOWER2}    ${PORT} ${100}  
+       ${resp}         Getcars ${FOLLOWER2}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   manufacturer1      
+               
+Add persons and get persons from Leader 
+    [Documentation]    Add 100 persons and get persons
+    [Documentation]    Note: There should be one person added first to enable rpc
+       ${resp}         AddPerson       ${FOLLOWER2}    ${PORT} ${0}    
+       ${resp}         AddPerson       ${FOLLOWER2}    ${PORT} ${100}  
+       ${resp}         GetPersons      ${FOLLOWER2}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user5      
+
+Add car-person mapping and get car-person mapping from Leader 
+    [Documentation]    Add car-person and get car-person from Leader 
+    [Documentation]  Note: This is done to enable working of rpc 
+
+       ${resp}         AddCarPerson    ${FOLLOWER2}    ${PORT} ${0}    
+       ${resp}         GetCarPersonMappings    ${FOLLOWER2}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user0
+       
+Purchase 100 cars using Leader 
+    [Documentation]  Purchase 100 cars using Leader
+
+       ${resp}         BuyCar  ${FOLLOWER2}    ${PORT} ${100}  
+       ${resp}         GetCarPersonMappings    ${FOLLOWER2}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+
+Get car-person mappings using Leader
+   [Documentation]     Get car-person mappings using Leader to see 100 entry
+       ${resp}         GetCarPersonMappings    ${FOLLOWER2}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user100
+
+Get car-person mappings using Leader
+   [Documentation]     Get car-person mappings using Leader to see 100 entry
+       ${resp}         GetCarPersonMappings    ${LEADER}       ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user100
+       Should Contain     ${resp.content}   user5
+
+
+Get car-person mappings using Follower1
+   [Documentation]     Get car-person mappings using Follower1 to see 100 entry
+       ${resp}         GetCarPersonMappings    ${FOLLOWER1}    ${PORT} ${0}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}   user0
+       Should Contain     ${resp.content}   user100
diff --git a/test/csit/suites/clustering/datastore/basic/__init__.txt b/test/csit/suites/clustering/datastore/basic/__init__.txt
new file mode 100644 (file)
index 0000000..86169c6
--- /dev/null
@@ -0,0 +1,10 @@
+*** Settings ***
+Documentation     Test suite for MD-SAL NSF
+Suite Setup       Start Suite
+Suite Teardown    Stop Suite
+Library     SSHLibrary
+
+
+** Keywords ***
+Start Suite  
+Stop Suite