blob: 865ee76fea6a797c171c3bae21df7725e048aaa9 [file] [log] [blame]
Ray Milkey48bf76c2016-02-23 15:27:39 -08001# /bin/sh
2
3if [ "$#" -ne 6 ]
4then
5 echo usage: create-forward-objective.sh onos device src-mac dst-mac src-port dst-port
6 exit 1
7fi
8
9
10onos=$1
11device=$2
12srcMac=$3
13dstMac=$4
14srcPort=$5
15dstPort=$6
16
17curl -u onos:rocks -X POST --header "Content-Type: application/json" --header "Accept: application/json" -d "{
18 \"priority\": 100,
Thomas Vachuska73dea2f2017-10-06 10:26:52 -070019 \"isPermanent\": \"true\",
Ray Milkey48bf76c2016-02-23 15:27:39 -080020 \"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
41echo