Skip to content

Commit 1d6e242

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Remove deprecated network options"
2 parents 3161f87 + 5a0fc68 commit 1d6e242

8 files changed

Lines changed: 56 additions & 252 deletions

File tree

doc/source/cli/backwards-incompatible.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@ Release 4.0
5555
* Removed in: 4.0
5656
* Commit: https://review.opendev.org/659431
5757

58+
7. Remove ``port create|set`` options ``--device-id`` and ``--host-id``.
59+
Use ``--device`` and ``--host`` instead.
60+
61+
* Removed in: 4.0
62+
* Commit: https://review.opendev.org/613644
63+
64+
8. Remove ``router set`` option ``--clear-routes``.
65+
Use ``no-route`` option instead.
66+
67+
* Removed in: 4.0
68+
* Commit: https://review.opendev.org/613644
69+
70+
9. Remove ``security group rule create`` options ``--src-ip`` and ``--src-group``.
71+
Use ``--remote-ip`` and ``--remote-group`` options instead.
72+
73+
* Removed in: 4.0
74+
* Commit: https://review.opendev.org/613644
75+
5876
.. 1. Change ``volume transfer request accept`` to use new option ``--auth-key``
5977
.. rather than a second positional argument.
6078

openstackclient/network/v2/port.py

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,6 @@ def __call__(self, parser, namespace, values, option_string=None):
9696
def _get_attrs(client_manager, parsed_args):
9797
attrs = {}
9898

