def test_compute(self): # create VM vm_size = 'Standard_D1' publisher = 'Canonical' offer = 'UbuntuServer' sku = '16.04.0-LTS' version = 'latest' os_uri = 'http://' + self.saname + '.blob.core.windows.net/vhds/osdisk.vhd' username = '******' password = Haikunator.haikunate(delimiter=',') print('Creating VM: ' + self.vmname) response = azurerm.create_vm(self.access_token, self.subscription_id, self.rgname, \ self.vmname, vm_size, publisher, offer, sku, version, self.saname, os_uri, \ self.nic_id, self.location, username=username, public_key=self.public_key) # print(json.dumps(response.json())) self.assertEqual(response.status_code, 201) self.assertEqual(response.json()['name'], self.vmname) # create VMSS capacity = 3 print('Creating VMSS: ' + self.vmssname + ', capacity = ' + str(capacity)) response = azurerm.create_vmss(self.access_token, self.subscription_id, self.rgname, \ self.vmssname, vm_size, capacity, publisher, offer, sku, version, self.container_list, \ self.subnet_id, self.be_pool_id, self.lb_pool_id, self.location, username=username, \ public_key=self.public_key) # print(json.dumps(response.json())) self.assertEqual(response.status_code, 201) self.assertEqual(response.json()['name'], self.vmssname) # get compute usage print('Getting compute usage') response = azurerm.get_compute_usage(self.access_token, self.subscription_id, self.location) self.assertTrue(len(response['value']) > 0) # get vm instance view print('Getting VM instance view') response = azurerm.get_vm_instance_view(self.access_token, self.subscription_id, \ self.rgname, self.vmname) # print(json.dumps(response, sort_keys=False, indent=2, separators=(',', ': '))) self.assertEqual(response['statuses'][0]['displayStatus'], 'Creating') # list vm instance views print('Listing VM instance views') response = azurerm.list_vm_instance_view(self.access_token, self.subscription_id, \ self.rgname) # print(json.dumps(response, sort_keys=False, indent=2, separators=(',', ': '))) self.assertTrue(len(response['value']) > 0) # delete VM print('Deleting VM: ' + self.vmname) response = azurerm.delete_vm(self.access_token, self.subscription_id, self.rgname, \ self.vmname) self.assertEqual(response.status_code, 202) # delete VMSS print('Deleting VMSS: ' + self.vmssname) response = azurerm.delete_vmss(self.access_token, self.subscription_id, self.rgname, \ self.vmssname) self.assertEqual(response.status_code, 202)
def test_compute(self): # create VM vm_size = 'Standard_D1' publisher = 'Canonical' offer = 'UbuntuServer' sku = '16.04.0-LTS' version = 'latest' os_uri = 'http://' + self.saname + '.blob.core.windows.net/vhds/osdisk.vhd' username = '******' password = Haikunator.haikunate(delimiter=',') print('Creating VM: ' + self.vmname) response = azurerm.create_vm(self.access_token, self.subscription_id, self.rgname, \ self.vmname, vm_size, publisher, offer, sku, version, self.saname, os_uri, \ username, password, self.nic_id, self.location) self.assertEqual(response.status_code, 201) self.assertEqual(response.json()['name'], self.vmname) # create VMSS capacity = 3 print('Creating VMSS: ' + self.vmssname + ', capacity = ' + str(capacity)) response = azurerm.create_vmss(self.access_token, self.subscription_id, self.rgname, \ self.vmssname, vm_size, capacity, publisher, offer, sku, version, self.container_list, \ username, password, self.subnet_id, self.be_pool_id, self.lb_pool_id, self.location) self.assertEqual(response.status_code, 201) self.assertEqual(response.json()['name'], self.vmssname) # get compute usage print('Getting compute usage') response = azurerm.get_compute_usage(self.access_token, self.subscription_id, self.location) self.assertTrue(len(response['value']) > 0) # delete VM print('Deleting VM: ' + self.vmname) response = azurerm.delete_vm(self.access_token, self.subscription_id, self.rgname, \ self.vmname) self.assertEqual(response.status_code, 202) # delete VMSS print('Deleting VMSS: ' + self.vmssname) response = azurerm.delete_vmss(self.access_token, self.subscription_id, self.rgname, \ self.vmssname) self.assertEqual(response.status_code, 202)
def test_compute(self): # create availability set print('Creating availability set: ' + self.asname + ', update domains = 5, fault domains = 3') response = azurerm.create_as(self.access_token, self.subscription_id, self.rgname, self.asname, 5, 3, self.location) self.assertEqual(response.status_code, 200) self.assertEqual(response.json()['name'], self.asname) # create VM vm_size = 'Standard_B1s' publisher = 'Canonical' offer = 'UbuntuServer' sku = '18.04-LTS' version = 'latest' username = '******' print('Creating VM: ' + self.vmname) response = azurerm.create_vm(self.access_token, self.subscription_id, self.rgname, \ self.vmname, vm_size, publisher, offer, sku, version, \ self.nic_id, self.location, username=username, public_key=self.public_key) # print(json.dumps(response.json())) self.assertEqual(response.status_code, 201) self.assertEqual(response.json()['name'], self.vmname) # create VMSS capacity = 3 print('Creating VMSS: ' + self.vmssname + ', capacity = ' + str(capacity)) response = azurerm.create_vmss(self.access_token, self.subscription_id, self.rgname, \ self.vmssname, vm_size, capacity, publisher, offer, sku, version, \ self.subnet_id, self.location, self.be_pool_id, self.lb_pool_id, username=username, \ public_key=self.public_key) # print(json.dumps(response.json())) self.assertEqual(response.status_code, 201) self.assertEqual(response.json()['name'], self.vmssname) # get compute usage print('Getting compute usage') response = azurerm.get_compute_usage(self.access_token, self.subscription_id, self.location) self.assertTrue(len(response['value']) > 0) # get vm instance view print('Getting VM instance view') response = azurerm.get_vm_instance_view(self.access_token, self.subscription_id, \ self.rgname, self.vmname) # print(json.dumps(response, sort_keys=False, indent=2, separators=(',', ': '))) self.assertEqual(response['statuses'][0]['displayStatus'], 'Creating') # get availability set details print('Getting availability set details') response = azurerm.get_as(self.access_token, self.subscription_id, self.rgname, self.asname) self.assertEqual(response['name'], self.asname) # list VMSS skus print('Listing VMSS skus') response = azurerm.list_vmss_skus(self.access_token, self.subscription_id, \ self.rgname, self.vmssname) # print(json.dumps(response, sort_keys=False, indent=2, separators=(',', ': '))) self.assertTrue(len(response['value']) > 0) # list VMSS nics print('Getting VMSS NICs') response = azurerm.get_vmss_nics(self.access_token, self.subscription_id, \ self.rgname, self.vmssname) # print(json.dumps(response, sort_keys=False, indent=2, separators=(',', ': '))) self.assertTrue(len(response['value']) > 0) # delete VM print('Deleting VM: ' + self.vmname) response = azurerm.delete_vm(self.access_token, self.subscription_id, self.rgname, \ self.vmname) self.assertEqual(response.status_code, 202) # delete VMSS print('Deleting VMSS: ' + self.vmssname) response = azurerm.delete_vmss(self.access_token, self.subscription_id, self.rgname, \ self.vmssname) self.assertEqual(response.status_code, 202) # delete Availability Set print('Deleting Availability Set: ' + self.asname) response = azurerm.delete_as(self.access_token, self.subscription_id, self.rgname, \ self.asname) self.assertEqual(response.status_code, 200)
def test_compute(self): # create availability set print('Creating availability set: ' + self.asname + ', update domains = 5, fault domains = 3') response = azurerm.create_as(self.access_token, self.subscription_id, self.rgname, self.asname, 5, 3, self.location) self.assertEqual(response.status_code, 200) self.assertEqual(response.json()['name'], self.asname) # create VM vm_size = 'Standard_D1' publisher = 'Canonical' offer = 'UbuntuServer' sku = '16.04-LTS' version = 'latest' username = '******' password = self.h.haikunate(',') print('Creating VM: ' + self.vmname) response = azurerm.create_vm(self.access_token, self.subscription_id, self.rgname, \ self.vmname, vm_size, publisher, offer, sku, version, \ self.nic_id, self.location, username=username, public_key=self.public_key) # print(json.dumps(response.json())) self.assertEqual(response.status_code, 201) self.assertEqual(response.json()['name'], self.vmname) # create VMSS capacity = 3 print('Creating VMSS: ' + self.vmssname + ', capacity = ' + str(capacity)) response = azurerm.create_vmss(self.access_token, self.subscription_id, self.rgname, \ self.vmssname, vm_size, capacity, publisher, offer, sku, version, \ self.subnet_id, self.be_pool_id, self.lb_pool_id, self.location, username=username, \ public_key=self.public_key) # print(json.dumps(response.json())) self.assertEqual(response.status_code, 201) self.assertEqual(response.json()['name'], self.vmssname) # get compute usage print('Getting compute usage') response = azurerm.get_compute_usage(self.access_token, self.subscription_id, self.location) self.assertTrue(len(response['value']) > 0) # get vm instance view print('Getting VM instance view') response = azurerm.get_vm_instance_view(self.access_token, self.subscription_id, \ self.rgname, self.vmname) # print(json.dumps(response, sort_keys=False, indent=2, separators=(',', ': '))) self.assertEqual(response['statuses'][0]['displayStatus'], 'Creating') # get availability set details print('Getting availability set details') response = azurerm.get_as(self.access_token, self.subscription_id, self.rgname, self.asname) self.assertEqual(response['name'], self.asname) # list vm instance views print('Listing VM instance views') response = azurerm.list_vm_instance_view(self.access_token, self.subscription_id, \ self.rgname) # print(json.dumps(response, sort_keys=False, indent=2, separators=(',', ': '))) self.assertTrue(len(response['value']) > 0) # list VMSS skus print('Listing VMSS skus') response = azurerm.list_vmss_skus(self.access_token, self.subscription_id, \ self.rgname, self.vmssname) # print(json.dumps(response, sort_keys=False, indent=2, separators=(',', ': '))) self.assertTrue(len(response['value']) > 0) # list VMSS nics print('Getting VMSS NICs') response = azurerm.get_vmss_nics(self.access_token, self.subscription_id, \ self.rgname, self.vmssname) #print(json.dumps(response, sort_keys=False, indent=2, separators=(',', ': '))) self.assertTrue(len(response['value']) > 0) # delete VM print('Deleting VM: ' + self.vmname) response = azurerm.delete_vm(self.access_token, self.subscription_id, self.rgname, \ self.vmname) self.assertEqual(response.status_code, 202) # delete VMSS print('Deleting VMSS: ' + self.vmssname) response = azurerm.delete_vmss(self.access_token, self.subscription_id, self.rgname, \ self.vmssname) self.assertEqual(response.status_code, 202) # delete Availability Set print('Deleting Availability Set: ' + self.asname) response = azurerm.delete_as(self.access_token, self.subscription_id, self.rgname, \ self.asname) self.assertEqual(response.status_code, 200)