Closed RobinKaul closed 6 years ago
Sorry I forgot to show you the json flags.
-bash-4.2$ hil node show node1 --json
{u'project': u'proj', u'nics': [{u'port': u'te1/0/11', u'switch': u'switch1', u'macaddr': u'aa:bb:cc:dd:ee:01', u'networks': {u'vlan/1510': u'network1'}, u'label': u'nic1'}, {u'port': u'te1/0/12', u'switch': u'switch1', u'macaddr': u'ab:cd:ef:gh:ij:34', u'networks': {u'vlan/1512': u'fancy_name', u'vlan/1513': u'fibernet', u'vlan/1510': u'network1'}, u'label': u'nic2'}, {u'port': u'gi1/0/11', u'switch': u'switch1', u'macaddr': u'qw:er:ty:ui:op:56', u'networks': {u'vlan/1511': u'internet'}, u'label': u'nic3'}], u'name': u'node1', u'metadata': {u'SSD': u'"Samsung_EVO"', u'RAM': u'"Kingston_hyperx"', u'Processor': u'"Intel_i5"', u'Power_Supply': u'"Corsair_650"'}}
-bash-4.2$
-bash-4.2$ hil network show internet --json
{u'access': [u'proj'], u'channels': [u'vlan/native', u'vlan/1511'], u'owner': u'proj', u'name': u'internet', u'connected-nodes': {u'node1': [u'nic3'], u'node2': [u'nic4']}}
-bash-4.2$
I was able to add a title to the tables instead of having a lousy label text on top. But since I'm looping on the NIC table I wasn't able to remove the title from the individual NIC sections like shown in the previous output. So I just have an empty row between each section. How does this look?
-bash-4.2$ hil node show node1
+-------------------------+
| MAIN TABLE |
+-----------+-------------+
| ATTRIBUTE | INFORMATION |
+-----------+-------------+
| project | proj |
| name | node1 |
+-----------+-------------+
+-----------------------------------+
| NIC TABLE |
+-----------+-----------------------+
| ATTRIBUTE | INFORMATION |
+-----------+-----------------------+
| label | nic1 |
| macaddr | aa:bb:cc:dd:ee:01 |
| switch | switch1 |
| port | te1/0/11 |
| networks | network1(vlan/1510) |
| | |
| label | nic2 |
| macaddr | ab:cd:ef:gh:ij:34 |
| switch | switch1 |
| port | te1/0/12 |
| networks | fancy_name(vlan/1512) |
| | fibernet(vlan/1513) |
| | network1(vlan/1510) |
| | |
| label | nic3 |
| macaddr | qw:er:ty:ui:op:56 |
| switch | switch1 |
| port | gi1/0/11 |
| networks | internet(vlan/1511) |
| | |
+-----------+-----------------------+
+----------------------------------+
| METADATA TABLE |
+----------------+-----------------+
| METADATA LABEL | METADATA INFO |
+----------------+-----------------+
| SSD | Samsung_EVO |
| RAM | Kingston_hyperx |
| Processor | Intel_i5 |
| Power_Supply | Corsair_650 |
+----------------+-----------------+
-bash-4.2$
@radonm suggested that it would be better to have 1 table for node show because that means less scrolling. @apoorvemohan @mosayyebzadeh you guys are heavy users of the HIL CLI, any opinions on this?
@zenhack Yes sorry actually someone else had also worked on the code with me before and I didn't pay attention to this while completing it. I will clean this up and also upload the switch output by tomorrow. Please let me know if you find something else too.
@naved001 before I upload the code for the node table I wanted your input on this since I can't tag Rado for some reason as this was his suggestion. What are your thoughts @apoorvemohan @mosayyebzadeh ?
-bash-4.2$ hil node show node1
+--------------+-----------------------+
| ATTRIBUTE | INFORMATION |
+--------------+-----------------------+
| Project | proj |
| Name | node1 |
| | |
| Label | nic1 |
| Macaddr | aa:bb:cc:dd:ee:01 |
| Switch | switch1 |
| Port | te1/0/11 |
| Networks | network1(vlan/1510) |
| | |
| Label | nic2 |
| Macaddr | ab:cd:ef:gh:ij:34 |
| Switch | switch1 |
| Port | te1/0/12 |
| Networks | fancy_name(vlan/1512) |
| | fibernet(vlan/1513) |
| | network1(vlan/1510) |
| | |
| Label | nic3 |
| Macaddr | qw:er:ty:ui:op:56 |
| Switch | switch1 |
| Port | gi1/0/11 |
| Networks | internet(vlan/1511) |
| | |
| SSD | Samsung_EVO |
| RAM | Kingston_hyperx |
| Processor | Intel_i5 |
| Power_Supply | Corsair_650 |
+--------------+-----------------------+
-bash-4.2$ hil node show node2
+-----------+---------------------+
| ATTRIBUTE | INFORMATION |
+-----------+---------------------+
| Project | proj |
| Name | node2 |
| | |
| Label | nic4 |
| Macaddr | as:df:gh:jk:lz:87 |
| Switch | switch1 |
| Port | gi1/0/12 |
| Networks | internet(vlan/1511) |
| | |
+-----------+---------------------+
-bash-4.2$ hil node show node3
+-----------+-------------------+
| ATTRIBUTE | INFORMATION |
+-----------+-------------------+
| Project | proj |
| Name | node3 |
| | |
| Label | nic5 |
| Macaddr | zx:cv:bn:ma:sd:21 |
| Switch | None |
| Port | None |
| Networks | None |
| | |
+-----------+-------------------+
-bash-4.2$ hil node show node4
+-----------+-------------+
| ATTRIBUTE | INFORMATION |
+-----------+-------------+
| Project | None |
| Name | node4 |
| | |
+-----------+-------------+
-bash-4.2$
And I know I haven't uploaded the switch code yet but needed input on this too.
-bash-4.2$ hil switch show switch1
+--------------+-----------------------+
| ATTRIBUTE | INFORMATION |
+--------------+-----------------------+
| name | switch1 |
| capabilities | nativeless-trunk-mode |
| ports | te1/0/11 |
| | te1/0/12 |
| | gi1/0/11 |
| | gi1/0/12 |
| | gi1/0/13 |
+--------------+-----------------------+
-bash-4.2$ hil switch show switch2
+--------------+-----------------------+
| ATTRIBUTE | INFORMATION |
+--------------+-----------------------+
| name | switch2 |
| capabilities | nativeless-trunk-mode |
| ports | None |
+--------------+-----------------------+
-bash-4.2$
One command should display one table (not multiple), so second option looks better to me
Updates:
Variable name changes for node and networks
Output changes
Raw output to json dumps
Correction to node output for connected nodes including link aggregation
Added switch output
Added port output
@RobinKaul Do you think you will have time to finish this, or can someone else take over?
@naved001 It'll be better if someone can take over if you're in a pinch for time.
closing this in favor of #1051
I have opened a new request so ignore the last one. Here are my changes to the CLI output:
Added a json flag for raw output of network show, network list, node show and node list.
Added prettytables for network, node and switch outputs.
Here is my current output:
What are your opinions?