예제 #1
0
    def setUp(self):
        '''
        @summary: Setup for the test
        '''
        self.dataplane = ptf.dataplane_instance

        self.fibs = []
        for fib_info_file in self.test_params.get('fib_info_files'):
            self.fibs.append(fib.Fib(fib_info_file))

        ptf_test_port_map = self.test_params.get('ptf_test_port_map')
        with open(ptf_test_port_map) as f:
            self.ptf_test_port_map = json.load(f)

        self.router_macs = self.test_params.get('router_macs')
        self.src_ip_range = [
            unicode(x) for x in self.test_params['src_ip_range'].split(',')
        ]
        self.dst_ip_range = [
            unicode(x) for x in self.test_params['dst_ip_range'].split(',')
        ]
        self.src_ip_interval = lpm.LpmDict.IpInterval(
            ip_address(self.src_ip_range[0]), ip_address(self.src_ip_range[1]))
        self.dst_ip_interval = lpm.LpmDict.IpInterval(
            ip_address(self.dst_ip_range[0]), ip_address(self.dst_ip_range[1]))
        self.vlan_ids = self.test_params.get('vlan_ids', [])
        self.hash_keys = self.test_params.get(
            'hash_keys', ['src-ip', 'dst-ip', 'src-port', 'dst-port'])
        self.src_ports = [int(port) for port in self.ptf_test_port_map.keys()]

        self.balancing_range = self.test_params.get(
            'balancing_range', self.DEFAULT_BALANCING_RANGE)
        self.balancing_test_times = self.test_params.get(
            'balancing_test_times', self.BALANCING_TEST_TIMES)
예제 #2
0
    def setUp(self):
        '''
        @summary: Setup for the test
        '''
        self.dataplane = ptf.dataplane_instance
        self.router_mac = self.test_params['router_mac']
        self.fib = fib.Fib(self.test_params['fib_info'])
        if self.test_params['testbed_type'] == 't1' or self.test_params[
                'testbed_type'] == 't1-lag':
            self.src_ports = range(0, 32)
        if self.test_params['testbed_type'] == 't1-64-lag':
            self.src_ports = [
                0, 1, 4, 5, 16, 17, 20, 21, 34, 36, 37, 38, 39, 42, 44, 45, 46,
                47, 50, 52, 53, 54, 55, 58, 60, 61, 62, 63
            ]
        if self.test_params['testbed_type'] == 't0':
            self.src_ports = range(1, 25) + range(28, 32)
        if self.test_params['testbed_type'] == 't0-64':
            self.src_ports = [
                0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21,
                22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 36, 37, 38, 39, 40,
                41, 42, 48, 52, 53, 54, 55, 56, 57, 58
            ]
        if self.test_params['testbed_type'] == 't0-116':
            self.src_ports = range(0, 24) + range(32, 120)

        # which type of tunneled trafic to test (IPv4 in IPv4, IPv6 in IPv4, IPv6 in IPv4, IPv6 in IPv6)
        self.test_outer_ipv4 = self.test_params.get('outer_ipv4', True)
        self.test_outer_ipv6 = self.test_params.get('outer_ipv6', True)
        self.test_inner_ipv4 = self.test_params.get('inner_ipv4', True)
        self.test_inner_ipv6 = self.test_params.get('inner_ipv6', True)

        self.summary = {}
