-
Notifications
You must be signed in to change notification settings - Fork 727
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[platform/test_sfp]Operate SFP only once for split ports when resetti…
…ng or setting LPM (#1338) * [sfp]operating the logical interfaces sharing a physical interface only once * [sfp]add teardown, beautify and optimize code * [sfp]fix comments
- Loading branch information
1 parent
8c471a3
commit 08c3915
Showing
2 changed files
with
87 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env python | ||
# This script runs on the DUT and is intended to retrieve the portmapping from logical interfaces to physical ones | ||
# The way the port mapping retrieved is exactly the same as what xcvrd does | ||
|
||
import sonic_platform_base.sonic_sfp.sfputilhelper | ||
import json | ||
from sonic_daemon_base.daemon_base import DaemonBase | ||
|
||
# load and parse the port configuration file on DUT | ||
db = DaemonBase() | ||
port_config_path = db.get_path_to_port_config_file() | ||
platform_sfputil = sonic_platform_base.sonic_sfp.sfputilhelper.SfpUtilHelper() | ||
platform_sfputil.read_porttab_mappings(port_config_path) | ||
|
||
# print the mapping to stdout in json format | ||
print json.dumps(platform_sfputil.logical_to_physical) | ||
|
||
# json will be loaded by sonic-mgmt |
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