def connectToVChassis(self, chassisIp): # Connects to the virtual chassis url = self.ixnObj.sessionUrl+'/operations/connecttochassis' data = {"arg1": chassisIp} response = self.ixnObj.post(url, data=data) if response == 1: return 1 if response.json()['state'] == 'ERROR': self.ixnObj.logInfo('connectToVChassis error: %s' % response.json()['result']) return 1 else: self.ixnObj.logInfo('connectToVChassis: Successfully connected to chassis: %s' % chassisIp) while response.json()["state"] == "IN_PROGRESS" or response.json()["state"] == "down": if timeout == 0: break time.sleep(1) response = request.get(self.ixnObj.sessionUrl) state = response.json()["state"] self.ixnObj.logInfo("\t\t%s" % state) timeout = timeout - 1 return 0