-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenable_ucap.sh
More file actions
35 lines (29 loc) · 1.07 KB
/
Copy pathenable_ucap.sh
File metadata and controls
35 lines (29 loc) · 1.07 KB
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
#!/bin/sh
# Manipulate config for changing bridging for ucap
local wl0=`uci get wireless.@wifi-iface[0].network -q`
local wl1=`uci get wireless.@wifi-iface[1].network -q`
local ifname=`uci get network.lan.ifname -q`
if [ "$wl0" != "" ] || [ "$wl1" != "" ] || [ "$ifname" != "" ]; then
uci set wireless.@wifi-iface[0].network=''
uci set wireless.@wifi-iface[1].network=''
uci set network.lan.ifname=''
uci commit wireless
uci commit network
# restart network
/etc/init.d/network restart
fi
# OpenFlow
uci set openflow.@ofswitch[0].dp=dp0
local dp_id=`ifconfig | grep "^eth0 " | grep HWaddr | awk -F 'HWaddr ' '{ print $2 }' | sed -e '/:/ s/://g'}`
uci set openflow.@ofswitch[0].dpid=$dp_id
uci set openflow.@ofswitch[0].ofports=wlan0,wlan1,eth0.1,veth0
uci set openflow.@ofswitch[0].ofctl=tcp:143.215.131.178:6633
uci set openflow.@ofswitch[0].mode=outofband
uci commit openflow
# enable openflow
/etc/init.d/openflow restart
# Start monitoring script
local check=`pgrep -fl monitor_veth`
if [ "$check" == "" ]; then
sh /usr/bin/monitor_veth.sh &
fi