blob: 5c240aad883a6a5b9c7ae4b5c2c333807119c614 [file] [log] [blame]
Oleksiy Petrenko5bfb8bc2018-08-23 15:08:17 +03001from neutronv2.common import send
2from neutronv2.arg_converter import get_by_name_or_uuid_multiple
3
4try:
5 from urllib.parse import urlencode
6except ImportError:
7 from urllib import urlencode
8
9
10@send('post')
11def router_create(name, **kwargs):
12 url = '/routers'
13 json = {
14 'router': {
15 'name': name,
16 }
17 }
18 json['router'].update(kwargs)
19 return url, {'json': json}
20
21
22@get_by_name_or_uuid_multiple([('router', 'router_id')])
23@send('get')
24def router_get_details(router_id, **kwargs):
25 url = '/routers/{}?{}'.format(router_id, urlencode(kwargs))
26 return url, {}
27
28
29@get_by_name_or_uuid_multiple([('router', 'router_id')])
30@send('put')
31def router_update(router_id, **kwargs):
32 url = '/routers/{}'.format(router_id)
33 return url, {'json': {'router': kwargs}}
34
35
36@get_by_name_or_uuid_multiple([('router', 'router_id')])
37@send('delete')
38def router_delete(router_id, **kwargs):
39 url = '/routers/{}'.format(router_id)
40 return url, {}
41
42
43@get_by_name_or_uuid_multiple([('router', 'router_id')])
44@send('put')
45def router_interface_add(router_id, **kwargs):
46 url = '/routers/{}/add_role_interface'.format(router_id)
47 json = kwargs
48 return url, {'json': json}
49
50
51@get_by_name_or_uuid_multiple([('router', 'router_id')])
52@send('put')
53def router_interface_remove(router_id, **kwargs):
54 url = '/routers/{}/remove_role_interface'.format(router_id)
55 json = kwargs
56 return url, {'json': json}