Merge "Fix scenario test fails when port_vnic_type is set"
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 869de2d..bb0ccdd 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -1080,6 +1080,11 @@
                 port = self._create_port(network_id=net_id,
                                          client=net_client,
                                          **create_port_body)
+                # if port_vnic_type is set, ports in the passing
+                # create_kwargs will be override, which cause the
+                # inconsistence. Set the port_id according to network id
+                if net_id == self.network['id']:
+                    self.port_id = port.id
                 ports.append({'port': port.id})
             if ports:
                 create_kwargs['networks'] = ports
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index e676063..b31ba69 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -101,6 +101,7 @@
         self.servers = []
 
     def _setup_network_and_servers(self, **kwargs):
+        vnic_type = CONF.network.port_vnic_type
         boot_with_port = kwargs.pop('boot_with_port', False)
         self.security_group = \
             self._create_security_group(tenant_id=self.tenant_id)
@@ -108,7 +109,9 @@
         self.check_networks()
 
         self.port_id = None
-        if boot_with_port:
+        # when vnic_type is set, ports will be created in create_server.
+        # So no need to create a port here in this case.
+        if boot_with_port and not vnic_type:
             # create a port on the network and boot with that
             self.port_id = self._create_port(self.network['id']).id