diff --git a/src/CLI/actioner/sonic-cli-if.py b/src/CLI/actioner/sonic-cli-if.py index 9ed5f27006..e858fbb071 100755 --- a/src/CLI/actioner/sonic-cli-if.py +++ b/src/CLI/actioner/sonic-cli-if.py @@ -44,6 +44,7 @@ def call_method(name, args): def generate_body(func, args): body = None + keypath = [] # Get the rules of all ACL table entries. if func.__name__ == 'patch_openconfig_interfaces_interfaces_interface_config_description': keypath = [ args[0] ] @@ -98,6 +99,11 @@ def run(func, args): keypath, body = generate_body(func, args) try: + # Temporary code for #show vlan command with dummy data + if func.__name__ == "get_openconfig_vlan_interfaces_interface_ethernet_switched_vlan_state": + api_response = {'Vlan100': {'Ethernet20': 'tagged', 'Ethernet40': 'untagged'}} + show_cli_output(args[0], api_response) + return if body is not None: api_response = getattr(aa,func.__name__)(*keypath, body=body) else : diff --git a/src/CLI/clitree/cli-xml/interface.xml b/src/CLI/clitree/cli-xml/interface.xml index 3341170d76..0ded9aabfd 100644 --- a/src/CLI/clitree/cli-xml/interface.xml +++ b/src/CLI/clitree/cli-xml/interface.xml @@ -23,89 +23,150 @@ limitations under the License. http://www.dellemc.com/sonic/XMLSchema/clish.xsd" > - + - - + > + + - - - - - - - - - if test "${if-subcommands}" = "status"; then - python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_interfaces_interfaces show_interface_status.j2 ${__full_line} - elif test "${if-subcommands}" = "counters"; then - python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_interfaces_interfaces show_interface_counters.j2 ${__full_line} - else - if test "${phy-if-id}" = ""; then - python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_interfaces_interfaces show_interface.j2 ${__full_line} - else - python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_interfaces_interfaces_interface Ethernet${phy-if-id} show_interface_id.j2 ${__full_line} - fi - fi - - - + + + + + + + + + if test "${if-subcommands}" = "status"; then + python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_interfaces_interfaces show_interface_status.j2 ${__full_line} + elif test "${if-subcommands}" = "counters"; then + python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_interfaces_interfaces show_interface_counters.j2 ${__full_line} + else + if test "${phy-if-id}" = ""; then + python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_interfaces_interfaces show_interface.j2 ${__full_line} + else + python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_interfaces_interfaces_interface Ethernet${phy-if-id} show_interface_id.j2 ${__full_line} + fi + fi + + + + + + + + python $SONIC_CLI_ROOT/sonic-cli-if.py get_openconfig_vlan_interfaces_interface_ethernet_switched_vlan_state show_vlan.j2 + + + + - + + + + - + + + + + + + + + + + + + - - - - - + + + + + + - - python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_interfaces_interfaces_interface_config_enabled ${iface} False - - - python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_interfaces_interfaces_interface_config_enabled ${iface} True - - - - python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_interfaces_interfaces_interface_config_description ${iface} ${desc} + python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_interfaces_interfaces_interface_config_description ${iface} ${desc} - python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_interfaces_interfaces_interface_config_description ${iface} "" + python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_interfaces_interfaces_interface_config_description ${iface} "" - - python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_interfaces_interfaces_interface_config_mtu ${iface} ${mtu} + python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_interfaces_interfaces_interface_config_mtu ${iface} ${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_interfaces_interfaces_interface_config_enabled ${iface} False + + + python $SONIC_CLI_ROOT/sonic-cli-if.py patch_openconfig_interfaces_interfaces_interface_config_enabled ${iface} True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/CLI/renderer/templates/show_vlan.j2 b/src/CLI/renderer/templates/show_vlan.j2 new file mode 100644 index 0000000000..aabb216869 --- /dev/null +++ b/src/CLI/renderer/templates/show_vlan.j2 @@ -0,0 +1,23 @@ +{% set vars = {'vlanName': ""} %} +{% set vars = {'ifName': ""} %} +{% set vars = {'tagMode': ""} %} +{% set vars = {'tagLetter': ""} %} +{% if json_output -%} +Q: A - Access (Untagged), T - Tagged +{{'%-11s'|format("NUM")}}{{'%-2s'|format("Q Ports")}} +{% for vlanKey, memberEntries in json_output.items() %} +{% if vars.update({'vlanName':vlanKey}) %}{% endif %} +{% for ifKey, ifMode in memberEntries.items() %} +{% if vars.update({'ifName':ifKey}) %}{% endif %} +{% if vars.update({'tagMode':ifMode}) %}{% endif %} +{% if ifMode == "untagged" %} +{% if vars.update({'tagLetter':" U "}) %}{% endif %} +{% else %} +{% if vars.update({'tagLetter':" T "}) %}{% endif %} +{% endif %} +{{'%-10s'|format(vars.vlanName)}}{{'%-2s'|format(vars.tagLetter)}}{{'%-10s'|format(vars.ifName)}} +{% if vars.update({'vlanName':''}) %}{% endif %} +{% endfor %} +{% endfor %} +{% endif %} +