Collect exception information in ARPSpoofTestCase only if initialized

Only if ARPSpoofTestCase is correctly initialized (there is no error
in setUp method), the exception handler "collect_flows_and_ports" can
be executed in case of error. This method needs to have some declared
members during the test case setup.

Trivial-Fix

Change-Id: Ic087adc3e38f33cf369f04ec7b78db0b72134673
This commit is contained in:
Rodolfo Alonso Hernandez 2020-01-24 14:06:50 +00:00
parent e15d1003f8
commit 710dad13a2
1 changed files with 1 additions and 1 deletions

View File

@ -78,7 +78,6 @@ class ARPSpoofTestCase(OVSAgentTestBase):
# NOTE(kevinbenton): it would be way cooler to use scapy for
# these but scapy requires the python process to be running as
# root to bind to the ports.
self.addOnException(self.collect_flows_and_ports)
super(ARPSpoofTestCase, self).setUp()
self.skip_without_arp_support()
self.src_addr = '192.168.0.1'
@ -93,6 +92,7 @@ class ARPSpoofTestCase(OVSAgentTestBase):
net_helpers.OVSPortFixture(self.br, self.dst_namespace)).port
# wait to add IPs until after anti-spoof rules to ensure ARP doesn't
# happen before
self.addOnException(self.collect_flows_and_ports)
def collect_flows_and_ports(self, exc_info):
nicevif = lambda x: ['%s=%s' % (k, getattr(x, k))