Merge "Add nested snat test"

This commit is contained in:
Zuul 2025-03-13 01:30:51 +00:00 committed by Gerrit Code Review
commit 2b7e019fa5

View File

@ -0,0 +1,47 @@
# Copyright 2025 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from neutron_tempest_plugin.scenario import test_floatingip
from tempest import config
from tempest.lib import decorators
from whitebox_neutron_tempest_plugin.tests.scenario import base
CONF = config.CONF
WB_CONF = config.CONF.whitebox_neutron_plugin_options
class DefaultSnatToExternalTest(
base.BaseTempestWhiteboxTestCase, test_floatingip.DefaultSnatToExternal
):
@classmethod
def resource_setup(cls):
super(DefaultSnatToExternalTest, cls).resource_setup()
if cls.check_service_setting(
{"client": cls.master_node_client},
config_files=(
cls.neutron_conf,
"/etc/neutron/neutron.conf.d/02-neutron-custom.conf",
),
section="ovn",
param="ovn_router_indirect_snat",
msg="Backend doesn't enable nested SNAT.",
):
cls.feature_enabled_bool = True
else:
cls.feature_enabled_bool = False
@decorators.idempotent_id('97473428-e17c-4fe2-a389-b931dbfab6b2')
def test_nested_snat_external_ip(self):
self._test_nested_snat_external_ip(self.feature_enabled_bool)