Skip to content
Merged
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
9 changes: 6 additions & 3 deletions ansible/roles/test/files/ptftests/fib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#---------------------------------------------------------------------
import logging
import random
import time

import ptf
import ptf.packet as scapy
Expand Down Expand Up @@ -56,7 +57,7 @@ class FibTest(BaseTest):
# Class variables
#---------------------------------------------------------------------
DEFAULT_BALANCING_RANGE = 0.25
BALANCING_TEST_TIMES = 10000
BALANCING_TEST_TIMES = 625
DEFAULT_BALANCING_TEST_RATIO = 0.0001
ACTION_FWD = 'fwd'
ACTION_DROP = 'drop'
Expand Down Expand Up @@ -173,17 +174,19 @@ def check_ip_range(self, ip_range, next_hop, ipv4=True):
# Send a packet with a random IP in the range
if ip_range.length() > 2:
self.check_ip_route(src_port, ip_range.get_random_ip(), exp_port_list, ipv4)

time.sleep(0.01)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need this delay?

If this delay is really needed, should it be added to the loop in function def check_ip_ranges?

    def check_ip_ranges(self, ipv4=True):
        if ipv4:
            ip_ranges = self.fib.ipv4_ranges()
        else:
            ip_ranges = self.fib.ipv6_ranges()

        for ip_range in ip_ranges:
            if ip_range.get_first_ip() in self.fib:
                next_hop = self.fib[ip_range.get_first_ip()]
                self.check_ip_range(ip_range, next_hop, ipv4)
                time.sleep(0.01)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need this tiny sleep to avoid flapping bgp sessions, as TC received ~6k routes per neighbor, and sends 3 packets per route group. To avoid overloading when send traffic delay was being set.

In def check_ip_ranges i beleive we do not need such delay, I've re-run fib dozen times and TC passed without changes in check_ip_ranges.

# Test traffic balancing across ECMP/LAG members
if (self.test_balancing and self.pkt_action == self.ACTION_FWD
and len(exp_port_list) > 1
and random.random() < self.balancing_test_ratio):
logging.info("Check IP range balancing...")
dst_ip = ip_range.get_random_ip()
hit_count_map = {}
for i in range(0, self.balancing_test_times):
# Change balancing_test_times according to number of next hop groups
for i in range(0, self.balancing_test_times*len(exp_port_list)):
(matched_index, received) = self.check_ip_route(src_port, dst_ip, exp_port_list, ipv4)
hit_count_map[matched_index] = hit_count_map.get(matched_index, 0) + 1
time.sleep(0.01)
self.check_balancing(next_hop.get_next_hop(), hit_count_map)

def check_ip_route(self, src_port, dst_ip_addr, dst_port_list, ipv4=True):
Expand Down