예제 #3
0
    def setUp(self):
        '''
        @summary: Setup for the test
        Two test parameters are used:
         - fib_info: the FIB information generated according to the testbed
         - router_mac: the MAC address of the DUT used to create the eth_dst
           of the packet
         - testbed_type: the type of the testbed used to determine the source
           port
        TODO: Have a separate line in fib_info/file to indicate all UP ports
        '''
        self.dataplane = ptf.dataplane_instance
        self.fib = fib.Fib(self.test_params['fib_info'])
        self.router_mac = self.test_params['router_mac']

        self.test_ipv4 = self.test_params.get('ipv4', True)
        self.test_ipv6 = self.test_params.get('ipv6', True)

        self.balancing_range = self.test_params.get(
            'balancing_range', self.DEFAULT_BALANCING_RANGE)
        self.balancing_test_ratio = self.test_params.get(
            'balancing_test_ratio', self.DEFAULT_BALANCING_TEST_RATIO)

        if self.test_params['testbed_type'] == 't1' or self.test_params[
                'testbed_type'] == 't1-lag':
            self.src_ports = range(0, 32)
        if self.test_params['testbed_type'] == 't0':
            self.src_ports = range(1, 25) + range(28, 32)
        if self.test_params['testbed_type'] == 't0-64':
            self.src_ports = range(0, 2) + range(4, 18) + range(
                20, 33) + range(36, 43) + range(48, 49) + range(52, 59)
        if self.test_params['testbed_type'] == 't0-116':
            self.src_ports = range(0, 24) + range(32, 120)
예제 #4
0
    def setUp(self):
        '''
        @summary: Setup for the test
        '''
        self.dataplane = ptf.dataplane_instance
        self.fib = fib.Fib(self.test_params['fib_info'])
        self.router_mac = self.test_params['router_mac']

        self.src_ip_range = [unicode(x) for x in self.test_params['src_ip_range'].split(',')]
        self.dst_ip_range = [unicode(x) for x in self.test_params['dst_ip_range'].split(',')]
        self.test_hash_srcip = self.test_params.get('hash_srcip', True)
        self.test_hash_dstip = self.test_params.get('hash_dstip', True)
        self.test_hash_srcport = self.test_params.get('hash_srcport', True)
        self.test_hash_dstport = self.test_params.get('hash_dstport', True)
        self.test_hash_inport = self.test_params.get('hash_inport', False)
        self.test_ipv4 = self.test_params.get('ipv4', True)
        self.test_ipv6 = self.test_params.get('ipv6', True)

        self.balancing_range = self.test_params.get('balancing_range', self.DEFAULT_BALANCING_RANGE)

        # Provide the list of all UP interfaces with index in sequence order starting from 0
        if self.test_params['testbed_type'] == 't1' or self.test_params['testbed_type'] == 't1-lag':
            self.src_ports = range(0, 32)
        if self.test_params['testbed_type'] == 't1-64-lag' or self.test_params['testbed_type'] == 't1-64-lag-clet':
            self.src_ports = [0, 1, 4, 5, 16, 17, 20, 21, 34, 36, 37, 38, 39, 42, 44, 45, 46, 47, 50, 52, 53, 54, 55, 58, 60, 61, 62, 63]
        if self.test_params['testbed_type'] == 't0':
            self.src_ports = range(1, 25) + range(28, 32)
        if self.test_params['testbed_type'] == 't0-56':
            self.src_ports = [0, 1, 4, 5, 8, 9] + range(12, 18) + [20, 21, 24, 25, 28, 29, 32, 33, 36, 37] + range(40, 46) + [48, 49, 52, 53]
        if self.test_params['testbed_type'] == 't0-64':
            self.src_ports = range(0, 2) + range(4, 18) + range(20, 33) + range(36, 43) + range(48, 49) + range(52, 59)
        if self.test_params['testbed_type'] == 't0-116':
            self.src_ports = range(0, 120)
