1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
#!/bin/sh
#
# $XORP: xorp/cli/xrl_cli_shell_funcs.sh,v 1.10 2003/12/20 01:43:34 pavlin Exp $
#
#
# Library of functions to sent XRLs to a running CLI process.
#
# Conditionally set ${srcdir} if it wasn't assigned (e.g., by `gmake check`)
if [ "X${srcdir}" = "X" ] ; then srcdir=`dirname $0` ; fi
. ${srcdir}/../utils/xrl_shell_lib.sh
#
# Conditionally set the target name
#
IP_VERSION=${IP_VERSION:?"IP_VERSION undefined. Must be defined to either IPV4 or IPV6"}
case "${IP_VERSION}" in
IPV4)
CLI_TARGET=${CLI_TARGET:="CLI"}
;;
IPV6)
CLI_TARGET=${CLI_TARGET:="CLI"}
;;
*)
echo "Error: invalid IP_VERSION = ${IP_VERSION}. Must be either IPV4 or IPV6"
exit 1
;;
esac
cli_enable_cli()
{
if [ $# -lt 1 ] ; then
echo "Usage: cli_enable_cli <enable:bool>"
exit 1
fi
enable=$1
echo "cli_enable_cli" $*
XRL="finder://$CLI_TARGET/cli_manager/0.1/enable_cli"
XRL_ARGS="?enable:bool=$enable"
call_xrl_wrapper -r 0 $XRL$XRL_ARGS
}
cli_start_cli()
{
echo "cli_start_cli" $*
XRL="finder://$CLI_TARGET/cli_manager/0.1/start_cli"
XRL_ARGS=""
call_xrl_wrapper -r 0 $XRL$XRL_ARGS
}
cli_stop_cli()
{
echo "cli_stop_cli" $*
XRL="finder://$CLI_TARGET/cli_manager/0.1/stop_cli"
XRL_ARGS=""
call_xrl_wrapper -r 0 $XRL$XRL_ARGS
}
cli_add_enable_cli_access_from_subnet4()
{
if [ $# -lt 1 ] ; then
echo "Usage: cli_add_enable_cli_access_from_subnet4 <subnet_addr:ipv4net>"
exit 1
fi
subnet_addr=$1
echo "cli_add_enable_cli_access_from_subnet4" $*
XRL="finder://$CLI_TARGET/cli_manager/0.1/add_enable_cli_access_from_subnet4"
XRL_ARGS="?subnet_addr:ipv4net=$subnet_addr"
call_xrl_wrapper -r 0 $XRL$XRL_ARGS
}
cli_add_enable_cli_access_from_subnet6()
{
if [ $# -lt 1 ] ; then
echo "Usage: cli_add_enable_cli_access_from_subnet6 <subnet_addr:ipv6net>"
exit 1
fi
subnet_addr=$1
echo "cli_add_enable_cli_access_from_subnet6" $*
XRL="finder://$CLI_TARGET/cli_manager/0.1/add_enable_cli_access_from_subnet6"
XRL_ARGS="?subnet_addr:ipv6net=$subnet_addr"
call_xrl_wrapper -r 0 $XRL$XRL_ARGS
}
cli_delete_enable_cli_access_from_subnet4()
{
if [ $# -lt 1 ] ; then
echo "Usage: cli_delete_enable_cli_access_from_subnet4 <subnet_addr:ipv4net>"
exit 1
fi
subnet_addr=$1
echo "cli_delete_enable_cli_access_from_subnet4" $*
XRL="finder://$CLI_TARGET/cli_manager/0.1/delete_enable_cli_access_from_subnet4"
XRL_ARGS="?subnet_addr:ipv4net=$subnet_addr"
call_xrl_wrapper -r 0 $XRL$XRL_ARGS
}
cli_delete_enable_cli_access_from_subnet6()
{
if [ $# -lt 1 ] ; then
echo "Usage: cli_delete_enable_cli_access_from_subnet6 <subnet_addr:ipv6net>"
exit 1
fi
subnet_addr=$1
echo "cli_delete_enable_cli_access_from_subnet6" $*
XRL="finder://$CLI_TARGET/cli_manager/0.1/delete_enable_cli_access_from_subnet6"
XRL_ARGS="?subnet_addr:ipv6net=$subnet_addr"
call_xrl_wrapper -r 0 $XRL$XRL_ARGS
}
cli_add_disable_cli_access_from_subnet4()
{
if [ $# -lt 1 ] ; then
echo "Usage: cli_add_disable_cli_access_from_subnet4 <subnet_addr:ipv4net>"
exit 1
fi
subnet_addr=$1
echo "cli_add_disable_cli_access_from_subnet4" $*
XRL="finder://$CLI_TARGET/cli_manager/0.1/add_disable_cli_access_from_subnet4"
XRL_ARGS="?subnet_addr:ipv4net=$subnet_addr"
call_xrl_wrapper -r 0 $XRL$XRL_ARGS
}
cli_add_disable_cli_access_from_subnet6()
{
if [ $# -lt 1 ] ; then
echo "Usage: cli_add_disable_cli_access_from_subnet6 <subnet_addr:ipv6net>"
exit 1
fi
subnet_addr=$1
echo "cli_add_disable_cli_access_from_subnet6" $*
XRL="finder://$CLI_TARGET/cli_manager/0.1/add_disable_cli_access_from_subnet6"
XRL_ARGS="?subnet_addr:ipv6net=$subnet_addr"
call_xrl_wrapper -r 0 $XRL$XRL_ARGS
}
cli_delete_disable_cli_access_from_subnet4()
{
if [ $# -lt 1 ] ; then
echo "Usage: cli_delete_disable_cli_access_from_subnet4 <subnet_addr:ipv4net>"
exit 1
fi
subnet_addr=$1
echo "cli_delete_disable_cli_access_from_subnet4" $*
XRL="finder://$CLI_TARGET/cli_manager/0.1/delete_disable_cli_access_from_subnet4"
XRL_ARGS="?subnet_addr:ipv4net=$subnet_addr"
call_xrl_wrapper -r 0 $XRL$XRL_ARGS
}
cli_delete_disable_cli_access_from_subnet6()
{
if [ $# -lt 1 ] ; then
echo "Usage: cli_delete_disable_cli_access_from_subnet6 <subnet_addr:ipv6net>"
exit 1
fi
subnet_addr=$1
echo "cli_delete_disable_cli_access_from_subnet6" $*
XRL="finder://$CLI_TARGET/cli_manager/0.1/delete_disable_cli_access_from_subnet6"
XRL_ARGS="?subnet_addr:ipv6net=$subnet_addr"
call_xrl_wrapper -r 0 $XRL$XRL_ARGS
}
|