From e15b27742cebc4092af7d743c1350f09bd49bb96 Mon Sep 17 00:00:00 2001 From: Tejaswi Goel Date: Wed, 25 Sep 2019 17:17:32 -0700 Subject: [PATCH] Changes in show port-channel command Signed-off-by: Tejaswi Goel --- src/CLI/actioner/sonic-cli-if.py | 78 +++++++++---------- src/CLI/clitree/cli-xml/interface.xml | 62 ++++++++------- src/CLI/clitree/cli-xml/sonic_types.xml | 14 ++++ .../renderer/templates/show_portchannel.j2 | 9 ++- .../renderer/templates/show_portchannel_id.j2 | 8 -- 5 files changed, 89 insertions(+), 82 deletions(-) delete mode 100644 src/CLI/renderer/templates/show_portchannel_id.j2 diff --git a/src/CLI/actioner/sonic-cli-if.py b/src/CLI/actioner/sonic-cli-if.py index af02afcec8..5fe245442d 100755 --- a/src/CLI/actioner/sonic-cli-if.py +++ b/src/CLI/actioner/sonic-cli-if.py @@ -101,50 +101,44 @@ def run(func, args): if "PortChannel" in args[0] and func.__name__ == 'patch_openconfig_interfaces_interfaces_interface': return - dummy_data= { - "openconfig-interfaces:interface": [ - { - "members": [ - "Ethernet56", - "Ethernet60" - ], - "min-links": 2, - "mtu": 9100, - "admin_status": "up", - "oper_status": "down", - "name": "PortChannel1" - }, - { - "members": [], - "min-links": 1, - "mtu": 9100, - "admin_status": "up", - "oper_status": "down", - "name": "PortChannel2" - }, - { - "members": [], - "min-links": 1, - "mtu": 9100, - "admin_status": "up", - "oper_status": "down", - "name": "PortChannel3" - } - ] -} - - #show given port-channel details - if "PortChannel" in args[0] and func.__name__ == 'get_openconfig_if_aggregate_interfaces_interface_aggregation_state': - for dict in dummy_data['openconfig-interfaces:interface']: - if dict["name"] == "PortChannel3": - show_cli_output("show_portchannel_id.j2", dict) - return - print("%Error: Entry not found") - return - #show port-channels summary if "PortChannel" in args[0] and func.__name__ == 'get_openconfig_interfaces_interfaces': - show_cli_output("show_portchannel.j2", dummy_data) + + dummy_resp= { + "PORTCHANNEL": [ + { + "members": [ + "Ethernet56", + "Ethernet60" + ], + "min-links": 2, + "mtu": 9100, + "admin_status": "up", + "oper_status": "down", + "name": "PortChannel1", + "id": "1" + }, + { + "members": [], + "min-links": 1, + "mtu": 9100, + "admin_status": "up", + "oper_status": "down", + "name": "PortChannel12", + "id": "12" + }, + { + "members": [], + "min-links": 1, + "mtu": 9100, + "admin_status": "up", + "oper_status": "down", + "name": "PortChannel3", + "id": "3" + } + ] + } + show_cli_output(args[1], dummy_resp) return #add members to port-channel diff --git a/src/CLI/clitree/cli-xml/interface.xml b/src/CLI/clitree/cli-xml/interface.xml index a72827413e..10cbe9398b 100644 --- a/src/CLI/clitree/cli-xml/interface.xml +++ b/src/CLI/clitree/cli-xml/interface.xml @@ -98,23 +98,15 @@ limitations under the License. - - - - if test "${lag-id}" = ""; then - python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_interfaces_interfaces PortChannel show_portchannel.j2 - else - python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_if_aggregate_interfaces_interface_aggregation_state PortChannel${lag-id} show_portchannel_id.j2#xA; - fi + mode="subcommand" /> + + + python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_interfaces_interfaces PortChannel show_portchannel.j2 @@ -163,7 +155,7 @@ limitations under the License. python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_interfaces_interfaces_interface PortChannel${lag-id} @@ -210,7 +202,7 @@ limitations under the License. @@ -261,14 +253,25 @@ limitations under the License. help="Remove MTU"> python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_interfaces_interfaces_interface_config_mtu ${iface} 9100 + + + - + - python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_if_aggregate_interfaces_interface_ethernet_config_aggregate_id ${iface} ${lag-id} + ptype="LAG_ID"/> + python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_if_aggregate_interfaces_interface_ethernet_config_aggregate_id ${iface} ${lag-id} + ptype="MIN_LINK" /> python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_if_aggregate_interfaces_interface_aggregation_config_min_links ${po_id} ${min-links} + + - @@ -485,6 +489,7 @@ limitations under the License. name="addr" help="IP address with mask" ptype="IP_ADDR_MASK" /> + + diff --git a/src/CLI/clitree/cli-xml/sonic_types.xml b/src/CLI/clitree/cli-xml/sonic_types.xml index 6b33089605..09a23fe5ef 100644 --- a/src/CLI/clitree/cli-xml/sonic_types.xml +++ b/src/CLI/clitree/cli-xml/sonic_types.xml @@ -41,6 +41,20 @@ limitations under the License. help="" /> + + + +