f48ebc035ec064beabcce9e4a7e95ba080c955d1
[integration/test.git] / test / tools / odl-mdsal-clustering-tests / clustering-performance-test / config_cleanup.py
1 __author__ = "Jan Medved"
2 __copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
3 __license__ = "New-style BSD"
4 __email__ = "jmedved@cisco.com"
5
6
7 import json
8 import argparse
9 import requests
10
11 CONFIGURL = 'restconf/config/opendaylight-inventory:nodes'
12 getheaders = {'Accept': 'application/json'}
13
14
15 if __name__ == "__main__":
16
17     parser = argparse.ArgumentParser(description='Cleans up the config space')
18     parser.add_argument('--odlhost', default='127.0.0.1', help='host where '
19                         'odl controller is running (default is 127.0.0.1)')
20     parser.add_argument('--odlport', default='8080', help='port on '
21                         'which odl\'s RESTCONF is listening (default is 8080)')
22
23     in_args = parser.parse_args()
24
25     url = 'http://' + in_args.odlhost + ":" + in_args.odlport + '/' + CONFIGURL
26     s = requests.Session()
27     r = s.delete(url, headers=getheaders)
28
29     if r.status_code != 200:
30         print 'Failed to delete nodes in the config space, code %d' % r.status_code
31     else:
32         print 'Nodes in config space deleted.'