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
This commit is contained in:
Dean Troyer
2017-04-27 10:26:07 -05:00
parent 7b609ebd55
commit 589a65c3fe
7 changed files with 300 additions and 144 deletions
doc/source
openstackclient

@ -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"]