Ray Milkey | 48bf76c | 2016-02-23 15:27:39 -0800 | [diff] [blame] | 1 | # /bin/sh |
| 2 | |
| 3 | if [ "$#" -ne 6 ] |
| 4 | then |
| 5 | echo usage: create-forward-objective.sh onos device src-mac dst-mac src-port dst-port |
| 6 | exit 1 |
| 7 | fi |
| 8 | |
| 9 | |
| 10 | onos=$1 |
| 11 | device=$2 |
| 12 | srcMac=$3 |
| 13 | dstMac=$4 |
| 14 | srcPort=$5 |
| 15 | dstPort=$6 |
| 16 | |
| 17 | curl -u onos:rocks -X POST --header "Content-Type: application/json" --header "Accept: application/json" -d "{ |
| 18 | \"priority\": 100, |
| 19 | \"isPermanent\": \"false\", |
| 20 | \"timeout\": 100, |
| 21 | \"flag\": \"VERSATILE\", |
| 22 | \"operation\": \"ADD\", |
| 23 | \"selector\": { |
| 24 | \"criteria\": [ |
| 25 | {\"type\": \"ETH_TYPE\", \"ethType\": 2048}, |
| 26 | {\"type\": \"IN_PORT\", \"port\": \"$srcPort\"}, |
| 27 | {\"type\": \"ETH_DST\", \"mac\": \"$dstMac\"}, |
| 28 | {\"type\": \"ETH_SRC\", \"mac\": \"$srcMac\"} |
| 29 | ] |
| 30 | }, |
| 31 | \"treatment\": |
| 32 | { |
| 33 | \"instructions\": |
| 34 | [ |
| 35 | {\"type\":\"OUTPUT\",\"port\":$dstPort} |
| 36 | ], |
| 37 | \"deferred\":[] |
| 38 | } |
| 39 | }" http://${onos}:8181/onos/v1/flowobjectives/$device/forward |
| 40 | |
| 41 | echo |