Skip to content

Add get_presence implementation for SFP on Mellanox platforms#1056

Merged
stcheng merged 1 commit intosonic-net:masterfrom
andriymoroz-mlnx:sfp_presence
Oct 20, 2017
Merged

Add get_presence implementation for SFP on Mellanox platforms#1056
stcheng merged 1 commit intosonic-net:masterfrom
andriymoroz-mlnx:sfp_presence

Conversation

@andriymoroz-mlnx
Copy link
Collaborator

Signed-off-by: Andriy Moroz c_andriym@mellanox.com

- What I did
Add get_presence implementation for SFP on Mellanox platforms

- How I did it
Added implementation in sfputil.py

- How to verify it
Before implementation:

root@arc-switch1028:/# sfputil show presence
Traceback (most recent call last):
  File "/usr/bin/sfputil", line 9, in <module>
    load_entry_point('sonic-utilities==1.1', 'console_scripts', 'sfputil')()
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/sfputil/main.py", line 469, in presence
    presence = platform_sfputil.get_presence(physical_port)
  File "/usr/share/sonic/device/x86_64-mlnx_msn2700-r0/plugins/sfputil.py", line 50, in get_presence
    raise NotImplementedError
NotImplementedError
root@arc-switch1028:/#

After implementation

root@arc-switch1028:/# sfputil show presence
Port         Presence
-----------  -----------
Ethernet0    Present
Ethernet4    Present
Ethernet8    Present
Ethernet12   Not present
Ethernet16   Not present
Ethernet20   Not present
Ethernet24   Not present
Ethernet28   Not present
Ethernet32   Present
Ethernet36   Present
Ethernet40   Not present
Ethernet44   Not present
Ethernet48   Not present
Ethernet52   Not present
Ethernet56   Not present
Ethernet60   Not present
Ethernet64   Not present
Ethernet68   Not present
Ethernet72   Not present
Ethernet76   Not present
Ethernet80   Not present
Ethernet84   Not present
Ethernet88   Not present
Ethernet92   Not present
Ethernet96   Not present
Ethernet100  Not present
Ethernet104  Not present
Ethernet108  Not present
Ethernet112  Not present
Ethernet116  Present
Ethernet120  Present
Ethernet124  Present
root@arc-switch1028:/#

Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
@sonic-net sonic-net deleted a comment from jleveque Oct 19, 2017
@stcheng stcheng merged commit 587b14a into sonic-net:master Oct 20, 2017
@daall daall mentioned this pull request Nov 4, 2020
3 tasks
lguohan pushed a commit that referenced this pull request Nov 6, 2020
Add a switch to route_check to control whether write log to syslog (#1215)
[consutil] Store console port state in STATE_DB (#1208)
[sfputil] Display 'N/A' for non-SFP ports (#1078)
Show FG_NHG CLI Commands Added (#1056)
[show] remove 'device2interface_dict' in show interface neighbor expected (#1188)
Add license file, remove third-party licenses file (#1192)
[fwutil]: Set min log priority to INFO. (#1191)
[CLI][show][platform] Added ASIC count in the output. (#1185)
fdbshow and nbrshow use SonicV2Connector with decode_responses=True, and remove all the decode() (#1187)
Remove stdeb.cfg; no longer used now that we build as wheel (#1182) 
[counterpoll] Disable Counter Poll When Entering Fast Reboot (#1174) 
Fixes the issue with show interface counters and for pfc and queue counters. (#1180)
[config/show] Add CLI support for proxy arp (#1168)
[consutil] Add brief option to show line command (#1176)
Modify fast-reboot script to use BGP service script to stop bgp service (#1177)
[config/console] Support update console configuration related commands (#1166)
[consutil] Fix issue where the show line command crash if no ttyUSB exists (#1173)
[watermarkstat] Add unit tests for watermarkstat show commands (#1157)
Fix exception for ipaddress in python2 (#1164) 
[celestica] consutil to support customize tty device name (#1155)

Signed-off-by: Danny Allen <daall@microsoft.com>
santhosh-kt pushed a commit to santhosh-kt/sonic-buildimage that referenced this pull request Feb 25, 2021
Add a switch to route_check to control whether write log to syslog (sonic-net#1215)
[consutil] Store console port state in STATE_DB (sonic-net#1208)
[sfputil] Display 'N/A' for non-SFP ports (sonic-net#1078)
Show FG_NHG CLI Commands Added (sonic-net#1056)
[show] remove 'device2interface_dict' in show interface neighbor expected (sonic-net#1188)
Add license file, remove third-party licenses file (sonic-net#1192)
[fwutil]: Set min log priority to INFO. (sonic-net#1191)
[CLI][show][platform] Added ASIC count in the output. (sonic-net#1185)
fdbshow and nbrshow use SonicV2Connector with decode_responses=True, and remove all the decode() (sonic-net#1187)
Remove stdeb.cfg; no longer used now that we build as wheel (sonic-net#1182) 
[counterpoll] Disable Counter Poll When Entering Fast Reboot (sonic-net#1174) 
Fixes the issue with show interface counters and for pfc and queue counters. (sonic-net#1180)
[config/show] Add CLI support for proxy arp (sonic-net#1168)
[consutil] Add brief option to show line command (sonic-net#1176)
Modify fast-reboot script to use BGP service script to stop bgp service (sonic-net#1177)
[config/console] Support update console configuration related commands (sonic-net#1166)
[consutil] Fix issue where the show line command crash if no ttyUSB exists (sonic-net#1173)
[watermarkstat] Add unit tests for watermarkstat show commands (sonic-net#1157)
Fix exception for ipaddress in python2 (sonic-net#1164) 
[celestica] consutil to support customize tty device name (sonic-net#1155)

Signed-off-by: Danny Allen <daall@microsoft.com>
stepanblyschak pushed a commit to stepanblyschak/sonic-buildimage that referenced this pull request May 10, 2021
1. show fg-nhg-hash-view
   (shows the current hash bucket view of fg nhg)

2. show fg-nhg-active-hops
   (shows which set of next-hops are active)
mssonicbld added a commit that referenced this pull request Aug 1, 2025
…omatically (#23392)

#### Why I did it
src/sonic-swss-common
```
* fc35dd0 - (HEAD -> master, origin/master, origin/HEAD) Move SonicDbTable to sonic-dash-ha. (#1056) (3 hours ago) [dypet]
* 100e2e0 - [MSTP] Schema Support (#961) (5 hours ago) [Wajahat Razi]
* d7c661b - [trim]: Add Packet Trimming Drop Counters DB schema (#1055) (33 hours ago) [Nazarii Hnydyn]
* 465cc1c - Add test case to verify zmq reconnect behaviour (#84) (#1052) (12 days ago) [Qi Luo]
* 93af927 - Move swss-common/swss-common-testing crates from https://github.com/sonic-net/sonic-dash-ha (#1044) (13 days ago) [Qi Luo]
```
#### How I did it
#### How to verify it
#### Description for the changelog
patrickmacarthur pushed a commit to patrickmacarthur/sonic-buildimage that referenced this pull request Aug 6, 2025
…onic-net#1056)

What I did:

Do not add switch_id in DEVICE_METADATA for chassis_packet. In OA we do
not pass/switch_id for chassis-packet. But their can be other
application like Debug Shell which can use it when initalizing. To keep
consistency just do not add this field.

How I verify:

Before

```
sonic-cfggen -m /etc/sonic/minigraph.xml -n asic0 -v DEVICE_METADATA
{'localhost': {'region': 'australiaeast', 'cloudtype': None, 'docker_routing_config_mode': 'separated', 'hostname': 'xxxx', 'hwsku': 'xxxxx', 'type': 'SpineRouter', 'synchronous_mode': 'enable', 'yang_config_validation': 'disable', 'bgp_asn': 'xxxxx', 'chassis_hostname': 'xxxxx', 'deployment_id': '3', 'cluster': 'xxxx', 'slice_type': 'AZNG_Production', 'subtype': 'DownstreamLC', 'asic_name': 'asic0', 'sub_role': 'FrontEnd', 'switch_type': 'chassis-packet', 'switch_id': 4}}
```

After

```
sonic-cfggen -m /etc/sonic/minigraph.xml -n asic0 -v DEVICE_METADATA
{'localhost': {'region': 'australiaeast', 'cloudtype': None, 'docker_routing_config_mode': 'separated', 'hostname': 'xxxxx', 'hwsku': 'xxxxx', 'type': 'SpineRouter', 'synchronous_mode': 'enable', 'yang_config_validation': 'disable', 'bgp_asn': 'xxxxx', 'chassis_hostname': 'xxxxx', 'deployment_id': '3', 'cluster': 'xxxxx', 'slice_type': 'AZNG_Production', 'subtype': 'DownstreamLC', 'asic_name': 'asic0', 'sub_role': 'FrontEnd', 'switch_type': 'chassis-packet'}}
```
ccroy-arista pushed a commit to ccroy-arista/sonic-buildimage that referenced this pull request Aug 14, 2025
…omatically (sonic-net#23392)

#### Why I did it
src/sonic-swss-common
```
* fc35dd0 - (HEAD -> master, origin/master, origin/HEAD) Move SonicDbTable to sonic-dash-ha. (sonic-net#1056) (3 hours ago) [dypet]
* 100e2e0 - [MSTP] Schema Support (sonic-net#961) (5 hours ago) [Wajahat Razi]
* d7c661b - [trim]: Add Packet Trimming Drop Counters DB schema (sonic-net#1055) (33 hours ago) [Nazarii Hnydyn]
* 465cc1c - Add test case to verify zmq reconnect behaviour (sonic-net#84) (sonic-net#1052) (12 days ago) [Qi Luo]
* 93af927 - Move swss-common/swss-common-testing crates from https://github.com/sonic-net/sonic-dash-ha (sonic-net#1044) (13 days ago) [Qi Luo]
```
#### How I did it
#### How to verify it
#### Description for the changelog
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