I have three nested views, but I found that the 3rd view can't find the 1st view's id.
My xml is as below.
<?xml version="1.0" encoding="utf-8"?>
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema http://clish.sourceforge.net/XMLSchema/clish.xsd">
<VIEW name="configure-view">
<COMMAND help="System operation configuration." name="system"></COMMAND>
<COMMAND help="System operation configuration." name="no system"></COMMAND>
<COMMAND help="Configure interfaces." viewid="interface=${name}" name="system interface" view="configure-system-interface-view">
<PARAM help="Name." name="name" ptype="STRING"></PARAM>
<ACTION>echo /api/v2/cmdb/system/interface/${interface}</ACTION>
<CONFIG pattern="^${__line}$"></CONFIG>
</COMMAND>
<COMMAND help="Configure interfaces." name="no system interface">
<ACTION>echo ${name}</ACTION>
<CONFIG operation="unset" pattern="^system interface ${name}"></CONFIG>
<PARAM help="Name." name="name" ptype="STRING"></PARAM>
</COMMAND>
<VIEW name="configure-system-interface-view" prompt="(config-system-interface-${interface})# " depth="1">
<NAMESPACE completion="true" ref="configure-view" help="false"></NAMESPACE>
<COMMAND lock="false" help="Exit from current mode" name="exit">
<ACTION builtin="clish_nested_up"></ACTION>
</COMMAND>
<COMMAND help="Negate a command or set its defaults" name="no"></COMMAND>
<COMMAND help="VRRP configuration." viewid="vrrp=${vrid}" name="vrrp" view="configure-system-interface-vrrp-view">
<PARAM help="Virtual router identifier (1 - 255)." name="vrid" ptype="INTEGER"></PARAM>
<ACTION>echo /api/v2/cmdb/system/interface/${interface}/vrrp/${vrrp}</ACTION>
<CONFIG pattern="^${__line}$"></CONFIG>
</COMMAND>
<COMMAND help="VRRP configuration." name="no vrrp">
<ACTION>echo ${vrid}</ACTION>
<CONFIG operation="unset" pattern="^vrrp ${vrid}"></CONFIG>
<PARAM help="Virtual router identifier (1 - 255)." name="vrid" ptype="INTEGER"></PARAM>
</COMMAND>
<VIEW name="configure-system-interface-vrrp-view" prompt="(config-system-interface-vrrp-${vrrp})# " depth="2">
<NAMESPACE completion="true" ref="configure-system-interface-view" help="false"></NAMESPACE>
<COMMAND lock="false" help="Exit from current mode" name="exit">
<ACTION builtin="clish_nested_up"></ACTION>
</COMMAND>
<COMMAND help="Negate a command or set its defaults" name="no"></COMMAND>
<COMMAND help="VRRP Proxy ARP configuration." viewid="proxy-arp=${id}" name="proxy-arp" view="configure-system-interface-vrrp-proxy-arp-view">
<PARAM help="ID." name="id" ptype="INTEGER"></PARAM>
<ACTION>echo /api/v2/cmdb/system/interface/${interface}/vrrp/${vrrp}/proxy-arp/${proxy-arp}</ACTION>
<CONFIG pattern="^${__line}$"></CONFIG>
</COMMAND>
<COMMAND help="VRRP Proxy ARP configuration." name="no proxy-arp">
<ACTION>echo ${id}</ACTION>
<CONFIG operation="unset" pattern="^proxy-arp ${id}"></CONFIG>
<PARAM help="ID." name="id" ptype="INTEGER"></PARAM>
</COMMAND>
<VIEW name="configure-system-interface-vrrp-proxy-arp-view" prompt="(config-system-interface-vrrp-proxy-arp-${proxy-arp})# " depth="3">
<NAMESPACE completion="true" ref="configure-system-interface-vrrp-view" help="false"></NAMESPACE>
<COMMAND lock="false" help="Exit from current mode" name="exit">
<ACTION builtin="clish_nested_up"></ACTION>
</COMMAND>
<COMMAND help="Negate a command or set its defaults" name="no"></COMMAND>
</VIEW>
</VIEW>
</VIEW>
</VIEW>
</CLISH_MODULE>
And the operation flow is as below.
/ # konfd/ # clish -x /etc/klish# configure terminal(config)#! Commentsdo To run exec commands in config modeexit Exit from configure modehostname Set system's network nameip Global IP configuration subcommandsno Negate a command or set its defaultssystem System operation configuration.(config)# system interfaceString Name.(config)# system interface mgmt/api/v2/cmdb/system/interface/(config-system-interface-mgmt)#! Commentsexit Exit from current modeno Negate a command or set its defaultsvrrp VRRP configuration.(config-system-interface-mgmt)# vrrp 1/api/v2/cmdb/system/interface/mgmt/vrrp/(config-system-interface-vrrp-1)#! Commentsexit Exit from current modeno Negate a command or set its defaultsproxy-arp VRRP Proxy ARP configuration.(config-system-interface-vrrp-1)# proxy-arpInteger ID.(config-system-interface-vrrp-1)# proxy-arp 2/api/v2/cmdb/system/interface//vrrp/1/proxy-arp/(config-system-interface-vrrp-proxy-arp-2)#
It is bad that the inner ”configure-system-interface-vrrp-proxy-arp-view“ can't get the outter ”configure-system-interface-view“ viewid mgmt.
So what can I do? I didn't find any useful informations from the wiki.
Hello
The viewid vars is active on the current level only i.e. within the target VIEW only.
You need something like this:
<COMMAND help="Configure
interfaces." viewid="interface=${name}" name="system
interface" view="configure-system-interface-view">
...
<COMMAND help="VRRP
configuration." viewid="
interface=${interface};
vrrp=${vrid}" name="vrrp" view="configure-system-interface-vrrp-view">
...
--
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/47ef8628-de0e-4e14-9e04-3cfc549af603%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to kl...@googlegroups.com.