X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FClusterStateLibrary.py;h=815e6e3dcf0fc4da557e491deb16b9c9ddbe0ee6;hb=d52be90c6c92151afb0ddeb49401f195b347011f;hp=dd006cb56a9b26d41ba6bdb852e55bec462003dd;hpb=7ef28e701bb30353fe438e97c635e05130f23b84;p=integration%2Ftest.git diff --git a/csit/libraries/ClusterStateLibrary.py b/csit/libraries/ClusterStateLibrary.py index dd006cb56a..815e6e3dcf 100644 --- a/csit/libraries/ClusterStateLibrary.py +++ b/csit/libraries/ClusterStateLibrary.py @@ -22,18 +22,18 @@ def getClusterRoles(shardName, numOfShards=3, numOfTries=3, sleepBetweenRetriesI for ip in ips: i = 1 dict[ip] = None - print "numOfShards => " + str(numOfShards) + print("numOfShards => ", str(numOfShards)) while i <= numOfShards: shardMemberName = "member-" + str(i) + "-" + shardName j = 1 - print 'j => ' + str(j) - print 'numOfTries => ' + str(numOfTries) + print('j => ', str(j)) + print('numOfTries => ', str(numOfTries)) while int(j) <= int(numOfTries): print("Try number " + str(j)) try: print("getting role of " + ip + " for shardName = " + shardMemberName) url = SettingsLibrary.getJolokiaURL(ip, str(port), str(i), shardName) - print url + print(url) resp = UtilLibrary.get(url) print(resp) if resp.status_code != 200: @@ -60,7 +60,7 @@ def getClusterRoles(shardName, numOfShards=3, numOfTries=3, sleepBetweenRetriesI return dict -def isRole(role, shardName, ipAddress, numOfShards=3, numOfRetries=1, sleepFor=3, port=8181): +def isRole(role, shardName, ipAddress, numOfShards=3, numOfRetries=1, sleepFor=3, port=8181): """Given a role (Leader, Follower, Candidate, or IsolatedLeader), shardname (e.g. shard-inventory-config), controller IP address, and number of shards on the controller,this function determines if the controller, @@ -92,7 +92,7 @@ def getFollowers(shardName, numOfShards=3, numOfTries=3, sleepBetweenRetriesInSe for ip in dict.keys(): if dict[ip] == 'Follower': result.append(ip) - print "i=", i, "result=", result + print("i=%s result=%s" % (i, result)) if (len(result) == (len(ips) - 1)): break sleep(1) @@ -116,7 +116,7 @@ def testGetClusterRoles(): def testGetLeader(): leader = getLeader("shard-inventory-config", 3, 1, 1, 8181, "10.194.126.116", "10.194.126.117", "10.194.126.118") - print leader + print(leader) return leader