diff --git a/modules/rhizo_base/templates/rccn-functions.sh.erb b/modules/rhizo_base/templates/rccn-functions.sh.erb index ba6c68c..d8f423d 100644 --- a/modules/rhizo_base/templates/rccn-functions.sh.erb +++ b/modules/rhizo_base/templates/rccn-functions.sh.erb @@ -193,3 +193,16 @@ smsq-max() expect -c 'set queue '$1'; set port <% if @osmo_stack != "split" -%>4242<% else -%>4254<% end -%>; spawn telnet localhost $port; expect ">"; send "enable\r"; expect "#"; send "sms-queue max-pending $queue\r"; expect "#"; send "sms-queue trigger\r"; expect "#";' } +<% if @osmo_stack != "split" %> +close-net () { + expect -c 'spawn -noecho telnet 0 4242; expect >; send enable\r; expect #; send "configure terminal\r"; expect #; send network\r; expect #; send "auth policy closed\r"; expect #; send \r' ; echo -e " \r Closed Network" +} + +open-net () { + expect -c 'spawn -noecho telnet 0 4242; expect >; send enable\r; expect #; send "configure terminal\r"; expect #; send network\r; expect #; send "auth policy accept-all \r";expect #; send \r' ; echo -e " \r Opened Network" +} + +p-net (){ + echo "show network" | nc -q1 localhost 4242 | grep "policy" | awk -F "," '{print $1 }' +} +<% end %>