X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=RO-VIM-azure%2Fosm_rovim_azure%2Fvimconn_azure.py;h=15c3cadc349687c159f6f3668486478a89c162ff;hb=309b5bff8b1d25262c405b93e6362be39cbe0918;hp=d93ff5cd1abd279786a76402f44f12a3f8c09ed2;hpb=eaccf71d78032c68f6fb4dadfc98308f007b63af;p=osm%2FRO.git diff --git a/RO-VIM-azure/osm_rovim_azure/vimconn_azure.py b/RO-VIM-azure/osm_rovim_azure/vimconn_azure.py index d93ff5cd..15c3cadc 100755 --- a/RO-VIM-azure/osm_rovim_azure/vimconn_azure.py +++ b/RO-VIM-azure/osm_rovim_azure/vimconn_azure.py @@ -56,7 +56,6 @@ def find_in_list(the_list, condition_lambda): class vimconnector(vimconn.VimConnector): - # Translate azure provisioning state to OSM provision state # The first three ones are the transitional status once a user initiated action has been requested # Once the operation is complete, it will transition into the states Succeeded or Failed @@ -970,7 +969,6 @@ class vimconnector(vimconn.VimConnector): self._format_vimconn_exception(e) def _build_os_profile(self, vm_name, cloud_config, image_id): - # initial os_profile os_profile = {"computer_name": vm_name} @@ -1142,7 +1140,7 @@ class vimconnector(vimconn.VimConnector): vm_sizes_list = [ vm_size.as_dict() for vm_size in self.conn_compute.resource_skus.list( - "location eq '{}'".format(self.region) + filter="location eq '{}'".format(self.region) ) ] @@ -1220,7 +1218,7 @@ class vimconnector(vimconn.VimConnector): vm_sizes_list = [ vm_size.as_dict() for vm_size in self.conn_compute.resource_skus.list( - "location eq '{}'".format(self.region) + filter="location eq '{}'".format(self.region) ) ] @@ -1315,7 +1313,6 @@ class vimconnector(vimconn.VimConnector): self._format_vimconn_exception(e) def delete_inuse_nic(self, nic_name): - # Obtain nic data nic_data = self.conn_vnet.network_interfaces.get(self.resource_group, nic_name) @@ -1338,7 +1335,6 @@ class vimconnector(vimconn.VimConnector): # TODO - check if there is a public ip to delete and delete it if network_interfaces: - # Deallocate the vm async_vm_deallocate = ( self.conn_compute.virtual_machines.begin_deallocate( @@ -1786,7 +1782,21 @@ class vimconnector(vimconn.VimConnector): vm = self.conn_compute.virtual_machines.get( self.resource_group, res_name ) - out_vm["vim_info"] = str(vm) + img = vm.storage_profile.image_reference + images = self._get_version_image_list( + img.publisher, img.offer, img.sku, img.version + ) + vim_info = { + "id": vm.id, + "name": vm.name, + "location": vm.location, + "provisioning_state": vm.provisioning_state, + "vm_id": vm.vm_id, + "type": vm.type, + "flavor": {"id": vm.hardware_profile.vm_size}, + "image": images[0], + } + out_vm["vim_info"] = str(vim_info) out_vm["status"] = self.provision_state2osm.get( vm.provisioning_state, "OTHER" ) @@ -1866,6 +1876,10 @@ class vimconnector(vimconn.VimConnector): self.logger.debug("Public ip address is: %s", public_ip.ip_address) ips.append(public_ip.ip_address) + subnet = nic_data.ip_configurations[0].subnet.id + if subnet: + interface_dict["vim_net_id"] = subnet + private_ip = nic_data.ip_configurations[0].private_ip_address ips.append(private_ip)