From 256ec66f79f98b41497e8937911604bac7ddeabb Mon Sep 17 00:00:00 2001 From: Richard Theis Date: Wed, 28 Sep 2016 08:16:22 -0500 Subject: [PATCH] Remove beta label for network segment resource With Ocata development opened, neutron network segments are no longer beta resources. Change-Id: I25be51c30df17c746136471b88840f64a03187b9 Partially-Implements: blueprint routed-networks --- .../command-objects/network-segment.rst | 20 ------ doc/source/command-objects/subnet.rst | 6 +- openstackclient/network/v2/network_segment.py | 42 ++----------- openstackclient/network/v2/subnet.py | 15 +++-- .../network/v2/test_network_segment.py | 19 ++---- .../unit/network/v2/test_network_segment.py | 61 ------------------- .../tests/unit/network/v2/test_subnet.py | 18 ------ .../bp-routed-networks-3b502faa5cd96807.yaml | 6 +- 8 files changed, 23 insertions(+), 164 deletions(-) diff --git a/doc/source/command-objects/network-segment.rst b/doc/source/command-objects/network-segment.rst index 242dcbe965..d0434651fd 100644 --- a/doc/source/command-objects/network-segment.rst +++ b/doc/source/command-objects/network-segment.rst @@ -14,10 +14,6 @@ network segment create Create new network segment -.. caution:: This is a beta command and subject to change. - Use global option ``--os-beta-command`` to - enable this command. - .. program:: network segment create .. code:: bash @@ -63,10 +59,6 @@ network segment delete Delete network segment(s) -.. caution:: This is a beta command and subject to change. - Use global option ``--os-beta-command`` to - enable this command. - .. program:: network segment delete .. code:: bash @@ -83,10 +75,6 @@ network segment list List network segments -.. caution:: This is a beta command and subject to change. - Use global option ``--os-beta-command`` to - enable this command. - .. program:: network segment list .. code:: bash @@ -107,10 +95,6 @@ network segment set Set network segment properties -.. caution:: This is a beta command and subject to change. - Use global option ``--os-beta-command`` to - enable this command. - .. program:: network segment set .. code:: bash @@ -137,10 +121,6 @@ network segment show Display network segment details -.. caution:: This is a beta command and subject to change. - Use global option ``--os-beta-command`` to - enable this command. - .. program:: network segment show .. code:: bash diff --git a/doc/source/command-objects/subnet.rst b/doc/source/command-objects/subnet.rst index 00401ddab3..e2059875ba 100644 --- a/doc/source/command-objects/subnet.rst +++ b/doc/source/command-objects/subnet.rst @@ -116,11 +116,7 @@ Create new subnet .. option:: --network-segment - Network segment to associate with this subnet (ID only) - - .. caution:: This is a beta command option and subject - to change. Use global option ``--os-beta-command`` - to enable this command option. + Network segment to associate with this subnet (name or ID) .. option:: --service-type diff --git a/openstackclient/network/v2/network_segment.py b/openstackclient/network/v2/network_segment.py index 34cac0e02e..94722f1e68 100644 --- a/openstackclient/network/v2/network_segment.py +++ b/openstackclient/network/v2/network_segment.py @@ -26,12 +26,7 @@ LOG = logging.getLogger(__name__) class CreateNetworkSegment(command.ShowOne): - """Create new network segment - - (Caution: This is a beta command and subject to change. - Use global option --os-beta-command to enable - this command) - """ + """Create new network segment""" def get_parser(self, prog_name): parser = super(CreateNetworkSegment, self).get_parser(prog_name) @@ -76,7 +71,6 @@ class CreateNetworkSegment(command.ShowOne): return parser def take_action(self, parsed_args): - self.validate_os_beta_command_enabled() client = self.app.client_manager.network attrs = {} attrs['name'] = parsed_args.name @@ -96,12 +90,7 @@ class CreateNetworkSegment(command.ShowOne): class DeleteNetworkSegment(command.Command): - """Delete network segment(s) - - (Caution: This is a beta command and subject to change. - Use global option --os-beta-command to enable - this command) - """ + """Delete network segment(s)""" def get_parser(self, prog_name): parser = super(DeleteNetworkSegment, self).get_parser(prog_name) @@ -114,7 +103,6 @@ class DeleteNetworkSegment(command.Command): return parser def take_action(self, parsed_args): - self.validate_os_beta_command_enabled() client = self.app.client_manager.network result = 0 @@ -137,12 +125,7 @@ class DeleteNetworkSegment(command.Command): class ListNetworkSegment(command.Lister): - """List network segments - - (Caution: This is a beta command and subject to change. - Use global option --os-beta-command to enable - this command) - """ + """List network segments""" def get_parser(self, prog_name): parser = super(ListNetworkSegment, self).get_parser(prog_name) @@ -161,8 +144,6 @@ class ListNetworkSegment(command.Lister): return parser def take_action(self, parsed_args): - self.validate_os_beta_command_enabled() - network_client = self.app.client_manager.network filters = {} @@ -204,12 +185,7 @@ class ListNetworkSegment(command.Lister): class SetNetworkSegment(command.Command): - """Set network segment properties - - (Caution: This is a beta command and subject to change. - Use global option --os-beta-command to enable - this command) - """ + """Set network segment properties""" def get_parser(self, prog_name): parser = super(SetNetworkSegment, self).get_parser(prog_name) @@ -231,7 +207,6 @@ class SetNetworkSegment(command.Command): return parser def take_action(self, parsed_args): - self.validate_os_beta_command_enabled() client = self.app.client_manager.network obj = client.find_segment(parsed_args.network_segment, ignore_missing=False) @@ -244,12 +219,7 @@ class SetNetworkSegment(command.Command): class ShowNetworkSegment(command.ShowOne): - """Display network segment details - - (Caution: This is a beta command and subject to change. - Use global option --os-beta-command to enable - this command) - """ + """Display network segment details""" def get_parser(self, prog_name): parser = super(ShowNetworkSegment, self).get_parser(prog_name) @@ -261,8 +231,6 @@ class ShowNetworkSegment(command.ShowOne): return parser def take_action(self, parsed_args): - self.validate_os_beta_command_enabled() - client = self.app.client_manager.network obj = client.find_segment( parsed_args.network_segment, diff --git a/openstackclient/network/v2/subnet.py b/openstackclient/network/v2/subnet.py index 2021d9f03c..1b778c9114 100644 --- a/openstackclient/network/v2/subnet.py +++ b/openstackclient/network/v2/subnet.py @@ -179,7 +179,7 @@ def _get_attrs(client_manager, parsed_args, is_create=True): attrs['ipv6_ra_mode'] = parsed_args.ipv6_ra_mode if parsed_args.ipv6_address_mode is not None: attrs['ipv6_address_mode'] = parsed_args.ipv6_address_mode - if 'network_segment' in parsed_args: + if parsed_args.network_segment is not None: attrs['segment_id'] = client.find_segment( parsed_args.network_segment, ignore_missing=False).id @@ -299,13 +299,12 @@ class CreateSubnet(command.ShowOne): help=_("IPv6 address mode, " "valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]") ) - if self.app.options.os_beta_command: - parser.add_argument( - '--network-segment', - metavar='', - help=_("Network segment to associate with this subnet " - "(ID only)") - ) + parser.add_argument( + '--network-segment', + metavar='', + help=_("Network segment to associate with this subnet " + "(name or ID)") + ) parser.add_argument( '--network', required=True, diff --git a/openstackclient/tests/functional/network/v2/test_network_segment.py b/openstackclient/tests/functional/network/v2/test_network_segment.py index de5aef9650..b6f19ac4bf 100644 --- a/openstackclient/tests/functional/network/v2/test_network_segment.py +++ b/openstackclient/tests/functional/network/v2/test_network_segment.py @@ -39,8 +39,7 @@ class NetworkSegmentTests(base.TestCase): if cls.NETWORK_SEGMENT_EXTENSION: # Get the segment for the network. opts = cls.get_opts(['ID', 'Network']) - raw_output = cls.openstack('--os-beta-command ' - 'network segment list ' + raw_output = cls.openstack('network segment list ' ' --network ' + cls.NETWORK_NAME + ' ' + opts) raw_output_row = raw_output.split('\n')[0] @@ -55,14 +54,12 @@ class NetworkSegmentTests(base.TestCase): if self.NETWORK_SEGMENT_EXTENSION: opts = self.get_opts(['id']) raw_output = self.openstack( - '--os-beta-command' + ' network segment create --network ' + self.NETWORK_ID + ' --network-type geneve ' + ' --segment 2055 test_segment ' + opts ) network_segment_id = raw_output.strip('\n') - raw_output = self.openstack('--os-beta-command ' + - 'network segment delete ' + + raw_output = self.openstack('network segment delete ' + network_segment_id) self.assertOutput('', raw_output) else: @@ -71,8 +68,7 @@ class NetworkSegmentTests(base.TestCase): def test_network_segment_list(self): if self.NETWORK_SEGMENT_EXTENSION: opts = self.get_opts(['ID']) - raw_output = self.openstack('--os-beta-command ' - 'network segment list' + opts) + raw_output = self.openstack('network segment list' + opts) self.assertIn(self.NETWORK_SEGMENT_ID, raw_output) else: self.skipTest('Segment extension disabled') @@ -80,14 +76,12 @@ class NetworkSegmentTests(base.TestCase): def test_network_segment_set(self): if self.NETWORK_SEGMENT_EXTENSION: new_description = 'new_description' - raw_output = self.openstack('--os-beta-command ' - 'network segment set ' + + raw_output = self.openstack('network segment set ' + '--description ' + new_description + ' ' + self.NETWORK_SEGMENT_ID) self.assertOutput('', raw_output) opts = self.get_opts(['description']) - raw_output = self.openstack('--os-beta-command ' - 'network segment show ' + + raw_output = self.openstack('network segment show ' + self.NETWORK_SEGMENT_ID + opts) self.assertEqual(new_description + "\n", raw_output) else: @@ -96,8 +90,7 @@ class NetworkSegmentTests(base.TestCase): def test_network_segment_show(self): if self.NETWORK_SEGMENT_EXTENSION: opts = self.get_opts(['network_id']) - raw_output = self.openstack('--os-beta-command ' - 'network segment show ' + + raw_output = self.openstack('network segment show ' + self.NETWORK_SEGMENT_ID + opts) self.assertEqual(self.NETWORK_ID + "\n", raw_output) else: diff --git a/openstackclient/tests/unit/network/v2/test_network_segment.py b/openstackclient/tests/unit/network/v2/test_network_segment.py index 3e755e0730..b9f0c3cff4 100644 --- a/openstackclient/tests/unit/network/v2/test_network_segment.py +++ b/openstackclient/tests/unit/network/v2/test_network_segment.py @@ -26,9 +26,6 @@ class TestNetworkSegment(network_fakes.TestNetworkV2): def setUp(self): super(TestNetworkSegment, self).setUp() - # Enable beta commands. - self.app.options.os_beta_command = True - # Get a shortcut to the network client self.network = self.app.client_manager.network @@ -81,22 +78,6 @@ class TestCreateNetworkSegment(TestNetworkSegment): self.assertRaises(tests_utils.ParserException, self.check_parser, self.cmd, [], []) - def test_create_no_beta_commands(self): - arglist = [ - '--network', self._network_segment.network_id, - '--network-type', self._network_segment.network_type, - self._network_segment.name, - ] - verifylist = [ - ('network', self._network_segment.network_id), - ('network_type', self._network_segment.network_type), - ('name', self._network_segment.name), - ] - self.app.options.os_beta_command = False - parsed_args = self.check_parser(self.cmd, arglist, verifylist) - self.assertRaises(exceptions.CommandError, self.cmd.take_action, - parsed_args) - def test_create_invalid_network_type(self): arglist = [ '--network', self._network_segment.network_id, @@ -192,18 +173,6 @@ class TestDeleteNetworkSegment(TestNetworkSegment): self.namespace ) - def test_delete_no_beta_commands(self): - arglist = [ - self._network_segments[0].id, - ] - verifylist = [ - ('network_segment', [self._network_segments[0].id]), - ] - self.app.options.os_beta_command = False - parsed_args = self.check_parser(self.cmd, arglist, verifylist) - self.assertRaises(exceptions.CommandError, self.cmd.take_action, - parsed_args) - def test_delete(self): arglist = [ self._network_segments[0].id, @@ -330,12 +299,6 @@ class TestListNetworkSegment(TestNetworkSegment): self.assertEqual(self.columns, columns) self.assertEqual(self.data, list(data)) - def test_list_no_beta_commands(self): - self.app.options.os_beta_command = False - parsed_args = self.check_parser(self.cmd, [], []) - self.assertRaises(exceptions.CommandError, self.cmd.take_action, - parsed_args) - def test_list_long(self): arglist = [ '--long', @@ -391,18 +354,6 @@ class TestSetNetworkSegment(TestNetworkSegment): # Get the command object to test self.cmd = network_segment.SetNetworkSegment(self.app, self.namespace) - def test_set_no_beta_commands(self): - arglist = [ - self._network_segment.id, - ] - verifylist = [ - ('network_segment', self._network_segment.id), - ] - self.app.options.os_beta_command = False - parsed_args = self.check_parser(self.cmd, arglist, verifylist) - self.assertRaises(exceptions.CommandError, self.cmd.take_action, - parsed_args) - def test_set_no_options(self): arglist = [ self._network_segment.id, @@ -485,18 +436,6 @@ class TestShowNetworkSegment(TestNetworkSegment): self.assertRaises(tests_utils.ParserException, self.check_parser, self.cmd, [], []) - def test_show_no_beta_commands(self): - arglist = [ - self._network_segment.id, - ] - verifylist = [ - ('network_segment', self._network_segment.id), - ] - self.app.options.os_beta_command = False - parsed_args = self.check_parser(self.cmd, arglist, verifylist) - self.assertRaises(exceptions.CommandError, self.cmd.take_action, - parsed_args) - def test_show_all_options(self): arglist = [ self._network_segment.id, diff --git a/openstackclient/tests/unit/network/v2/test_subnet.py b/openstackclient/tests/unit/network/v2/test_subnet.py index 9c468f3924..2d51aa4ad9 100644 --- a/openstackclient/tests/unit/network/v2/test_subnet.py +++ b/openstackclient/tests/unit/network/v2/test_subnet.py @@ -379,23 +379,6 @@ class TestCreateSubnet(TestSubnet): self.assertEqual(self.columns, columns) self.assertEqual(self.data_ipv6, data) - def test_create_no_beta_command_options(self): - arglist = [ - "--subnet-range", self._subnet.cidr, - "--network-segment", self._network_segment.id, - "--network", self._subnet.network_id, - self._subnet.name, - ] - verifylist = [ - ('name', self._subnet.name), - ('subnet_range', self._subnet.cidr), - ('network-segment', self._network_segment.id), - ('network', self._subnet.network_id), - ] - self.app.options.os_beta_command = False - self.assertRaises(tests_utils.ParserException, - self.check_parser, self.cmd, arglist, verifylist) - def test_create_with_network_segment(self): # Mock SDK calls for this test. self.network.create_subnet = mock.Mock(return_value=self._subnet) @@ -417,7 +400,6 @@ class TestCreateSubnet(TestSubnet): ] - self.app.options.os_beta_command = True parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) diff --git a/releasenotes/notes/bp-routed-networks-3b502faa5cd96807.yaml b/releasenotes/notes/bp-routed-networks-3b502faa5cd96807.yaml index b055479368..6da2f7afca 100644 --- a/releasenotes/notes/bp-routed-networks-3b502faa5cd96807.yaml +++ b/releasenotes/notes/bp-routed-networks-3b502faa5cd96807.yaml @@ -1,6 +1,8 @@ --- features: - Add ``network segment create``, ``network segment delete`` and - ``network segment set`` commands. These are beta commands and subject to - change. Use global option ``--os-beta-command`` to enable these commands. + ``network segment set`` commands. In addition, the ``network segment list`` + and ``network segment show`` commands are no longer beta commands and + the ``--network-segment`` option on the ``subnet create`` command is + no longer a beta command option. [Blueprint `routed-networks `_]