Browse Source

Add xml-examples without symlinks

Serj Kalichev 11 years ago
parent
commit
4c56c7d55f

+ 23 - 0
xml-examples/klish/etc/clish-enable/common.xml

@@ -0,0 +1,23 @@
+<?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">
+	<!--=======================================================-->
+
+<COMMAND name="exit"
+	help="Exit from the CLI"
+	lock="false">
+	<ACTION builtin="clish_close"/>
+</COMMAND>
+
+<COMMAND name="!"
+	help="Comments"
+	args="comment"
+	args_help="ignored comment text">
+	<ACTION builtin="clish_nop"/>
+</COMMAND>
+
+</CLISH_MODULE>
+
+

+ 56 - 0
xml-examples/klish/etc/clish-enable/configure-mode.xml

@@ -0,0 +1,56 @@
+<?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"
+	prompt="${SYSTEM_NAME}(config)# "
+	restore="depth">
+
+<!-- Inheritance -->
+
+	<NAMESPACE ref="enable-view" 
+		prefix="do"
+		help="true"
+		completion="true"/>
+
+	<COMMAND name="do"
+		help="To run exec commands in config mode"/>
+
+<!-- Virtual commands -->
+
+	<COMMAND name="no"
+		help="Negate a command or set its defaults"/>
+
+	<COMMAND name="ip"
+		help="Global IP configuration subcommands"/>
+
+	<COMMAND name="no ip"
+		help="Global IP configuration subcommands"/>
+
+<!-- Simple configuration mode commands -->
+
+	<COMMAND name="exit"
+		help="Exit from configure mode"
+		view="enable-view"
+		lock="false">
+	</COMMAND>
+
+	<COMMAND name="hostname"
+		help="Set system's network name">
+		<PARAM name="hostname"
+			help="This system's network name"
+			ptype="STRING"/>
+		<CONFIG priority="0x1000"/>
+		<ACTION>
+		hostname "${hostname}"
+		echo "${hostname}" > /etc/hostname
+		sed -i "s|^127\.0\.0\.1.*$|127.0.0.1 localhost ${hostname}|" /etc/hosts
+		</ACTION>
+	</COMMAND>
+
+</VIEW>
+
+</CLISH_MODULE>

+ 74 - 0
xml-examples/klish/etc/clish-enable/enable-mode.xml

@@ -0,0 +1,74 @@
+<?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="enable-view"
+	prompt="${SYSTEM_NAME}# ">
+
+<!-- Inheritance -->
+
+	<NAMESPACE ref="ping-view"
+		help="true"
+		completion="true"/>
+
+<!-- Simple enable mode commands -->
+
+	<COMMAND name="disable"
+		help="Turn off privileged commands">
+		<ACTION builtin="clish_close"/>
+	</COMMAND>
+
+	<COMMAND name="reboot"
+		help="Halt and perform a cold restart">
+		<ACTION>reboot</ACTION>
+	</COMMAND>
+
+	<COMMAND name="configure"
+		help="Enter configuration mode"/>
+
+	<COMMAND name="configure terminal"
+		help="Configure from the terminal"
+		view="configure-view">
+	</COMMAND>
+
+<!-- Show commands -->
+
+	<COMMAND name="show"
+		help="Show running system information"/>
+
+	<COMMAND name="show ip"
+		help="IP information"/>
+
+	<COMMAND name="show diag"
+		help="Show diagnostic information for port adapters/modules">
+		<ACTION>lspci</ACTION>
+	</COMMAND>
+
+	<COMMAND name="show running-config"
+		help="Current operating configuration">
+		<CONFIG operation="dump"/>
+	</COMMAND>
+
+	<COMMAND name="show startup-config"
+		help="Contents of startup configuration">
+		<ACTION>cat /etc/startup-config</ACTION>
+	</COMMAND>
+
+<!-- Copy commands -->
+
+	<COMMAND name="copy"
+		help="Copy from one file to another"/>
+
+	<COMMAND name="copy running-config"
+		help="Copy from current system configuration"/>
+
+	<COMMAND name="copy running-config startup-config"
+		help="Copy to startup configuration">
+		<CONFIG operation="dump" file="/etc/startup-config"/>
+	</COMMAND>
+
+</VIEW>
+
+</CLISH_MODULE>

