Skip to content

Add speed and buffer set test#432

Merged
yxieca merged 7 commits intosonic-net:masterfrom
andriymoroz-mlnx:buffers_port_speed_test
Jan 31, 2018
Merged

Add speed and buffer set test#432
yxieca merged 7 commits intosonic-net:masterfrom
andriymoroz-mlnx:buffers_port_speed_test

Conversation

@andriymoroz-mlnx
Copy link
Contributor

@andriymoroz-mlnx andriymoroz-mlnx commented Jan 19, 2018

Signed-off-by: Andriy Moroz [email protected]

What I did
Added test for port speed change and PG buffer profile update

Why I did it

How I verified it
Ran the test and checked it passes

Details if related
should pass after
#417 and
sonic-net/sonic-buildimage#1250
are merged

Signed-off-by: Andriy Moroz <[email protected]>

buffer_profiles = cfg_buffer_profile_table.getKeys()
expected_buffer_profiles_num = len(buffer_profiles)
assert expected_buffer_profiles_num == 7
Copy link
Contributor

Choose a reason for hiding this comment

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

Using number 7 here seems to be a recipe for long investigation when test fails. How can we make it clearer where this number came from and when test failed here, what to look for?

A comment will be a good start.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it comes from the buffers profile used for the test
I think it can be calculates (something like cat ... | grep "PROFILE" | wc -l)
I'll check and update this comment

fvs = swsscommon.FieldValuePairs([("speed", speed)])
# set same speed on all ports
for i in range(0, self.num_ports):
cfg_port_table.set("Ethernet%d" % (i*4), fvs)
Copy link
Contributor

@yxieca yxieca Jan 24, 2018

Choose a reason for hiding this comment

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

I suspect this change won't work for all devices.

It all depends on what is self.num_ports?

For instance, Arista7260CX3 has 64 physical ports, if self.num_ports is 64 for this device, then it is fine. However, when Arista7260CX3 is used for T0, it will have 56 out of 64 ports break into 2 50G ports, bring the total number of ports to 112 + 8 = 120. Most of these ports are Etherenet(x * 4) and Ethernet(x * 4 + 2) except the 8 100G ports. So if self.num_ports is 120 for this device, then the code here is incorrect.

Also, it appears that ASIC_STATE:SAI_OBJECT_TYPE_PORT also contains disabled ports. E.g. on the platform mentioned above, the number of entry is actually 123 (120 valid ports, 2 disabled ports, 1 cpu).

On the same mentioned platform, the asic port sequence doesn't directly map into Ethernet sequence. This is another assumption that would break, unfortunately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is designed to run on PLATFORM=vs

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Can you at least add a comment at beginning of this file?

Thanks,
Ying

@lguohan
Copy link
Contributor

lguohan commented Jan 24, 2018

the test does not pass, please check

@andriymoroz-mlnx
Copy link
Contributor Author

It will pass after VS docker is updated sonic-net/sonic-buildimage@ff8332f (it is part of buffers config PR sonic-net/sonic-buildimage#1250)
vicious circle...

@yxieca yxieca merged commit 4227bee into sonic-net:master Jan 31, 2018
@andriymoroz-mlnx andriymoroz-mlnx deleted the buffers_port_speed_test branch January 31, 2018 17:40
rodnymolina pushed a commit to rodnymolina/sonic-swss that referenced this pull request Feb 14, 2018
* Add speed and buffer set test

Signed-off-by: Andriy Moroz <[email protected]>

* Add some comments to the test

Signed-off-by: Andriy Moroz <[email protected]>
Janetxxx pushed a commit to Janetxxx/sonic-swss that referenced this pull request Nov 10, 2025
* Add speed and buffer set test

Signed-off-by: Andriy Moroz <[email protected]>

* Add some comments to the test

Signed-off-by: Andriy Moroz <[email protected]>
jianyuewu pushed a commit to jianyuewu/sonic-swss that referenced this pull request Dec 24, 2025
Add support for hexists call.

Tested using below code snippet:

```
from swsscommon.swsscommon import SonicV2Connector

db = SonicV2Connector(host='127.0.0.1')
db.connect(db.COUNTERS_DB)
db.connect(db.ASIC_DB)

ex = int(db.hexists(db.COUNTERS_DB, "COUNTERS_PORT_NAME_MAP", "Ethernet0"))
if ex == 1:
    print "Exists"
else:
    print "Do not exists"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants