-
Notifications
You must be signed in to change notification settings - Fork 1k
[TestCOPP] Add test configuration parameter for number of TX packets #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
fc41a9e
1967d21
eeb2c9a
22888e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # ptf --test-dir saitests copp_tests --qlen=100000 --platform nn -t "verbose=True" --device-socket 0-3@tcp://127.0.0.1:10900 --device-socket 1-3@tcp://10.3.147.47:10900 | ||
| # ptf --test-dir saitests copp_tests --qlen=100000 --platform nn -t "verbose=True;pkt_tx_count=100000" --device-socket 0-3@tcp://127.0.0.1:10900 --device-socket 1-3@tcp://10.3.147.47:10900 | ||
| # | ||
| # copp_test.${name_test} | ||
| # | ||
|
|
@@ -32,14 +32,15 @@ class ControlPlaneBaseTest(BaseTest): | |
| PPS_LIMIT_MAX = PPS_LIMIT * 1.1 | ||
| NO_POLICER_LIMIT = PPS_LIMIT * 1.4 | ||
| PKT_TX_COUNT = 100000 | ||
| PKT_RX_LIMIT = PKT_TX_COUNT * 0.90 | ||
| TASK_TIMEOUT = 300 # Wait up to 5 minutes for tasks to complete | ||
|
|
||
| def __init__(self): | ||
| BaseTest.__init__(self) | ||
| self.log_fp = open('/tmp/copp.log', 'a') | ||
| test_params = testutils.test_params_get() | ||
| self.verbose = 'verbose' in test_params and test_params['verbose'] | ||
| self.pkt_tx_count = test_params.get('pkt_tx_count', self.PKT_TX_COUNT) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you will read this None value (probably as string), because you initialized it as default in ansible code. |
||
| self.pkt_rx_limit = self.pkt_tx_count * 0.90 | ||
| self.timeout_thr = None | ||
|
|
||
| self.myip = {} | ||
|
|
@@ -148,8 +149,8 @@ def check_constraints(self, total_rcv_pkt_cnt, time_delta_ms, rx_pps): | |
|
|
||
| def one_port_test(self, port_number): | ||
| packet = self.contruct_packet(port_number) | ||
| total_rcv_pkt_cnt, time_delta, time_delta_ms, tx_pps, rx_pps = self.copp_test(str(packet), self.PKT_TX_COUNT, (0, port_number), (1, port_number)) | ||
| self.printStats(self.PKT_TX_COUNT, total_rcv_pkt_cnt, time_delta, tx_pps, rx_pps) | ||
| total_rcv_pkt_cnt, time_delta, time_delta_ms, tx_pps, rx_pps = self.copp_test(str(packet), self.pkt_tx_count, (0, port_number), (1, port_number)) | ||
| self.printStats(self.pkt_tx_count, total_rcv_pkt_cnt, time_delta, tx_pps, rx_pps) | ||
| self.check_constraints(total_rcv_pkt_cnt, time_delta_ms, rx_pps) | ||
|
|
||
| return | ||
|
|
@@ -178,11 +179,11 @@ def check_constraints(self, total_rcv_pkt_cnt, time_delta_ms, rx_pps): | |
| self.log("") | ||
| self.log("Checking constraints (NoPolicy):") | ||
| self.log("rx_pps (%d) > NO_POLICER_LIMIT (%d): %s" % (int(rx_pps), int(self.NO_POLICER_LIMIT), str(rx_pps > self.NO_POLICER_LIMIT))) | ||
| self.log("total_rcv_pkt_cnt (%d) > PKT_RX_LIMIT (%d): %s" % \ | ||
| (int(total_rcv_pkt_cnt), int(self.PKT_RX_LIMIT), str(total_rcv_pkt_cnt > self.PKT_RX_LIMIT))) | ||
| self.log("total_rcv_pkt_cnt (%d) > pkt_rx_limit (%d): %s" % \ | ||
| (int(total_rcv_pkt_cnt), int(self.pkt_rx_limit), str(total_rcv_pkt_cnt > self.pkt_rx_limit))) | ||
|
|
||
| assert(rx_pps > self.NO_POLICER_LIMIT) | ||
| assert(total_rcv_pkt_cnt > self.PKT_RX_LIMIT) | ||
| assert(total_rcv_pkt_cnt > self.pkt_rx_limit) | ||
|
|
||
| class PolicyTest(ControlPlaneBaseTest): | ||
| def __init__(self): | ||
|
|
@@ -370,8 +371,8 @@ def one_port_test(self, port_number): | |
| if port[0] == 0: | ||
| continue | ||
| packet = self.contruct_packet(port[1]) | ||
| total_rcv_pkt_cnt, time_delta, time_delta_ms, tx_pps, rx_pps = self.copp_test(str(packet), self.PKT_TX_COUNT, (0, port_number), (1, port_number)) | ||
| self.printStats(self.PKT_TX_COUNT, total_rcv_pkt_cnt, time_delta, tx_pps, rx_pps) | ||
| total_rcv_pkt_cnt, time_delta, time_delta_ms, tx_pps, rx_pps = self.copp_test(str(packet), self.pkt_tx_count, (0, port_number), (1, port_number)) | ||
| self.printStats(self.pkt_tx_count, total_rcv_pkt_cnt, time_delta, tx_pps, rx_pps) | ||
| self.check_constraints(total_rcv_pkt_cnt, time_delta_ms, rx_pps) | ||
|
|
||
| return | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,7 @@ | |
| ptf_qlen: 100000 | ||
| ptf_test_params: | ||
| - verbose=False | ||
| - pkt_tx_count={{ pkt_tx_count|default(None) }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you initialize params dictionary here with None value.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd better used something like: I don't know better way to omit pkt_tx_count from ptf_test_params in Ansible. |
||
| ptf_extra_options: --device-socket 0-3@tcp://127.0.0.1:10900 --device-socket 1-3@tcp://{{ ansible_eth0['ipv4']['address'] }}:10900 | ||
| with_items: | ||
| - ARPTest | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave as default value?