summaryrefslogtreecommitdiff
path: root/openstackclient/api
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2017-04-27 10:26:07 -0500
committerDean Troyer <dtroyer@gmail.com>2017-04-27 20:36:00 +0000
commit589a65c3fee2d61a13eaa53785afd3525d9ae80d (patch)
tree94864ff5360391385b3e73517e3698e6f3cc14ab /openstackclient/api
parent7b609ebd55b1ff38be4763b5122b4a48a05ef931 (diff)
downloadpython-openstackclient-589a65c3fee2d61a13eaa53785afd3525d9ae80d.tar.gz
Fix Nova-net netowrk commands
In cleaning up functional tests for nova-net, I discovered some problems in network create: * --subnet option is required in network create command * Switch API to use /os-networks rather than /os-tenant-networks as this is what we were actually using via novaclient * Fix functional tests for nova-net * Normalize some private function names in network/v2/network.py Change-Id: I426b864406756d58d140575a3a45ee9aee67ce84
Diffstat (limited to 'openstackclient/api')
-rw-r--r--openstackclient/api/compute_v2.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/openstackclient/api/compute_v2.py b/openstackclient/api/compute_v2.py
index 65022671..51b34482 100644
--- a/openstackclient/api/compute_v2.py
+++ b/openstackclient/api/compute_v2.py
@@ -202,24 +202,25 @@ class APIv2(api.BaseAPI):
):
"""Create a new network
- https://developer.openstack.org/api-ref/compute/#create-project-network
+ https://developer.openstack.org/api-ref/compute/#create-network
:param string name:
- Network label
+ Network label (required)
:param integer subnet:
- Subnet for IPv4 fixed addresses in CIDR notation
+ Subnet for IPv4 fixed addresses in CIDR notation (required)
:param integer share_subnet:
Shared subnet between projects, True or False
:returns: A dict of the network attributes
"""
- url = "/os-tenant-networks"
+ url = "/os-networks"
params = {
'label': name,
'cidr': subnet,
- 'share_address': share_subnet,
}
+ if share_subnet is not None:
+ params['share_address'] = share_subnet
return self.create(
url,
@@ -232,13 +233,13 @@ class APIv2(api.BaseAPI):
):
"""Delete a network
- https://developer.openstack.org/api-ref/compute/#delete-project-network
+ https://developer.openstack.org/api-ref/compute/#delete-network
:param string network:
Network name or ID
"""
- url = "/os-tenant-networks"
+ url = "/os-networks"
network = self.find(
url,
@@ -256,14 +257,14 @@ class APIv2(api.BaseAPI):
):
"""Return a network given name or ID
- https://developer.openstack.org/api-ref/compute/#show-project-network-details
+ https://developer.openstack.org/api-ref/compute/#show-network-details
:param string network:
Network name or ID
:returns: A dict of the network attributes
"""
- url = "/os-tenant-networks"
+ url = "/os-networks"
return self.find(
url,
@@ -276,13 +277,13 @@ class APIv2(api.BaseAPI):
):
"""Get networks
- https://developer.openstack.org/api-ref/compute/#list-project-networks
+ https://developer.openstack.org/api-ref/compute/#list-networks
:returns:
list of networks
"""
- url = "/os-tenant-networks"
+ url = "/os-networks"
return self.list(url)["networks"]