-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure_first_classifier.sh
9 lines (8 loc) · 1.07 KB
/
configure_first_classifier.sh
1
2
3
4
5
6
7
8
9
printf -v nsp "0x%x" `ovs-ofctl -O Openflow13 dump-flows br-int table=11 | grep "nsp=" | awk '{print $6}' | awk -F ',' '{print $1}' | awk -F '=' '{print $2}'`
printf -v ip '0x%x' `ovs-ofctl -O Openflow13 dump-flows br-int table=158 | grep nshc1 | awk -F ',' '{print $9}' | awk -F '=' '{print $2}' | uniq`
client_port=$1
output_port=$2
ovs-ofctl -O Openflow13 del-flows br-int "table=11,tcp,reg0=0x1,tp_dst=80"
ovs-ofctl -O Openflow13 del-flows br-int "table=11,tcp,reg0=0x1,tp_dst=22"
ovs-ofctl -O Openflow13 add-flow br-int "table=11,tcp,reg0=0x1,tp_dst=22,in_port=${client_port} actions=move:NXM_NX_TUN_ID[0..31]->NXM_NX_NSH_C2[],set_field:${ip}->nshc1,set_field:${nsp}->nsp,set_field:255->nsi,load:${ip}->NXM_NX_TUN_IPV4_DST[],load:${nsp}->NXM_NX_TUN_ID[0..31],resubmit(${output_port},0)"
ovs-ofctl -O Openflow13 add-flow br-int "table=11,tcp,reg0=0x1,tp_dst=80,in_port=${client_port} actions=move:NXM_NX_TUN_ID[0..31]->NXM_NX_NSH_C2[],set_field:${ip}->nshc1,set_field:${nsp}->nsp,set_field:255->nsi,load:${ip}->NXM_NX_TUN_IPV4_DST[],load:${nsp}->NXM_NX_TUN_ID[0..31],resubmit(${output_port},0)"