+ 120 - 0
xml-examples/klish/etc/clish-enable/interface.xml

@@ -0,0 +1,120 @@
+<?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="enable-view">
+
+	<COMMAND name="show interfaces"
+		help="Interface status and configuration">
+		<ACTION>ip addr show</ACTION>
+	</COMMAND>
+
+	<COMMAND name="show ip interface"
+		help="IP interface status and configuration">
+		<ACTION>ip addr show</ACTION>
+	</COMMAND>
+
+</VIEW>
+
+<VIEW name="configure-view">
+
+	<COMMAND name="interface"
+		help="Select an interface to configure"/>
+
+	<COMMAND name="interface ethernet"
+		help="Ethernet IEEE 802.3"
+		view="configure-if-view"
+		viewid="iface=eth${iface_num}">
+		<PARAM name="iface_num"
+			help="Ethernet interface number"
+			ptype="IFACE_NUM"/>
+		<CONFIG priority="0x2001" pattern="^${__line}$"/>
+	</COMMAND>
+
+</VIEW>
+
+<VIEW name="configure-if-view"
+	prompt="${SYSTEM_NAME}(config-if-${iface})# "
+	depth="1">
+
+<!-- Inheritance -->
+
+	<NAMESPACE ref="configure-view"
+		help="false"
+		completion="true"/>
+
+<!-- Simple configure-if mode commands -->
+
+	<COMMAND name="exit"
+		help="Exit from interface configuration mode"
+		lock="false">
+		<ACTION builtin="clish_nested_up"/>
+	</COMMAND>
+
+	<COMMAND name="no"
+		help="Negate a command or set its defaults"/>
+
+	<COMMAND name="ip"
+		help="Interface Internet Protocol config commands"/>
+
+	<COMMAND name="no ip"
+		help="Interface Internet Protocol config commands"/>
+
+<!-- IP address -->
+
+	<COMMAND name="ip address"
+		help="Set the IP address of an interface">
+		<PARAM name="ip_method"
+			help="Method to get IP"
+			ptype="SUBCOMMAND"
+			mode="switch">
+			<PARAM name="dhcp"
+				help="IP Address negotiated via DHCP"
+				ptype="SUBCOMMAND"
+				mode="subcommand"/>
+			<PARAM name="ip"
+				help="IP address"
+				ptype="IP_ADDR_MASK"/>
+		</PARAM>
+		<CONFIG/>
+		<ACTION>
+			if test "${ip_method}" = "dhcp"; then
+				dhclient ${iface}
+			elif test "${ip_method}" = "ip"; then
+				ip addr show dev ${iface} | grep "inet " | (while read a b c; do ip addr del $b dev ${iface}; done)
+				ip addr add ${ip} dev ${iface}
+			fi
+		</ACTION>
+	</COMMAND>
+
+	<COMMAND name="no ip address"
+		help="Set the IP address of an interface">
+		<CONFIG operation="unset" pattern="^ip address"/>
+		<ACTION>
+			ip addr show dev ${iface} | grep "inet " | (while read a b c; do ip addr del $b dev ${iface}; done)
+		</ACTION>
+	</COMMAND>
+
+<!-- Enable/Disable -->
+
+	<COMMAND name="disable"
+		help="Disable the selected interface">
+		<CONFIG operation="unset" pattern="^enable"/>
+		<ACTION>
+			ip link set ${iface} down
+		</ACTION>
+	</COMMAND>
+
+	<COMMAND name="enable"
+		help="Enable the selected interface">
+		<CONFIG/>
+		<ACTION>
+			ip link set ${iface} up
+		</ACTION>
+	</COMMAND>
+</VIEW>
+
+</CLISH_MODULE>

