[Fullstack] Add debug_iptables=True in security groups tests

In security groups tests with "iptables" or "iptables_hybrid"
driver it will be useful to have debug_iptables_rules enabled
to check what rules are applied by L2 agent in case of test
failures.

Change-Id: Ib7d12b2e589019bc6043affe371ef5aa5425945b
Related-Bug: #1779328
This commit is contained in:
Slawek Kaplonski 2018-08-14 14:21:57 +02:00
parent e05cc40617
commit 0bd1cec676
3 changed files with 10 additions and 2 deletions

View File

@ -172,6 +172,7 @@ class OVSConfigFixture(ConfigFixture):
'agent': {
'l2_population': str(self.env_desc.l2_pop),
'arp_responder': str(self.env_desc.arp_responder),
'debug_iptables_rules': str(env_desc.debug_iptables)
}
})
@ -239,6 +240,9 @@ class LinuxBridgeConfigFixture(ConfigFixture):
},
'securitygroup': {
'firewall_driver': host_desc.firewall_driver,
},
'AGENT': {
'debug_iptables_rules': str(env_desc.debug_iptables)
}
})
if env_desc.qos:

View File

@ -38,7 +38,8 @@ class EnvironmentDescription(object):
mech_drivers='openvswitch,linuxbridge',
service_plugins='router', arp_responder=False,
agent_down_time=75, router_scheduler=None,
global_mtu=common_const.DEFAULT_NETWORK_MTU):
global_mtu=common_const.DEFAULT_NETWORK_MTU,
debug_iptables=False):
self.network_type = network_type
self.l2_pop = l2_pop
self.qos = qos
@ -49,6 +50,7 @@ class EnvironmentDescription(object):
self.router_scheduler = router_scheduler
self.global_mtu = global_mtu
self.service_plugins = service_plugins
self.debug_iptables = debug_iptables
if self.qos:
self.service_plugins += ',qos'

View File

@ -42,6 +42,7 @@ class BaseSecurityGroupsSameNetworkTest(base.BaseFullStackTestCase):
of_interface = None
def setUp(self):
debug_iptables = self.firewall_driver.startswith("iptables")
host_descriptions = [
environment.HostDescription(
of_interface=self.of_interface,
@ -50,7 +51,8 @@ class BaseSecurityGroupsSameNetworkTest(base.BaseFullStackTestCase):
dhcp_agent=True) for _ in range(self.num_hosts)]
env = environment.Environment(
environment.EnvironmentDescription(
network_type=self.network_type),
network_type=self.network_type,
debug_iptables=debug_iptables),
host_descriptions)
super(BaseSecurityGroupsSameNetworkTest, self).setUp(env)