Skip to content
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

[sfputilbase | sfputilhelper] Add support of platform.json #72

Merged
merged 2 commits into from
May 29, 2020

Conversation

samaity
Copy link
Contributor

@samaity samaity commented Dec 15, 2019

Signed-off-by: Sangita Maity [email protected]

Azure/sonic-utilities/pull/767 PR in sonic_utilities submodule(filename: sfputil/main.py depends on this PR.

All three PRs are necessary to run show interfaces transceiver command.

  1. Azure/sonic-buildimage#3912
  2. Azure/sonic-platform-common#72
  3. [sfputil] Add support of platform.json sonic-utilities#767

- What I did

Add support of platform.json in sfputilbase and sfputilhelper file. Code is duplicated in sfputilhelper file as sfputilbase is an abstract base class. So, it cant be instantiated.

admin@lnos-x1-a-fab01:~$ sudo sfputil show
/usr/share/sonic/device/x86_64-cel_seastone-r0/Seastone-DX010-10-50/platform.json
logical: ['Ethernet0', 'Ethernet4', 'Ethernet5', 'Ethernet6', 'Ethernet7', 'Ethernet8', 'Ethernet9', 'Ethernet10', 'Ethernet11', 'Ethernet12', 'Ethernet13', 'Ethernet14', 'Ethernet16', 'Ethernet18', 'Ethernet19', 'Ethernet20', 'Ethernet21', 'Ethernet22', 'Ethernet23', 'Ethernet24', 'Ethernet25', 'Ethernet26', 'Ethernet27', 'Ethernet28', 'Ethernet29', 'Ethernet30', 'Ethernet31', 'Ethernet32', 'Ethernet33', 'Ethernet34', 'Ethernet35', 'Ethernet36', 'Ethernet37', 'Ethernet38', 'Ethernet39', 'Ethernet40', 'Ethernet41', 'Ethernet42', 'Ethernet43', 'Ethernet44', 'Ethernet45', 'Ethernet46', 'Ethernet47', 'Ethernet48', 'Ethernet49', 'Ethernet50', 'Ethernet51', 'Ethernet52', 'Ethernet53', 'Ethernet54', 'Ethernet55', 'Ethernet56', 'Ethernet57', 'Ethernet58', 'Ethernet59', 'Ethernet60', 'Ethernet61', 'Ethernet62', 'Ethernet63', 'Ethernet64', 'Ethernet65', 'Ethernet66', 'Ethernet67', 'Ethernet68', 'Ethernet69', 'Ethernet70', 'Ethernet71', 'Ethernet72', 'Ethernet73', 'Ethernet74', 'Ethernet75', 'Ethernet76', 'Ethernet77', 'Ethernet78', 'Ethernet79', 'Ethernet80', 'Ethernet81', 'Ethernet82', 'Ethernet83', 'Ethernet84', 'Ethernet85', 'Ethernet86', 'Ethernet87', 'Ethernet88', 'Ethernet89', 'Ethernet90', 'Ethernet91', 'Ethernet92', 'Ethernet93', 'Ethernet94', 'Ethernet95', 'Ethernet96', 'Ethernet98', 'Ethernet100', 'Ethernet102', 'Ethernet104', 'Ethernet106', 'Ethernet108', 'Ethernet110', 'Ethernet112', 'Ethernet114', 'Ethernet116', 'Ethernet118', 'Ethernet120', 'Ethernet122', 'Ethernet124', 'Ethernet126']

logical to bcm: OrderedDict([('Ethernet0', 'xe0'), ('Ethernet4', 'xe1'), ('Ethernet5', 'xe2'), ('Ethernet6', 'xe3'), ('Ethernet7', 'xe4'), ('Ethernet8', 'xe5'), ('Ethernet9', 'xe6'), ('Ethernet10', 'xe7'), ('Ethernet11', 'xe8'), ('Ethernet12', 'xe9'), ('Ethernet13', 'xe10'), ('Ethernet14', 'xe11'), ('Ethernet16', 'xe12'), ('Ethernet18', 'xe13'), ('Ethernet19', 'xe14'), ('Ethernet20', 'xe15'), ('Ethernet21', 'xe16'), ('Ethernet22', 'xe17'), ('Ethernet23', 'xe18'), ('Ethernet24', 'xe19'), ('Ethernet25', 'xe20'), ('Ethernet26', 'xe21'), ('Ethernet27', 'xe22'), ('Ethernet28', 'xe23'), ('Ethernet29', 'xe24'), ('Ethernet30', 'xe25'), ('Ethernet31', 'xe26'), ('Ethernet32', 'xe27'), ('Ethernet33', 'xe28'), ('Ethernet34', 'xe29'), ('Ethernet35', 'xe30'), ('Ethernet36', 'xe31'), ('Ethernet37', 'xe32'), ('Ethernet38', 'xe33'), ('Ethernet39', 'xe34'), ('Ethernet40', 'xe35'), ('Ethernet41', 'xe36'), ('Ethernet42', 'xe37'), ('Ethernet43', 'xe38'), ('Ethernet44', 'xe39'), ('Ethernet45', 'xe40'), ('Ethernet46', 'xe41'), ('Ethernet47', 'xe42'), ('Ethernet48', 'xe43'), ('Ethernet49', 'xe44'), ('Ethernet50', 'xe45'), ('Ethernet51', 'xe46'), ('Ethernet52', 'xe47'), ('Ethernet53', 'xe48'), ('Ethernet54', 'xe49'), ('Ethernet55', 'xe50'), ('Ethernet56', 'xe51'), ('Ethernet57', 'xe52'), ('Ethernet58', 'xe53'), ('Ethernet59', 'xe54'), ('Ethernet60', 'xe55'), ('Ethernet61', 'xe56'), ('Ethernet62', 'xe57'), ('Ethernet63', 'xe58'), ('Ethernet64', 'xe59'), ('Ethernet65', 'xe60'), ('Ethernet66', 'xe61'), ('Ethernet67', 'xe62'), ('Ethernet68', 'xe63'), ('Ethernet69', 'xe64'), ('Ethernet70', 'xe65'), ('Ethernet71', 'xe66'), ('Ethernet72', 'xe67'), ('Ethernet73', 'xe68'), ('Ethernet74', 'xe69'), ('Ethernet75', 'xe70'), ('Ethernet76', 'xe71'), ('Ethernet77', 'xe72'), ('Ethernet78', 'xe73'), ('Ethernet79', 'xe74'), ('Ethernet80', 'xe75'), ('Ethernet81', 'xe76'), ('Ethernet82', 'xe77'), ('Ethernet83', 'xe78'), ('Ethernet84', 'xe79'), ('Ethernet85', 'xe80'), ('Ethernet86', 'xe81'), ('Ethernet87', 'xe82'), ('Ethernet88', 'xe83'), ('Ethernet89', 'xe84'), ('Ethernet90', 'xe85'), ('Ethernet91', 'xe86'), ('Ethernet92', 'xe87'), ('Ethernet93', 'xe88'), ('Ethernet94', 'xe89'), ('Ethernet95', 'xe90'), ('Ethernet96', 'xe91'), ('Ethernet98', 'xe92'), ('Ethernet100', 'xe93'), ('Ethernet102', 'xe94'), ('Ethernet104', 'xe95'), ('Ethernet106', 'xe96'), ('Ethernet108', 'xe97'), ('Ethernet110', 'xe98'), ('Ethernet112', 'xe99'), ('Ethernet114', 'xe100'), ('Ethernet116', 'xe101'), ('Ethernet118', 'xe102'), ('Ethernet120', 'xe103'), ('Ethernet122', 'xe104'), ('Ethernet124', 'xe105'), ('Ethernet126', 'xe106')])

logical to physical: OrderedDict([('Ethernet0', ['1']), ('Ethernet4', ['2']), ('Ethernet5', ['2']), ('Ethernet6', ['2']), ('Ethernet7', ['2']), ('Ethernet8', ['3']), ('Ethernet9', ['3']), ('Ethernet10', ['3']), ('Ethernet11', ['3']), ('Ethernet12', ['4']), ('Ethernet13', ['4']), ('Ethernet14', ['4']), ('Ethernet16', ['5']), ('Ethernet18', ['5']), ('Ethernet19', ['5']), ('Ethernet20', ['5']), ('Ethernet21', ['5']), ('Ethernet22', ['5']), ('Ethernet23', ['5']), ('Ethernet24', ['6']), ('Ethernet25', ['6']), ('Ethernet26', ['6']), ('Ethernet27', ['6']), ('Ethernet28', ['7']), ('Ethernet29', ['7']), ('Ethernet30', ['7']), ('Ethernet31', ['7']), ('Ethernet32', ['8']), ('Ethernet33', ['8']), ('Ethernet34', ['8']), ('Ethernet35', ['8']), ('Ethernet36', ['9']), ('Ethernet37', ['9']), ('Ethernet38', ['9']), ('Ethernet39', ['9']), ('Ethernet40', ['10']), ('Ethernet41', ['10']), ('Ethernet42', ['10']), ('Ethernet43', ['10']), ('Ethernet44', ['11']), ('Ethernet45', ['11']), ('Ethernet46', ['11']), ('Ethernet47', ['11']), ('Ethernet48', ['12']), ('Ethernet49', ['12']), ('Ethernet50', ['12']), ('Ethernet51', ['12']), ('Ethernet52', ['13']), ('Ethernet53', ['13']), ('Ethernet54', ['13']), ('Ethernet55', ['13']), ('Ethernet56', ['14']), ('Ethernet57', ['14']), ('Ethernet58', ['14']), ('Ethernet59', ['14']), ('Ethernet60', ['15']), ('Ethernet61', ['15']), ('Ethernet62', ['15']), ('Ethernet63', ['15']), ('Ethernet64', ['16']), ('Ethernet65', ['16']), ('Ethernet66', ['16']), ('Ethernet67', ['16']), ('Ethernet68', ['17']), ('Ethernet69', ['17']), ('Ethernet70', ['17']), ('Ethernet71', ['17']), ('Ethernet72', ['18']), ('Ethernet73', ['18']), ('Ethernet74', ['18']), ('Ethernet75', ['18']), ('Ethernet76', ['19']), ('Ethernet77', ['19']), ('Ethernet78', ['19']), ('Ethernet79', ['19']), ('Ethernet80', ['20']), ('Ethernet81', ['20']), ('Ethernet82', ['20']), ('Ethernet83', ['20']), ('Ethernet84', ['21']), ('Ethernet85', ['21']), ('Ethernet86', ['21']), ('Ethernet87', ['21']), ('Ethernet88', ['22']), ('Ethernet89', ['22']), ('Ethernet90', ['22']), ('Ethernet91', ['22']), ('Ethernet92', ['23']), ('Ethernet93', ['23']), ('Ethernet94', ['23']), ('Ethernet95', ['23']), ('Ethernet96', ['24']), ('Ethernet98', ['24']), ('Ethernet100', ['25']), ('Ethernet102', ['25']), ('Ethernet104', ['26']), ('Ethernet106', ['26']), ('Ethernet108', ['27']), ('Ethernet110', ['27']), ('Ethernet112', ['28']), ('Ethernet114', ['28']), ('Ethernet116', ['29']), ('Ethernet118', ['29']), ('Ethernet120', ['30']), ('Ethernet122', ['30']), ('Ethernet124', ['31']), ('Ethernet126', ['31'])])

physical to logical: OrderedDict([('1', ['Ethernet0']), ('2', ['Ethernet4', 'Ethernet5', 'Ethernet6', 'Ethernet7']), ('3', ['Ethernet8', 'Ethernet9', 'Ethernet10', 'Ethernet11']), ('4', ['Ethernet12', 'Ethernet13', 'Ethernet14']), ('5', ['Ethernet16', 'Ethernet18', 'Ethernet19', 'Ethernet20', 'Ethernet21', 'Ethernet22', 'Ethernet23']), ('6', ['Ethernet24', 'Ethernet25', 'Ethernet26', 'Ethernet27']), ('7', ['Ethernet28', 'Ethernet29', 'Ethernet30', 'Ethernet31']), ('8', ['Ethernet32', 'Ethernet33', 'Ethernet34', 'Ethernet35']), ('9', ['Ethernet36', 'Ethernet37', 'Ethernet38', 'Ethernet39']), ('10', ['Ethernet40', 'Ethernet41', 'Ethernet42', 'Ethernet43']), ('11', ['Ethernet44', 'Ethernet45', 'Ethernet46', 'Ethernet47']), ('12', ['Ethernet48', 'Ethernet49', 'Ethernet50', 'Ethernet51']), ('13', ['Ethernet52', 'Ethernet53', 'Ethernet54', 'Ethernet55']), ('14', ['Ethernet56', 'Ethernet57', 'Ethernet58', 'Ethernet59']), ('15', ['Ethernet60', 'Ethernet61', 'Ethernet62', 'Ethernet63']), ('16', ['Ethernet64', 'Ethernet65', 'Ethernet66', 'Ethernet67']), ('17', ['Ethernet68', 'Ethernet69', 'Ethernet70', 'Ethernet71']), ('18', ['Ethernet72', 'Ethernet73', 'Ethernet74', 'Ethernet75']), ('19', ['Ethernet76', 'Ethernet77', 'Ethernet78', 'Ethernet79']), ('20', ['Ethernet80', 'Ethernet81', 'Ethernet82', 'Ethernet83']), ('21', ['Ethernet84', 'Ethernet85', 'Ethernet86', 'Ethernet87']), ('22', ['Ethernet88', 'Ethernet89', 'Ethernet90', 'Ethernet91']), ('23', ['Ethernet92', 'Ethernet93', 'Ethernet94', 'Ethernet95']), ('24', ['Ethernet96', 'Ethernet98']), ('25', ['Ethernet100', 'Ethernet102']), ('26', ['Ethernet104', 'Ethernet106']), ('27', ['Ethernet108', 'Ethernet110']), ('28', ['Ethernet112', 'Ethernet114']), ('29', ['Ethernet116', 'Ethernet118']), ('30', ['Ethernet120', 'Ethernet122']), ('31', ['Ethernet124', 'Ethernet126'])])

- How I did it

- How to verify it

Check whether all the below-mentioned CLI's are working correctly.

Usage: show interfaces transceiver [OPTIONS] COMMAND [ARGS]...

  Show SFP Transceiver information

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  eeprom    Show interface transceiver EEPROM information
  lpmode    Show interface transceiver low-power mode status
  presence  Show interface transceiver presence

Signed-off-by: Sangita Maity <[email protected]>

keep the old code as usual

Signed-off-by: Sangita Maity <[email protected]>
Signed-off-by: Sangita Maity <[email protected]>
@jleveque jleveque merged commit 4040326 into sonic-net:master May 29, 2020
jleveque pushed a commit to sonic-net/sonic-utilities that referenced this pull request Jun 11, 2020
Signed-off-by: Sangita Maity <[email protected]>

> This PR is dependent on [sonic-platform-common/pull/72](sonic-net/sonic-platform-common#72)

All three PRs are necessary to run `show interfaces transceiver` command.

1. [sonic-net/sonic-buildimage#3912](sonic-net/sonic-buildimage#3912)
2. [sonic-net/sonic-platform-common#72](sonic-net/sonic-platform-common#72)
3. [#767](#767)


**- What I did**
Add support of platform.json in sfputil to get correct output of `show interfaces transceiver`


**- How to verify it**
Check whether all the below-mentioned CLI's are working correctly.
```
Usage: show interfaces transceiver [OPTIONS] COMMAND [ARGS]...

  Show SFP Transceiver information

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  eeprom    Show interface transceiver EEPROM information
  lpmode    Show interface transceiver low-power mode status
  presence  Show interface transceiver presence
```
abdosi pushed a commit to abdosi/sonic-utilities that referenced this pull request Aug 4, 2020
Signed-off-by: Sangita Maity <[email protected]>

> This PR is dependent on [sonic-platform-common/pull/72](sonic-net/sonic-platform-common#72)

All three PRs are necessary to run `show interfaces transceiver` command.

1. [sonic-net/sonic-buildimage#3912](sonic-net/sonic-buildimage#3912)
2. [sonic-net/sonic-platform-common#72](sonic-net/sonic-platform-common#72)
3. [sonic-net#767](sonic-net#767)


**- What I did**
Add support of platform.json in sfputil to get correct output of `show interfaces transceiver`


**- How to verify it**
Check whether all the below-mentioned CLI's are working correctly.
```
Usage: show interfaces transceiver [OPTIONS] COMMAND [ARGS]...

  Show SFP Transceiver information

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  eeprom    Show interface transceiver EEPROM information
  lpmode    Show interface transceiver low-power mode status
  presence  Show interface transceiver presence
```
malletvapid23 added a commit to malletvapid23/Sonic-Utility that referenced this pull request Aug 3, 2023
Signed-off-by: Sangita Maity <[email protected]>

> This PR is dependent on [sonic-platform-common/pull/72](sonic-net/sonic-platform-common#72)

All three PRs are necessary to run `show interfaces transceiver` command.

1. [sonic-net/sonic-buildimage#3912](sonic-net/sonic-buildimage#3912)
2. [sonic-net/sonic-platform-common#72](sonic-net/sonic-platform-common#72)
3. [sonic-net/sonic-utilities#767](sonic-net/sonic-utilities#767)


**- What I did**
Add support of platform.json in sfputil to get correct output of `show interfaces transceiver`


**- How to verify it**
Check whether all the below-mentioned CLI's are working correctly.
```
Usage: show interfaces transceiver [OPTIONS] COMMAND [ARGS]...

  Show SFP Transceiver information

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  eeprom    Show interface transceiver EEPROM information
  lpmode    Show interface transceiver low-power mode status
  presence  Show interface transceiver presence
```
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-platform-common that referenced this pull request Oct 25, 2024
Add a field-value pair when it try to set the table inside "post_port_sfp_info_to_db" function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants