-
Notifications
You must be signed in to change notification settings - Fork 664
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
aclshow unittest #468
aclshow unittest #468
Conversation
import mock_tables.dbconnector | ||
|
||
default_output = ''+ \ | ||
"""RULE NAME TABLE NAME PACKETS COUNT BYTES COUNT |
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.
can you add line breakup and have the table header aligned with the data? this applies to all the below table
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.
Line breakup makes assertion to fail, as it compares strings.
default_output = ''+ \ | ||
"""RULE NAME TABLE NAME PACKETS COUNT BYTES COUNT | ||
------------ ------------ --------------- ------------- | ||
RULE_9 DATAACL 901 900 |
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.
can you explain how the tool sort the table? it does not seems to be according to the rule name and not sure if the current behavior is the expected one.
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.
It sorts by table name, then by counters.
|
||
import mock_tables.dbconnector | ||
|
||
default_output = ''+ \ |
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.
please add a description of the command used and the parameters to invoke this output. it will help so see the big picture
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.
Added description to the expected outputs, ant to each test case.
if self.nullify_on_exit: | ||
self.nullify_counters() | ||
sys.stdout = self.old_stdout | ||
#print self.result.getvalue() # Print output for debugging. |
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.
please remove unused code
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.
Removed.
assert test.result.getvalue() == rule4_rule6_verbose_output | ||
|
||
def test_everflow(): | ||
test = Aclshow(all=None, clear=None, rules=None, tables='EVERFLOW', verbose=None) |
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.
if mirroring was configured, were we suppose to see the data? if so, i think we should have dedicated case for it as well. i see below the table configured but are we missing additional configuration to see the info?
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.
Added two rules to be in Everflow.
c0ee404
to
46b17fd
Compare
Signed-off-by: Roman Kachur <romankac@mellanox.com>
46b17fd
to
dfe19d8
Compare
Added PRIO column to the command output. vstest will fail until aclshow is merged |
Include below commits sonic-swss-common ``` 83d3351 2021-04-22 | [swig] fix ConfigDBConnector.db_name (sonic-net#483) [Qi Luo] fdf296f 2021-04-09 | Fix: ConfigDBConnector call super init with proper parameter name (sonic-net#470) [Qi Luo] 4f580e3 2021-03-26 | [swig] translate SonicV2Connector::keys return type from C++ vector<string> to Python list (sonic-net#468) [Qi Luo] ``` sonic-snmpagent ``` c160c2b 2021-08-04 | CPU Spike because of redundant and flooded keyspace notifis handled (sonic-net#230) [Vivek Reddy] a4dd3bf 2021-08-03 | Non-block reading counters to tolerate corrupted/delayed counters in COUNTERS_DB (sonic-net#231) [Qi Luo] ```
Signed-off-by: Roman Kachur romankac@mellanox.com
- What I did
I created a unittest for the aclshow utility
- How I did it
Exploiting mock_tables, I added mock Rules, Databases, and occasional Counters.
Unittest calls aclshow with different arguments, and compares its output with the predefined outputs.
In total 10 cases were covered:
- How to verify it
python2 -m py.test aclshow_test.py -v
- Previous command output (if the output of a command-line utility has changed)
N/A
- New command output (if the output of a command-line utility has changed)
-->