blob: 6104f2c215c4bf08c52221ea25c37fd1898af478 [file] [log] [blame]
Ray Milkeya0f983b2016-06-23 19:39:55 -07001#! /usr/bin/env python
2
3import requests
4
5from requests.auth import HTTPBasicAuth
6import sys
7
8if len(sys.argv) != 3:
9 print "usage: post-netcfg onos-node json-file-name"
10 sys.exit(1)
11
12node = sys.argv[1]
13configFileName = sys.argv[2]
14
15jsonFile = open(configFileName, 'rb')
16configJson = jsonFile.read()
17
18request = requests.post('http://' + node + ':8181/onos/v1/network/configuration',
19 auth=HTTPBasicAuth('onos', 'rocks'),
20 data=configJson)
21
22if request.status_code != 200:
23 print request.text
24 sys.exit(1)
25
26sys.exit(0)
27
28
29