This repository has been archived by the owner on Feb 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
put.py
59 lines (49 loc) · 1.42 KB
/
put.py
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
56
57
58
59
from __future__ import print_function
import json
from sys import stderr
from basics import odl_http
from basics import render
from basics.odl_http import odl_http_put
import settings
def main():
if not settings:
print('Settings must be configured', file=stderr)
render.print_table(odl_http.coordinates)
print()
config = {
"add-flow": {
"input": {
"flow-ref": "1",
"transaction-uri": "1",
"flow-table": "1",
"container-name": "1",
"cookie_mask": "1",
"buffer_id": "1",
"out_port": "1",
"out_group": "1",
"flags": "CHECK_OVERLAP",
"flow-name": "1",
"installHw": "true",
"barrier": "true",
"strict": "true",
"priority": "1",
"idle-timeout": "1",
"hard-timeout": "1",
"cookie": "1",
"table_id": "1",
"node": "1"
}
}
}
config_str = json.dumps(config)
try:
response = odl_http_put(
url_suffix='http://127.0.0.1:8181/restconf/operations/sal-flow:add-flow',
url_params={},
contentType='application/json',
content=config_str)
print(response)
except Exception as e:
print(e, file=stderr)
if __name__ == "__main__":
main()