+ 214 - 0
xml-examples/klish/etc/clish-enable/ping.xml

@@ -0,0 +1,214 @@
+<?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="ping-view"
+	prompt="${SYSTEM_NAME}# ">
+
+<!-- commands set: ping, ping6, arping, traceroute, traceroute6 -->
+<!-- ping, ping6, arping -->
+	<COMMAND name="ping"
+		help="Send messages to network hosts"
+		lock="false"
+		interrupt="true">
+		<PARAM name="proto"
+			help="Protocol to use for the ping"
+			optional="true"
+			mode="switch"
+			ptype="SUBCOMMAND">
+			<PARAM name="ip"
+				help="Send ICMP IPv4 messages to network hosts (default)"
+				mode="subcommand"
+				ptype="SUBCOMMAND"/>
+			<PARAM name="ipv6"
+				help="Send ICMP IPv6 messages to network hosts"
+				mode="subcommand"
+				ptype="SUBCOMMAND"/>
+			<PARAM name="arp"
+				help="Send ARP requests to a neighbour host"
+				mode="subcommand"
+				ptype="SUBCOMMAND"/>
+		</PARAM>
+		<PARAM name="dst"
+			help="Hostname or IP-address to ping"
+			ptype="STRING"/>
+		<PARAM name="source"
+			help="Source IP-address (ip) or interface (ip and arp)"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="src"
+				help="Source IP-address (ip) or interface name (ip and arp)"
+				ptype="STRING"/>
+		</PARAM>
+		<PARAM name="repeat"
+			help="Requests to send count, default is 5"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="count"
+				help="Requests count"
+				ptype="UINT"/>
+		</PARAM>
+		<PARAM name="resolve"
+			test='"${proto}"!="arp"'
+			help="Resolve names"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND"/>
+		<PARAM name="broadcast"
+			test='"${proto}"!="arp"'
+			help="Ping broadcast address"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND"/>
+		<PARAM name="size"
+			test='"${proto}"!="arp"'
+			help="Packet size"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="psize"
+				help="Number of data bytes to send"
+				ptype="UINT"/>
+		</PARAM>
+		<PARAM name="interval"
+			test='"${proto}"!="arp"'
+			help="The time interval between packets, default is 1"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="period"
+				help="Interval between packets"
+				ptype="STRING"/>
+		</PARAM>
+		<PARAM name="flood"
+			test='"${proto}"!="arp"'
+			help="Flood ping"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND"/>
+		<PARAM name="duplicate-detect"
+			test='"${proto}"="arp"'
+			help="Duplicate address detection mode"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND"/>
+		<ACTION>
+			case "${proto}" in
+				"ipv6")
+					cmd="ping6"
+					;;
+				"arp")
+					cmd="arping"
+					;;
+				*)
+					cmd="ping"
+					;;
+			esac
+			if test "${proto}" != "arp"; then
+				# Resolve names
+				if test -z "${resolve}"; then
+					cmd=$cmd" -n"
+				fi
+				# Ping broadcast
+				cmd=$cmd"`expr substr '${ -b :broadcast}' 1 3`"
+				# Packet size
+				cmd=$cmd"${ -s :psize}"
+				# Interval between packets 
+				if test -n "${period}"; then
+					cmd=$cmd"${ -i :period}"
+				else
+					cmd=$cmd" -i 1"
+				fi
+				# Flood ping
+				cmd=$cmd"`expr substr '${ -f :flood}' 1 3`"
+			else
+				# Detect MAC duplicate
+				cmd=$cmd"`expr substr '${ -D :duplicate-detect}' 1 3`"
+			fi
+			# Interface or address
+			cmd=$cmd"${ -I :src}"
+			# Request count
+			if test -z "${count}"; then
+				cmd=$cmd" -c 5"
+			else
+				cmd=$cmd"${ -c :count}"
+			fi
+			#
+			cmd=$cmd" ${dst}"
+			$cmd
+		</ACTION>
+	</COMMAND>
+
+<!-- traceroute, traceroute6 -->
+	<COMMAND name="traceroute"
+		help="Print the route packets trace to network host"
+		lock="false"
+		interrupt="true">
+		<PARAM name="proto"
+			help="Protocol to use"
+			optional="true"
+			mode="switch"
+			ptype="SUBCOMMAND">
+			<PARAM name="ip"
+				help="IPv4"
+				mode="subcommand"
+				ptype="SUBCOMMAND"/>
+			<PARAM name="ipv6"
+				help="IPv6"
+				mode="subcommand"
+				ptype="SUBCOMMAND"/>
+		</PARAM>
+		<PARAM name="dst"
+			help="Hostname or IP-address to trace the route"
+			ptype="STRING"/>
+		<PARAM name="resolve"
+			help="Resolve names"
+			ptype="SUBCOMMAND"
+			mode="subcommand"
+			optional="true"/>
+		<PARAM name="source"
+			help="Source IP-address"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="src"
+				help="IP-address"
+				ptype="STRING"/>
+		</PARAM>
+		<PARAM name="interface"
+			help="Source interface"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="if"
+				help="Interface name"
+				ptype="STRING"/>
+		</PARAM>
+		<ACTION>
+			if test -n "${ipv6}"; then
+				cmd="traceroute6"
+			else
+				cmd="traceroute"
+			fi
+			#Resolve names
+			if test -z "${resolve}"; then
+				cmd=$cmd" -n"
+			fi
+			# Source address
+			cmd=$cmd"${ -s :src}"
+			# Source interface
+			cmd=$cmd"${ -i :if}"
+			#
+			cmd=$cmd" ${dst}"
+			$cmd
+		</ACTION>
+	</COMMAND>
+
+</VIEW>
+
+</CLISH_MODULE>

