def putAccountSnow(self): try: passed = False version = utils.decodeCredential(snow_username) url = utils.decodeCredential(snow_password) userName = utils.decodeCredential(snow_version) password = utils.decodeCredential(snow_url) randID = 'MyAmazon' randID += str(x) print(randID) id1 = "f16b0f4a-a76e-499e-b5f7-testautomationsnowNewV" resp, body = self.api_client.get_AccountById(id1) data = json.dumps(body) data = json.loads(data) body = { "account": { "basicInfo": { "accountName": data["basicInfo"]["accountName"], "accountType": "master", "isActive": "Active", "userType": "billing", "serviceProviderCode": "snow", "serviceProviderType": "snow", "credential_count": 1 }, "advancedInfo": { "version": version, "url": url }, "credentials": [{ "credentialName": "kjkkkjk", "purpose": ["costIngestion"], "context": [{ "team": ["CORE-X"] }], "status": "Active", "passwordFields": { "userName": userName, "url": url, "password": password } }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationsnowNewV" } } resp, body = self.api_client.update_account(body, id1) print(resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def test_connection_amazon_asset(self): try: passed = False accessKey=utils.decodeCredential(aws_accessKey) secretKey=utils.decodeCredential(aws_secretKey) body = { "basicInfo": { "serviceProviderType": "amazon", "serviceProviderCode": "amazon", "userType": "asset" }, "advancedInfo": { "accountNumber": "2222222222" }, "credentials": { "crefId": "123-456-789-012", "passwordFields": { "accessKey": accessKey, "secretKey": secretKey } } }; resp, body = self.api_client.testConnection(body) print (resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def test_connection_amazon_billing_InvalidCredId_validPasswordField(self): try: passed = False accessKey=utils.decodeCredential(aws_accessKey) secretKey=utils.decodeCredential(aws_secretKey) s3Bucket=utils.decodeCredential(aws_s3Bucket) body = { "basicInfo": { "serviceProviderType": "amazon", "serviceProviderCode": "amazon", "userType": "billing" }, "advancedInfo": { "s3Bucket" : s3Bucket }, "credentials": { "crefId": "test3763763737hdsgdsh", "passwordFields": { "accessKey": accessKey, "secretKey": secretKey } } }; resp, body = self.api_client.testConnection(body) print (resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def test_connection_ibm_asset_invalidCredentials(self): try: passed = False username=utils.decodeCredential(ibm_username) apikey=utils.decodeCredential(ibm_apikey) body = { "basicInfo": { "serviceProviderType": "ibm", "serviceProviderCode": "softlayer", "userType": "asset" }, "advancedInfo": { "accountNumber": "2222222222" }, "credentials": { "crefId": "123-456-789-012", "passwordFields": { "apiKey": apikey+apikey+apikey, "username": username+username } } }; resp, body = self.api_client.testConnection(body) print (resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 400) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def createCredential_WithValue(self): try: passed = False s3Bucket=utils.decodeCredential(aws_s3Bucket) accessKey=utils.decodeCredential(aws_accessKey) secretKey=utils.decodeCredential(aws_secretKey) print (crefId) body = { "crefId":crefId, "credential": { "value":{ "accessKey": accessKey, "secretKey": secretKey } } }; resp, body = self.api_client.postCredRefCredential(body) print (resp) logger.info("API response:" + str(resp)) resp1=resp if(resp1==200 or resp1==409) : passed = True status['CAM-APITest'] = passed return passed else : status['CAM-APITest'] = False return False except: status['CAM-APITest'] = False return False
def deleteNewConfiguration(self): try: passed = False x = random.randint(0, 50000) randID = 'xys779' randID += str(x) print(randID) vault_adapter_url = utils.decodeCredential(adapter_url) vault_endpoint_url = utils.decodeCredential(endpoint_url) body = { "display_name": randID, "vault_type": "Test", "isReadOnly": "false", "vault_adapter_url": vault_adapter_url, "vault_endpoint_url": vault_endpoint_url } resp, body = self.api_client.postVaultConfiguration(body) print(resp) logger.info("API response:" + str(resp)) data = json.dumps(body) data = json.loads(data) print(data['vault_id']) resp, body = self.api_client.delete_VaultConfiguration( data['vault_id']) print(resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 204) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def postAccountAzure(self): try: passed = False randID = 'TestAZureAc' randID += str(x) print(randID) subscriptionID = utils.decodeCredential(azure_subscriptionID) offerID = utils.decodeCredential(azure_offerID) tenantID = utils.decodeCredential(azure_tenantID) body = { "account": { "basicInfo": { "accountName": randID, "accountType": "master", "isActive": "Active", "userType": "billing", "serviceProviderCode": "azure", "serviceProviderType": "azure", "credential_count": 1 }, "advancedInfo": { "subscriptionID": subscriptionID, "offerID": offerID, "tenantID": tenantID }, "credentials": [{ "credentialName": "ljlkajslkfdjlkasjdf", "crefId": azurecredRef_billing, "purpose": ["costIngestion"], "context": [{ "team": ["CORE-X"] }], "status": "Active", "accountNumber": "1234567890aa", "tenantID": tenantID, "applicationID": offerID }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationazure" } } #print body resp, body = self.api_client.create_account(body) print(resp) ##print body logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else: status['CAM-APITest'] = False return False except: status['CAM-APITest'] = False return False
def postAccountVRAAsset(self): try: passed = False randID = 'TestVRAAssetAc' randID += str(x) print(randID) # print metadata[0] endPointVersion = utils.decodeCredential(vra_endPointVersion) url = utils.decodeCredential(vra_url) tenant = utils.decodeCredential(vra_tenant) username = utils.decodeCredential(vra_username) password = utils.decodeCredential(vra_password) body = { "account": { "basicInfo": { "accountName": randID, "serviceProviderType": "vra", "isActive": "Active", "accountType": "subaccount", "userType": "asset", "serviceProviderCode": "vra", "credential_count": 1 }, "advancedInfo": { "accountNumber": "vraAccount77", "endPointVersion": endPointVersion, "url": url, "tenant": tenant }, "credentials": [{ "credentialName": "fasdfasdf", "purpose": ["provisioning"], "status": "Active", "context": [{ "team": ["CORE-X"] }], "passwordFields": { "username": username, "password": password } }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationvraasset" } } #print body resp, body = self.api_client.create_account(body) print(resp) #print body logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def postNewDefaultConfiguration(self): try: passed = False x = random.randint(0, 50000) randID = 'xys778' randID += str(x) print(randID) vault_adapter_url = utils.decodeCredential(adapter_url) vault_endpoint_url = utils.decodeCredential(endpoint_url) body = { "display_name": randID, "vault_type": "default", "isReadOnly": "false", "vault_adapter_url": vault_adapter_url, "vault_endpoint_url": vault_endpoint_url } resp, body = self.api_client.postVaultConfiguration(body) print(resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 409) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def putAccountVRAAsset(self): try: passed = False randID = 'TestVRAAssetAc' randID += str(x) print(randID) endPointVersion = utils.decodeCredential(vra_endPointVersion) url = utils.decodeCredential(vra_url) tenant = utils.decodeCredential(vra_tenant) id1 = "f16b0f4a-a76e-499e-b5f7-testautomationvraasset" resp, body = self.api_client.get_AccountById(id1) data = json.dumps(body) data = json.loads(data) body = { "account": { "basicInfo": { "accountName": data["basicInfo"]["accountName"], "serviceProviderType": "vra", "isActive": "Active", "accountType": "subaccount", "userType": "asset", "serviceProviderCode": "vra", "credential_count": 1 }, "advancedInfo": { "accountNumber": "vraAccount77", "endPointVersion": endPointVersion, "url": url, "tenant": tenant }, "credentials": [{ "credentialName": "fasdfasdf", "purpose": ["provisioning"], "status": "Active", "context": [{ "team": ["CORE-X"] }], "crefId": vracredRef_asset }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationvraasset" } } resp, body = self.api_client.update_account(body, id1) print(resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else: status['CAM-APITest'] = False return False except: status['CAM-APITest'] = False return False
def test_connection_azure_asset(self): try: passed = False subscriptionID = utils.decodeCredential(azure_subscriptionID) tenantID = utils.decodeCredential(azure_tenantID) body = { "basicInfo": { "serviceProviderType": "azure", "serviceProviderCode": "azure", "userType": "asset" }, "advancedInfo": { "tenantID": tenantID, "subscriptionID": subscriptionID }, "credentials": { "crefId": crefId_azure_asset } } resp, body = self.api_client.testConnection(body) print(resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def postAccountSnow(self): try: passed = False version = utils.decodeCredential(snow_username) url = utils.decodeCredential(snow_password) userName = utils.decodeCredential(snow_version) password = utils.decodeCredential(snow_url) randID = 'TestSnowAc' randID += str(x) print(randID) # print metadata[0] body = { "account": { "basicInfo": { "accountName": randID, "accountType": "master", "isActive": "Active", "userType": "billing", "serviceProviderCode": "snow", "serviceProviderType": "snow" }, "advancedInfo": { "version": version, "url": url }, "credentials": [{ "credentialName": "kjkkkjk", "purpose": ["costIngestion"], "passwordFields": { "userName": userName, "url": url, "password": password }, "context": [{ "team": ["CORE-X"] }], "status": "Active" }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationsnowNewV" } } #print body resp, body = self.api_client.create_account(body) print(resp) #print body logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def postAccountVRA(self): try: passed = False randID = 'TestVRAAcNew' randID += str(x) print(randID) endPointVersion = utils.decodeCredential(vra_endPointVersion) url = utils.decodeCredential(vra_url) tenant = utils.decodeCredential(vra_tenant) body = { "account": { "basicInfo": { "accountName": "vra" + randID, "accountType": "master", "isActive": "Active", "userType": "billing", "serviceProviderCode": "vra", "serviceProviderType": "vra", "credential_count": 1 }, "advancedInfo": { "accountNumber": "vraAccount77", "endPointVersion": endPointVersion, "url": url, "tenant": tenant }, "credentials": [{ "credentialName": "wwwwwwww", "purpose": ["costIngestion"], "crefId": vracredRef_billing, "context": [{ "team": ["CORE-X"] }], "status": "Active" }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationvraNew1" } } #print body resp, body = self.api_client.create_account(body) print(resp) #print body logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else: status['CAM-APITest'] = False return False except: status['CAM-APITest'] = False return False
def putAccountAWS(self): try: passed = False randID = 'MyAmazon' randID += str(x) print(randID) accessKey = utils.decodeCredential(amazon_accessKey) secretKey = utils.decodeCredential(amazon_secretKey) id1 = "f16b0f4a-a76e-499e-b5f7-testautomationaws" resp, body = self.api_client.get_AccountById(id1) data = json.dumps(body) data = json.loads(data) body = { "account": { "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationaws", "basicInfo": { "accountName": "amazon" + randID, "serviceProviderId": None, "serviceProviderType": "amazon", "serviceProviderCode": "amazon", "accountType": "subaccount", "isActive": "Active", "userType": "asset" }, "advancedInfo": { "accountNumber": "amazon11158" }, "credentials": [{ "credentialName": "amazon11158", "status": "Active", "passwordFields": { "secretKey": secretKey + randID, "accessKey": accessKey + randID }, "purpose": ["provisioning"], "context": [{ "team": ["CORE-X"] }] }] } } resp, body = self.api_client.update_account(body, id1) print(resp) logger.info("API response:" + str(resp)) passOfResponseCode = (assertEqual(resp, 200) & assertEqual( body['translateCode'], 'CO200_SUCCESSFULLY_UPDATE_ACC_AND_SUBACC')) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def putAccountICDAsset(self): try: passed = False randID = 'MyICDAssetAc' randID += str(x) print(randID) url = utils.decodeCredential(icd_url) username = utils.decodeCredential(icd_username) password = utils.decodeCredential(icd_password) id1 = "f16b0f4a-a76e-499e-b5f7-testautomationicdasset" resp, body = self.api_client.get_AccountById(id1) data = json.dumps(body) data = json.loads(data) body = { "account": { "basicInfo": { "accountName": data["basicInfo"]["accountName"], "serviceProviderType": "icd", "isActive": "Active", "accountType": "subaccount", "userType": "asset", "serviceProviderCode": "icd", "credential_count": 1 }, "advancedInfo": { "url": url }, "credentials": [{ "credentialName": "lkajdslkj", "purpose": ["provisioning"], "status": "Active", "context": [{ "team": ["CORE-X"] }], "passwordFields": { "username": username, "password": password } }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationicdasset" } } resp, body = self.api_client.update_account(body, id1) print(resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def postAccountICDSystem(self): try: passed = False randID = 'TestICDSystemAc' randID += str(x) print(randID) # print metadata[0] url = utils.decodeCredential(icd_url) username = utils.decodeCredential(icd_username) password = utils.decodeCredential(icd_password) body = { "account": { "basicInfo": { "accountName": randID, "serviceProviderType": "icd", "isActive": "Active", "accountType": "master", "userType": "system", "serviceProviderCode": "icd", "credential_count": 1 }, "advancedInfo": { "url": url }, "credentials": [{ "credentialName": "fasdf", "purpose": ["systemIntegration"], "status": "Active", "context": [{ "team": ["CORE-X"] }], "passwordFields": { "username": username, "password": password } }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationicdsystem" } } #print body resp, body = self.api_client.create_account(body) print(resp) #print body logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def putAccountAzureAsset(self): passed = False randID = 'TestAzureNew' randID += str(x) print(randID) subscriptionID = utils.decodeCredential(azure_subscriptionID) offerID = utils.decodeCredential(azure_offerID) tenantID = utils.decodeCredential(azure_tenantID) id1 = "f16b0f4a-a76e-499e-b5f7-testautomationazureasset" resp, body = self.api_client.get_AccountById(id1) data = json.dumps(body) data = json.loads(data) body = { "account": { "basicInfo": { "accountName": data["basicInfo"]["accountName"], "serviceProviderType": "azure", "isActive": "Active", "accountType": "subaccount", "userType": "asset", "serviceProviderCode": "azure", "credential_count": 1 }, "advancedInfo": { "subscriptionID": subscriptionID, "offerID": offerID, "tenantID": tenantID }, "credentials": [{ "credentialName": "asdfadsf", "purpose": ["provisioning"], "status": "Active", "context": [{ "team": ["CORE-X"] }], "crefId": azurecredRef_asset, }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationazureasset" } } resp, body = self.api_client.update_account(body, id1) print(resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else: status['CAM-APITest'] = False return False
def postAccountAWS(self): try: passed = False randID = 'TestAWSAc' randID += str(x) print(randID) accessKey = utils.decodeCredential(amazon_accessKey) secretKey = utils.decodeCredential(amazon_secretKey) body = { "account": { "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationaws", "basicInfo": { "accountName": "amazon" + randID, "serviceProviderType": "amazon", "serviceProviderCode": "amazon", "accountType": "subaccount", "isActive": "Active", "userType": "asset" }, "advancedInfo": { "accountNumber": "amazon11158" }, "credentials": [{ "credentialName": "amazon11158", "passwordFields": { "secretKey": secretKey, "accessKey": accessKey }, "purpose": ["provisioning"], "context": [{ "team": ["CORE-X"] }], "status": "Active" }] } } resp, body = self.api_client.create_account(body) print(resp) #print body logger.info("API response:" + str(resp)) passOfResponseCode = (assertEqual(resp, 200) & assertEqual( body['message'], 'Accounts creation successful')) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else: status['CAM-APITest'] = False return False except: status['CAM-APITest'] = False return False
def postAccountSnowAsset(self): passed = False randID = 'TestSnowAssetAc' randID += str(x) print(randID) # print metadata[0] version = utils.decodeCredential(snow_username) url = utils.decodeCredential(snow_password) userName = utils.decodeCredential(snow_version) password = utils.decodeCredential(snow_url) body = { "account": { "basicInfo": { "accountName": randID, "serviceProviderType": "snow", "isActive": "Active", "accountType": "subaccount", "userType": "asset", "serviceProviderCode": "snow", "credential_count": 1 }, "advancedInfo": { "version": version, "url": url }, "credentials": [{ "credentialName": "lkjalksdfjlkj", "purpose": ["provisioning"], "status": "Active", "context": [{ "team": ["CORE-X"] }], "passwordFields": { "userName": userName, "password": password } }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationsnowasset" } } #print body resp, body = self.api_client.create_account(body) print(resp) #print body logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed
def CORE2250_postAccountGoogleMinimalInfo(self): try: passed = False randID = 'TestGoogleAcMinimal' randID += str(x) print (randID) projectName=utils.decodeCredential(google_projectName) serviceAccountName=utils.decodeCredential(google_serviceAccountName) projectId=utils.decodeCredential(google_projectId) bucket=utils.decodeCredential(google_bucket) body = { "account": { "basicInfo": { "accountName": randID, "accountType": "master", "isActive": "Active", "userType": "billing", "serviceProviderCode": "google", "serviceProviderType": "google", "credential_count": 1 }, "advancedInfo": { "projectName": projectName, "serviceAccountName": serviceAccountName, "projectId": projectId, "bucket": bucket }, "credentials": [ ], "accountId": "f16b0f4a-a76e-499e-google-testautomationgoogle1" } }; #print body resp, body = self.api_client.create_account(body) print (resp) #print body logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else : status['CAM-APITest'] = False return False except: status['CAM-APITest'] = False return False
def postAccountAWSAsset(self): passed = False randID = 'TestAWSAssetAc' randID += str(x) print(randID) s3Bucket = utils.decodeCredential(aws_s3Bucket) accessKey = utils.decodeCredential(amazon_accessKey) secretKey = utils.decodeCredential(amazon_secretKey) body = { "account": { "basicInfo": { "accountName": randID, "serviceProviderType": "amazon", "isActive": "Active", "accountType": "subaccount", "userType": "asset", "serviceProviderCode": "amazon", "credential_count": 1 }, "advancedInfo": { "accountNumber": "lkjaslkdj" }, "credentials": [{ "credentialName": "lkjadslkj", "purpose": ["provisioning"], "status": "Active", "context": [{ "team": ["CORE-X"] }], "passwordFields": { "accessKey": accessKey, "secretKey": secretKey } }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationawsasset" } } #print body resp, body = self.api_client.create_account(body) print(resp) #print body logger.info("API response:" + str(resp)) passOfResponseCode = (assertEqual(resp, 200) & assertEqual( body['translateCode'], 'CO200_ACC_CREATED_SUCCESSFULLY')) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed
def putAccountSnowAsset(self): passed = False randID = 'MyAmazon' randID += str(x) print(randID) version = utils.decodeCredential(snow_version) url = utils.decodeCredential(snow_url) id1 = "f16b0f4a-a76e-499e-b5f7-testautomationsnowasset" resp, body = self.api_client.get_AccountById(id1) data = json.dumps(body) data = json.loads(data) body = { "account": { "basicInfo": { "accountName": data["basicInfo"]["accountName"], "serviceProviderType": "snow", "isActive": "Active", "accountType": "subaccount", "userType": "asset", "serviceProviderCode": "snow" }, "advancedInfo": { "version": version, "url": url }, "credentials": [{ "credentialName": "lkjalksdfjlkj", "purpose": ["provisioning"], "status": "Active", "context": [{ "team": ["CORE-X"] }], "crefId": snowcredRef_asset }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationsnowasset" } } resp, body = self.api_client.update_account(body, id1) print(resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else: status['CAM-APITest'] = False return False
def postAccountSnowSystem(self): passed = False randID = 'TestSnowSystemAc' randID += str(x) print(randID) version = utils.decodeCredential(snow_version) url = utils.decodeCredential(snow_url) body = { "account": { "basicInfo": { "accountName": randID, "accountType": "master", "isActive": "Active", "userType": "system", "serviceProviderCode": "snow", "serviceProviderType": "snow", "credential_count": 1 }, "advancedInfo": { "version": version, "url": url }, "credentials": [{ "credentialName": "kjkkkjk", "purpose": ["systemIntegration"], "crefId": snowcredRef_billing, "context": [{ "team": ["CORE-X"] }], "status": "Active" }], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationsnowsystemNewV" } } #print body resp, body = self.api_client.create_account(body) print(resp) #print body logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else: status['CAM-APITest'] = False return False
def postSystemAccount_TestDataCreation(self): try: passed = False url = utils.decodeCredential(icd_url) username = utils.decodeCredential(icd_username) password = utils.decodeCredential(icd_password) body = { "account": { "basicInfo": { "accountName": "testDataAccountforICDNewAccount", "serviceProviderType": "icd", "isActive": "Active", "accountType": "master", "userType": "system", "serviceProviderCode": "icd", "credential_count": 1 }, "advancedInfo": { "url": url }, "credentials": [{ "credentialName": "Credential1", "purpose": ["systemIntegration"], "status": "Active", "context": [{ "team": ["CORE-X"] }], "passwordFields": { "username": username, "password": password } }] } } #print body resp, body = self.api_client.create_account(body) print(resp) passOfResponseCode = resp if ((passOfResponseCode == 500) | (passOfResponseCode == 200) | (passOfResponseCode == 409)): passed = True status['CAM-APITest'] = passed return passed else: status['CAM-APITest'] = False return passed except: status['CAM-APITest'] = False return False
def CORE2250_postAccountVRAMinimalInfo(self): try: passed = False randID = 'TestVRAAcMinimal' randID += str(x) print(randID) endPointVersion = utils.decodeCredential(vra_endPointVersion) url = utils.decodeCredential(vra_url) tenant = utils.decodeCredential(vra_tenant) body = { "account": { "basicInfo": { "accountName": randID, "accountType": "master", "isActive": "Active", "userType": "billing", "serviceProviderCode": "vra", "serviceProviderType": "vra", "credential_count": 1 }, "advancedInfo": { "accountNumber": "vraAccount77", "endPointVersion": endPointVersion, "url": url, "tenant": tenant }, "credentials": [], "accountId": "f16b0f4a-a76e-499e-VRA-testautomationVRA" } } #print body resp, body = self.api_client.create_account(body) print(resp) #print body logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else: status['CAM-APITest'] = False return False except: status['CAM-APITest'] = False return False
def test_connection_amazon_billing_InvalidcrefId(self): try: passed = False s3Bucket=utils.decodeCredential(aws_s3Bucket) body = { "basicInfo": { "serviceProviderType": "amazon", "serviceProviderCode": "amazon", "userType": "billing" }, "advancedInfo": { "s3Bucket" : s3Bucket }, "credentials": { "crefId": "Test76327397" } }; resp, body = self.api_client.testConnection(body) print (resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 400) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def test_connection_google_asset_invalidCredentials(self): try: passed = False serviceKey=utils.decodeCredential(google_servicekey) body = { "basicInfo": { "serviceProviderType": "google", "serviceProviderCode": "google", "userType": "asset" }, "advancedInfo": { "accountNumber": "2222222222" }, "credentials": { "passwordFields": { "serviceKey": serviceKey+serviceKey } } }; resp, body = self.api_client.testConnection(body) print (resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 400) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed except: status['CAM-APITest'] = False return False
def postAccountICD(self): try: passed = False randID = 'TestICDAc' randID += str(x) print (randID) url=utils.decodeCredential(icd_url) body = { "account":{ "basicInfo":{ "accountName":randID, "serviceProviderType":"icd", "isActive":"Active", "accountType":"master", "userType":"billing", "serviceProviderCode":"icd", "credential_count":1 }, "advancedInfo":{ "url":url }, "credentials":[ { "credentialName":"jaslkdjflkj", "purpose":[ "costIngestion" ], "context": [ { "team": [ "CORE-X" ] } ], "status": "Active", "crefId": icdcredRef } ], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationicd" } }; #print body resp, body = self.api_client.create_account(body) print (resp) #print body logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else : status['CAM-APITest'] = False return False except: status['CAM-APITest'] = False return False
def putAccountICDSystem(self): try: passed = False randID = 'MyICDSystem' randID += str(x) print (randID) url=utils.decodeCredential(icd_url) id1 = "f16b0f4a-a76e-499e-b5f7-testautomationicdsystem" resp, body = self.api_client.get_AccountById(id1) data = json.dumps(body) data = json.loads(data) body = { "account":{ "basicInfo":{ "accountName":data["basicInfo"]["accountName"], "serviceProviderType":"icd", "isActive":"Active", "accountType":"master", "userType":"system", "serviceProviderCode":"icd", "credential_count":1 }, "advancedInfo":{ "url":url }, "credentials":[ { "credentialName":"fasdf", "purpose":[ "systemIntegration" ], "status":"Active", "context": [ { "team": [ "CORE-X" ] } ], "crefId": icdcredRef } ], "accountId": "f16b0f4a-a76e-499e-b5f7-testautomationicdsystem" } }; resp, body = self.api_client.update_account(body, id1) print (resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) if (passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else : status['CAM-APITest'] = False return False except: status['CAM-APITest'] = False return False
def createBillingAccount(self): try: passed = False randID = 'TestBillingAccount' randID += str(x) print(randID) s3Bucket = utils.decodeCredential(aws_s3Bucket) accessKey = utils.decodeCredential(amazon_accessKey) secretKey = utils.decodeCredential(amazon_secretKey) body = { "account": { "basicInfo": { "accountName": "amazon" + randID, "serviceProviderType": "amazon", "isActive": "Active", "accountType": "master", "userType": "billing", "serviceProviderCode": "amazon" }, "advancedInfo": { "accountNumber": "3245235249", "s3Bucket": s3Bucket }, "credentials": [], "accountId": "f16b0f4a-Billing-AutomationAccount" } } resp, body = self.api_client.create_account(body) print(resp) logger.info("API response:" + str(resp)) passOfResponseCode = assertEqual(resp, 200) & assertEqual( body['translateCode'], 'CO200_ACC_CREATED_SUCCESSFULLY') resp1 = resp if (resp1 == 200 or resp1 == 201 or resp1 == 409 or passOfResponseCode): passed = True status['CAM-APITest'] = passed return passed else: status['CAM-APITest'] = False return False except: status['CAM-APITest'] = False return False