Change 'port-type' to 'port_type' when pass the parameter to API

The nimble api require 'port_type' when creating a server with port type
specified, but currently the client pass a 'port-type' parameter.

Change-Id: I4be883d41e5b8174f1870f2ed41f1d325a01537d
Closes-Bug: #1652551
This commit is contained in:
liusheng
2016-12-26 10:37:03 +08:00
parent cbc4b1d0c9
commit 925de8b965
2 changed files with 12 additions and 1 deletions

View File

@@ -86,6 +86,11 @@ class CreateServer(command.ShowOne):
self.app.client_manager.image.images,
parsed_args.image)
for nic in parsed_args.nic:
if 'port-type' in nic:
nic['port_type'] = nic['port-type']
del nic['port-type']
data = bc_client.server.create(
name=parsed_args.name,
image_uuid=image_data.id,

View File

@@ -13,6 +13,7 @@
# under the License.
#
import copy
import mock
import uuid
@@ -74,10 +75,15 @@ class TestServerCreate(TestServer):
('name', name),
('flavor', flavor_id),
('image', image_id)]
called_networks = copy.deepcopy(networks)
for nic in called_networks:
if 'port-type' in nic:
nic['port_type'] = nic['port-type']
del nic['port-type']
called_data = {'name': name,
'image_uuid': image_id,
'instance_type_uuid': flavor_id,
'networks': networks}
'networks': called_networks}
for network in networks:
network_id = network.get('uuid')
port_type = network.get('port-type')