keystone_ip = "130.206.80.63" keystone_port = "35357" #vdc = 'ebe6d9ec7b024361b7a3882c65a57dda' user = '******' password='******' project ='henarproject' token = utils.obtainToken (keystone_ip, keystone_port, user, password, project) print(token) headers = {'Content-Type': 'application/xml', 'X-Auth-Token': token , 'Tenant-ID': vdc} print(headers) print('Get products in the software catalogue: ') resource = "/sdc/rest/catalog/product" data1 = utils.doRequestHttpOperation(domine, port,resource, 'GET',None, headers) print(" OK") dom = parseString(data1) try: product = (dom.getElementsByTagName('product'))[0] productname = product.firstChild.firstChild.nodeValue print('First product in the software catalogue') print(" OK " + productname) except: print ("Error in the request to get products") sys.exit(1) print('Get Product Details ' + product_name ) data1 = utils.doRequestHttpOperation(domine,port,"/sdc/rest/catalog/product/"+product_name, 'GET',None, headers) print(" OK")
password = '******' project = 'henarproject' token = utils.obtainToken(keystone_ip, keystone_port, user, password, project) print(token) headers = { 'Content-Type': 'application/xml', 'X-Auth-Token': token, 'Tenant-ID': vdc } print(headers) print('Get products in the software catalogue: ') resource = "/sdc/rest/catalog/product" data1 = utils.doRequestHttpOperation(domine, port, resource, 'GET', None, headers) dom = parseString(data1) try: product = (dom.getElementsByTagName('product'))[0] productname = product.firstChild.firstChild.nodeValue print('First product in the software catalogue: ' + productname) except: print("Error in the request to get products") sys.exit(1) print('Get Product Details ' + product_name) data1 = utils.doRequestHttpOperation( domine, port, "/sdc/rest/catalog/product/" + product_name, 'GET', None, headers)
keystone_port = "35357" vdc = '60b4125450fc4a109f50357894ba2e28' user = '******' password='******' project ='henarproject' token = utils.obtainToken (keystone_ip, keystone_port, user, password, project) print(token) headers = {'Content-Type': 'application/xml', 'X-Auth-Token': token , 'Tenant-ID': vdc} print(headers) print('Get products in the software catalogue: ') resource = "/sdc/rest/catalog/product" data1 = utils.doRequestHttpOperation(domine, port, resource, 'GET',None,headers) dom = parseString(data1) try: product = (dom.getElementsByTagName('product'))[0] productname = product.firstChild.firstChild.nodeValue print('First product in the software catalogue: '+productname) except: print ("Error in the request to get products") sys.exit(1) print('Get Product Details ' + product_name ) data1 = utils.doRequestHttpOperation(domine, port, "/sdc/rest/catalog/product/"+product_name, 'GET',None, headers) print(" OK")
headers = { 'Content-Type': 'application/xml', 'X-Auth-Token': token, 'Tenant-ID': vdc } print(headers) resource_product_instance = "/sdc/rest/vdc/" + vdc + "/productInstance" print('Install a product in VM. Product ' + product_name) productInstanceDto = utils.createProductInstanceDto(vm_ip, vm_fqn, product_name, product_version) task = utils.doRequestHttpOperation(domine, port, resource_product_instance, 'POST', tostring(productInstanceDto), headers) status = utils.processTask(domine, port, task) print(" " + status) if status == "ERROR": sys.exit(1) resource_get_info_product_instance = "/sdc/rest/vdc/" + vdc + "/productInstance/" + vm_fqn + '_' + product_name + '_' + product_version print('Get Product Instance Info. Product ' + product_name) data = utils.doRequestHttpOperation(domine, port, resource_get_info_product_instance, 'GET', None, headers) print(" OK") status = utils.processProductInstanceStatus(data) if status != 'INSTALLED': print("Status not correct" + status)
domine = "130.206.80.119" port = "8080" keystone_ip = "130.206.80.63" keystone_port = "35357" vdc = '60b4125450fc4a109f50357894ba2e28' user = '******' password = '******' project = 'henarproject' print("Getting token from keystone") token = utils.obtainToken(keystone_ip, keystone_port, user, password, project) print("OK: " + token) headers = {'Content-Type': 'application/xml', 'X-Auth-Token': token, 'Tenant-ID': vdc} print('Get product list in the software catalogue...') resource = "/sdc/rest/catalog/product" data1 = utils.doRequestHttpOperation(domine, port, resource, 'GET', None, headers) #Calculating number of products in SDC Catalogue root = xml.etree.ElementTree.fromstring(data1) number_product = 0 for product in root.findall('product'): number_product = number_product + 1 print("Number of products in catalog:") print(number_product) print("SUCCESS")
resource_product_instance = "/sdc/rest/vdc/" + vdc + "/productInstance" #productInstanceDto = utils.createProductInstanceDto (vm_ip,vm_fqn, product_name, product_version) #task = utils.doRequestHttpOperation(domine, port, resource_product_instance, 'POST',tostring(productInstanceDto), headers) #status = utils.processTask (domine,task) #print (" " + status) #if status != 'SUCCESS': # print("Error with the requirements to test") # sys.exit(1) resource_install_artifact = "/sdc/rest/vdc/" + vdc + "/productInstance/" + vm_fqn + '_' + product_name + '_' + product_version + "/ac" print('Deploy Ac in product ' + product_name ) artifactDto = utils.createArtifactDto(artifact_name, product_name, product_version) print(artifactDto) data = utils.doRequestHttpOperation(domine, port, resource_install_artifact, 'POST', artifactDto, headers) status = utils.processTask(domine, data) print (" " + status) #if status != 'INSTALLED': # print("Status not correct" + status) resource_delete_artifact = "/sdc/rest/vdc/" + vdc + "/productInstance/" + vm_fqn + '_' + product_name + '_' + product_version + "/ac/" + artifact_name print('Get Info Ac in product ' + product_name ) data = utils.doRequestHttpOperation(domine, port, resource_delete_artifact, 'GET', None, headers) print (" OK" ) print('Get Delete Product Instance ' + product_name ) task = utils.doRequestHttpOperation(domine, port, resource_delete_artifact, 'DELETE', None, headers) status = utils.processTask(domine, task) print (" " + status) #data = utils.doRequestHttpOperation(domine, port, resource_delete_artifact, 'GET',None, headers) #statusProduct = utils.processProductInstanceStatus(data)
user = '******' password='******' project ='henarproject' vdc = '60b4125450fc4a109f50357894ba2e28' token = utils.obtainToken (keystone_ip, keystone_port, user, password, project) print(token) headers = {'Content-Type': 'application/xml', 'X-Auth-Token': token , 'Tenant-ID': vdc} print(headers) resource_product_instance = "/sdc/rest/vdc/"+vdc+"/productInstance" print('Install a product in VM. Product ' + product_name ) productInstanceDto = utils.createProductInstanceDto (vm_ip,vm_fqn, product_name, product_version) task = utils.doRequestHttpOperation(domine,port,resource_product_instance, 'POST',tostring(productInstanceDto), headers) status = utils.processTask (domine,port,task) print (" " + status) if status == "ERROR": sys.exit(1) resource_get_info_product_instance = "/sdc/rest/vdc/"+vdc+"/productInstance/" + vm_fqn+'_'+product_name+'_'+product_version print('Get Product Instance Info. Product ' + product_name ) data = utils.doRequestHttpOperation(domine,port,resource_get_info_product_instance, 'GET',None, headers) print(" OK") status = utils.processProductInstanceStatus(data) if status != 'INSTALLED': print("Status not correct" + status)
#productInstanceDto = utils.createProductInstanceDto (vm_ip,vm_fqn, product_name, product_version) #task = utils.doRequestHttpOperation(domine, port, resource_product_instance, 'POST',tostring(productInstanceDto), headers) #status = utils.processTask (domine,task) #print (" " + status) #if status != 'SUCCESS': # print("Error with the requirements to test") # sys.exit(1) resource_install_artifact = "/sdc/rest/vdc/" + vdc + "/productInstance/" + vm_fqn + '_' + product_name + '_' + product_version + "/ac" print('Deploy Ac in product ' + product_name) artifactDto = utils.createArtifactDto(artifact_name, product_name, product_version) print(artifactDto) data = utils.doRequestHttpOperation(domine, port, resource_install_artifact, 'POST', artifactDto, headers) status = utils.processTask(domine, data) print(" " + status) #if status != 'INSTALLED': # print("Status not correct" + status) resource_delete_artifact = "/sdc/rest/vdc/" + vdc + "/productInstance/" + vm_fqn + '_' + product_name + '_' + product_version + "/ac/" + artifact_name print('Get Info Ac in product ' + product_name) data = utils.doRequestHttpOperation(domine, port, resource_delete_artifact, 'GET', None, headers) print(" OK") print('Get Delete Product Instance ' + product_name) task = utils.doRequestHttpOperation(domine, port, resource_delete_artifact, 'DELETE', None, headers) status = utils.processTask(domine, task) print(" " + status)
keystone_port = "35357" vdc = '60b4125450fc4a109f50357894ba2e28' user = '******' password = '******' project = 'henarproject' print("Getting token from keystone") token = utils.obtainToken(keystone_ip, keystone_port, user, password, project) print("OK: " + token) headers = { 'Content-Type': 'application/xml', 'X-Auth-Token': token, 'Tenant-ID': vdc } print('Get product list in the software catalogue...') resource = "/sdc/rest/catalog/product" data1 = utils.doRequestHttpOperation(domine, port, resource, 'GET', None, headers) #Calculating number of products in SDC Catalogue root = xml.etree.ElementTree.fromstring(data1) number_product = 0 for product in root.findall('product'): number_product = number_product + 1 print("Number of products in catalog:") print(number_product) print("SUCCESS")
password = '******' project = 'henarproject' token = utils.obtainToken(keystone_ip, keystone_port, user, password, project) print(token) headers = { 'Content-Type': 'application/xml', 'X-Auth-Token': token, 'Tenant-ID': vdc } print(headers) print('Get products in the software catalogue: ') resource = "/sdc/rest/catalog/product" data1 = utils.doRequestHttpOperation(domine, port, resource, 'GET', None, headers) print(" OK") dom = parseString(data1) try: product = (dom.getElementsByTagName('product'))[0] productname = product.firstChild.firstChild.nodeValue print('First product in the software catalogue') print(" OK " + productname) except: print("Error in the request to get products") sys.exit(1) print('Get Product Details ' + product_name) data1 = utils.doRequestHttpOperation( domine, port, "/sdc/rest/catalog/product/" + product_name, 'GET', None,