Add test_create_and_update_port_with_dns_name

Test both create and update of port with a correct predefined
internal dns-name (hostname).

Change-Id: Ia05be62e552ca43173833d3436fc1d36c1c34bf4
diff --git a/neutron_tempest_plugin/scenario/test_internal_dns.py b/neutron_tempest_plugin/scenario/test_internal_dns.py
index e9f7823..692bb70 100644
--- a/neutron_tempest_plugin/scenario/test_internal_dns.py
+++ b/neutron_tempest_plugin/scenario/test_internal_dns.py
@@ -139,38 +139,46 @@
 
     @utils.requires_ext(extension="dns-integration", service="network")
     @decorators.idempotent_id('db5e612f-f17f-4974-b5f1-9fe89f4a6fc9')
-    def test_create_port_with_dns_name(self):
+    def test_create_and_update_port_with_dns_name(self):
         """Test creation of port with correct internal dns-name (hostname)."""
 
-        # 1) Create network and subnet.
-        # 2) Create a port with dns-name.
-        # 3) Verify that correct port initial dns-name (as VM name)
-        #    were queried from openstack API.
-        # 4) Boot a VM with predefined port.
-        # 5) Validate hostname configured in VM is same as VM's name.
+        # 1) Create resources: network, subnet, etc.
+        # 2) Create a port with wrong dns-name (not as VM name).
+        # 3) Verify that wrong port initial dns-name.
+        #    was queried from openstack API.
+        # 4) Update the port with correct dns-name (as VM name).
+        # 5) Boot a VM with corrected predefined port.
+        # 6) Verify that correct port dns-name
+        #    was queried from openstack API.
+        # 7) Validate hostname configured on VM is same as VM's name.
 
         # NOTE: VM's hostname has to be the same as VM's name
         #       when a VM is created, it is a known limitation.
         #       Therefore VM's dns-name/hostname is checked to be as VM's name.
 
-        vm_name = self._rand_name('vm')
+        vm_correct_name = self._rand_name('vm')
+        vm_wrong_name = self._rand_name('bazinga')
         # create resources
         network = self.create_network(name=self._rand_name('network'))
         subnet = self.create_subnet(network, name=self._rand_name('subnet'))
         self.create_router_interface(self.router['id'], subnet['id'])
-        # create port with dns-name (as VM name)
+        # create port with wrong dns-name (not as VM name)
         dns_port = self.create_port(network,
-                                    dns_name=vm_name,
+                                    dns_name=vm_wrong_name,
                                     security_groups=[self.secgroup['id']],
                                     name=self._rand_name('port'))
-        # validate dns port initial hostname from API
-        self._validate_port_dns_details(vm_name, dns_port)
-        # create VM with predefined dns-name on port
-        vm_1 = self.create_server(name=vm_name,
+        # validate dns port with wrong initial hostname from API
+        self._validate_port_dns_details(vm_wrong_name, dns_port)
+        # update port with correct dns-name (as VM name)
+        dns_port = self.update_port(dns_port, dns_name=vm_correct_name)
+        # create VM with correct predefined dns-name on port
+        vm_1 = self.create_server(name=vm_correct_name,
                                   networks=[{'port': dns_port['id']}],
                                   **self.vm_kwargs)
-        # validate hostname configured in VM is same as VM's name.
+        # validate dns port with correct changed hostname using API
+        self._validate_port_dns_details(vm_correct_name, dns_port)
+        # validate hostname configured on VM is same as VM's name.
         vm_1['fip'] = self.create_floatingip(port=dns_port)
         vm_1['ssh_client'] = self._create_ssh_client(
             vm_1['fip']['floating_ip_address'])
-        self._validate_ssh_dns_details(vm_name, vm_1['ssh_client'])
+        self._validate_ssh_dns_details(vm_correct_name, vm_1['ssh_client'])