Add nested snat test

This test checks connectivity when ovn_router_indirect_snat is enabled.

This functionality was added for ML2/OVN in https://review.opendev.org/c/openstack/neutron/+/926495

Depends-On: https://review.opendev.org/c/openstack/neutron-tempest-plugin/+/940906

Resolves-Bug: OSPRH-13329

Change-Id: I2b31d1c123286bcbd69f932bda069aa3af9beb18
This commit is contained in:
Renjing Xiao 2025-02-06 18:28:35 +00:00
parent 37a4f7b828
commit e401b6162b

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)