Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions ansible/roles/test/files/ptftests/hash_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,21 @@ def check_hash(self, hash_key):
in_port = random.choice([port for port in self.src_ports if port not in exp_port_list])

hit_count_map = {}
for _ in range(0, self.BALANCING_TEST_TIMES):
logging.info("in_port: {}".format(in_port))
(matched_index, _) = self.check_ip_route(hash_key, in_port, dst_ip, exp_port_list)
hit_count_map[matched_index] = hit_count_map.get(matched_index, 0) + 1
logging.info("hit count map: {}".format(hit_count_map))
self.check_balancing(next_hop.get_next_hop(), hit_count_map)
if hash_key == 'ingress-port': # The sample is too little for hash_key ingress-port, check it loose(just verify if the asic actually used the hash field as a load-balancing factor)
for in_port in [port for port in self.src_ports if port not in exp_port_list]:
logging.info("in_port: {}".format(in_port))
(matched_index, _) = self.check_ip_route(hash_key, in_port, dst_ip, exp_port_list)
hit_count_map[matched_index] = hit_count_map.get(matched_index, 0) + 1
logging.info("hit count map: {}".format(hit_count_map))
assert True if len(hit_count_map.keys()) > 1 else False
else:
for _ in range(0, self.BALANCING_TEST_TIMES):
logging.info("in_port: {}".format(in_port))
(matched_index, _) = self.check_ip_route(hash_key, in_port, dst_ip, exp_port_list)
hit_count_map[matched_index] = hit_count_map.get(matched_index, 0) + 1
logging.info("hit count map: {}".format(hit_count_map))

self.check_balancing(next_hop.get_next_hop(), hit_count_map)

def check_ip_route(self, hash_key, in_port, dst_ip, dst_port_list):
if ip_network(unicode(dst_ip)).version == 4:
Expand Down
3 changes: 0 additions & 3 deletions tests/fib/test_fib.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ def setup_hash(self, testbed, duthost, ptfhost):
self.hash_keys.remove('src-port')
self.hash_keys.remove('dst-port')

# TODO
self.hash_keys.remove('ingress-port')

g_vars['testbed_type'] = testbed['topo']['name']
g_vars['router_mac'] = duthost.shell('sonic-cfggen -d -v \'DEVICE_METADATA.localhost.mac\'')["stdout_lines"][0].decode("utf-8")

Expand Down