Create a subcommands using KLISH 3.0

27 views
Skip to first unread message

Vivek Singh

unread,
Oct 22, 2024, 4:49:27 AM10/22/24
to klish
Hi,

I am trying to create subcommands and hieratical commands using KLISH 3.0. Since i am new to klish just wanted to understand how do we do the same.

My main view should have 
configure 
show 

this can be achieved via 
        <COMMAND name="configure" help="Configure system">
                <ACTION sym="nav">replace config-view</ACTION>
        </COMMAND>
        <COMMAND name="show" help="show system">
                <ACTION sym="nav">replace priv-view</ACTION>
        </COMMAND>

Inside Config view :
i need to have multiple option like :

  id-profile                           Circuit id and remote id format profile for DHCP snoop and PPPoE IA
  igmp-profile                         Configure IGMP Profiles
  igmp-ssm-map                         Configure a static mapping of a source to a SSM group range
  interface                            Configure Interface
  ip                                   IP configuration
  ip-unicast-rpf                       Unicast RPF

I can create these with <COMMANDS> tag 

but now if i choose command : interface 

(config)# interface ?
Description: Configure Interface
Description: Configure interfaces
Possible completions:
  channel-group        wavelength channel group
  craft                Craft Port
  ethernet             Ethernet ports
  ffp                  fast facility protection group
  full-bridge          full bridge logical interface
  lag                  LAG groups
  loopback             Loopback

then if i choose ethernet

CLX3001(config)# interface ethernet 1/1/x1 ?
Description: Ethernet ports
Possible completions:
  alarm-suppression   Suppress all alarms associated with the specified object
  arp                 Interface arp configuration
  cosq                CoSQ reference for the port
  description         Ethernet port description (255 characters maximum)
   duplex


so you see that inside config mode, we can type in a single line all the values 
something like this :
(config)# interface ethernet 1/1/x1 mtu 2000 description vivek duplex full

How do we achieve this..

Do we have any sample XML for this design approach?

Regards,
Vivek Kumar Singh

 

Serj Kalichev

unread,
Oct 22, 2024, 7:48:33 AM10/22/24
to kl...@googlegroups.com
I don't understand the question. If you want to duplicate klish-2.0 behaviour then use nested COMMAND. The COMMAND inside another COMMAND tag is a SUBCOMMAND. In this case klish-3 can do things like klish-2 does.

If you want to use sysrepo then see examples. The configure view contains COMMANDs like "set", "del" etc to deal with YANG scheme.

22.10.2024 11:49, Vivek Singh пишет:
--
You received this message because you are subscribed to the Google Groups "klish" group.
To unsubscribe from this group and stop receiving emails from it, send an email to klish+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/klish/f74d8b18-afc5-4098-a169-2443bd0cac7an%40googlegroups.com.


Reply all
Reply to author
Forward
0 new messages