예제 #5
0
    def setUp(self):
        '''
        @summary: Setup for the test
        '''
        self.dataplane = ptf.dataplane_instance
        self.router_mac = self.test_params['router_mac']
        self.fib = fib.Fib(self.test_params['fib_info'])
        if self.test_params['testbed_type'] == 't1' or self.test_params['testbed_type'] == 't1-lag':
            self.src_ports = range(0, 32)
        if self.test_params['testbed_type'] == 't1-64-lag' or self.test_params['testbed_type'] == 't1-64-lag-clet':
            self.src_ports = [0, 1, 4, 5, 16, 17, 20, 21, 34, 36, 37, 38, 39, 42, 44, 45, 46, 47, 50, 52, 53, 54, 55, 58, 60, 61, 62, 63]
        if self.test_params['testbed_type'] == 't0':
            self.src_ports = range(1, 25) + range(28, 32)
        if self.test_params['testbed_type'] == 't0-64':
            self.src_ports = [0,  1,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 36, 37, 38, 39, 40, 41, 42, 48, 52, 53, 54, 55, 56, 57, 58]
        if self.test_params['testbed_type'] == 't0-116':
            self.src_ports = range(0, 24) + range(32, 120)
        if self.test_params['testbed_type'] == 't0-52':
            self.src_ports = range(0, 52)

        # which type of tunneled trafic to test (IPv4 in IPv4, IPv6 in IPv4, IPv6 in IPv4, IPv6 in IPv6)
        self.test_outer_ipv4 = self.test_params.get('outer_ipv4', True)
        self.test_outer_ipv6 = self.test_params.get('outer_ipv6', True)
        self.test_inner_ipv4 = self.test_params.get('inner_ipv4', True)
        self.test_inner_ipv6 = self.test_params.get('inner_ipv6', True)

        # Index of current DSCP and TTL value in allowed DSCP_RANGE and TTL_RANGE
        self.dscp_in_idx = 0  # DSCP of inner layer.
        self.dscp_out_idx = len(self.DSCP_RANGE) / 2  # DSCP of outer layer. Set different initial dscp_in and dscp_out
        self.ttl_in_idx = 0  # TTL of inner layer.
        self.ttl_out_idx = len(self.TTL_RANGE) / 2  # TTL of outer layer. Set different initial ttl_in and ttl_out

        self.summary = {}
예제 #6
0
    def setUp(self):
        '''
        @summary: Setup for the test
        '''
        self.dataplane = ptf.dataplane_instance
        self.fib = fib.Fib(self.test_params['fib_info'])
        self.testbed_type = self.test_params['testbed_type']
        self.router_mac = self.test_params['router_mac']
        self.in_ports = self.test_params['in_ports']

        self.src_ip_range = [
            unicode(x) for x in self.test_params['src_ip_range'].split(',')
        ]
        self.dst_ip_range = [
            unicode(x) for x in self.test_params['dst_ip_range'].split(',')
        ]
        self.src_ip_interval = lpm.LpmDict.IpInterval(
            ip_address(self.src_ip_range[0]), ip_address(self.src_ip_range[1]))
        self.dst_ip_interval = lpm.LpmDict.IpInterval(
            ip_address(self.dst_ip_range[0]), ip_address(self.dst_ip_range[1]))
        self.vlan_ids = self.test_params.get('vlan_ids', [])
        self.hash_keys = self.test_params.get(
            'hash_keys', ['src-ip', 'dst-ip', 'src-port', 'dst-port'])
        self.dst_macs = self.test_params.get('dst_macs', [])  # TODO

        self.balancing_range = self.test_params.get(
            'balancing_range', self.DEFAULT_BALANCING_RANGE)
예제 #7
0
    def setUp(self):
        '''
        @summary: Setup for the test
        Two test parameters are used:
         - fib_info: the FIB information generated according to the testbed
         - router_mac: the MAC address of the DUT used to create the eth_dst
           of the packet
         - testbed_type: the type of the testbed used to determine the source
           port
         - src_port: this list should include all enabled ports, both up links
                     and down links.
        TODO: Have a separate line in fib_info/file to indicate all UP ports
        '''
        self.dataplane = ptf.dataplane_instance
        self.fib = fib.Fib(self.test_params['fib_info'])
        self.router_mac = self.test_params['router_mac']

        self.test_ipv4 = self.test_params.get('ipv4', True)
        self.test_ipv6 = self.test_params.get('ipv6', True)

        self.balancing_range = self.test_params.get('balancing_range', self.DEFAULT_BALANCING_RANGE)
        self.balancing_test_ratio = self.test_params.get('balancing_test_ratio', self.DEFAULT_BALANCING_TEST_RATIO)

        if self.test_params['testbed_type'] == 't1' or self.test_params['testbed_type'] == 't1-lag':
            self.src_ports = range(0, 32)
        if self.test_params['testbed_type'] == 't1-64-lag':
            self.src_ports = [0, 1, 4, 5, 16, 17, 20, 21, 34, 36, 37, 38, 39, 42, 44, 45, 46, 47, 50, 52, 53, 54, 55, 58, 60, 61, 62, 63]
        if self.test_params['testbed_type'] == 't0':
            self.src_ports = range(1, 25) + range(28, 32)
        if self.test_params['testbed_type'] == 't0-64':
            self.src_ports = range(0, 2) + range(4, 18) + range(20, 33) + range(36, 43) + range(48, 49) + range(52, 59)
        if self.test_params['testbed_type'] == 't0-116':
            self.src_ports = range(0, 120)
