def addNewChassis(self, chassisIpList): """ Add a chassis to connect to. If you have multiple chassis's, put them in a list. Parameter chassisIp: : One or more chassis IP addresses in a list. """ if type(chassisIpList) == str: chassisIpList = chassisIpList.split(' ') self.logInfo('addNewChassis: {}'.format(chassisIpList)) for chassisIp in chassisIpList: # Verify if chassisIp exists. If exists, no need to add new chassis. url = self.sessionIdUrl+'/ixLoad/chassisChain/chassisList' response = self.get(url) for eachChassisIp in response.json(): if eachChassisIp['name'] == chassisIp: self.logInfo('\naddNewChassis: Chassis Ip exists in config. No need to add new chassis') objectId = eachChassisIp['objectID'] # /api/v0/sessions/10/ixLoad/chassisChain/chassisList/1/docs return eachChassisIp['id'], eachChassisIp['links'][0]['href'].replace('/docs', '') self.logInfo('addNewChassis: Chassis IP does not exists') self.logInfo('addNewChassis: Adding new chassisIP: %s:\nURL: %s' % (chassisIp, url)) self.logInfo('addNewChassis: Server synchronous blocking state. Please wait a few seconds ...') response = self.post(url, data = {"name": chassisIp}) objectId = response.headers['Location'].split('/')[-1] # /api/v0/sessions/2/ixLoad/chassisChain/chassisList/0 locationUrl = response.headers['Location'] self.logInfo('\nAddNewChassis: locationUrl: %s' % locationUrl) url = self.httpHeader+locationUrl self.logInfo('\nAdded new chassisIp Object to chainList: %s' % url) response = self.get(url) newChassisId = response.json()['id'] self.logInfo('\naddNewChassis: New Chassis ID: %s' % newChassisId) self.refreshConnection(locationUrl=locationUrl) self.waitForChassisIpToConnect(locationUrl=locationUrl) return newChassisId,locationUrl