Merge "tests: Centralise check for networking service"

This commit is contained in:
Zuul 2023-11-10 13:55:41 +00:00 committed by Gerrit Code Review
commit 7dbe6e6d3d
29 changed files with 43 additions and 171 deletions

View File

@ -20,9 +20,15 @@ class NetworkTests(base.TestCase):
@classmethod
def setUpClass(cls):
super(NetworkTests, cls).setUpClass()
super().setUpClass()
cls.haz_network = cls.is_service_enabled('network')
def setUp(self):
super().setUp()
if not self.haz_network:
self.skipTest("No Network service present")
class NetworkTagTests(NetworkTests):
"""Functional tests with tag operation"""

View File

@ -19,10 +19,8 @@ class AddressGroupTests(common.NetworkTests):
"""Functional tests for address group"""
def setUp(self):
super(AddressGroupTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
if not self.is_extension_enabled('address-group'):
self.skipTest("No address-group extension present")

View File

@ -23,12 +23,6 @@ class AddressScopeTests(common.NetworkTests):
# has its own needs and there are collisions when running
# tests in parallel.
def setUp(self):
super(AddressScopeTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
def test_address_scope_delete(self):
"""Test create, delete multiple"""
name1 = uuid.uuid4().hex

View File

@ -19,10 +19,8 @@ class SecurityGroupRuleTests(common.NetworkTests):
"""Functional tests for security group rule"""
def setUp(self):
super(SecurityGroupRuleTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
if not self.is_extension_enabled("security-groups-default-rules"):
self.skipTest("No security-groups-default-rules extension present")

View File

@ -21,7 +21,7 @@ class FloatingIpTests(common.NetworkTests):
@classmethod
def setUpClass(cls):
common.NetworkTests.setUpClass()
super().setUpClass()
if cls.haz_network:
# Create common networks that all tests share
cls.EXTERNAL_NETWORK_NAME = uuid.uuid4().hex
@ -53,13 +53,10 @@ class FloatingIpTests(common.NetworkTests):
)
cls.assertOutput('', del_output)
finally:
super(FloatingIpTests, cls).tearDownClass()
super().tearDownClass()
def setUp(self):
super(FloatingIpTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
# Verify setup
self.assertIsNotNone(self.external_network_id)

View File

@ -20,7 +20,8 @@ class IPAvailabilityTests(common.NetworkTests):
@classmethod
def setUpClass(cls):
common.NetworkTests.setUpClass()
super().setUpClass()
if cls.haz_network:
cls.NAME = uuid.uuid4().hex
cls.NETWORK_NAME = uuid.uuid4().hex
@ -49,13 +50,7 @@ class IPAvailabilityTests(common.NetworkTests):
cls.assertOutput('', raw_subnet)
cls.assertOutput('', raw_network)
finally:
super(IPAvailabilityTests, cls).tearDownClass()
def setUp(self):
super(IPAvailabilityTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().tearDownClass()
def test_ip_availability_list(self):
"""Test ip availability list"""

View File

@ -18,12 +18,11 @@ from openstackclient.tests.functional.network.v2 import common
class L3ConntrackHelperTests(common.NetworkTests):
def setUp(self):
super(L3ConntrackHelperTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
if not self.is_extension_enabled('l3-conntrack-helper'):
self.skipTest("No l3-conntrack-helper extension present")
if not self.is_extension_enabled('expose-l3-conntrack-helper'):
self.skipTest("No expose-l3-conntrack-helper extension present")

View File

@ -21,10 +21,8 @@ class LocalIPTests(common.NetworkTests):
"""Functional tests for local IP"""
def setUp(self):
super(LocalIPTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
if not self.is_extension_enabled('local-ip'):
self.skipTest("No local-ip extension present")

View File

@ -20,12 +20,6 @@ class NetworkTests(common.NetworkTagTests):
base_command = 'network'
def setUp(self):
super(NetworkTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
def test_network_create_compute(self):
"""Test Nova-net create options, delete"""
if self.haz_network:

View File

@ -18,12 +18,6 @@ from openstackclient.tests.functional.network.v2 import common
class NetworkAgentTests(common.NetworkTests):
"""Functional tests for network agent"""
def setUp(self):
super(NetworkAgentTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
def test_network_agent_list_show_set(self):
"""Test network agent list, set, show commands
@ -88,12 +82,6 @@ class NetworkAgentTests(common.NetworkTests):
class NetworkAgentListTests(common.NetworkTests):
"""Functional test for network agent"""
def setUp(self):
super(NetworkAgentListTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
def test_network_dhcp_agent_list(self):
"""Test network agent list"""

View File

@ -18,12 +18,6 @@ from openstackclient.tests.functional.network.v2 import common
class NetworkFlavorTests(common.NetworkTests):
"""Functional tests for network flavor"""
def setUp(self):
super(NetworkFlavorTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
def test_network_flavor_add_remove_profile(self):
"""Test add and remove network flavor to/from profile"""
# Create Flavor

View File

@ -19,12 +19,6 @@ class NetworkFlavorProfileTests(common.NetworkTests):
DESCRIPTION = 'fakedescription'
METAINFO = 'Extrainfo'
def setUp(self):
super(NetworkFlavorProfileTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
def test_network_flavor_profile_create(self):
json_output = self.openstack(
'network flavor profile create '

View File

@ -26,12 +26,6 @@ class TestMeter(common.NetworkTests):
# has its own needs and there are collisions when running
# tests in parallel.
def setUp(self):
super(TestMeter, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
def test_meter_delete(self):
"""Test create, delete multiple"""
name1 = uuid.uuid4().hex

View File

@ -26,7 +26,7 @@ class TestMeterRule(common.NetworkTests):
@classmethod
def setUpClass(cls):
common.NetworkTests.setUpClass()
super().setUpClass()
if cls.haz_network:
cls.METER_NAME = uuid.uuid4().hex
@ -45,13 +45,7 @@ class TestMeterRule(common.NetworkTests):
)
cls.assertOutput('', raw_output)
finally:
common.NetworkTests.tearDownClass()
def setUp(self):
super(TestMeterRule, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().tearDownClass()
def test_meter_rule_delete(self):
"""test create, delete"""

View File

@ -16,9 +16,7 @@ from openstackclient.tests.functional.network.v2 import common
class L3NDPProxyTests(common.NetworkTests):
def setUp(self):
super().setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
if not self.is_extension_enabled('l3-ndp-proxy'):
self.skipTest("No l3-ndp-proxy extension present")

View File

@ -21,12 +21,6 @@ from openstackclient.tests.functional.network.v2 import common
class NetworkQosPolicyTests(common.NetworkTests):
"""Functional tests for QoS policy"""
def setUp(self):
super(NetworkQosPolicyTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
def test_qos_rule_create_delete(self):
# This is to check the output of qos policy delete
policy_name = uuid.uuid4().hex

View File

@ -22,10 +22,7 @@ class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
"""Functional tests for QoS minimum bandwidth rule"""
def setUp(self):
super(NetworkQosRuleTestsMinimumBandwidth, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
self.QOS_POLICY_NAME = 'qos_policy_%s' % uuid.uuid4().hex
@ -100,10 +97,7 @@ class NetworkQosRuleTestsMinimumPacketRate(common.NetworkTests):
"""Functional tests for QoS minimum packet rate rule"""
def setUp(self):
super(NetworkQosRuleTestsMinimumPacketRate, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
self.QOS_POLICY_NAME = 'qos_policy_%s' % uuid.uuid4().hex
@ -179,10 +173,7 @@ class NetworkQosRuleTestsDSCPMarking(common.NetworkTests):
"""Functional tests for QoS DSCP marking rule"""
def setUp(self):
super(NetworkQosRuleTestsDSCPMarking, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
self.QOS_POLICY_NAME = 'qos_policy_%s' % uuid.uuid4().hex
self.openstack('network qos policy create %s' % self.QOS_POLICY_NAME)
@ -254,10 +245,7 @@ class NetworkQosRuleTestsBandwidthLimit(common.NetworkTests):
"""Functional tests for QoS bandwidth limit rule"""
def setUp(self):
super(NetworkQosRuleTestsBandwidthLimit, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
self.QOS_POLICY_NAME = 'qos_policy_%s' % uuid.uuid4().hex
self.openstack('network qos policy create %s' % self.QOS_POLICY_NAME)

View File

@ -29,12 +29,6 @@ class NetworkQosRuleTypeTests(common.NetworkTests):
'minimum_packet_rate',
]
def setUp(self):
super(NetworkQosRuleTypeTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
def test_qos_rule_type_list(self):
cmd_output = self.openstack(
'network qos rule type list -f json',

View File

@ -24,10 +24,7 @@ class NetworkRBACTests(common.NetworkTests):
FIELDS = ['id']
def setUp(self):
super(NetworkRBACTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
self.NET_NAME = uuid.uuid4().hex
self.PROJECT_NAME = uuid.uuid4().hex

View File

@ -20,7 +20,7 @@ class NetworkSegmentTests(common.NetworkTests):
@classmethod
def setUpClass(cls):
common.NetworkTests.setUpClass()
super().setUpClass()
if cls.haz_network:
cls.NETWORK_NAME = uuid.uuid4().hex
cls.PHYSICAL_NETWORK_NAME = uuid.uuid4().hex
@ -42,13 +42,7 @@ class NetworkSegmentTests(common.NetworkTests):
)
cls.assertOutput('', raw_output)
finally:
super(NetworkSegmentTests, cls).tearDownClass()
def setUp(self):
super(NetworkSegmentTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().tearDownClass()
def test_network_segment_create_delete(self):
name = uuid.uuid4().hex

View File

@ -23,12 +23,11 @@ class NetworkSegmentRangeTests(common.NetworkTests):
"""Functional tests for network segment range"""
def setUp(self):
super(NetworkSegmentRangeTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
if not self.is_extension_enabled('network-segment-range'):
self.skipTest("No network-segment-range extension present")
self.PROJECT_NAME = uuid.uuid4().hex
def test_network_segment_range_create_delete(self):

View File

@ -20,10 +20,8 @@ class TestNetworkServiceProvider(common.NetworkTests):
"""Functional tests for network service provider"""
def setUp(self):
super(TestNetworkServiceProvider, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
# NOTE(slaweq):
# that tests should works only when "standard" Neutron L3 agent is
# used, as e.g. OVN L3 plugin don't supports that.

View File

@ -23,9 +23,6 @@ class NetworkTrunkTests(common.NetworkTests):
def setUp(self):
super().setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
network_name = uuid.uuid4().hex
subnet_name = uuid.uuid4().hex

View File

@ -25,7 +25,7 @@ class PortTests(common.NetworkTagTests):
@classmethod
def setUpClass(cls):
common.NetworkTests.setUpClass()
super().setUpClass()
if cls.haz_network:
cls.NAME = uuid.uuid4().hex
cls.NETWORK_NAME = uuid.uuid4().hex
@ -42,13 +42,7 @@ class PortTests(common.NetworkTagTests):
)
cls.assertOutput('', raw_output)
finally:
super(PortTests, cls).tearDownClass()
def setUp(self):
super(PortTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().tearDownClass()
def test_port_delete(self):
"""Test create, delete multiple"""

View File

@ -20,12 +20,6 @@ class RouterTests(common.NetworkTagTests):
base_command = 'router'
def setUp(self):
super(RouterTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
def test_router_create_and_delete(self):
"""Test create options, delete multiple"""
name1 = uuid.uuid4().hex

View File

@ -19,10 +19,7 @@ class SecurityGroupTests(common.NetworkTests):
"""Functional tests for security group"""
def setUp(self):
super(SecurityGroupTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
self.NAME = uuid.uuid4().hex
self.OTHER_NAME = uuid.uuid4().hex

View File

@ -19,10 +19,7 @@ class SecurityGroupRuleTests(common.NetworkTests):
"""Functional tests for security group rule"""
def setUp(self):
super(SecurityGroupRuleTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().setUp()
self.SECURITY_GROUP_NAME = uuid.uuid4().hex

View File

@ -23,7 +23,7 @@ class SubnetTests(common.NetworkTagTests):
@classmethod
def setUpClass(cls):
common.NetworkTests.setUpClass()
super().setUpClass()
if cls.haz_network:
cls.NETWORK_NAME = uuid.uuid4().hex
@ -44,13 +44,7 @@ class SubnetTests(common.NetworkTagTests):
)
cls.assertOutput('', raw_output)
finally:
super(SubnetTests, cls).tearDownClass()
def setUp(self):
super(SubnetTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
super().tearDownClass()
def test_subnet_create_and_delete(self):
"""Test create, delete multiple"""

View File

@ -21,12 +21,6 @@ class SubnetPoolTests(common.NetworkTagTests):
base_command = 'subnet pool'
def setUp(self):
super(SubnetPoolTests, self).setUp()
# Nothing in this class works with Nova Network
if not self.haz_network:
self.skipTest("No Network service present")
def test_subnet_pool_create_delete(self):
"""Test create, delete"""
name1 = uuid.uuid4().hex