+ 111 - 0
xml-examples/klish/etc/clish-enable/route.xml

@@ -0,0 +1,111 @@
+<?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="enable-view">
+
+<!-- Show routing information -->
+
+	<COMMAND name="show ip route"
+		help="IP routing table"
+		lock="false"
+		interrupt="true">
+		<ACTION>ip route show</ACTION>
+	</COMMAND>
+
+</VIEW>
+
+
+<VIEW name="configure-view">
+
+<!-- Enable/Disable routing -->
+
+	<COMMAND name="ip routing"
+		help="Enable IP routing">
+		<CONFIG operation="unset" pattern="^no ip routing"/>
+		<ACTION>
+		echo "1" > /proc/sys/net/ipv4/ip_forward
+		</ACTION>
+	</COMMAND>
+
+	<COMMAND name="no ip routing"
+		help="Disable IP routing">
+		<CONFIG priority="0x1500"/>
+		<ACTION>
+		echo "0" > /proc/sys/net/ipv4/ip_forward
+		</ACTION>
+	</COMMAND>
+
+<!-- Default gateway -->
+
+	<COMMAND name="ip default-gateway"
+		help="Specify default gateway (if not routing IP)">
+		<PARAM name="ip"
+			help="IP address of default gateway"
+			ptype="IP_ADDR"/>
+		<CONFIG priority="0x9000" splitter="false"/>
+		<ACTION>
+			ip route replace to default via ${ip}
+		</ACTION>
+	</COMMAND>
+
+	<COMMAND name="no ip default-gateway"
+		help="Specify default gateway (if not routing IP)">
+		<CONFIG operation="unset" pattern="^ip default-gateway"/>
+		<ACTION>
+			ip route delete to default
+		</ACTION>
+	</COMMAND>
+
+<!-- Set/Unset static route -->
+
+	<COMMAND name="ip route"
+		help="Establish static routes">
+		<PARAM name="ip"
+			help="Destination prefix"
+			ptype="IP_ADDR_MASK"/>
+		<PARAM name="route_target"
+			help="Route target"
+			ptype="STRING"
+			mode="switch">
+			<PARAM name="ethernet"
+				help="Ethernet IEEE 802.3"
+				ptype="SUBCOMMAND"
+				mode="subcommand">
+					<PARAM name="iface_num"
+						help="Ethernet interface number"
+						ptype="IFACE_NUM"/>
+			</PARAM>
+			<PARAM name="forward"
+				help="Forwarding router's address"
+				ptype="IP_ADDR"/>
+		</PARAM>
+		<CONFIG priority="0x9002" pattern="^ip route ${ip} " splitter="false"/>
+		<ACTION>
+		if test "${route_target}" = "ethernet"; then
+			ip route replace to ${ip} dev eth${iface_num}
+			exit $?
+		elif test "${route_target}" = "forward"; then
+			ip route replace to ${ip} via ${forward}
+			exit $?
+		fi
+		</ACTION>
+	</COMMAND>
+
+	<COMMAND name="no ip route"
+		help="Establish static routes">
+		<PARAM name="ip"
+			help="Destination prefix"
+			ptype="IP_ADDR_MASK"/>
+		<CONFIG operation="unset" pattern="^ip route ${ip} "/>
+		<ACTION>
+		ip route delete to ${ip}
+		</ACTION>
+	</COMMAND>
+
+</VIEW>
+
+</CLISH_MODULE>

