-
Notifications
You must be signed in to change notification settings - Fork 3
/
lc_mob_2.sh
58 lines (51 loc) · 2.12 KB
/
lc_mob_2.sh
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
#!/bin/bash
#aplicação generica para gerenciamento de mobilidade ente celulas
# while true;
# do
#RSU1 verifica se existem flow no backbone correto para os veiculos em sua RAN
p=2
for i in $(hostapd_cli -i rsu1-wlan1 all_sta | grep :);
do
x=$(ovs-ofctl dump-flows sw1 -O Openflow13 | grep dl_dst=$i | grep output:$p | grep 0x0 -c)
if [[ $x -lt 1 ]]; then
echo "falta RSU1 " $i
echo "Configurando..."
ovs-ofctl del-flows sw1 cookie=0x0/-1,dl_src=$i -O Openflow13
ovs-ofctl del-flows sw1 cookie=0x0/-1,dl_dst=$i -O Openflow13
ovs-ofctl add-flow sw1 "table=1, priority=1, cookie=0x0, in_port=$p,dl_src=$i actions=1" -O Openflow13
ovs-ofctl add-flow sw1 "table=1, priority=1, cookie=0x0, in_port=1,dl_dst=$i actions=$p" -O Openflow13
echo "Concluído!"
fi
done
#RSU2 verifica se existem flow no backbone correto para os veiculos em sua RAN
p=3
for i in $(hostapd_cli -i rsu2-wlan1 all_sta | grep :);
do
x=$(ovs-ofctl dump-flows sw1 -O Openflow13 | grep dl_dst=$i | grep output:$p | grep 0x0 -c)
if [[ $x -lt 1 ]]; then
echo "falta na RSU2 " $i
echo "Configurando..."
ovs-ofctl del-flows sw1 cookie=0x0/-1,dl_src=$i -O Openflow13
ovs-ofctl del-flows sw1 cookie=0x0/-1,dl_dst=$i -O Openflow13
ovs-ofctl add-flow sw1 "table=1, priority=1, cookie=0x0, in_port=$p,dl_src=$i actions=1" -O Openflow13
ovs-ofctl add-flow sw1 "table=1, priority=1, cookie=0x0, in_port=1,dl_dst=$i actions=$p" -O Openflow13
echo "Concluído!"
fi
done
#RSU3 verifica se existem flow no backbone correto para os veiculos em sua RAN
p=4
for i in $(hostapd_cli -i rsu3-wlan1 all_sta | grep :);
do
x=$(ovs-ofctl dump-flows sw1 -O Openflow13 | grep dl_dst=$i | grep output:$p | grep 0x0 -c)
if [[ $x -lt 1 ]]; then
echo "falta na RSU3 " $i
echo "Configurando..."
ovs-ofctl del-flows sw1 cookie=0x0/-1,dl_src=$i -O Openflow13
ovs-ofctl del-flows sw1 cookie=0x0/-1,dl_dst=$i -O Openflow13
ovs-ofctl add-flow sw1 "table=1, priority=1, cookie=0x0, in_port=$p,dl_src=$i actions=1" -O Openflow13
ovs-ofctl add-flow sw1 "table=1, priority=1, cookie=0x0, in_port=1,dl_dst=$i actions=$p" -O Openflow13
echo "Concluído!"
fi
done
# sleep 1;
# done