Dimitrios Mavrommatis | a9df596 | 2017-12-05 15:11:04 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Dimitrios Mavrommatis | e1f23ac | 2017-12-05 22:59:41 -0800 | [diff] [blame] | 3 | if [ "$#" -eq 2 ] && [ $1 == "delete" ]; then |
| 4 | echo "" |
| 5 | json='{ |
| 6 | "input": { |
| 7 | "op-id": '$2', |
| 8 | "targets": [ |
| 9 | { |
| 10 | "target": "/ietf-dmm-fpcagent:tenants/tenant=default/fpc-mobility/contexts='$2'" |
| 11 | } |
| 12 | ], |
| 13 | "client-id": "1", |
| 14 | "session-state": "complete", |
| 15 | "admin-state": "enabled", |
| 16 | "op-type": "'$1'", |
| 17 | "op-ref-scope": "none" |
| 18 | } |
| 19 | }' |
| 20 | |
| 21 | curl -X POST \ |
| 22 | --header 'Content-Type: application/json' \ |
| 23 | -u onos:rocks \ |
| 24 | --header 'Accept: application/json' \ |
| 25 | -d "$json" \ |
| 26 | 'http://localhost:8181/onos/restconf/operations/ietf-dmm-fpcagent:configure' | python -m json.tool |
| 27 | elif [ "$#" -eq 3 ] && [ $1 == "create" ]; then |
Dimitrios Mavrommatis | a9df596 | 2017-12-05 15:11:04 -0800 | [diff] [blame] | 28 | echo "" |
| 29 | json='{ |
| 30 | "input": { |
| 31 | "admin-state": "enabled", |
| 32 | "client-id": "1", |
| 33 | "contexts": [ |
| 34 | { |
| 35 | "context-id": '$2', |
| 36 | "delegating-ip-prefixes": [ |
| 37 | "192.168.1.5/32" |
| 38 | ], |
| 39 | "dl": { |
| 40 | "dpn-parameters": {}, |
| 41 | "mobility-tunnel-parameters": { |
| 42 | "tunnel-identifier": "2222", |
| 43 | "tunnel-type": "gtpv1" |
| 44 | }, |
| 45 | "tunnel-local-address": "192.168.1.1", |
| 46 | "tunnel-remote-address": "10.1.1.1" |
| 47 | }, |
| 48 | "dpn-group": "foo", |
| 49 | "dpns": [ |
| 50 | { |
| 51 | "direction": "uplink", |
| 52 | "dpn-id": '$3', |
| 53 | "dpn-parameters": {} |
| 54 | } |
| 55 | ], |
| 56 | "ebi": "5", |
| 57 | "imsi": "9135551234", |
| 58 | "instructions": { |
| 59 | "instr-3gpp-mob": "session uplink" |
| 60 | }, |
| 61 | "lbi": "5", |
| 62 | "ul": { |
| 63 | "dpn-parameters": {}, |
| 64 | "mobility-tunnel-parameters": { |
| 65 | "tunnel-identifier": "1111", |
| 66 | "tunnel-type": "gtpv1" |
| 67 | }, |
| 68 | "tunnel-local-address": "192.168.1.1", |
| 69 | "tunnel-remote-address": "10.1.1.1" |
| 70 | } |
| 71 | } |
| 72 | ], |
Dimitrios Mavrommatis | e1f23ac | 2017-12-05 22:59:41 -0800 | [diff] [blame] | 73 | "op-id": '$2', |
Dimitrios Mavrommatis | a9df596 | 2017-12-05 15:11:04 -0800 | [diff] [blame] | 74 | "op-ref-scope": "op", |
| 75 | "op-type": "'$1'", |
| 76 | "session-state": "complete" |
| 77 | } |
| 78 | }' |
| 79 | |
| 80 | curl -X POST \ |
| 81 | --header 'Content-Type: application/json' \ |
| 82 | -u onos:rocks \ |
| 83 | --header 'Accept: application/json' \ |
| 84 | -d "$json" \ |
| 85 | 'http://localhost:8181/onos/restconf/operations/ietf-dmm-fpcagent:configure' | python -m json.tool |
| 86 | echo "" |
| 87 | else |
Dimitrios Mavrommatis | e1f23ac | 2017-12-05 22:59:41 -0800 | [diff] [blame] | 88 | echo "usage: "$0" type contextId" |
Dimitrios Mavrommatis | a9df596 | 2017-12-05 15:11:04 -0800 | [diff] [blame] | 89 | fi |