99-
# Handle deprecated options
100-
# NOTE(dtroyer): --device-id and --host-id were deprecated in Mar 2016.
101-
# Do not remove before 3.x release or Mar 2017.
102-
if parsed_args.device_id:
103-
attrs['device_id'] = parsed_args.device_id
104-
LOG.warning(_(
105-
'The --device-id option is deprecated, '
106-
'please use --device instead.'
107-
))
108-
if parsed_args.host_id:
109-
attrs['binding:host_id'] = parsed_args.host_id
110-
LOG.warning(_(
111-
'The --host-id option is deprecated, '
112-
'please use --host instead.'
113-
))
11499
if parsed_args.description is not None:
115100
attrs['description'] = parsed_args.description
116101
if parsed_args.device:
@@ -235,19 +220,11 @@ def _add_updatable_args(parser):
235220
metavar='<description>',
236221
help=_("Description of this port")
237222
)
238-
# NOTE(dtroyer): --device-id is deprecated in Mar 2016. Do not
239-
# remove before 3.x release or Mar 2017.
240-
device_group = parser.add_mutually_exclusive_group()
241-
device_group.add_argument(
223+
parser.add_argument(
242224
'--device',
243225
metavar='<device-id>',
244226
help=_("Port device ID")
245227
)
246-
device_group.add_argument(
247-
'--device-id',
248-
metavar='<device-id>',
249-
help=argparse.SUPPRESS,
250-
)
251228
parser.add_argument(
252229
'--mac-address',
253230
metavar='<mac-address>',
@@ -268,19 +245,11 @@ def _add_updatable_args(parser):
268245
"macvtap | normal | baremetal | virtio-forwarder, "
269246
"default: normal)")
270247
)
271-
# NOTE(dtroyer): --host-id is deprecated in Mar 2016. Do not
272-
# remove before 3.x release or Mar 2017.
273-
host_group = parser.add_mutually_exclusive_group()
274-
host_group.add_argument(
248+
parser.add_argument(
275249
'--host',
276250
metavar='<host-id>',
277251
help=_("Allocate port on host <host-id> (ID only)")
278252
)
279-
host_group.add_argument(
280-
'--host-id',
281-
metavar='<host-id>',
282-
help=argparse.SUPPRESS,
283-
)
284253
parser.add_argument(
285254
'--dns-domain',
286255
metavar='dns-domain',

openstackclient/network/v2/router.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
"""Router action implementations"""
1515

16-
import argparse
1716
import copy
1817
import json
1918
import logging
@@ -528,8 +527,6 @@ def get_parser(self, prog_name):
528527
action='store_true',
529528
help=_("Set router to centralized mode (disabled router only)")
530529
)
531-
routes_group = parser.add_mutually_exclusive_group()
532-
# ToDo(Reedip):Remove mutual exclusiveness once clear-routes is removed
533530
parser.add_argument(
534531
'--route',
535532
metavar='destination=<subnet>,gateway=<ip-address>',
@@ -542,18 +539,13 @@ def get_parser(self, prog_name):
542539
"gateway: nexthop IP address "
543540
"(repeat option to set multiple routes)")
544541
)
545-
routes_group.add_argument(
542+
parser.add_argument(
546543
'--no-route',
547544
action='store_true',
548545
help=_("Clear routes associated with the router. "
549546
"Specify both --route and --no-route to overwrite "
550547
"current value of route.")
551548
)
552-
routes_group.add_argument(
553-
'--clear-routes',
554-
action='store_true',
555-
help=argparse.SUPPRESS,
556-
)
557549
routes_ha = parser.add_mutually_exclusive_group()
558550
routes_ha.add_argument(
559551
'--ha',
@@ -619,21 +611,16 @@ def take_action(self, parsed_args):
619611
attrs['ha'] = True
620612
elif parsed_args.no_ha:
621613
attrs['ha'] = False
622-
if parsed_args.clear_routes:
623-
LOG.warning(_(
624-
'The --clear-routes option is deprecated, '
625-
'please use --no-route instead.'
626-
))
627614

628615
if parsed_args.routes is not None:
629616
for route in parsed_args.routes:
630617
route['nexthop'] = route.pop('gateway')
631618
attrs['routes'] = parsed_args.routes
632-
if not (parsed_args.no_route or parsed_args.clear_routes):
619+
if not parsed_args.no_route:
633620
# Map the route keys and append to the current routes.
634621
# The REST API will handle route validation and duplicates.
635622
attrs['routes'] += obj.routes
636-
elif parsed_args.no_route or parsed_args.clear_routes:
623+
elif parsed_args.no_route:
637624
attrs['routes'] = []
638625
if (parsed_args.disable_snat or parsed_args.enable_snat or
639626
parsed_args.fixed_ip) and not parsed_args.external_gateway:

openstackclient/network/v2/security_group_rule.py

Lines changed: 8 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,6 @@ def update_parser_common(self, parser):
115115
metavar="<group>",
116116
help=_("Remote security group (name or ID)"),
117117
)
118-
# Handle deprecated options
119-
# NOTE(dtroyer): --src-ip and --src-group were deprecated in Nov 2016.
120-
# Do not remove before 4.x release or Nov 2017.
121-
remote_group.add_argument(
122-
"--src-ip",
123-
metavar="<ip-address>",
124-
help=argparse.SUPPRESS,
125-
)
126-
remote_group.add_argument(
127-
"--src-group",
128-
metavar="<group>",
129-
help=argparse.SUPPRESS,
130-
)
131118
return parser
132119

133120
def update_parser_network(self, parser):
@@ -310,31 +297,13 @@ def take_action_network(self, client, parsed_args):
310297
if parsed_args.icmp_code is not None and parsed_args.icmp_code >= 0:
311298
attrs['port_range_max'] = parsed_args.icmp_code
312299

313-
# NOTE(dtroyer): --src-ip and --src-group were deprecated in Nov 2016.
314-
# Do not remove before 4.x release or Nov 2017.
315-
if not (parsed_args.remote_group is None and
316-
parsed_args.src_group is None):
300+
if parsed_args.remote_group is not None:
317301
attrs['remote_group_id'] = client.find_security_group(
318-
parsed_args.remote_group or parsed_args.src_group,
302+
parsed_args.remote_group,
319303
ignore_missing=False
320304
).id
321-
if parsed_args.src_group:
322-
LOG.warning(
323-
_("The %(old)s option is deprecated, "
324-
"please use %(new)s instead."),
325-
{'old': '--src-group', 'new': '--remote-group'},
326-
)
327-
elif not (parsed_args.remote_ip is None and
328-
parsed_args.src_ip is None):
329-
attrs['remote_ip_prefix'] = (
330-
parsed_args.remote_ip or parsed_args.src_ip
331-
)
332-
if parsed_args.src_ip:
333-
LOG.warning(
334-
_("The %(old)s option is deprecated, "
335-
"please use %(new)s instead."),
336-
{'old': '--src-ip', 'new': '--remote-ip'},
337-
)
305+
elif parsed_args.remote_ip is not None:
306+
attrs['remote_ip_prefix'] = parsed_args.remote_ip
338307
elif attrs['ethertype'] == 'IPv4':
339308
attrs['remote_ip_prefix'] = '0.0.0.0/0'
340309
attrs['security_group_id'] = security_group_id
@@ -361,29 +330,13 @@ def take_action_compute(self, client, parsed_args):
361330
else:
362331
from_port, to_port = parsed_args.dst_port
363332

364-
# NOTE(dtroyer): --src-ip and --src-group were deprecated in Nov 2016.
365-
# Do not remove before 4.x release or Nov 2017.
366333
remote_ip = None
367-
if not (parsed_args.remote_group is None and
368-
parsed_args.src_group is None):
334+
if parsed_args.remote_group is not None:
369335
parsed_args.remote_group = client.api.security_group_find(
370-
parsed_args.remote_group or parsed_args.src_group,
336+
parsed_args.remote_group,
371337
)['id']
372-
if parsed_args.src_group:
373-
LOG.warning(
374-
_("The %(old)s option is deprecated, "
375-
"please use %(new)s instead."),
376-
{'old': '--src-group', 'new': '--remote-group'},
377-
)
378-
if not (parsed_args.remote_ip is None and
379-
parsed_args.src_ip is None):
380-
remote_ip = parsed_args.remote_ip or parsed_args.src_ip
381-
if parsed_args.src_ip:
382-
LOG.warning(
383-
_("The %(old)s option is deprecated, "
384-
"please use %(new)s instead."),
385-
{'old': '--src-ip', 'new': '--remote-ip'},
386-
)
338+
if parsed_args.remote_ip is not None:
339+
remote_ip = parsed_args.remote_ip
387340
else:
388341
remote_ip = '0.0.0.0/0'
389342

openstackclient/tests/unit/network/v2/test_router.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -939,52 +939,6 @@ def test_set_route_overwrite_route(self):
939939
_testrouter, **attrs)
940940
self.assertIsNone(result)
941941

