Remove neon version of netconf testplans
[integration/test.git] / csit / libraries / CrudLibrary.py
index 8194bbd0f23337ff622d89a1a0b1c9d0d51977a2..baaf5f4547f30e12bdc45e503e3993a226607636 100644 (file)
@@ -1,13 +1,15 @@
-__author__ = "Basheeruddin Ahmed"
-__copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
-__license__ = "New-style BSD"
-__email__ = "syedbahm@cisco.com"
 import sys
 import UtilLibrary
 import SettingsLibrary
 import time
 
 
+__author__ = "Basheeruddin Ahmed"
+__copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
+__license__ = "New-style BSD"
+__email__ = "syedbahm@cisco.com"
+
+
 def initCar(hostname, port):
     """Initiales the car shard"""
     x = 0
@@ -66,7 +68,7 @@ def addPerson(hostname, port, numberOfPersons, *expected):
         return resp
 
     genderToggle = "Male"
-    for x in range(1, numberOfPersons+1):
+    for x in range(1, numberOfPersons + 1):
         if(genderToggle == "Male"):
             genderToggle = "Female"
         else:
@@ -77,7 +79,7 @@ def addPerson(hostname, port, numberOfPersons, *expected):
         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)
+            contactNo="some number" + strId)
         # Send the POST request using RPC
         resp = UtilLibrary.post(SettingsLibrary.getAddPersonRpcUrl(hostname, port), "admin", "admin", payload)
 
@@ -111,7 +113,7 @@ def addCarPerson(hostname, port, numberOfCarPersons):
 
         return resp
 
-    for x in range(1, numberOfCarPersons+1):
+    for x in range(1, numberOfCarPersons + 1):
         strId = str(x)
 
         payload = SettingsLibrary.add_car_person_template.substitute(Id=strId, personId="user" + strId)
@@ -140,9 +142,9 @@ def buyCar(hostname, port, numberOfCarBuyers, start=0):
     </note>
     """
 
-    print "Buying " + str(numberOfCarBuyers) + " Cars"
-    for x in range(start, start+numberOfCarBuyers):
-        strId = str(x+1)
+    print("Buying " + str(numberOfCarBuyers) + " Cars")
+    for x in range(start, start + numberOfCarBuyers):
+        strId = str(x + 1)
 
         payload = SettingsLibrary.buy_car_rpc_template.substitute(personId="user" + strId, carId=strId)
 
@@ -190,7 +192,7 @@ def getCarPersonMappings(hostname, port, ignore):
     """
     resp = UtilLibrary.get(SettingsLibrary.getCarPersonUrl(hostname, port), "admin", "admin")
     resp.encoding = 'utf-8'
-    print (resp)
+    print(resp)
 
     return resp
 
@@ -240,7 +242,7 @@ def testlongevity(inputtime, port, *ips):
             resp = getCars(ip, port, 0)
             if resp.status_code == 200:
                 print("Pass: car data available after addition")
-                if resp.content.find("manufacturer100") == -1:
+                if resp.text.find("manufacturer100") == -1:
                     print("Fail: last car is not there")
                 else:
                     print("Pass: car data matches")
@@ -252,7 +254,7 @@ def testlongevity(inputtime, port, *ips):
             resp = getPersons(ip, port, 0)
             if resp.status_code == 200:
                 print("Pass: people data available after addition")
-                if resp.content.find("user100") == -1:
+                if resp.text.find("user100") == -1:
                     print("Fail: last person is not there")
                 else:
                     print("Pass: person data matches")
@@ -265,7 +267,7 @@ def testlongevity(inputtime, port, *ips):
             resp = getCarPersonMappings(ip, port, 0)
             if resp.status_code == 200:
                 print("Pass: car person data available after addition")
-                if resp.content.find("user100") == -1:
+                if resp.text.find("user100") == -1:
                     print("Fail: last car person is not there")
                 else:
                     print("Pass: car person data matches")
@@ -295,7 +297,7 @@ def options():
 
     usageString = usageString + command + param
 
-    print (usageString)
+    print(usageString)
 
 
 #
@@ -319,6 +321,7 @@ def main():
 
     call[sys.argv[2]](SettingsLibrary.hostname, SettingsLibrary.port, int(sys.argv[3]))
 
+
 #
 # main invoked
 if __name__ == "__main__":