예제 #8
0
    def setUp(self):
        '''
        @summary: Setup for the test
        '''
        self.dataplane = ptf.dataplane_instance
        self.router_mac = self.test_params['router_mac']
        self.fib = fib.Fib(self.test_params['fib_info'])
        self.src_ports = [
            int(port) for port in self.test_params['src_ports'].split(',')
        ]

        # which type of tunneled trafic to test (IPv4 in IPv4, IPv6 in IPv4, IPv6 in IPv4, IPv6 in IPv6)
        self.test_outer_ipv4 = self.test_params.get('outer_ipv4', True)
        self.test_outer_ipv6 = self.test_params.get('outer_ipv6', True)
        self.test_inner_ipv4 = self.test_params.get('inner_ipv4', True)
        self.test_inner_ipv6 = self.test_params.get('inner_ipv6', True)

        self.vlan_ip = self.test_params.get('vlan_ip')
        self.vlan_ipv6 = self.test_params.get('vlan_ipv6')

        # Index of current DSCP and TTL value in allowed DSCP_RANGE and TTL_RANGE
        self.dscp_in_idx = 0  # DSCP of inner layer.
        self.dscp_out_idx = len(
            self.DSCP_RANGE
        ) / 2  # DSCP of outer layer. Set different initial dscp_in and dscp_out
        self.ttl_in_idx = 0  # TTL of inner layer.
        self.ttl_out_idx = len(
            self.TTL_RANGE
        ) / 2  # TTL of outer layer. Set different initial ttl_in and ttl_out

        self.summary = {}
예제 #9
0
    def setUp(self):
        '''
        @summary: Setup for the test
        Some test parameters are used:
         - fib_info: the FIB information generated according to the testbed
         - router_mac: the MAC address of the DUT used to create the eth_dst
           of the packet
         - testbed_type: the type of the testbed used to determine the source
           port
         - src_ports: this list should include all enabled ports, both up links
                     and down links.
         - pkt_action: expect to receive test traffic or not. Default: fwd
         - ipv4/ipv6: enable ipv4/ipv6 tests
        
        Other test parameters:
         - ttl:             ttl of test pkts. Auto decrease 1 for expected pkts.
         - ip_options       enable ip option header in ipv4 pkts. Default: False(disable)
         - src_vid          vlan tag id of src pkts. Default: None(untag)
         - dst_vid          vlan tag id of dst pkts. Default: None(untag)

        TODO: Have a separate line in fib_info/file to indicate all UP ports
        '''
        self.dataplane = ptf.dataplane_instance
        fib_info = self.test_params.get('fib_info', None)
        self.fib = fib.Fib(self.test_params['fib_info']) if fib_info is not None else None
        self.router_mac = self.test_params.get('router_mac', None)
        self.pktlen = self.test_params.get('testbed_mtu', 1500)

        self.test_ipv4 = self.test_params.get('ipv4', True)
        self.test_ipv6 = self.test_params.get('ipv6', True)

        self.test_balancing = self.test_params.get('test_balancing', True)
        self.balancing_range = self.test_params.get('balancing_range', self.DEFAULT_BALANCING_RANGE)
        self.balancing_test_times = self.test_params.get('balancing_test_times', self.BALANCING_TEST_TIMES)
        self.balancing_test_ratio = self.test_params.get('balancing_test_ratio', self.DEFAULT_BALANCING_TEST_RATIO)

        self.pkt_action = self.test_params.get('pkt_action', self.ACTION_FWD)
        self.ttl = self.test_params.get('ttl', 64)
        self.ip_options = self.test_params.get('ip_options', False)
        self.src_vid = self.test_params.get('src_vid', None)
        self.dst_vid = self.test_params.get('dst_vid', None)

        self.src_ports = self.test_params.get('src_ports', None)
        if self.src_ports is None:
            # Provide the list of all UP interfaces with index in sequence order starting from 0
            if self.test_params['testbed_type'] == 't1' or self.test_params['testbed_type'] == 't1-lag' or self.test_params['testbed_type'] == 't0-64-32':
                self.src_ports = range(0, 32)
            if self.test_params['testbed_type'] == 't1-64-lag' or self.test_params['testbed_type'] == 't1-64-lag-clet':
                self.src_ports = [0, 1, 4, 5, 16, 17, 20, 21, 34, 36, 37, 38, 39, 42, 44, 45, 46, 47, 50, 52, 53, 54, 55, 58, 60, 61, 62, 63]
            if self.test_params['testbed_type'] == 't0':
                self.src_ports = range(1, 25) + range(28, 32)
            if self.test_params['testbed_type'] == 't0-52':
                self.src_ports = range(0, 52)
            if self.test_params['testbed_type'] == 't0-56':
                self.src_ports = [0, 1, 4, 5, 8, 9] + range(12, 18) + [20, 21, 24, 25, 28, 29, 32, 33, 36, 37] + range(40, 46) + [48, 49, 52, 53]
            if self.test_params['testbed_type'] == 't0-64':
                self.src_ports = range(0, 2) + range(4, 18) + range(20, 33) + range(36, 43) + range(48, 49) + range(52, 59)
            if self.test_params['testbed_type'] == 't0-116':
                self.src_ports = range(0, 120)
