diff --git a/clib/clib_mininet_test_main.py b/clib/clib_mininet_test_main.py index dc1bc84afc..b66a6e37e3 100755 --- a/clib/clib_mininet_test_main.py +++ b/clib/clib_mininet_test_main.py @@ -201,13 +201,13 @@ def check_dependencies(): return True -def make_suite(tc_class, hw_config, root_tmpdir, ports_sock, max_test_load, port_base): +def make_suite(tc_class, hw_config, root_tmpdir, ports_sock, max_test_load): """Compose test suite based on test class names.""" testloader = unittest.TestLoader() testnames = testloader.getTestCaseNames(tc_class) suite = unittest.TestSuite() for name in testnames: - suite.addTest(tc_class(name, hw_config, root_tmpdir, ports_sock, max_test_load, port_base)) + suite.addTest(tc_class(name, hw_config, root_tmpdir, ports_sock, max_test_load)) return suite @@ -361,7 +361,7 @@ def max_loadavg(): def expand_tests(module, requested_test_classes, excluded_test_classes, - hw_config, root_tmpdir, ports_sock, port_base, serial): + hw_config, root_tmpdir, ports_sock, serial): sanity_test_suites = [] single_test_suites = [] parallel_test_suites = [] @@ -379,7 +379,7 @@ def expand_tests(module, requested_test_classes, excluded_test_classes, continue print('adding test %s' % test_name) test_suite = make_suite( - test_obj, hw_config, root_tmpdir, ports_sock, max_loadavg(), port_base) + test_obj, hw_config, root_tmpdir, ports_sock, max_loadavg()) if test_name.startswith('FaucetSanity'): sanity_test_suites.append(test_suite) else: @@ -585,8 +585,7 @@ def clean_test_dirs(root_tmpdir, all_successful, sanity, keep_logs, dumpfail): def run_tests(module, hw_config, requested_test_classes, dumpfail, - keep_logs, port_base, serial, excluded_test_classes, - report_json_filename): + keep_logs, serial, excluded_test_classes, report_json_filename): """Actually run the test suites, potentially in parallel.""" if hw_config is not None: print('Testing hardware, forcing test serialization') @@ -602,7 +601,7 @@ def run_tests(module, hw_config, requested_test_classes, dumpfail, print('test ports server started') sanity_tests, single_tests, parallel_tests = expand_tests( module, requested_test_classes, excluded_test_classes, - hw_config, root_tmpdir, ports_sock, port_base, serial) + hw_config, root_tmpdir, ports_sock, serial) resultclass = FaucetCleanupResult if keep_logs: resultclass = FaucetResult @@ -638,9 +637,6 @@ def parse_args(): '-k', '--keep_logs', action='store_true', help='keep logs even for OK tests') parser.add_argument( '-n', '--nocheck', action='store_true', help='skip dependency check') - parser.add_argument( - '-p', '--ports', type=str, default='random', - help='OvS ports or starting port [1,2,3,4 | 1 | random] (random)') parser.add_argument( '-i', '--integration', default=True, action='store_true', help='run integration tests') parser.add_argument( @@ -655,9 +651,7 @@ def parse_args(): try: args, requested_test_classes = parser.parse_known_args(sys.argv[1:]) - if args.ports != 'random': - args.ports = [int(x) for x in args.ports.split(',')] - except(KeyError, IndexError, ValueError): + except(KeyError, IndexError): parser.print_usage() sys.exit(-1) @@ -667,7 +661,7 @@ def parse_args(): excluded_test_classes = args.x.split(',') return ( requested_test_classes, args.clean, args.dumpfail, - args.keep_logs, args.nocheck, args.ports, args.serial, + args.keep_logs, args.nocheck, args.serial, excluded_test_classes, report_json_filename) @@ -675,8 +669,9 @@ def test_main(module): """Test main.""" setLogLevel('error') print('testing module %s' % module) - (requested_test_classes, clean, dumpfail, keep_logs, nocheck, port_base, + (requested_test_classes, clean, dumpfail, keep_logs, nocheck, serial, excluded_test_classes, report_json_filename) = parse_args() + if clean: print('Cleaning up test interfaces, processes and openvswitch ' 'configuration from previous test runs') @@ -690,11 +685,6 @@ def test_main(module): 'list in header of this script') sys.exit(-1) hw_config = import_hw_config() - if port_base == 'random': - # A random range to allocate OvS ports from - port_base = random.sample(range(1, 1024), 16) - print("random port base: -p", ",".join(str(x) for x in port_base)) run_tests( module, hw_config, requested_test_classes, dumpfail, - keep_logs, port_base, serial, excluded_test_classes, report_json_filename, - ) + keep_logs, serial, excluded_test_classes, report_json_filename) diff --git a/clib/clib_mininet_tests.py b/clib/clib_mininet_tests.py index 7819f9adba..653749cc86 100644 --- a/clib/clib_mininet_tests.py +++ b/clib/clib_mininet_tests.py @@ -49,7 +49,6 @@ def setUp(self): n_extended=self.N_EXTENDED, e_cls=self.EXTENDED_CLS, tmpdir=self.tmpdir, links_per_host=self.LINKS_PER_HOST, hw_dpid=self.hw_dpid) - self.port_map = self.create_port_map(self.dpid) self.start_net() def test_ping_all(self): diff --git a/clib/mininet_test_base.py b/clib/mininet_test_base.py index 9563d3a1b1..69679c8e4f 100644 --- a/clib/mininet_test_base.py +++ b/clib/mininet_test_base.py @@ -32,7 +32,6 @@ from clib import mininet_test_util from clib import mininet_test_topo -from clib.mininet_test_topo import FaucetSwitchTopo from clib.tcpdump_helper import TcpdumpHelper MAX_TEST_VID = 512 @@ -120,13 +119,14 @@ class FaucetTestBase(unittest.TestCase): event_sock = None faucet_config_path = None - def __init__(self, name, config, root_tmpdir, ports_sock, max_test_load, port_base=None): + def __init__(self, name, config, root_tmpdir, ports_sock, max_test_load): super(FaucetTestBase, self).__init__(name) self.config = config self.root_tmpdir = root_tmpdir self.ports_sock = ports_sock self.max_test_load = max_test_load - self.port_base = port_base + start_port = mininet_test_topo.SWITCH_START_PORT + self.port_map = {'port_%u' % (port + 1): port + start_port for port in range(4)} def rand_dpid(self): reserved_range = 100 @@ -331,8 +331,7 @@ def _stop_net(self): def setUp(self): self.tmpdir = self._tmpdir_name() self._set_static_vars() - self.topo_class = partial( - mininet_test_topo.FaucetSwitchTopo, port_base=self.port_base) + self.topo_class = mininet_test_topo.FaucetSwitchTopo if self.hw_switch: self.hw_dpid = mininet_test_util.str_int_dpid(self.dpid) self.dpid = self.hw_dpid @@ -423,8 +422,6 @@ def _attach_physical_switch(self): def start_net(self): """Start Mininet network.""" - if not self.port_map: - self.port_map = self.create_port_map(self.dpid) controller_intf = 'lo' controller_ipv6 = False if self.hw_switch: @@ -467,12 +464,6 @@ def _start_check(self): port, port_name) return self._start_gauge_check() - def create_port_map(self, dpid): - """Return a port map {'port_1': port...} for a dpid in self.topo""" - ports = self.topo.dpid_ports(dpid) - port_map = {'port_%d' % (i+1): port for i, port in enumerate(ports)} - return port_map - def _start_faucet(self, controller_intf, controller_ipv6): last_error_txt = '' assert self.net is None # _start_faucet() can't be multiply called diff --git a/clib/mininet_test_topo.py b/clib/mininet_test_topo.py index 7f4254521d..91af44f99c 100644 --- a/clib/mininet_test_topo.py +++ b/clib/mininet_test_topo.py @@ -1,6 +1,5 @@ """Topology components for FAUCET Mininet unit tests.""" -from collections import defaultdict import os import socket import string @@ -154,62 +153,28 @@ def _add_extended_host(self, sid_prefix, host_n, e_cls, tmpdir): def _add_faucet_switch(self, sid_prefix, dpid, ovs_type, switch_cls): """Add a FAUCET switch.""" switch_name = 's%s' % sid_prefix - self._dpid_names[dpid] = switch_name return self.addSwitch( name=switch_name, cls=switch_cls, datapath=ovs_type, dpid=mininet_test_util.mininet_dpid(dpid)) - @staticmethod - def port_nums(count, ports=None, start_port=SWITCH_START_PORT): - """Return switch port numbers as a tuple of at least count entries; - ports = [1, 2, 3...] | [] (range starting from start_port)""" - assert ports - if not ports: - ports = [SWITCH_START_PORT] - ports = tuple(ports) - length, next_port = len(ports), max(ports) + 1 - if length < count: - ports += tuple(range(next_port, next_port + count - length)) - return ports - - def _add_links(self, switch, hosts, links_per_host, port_base=None): - ports = self.port_nums(len(hosts)*links_per_host, port_base) - i = 0 + def _add_links(self, switch, hosts, links_per_host, start_port): + port = start_port for host in hosts: - for _ in range(links_per_host): + for i in range(links_per_host): # Order of switch/host is important, since host may be in a container. - self.addLink(switch, host, port1=ports[i], delay=self.DELAY, use_htb=True) - i += 1 - # Next port to use if needed - return max(ports) + 1 - - def addLink(self, src, dst, **kwargs): - """Keep track of switch ports in order""" - result = super().addLink(src, dst, **kwargs) - sport, dport = kwargs.get('port1'), kwargs.get('port2') - for node, port in ((src, sport), (dst, dport)): - if self.isSwitch(node) and port: - self._switch_ports[node].append(port) - return result - - def dpid_ports(self, dpid): - """Return port list for dpid""" - switch = self._dpid_names[dpid] - return self._switch_ports[switch] - - def __init__(self, *args, **kwargs): - self._switch_ports = defaultdict(list) # ports in order for each switch - self._dpid_names = {} # maps dpids to switch names - super().__init__(*args, **kwargs) + self.addLink(switch, host, port1=port, delay=self.DELAY, use_htb=True) + port += 1 + return port def build(self, ovs_type, ports_sock, test_name, dpids, n_tagged=0, tagged_vid=100, n_untagged=0, links_per_host=0, n_extended=0, e_cls=None, tmpdir=None, hw_dpid=None, - host_namespace=None, port_base=None): + host_namespace=None, start_port=SWITCH_START_PORT): if not host_namespace: host_namespace = {} + for dpid in dpids: serialno = mininet_test_util.get_serialno( ports_sock, test_name) @@ -228,7 +193,7 @@ def build(self, ovs_type, ports_sock, test_name, dpids, dpid = remap_dpid switch_cls = NoControllerFaucetSwitch switch = self._add_faucet_switch(sid_prefix, dpid, ovs_type, switch_cls) - self._add_links(switch, self.hosts(), links_per_host, port_base) + self._add_links(switch, self.hosts(), links_per_host, start_port) class FaucetStringOfDPSwitchTopo(FaucetSwitchTopo): @@ -239,7 +204,7 @@ class FaucetStringOfDPSwitchTopo(FaucetSwitchTopo): def build(self, ovs_type, ports_sock, test_name, dpids, n_tagged=0, tagged_vid=100, n_untagged=0, links_per_host=0, switch_to_switch_links=1, - hw_dpid=None, stack_ring=False, port_base=None): + hw_dpid=None, stack_ring=False, start_port=SWITCH_START_PORT): """ Hosts @@ -270,6 +235,7 @@ def addLinks(src, dst, switch_ports): # pylint: disable=invalid-name self.addLink(src, dst, port1=switch_ports[src], port2=switch_ports[dst]) switch_ports[src] += 1 switch_ports[dst] += 1 + first_switch = None last_switch = None self.switch_to_switch_links = switch_to_switch_links @@ -293,7 +259,7 @@ def addLinks(src, dst, switch_ports): # pylint: disable=invalid-name switch = self._add_faucet_switch(sid_prefix, dpid, ovs_type, switch_cls) if first_switch is None: first_switch = switch - switch_ports[switch] = self._add_links(switch, hosts, links_per_host, port_base) + switch_ports[switch] = self._add_links(switch, hosts, links_per_host, start_port) if last_switch is not None: # Add a switch-to-switch link with the previous switch, # if this isn't the first switch in the topology. diff --git a/tests/integration/mininet_tests.py b/tests/integration/mininet_tests.py index fda2dfd370..d3d6af1863 100644 --- a/tests/integration/mininet_tests.py +++ b/tests/integration/mininet_tests.py @@ -130,7 +130,6 @@ def setUp(self): # pylint: disable=invalid-name n_tagged=self.N_TAGGED, n_untagged=self.N_UNTAGGED, links_per_host=self.LINKS_PER_HOST, hw_dpid=self.hw_dpid, host_namespace=self.HOST_NAMESPACE) - self.port_map = self.create_port_map(self.dpid) self.start_net() def verify_events_log(self, event_log, timeout=10): @@ -270,7 +269,6 @@ def setUp(self): n_tagged=self.N_TAGGED, n_untagged=self.N_UNTAGGED, links_per_host=self.LINKS_PER_HOST, hw_dpid=self.hw_dpid, host_namespace=self.HOST_NAMESPACE) - self.port_map = self.create_port_map(self.dpid) self.start_net() self.nfv_portno = self.port_map['port_4'] @@ -6370,17 +6368,16 @@ def non_host_ports(self, dpid): min_non_host_ports = self.MAX_HOSTS - self.NUM_HOSTS first_non_host_port = min_non_host_ports + 1 last_non_host_port = first_non_host_port + min_non_host_ports - 1 - return [self.port_maps[dpid]['port_%u' % port] + return [self.port_map['port_%u' % port] for port in range(first_non_host_port, last_non_host_port + 1)] min_non_host_ports = 2 - first_non_host_port = self.NUM_HOSTS + 1 + first_non_host_port = self.NUM_HOSTS + mininet_test_topo.SWITCH_START_PORT last_non_host_port = first_non_host_port + min_non_host_ports - 1 - return [self.port_maps[dpid]['port_%u' % port] - for port in range(first_non_host_port, last_non_host_port + 1)] + return [port for port in range(first_non_host_port, last_non_host_port + 1)] def hw_port_map_offset(self, port_no): - remap_port_no = (len(self.port_map) - port_no) + 1 - return self.port_maps[self.dpid]['port_%u' % remap_port_no] + remap_port_no = (port_no - mininet_test_topo.SWITCH_START_PORT) + 1 + return self.port_map['port_%u' % remap_port_no] def hw_remap_all_ports(self, config): return {self.hw_port_map_offset(port_no): config @@ -6391,16 +6388,11 @@ def get_config_header(_config_global, _debug_log, _dpid, _hardware): """Don't generate standard config file header.""" return '' - def acls(self): - return {} - - def acl_in_dp(self): - return {} - def build_net(self, stack=False, n_dps=1, n_tagged=0, tagged_vid=100, n_untagged=0, untagged_vid=100, include=None, include_optional=None, + acls=None, acl_in_dp=None, switch_to_switch_links=1, hw_dpid=None, stack_ring=False, lacp=False, use_external=False): """Set up Mininet and Faucet for the given topology.""" @@ -6408,6 +6400,10 @@ def build_net(self, stack=False, n_dps=1, include = [] if include_optional is None: include_optional = [] + if acls is None: + acls = {} + if acl_in_dp is None: + acl_in_dp = {} self.dpids = [str(self.rand_dpid()) for _ in range(n_dps)] self.dpids[0] = self.dpid self.topo = mininet_test_topo.FaucetStringOfDPSwitchTopo( @@ -6422,10 +6418,7 @@ def build_net(self, stack=False, n_dps=1, test_name=self._test_name(), hw_dpid=hw_dpid, stack_ring=stack_ring, - port_base=self.port_base ) - self.port_maps = {dpid: self.create_port_map(dpid) for dpid in self.dpids} - self.port_map = self.port_maps[self.dpid] self.CONFIG = self.get_config( self.dpids, hw_dpid, @@ -6438,8 +6431,8 @@ def build_net(self, stack=False, n_dps=1, untagged_vid, include, include_optional, - self.acls(), - self.acl_in_dp(), + acls, + acl_in_dp, stack_ring, lacp, use_external, @@ -6482,17 +6475,17 @@ def add_acl_to_port(name, port, interfaces_config): if name in acl_in_dp and port in acl_in_dp[name]: interfaces_config[port]['acl_in'] = acl_in_dp[name][port] - def add_dp_to_dp_ports(name, dp_config, port_index, interfaces_config, i, + def add_dp_to_dp_ports(name, dp_config, port, interfaces_config, i, dpid_count, stack, n_tagged, tagged_vid, - n_untagged, untagged_vid, dpname_to_dpkey): - dpid, _ = dpname_to_dpkey[name] + n_untagged, untagged_vid): + # Add configuration for the switch-to-switch links # (0 for a single switch, 1 for an end switch, 2 for middle switches). first_dp = i == 0 second_dp = i == 1 last_dp = i == dpid_count - 1 end_dp = first_dp or last_dp - first_stack_port = port_index + first_stack_port = port peer_dps = [] if dpid_count > 1: if end_dp: @@ -6517,26 +6510,21 @@ def add_dp_to_dp_ports(name, dp_config, port_index, interfaces_config, i, dp_config['stack'] = { 'priority': 1 } - index = 0 for peer_dp in peer_dps: if (dpid_count <= 2 or (first_dp and peer_dp != dpid_count - 1) or second_dp or (not end_dp and peer_dp > i)): peer_stack_port_base = first_stack_port else: peer_stack_port_base = first_stack_port + self.topo.switch_to_switch_links - port_maps = self.port_maps for stack_dp_port in range(self.topo.switch_to_switch_links): - port = port_maps[dpid]['port_%d' % (first_stack_port + index)] - peer_dp_name = dp_name(peer_dp) - peer_dpid, _ = dpname_to_dpkey[peer_dp_name] - peer_port = port_maps[peer_dpid]['port_%d' % (peer_stack_port_base + stack_dp_port)] + peer_port = peer_stack_port_base + stack_dp_port interfaces_config[port] = {} if stack: # make this a stacking link. interfaces_config[port].update( { 'stack': { - 'dp': peer_dp_name, + 'dp': dp_name(peer_dp), 'port': peer_port} }) else: @@ -6555,8 +6543,7 @@ def add_dp_to_dp_ports(name, dp_config, port_index, interfaces_config, i, interfaces_config[port].update( {'lacp': 1, 'lacp_active': True}) add_acl_to_port(name, port, interfaces_config) - index += 1 - + port += 1 def add_dp(name, dpid, hw_dpid, i, dpid_count, stack, n_tagged, tagged_vid, n_untagged, untagged_vid, @@ -6577,29 +6564,27 @@ def add_dp(name, dpid, hw_dpid, i, dpid_count, stack, } interfaces_config = {} - index = 1 + port = mininet_test_topo.SWITCH_START_PORT for n_port in range(1, n_tagged + 1): - port = self.port_maps[dpid]['port_%d' % index] interfaces_config[port] = { 'tagged_vlans': [tagged_vid], 'loop_protect_external': (use_external and n_port < n_tagged), } add_acl_to_port(name, port, interfaces_config) - index += 1 + port += 1 for n_port in range(1, n_untagged + 1): - port = self.port_maps[dpid]['port_%d' % index] interfaces_config[port] = { 'native_vlan': untagged_vid, 'loop_protect_external': (use_external and n_port < n_untagged), } add_acl_to_port(name, port, interfaces_config) - index += 1 + port += 1 add_dp_to_dp_ports( - name, dp_config, index, interfaces_config, i, dpid_count, stack, - n_tagged, tagged_vid, n_untagged, untagged_vid, dpname_to_dpkey) + name, dp_config, port, interfaces_config, i, dpid_count, stack, + n_tagged, tagged_vid, n_untagged, untagged_vid) for portno, config in list(interfaces_config.items()): stack = config.get('stack', None) @@ -7029,16 +7014,14 @@ class FaucetSingleStackAclControlTest(FaucetStringOfDPTest): NUM_DPS = 3 NUM_HOSTS = 3 - def acls(self): - map1, map2, map3 = [self.port_maps[dpid] for dpid in self.dpids] - ACLS = { + ACLS = { 1: [ {'rule': { 'dl_type': IPV4_ETH, 'nw_dst': '10.0.0.2', 'actions': { 'output': { - 'port': map1['port_2'] + 'port': mininet_test_topo.SWITCH_START_PORT + 1 } }, }}, @@ -7048,8 +7031,8 @@ def acls(self): 'actions': { 'output': { 'ports': [ - map1['port_2'], - map1['port_4']] + mininet_test_topo.SWITCH_START_PORT + 1, + mininet_test_topo.SWITCH_START_PORT + 3] } }, }}, @@ -7057,7 +7040,7 @@ def acls(self): 'dl_type': IPV4_ETH, 'actions': { 'output': { - 'port': map1['port_4'] + 'port': mininet_test_topo.SWITCH_START_PORT + 3 } }, }}, @@ -7072,7 +7055,7 @@ def acls(self): 'dl_type': IPV4_ETH, 'actions': { 'output': { - 'port': map2['port_5'] + 'port': mininet_test_topo.SWITCH_START_PORT + 4 } }, }}, @@ -7088,7 +7071,7 @@ def acls(self): 'nw_dst': '10.0.0.7', 'actions': { 'output': { - 'port': map3['port_1'] + 'port': mininet_test_topo.SWITCH_START_PORT } }, }}, @@ -7097,7 +7080,7 @@ def acls(self): 'dl_dst': 'ff:ff:ff:ff:ff:ff', 'actions': { 'output': { - 'ports': [map3['port_1']] + 'ports': [mininet_test_topo.SWITCH_START_PORT] } }, }}, @@ -7113,28 +7096,23 @@ def acls(self): }, }}, ], - } - return ACLS + } - def acl_in_dp(self): - map1, map2, map3 = [self.port_maps[dpid] for dpid in self.dpids] - # DP-to-acl_in port mapping. - ACL_IN_DP = { + # DP-to-acl_in port mapping. + ACL_IN_DP = { 'faucet-1': { # Port 1, acl_in = 1 - map1['port_1'] : 1, + mininet_test_topo.SWITCH_START_PORT: 1, }, 'faucet-2': { # Port 4, acl_in = 2 - map2['port_4'] : 2, + mininet_test_topo.SWITCH_START_PORT + 3: 2, }, 'faucet-3': { # Port 4, acl_in = 3 - map3['port_4'] : 3, + mininet_test_topo.SWITCH_START_PORT + 3: 3, }, - } - return ACL_IN_DP - + } def setUp(self): # pylint: disable=invalid-name super(FaucetSingleStackAclControlTest, self).setUp() @@ -7143,6 +7121,8 @@ def setUp(self): # pylint: disable=invalid-name n_dps=self.NUM_DPS, n_untagged=self.NUM_HOSTS, untagged_vid=self.VID, + acls=self.ACLS, + acl_in_dp=self.ACL_IN_DP, ) self.start_net() @@ -7225,15 +7205,13 @@ class FaucetStringOfDPACLOverrideTest(FaucetStringOfDPTest): ], } - def acl_in_dp(self): - # DP-to-acl_in port mapping. - ACL_IN_DP = { + # DP-to-acl_in port mapping. + ACL_IN_DP = { 'faucet-1': { # First port, acl_in = 1 - self.port_map['port_1']: 1, + mininet_test_topo.SWITCH_START_PORT: 1, }, - } - return ACL_IN_DP + } def setUp(self): # pylint: disable=invalid-name super(FaucetStringOfDPACLOverrideTest, self).setUp() @@ -7243,7 +7221,9 @@ def setUp(self): # pylint: disable=invalid-name n_dps=self.NUM_DPS, n_untagged=self.NUM_HOSTS, untagged_vid=self.VID, - include_optional=[self.acls_config, missing_config] + include_optional=[self.acls_config, missing_config], + acls=self.ACLS, + acl_in_dp=self.ACL_IN_DP, ) self.start_net() @@ -7276,9 +7256,7 @@ class FaucetTunnelSameDpTest(FaucetStringOfDPTest): NUM_HOSTS = 2 SWITCH_TO_SWITCH_LINKS = 2 VID = 100 - - def acls(self): - return { + ACLS = { 1: [ {'rule': { 'dl_type': IPV4_ETH, @@ -7290,21 +7268,20 @@ def acls(self): 'type': 'vlan', 'tunnel_id': 200, 'dp': 'faucet-1', - 'port': self.port_map['port_2']} + 'port': mininet_test_topo.SWITCH_START_PORT + 1} } } }} ] - } + } - def acl_in_dp(self): - # DP-to-acl_in port mapping. - return { + # DP-to-acl_in port mapping. + ACL_IN_DP = { 'faucet-1': { # First port 1, acl_in = 1 - self.port_map['port_1'] : 1, - } + mininet_test_topo.SWITCH_START_PORT: 1, } + } def setUp(self): # pylint: disable=invalid-name super(FaucetTunnelSameDpTest, self).setUp() @@ -7313,6 +7290,8 @@ def setUp(self): # pylint: disable=invalid-name n_dps=self.NUM_DPS, n_untagged=self.NUM_HOSTS, untagged_vid=self.VID, + acls=self.ACLS, + acl_in_dp=self.ACL_IN_DP, switch_to_switch_links=self.SWITCH_TO_SWITCH_LINKS, hw_dpid=self.hw_dpid, ) @@ -7347,9 +7326,7 @@ class FaucetTunnelTest(FaucetStringOfDPTest): NUM_HOSTS = 2 SWITCH_TO_SWITCH_LINKS = 2 VID = 100 - - def acls(self): - return { + ACLS = { 1: [ {'rule': { 'dl_type': IPV4_ETH, @@ -7361,21 +7338,20 @@ def acls(self): 'type': 'vlan', 'tunnel_id': 200, 'dp': 'faucet-2', - 'port': self.port_map['port_1']} + 'port': mininet_test_topo.SWITCH_START_PORT} } } }} ] - } + } - def acl_in_dp(self): - # DP-to-acl_in port mapping. - return { + # DP-to-acl_in port mapping. + ACL_IN_DP = { 'faucet-1': { # First port 1, acl_in = 1 - self.port_map['port_1']: 1, - } + mininet_test_topo.SWITCH_START_PORT: 1, } + } def setUp(self): # pylint: disable=invalid-name super(FaucetTunnelTest, self).setUp() @@ -7384,6 +7360,8 @@ def setUp(self): # pylint: disable=invalid-name n_dps=self.NUM_DPS, n_untagged=self.NUM_HOSTS, untagged_vid=self.VID, + acls=self.ACLS, + acl_in_dp=self.ACL_IN_DP, switch_to_switch_links=self.SWITCH_TO_SWITCH_LINKS, hw_dpid=self.hw_dpid, )