+ 10 - 0
xml-examples/klish/etc/clish-enable/startup.xml

@@ -0,0 +1,10 @@
+<?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">
+
+	<STARTUP view="enable-view">
+	</STARTUP>
+
+</CLISH_MODULE>

+ 62 - 0
xml-examples/klish/etc/clish-enable/types.xml

@@ -0,0 +1,62 @@
+<?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">
+    <!--=======================================================-->
+	<PTYPE name="VLAN_ID" 
+		pattern="(409[0-5]|40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[1-9])"
+		help="Number in the range 1-4095"/>
+	<!--=======================================================-->
+	<PTYPE name="IP_ADDR"
+		pattern="(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))"
+		help="A.B.C.D"/>
+	<!--=======================================================-->
+	<PTYPE name="UINT"
+		pattern="[0-9]+"
+		help="Unsigned integer"/>
+	<!--=======================================================-->
+	<PTYPE name="STRING"
+		pattern=".+"
+		help="String"/>
+	<!--=======================================================-->
+	<PTYPE name="SUBCOMMAND"
+		pattern="[^\]+"
+		help="String"/>
+	<!--=======================================================-->
+	<PTYPE name="BOOL"
+		method="select"
+		pattern="true(1) false(0)"
+		help="Boolean choice"/>
+	<!--=======================================================-->
+	<PTYPE name="IFACE_NUM"
+		pattern="[0-9]+"
+		help="Interface number"/>
+	<!--=======================================================-->
+	<PTYPE name="PROTO"
+		method="select"
+		pattern="ip(ip) ipencap(ipencap) icmp(icmp) igmp(igmp) tcp(tcp) udp(udp)"
+		help="Protocol choice"/>
+	<!--=======================================================-->
+	<PTYPE name="SERVICE"
+		pattern="((ftp)|(telnet)|(sntp)|(smtp)|(http)|([0-9]+))"
+		help="Port"/>
+	<!--=======================================================-->
+	<PTYPE name="IP_ADDR_MASK"
+		pattern="(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(/(1[0-9]|2[0-9]|3[0-2]|[0-9]))?"
+		help="A.B.C.D[/mask]"/>
+	<!--=======================================================-->
+	<PTYPE name="IP_ADDR_ANY"
+		pattern="(((((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(/(1[0-9]|2[0-9]|3[0-2]|[0-9]))?)|any)"
+		help="A.B.C.D[/mask] or any"/>
+	<!--=======================================================-->
+	<PTYPE name="PORT_MASK_ANY"
+		pattern="^(([0-9]+(/0x[0-9a-f]+)?)|(any))$"
+		help="Port[/mask]" />
+	<!--=======================================================-->
+	<PTYPE name="SEQ"
+		pattern="^[0-9]*[1-9][0-9]*"
+		help="Entry number"/>
+	<!--=======================================================-->
+
+</CLISH_MODULE>