예제 #10
0
    def setUp(self):
        '''
        @summary: Setup for the test
        '''
        self.dataplane = ptf.dataplane_instance

        self.fib = fib.Fib(self.test_params['fib_info'])
        self.router_mac = self.test_params['router_mac']

        inner_src_ip_range = [
            unicode(x)
            for x in self.test_params['inner_src_ip_range'].split(',')
        ]
        inner_dst_ip_range = [
            unicode(x)
            for x in self.test_params['inner_dst_ip_range'].split(',')
        ]
        self.inner_src_ip_interval = lpm.LpmDict.IpInterval(
            ip_address(inner_src_ip_range[0]),
            ip_address(inner_src_ip_range[1]))
        self.inner_dst_ip_interval = lpm.LpmDict.IpInterval(
            ip_address(inner_dst_ip_range[0]),
            ip_address(inner_dst_ip_range[1]))

        outer_src_ip_range = [
            unicode(x)
            for x in self.test_params['outer_src_ip_range'].split(',')
        ]
        outer_dst_ip_range = [
            unicode(x)
            for x in self.test_params['outer_dst_ip_range'].split(',')
        ]
        self.outer_src_ip_interval = lpm.LpmDict.IpInterval(
            ip_address(outer_src_ip_range[0]),
            ip_address(outer_src_ip_range[1]))
        self.outer_dst_ip_interval = lpm.LpmDict.IpInterval(
            ip_address(outer_dst_ip_range[0]),
            ip_address(outer_dst_ip_range[1]))

        self.hash_keys = self.test_params.get(
            'hash_keys', ['src-ip', 'dst-ip', 'src-port', 'dst-port'])
        self.src_ports = self.test_params['src_ports']
        self.vxlan_port = self.test_params['vxlan_port']
        self.symmetric_hashing = self.test_params.get('symmetric_hashing',
                                                      False)
        self.outer_dst_ip = self.outer_dst_ip_interval.get_first_ip()

        self.next_hop = self.fib[self.outer_dst_ip]
        self.exp_port_list = self.next_hop.get_next_hop_list()
        assert (len(self.exp_port_list) > 1)
        for exp_port in self.exp_port_list:
            assert exp_port not in self.src_ports

        self.balancing_range = self.test_params.get(
            'balancing_range', self.DEFAULT_BALANCING_RANGE)
        self.balancing_test_times = self.test_params.get(
            'balancing_test_times', self.BALANCING_TEST_TIMES)
