blob: 5e553930e52041c6112f0876fab58cc7d814a1bf [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
Oleksiy Petrenkocaad2032018-04-20 14:42:46 +03004try:
5 from urllib.parse import urlencode
6except ImportError:
7 from urllib import urlencode
8
Oleksiy Petrenkocaad2032018-04-20 14:42:46 +03009
Oleksiy Petrenko5bfb8bc2018-08-23 15:08:17 +030010@get_by_name_or_uuid_multiple([('subnetpool', 'subnetpool_id')])
Oleksiy Petrenkocaad2032018-04-20 14:42:46 +030011@send('get')
12def subnetpool_get_details(subnetpool_id, **kwargs):
13 url = '/subnetpools/{}?{}'.format(
14 subnetpool_id, urlencode(kwargs)
15 )
16 return url, {}
17
18
Oleksiy Petrenko5bfb8bc2018-08-23 15:08:17 +030019@get_by_name_or_uuid_multiple([('subnetpool', 'subnetpool_id')])
Oleksiy Petrenkocaad2032018-04-20 14:42:46 +030020@send('put')
21def subnetpool_update(subnetpool_id, **kwargs):
22 url = '/subnetpools/{}'.format(subnetpool_id)
23 json = {
24 'subnetpool': kwargs,
25 }
26 return url, {'json': json}
27
28
Oleksiy Petrenko5bfb8bc2018-08-23 15:08:17 +030029@get_by_name_or_uuid_multiple([('subnetpool', 'subnetpool_id')])
Oleksiy Petrenkocaad2032018-04-20 14:42:46 +030030@send('delete')
31def subnetpool_delete(subnetpool_id, **kwargs):
32 url = '/subnetpools/{}'.format(subnetpool_id)
33 return url, {}
34
35
36@send('post')
37def subnetpool_create(name, prefixes, **kwargs):
38 url = '/subnetpools'
39 json = {
40 'subnetpool': {
41 'name': name,
42 'prefixes': prefixes,
43 }
44 }
45 json['subnetpool'].update(kwargs)
46 return url, {'json': json}