123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?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">
- <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>
|