[show] fix "show interfaces breakout" command#1198
[show] fix "show interfaces breakout" command#1198qiluo-msft merged 2 commits intosonic-net:masterfrom
Conversation
52e069b to
ad1ca76
Compare
|
Fixed fails: |
|
@praveen-li to review |
|
Hope this fix can be pushed soon |
show/interfaces/__init__.py
Outdated
There was a problem hiding this comment.
@samaity : Hi Sangita, as I know, we do not provide platform.json like this. We need a call to device_info.get_path_to_port_config_file(). Kindly confirm, if yes, I will mark it as a change needed.
There was a problem hiding this comment.
@praveen-li, I saw device_info.get_path_to_port_config_file() logic, I think its better way to find PLATFORM.json, so PR was updated.
Please take a look.
There was a problem hiding this comment.
We didn't have get_path_to_port_config_file available when the show breakout functionality was added. This is absolutely the better way to get the path. Thanks for the update!
c65dfe2 to
002d858
Compare
|
This pull request introduces 2 alerts when merging 002d8587cb30db2275cf8f595fc8190146af0276 into 05c8e33 - view on LGTM.com new alerts:
|
002d858 to
d93dae6
Compare
|
This pull request introduces 2 alerts when merging d93dae67e644c25a3010469c52b8dcfed088455c into 05c8e33 - view on LGTM.com new alerts:
|
1bf7554 to
b324e90
Compare
|
@praveen-li @daall @lguohan can we merge this PR? its very comfortably to see information related to DPB using show command |
praveen-li
left a comment
There was a problem hiding this comment.
Look Good to Me.
@samaity for quick double-check.
|
@praveen-li @samaity thanks for the review |
|
@vdahiya12 @qiluo-msft @renukamanavalan please take a look and review/merge this PR. Thanks. |
| try: | ||
| with open(fileName) as f: | ||
| result = json.load(f) | ||
| except Exception as e: |
There was a problem hiding this comment.
Exception [](start = 11, length = 9)
Could you catch the specific type/types? such as file exception, json format exceptions, etc? #Closed
show/interfaces/__init__.py
Outdated
| with open(fileName) as f: | ||
| result = json.load(f) | ||
| except Exception as e: | ||
| click.echo(str(e)) |
There was a problem hiding this comment.
echo [](start = 14, length = 4)
echo to stderr #Closed
344d455
|
@qiluo-msft done, please check |
|
@qiluo-msft please merge |
**- What I did**
Fixed `show interface breakout` command
**- How I did it**
**- How to verify it**
From command line type `show interface breakout`
**- Previous command output (if the output of a command-line utility has changed)**
```
Traceback (most recent call last):
File "/usr/local/bin/show", line 10, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1114, in invoke
return Command.invoke(self, ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/show/interfaces/__init__.py", line 135, in breakout
config_db = ConfigDBConnector()
NameError: global name 'ConfigDBConnector' is not defined
```
**- New command output (if the output of a command-line utility has changed)**
Related from DPB config.
e.g.
```
{
"Ethernet0": {
"index": "0,0,0,0",
"default_brkout_mode": "1x100G[40G]",
"child ports": "Ethernet0",
"breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)",
"child port speeds": "100G",
"Current Breakout Mode": "1x100G[40G]",
"lanes": "25,26,27,28",
"alias_at_lanes": "Ethernet0/0,Ethernet0/1,Ethernet0/2,Ethernet0/3"
}
}
```
**- What I did**
Fixed `show interface breakout` command
**- How I did it**
**- How to verify it**
From command line type `show interface breakout`
**- Previous command output (if the output of a command-line utility has changed)**
```
Traceback (most recent call last):
File "/usr/local/bin/show", line 10, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1114, in invoke
return Command.invoke(self, ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/show/interfaces/__init__.py", line 135, in breakout
config_db = ConfigDBConnector()
NameError: global name 'ConfigDBConnector' is not defined
```
**- New command output (if the output of a command-line utility has changed)**
Related from DPB config.
e.g.
```
{
"Ethernet0": {
"index": "0,0,0,0",
"default_brkout_mode": "1x100G[40G]",
"child ports": "Ethernet0",
"breakout_modes": "1x100G[40G],2x50G,4x25G[10G],2x25G(2)+1x50G(2),1x50G(2)+2x25G(2)",
"child port speeds": "100G",
"Current Breakout Mode": "1x100G[40G]",
"lanes": "25,26,27,28",
"alias_at_lanes": "Ethernet0/0,Ethernet0/1,Ethernet0/2,Ethernet0/3"
}
}
```
|
swsssdk is deprecated largely in sonic-utilities. Could you adapt the new |
- What I did
Fixed
show interface breakoutcommand- How I did it
- How to verify it
From command line type
show interface breakout- Previous command output (if the output of a command-line utility has changed)
- New command output (if the output of a command-line utility has changed)
Related from DPB config.
e.g.