def listHypervisorDetails(novaUrl, token): #print 'ENTER listHypervisorDetails' address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + \ '/os-hypervisors/detail' headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def showHypervisor(novaUrl, token, hypervisor_id): #print 'ENTER showHypervisor' address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + \ '/os-hypervisors/' + str(hypervisor_id) headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def getSCGs(novaUrl, token): #print 'ENTER showFlavor' address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + '/storage-connectivity-groups' headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def listUnmanagedServers(novaUrl, token, hostName): address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + \ '/os-hosts/' + hostName + '/all-servers' headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def showExtension(novaUrl, token, extension_id): #print 'ENTER showExtension' address = openstackUtils.parseAddress(novaUrl) url = EXTS_ID % (openstackUtils.parseBaseURL(novaUrl, address), extension_id) headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def listexistingHosts(novaUrl, token): address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL( novaUrl, address ) + '/os-hypervisors/' + '/detail?include_remote_restart_enabled=true' headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def showServer_per_host(novaUrl, token, server_id, host_id): #print 'ENTER showServer' address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL( novaUrl, address) + "/" + server_id + '?host=' + host_id headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def removevNIC(novaUrl, token, serverid, attachment_id): address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL( novaUrl, address) + '/servers/' + serverid + '/os-interface/' + attachment_id headers = {'X-Auth-Token': token} return restUtils.request('DELETE', address, url, headers)
def dettachVolume(novaUrl, token, vm_id, vol_id): address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL( novaUrl, address) + "/servers/" + vm_id + "/os-volume_attachments/" + vol_id headers = {'X-Auth-Token': token} return restUtils.request('DELETE', address, url, headers)
def listServerSummaries_host(novaUrl, token, host_id): #print 'ENTER listServerSummaries' address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL( novaUrl, address) + "/servers/detail?host=" + host_id headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def showTenantQuotaSetDefaults(novaUrl, token, tenant_id): #print 'ENTER showTenantQuotaSetDefaults' address = openstackUtils.parseAddress(novaUrl) url = QUOTA_SETS_DFLT % (openstackUtils.parseBaseURL(novaUrl, address), tenant_id) headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def listUsers2(keystoneUrl, token) : #print 'ENTER listUsers' address = openstackUtils.parseAddress(keystoneUrl) url = openstackUtils.parseBaseURL(keystoneUrl, address) + '/users' headers = {'X-Auth-Token' : token} #return restUtils.getJSON(address, url, headers)['users'] return restUtils.getJSON(address, url, headers)
def getValidationResult(validatorUrl, token): print("ENTER getValidationResult() method") address = openstackUtils.parseAddress(validatorUrl) url = openstackUtils.parseBaseURL(validatorUrl, address) + '/v1/validate/result' headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def deleteImage(glanceUrl, token, image_id): #print 'ENTER deleteImage' address = openstackUtils.parseAddress(glanceUrl) url = openstackUtils.parseBaseURL(glanceUrl, address) + '/v2.0/images/' + image_id headers = {'X-Auth-Token': token} return restUtils.request('DELETE', address, url, headers)
def createServer(novaUrl, token, serverProps): #print 'ENTER createServer' address = openstackUtils.parseAddress(novaUrl) url = SVRS % openstackUtils.parseBaseURL(novaUrl, address) postBody = json.dumps({'server': serverProps}) headers = {'X-Auth-Token': token} return restUtils.postJSON(address, url, postBody, headers)
def deleteVolumeAttachment(novaUrl, token, server_id, attachment_id): #print 'ENTER deleteVolumeAttachment' address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + '/servers/' + \ server_id + '/os-volume_attachments/' + attachment_id headers = {'X-Auth-Token': token} return restUtils.request('DELETE', address, url, headers)
def createServerAction(novaUrl, token, server_id, actionProps): #print 'ENTER createServerAction' address = openstackUtils.parseAddress(novaUrl) url = SVR_ACT % (openstackUtils.parseBaseURL(novaUrl, address), server_id) postBody = json.dumps(actionProps) headers = {'X-Auth-Token': token} return restUtils.postJSON(address, url, postBody, headers)
def listPlacementPolicies(novaUrl, token): #print 'ENTER listPlacementPolicies' address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + '/ego/policy/placement' headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def showServerDiagnostics(novaUrl, token, server_id): #print 'ENTER showServerDiagnostics' address = openstackUtils.parseAddress(novaUrl) url = SVR_DIAGS % (openstackUtils.parseBaseURL(novaUrl, address), server_id) headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def showPlacementPolicy(novaUrl, token, policy_id): #print 'ENTER showPlacementPolicy' address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + \ '/ego/policy/placement/' + str(policy_id) headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def createFlavor(novaUrl, token, flavorProps): #print 'ENTER createFlavor' address = openstackUtils.parseAddress(novaUrl) url = FLAVS % openstackUtils.parseBaseURL(novaUrl, address) postBody = json.dumps({'flavor': flavorProps}) headers = {'X-Auth-Token': token} return restUtils.postJSON(address, url, postBody, headers)
def unregisterneoHostwithpvc(novaUrl, token, host_name): #print 'ENTER deleteHost' address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + \ '/os-hosts/' + host_name + '/uninstall' headers = {'X-Auth-Token': token} return restUtils.request('DELETE', address, url, headers)
def showHost(novaUrl, token, host_name): #print 'ENTER showHost' address = openstackUtils.parseAddress(novaUrl) url = HOSTS_NAME % (openstackUtils.parseBaseURL(novaUrl, address), host_name) headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def createSCGs(novaUrl, token, scg_props): address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + '/storage-connectivity-groups' postBody = json.dumps({'storage_connectivity_group': scg_props}) headers = {'X-Auth-Token': token} return restUtils.postJSON(address, url, postBody, headers)
def showVolumeAttachment(novaUrl, token, server_id, attachment_id): #print 'ENTER showVolumeAttachment' address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + '/servers/' + \ server_id + '/os-volume_attachments/' + attachment_id headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def listImages(glanceUrl, token): #print 'ENTER listImages' address = openstackUtils.parseAddress(glanceUrl) url = openstackUtils.parseBaseURL(glanceUrl, address) + '/v2.0/images?limit=400' headers = {'X-Auth-Token': token} return restUtils.getJSON(address, url, headers)
def onboardUnmanagedServers(novaUrl, token, hostName, serversProps): address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + \ '/os-hosts/' + hostName + '/onboard' postBody = json.dumps({'servers': serversProps}) headers = {'X-Auth-Token': token} return restUtils.postJSON(address, url, postBody, headers)
def updatePlacementPolicy(novaUrl, token, policy_id, policyProps): #print 'ENTER updatePlacementPolicy' address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + \ '/ego/policy/placement/' + str(policy_id) putBody = json.dumps({'placement_policy': policyProps}) headers = {'X-Auth-Token': token} return restUtils.putJSON(address, url, putBody, headers)
def HostMaintence(novaUrl, token, host_name, hyperProps): address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL( novaUrl, address) + '/ego/prs/hypervisor_maintenance/' + host_name headers = {'X-Auth-Token': token} putBody = json.dumps({'Maintenance': hyperProps}) return restUtils.putJSON(address, url, putBody, headers)
def addvNIC_dy(novaUrl, token, serverid, network_id): address = openstackUtils.parseAddress(novaUrl) url = openstackUtils.parseBaseURL(novaUrl, address) + \ '/servers/' + serverid + '/os-interface' postBody = json.dumps({"interfaceAttachment": {"net_id": network_id}}) headers = {'X-Auth-Token': token} print '\nExiting from addvNic function..\n' return restUtils.postJSON(address, url, postBody, headers)