+ 23 - 0
xml-examples/klish/etc/clish/common.xml

@@ -0,0 +1,23 @@
+<?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">
+	<!--=======================================================-->
+
+<COMMAND name="exit"
+	help="Exit from the CLI"
+	lock="false">
+	<ACTION builtin="clish_close"/>
+</COMMAND>
+
+<COMMAND name="!"
+	help="Comments"
+	args="comment"
+	args_help="ignored comment text">
+	<ACTION builtin="clish_nop"/>
+</COMMAND>
+
+</CLISH_MODULE>
+
+

+ 28 - 0
xml-examples/klish/etc/clish/info-mode.xml

@@ -0,0 +1,28 @@
+<?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="info-view"
+	prompt="${SYSTEM_NAME}&gt; ">
+
+<!-- Inheritance -->
+
+	<NAMESPACE ref="ping-view"
+		help="true"
+		completion="true"/>
+
+<!-- Simple non-priveledged mode commands -->
+
+	<COMMAND name="enable"
+		help="Turn on privileged commands"
+		lock="false"
+		interrupt="true">
+		<ACTION>su -l -c "clish -x /etc/clish-enable"</ACTION>
+	</COMMAND>
+
+</VIEW>
+
+</CLISH_MODULE>

+ 45 - 0
xml-examples/klish/etc/clish/overview.xml

@@ -0,0 +1,45 @@
+<?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">
+ 	<!--=======================================================-->
+	<OVERVIEW>
+CONTEXT SENSITIVE HELP
+[?] - Display context sensitive help. This is either a list of possible
+      command completions with summaries, or the full syntax of the 
+      current command. A subsequent repeat of this key, when a command
+      has been resolved, will display a detailed reference.
+
+AUTO-COMPLETION
+The following keys both perform auto-completion for the current command line.
+If the command prefix is not unique then the bell will ring and a subsequent
+repeat of the key will display possible completions.
+
+[enter] - Auto-completes, syntax-checks then executes a command. If there is 
+          a syntax error then offending part of the command line will be
+          highlighted and explained.
+
+[space] - Auto-completes, or if the command is already resolved inserts a space.
+
+MOVEMENT KEYS
+[CTRL-A] - Move to the start of the line
+[CTRL-E] - Move to the end of the line.
+[up]     - Move to the previous command line held in history.
+[down]   - Move to the next command line held in history.
+[left]   - Move the insertion point left one character.
+[right]  - Move the insertion point right one character.
+
+DELETION KEYS
+[CTRL-C]    - Delete and abort the current line
+[CTRL-D]    - Delete the character to the right on the insertion point.
+[CTRL-K]    - Delete all the characters to the right of the insertion point.
+[CTRL-U]    - Delete the whole line.
+[backspace] - Delete the character to the left of the insertion point.
+
+ESCAPE SEQUENCES
+!!  - Subsitute the the last command line.
+!N  - Substitute the Nth command line (absolute as per 'history' command)
+!-N - Substitute the command line entered N lines before (relative)
+    </OVERVIEW>
+</CLISH_MODULE>

+ 214 - 0
xml-examples/klish/etc/clish/ping.xml

