Clustering datastore tests for Lithium. 22/21822/7
authorPhillip Shea <phillip.shea@hp.com>
Wed, 3 Jun 2015 19:09:36 +0000 (12:09 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 10 Jun 2015 20:16:15 +0000 (20:16 +0000)
Some datastore functionality has changed between Helium and Lithium. The crud and settings libraries
needed to be modified for changes in restconf for the cars shard. Also, an unneccessary sleep was removed
from the crud library. Because there's a difference in the installed features required for Hydrogen
and Lithium cluster testing, the multi-node-test clustering template was changed. Some other features to
help with troubleshooting were also added. Finally, the clustering template temp directory was added to
gitignore to simplify test development.

Change-Id: I8b704d57af64985d8d4be6d2454601371c0f55e8
Signed-off-by: Phillip Shea <phillip.shea@hp.com>
test/csit/libraries/ClusterKeywords.txt
test/csit/libraries/CrudLibrary.py
test/csit/libraries/SettingsLibrary.py
test/csit/suites/clustering/routedrpc/023_routed_rpc_crud_test.robot
test/csit/suites/clustering/routedrpc/024_routed_rpc_crud_test.robot
test/tools/clustering/cluster-deployer/.gitignore [new file with mode: 0644]
test/tools/clustering/cluster-deployer/templates/multi-node-test/org.apache.karaf.features.cfg.template

index bacf0112468ceefdf21cd93f02f51b21f22ac28e..e000d8e31598e8ff3b5903f52c0f5c9913583ea1 100644 (file)
@@ -32,6 +32,8 @@ Get All Followers
 
 Add Cars And Verify
     [Arguments]    ${controller_ip}    ${num_cars}  ${timeout}=60s
+    ${resp}   InitCar   ${controller_ip}   ${PORT}
+    Should Be Equal As Strings    ${resp.status_code}    204
     ${resp}   AddCar   ${controller_ip}   ${PORT}   ${num_cars}
     Should Be Equal As Strings    ${resp.status_code}    204
     Wait Until Keyword Succeeds   ${timeout}  2s  Get Cars And Verify   ${controller_ip}  ${num_cars}
index b91f9661bd52e9fb6c05a9a8a4c75f29e09d1847..7772082e06b1e28bfd232b755e9e88ea7aef83e2 100644 (file)
@@ -8,9 +8,25 @@ import SettingsLibrary
 import time
 
 
+def initCar(hostname, port):
+    """Initiales the car shard"""
+    x = 0
+    strId = str(x)
+    payload = SettingsLibrary.add_car_init_payload_template.substitute(
+        id=strId, category="category" + strId, model="model" + strId,
+        manufacturer="manufacturer" + strId,
+        year=(2000 + x % 100))
+    print("Initialization payload=")
+    print(payload)
+    resp = UtilLibrary.post(SettingsLibrary.getAddCarInitUrl(hostname, port), "admin", "admin", payload)
+    print("the response of the POST to add car=")
+    print(resp)
+    return resp
+
+
 def addCar(hostname, port, numberOfCars):
     """Creates the specified number of cars based on Cars yang model using RESTCONF"""
-    for x in range(1, numberOfCars+1):
+    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,
@@ -23,8 +39,6 @@ def addCar(hostname, port, numberOfCars):
 
         print("the response of the POST to add car=")
         print(resp)
-
-    time.sleep(5)  # Let the add finish
     return resp
 
     # TBD: Detailed validation
@@ -118,6 +132,9 @@ def buyCar(hostname, port, numberOfCarBuyers, start=0):
         before invoking this method
     </note>
     """
+
+    print "Buying " + str(numberOfCarBuyers) + " Cars"
+    result = True
     for x in range(start, start+numberOfCarBuyers):
         strId = str(x+1)
 
@@ -129,10 +146,10 @@ def buyCar(hostname, port, numberOfCarBuyers, start=0):
         print(resp)
         print(resp.text)
 
-        if (resp.status_code != 204):
-            return False
+        if (resp.status_code != 200):
+            result = False
 
-    return True
+    return result
 
 
 def getCars(hostname, port, ignore):
index 1fe0b3ad023285e9f0ce7c4924075512f39e7857..e47c420707a3fc9c6feed7a99273fce5dded08ec 100644 (file)
@@ -31,11 +31,16 @@ def getCarPersonUrl(hostname, port):
     return "http://" + hostname + ":" + port + "/restconf/config/car-people:car-people"
 
 
-def getAddCarUrl(hostname, port):
+def getAddCarInitUrl(hostname, port):
     """POST or DELETE URL"""
     return "http://" + hostname + ":" + port + "/restconf/config"
 
 
+def getAddCarUrl(hostname, port):
+    """POST or DELETE URL"""
+    return "http://" + hostname + ":" + port + "/restconf/config/car:cars"
+
+
 def getAddPersonUrl(hostname, port):
     """POST or DELETE URL"""
     return "http://" + hostname + ":" + port + "/restconf/config"
@@ -63,8 +68,8 @@ def getJolokiaURL(hostname, port, shardIndex, shardName):
         shardIndex + "-" + shardName + ",type=DistributedConfigDatastore"
 
 
-# Template for Car resource payload
-add_car_payload_template = Template(
+# Template for Car init resource payload
+add_car_init_payload_template = Template(
     """
     {"car:cars":{
         "car-entry": [
@@ -79,6 +84,21 @@ add_car_payload_template = Template(
     }}
     """)
 
+# Template for Car resource payload
+add_car_payload_template = Template(
+    """
+        {"car-entry": [
+            {
+                "id": "$id",
+                "category": "$category",
+                "model": "$model",
+                "manufacturer": "$manufacturer",
+                "year": "$year"
+            }
+        ]
+    }
+    """)
+
 # Template for Person resource payload
 add_person_payload_template = Template(
     """
index 2ee99f23063dce66cc068ce099141c8c88af0698..ca01fba910360e0391b9ed2f2ee1b4d3e1059e24 100644 (file)
@@ -12,23 +12,24 @@ Variables         ../../../variables/Variables.py
 ${REST_CONTEXT}    /restconf/config/
 
 
-*** Test Cases *** 
-Add cars and get cars from Leader 
+*** Test Cases ***
+Add cars and get cars from Leader
     [Documentation]    Add 100 cars and get added cars from Leader
-       ${resp}         AddCar  ${MEMBER1}      ${PORT} ${100}  
+       ${resp}         InitCar ${MEMBER1}      ${PORT}
+       ${resp}         AddCar  ${MEMBER1}      ${PORT} ${100}
        ${resp}         Getcars ${MEMBER1}      ${PORT} ${0}
        Should Be Equal As Strings    ${resp.status_code}    200
-       Should Contain     ${resp.content}   manufacturer1      
-               
-Add persons and get persons from Leader 
+       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       ${MEMBER1}      ${PORT} ${0}    
-       ${resp}         AddPerson       ${MEMBER1}      ${PORT} ${100}  
+       ${resp}         AddPerson       ${MEMBER1}      ${PORT} ${0}
+       ${resp}         AddPerson       ${MEMBER1}      ${PORT} ${100}
        ${resp}         GetPersons      ${MEMBER1}      ${PORT} ${0}
        Should Be Equal As Strings    ${resp.status_code}    200
        Should Contain     ${resp.content}   user5
-       SLEEP   10      
+       SLEEP   10
 
 Add car-person mapping and get car-person mapping from Follower1
     [Documentation]    Add car-person and get car-person from Leader
@@ -39,7 +40,7 @@ Add car-person mapping and get car-person mapping from Follower1
         Should Contain ${resp.content} user0
        SLEEP   5
 
-Purchase 100 cars using Follower1 
+Purchase 100 cars using Follower1
     [Documentation]  Purchase 100 cars using Follower1
        ${resp}         BuyCar  ${MEMBER2}      ${PORT} ${100}
        ${resp}         GetCarPersonMappings    ${MEMBER2}      ${PORT} ${0}
index e29c3f5bf19a1f61ed437d5a884f0c10c1fa6026..94af65c4f25fe13d9447de248fb2a1ae95229dfd 100644 (file)
@@ -12,22 +12,23 @@ Variables         ../../../variables/Variables.py
 *** Variables ***
 ${REST_CONTEXT}    /restconf/config/
 
-*** Test Cases *** 
-Add cars and get cars from Leader 
+*** Test Cases ***
+Add cars and get cars from Leader
     [Documentation]    Add 100 cars and get added cars from Leader
-       ${resp}         AddCar  ${MEMBER1}      ${PORT} ${100}  
+    ${resp}            InitCar ${MEMBER1}      ${PORT}
+    ${resp}            AddCar  ${MEMBER1}      ${PORT} ${100}
        ${resp}         Getcars ${MEMBER1}      ${PORT} ${0}
        Should Be Equal As Strings    ${resp.status_code}    200
-       Should Contain     ${resp.content}   manufacturer1      
-       
-Add persons and get persons from Leader 
+       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       ${MEMBER1}      ${PORT} ${0}    
-       ${resp}         AddPerson       ${MEMBER1}      ${PORT} ${100}  
+       ${resp}         AddPerson       ${MEMBER1}      ${PORT} ${0}
+       ${resp}         AddPerson       ${MEMBER1}      ${PORT} ${100}
        ${resp}         GetPersons      ${MEMBER1}      ${PORT} ${0}
        Should Be Equal As Strings    ${resp.status_code}    200
-       Should Contain     ${resp.content}   user5      
+       Should Contain     ${resp.content}   user5
 
 Add car-person mapping and get car-person mapping from Follower1
     [Documentation]     Add car-person and get car-person from Follower1
@@ -37,7 +38,7 @@ Add car-person mapping and get car-person mapping from Follower1
        Should Be Equal As Strings    ${resp.status_code}    200
        Should Contain  ${resp.content} user0
 
-Purchase 100 cars using Follower 
+Purchase 100 cars using Follower
     [Documentation]  Purchase 100 cars using Follower
        SLEEP   10
        ${resp}         BuyCar  ${MEMBER2}      ${PORT} ${100}  
@@ -68,10 +69,10 @@ Stop Leader
        SLEEP   30
        ${resp}         Killcontroller  ${MEMBER1}      ${USERNAME}     ${PASSWORD}     ${KARAF_HOME}
 
-       
-Add cars and get cars from Follower1 
+Add cars and get cars from Follower1
     [Documentation]    Add 100 cars and get added cars from Follower
-       ${resp}         AddCar  ${MEMBER2}      ${PORT} ${100}  
+       ${resp          InitCar ${MEMBER2}      ${PORT}
+       ${resp}         AddCar  ${MEMBER2}      ${PORT} ${100}
        ${resp}         Getcars ${MEMBER2}      ${PORT} ${0}
        Should Be Equal As Strings    ${resp.status_code}    200
        Should Contain  ${resp.content}         manufacturer1
@@ -79,14 +80,14 @@ Add cars and get cars from Follower1
 Add persons and get persons from Follower1
     [Documentation]    Add 100 persons and get persons
     [Documentation]    Note: There should be one person added first to enable rpc
-       ${resp}         AddPerson       ${MEMBER2}      ${PORT} ${0}    
-       ${resp}         AddPerson       ${MEMBER2}      ${PORT} ${100}  
+       ${resp}         AddPerson       ${MEMBER2}      ${PORT} ${0}
+       ${resp}         AddPerson       ${MEMBER2}      ${PORT} ${100}
        ${resp}         GetPersons      ${MEMBER2}      ${PORT} ${0}
        Should Be Equal As Strings    ${resp.status_code}    200
        Should Contain  ${resp.content}         user5
        SLEEP   10
-       
-Purchase 100 cars using Follower2 
+
+Purchase 100 cars using Follower2
     [Documentation]  Purchase 100 cars using Follower2
        ${resp}         BuyCar  ${MEMBER3}      ${PORT} ${100}
        SLEEP   10
diff --git a/test/tools/clustering/cluster-deployer/.gitignore b/test/tools/clustering/cluster-deployer/.gitignore
new file mode 100644 (file)
index 0000000..d717ce2
--- /dev/null
@@ -0,0 +1 @@
+temp/*
index 39efcf010eeab389be0784cd9f26611c3e4905eb..d4680a8b376dab48f359ddb2b3e33e6f023f592b 100644 (file)
@@ -40,7 +40,7 @@ featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.3/xml/features
 #
 # Comma separated list of features to install at startup
 #
-featuresBoot=config,standard,region,package,kar,ssh,management,odl-clustering-test-app,odl-restconf-noauth,odl-mdsal-clustering
+featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf,odl-mdsal-clustering,odl-clustering-test-app,odl-netconf-connector-ssh
 
 #
 # Defines if the boot features are started in asynchronous mode (in a dedicated thread)