예제 #11
0
    def setUp(self):
        '''
        @summary: Setup for the test
        Some test parameters are used:
         - setup_info: various configuration required by the FIB ptf test
         - src_ports: this list should include all enabled ports, both up links
                     and down links.
         - pkt_action: expect to receive test traffic or not. Default: fwd
         - ipv4/ipv6: enable ipv4/ipv6 tests

        Other test parameters:
         - ttl:                   ttl of test pkts. Auto decrease 1 for expected pkts.
         - ip_options             enable ip option header in ipv4 pkts. Default: False(disable)
         - src_vid                vlan tag id of src pkts. Default: None(untag)
         - dst_vid                vlan tag id of dst pkts. Default: None(untag)
         - ignore_ttl:            mask the ttl field in the expected packet
         - single_fib_for_duts:   have a single fib file for all DUTs in multi-dut case. Default: False
        '''
        self.dataplane = ptf.dataplane_instance

        self.fibs = []
        for fib_info_file in self.test_params.get('fib_info_files'):
            self.fibs.append(fib.Fib(fib_info_file))

        ptf_test_port_map = self.test_params.get('ptf_test_port_map')
        with open(ptf_test_port_map) as f:
            self.ptf_test_port_map = json.load(f)

        self.pktlen = self.test_params.get('testbed_mtu', 9114)
        self.test_ipv4 = self.test_params.get('ipv4', True)
        self.test_ipv6 = self.test_params.get('ipv6', True)
        self.test_balancing = self.test_params.get('test_balancing', True)
        self.balancing_range = self.test_params.get('balancing_range', self.DEFAULT_BALANCING_RANGE)
        self.balancing_test_times = self.test_params.get('balancing_test_times', self.BALANCING_TEST_TIMES)
        self.balancing_test_number = self.test_params.get('balancing_test_number', self.DEFAULT_BALANCING_TEST_NUMBER)
        self.balancing_test_count = 0

        self.pkt_action = self.test_params.get('pkt_action', self.ACTION_FWD)
        self.ttl = self.test_params.get('ttl', 64)

        self.ip_options = False
        ip_options_list = self.test_params.get('ip_options', False)
        if isinstance(ip_options_list, list) and ip_options_list:
            self.ip_options = scapy.IPOption(ip_options_list[0])
            for opt in ip_options_list[1:]:
                self.ip_options /= scapy.IPOption(opt)

        self.src_vid = self.test_params.get('src_vid', None)
        self.dst_vid = self.test_params.get('dst_vid', None)

        self.src_ports = self.test_params.get('src_ports', None)
        if not self.src_ports:
            self.src_ports = [int(port) for port in self.ptf_test_port_map.keys()]

        self.ignore_ttl = self.test_params.get('ignore_ttl', False)
        self.single_fib = self.test_params.get('single_fib_for_duts', "multiple-fib")
예제 #12
0
 def setUp(self):
     '''
     @summary: Setup for the test
     '''
     self.dataplane = ptf.dataplane_instance
     self.router_mac = self.test_params['router_mac']
     self.fib = fib.Fib(self.test_params['fib_info'])
     if self.test_params['testbed_type'] == 't1' or self.test_params[
             'testbed_type'] == 't1-lag':
         self.src_ports = range(0, 32)
     if self.test_params['testbed_type'] == 't0':
         self.src_ports = range(1, 25) + range(28, 32)
