Change commands name from net-* to tenant-network-*
Currently the commands of os-tenant-network API use net-* which may confuse users sometime. This patch changes commands to tenant-network-*, and marks net-* commands as DEPRECATED. Closes-Bug: #1152862 Change-Id: I8c3a0be08763a6f626d7fc7cf84811ac61ccc526
This commit is contained in:
parent
b53a5e5ab1
commit
dfc752d725
@ -1867,6 +1867,23 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||||||
def post_os_networks_2_action(self, **kw):
|
def post_os_networks_2_action(self, **kw):
|
||||||
return (202, {}, None)
|
return (202, {}, None)
|
||||||
|
|
||||||
|
def get_os_tenant_networks(self, **kw):
|
||||||
|
return (200, {}, {'networks': [{"label": "1", "cidr": "10.0.0.0/24",
|
||||||
|
'project_id':
|
||||||
|
'4ffc664c198e435e9853f2538fbcd7a7',
|
||||||
|
'id': '1', 'vlan': '1234'}]})
|
||||||
|
|
||||||
|
def get_os_tenant_networks_1(self, **kw):
|
||||||
|
return (200, {}, {'network': {"label": "1", "cidr": "10.0.0.0/24",
|
||||||
|
"id": "1"}})
|
||||||
|
|
||||||
|
def post_os_tenant_networks(self, **kw):
|
||||||
|
return (202, {}, {'network': {"label": "new_network1",
|
||||||
|
"cidr1": "10.0.1.0/24"}})
|
||||||
|
|
||||||
|
def delete_os_tenant_networks_1(self, **kw):
|
||||||
|
return (202, {}, None)
|
||||||
|
|
||||||
def get_os_availability_zone(self, **kw):
|
def get_os_availability_zone(self, **kw):
|
||||||
return (200, {}, {
|
return (200, {}, {
|
||||||
"availabilityZoneInfo": [
|
"availabilityZoneInfo": [
|
||||||
|
@ -1942,6 +1942,23 @@ class ShellTest(utils.TestCase):
|
|||||||
self.run_command('network-delete 1')
|
self.run_command('network-delete 1')
|
||||||
self.assert_called('DELETE', '/os-networks/1')
|
self.assert_called('DELETE', '/os-networks/1')
|
||||||
|
|
||||||
|
def test_tenant_network_list(self):
|
||||||
|
self.run_command('tenant-network-list')
|
||||||
|
self.assert_called('GET', '/os-tenant-networks')
|
||||||
|
|
||||||
|
def test_tenant_network_show(self):
|
||||||
|
self.run_command('tenant-network-show 1')
|
||||||
|
self.assert_called('GET', '/os-tenant-networks/1')
|
||||||
|
|
||||||
|
def test_tenant_network_create(self):
|
||||||
|
self.run_command('tenant-network-create new_network 10.0.1.0/24')
|
||||||
|
body = {'network': {'cidr': '10.0.1.0/24', 'label': 'new_network'}}
|
||||||
|
self.assert_called('POST', '/os-tenant-networks', body)
|
||||||
|
|
||||||
|
def test_tenant_network_delete(self):
|
||||||
|
self.run_command('tenant-network-delete 1')
|
||||||
|
self.assert_called('DELETE', '/os-tenant-networks/1')
|
||||||
|
|
||||||
def test_add_fixed_ip(self):
|
def test_add_fixed_ip(self):
|
||||||
self.run_command('add-fixed-ip sample-server 1')
|
self.run_command('add-fixed-ip sample-server 1')
|
||||||
self.assert_called('POST', '/servers/1234/action',
|
self.assert_called('POST', '/servers/1234/action',
|
||||||
|
@ -44,7 +44,15 @@ class TenantNetworkManager(base.ManagerWithFind):
|
|||||||
@cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
|
@cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||||
def do_net(cs, args):
|
def do_net(cs, args):
|
||||||
"""
|
"""
|
||||||
Show a network
|
DEPRECATED, Use tenant-network-show instead.
|
||||||
|
"""
|
||||||
|
do_tenant_network_show(cs, args)
|
||||||
|
|
||||||
|
|
||||||
|
@cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||||
|
def do_tenant_network_show(cs, args):
|
||||||
|
"""
|
||||||
|
Show a tenant network.
|
||||||
"""
|
"""
|
||||||
network = cs.tenant_networks.get(args.network_id)
|
network = cs.tenant_networks.get(args.network_id)
|
||||||
utils.print_dict(network._info)
|
utils.print_dict(network._info)
|
||||||
@ -52,7 +60,14 @@ def do_net(cs, args):
|
|||||||
|
|
||||||
def do_net_list(cs, args):
|
def do_net_list(cs, args):
|
||||||
"""
|
"""
|
||||||
List networks
|
DEPRECATED, use tenant-network-list instead.
|
||||||
|
"""
|
||||||
|
do_tenant_network_list(cs, args)
|
||||||
|
|
||||||
|
|
||||||
|
def do_tenant_network_list(cs, args):
|
||||||
|
"""
|
||||||
|
List tenant networks.
|
||||||
"""
|
"""
|
||||||
networks = cs.tenant_networks.list()
|
networks = cs.tenant_networks.list()
|
||||||
utils.print_list(networks, ['ID', 'Label', 'CIDR'])
|
utils.print_list(networks, ['ID', 'Label', 'CIDR'])
|
||||||
@ -68,7 +83,22 @@ def do_net_list(cs, args):
|
|||||||
help=_('IP block to allocate from (ex. 172.16.0.0/24 or 2001:DB8::/64)'))
|
help=_('IP block to allocate from (ex. 172.16.0.0/24 or 2001:DB8::/64)'))
|
||||||
def do_net_create(cs, args):
|
def do_net_create(cs, args):
|
||||||
"""
|
"""
|
||||||
Create a network
|
DEPRECATED, use tenant-network-create instead.
|
||||||
|
"""
|
||||||
|
do_tenant_network_create(cs, args)
|
||||||
|
|
||||||
|
|
||||||
|
@cliutils.arg(
|
||||||
|
'label',
|
||||||
|
metavar='<network_label>',
|
||||||
|
help=_('Network label (ex. my_new_network)'))
|
||||||
|
@cliutils.arg(
|
||||||
|
'cidr',
|
||||||
|
metavar='<cidr>',
|
||||||
|
help=_('IP block to allocate from (ex. 172.16.0.0/24 or 2001:DB8::/64)'))
|
||||||
|
def do_tenant_network_create(cs, args):
|
||||||
|
"""
|
||||||
|
Create a tenant network.
|
||||||
"""
|
"""
|
||||||
network = cs.tenant_networks.create(args.label, args.cidr)
|
network = cs.tenant_networks.create(args.label, args.cidr)
|
||||||
utils.print_dict(network._info)
|
utils.print_dict(network._info)
|
||||||
@ -77,6 +107,14 @@ def do_net_create(cs, args):
|
|||||||
@cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
|
@cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||||
def do_net_delete(cs, args):
|
def do_net_delete(cs, args):
|
||||||
"""
|
"""
|
||||||
Delete a network
|
DEPRECATED, use tenant-network-delete instead.
|
||||||
|
"""
|
||||||
|
do_tenant_network_delete(cs, args)
|
||||||
|
|
||||||
|
|
||||||
|
@cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||||
|
def do_tenant_network_delete(cs, args):
|
||||||
|
"""
|
||||||
|
Delete a tenant network.
|
||||||
"""
|
"""
|
||||||
cs.tenant_networks.delete(args.network_id)
|
cs.tenant_networks.delete(args.network_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user