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
return followers
#testGetClusterRoles()
-testGetLeader()
+#testGetLeader()
#testGetFollowers()
import UtilLibrary
import SettingsLibrary
-
#
#Creates the specified number of cars based on Cars yang model
# using RESTCONF
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)
import requests
from SSHLibrary import SSHLibrary
+import robot
+
+global _cache
+
#
#Helps in making GET REST calls
#
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
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
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)
#
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