예제 #13
0
    def setUp(self):
        '''
        @summary: Setup for the test
        '''
        self.dataplane = ptf.dataplane_instance

        # which type of tunneled trafic to test (IPv4 in IPv4, IPv6 in IPv4, IPv6 in IPv4, IPv6 in IPv6)
        self.test_outer_ipv4 = self.test_params.get('outer_ipv4', True)
        self.test_outer_ipv6 = self.test_params.get('outer_ipv6', True)
        self.test_inner_ipv4 = self.test_params.get('inner_ipv4', True)
        self.test_inner_ipv6 = self.test_params.get('inner_ipv6', True)

        self.lo_ips = self.test_params.get('lo_ips')
        self.lo_ipv6s = self.test_params.get('lo_ipv6s')
        self.router_macs = self.test_params.get('router_macs')
        self.dscp_mode = self.test_params.get('dscp_mode')
        self.ttl_mode = self.test_params.get('ttl_mode')
        self.ignore_ttl = self.test_params.get('ignore_ttl', False)
        self.single_fib = self.test_params.get('single_fib_for_duts', False)

        # multi asic platforms have internal routing hops
        # this param will be used to set the correct ttl values for inner packet
        # this value is zero for single asic platform
        self.max_internal_hops = self.test_params.get('max_internal_hops', 0)
        if self.max_internal_hops:
            self.TTL_RANGE = list(range(self.max_internal_hops + 1, 63))

        self.fibs = []
        for fib_info_file in self.test_params.get('fib_info_files'):
            self.fibs.append(fib.Fib(fib_info_file))

        ptf_test_port_map = self.test_params.get('ptf_test_port_map')
        with open(ptf_test_port_map) as f:
            self.ptf_test_port_map = json.load(f)

        self.src_ports = [int(port) for port in self.ptf_test_port_map.keys()]

        # Index of current DSCP and TTL value in allowed DSCP_RANGE and TTL_RANGE
        self.dscp_in_idx = 0  # DSCP of inner layer.
        self.dscp_out_idx = len(
            self.DSCP_RANGE
        ) / 2  # DSCP of outer layer. Set different initial dscp_in and dscp_out
        self.ttl_in_idx = 0  # TTL of inner layer.
        self.ttl_out_idx = len(
            self.TTL_RANGE
        ) / 2  # TTL of outer layer. Set different initial ttl_in and ttl_out

        self.summary = {}
예제 #14
0
    def setUp(self):
        '''
        @summary: Setup for the test
        Some test parameters are used:
         - setup_info: various configuration required by the FIB ptf test
         - src_ports: this list should include all enabled ports, both up links
                     and down links.
         - pkt_action: expect to receive test traffic or not. Default: fwd
         - ipv4/ipv6: enable ipv4/ipv6 tests

        Other test parameters:
         - ttl:             ttl of test pkts. Auto decrease 1 for expected pkts.
         - ip_options       enable ip option header in ipv4 pkts. Default: False(disable)
         - src_vid          vlan tag id of src pkts. Default: None(untag)
         - dst_vid          vlan tag id of dst pkts. Default: None(untag)
        '''
        self.dataplane = ptf.dataplane_instance

        self.fibs = []
        for fib_info_file in self.test_params.get('fib_info_files'):
            self.fibs.append(fib.Fib(fib_info_file))

        ptf_test_port_map = self.test_params.get('ptf_test_port_map')
        with open(ptf_test_port_map) as f:
            self.ptf_test_port_map = json.load(f)

        self.router_macs = self.test_params.get('router_macs')
        self.pktlen = self.test_params.get('testbed_mtu', 1500)
        self.test_ipv4 = self.test_params.get('ipv4', True)
        self.test_ipv6 = self.test_params.get('ipv6', True)
        self.test_balancing = self.test_params.get('test_balancing', True)
        self.balancing_range = self.test_params.get('balancing_range', self.DEFAULT_BALANCING_RANGE)
        self.balancing_test_times = self.test_params.get('balancing_test_times', self.BALANCING_TEST_TIMES)
        self.balancing_test_number = self.test_params.get('balancing_test_number', self.DEFAULT_BALANCING_TEST_NUMBER)
        self.balancing_test_count = 0

        self.pkt_action = self.test_params.get('pkt_action', self.ACTION_FWD)
        self.ttl = self.test_params.get('ttl', 64)
        self.ip_options = self.test_params.get('ip_options', False)
        self.src_vid = self.test_params.get('src_vid', None)
        self.dst_vid = self.test_params.get('dst_vid', None)

        self.src_ports = self.test_params.get('src_ports', None)
        if not self.src_ports:
            self.src_ports = [int(port) for port in self.ptf_test_port_map.keys()]
