Adding port_admin_state_change option to config

Adding the ability to skip test_update_instance_port_admin_state
when this operation is not supported by the test environment.
Closes-Bug: 1436839

Change-Id: Icda251c46e2fefcc80b0c712d6f42d76a7d247b7
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 175f0d9..9007e51 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -796,6 +796,10 @@
 # attributes ipv6_ra_mode and ipv6_address_mode (boolean value)
 #ipv6_subnet_attributes = false
 
+# Does the test environment support changing port admin state (boolean
+# value)
+#port_admin_state_change = true
+
 
 [object-storage]
 
diff --git a/tempest/config.py b/tempest/config.py
index 3725f58..2ed1103 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -499,6 +499,10 @@
                      "the extended IPv6 attributes ipv6_ra_mode "
                      "and ipv6_address_mode"
                 ),
+    cfg.BoolOpt('port_admin_state_change',
+                default=True,
+                help="Does the test environment support changing"
+                     " port admin state"),
 ]
 
 messaging_group = cfg.OptGroup(name='messaging',
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 8353048..88c502f 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -586,6 +586,9 @@
     @testtools.skipIf(CONF.baremetal.driver_enabled,
                       'admin_state of instance ports cannot be altered '
                       'for baremetal nodes')
+    @testtools.skipUnless(CONF.network_feature_enabled.port_admin_state_change,
+                          "Changing a port's admin state is not supported "
+                          "by the test environment")
     @test.attr(type='smoke')
     @test.services('compute', 'network')
     def test_update_instance_port_admin_state(self):