@@ -0,0 +1,214 @@
+<?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="ping-view"
+	prompt="${SYSTEM_NAME}# ">
+
+<!-- commands set: ping, ping6, arping, traceroute, traceroute6 -->
+<!-- ping, ping6, arping -->
+	<COMMAND name="ping"
+		help="Send messages to network hosts"
+		lock="false"
+		interrupt="true">
+		<PARAM name="proto"
+			help="Protocol to use for the ping"
+			optional="true"
+			mode="switch"
+			ptype="SUBCOMMAND">
+			<PARAM name="ip"
+				help="Send ICMP IPv4 messages to network hosts (default)"
+				mode="subcommand"
+				ptype="SUBCOMMAND"/>
+			<PARAM name="ipv6"
+				help="Send ICMP IPv6 messages to network hosts"
+				mode="subcommand"
+				ptype="SUBCOMMAND"/>
+			<PARAM name="arp"
+				help="Send ARP requests to a neighbour host"
+				mode="subcommand"
+				ptype="SUBCOMMAND"/>
+		</PARAM>
+		<PARAM name="dst"
+			help="Hostname or IP-address to ping"
+			ptype="STRING"/>
+		<PARAM name="source"
+			help="Source IP-address (ip) or interface (ip and arp)"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="src"
+				help="Source IP-address (ip) or interface name (ip and arp)"
+				ptype="STRING"/>
+		</PARAM>
+		<PARAM name="repeat"
+			help="Requests to send count, default is 5"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="count"
+				help="Requests count"
+				ptype="UINT"/>
+		</PARAM>
+		<PARAM name="resolve"
+			test='"${proto}"!="arp"'
+			help="Resolve names"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND"/>
+		<PARAM name="broadcast"
+			test='"${proto}"!="arp"'
+			help="Ping broadcast address"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND"/>
+		<PARAM name="size"
+			test='"${proto}"!="arp"'
+			help="Packet size"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="psize"
+				help="Number of data bytes to send"
+				ptype="UINT"/>
+		</PARAM>
+		<PARAM name="interval"
+			test='"${proto}"!="arp"'
+			help="The time interval between packets, default is 1"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="period"
+				help="Interval between packets"
+				ptype="STRING"/>
+		</PARAM>
+		<PARAM name="flood"
+			test='"${proto}"!="arp"'
+			help="Flood ping"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND"/>
+		<PARAM name="duplicate-detect"
+			test='"${proto}"="arp"'
+			help="Duplicate address detection mode"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND"/>
+		<ACTION>
+			case "${proto}" in
+				"ipv6")
+					cmd="ping6"
+					;;
+				"arp")
+					cmd="arping"
+					;;
+				*)
+					cmd="ping"
+					;;
+			esac
+			if test "${proto}" != "arp"; then
+				# Resolve names
+				if test -z "${resolve}"; then
+					cmd=$cmd" -n"
+				fi
+				# Ping broadcast
+				cmd=$cmd"`expr substr '${ -b :broadcast}' 1 3`"
+				# Packet size
+				cmd=$cmd"${ -s :psize}"
+				# Interval between packets 
+				if test -n "${period}"; then
+					cmd=$cmd"${ -i :period}"
+				else
+					cmd=$cmd" -i 1"
+				fi
+				# Flood ping
+				cmd=$cmd"`expr substr '${ -f :flood}' 1 3`"
+			else
+				# Detect MAC duplicate
+				cmd=$cmd"`expr substr '${ -D :duplicate-detect}' 1 3`"
+			fi
+			# Interface or address
+			cmd=$cmd"${ -I :src}"
+			# Request count
+			if test -z "${count}"; then
+				cmd=$cmd" -c 5"
+			else
+				cmd=$cmd"${ -c :count}"
+			fi
+			#
+			cmd=$cmd" ${dst}"
+			$cmd
+		</ACTION>
+	</COMMAND>
+
+<!-- traceroute, traceroute6 -->
+	<COMMAND name="traceroute"
+		help="Print the route packets trace to network host"
+		lock="false"
+		interrupt="true">
+		<PARAM name="proto"
+			help="Protocol to use"
+			optional="true"
+			mode="switch"
+			ptype="SUBCOMMAND">
+			<PARAM name="ip"
+				help="IPv4"
+				mode="subcommand"
+				ptype="SUBCOMMAND"/>
+			<PARAM name="ipv6"
+				help="IPv6"
+				mode="subcommand"
+				ptype="SUBCOMMAND"/>
+		</PARAM>
+		<PARAM name="dst"
+			help="Hostname or IP-address to trace the route"
+			ptype="STRING"/>
+		<PARAM name="resolve"
+			help="Resolve names"
+			ptype="SUBCOMMAND"
+			mode="subcommand"
+			optional="true"/>
+		<PARAM name="source"
+			help="Source IP-address"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="src"
+				help="IP-address"
+				ptype="STRING"/>
+		</PARAM>
+		<PARAM name="interface"
+			help="Source interface"
+			optional="true"
+			mode="subcommand"
+			ptype="SUBCOMMAND">
+			<PARAM name="if"
+				help="Interface name"
+				ptype="STRING"/>
+		</PARAM>
+		<ACTION>
+			if test -n "${ipv6}"; then
+				cmd="traceroute6"
+			else
+				cmd="traceroute"
+			fi
+			#Resolve names
+			if test -z "${resolve}"; then
+				cmd=$cmd" -n"
+			fi
+			# Source address
+			cmd=$cmd"${ -s :src}"
+			# Source interface
+			cmd=$cmd"${ -i :if}"
+			#
+			cmd=$cmd" ${dst}"
+			$cmd
+		</ACTION>
+	</COMMAND>
+
+</VIEW>
+
+</CLISH_MODULE>