예제 #15
0
    def setUp(self):
        '''
        @summary: Setup for the test
        '''
        self.dataplane = ptf.dataplane_instance

        self.fibs = []
        for fib_info_file in self.test_params.get('fib_info_files'):
            self.fibs.append(fib.Fib(fib_info_file))

        ptf_test_port_map = self.test_params.get('ptf_test_port_map')
        with open(ptf_test_port_map) as f:
            self.ptf_test_port_map = json.load(f)

        self.src_ip_range = [
            six.text_type(x)
            for x in self.test_params['src_ip_range'].split(',')
        ]
        self.dst_ip_range = [
            six.text_type(x)
            for x in self.test_params['dst_ip_range'].split(',')
        ]
        self.src_ip_interval = lpm.LpmDict.IpInterval(
            ip_address(self.src_ip_range[0]), ip_address(self.src_ip_range[1]))
        self.dst_ip_interval = lpm.LpmDict.IpInterval(
            ip_address(self.dst_ip_range[0]), ip_address(self.dst_ip_range[1]))
        self.vlan_ids = self.test_params.get('vlan_ids', [])
        self.hash_keys = self.test_params.get(
            'hash_keys', ['src-ip', 'dst-ip', 'src-port', 'dst-port'])
        self.src_ports = [int(port) for port in self.ptf_test_port_map.keys()]

        self.balancing_range = self.test_params.get(
            'balancing_range', self.DEFAULT_BALANCING_RANGE)
        self.balancing_test_times = self.test_params.get(
            'balancing_test_times', self.BALANCING_TEST_TIMES)

        self.ignore_ttl = self.test_params.get('ignore_ttl', False)
        self.single_fib = self.test_params.get('single_fib_for_duts', False)

        # set the base mac here to make it persistent across calls of check_ip_route
        self.base_mac = self.dataplane.get_mac(
            *random.choice(list(self.dataplane.ports.keys())))
예제 #16
0
    def setUp(self):
        '''
        @summary: Setup for the test
        '''
        self.dataplane = ptf.dataplane_instance
        self.router_mac = self.test_params['router_mac']
        self.fib = fib.Fib(self.test_params['fib_info'])
        self.src_ports = [
            int(port) for port in self.test_params['src_ports'].split(',')
        ]

        # which type of tunneled trafic to test (IPv4 in IPv4, IPv6 in IPv4, IPv6 in IPv4, IPv6 in IPv6)
        self.test_outer_ipv4 = self.test_params.get('outer_ipv4', True)
        self.test_outer_ipv6 = self.test_params.get('outer_ipv6', True)
        self.test_inner_ipv4 = self.test_params.get('inner_ipv4', True)
        self.test_inner_ipv6 = self.test_params.get('inner_ipv6', True)

        self.vlan_ip = self.test_params.get('vlan_ip')
        self.vlan_ipv6 = self.test_params.get('vlan_ipv6')

        # Index of current DSCP and TTL value in allowed DSCP_RANGE and TTL_RANGE
        self.dscp_in_idx = 0  # DSCP of inner layer.
        self.dscp_out_idx = len(
            self.DSCP_RANGE
        ) / 2  # DSCP of outer layer. Set different initial dscp_in and dscp_out
        self.ttl_in_idx = 0  # TTL of inner layer.
        self.ttl_out_idx = len(
            self.TTL_RANGE
        ) / 2  # TTL of outer layer. Set different initial ttl_in and ttl_out

        # multi asic platforms have internal routing hops
        # this param will be used to set the correct ttl values for inner packet
        # this value is zero for single asic platform
        self.max_internal_hops = self.test_params.get('max_internal_hops', 0)
        if self.max_internal_hops:
            self.TTL_RANGE = list(range(self.max_internal_hops + 1, 63))

        self.ignore_ttl = self.test_params.get('ignore_ttl', False)

        self.summary = {}