sonic-buildimage icon indicating copy to clipboard operation
sonic-buildimage copied to clipboard

How to access LUA CLI or hardware prompt from SONiC

Open AravindSubramanian123 opened this issue 10 months ago • 6 comments

Description

 We are unable to access luacli from SONIC. Need a way/procedure to access the hardware prompt from SONiC

root@str-msn2700-01:~# show version

SONiC Software Version: SONiC.202211.2.2.a1.3 SONiC OS Version: 11 Distribution: Debian 11.8 Kernel: 5.10.0-18-2-arm64 Build commit: 710fe7dbe Build date: Mon Jan 8 03:08:49 UTC 2024 Built by: roger@ubuntu-arm

Platform: arm64-wistron_es2227_54ts_p-r0 HwSKU: wistron_es2227_54ts_p ASIC: marvell ASIC Count: 1 Serial Number: 68104P01000333000013M0LA Model Number: ES-2227-54TS-P-O Hardware Revision: 0 Uptime: 19:01:53 up 1 day, 3:30, 1 user, load average: 0.79, 0.99, 0.82 Date: Sat 29 Jul 2023 19:01:53

AravindSubramanian123 avatar Apr 09 '24 09:04 AravindSubramanian123

@AravindSubramanian123 please share more details on luacli.

judyjoseph avatar Apr 10 '24 15:04 judyjoseph

@saksarav-nokia please share some information on the changes needed.

judyjoseph avatar Apr 10 '24 15:04 judyjoseph

Here are the instructions we received from Marvell. Not sure if the patch is already in main.py

  1. Add the following to /usr/local/lib/python3.9/dist-packages/config/main.py before “if name == 'main':”

@config.group(cls=clicommon.AbbreviationGroup) @click.pass_context def switch(ctx): """switch related config""" pass

@switch.command('sdk_shell') @click.pass_context @click.argument('en', metavar='', required=True, type=click.Choice(['enable', 'disable'])) def set_sdk_diag_shell(ctx, en): tmp_file = "/tmp/swss.json" json_file = "/etc/swss/config.d/switch.json"

try:
    os.remove(tmp_file)
except:
    pass

command = " docker cp   swss:" + json_file + " " + tmp_file
print(command)
subprocess.Popen(command, shell=True)
time.sleep(2)

with open (tmp_file, "r") as f:
    cfg = json.load(f)

cfg[0]["SWITCH_TABLE:switch"]["debug_shell_enable"] = 1 if en == 'enable' else 0

with open (tmp_file, "w") as f:
    json.dump(cfg,f,indent=4, ensure_ascii=False)

command = " docker cp  " + tmp_file +" "+ "swss:"+json_file
subprocess.Popen(command, shell=True)
time.sleep(2)

command = "docker exec swss swssconfig " + json_file
subprocess.Popen(command, shell=True)
  1. sudo config switch sdk_shell enable
  2. sudo docker cp syncd:/usr/bin/mrvlcmd /usr/bin/.
  3. mrvlcmd -c “show interfaces status all” or any other command.

saksarav-nokia avatar Apr 10 '24 16:04 saksarav-nokia

Hi @saksarav-nokia

I updated the patch shared and tried the commands shared but I am facing the following issue. I have listed below the issue seen.

Logs: root@str-msn2700-01:~# mrvlcmd -c “show interfaces status all” end Console# set output nopause Console# “show Error in command line: “show. Command : "“show" Console# CLIexit

Kindly let me know if there is any CLIs to access LUACLI. From the commands shared I can observe that after executing the CLI, it exits from the LUACLI. Is there any option to not exit the prompt and execute multiple CLIs.

mithun2498 avatar Apr 15 '24 12:04 mithun2498

we are unable to edit the mrvlcmd since it is a binary. do we have source file for this, so that we try add our required commands and generate one binary. tried to locate mrvlcmd.c file but not able to get.

Option of accessing console and not exiting out automatically is also fine for us. Instead of mrvlcmd itself pushing CLIexit, we need to access console and do our required config, after all our configs and verification we manually give CLIexit and come out

AravindSubramanian123 avatar Apr 15 '24 17:04 AravindSubramanian123

@mithun2498 @AravindSubramanian123 , Those were the only instructions i know. Please contact Marvell if that doesn't help.

saksarav-nokia avatar Apr 15 '24 17:04 saksarav-nokia

Hello @saksarav-nokia

We are now able to execute mrvlcmd based commands. We checked this command (mrvlcmd -c "show mac pdu device 0") to check the packet action of LACP and LLDP. The packet action was "trap to cpu" by default. This was updated to "forward" using the below command, (mrvlcmd -c “configure; mac pdu protocol lacp forward device 0;end”) but the packet drop is still seen on the switch.

Kindly help us on this!

Logs:

Command: mrvlcmd -c "show mac pdu device 0" Console# set output nopause Console# show mac pdu device 0 Dev Protocol Descript DA=01-80-C2-00-00-XX Packet command

0 bpdu 802.1Q BPDU DA=-00 drop 0 lacp 802.3 Slow Protocols DA=-02 trap_to_cpu 0 pae 802.1X PAE address DA=-03 forward 0 lldp 802.1AB LLDP DA=-0E trap_to_cpu 0 gmrp 802.1D GMRP DA=-20 forward 0 gvrp 802.1Q GVRP DA=-21 forward 0 providerBPDU 802.1Q Provider BPDU DA=-08 forward 0 providerGVRP 802.1Q Bridge GVRP DA=-0D forward Console# CLIexit

Modified the slow protocol status to forward.

Command: mrvlcmd -c “configure; mac pdu protocol lacp forward device 0;end” Console# show mac pdu device 0 Dev Protocol Descript DA=01-80-C2-00-00-XX Packet command

0 bpdu 802.1Q BPDU DA=-00 drop 0 lacp 802.3 Slow Protocols DA=-02 forward 0 pae 802.1X PAE address DA=-03 forward 0 lldp 802.1AB LLDP DA=-0E forward 0 gmrp 802.1D GMRP DA=-20 forward 0 gvrp 802.1Q GVRP DA=-21 forward 0 providerBPDU 802.1Q Provider BPDU DA=-08 forward 0 providerGVRP 802.1Q Bridge GVRP DA=-0D forward Console# CLIexit

mithun2498 avatar Apr 22 '24 17:04 mithun2498