blob: bf0bf6ca560e07f98380dc0fe0013d7f11fe3881 [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([('network', 'network_id')])
Oleksiy Petrenkocaad2032018-04-20 14:42:46 +030011@send('get')
12def network_get_details(network_id, **kwargs):
13 url = '/networks/{}?{}'.format(network_id, urlencode(kwargs))
14 return url, {}
15
16
Oleksiy Petrenko5bfb8bc2018-08-23 15:08:17 +030017@get_by_name_or_uuid_multiple([('network', 'network_id')])
Oleksiy Petrenkocaad2032018-04-20 14:42:46 +030018@send('put')
19def network_update(network_id, **kwargs):
20 url = '/networks/{}'.format(network_id)
21 json = {
22 'network': kwargs,
23 }
24 return url, {'json': json}
25
26
Oleksiy Petrenko5bfb8bc2018-08-23 15:08:17 +030027@get_by_name_or_uuid_multiple([('network', 'network_id')])
Oleksiy Petrenkocaad2032018-04-20 14:42:46 +030028@send('delete')
29def network_delete(network_id, **kwargs):
30 url = '/networks/{}'.format(network_id)
31 return url, {}
32
33
34@send('post')
35def network_create(**kwargs):
36 url = '/networks'
37 json = {
38 'network': kwargs,
39 }
40 return url, {'json': json}
41
42
43@send('post')
44def network_bulk_create(networks, **kwargs):
45 url = '/networks'
46 json = {
47 'networks': networks,
48 }
49 return url, {'json': json}