blob: 36eadd685e2210abb5d3b563090e82cc84ae3cbd [file] [log] [blame]
Jonathan Hart02102892013-04-10 12:55:50 -07001#! /usr/bin/env python
2
3import os
4import json
5
6CONFIG_FILE=os.getenv("HOME") + "/ONOS/web/config.json"
7
8def read_config():
9 global LB, TESTBED, controllers, core_switches, ONOS_GUI3_HOST, ONOS_GUI3_CONTROL_HOST
10 f = open(CONFIG_FILE)
11 conf = json.load(f)
12 LB = conf['LB']
13 TESTBED = conf['TESTBED']
14 controllers = conf['controllers']
15 core_switches=conf['core_switches']
16 ONOS_GUI3_HOST=conf['ONOS_GUI3_HOST']
17 ONOS_GUI3_CONTROL_HOST=conf['ONOS_GUI3_CONTROL_HOST']
18 f.close()
19
20if __name__ == "__main__":
21 onos_rest_port = 8080
22 read_config()
23
24 try:
25 sw_list = json.dumps(core_switches)
Naoki Shiota862cc3b2013-12-13 15:42:50 -080026 command = "curl -s -H 'Content-Type: application/json' -d '%s' http://%s:%s/wm/onos/internal/clearflowtable/json" % (sw_list, controllers[0], onos_rest_port)
Jonathan Hart02102892013-04-10 12:55:50 -070027
28 print command
29 result = os.popen(command).read()
30 print result
31 except:
32 print "REST IF has issue"
33 exit