-
Notifications
You must be signed in to change notification settings - Fork 543
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[portsorch]: Bring the physical ports up are only after buffer config…
…uration was applied (#515) * Don't up ports, until buffer configuration is applied * Set MTU first, then set port state to UP * Introduce the test * Use logical operator && for boolean values
- Loading branch information
1 parent
44309ef
commit 2176688
Showing
5 changed files
with
138 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from swsscommon import swsscommon | ||
import time | ||
|
||
# The test check that the ports will be up, when the admin state is UP by conf db. | ||
|
||
def test_PortsAreUpAfterBuffers(dvs): | ||
num_ports = 32 | ||
asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0) | ||
conf_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0) | ||
|
||
conf_port_table = swsscommon.Table(conf_db, "PORT") | ||
asic_port_table = swsscommon.Table(asic_db, "ASIC_STATE:SAI_OBJECT_TYPE_PORT") | ||
|
||
# enable all ports | ||
fvs = swsscommon.FieldValuePairs([("admin_status", "up")]) | ||
for i in range(0, num_ports): | ||
conf_port_table.set("Ethernet%d" % (i*4), fvs) | ||
|
||
time.sleep(5) | ||
|
||
# check that the ports are enabled in ASIC | ||
asic_port_records = asic_port_table.getKeys() | ||
assert len(asic_port_records) == (num_ports + 1), "Number of port records doesn't match number of ports" # +CPU port | ||
num_set = 0 | ||
for k in asic_port_records: | ||
status, fvs = asic_port_table.get(k) | ||
assert status, "Got an error when get a key" | ||
for fv in fvs: | ||
if fv[0] == "SAI_PORT_ATTR_ADMIN_STATE": | ||
assert fv[1] == "true", "The port isn't UP as expected" | ||
num_set += 1 | ||
# make sure that state is set for all "num_ports" ports | ||
assert num_set == num_ports, "Not all ports are up" |