Fix gate: Add feature flag for nova policies removed in Wallaby

This patch set adds a new feature flag called
``removed_nova_policies_wallaby`` under the configuration
group ``[policy-feature-enabled]`` for skipping Nova
tests whose policies were removed in Wallaby. This feature flag
is currently applied to os-agents which is removed in nova
recently - https://review.opendev.org/#/c/749309

Change-Id: Iaa0ddbdca454b93bd8373ce749603f28c5c59180
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index 32c6562..10c44c0 100644
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -48,6 +48,10 @@
        # These policies were removed in Ussuri but are available in Pike.
        iniset $TEMPEST_CONFIG policy-feature-enabled changed_nova_policies_ussuri False
        iniset $TEMPEST_CONFIG policy-feature-enabled changed_nova_policies_victoria False
+
+       # TODO(gmann): Remove these once stable/victoria becomes EOL.
+       # These policies were removed in Wallaby.
+       iniset $TEMPEST_CONFIG policy-feature-enabled removed_nova_policies_wallaby False
     fi
 
     if [[ ${DEVSTACK_SERIES} == 'queens' ]]; then
@@ -76,6 +80,10 @@
        # These policies were removed in Ussuri but are available in Queens.
        iniset $TEMPEST_CONFIG policy-feature-enabled changed_nova_policies_ussuri False
        iniset $TEMPEST_CONFIG policy-feature-enabled changed_nova_policies_victoria False
+
+       # TODO(gmann): Remove these once stable/victoria becomes EOL.
+       # These policies were removed in Wallaby.
+       iniset $TEMPEST_CONFIG policy-feature-enabled removed_nova_policies_wallaby False
     fi
 
     if [[ ${DEVSTACK_SERIES} == 'rocky' ]]; then
@@ -94,6 +102,10 @@
        # These policies were removed in Ussuri but are available in Rocky.
        iniset $TEMPEST_CONFIG policy-feature-enabled changed_nova_policies_ussuri False
        iniset $TEMPEST_CONFIG policy-feature-enabled changed_nova_policies_victoria False
+
+       # TODO(gmann): Remove these once stable/victoria becomes EOL.
+       # These policies were removed in Wallaby.
+       iniset $TEMPEST_CONFIG policy-feature-enabled removed_nova_policies_wallaby False
     fi
 
     if [[ ${DEVSTACK_SERIES} == 'stein' ]]; then
@@ -107,17 +119,33 @@
        # These policies were removed in Ussuri but are available in Stein.
        iniset $TEMPEST_CONFIG policy-feature-enabled changed_nova_policies_ussuri False
        iniset $TEMPEST_CONFIG policy-feature-enabled changed_nova_policies_victoria False
+
+       # TODO(gmann): Remove these once stable/victoria becomes EOL.
+       # These policies were removed in Wallaby.
+       iniset $TEMPEST_CONFIG policy-feature-enabled removed_nova_policies_wallaby False
     fi
 
     if [[ ${DEVSTACK_SERIES} == 'train' ]]; then
        # Remove this once stable/train becomes EOL.
        iniset $TEMPEST_CONFIG policy-feature-enabled changed_nova_policies_ussuri False
        iniset $TEMPEST_CONFIG policy-feature-enabled changed_nova_policies_victoria False
+       # TODO(gmann): Remove these once stable/victoria becomes EOL.
+       # These policies were removed in Wallaby.
+       iniset $TEMPEST_CONFIG policy-feature-enabled removed_nova_policies_wallaby False
     fi
 
     if [[ ${DEVSTACK_SERIES} == 'ussuri' ]]; then
        # Remove this once stable/ussuri becomes EOL.
        iniset $TEMPEST_CONFIG policy-feature-enabled changed_nova_policies_victoria False
+       # TODO(gmann): Remove these once stable/victoria becomes EOL.
+       # These policies were removed in Wallaby.
+       iniset $TEMPEST_CONFIG policy-feature-enabled removed_nova_policies_wallaby False
+    fi
+
+    if [[ ${DEVSTACK_SERIES} == 'victoria' ]]; then
+       # TODO(gmann): Remove these once stable/victoria becomes EOL.
+       # These policies were removed in Wallaby.
+       iniset $TEMPEST_CONFIG policy-feature-enabled removed_nova_policies_wallaby False
     fi
 
     iniset $TEMPEST_CONFIG patrole rbac_test_roles $RBAC_TEST_ROLES
diff --git a/patrole_tempest_plugin/config.py b/patrole_tempest_plugin/config.py
index 41d824d..b01cf10 100644
--- a/patrole_tempest_plugin/config.py
+++ b/patrole_tempest_plugin/config.py
@@ -175,6 +175,11 @@
                 help="""Are the Nova API extension policies available in the
 cloud (e.g. os_compute_api:os-extended-availability-zone)? These policies were
 removed in Stein because Nova API extension concept was removed in Pike."""),
+    # TODO(gmann): Remove these feature flags once Victoria is EOL.
+    cfg.BoolOpt('removed_nova_policies_wallaby',
+                default=True,
+                help="""Are the Nova API policies being removed in wallaby
+cycle (e.g. os_compute_api:os-agents)?"""),
     cfg.BoolOpt('removed_keystone_policies_stein',
                 default=True,
                 help="""Are the obsolete Keystone policies available in the
diff --git a/patrole_tempest_plugin/tests/api/compute/test_agents_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_agents_rbac.py
index ba4c71a..de9a173 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_agents_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_agents_rbac.py
@@ -44,6 +44,10 @@
         if not utils.is_extension_enabled('os-agents', 'compute'):
             raise cls.skipException(
                 '%s skipped as os-agents not enabled' % cls.__name__)
+        if CONF.policy_feature_enabled.removed_nova_policies_wallaby:
+            raise cls.skipException(
+                '%s skipped as os-agents APIs/policies are not avaialble '
+                'any more.' % cls.__name__)
 
     def _param_helper(self, **kwargs):
         rand_key = 'architecture'
diff --git a/releasenotes/notes/removed-nova-policies-wallaby-feature-flag-abf3045a0a3e3315.yaml b/releasenotes/notes/removed-nova-policies-wallaby-feature-flag-abf3045a0a3e3315.yaml
new file mode 100644
index 0000000..a72b473
--- /dev/null
+++ b/releasenotes/notes/removed-nova-policies-wallaby-feature-flag-abf3045a0a3e3315.yaml
@@ -0,0 +1,7 @@
+---
+features:
+  - |
+    Added new feature flag called ``removed_nova_policies_wallaby`` under
+    the configuration group ``[policy-feature-enabled]`` for skipping Nova
+    tests whose policies were removed in Wallaby. This feature flag is currently
+    applied to os-agents related policies.