UtilLibrary now uses requests session instead of
authorBasheeruddin Ahmed <syedbahm@cisco.com>
Wed, 10 Sep 2014 21:54:27 +0000 (14:54 -0700)
committerBasheeruddin Ahmed <syedbahm@cisco.com>
Wed, 24 Sep 2014 18:12:01 +0000 (11:12 -0700)
direct post /get which seem to open active connections

Change-Id: I3261d78b8497f8b1a97f991866511254bbf07628
Signed-off-by: Basheeruddin Ahmed <syedbahm@cisco.com>
test/csit/libraries/ClusterStateLibrary.py
test/csit/libraries/CrudLibrary.py
test/csit/libraries/UtilLibrary.py
test/csit/suites/clustering/datastore/basic/__init__.txt

index 185bce874afba2a38cbed326be5eafb515876b0f..1255623ac73d77568092d9d9c4ddd0d4a2116eca 100644 (file)
@@ -123,7 +123,7 @@ def testGetClusterRoles():
             print (ip + " seems to have value "+ str(dict[ip]))
 
 def testGetLeader ():
-  leader =  getLeader("shard-car-config",3,1,1,8181,"10.194.126.116","10.194.126.117","10.194.126.118")
+  leader =  getLeader("shard-inventory-config",3,1,1,8181,"10.194.126.116","10.194.126.117","10.194.126.118")
   print leader
   return leader
 
@@ -133,7 +133,7 @@ def testGetFollowers():
    return followers
 
 #testGetClusterRoles()
-testGetLeader()
+#testGetLeader()
 #testGetFollowers()
 
 
index bc603521e30c2cc95af067b632202de4789fd40e..8e371e20243ddee1280d2e42f887bfcd1cd8a497 100644 (file)
@@ -6,7 +6,6 @@ import sys
 import UtilLibrary
 import SettingsLibrary
 
-
 #
 #Creates the specified number of cars based on Cars yang model
 # using RESTCONF
@@ -239,7 +238,7 @@ def main():
         options()
         quit(0)
     SettingsLibrary.hostname = sys.argv[1]
-    SettingsLibrary.port = '8080'
+    SettingsLibrary.port = '8181'
     call = dict(ac=addCar, ap=addPerson, bc=buyCar,
                 gc=getCars, gp=getPersons, gcp=getCarPersonMappings,dc=deleteAllCars,dp=deleteAllPersons)
 
index 793fff4d9c5e4b491964a8cb46aef3a80760bb8c..cdd9bc563a5d0b192d1a10d5ea3e0c5cf19df9f1 100644 (file)
@@ -7,6 +7,10 @@ __email__ = "syedbahm@cisco.com"
 import requests
 from SSHLibrary import SSHLibrary
 
+import robot
+
+global _cache
+
 #
 #Helps in making GET REST calls
 #
@@ -17,10 +21,11 @@ def get(url, userId=None, password=None):
     headers['Accept']= 'application/xml'
 
     # Send the GET request
-    req = requests.get(url, params=None, headers=headers)
+    session = _cache.switch("CLUSTERING_GET")
+    resp = session.get(url,headers=headers)
 
     # Read the response
-    return req
+    return resp
 
 #
 #Helps in making POST REST calls without outputs
@@ -31,7 +36,8 @@ def nonprintpost(url, userId, password,data):
     headers['Content-Type'] = 'application/json'
     #headers['Accept']= 'application/xml'
 
-    resp = requests.post(url,data.encode(),headers=headers)
+    session = _cache.switch("CLUSTERING_POST")
+    resp = session.post(url,data.encode('utf-8'),headers=headers)
 
 
     return resp
@@ -45,8 +51,8 @@ def post(url, userId, password,data):
     headers = {}
     headers['Content-Type'] = 'application/json'
     #headers['Accept']= 'application/xml'
-
-    resp = requests.post(url,data.encode(),headers=headers)
+    session = _cache.switch("CLUSTERING_POST")
+    resp = session.post(url,data.encode('utf-8'),headers=headers)
 
     #print (resp.raise_for_status())
     print (resp.headers)
@@ -58,7 +64,8 @@ def post(url, userId, password,data):
 #
 def delete(url,userId,password):
     print("delete all resources belonging to url"+url)
-    resp=requests.delete(url)
+    session = _cache.switch("CLUSTERING_DELETE")
+    resp=session.delete(url)
 
 
 # use username and password of controller server for ssh and need
index 86169c6d277a15355ff8f582aeea373f244087a5..a6ced85fa2ccc6beab52f385ea797508edd9d623 100644 (file)
@@ -1,10 +1,6 @@
 *** Settings ***
 Documentation     Test suite for MD-SAL NSF
-Suite Setup       Start Suite
-Suite Teardown    Stop Suite
 Library     SSHLibrary
 
 
 ** Keywords ***
-Start Suite  
-Stop Suite