Ray Milkey | bba7138 | 2015-08-26 13:09:23 -0700 | [diff] [blame] | 1 | #! /usr/bin/env python |
2 | |||||
3 | import requests | ||||
4 | |||||
5 | from requests.auth import HTTPBasicAuth | ||||
6 | |||||
7 | r = requests.get('http://192.168.56.101:8181/onos/v1/flows', auth=HTTPBasicAuth('onos', 'rocks')) | ||||
8 | deviceId = "of:0000000000000001" | ||||
9 | port = 4 | ||||
10 | flowsJson = r.json() | ||||
11 | |||||
12 | for flow in flowsJson["flows"]: | ||||
13 | if deviceId == flow["deviceId"]: | ||||
14 | if flow["treatment"]["instructions"][0]["port"] == port: | ||||
15 | print flow | ||||
16 | |||||
17 | |||||
18 | |||||
19 |