+ 10 - 0
xml-examples/klish/etc/clish/startup.xml

@@ -0,0 +1,10 @@
+<?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">
+
+<STARTUP view="info-view">
+</STARTUP>
+
+</CLISH_MODULE>

+ 62 - 0
xml-examples/klish/etc/clish/types.xml

@@ -0,0 +1,62 @@
+<?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">
+    <!--=======================================================-->
+	<PTYPE name="VLAN_ID" 
+		pattern="(409[0-5]|40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[1-9])"
+		help="Number in the range 1-4095"/>
+	<!--=======================================================-->
+	<PTYPE name="IP_ADDR"
+		pattern="(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))"
+		help="A.B.C.D"/>
+	<!--=======================================================-->
+	<PTYPE name="UINT"
+		pattern="[0-9]+"
+		help="Unsigned integer"/>
+	<!--=======================================================-->
+	<PTYPE name="STRING"
+		pattern=".+"
+		help="String"/>
+	<!--=======================================================-->
+	<PTYPE name="SUBCOMMAND"
+		pattern="[^\]+"
+		help="String"/>
+	<!--=======================================================-->
+	<PTYPE name="BOOL"
+		method="select"
+		pattern="true(1) false(0)"
+		help="Boolean choice"/>
+	<!--=======================================================-->
+	<PTYPE name="IFACE_NUM"
+		pattern="[0-9]+"
+		help="Interface number"/>
+	<!--=======================================================-->
+	<PTYPE name="PROTO"
+		method="select"
+		pattern="ip(ip) ipencap(ipencap) icmp(icmp) igmp(igmp) tcp(tcp) udp(udp)"
+		help="Protocol choice"/>
+	<!--=======================================================-->
+	<PTYPE name="SERVICE"
+		pattern="((ftp)|(telnet)|(sntp)|(smtp)|(http)|([0-9]+))"
+		help="Port"/>
+	<!--=======================================================-->
+	<PTYPE name="IP_ADDR_MASK"
+		pattern="(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(/(1[0-9]|2[0-9]|3[0-2]|[0-9]))?"
+		help="A.B.C.D[/mask]"/>
+	<!--=======================================================-->
+	<PTYPE name="IP_ADDR_ANY"
+		pattern="(((((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(/(1[0-9]|2[0-9]|3[0-2]|[0-9]))?)|any)"
+		help="A.B.C.D[/mask] or any"/>
+	<!--=======================================================-->
+	<PTYPE name="PORT_MASK_ANY"
+		pattern="^(([0-9]+(/0x[0-9a-f]+)?)|(any))$"
+		help="Port[/mask]" />
+	<!--=======================================================-->
+	<PTYPE name="SEQ"
+		pattern="^[0-9]*[1-9][0-9]*"
+		help="Entry number"/>
+	<!--=======================================================-->
+
+</CLISH_MODULE>