blob: ea3e964770db0fc34e504f5beca14b3d71b55a14 [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)
26 command = "curl -s -H 'Content-Type: application/json' -d '%s' http://%s:%s/wm/core/clearflowtable/json" % (sw_list, controllers[0], onos_rest_port)
27
28 print command
29 result = os.popen(command).read()
30 print result
31 except:
32 print "REST IF has issue"
33 exit