942-
def test_set_clear_routes(self):
943-
arglist = [
944-
self._router.name,
945-
'--clear-routes',
946-
]
947-
verifylist = [
948-
('router', self._router.name),
949-
('clear_routes', True),
950-
]
951-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
952-
953-
result = self.cmd.take_action(parsed_args)
954-
955-
attrs = {
956-
'routes': [],
957-
}
958-
self.network.update_router.assert_called_once_with(
959-
self._router, **attrs)
960-
self.assertIsNone(result)
961-
962-
def test_overwrite_route_clear_routes(self):
963-
_testrouter = network_fakes.FakeRouter.create_one_router(
964-
{'routes': [{"destination": "10.0.0.2",
965-
"nexthop": "1.1.1.1"}]})
966-
self.network.find_router = mock.Mock(return_value=_testrouter)
967-
arglist = [
968-
_testrouter.name,
969-
'--route', 'destination=10.20.30.0/24,gateway=10.20.30.1',
970-
'--clear-routes',
971-
]
972-
verifylist = [
973-
('router', _testrouter.name),
974-
('routes', [{'destination': '10.20.30.0/24',
975-
'gateway': '10.20.30.1'}]),
976-
('clear_routes', True),
977-
]
978-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
979-
result = self.cmd.take_action(parsed_args)
980-
attrs = {
981-
'routes': [{'destination': '10.20.30.0/24',
982-
'nexthop': '10.20.30.1'}]
983-
}
984-
self.network.update_router.assert_called_once_with(
985-
_testrouter, **attrs)
986-
self.assertIsNone(result)
987-
988942
def test_set_nothing(self):
989943
arglist = [
990944
self._router.name,

0 commit comments

Comments
 (0)