Remove the --dhcp option to network list

The --dhcp option lists agents, not networks.  This does not make
a lot of sense.  Another command should be created to list agents.

BackwardsIncompatibleImpact
Closes-Bug: #1472613

Change-Id: I5ecfe3fc046a07eb64a4dabd41dbd99de7c2215f
This commit is contained in:
TerryHowe 2015-07-08 11:21:41 -06:00
parent f07f71661f
commit 2d4a737160
3 changed files with 40 additions and 84 deletions

View File

@ -61,6 +61,20 @@ List of Backwards Incompatible Changes
* Bug: https://bugs.launchpad.net/python-openstackclient/+bug/1461817
* Commit: https://review.openstack.org/#/c/194654/
5. Command `openstack network list --dhcp` has been removed
The --dhcp option to network list is not a logical use case of listing
networks, it lists agents. Another command should be added in the future
to provide this functionality. It is highly unlikely anyone uses this
feature as we don't support any other agent commands. Use neutron
dhcp-agent-list-hosting-net command instead.
* In favor of: Create network agent list command in the future
* As of: 1.6.0
* Removed in: NA
* Bug: https://bugs.launchpad.net/python-openstackclient/+bug/472613
* Commit: https://review.openstack.org/#/c/194654/
For Developers
==============

View File

@ -156,10 +156,6 @@ class ListNetwork(lister.Lister):
default=False,
help='List external networks',
)
parser.add_argument(
'--dhcp',
metavar='<dhcp-id>',
help='DHCP agent ID')
parser.add_argument(
'--long',
action='store_true',
@ -172,40 +168,34 @@ class ListNetwork(lister.Lister):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
if parsed_args.dhcp:
data = client.api.dhcp_agent_list(dhcp_id=parsed_args.dhcp)
data = client.api.network_list(external=parsed_args.external)
columns = ('ID',)
column_headers = columns
if parsed_args.long:
columns = (
'ID',
'Name',
'Status',
'project_id',
'state',
'Shared',
'Subnets',
'provider:network_type',
'router_type',
)
column_headers = (
'ID',
'Name',
'Status',
'Project',
'State',
'Shared',
'Subnets',
'Network Type',
'Router Type',
)
else:
data = client.api.network_list(external=parsed_args.external)
if parsed_args.long:
columns = (
'ID',
'Name',
'Status',
'project_id',
'state',
'Shared',
'Subnets',
'provider:network_type',
'router_type',
)
column_headers = (
'ID',
'Name',
'Status',
'Project',
'State',
'Shared',
'Subnets',
'Network Type',
'Router Type',
)
else:
columns = ('ID', 'Name', 'Subnets')
column_headers = columns
columns = ('ID', 'Name', 'Subnets')
column_headers = columns
for d in data:
d = _prep_network_detail(d)

View File

@ -278,7 +278,6 @@ class TestListNetwork(common.TestNetworkBase):
arglist = []
verifylist = [
('external', False),
('dhcp', None),
('long', False),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -306,7 +305,6 @@ class TestListNetwork(common.TestNetworkBase):
]
verifylist = [
('external', True),
('dhcp', None),
('long', False),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -334,7 +332,6 @@ class TestListNetwork(common.TestNetworkBase):
]
verifylist = [
('long', True),
('dhcp', None),
('external', False),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -377,51 +374,6 @@ class TestListNetwork(common.TestNetworkBase):
self.assertEqual(list(data), datalist)
@mock.patch(
'openstackclient.api.network_v2.APIv2.dhcp_agent_list'
)
class TestListDhcpAgent(common.TestNetworkBase):
def setUp(self):
super(TestListDhcpAgent, self).setUp()
# Get the command object to test
self.cmd = network.ListNetwork(self.app, self.namespace)
self.DHCP_LIST = [
{'id': '1'},
{'id': '2'},
]
def test_list_dhcp(self, n_mock):
n_mock.return_value = self.DHCP_LIST
arglist = [
'--dhcp', 'dhcpid',
]
verifylist = [
('external', False),
('dhcp', 'dhcpid'),
('long', False),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
columns, data = self.cmd.take_action(parsed_args)
# Set expected values
n_mock.assert_called_with(
dhcp_id='dhcpid',
)
self.assertEqual(('ID',), columns)
datalist = [
('1',),
('2',),
]
self.assertEqual(datalist, list(data))
class TestSetNetwork(common.TestNetworkBase):
def test_set_this(self):
arglist = [