python-neutronclient 13.0.0__py3-none-any.whl → 14.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {python_neutronclient-13.0.0.dist-info → python_neutronclient-14.0.0.dist-info}/METADATA +1 -1
  2. {python_neutronclient-13.0.0.dist-info → python_neutronclient-14.0.0.dist-info}/RECORD +8 -23
  3. {python_neutronclient-13.0.0.dist-info → python_neutronclient-14.0.0.dist-info}/WHEEL +1 -1
  4. {python_neutronclient-13.0.0.dist-info → python_neutronclient-14.0.0.dist-info}/entry_points.txt +0 -25
  5. python_neutronclient-14.0.0.dist-info/pbr.json +1 -0
  6. neutronclient/osc/v2/vpnaas/__init__.py +0 -0
  7. neutronclient/osc/v2/vpnaas/endpoint_group.py +0 -222
  8. neutronclient/osc/v2/vpnaas/ikepolicy.py +0 -318
  9. neutronclient/osc/v2/vpnaas/ipsec_site_connection.py +0 -385
  10. neutronclient/osc/v2/vpnaas/ipsecpolicy.py +0 -318
  11. neutronclient/osc/v2/vpnaas/utils.py +0 -112
  12. neutronclient/osc/v2/vpnaas/vpnservice.py +0 -252
  13. neutronclient/tests/unit/osc/v2/vpnaas/__init__.py +0 -0
  14. neutronclient/tests/unit/osc/v2/vpnaas/common.py +0 -183
  15. neutronclient/tests/unit/osc/v2/vpnaas/fakes.py +0 -191
  16. neutronclient/tests/unit/osc/v2/vpnaas/test_endpoint_group.py +0 -254
  17. neutronclient/tests/unit/osc/v2/vpnaas/test_ikepolicy.py +0 -319
  18. neutronclient/tests/unit/osc/v2/vpnaas/test_ipsec_site_connection.py +0 -372
  19. neutronclient/tests/unit/osc/v2/vpnaas/test_ipsecpolicy.py +0 -299
  20. neutronclient/tests/unit/osc/v2/vpnaas/test_vpnservice.py +0 -305
  21. python_neutronclient-13.0.0.dist-info/pbr.json +0 -1
  22. {python_neutronclient-13.0.0.dist-info → python_neutronclient-14.0.0.dist-info}/licenses/AUTHORS +0 -0
  23. {python_neutronclient-13.0.0.dist-info → python_neutronclient-14.0.0.dist-info}/licenses/LICENSE +0 -0
  24. {python_neutronclient-13.0.0.dist-info → python_neutronclient-14.0.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-neutronclient
3
- Version: 13.0.0
3
+ Version: 14.0.0
4
4
  Summary: CLI and Client Library for OpenStack Networking
5
5
  Home-page: https://docs.openstack.org/python-neutronclient/latest/
6
6
  Author: OpenStack Networking Project
@@ -91,13 +91,6 @@ neutronclient/osc/v2/sfc/sfc_port_pair_group.py,sha256=3ZVLxJ8B2PkZV0dhwvPCFzEdB
91
91
  neutronclient/osc/v2/sfc/sfc_service_graph.py,sha256=Zn9_JsUYneKrrS486rlFIITWILCh7PAHpZCCN0ZRKiE,10187
92
92
  neutronclient/osc/v2/subnet_onboard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
93
93
  neutronclient/osc/v2/subnet_onboard/subnet_onboard.py,sha256=GK8LKPmkaN2lVt_QJnqq86ZL8d3xbC9CDCdiIu3mNhU,2091
94
- neutronclient/osc/v2/vpnaas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
95
- neutronclient/osc/v2/vpnaas/endpoint_group.py,sha256=8U5Nz-4iSocr29DwAVGm_SIhsDsjl8urEwxg-2x_U84,8133
96
- neutronclient/osc/v2/vpnaas/ikepolicy.py,sha256=8sAMJptfghCT6D7qRbRFbP210fWhr0PRCHFTyPZXpoQ,10539
97
- neutronclient/osc/v2/vpnaas/ipsec_site_connection.py,sha256=57DitWnWQdH0gINJV4W2a-_8i87lMjzN7XP7PTNCz18,15302
98
- neutronclient/osc/v2/vpnaas/ipsecpolicy.py,sha256=yBwcUQPqS_fzg9OoseLGBq_vtsTYfD2PQ2A47_6PK0M,10760
99
- neutronclient/osc/v2/vpnaas/utils.py,sha256=bCviT5_DpUgewZE0EfYzJvWV1ate_QZDYDiEr4c71t0,4312
100
- neutronclient/osc/v2/vpnaas/vpnservice.py,sha256=4pyieUWMJ26hhTiHIoQH5jN4XKo1pRJIgJ7kOs2p-98,9048
101
94
  neutronclient/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
95
  neutronclient/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
96
  neutronclient/tests/unit/test_casual_args.py,sha256=ckW0_DfdDD0mjUxPAAGjZyzzChp94vg-l2kRvK5YrGA,5814
@@ -122,21 +115,13 @@ neutronclient/tests/unit/osc/v2/sfc/test_port_pair_group.py,sha256=v_cfgHCpttbXp
122
115
  neutronclient/tests/unit/osc/v2/sfc/test_service_graph.py,sha256=lfwO5vGtqDEI_xcrs8EVGF_-Et7SdLAJReFPu8nNQCY,12037
123
116
  neutronclient/tests/unit/osc/v2/subnet_onboard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
124
117
  neutronclient/tests/unit/osc/v2/subnet_onboard/test_network_onboard_subnets.py,sha256=YRTVpvZiJ-EfzLQS2UX16IgoIX7vTNm_irglRqEe2YI,1907
125
- neutronclient/tests/unit/osc/v2/vpnaas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
126
- neutronclient/tests/unit/osc/v2/vpnaas/common.py,sha256=hYbpOr6MM8nZ__HHfrji5OITJO8PcHwMPQOoCnuZQNs,6734
127
- neutronclient/tests/unit/osc/v2/vpnaas/fakes.py,sha256=oI9C_HE1yfA55w4CWKg6UiAg513WsNigiyeR69m8tAI,7121
128
- neutronclient/tests/unit/osc/v2/vpnaas/test_endpoint_group.py,sha256=AekVbOf77XsHbyWNQowkC9YDWIg3qsZTQtKtCEKzAuo,8731
129
- neutronclient/tests/unit/osc/v2/vpnaas/test_ikepolicy.py,sha256=ITofRBb1BloAauESTAQSxaL8ma7ThJakmqf4bRmIIDc,11182
130
- neutronclient/tests/unit/osc/v2/vpnaas/test_ipsec_site_connection.py,sha256=xfwIWJvc8vWns2xthOaoXxQxCujPDgG5BC1OZYon3wY,13368
131
- neutronclient/tests/unit/osc/v2/vpnaas/test_ipsecpolicy.py,sha256=XwOQvyj54yHd2xNkPOS0ERRKLLr3zie6H6M4jaOYvMw,10566
132
- neutronclient/tests/unit/osc/v2/vpnaas/test_vpnservice.py,sha256=dXPhpvfrEA_uvvZ_nhtCWXzXFX7x3uxGu3p8XohH8Ko,9994
133
118
  neutronclient/v2_0/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
134
119
  neutronclient/v2_0/client.py,sha256=uYxHWtHXq2mWhM707UBu8De-q6ohlVp0-xklsH_s8rE,116835
135
- python_neutronclient-13.0.0.dist-info/licenses/AUTHORS,sha256=hUa35KbI6UW9BTxvh4kgQrm3uxle5ket9_kfETkZ5zU,13611
136
- python_neutronclient-13.0.0.dist-info/licenses/LICENSE,sha256=XfKg2H1sVi8OoRxoisUlMqoo10TKvHmU_wU39ks7MyA,10143
137
- python_neutronclient-13.0.0.dist-info/METADATA,sha256=QPIsZmt_S4qQ9MhZ8lHoP_RR3MneS-ob8KUc2T0eLjc,3496
138
- python_neutronclient-13.0.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
139
- python_neutronclient-13.0.0.dist-info/entry_points.txt,sha256=56GVgksRYYRJYqDwzVkHpfqVh0w_mbNNjyuIZxee1D0,5164
140
- python_neutronclient-13.0.0.dist-info/pbr.json,sha256=VHcOk_QNlgsISyg0LB5D-76hzNfK0Qe_4NeGcmektSY,46
141
- python_neutronclient-13.0.0.dist-info/top_level.txt,sha256=SxHuzHShRY_O8UAQAiwIMIjwHRm7Tr05U-cvrn1fLgU,14
142
- python_neutronclient-13.0.0.dist-info/RECORD,,
120
+ python_neutronclient-14.0.0.dist-info/licenses/AUTHORS,sha256=hUa35KbI6UW9BTxvh4kgQrm3uxle5ket9_kfETkZ5zU,13611
121
+ python_neutronclient-14.0.0.dist-info/licenses/LICENSE,sha256=XfKg2H1sVi8OoRxoisUlMqoo10TKvHmU_wU39ks7MyA,10143
122
+ python_neutronclient-14.0.0.dist-info/METADATA,sha256=aSCoifXbSiAzqFxbAu6InwHfd3OoHFZmEjbTuSc0Rms,3496
123
+ python_neutronclient-14.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
124
+ python_neutronclient-14.0.0.dist-info/entry_points.txt,sha256=9fcR4OiOT8Ytb6Of2kSNm6ek3ifptaC_T8Ax6d564WQ,3029
125
+ python_neutronclient-14.0.0.dist-info/pbr.json,sha256=a-cy3NwcVvEYdBEGOeLOIlx77dd2Pldf-SpgCV6EZmA,46
126
+ python_neutronclient-14.0.0.dist-info/top_level.txt,sha256=SxHuzHShRY_O8UAQAiwIMIjwHRm7Tr05U-cvrn1fLgU,14
127
+ python_neutronclient-14.0.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (83.0.0)
2
+ Generator: setuptools (84.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -36,28 +36,3 @@ sfc_service_graph_delete = neutronclient.osc.v2.sfc.sfc_service_graph:DeleteSfcS
36
36
  sfc_service_graph_list = neutronclient.osc.v2.sfc.sfc_service_graph:ListSfcServiceGraph
37
37
  sfc_service_graph_set = neutronclient.osc.v2.sfc.sfc_service_graph:SetSfcServiceGraph
38
38
  sfc_service_graph_show = neutronclient.osc.v2.sfc.sfc_service_graph:ShowSfcServiceGraph
39
- vpn_endpoint_group_create = neutronclient.osc.v2.vpnaas.endpoint_group:CreateEndpointGroup
40
- vpn_endpoint_group_delete = neutronclient.osc.v2.vpnaas.endpoint_group:DeleteEndpointGroup
41
- vpn_endpoint_group_list = neutronclient.osc.v2.vpnaas.endpoint_group:ListEndpointGroup
42
- vpn_endpoint_group_set = neutronclient.osc.v2.vpnaas.endpoint_group:SetEndpointGroup
43
- vpn_endpoint_group_show = neutronclient.osc.v2.vpnaas.endpoint_group:ShowEndpointGroup
44
- vpn_ike_policy_create = neutronclient.osc.v2.vpnaas.ikepolicy:CreateIKEPolicy
45
- vpn_ike_policy_delete = neutronclient.osc.v2.vpnaas.ikepolicy:DeleteIKEPolicy
46
- vpn_ike_policy_list = neutronclient.osc.v2.vpnaas.ikepolicy:ListIKEPolicy
47
- vpn_ike_policy_set = neutronclient.osc.v2.vpnaas.ikepolicy:SetIKEPolicy
48
- vpn_ike_policy_show = neutronclient.osc.v2.vpnaas.ikepolicy:ShowIKEPolicy
49
- vpn_ipsec_policy_create = neutronclient.osc.v2.vpnaas.ipsecpolicy:CreateIPsecPolicy
50
- vpn_ipsec_policy_delete = neutronclient.osc.v2.vpnaas.ipsecpolicy:DeleteIPsecPolicy
51
- vpn_ipsec_policy_list = neutronclient.osc.v2.vpnaas.ipsecpolicy:ListIPsecPolicy
52
- vpn_ipsec_policy_set = neutronclient.osc.v2.vpnaas.ipsecpolicy:SetIPsecPolicy
53
- vpn_ipsec_policy_show = neutronclient.osc.v2.vpnaas.ipsecpolicy:ShowIPsecPolicy
54
- vpn_ipsec_site_connection_create = neutronclient.osc.v2.vpnaas.ipsec_site_connection:CreateIPsecSiteConnection
55
- vpn_ipsec_site_connection_delete = neutronclient.osc.v2.vpnaas.ipsec_site_connection:DeleteIPsecSiteConnection
56
- vpn_ipsec_site_connection_list = neutronclient.osc.v2.vpnaas.ipsec_site_connection:ListIPsecSiteConnection
57
- vpn_ipsec_site_connection_set = neutronclient.osc.v2.vpnaas.ipsec_site_connection:SetIPsecSiteConnection
58
- vpn_ipsec_site_connection_show = neutronclient.osc.v2.vpnaas.ipsec_site_connection:ShowIPsecSiteConnection
59
- vpn_service_create = neutronclient.osc.v2.vpnaas.vpnservice:CreateVPNService
60
- vpn_service_delete = neutronclient.osc.v2.vpnaas.vpnservice:DeleteVPNService
61
- vpn_service_list = neutronclient.osc.v2.vpnaas.vpnservice:ListVPNService
62
- vpn_service_set = neutronclient.osc.v2.vpnaas.vpnservice:SetVPNSercice
63
- vpn_service_show = neutronclient.osc.v2.vpnaas.vpnservice:ShowVPNService
@@ -0,0 +1 @@
1
+ {"git_version": "a12bb3c", "is_release": true}
File without changes
@@ -1,222 +0,0 @@
1
- # Copyright 2017 FUJITSU LIMITED
2
- # All Rights Reserved.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may
5
- # not use this file except in compliance with the License. You may obtain
6
- # a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
- # License for the specific language governing permissions and limitations
14
- # under the License.
15
- #
16
-
17
- from osc_lib.command import command
18
- from osc_lib import exceptions
19
- from osc_lib import utils
20
- from osc_lib.utils import columns as column_util
21
- from oslo_log import log as logging
22
-
23
- from neutronclient._i18n import _
24
- from neutronclient.osc import utils as osc_utils
25
-
26
-
27
- LOG = logging.getLogger(__name__)
28
-
29
- _attr_map = (
30
- ('id', 'ID', column_util.LIST_BOTH),
31
- ('name', 'Name', column_util.LIST_BOTH),
32
- ('type', 'Type', column_util.LIST_BOTH),
33
- ('endpoints', 'Endpoints', column_util.LIST_BOTH),
34
- ('description', 'Description', column_util.LIST_LONG_ONLY),
35
- ('project_id', 'Project', column_util.LIST_LONG_ONLY),
36
- )
37
-
38
- _attr_map_dict = {
39
- 'id': 'ID',
40
- 'name': 'Name',
41
- 'type': 'Type',
42
- 'endpoints': 'Endpoints',
43
- 'description': 'Description',
44
- 'tenant_id': 'Project',
45
- 'project_id': 'Project',
46
- }
47
-
48
-
49
- def _get_common_parser(parser):
50
- parser.add_argument(
51
- '--description',
52
- metavar='<description>',
53
- help=_('Description for the endpoint group'))
54
- return parser
55
-
56
-
57
- def _get_common_attrs(client_manager, parsed_args, is_create=True):
58
- attrs = {}
59
- if is_create:
60
- if parsed_args.project is not None:
61
- attrs['tenant_id'] = osc_utils.find_project(
62
- client_manager.identity,
63
- parsed_args.project,
64
- parsed_args.project_domain,
65
- ).id
66
- if parsed_args.description:
67
- attrs['description'] = parsed_args.description
68
- return attrs
69
-
70
-
71
- class CreateEndpointGroup(command.ShowOne):
72
- _description = _("Create an endpoint group")
73
-
74
- def get_parser(self, prog_name):
75
- parser = super(CreateEndpointGroup, self).get_parser(prog_name)
76
- _get_common_parser(parser)
77
- parser.add_argument(
78
- 'name',
79
- metavar='<name>',
80
- help=_('Name for the endpoint group'))
81
- parser.add_argument(
82
- '--type',
83
- required=True,
84
- help=_('Type of endpoints in group (e.g. subnet, cidr)'))
85
- parser.add_argument(
86
- '--value',
87
- action='append',
88
- dest='endpoints',
89
- required=True,
90
- help=_('Endpoint(s) for the group. Must all be of the same type. '
91
- '(--value) option can be repeated'))
92
- osc_utils.add_project_owner_option_to_parser(parser)
93
- return parser
94
-
95
- def take_action(self, parsed_args):
96
- client = self.app.client_manager.network
97
- attrs = _get_common_attrs(self.app.client_manager, parsed_args)
98
- if parsed_args.name:
99
- attrs['name'] = str(parsed_args.name)
100
- attrs['type'] = parsed_args.type
101
- if parsed_args.type == 'subnet':
102
- _subnet_ids = [client.find_subnet(
103
- endpoint,
104
- ignore_missing=False)['id']
105
- for endpoint in parsed_args.endpoints]
106
- attrs['endpoints'] = _subnet_ids
107
- else:
108
- attrs['endpoints'] = parsed_args.endpoints
109
- obj = client.create_vpn_endpoint_group(**attrs)
110
- display_columns, columns = utils.get_osc_show_columns_for_sdk_resource(
111
- obj, _attr_map_dict, ['location', 'tenant_id'])
112
- data = utils.get_dict_properties(obj, columns)
113
- return display_columns, data
114
-
115
-
116
- class DeleteEndpointGroup(command.Command):
117
- _description = _("Delete endpoint group(s)")
118
-
119
- def get_parser(self, prog_name):
120
- parser = super(DeleteEndpointGroup, self).get_parser(prog_name)
121
- parser.add_argument(
122
- 'endpoint_group',
123
- metavar='<endpoint-group>',
124
- nargs='+',
125
- help=_('Endpoint group(s) to delete (name or ID)'))
126
- return parser
127
-
128
- def take_action(self, parsed_args):
129
- client = self.app.client_manager.network
130
- result = 0
131
- for endpoint in parsed_args.endpoint_group:
132
- try:
133
- endpoint_id = client.find_vpn_endpoint_group(
134
- endpoint, ignore_missing=False)['id']
135
- client.delete_vpn_endpoint_group(endpoint_id)
136
- except Exception as e:
137
- result += 1
138
- LOG.error(_("Failed to delete endpoint group with "
139
- "name or ID '%(endpoint_group)s': %(e)s"),
140
- {'endpoint_group': endpoint, 'e': e})
141
-
142
- if result > 0:
143
- total = len(parsed_args.endpoint_group)
144
- msg = (_("%(result)s of %(total)s endpoint group failed "
145
- "to delete.") % {'result': result, 'total': total})
146
- raise exceptions.CommandError(msg)
147
-
148
-
149
- class ListEndpointGroup(command.Lister):
150
- _description = _("List endpoint groups that belong to a given project")
151
-
152
- def get_parser(self, prog_name):
153
- parser = super(ListEndpointGroup, self).get_parser(prog_name)
154
- parser.add_argument(
155
- '--long',
156
- action='store_true',
157
- default=False,
158
- help=_("List additional fields in output")
159
- )
160
- return parser
161
-
162
- def take_action(self, parsed_args):
163
- client = self.app.client_manager.network
164
- obj = client.vpn_endpoint_groups()
165
- headers, columns = column_util.get_column_definitions(
166
- _attr_map, long_listing=parsed_args.long)
167
- return (headers, (utils.get_dict_properties(s, columns) for s in obj))
168
-
169
-
170
- class SetEndpointGroup(command.Command):
171
- _description = _("Set endpoint group properties")
172
-
173
- def get_parser(self, prog_name):
174
- parser = super(SetEndpointGroup, self).get_parser(prog_name)
175
- _get_common_parser(parser)
176
- parser.add_argument(
177
- '--name',
178
- metavar='<name>',
179
- help=_('Set a name for the endpoint group'))
180
- parser.add_argument(
181
- 'endpoint_group',
182
- metavar='<endpoint-group>',
183
- help=_('Endpoint group to set (name or ID)'))
184
- return parser
185
-
186
- def take_action(self, parsed_args):
187
- client = self.app.client_manager.network
188
- attrs = _get_common_attrs(self.app.client_manager,
189
- parsed_args, is_create=False)
190
- if parsed_args.name:
191
- attrs['name'] = str(parsed_args.name)
192
- endpoint_id = client.find_vpn_endpoint_group(
193
- parsed_args.endpoint_group, ignore_missing=False)['id']
194
- try:
195
- client.update_vpn_endpoint_group(endpoint_id, **attrs)
196
- except Exception as e:
197
- msg = (_("Failed to set endpoint group "
198
- "%(endpoint_group)s: %(e)s")
199
- % {'endpoint_group': parsed_args.endpoint_group, 'e': e})
200
- raise exceptions.CommandError(msg)
201
-
202
-
203
- class ShowEndpointGroup(command.ShowOne):
204
- _description = _("Display endpoint group details")
205
-
206
- def get_parser(self, prog_name):
207
- parser = super(ShowEndpointGroup, self).get_parser(prog_name)
208
- parser.add_argument(
209
- 'endpoint_group',
210
- metavar='<endpoint-group>',
211
- help=_('Endpoint group to display (name or ID)'))
212
- return parser
213
-
214
- def take_action(self, parsed_args):
215
- client = self.app.client_manager.network
216
- endpoint_id = client.find_vpn_endpoint_group(
217
- parsed_args.endpoint_group, ignore_missing=False)['id']
218
- obj = client.get_vpn_endpoint_group(endpoint_id)
219
- display_columns, columns = utils.get_osc_show_columns_for_sdk_resource(
220
- obj, _attr_map_dict, ['location', 'tenant_id'])
221
- data = utils.get_dict_properties(obj, columns)
222
- return (display_columns, data)
@@ -1,318 +0,0 @@
1
- # Copyright 2017 FUJITSU LIMITED
2
- # All Rights Reserved.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may
5
- # not use this file except in compliance with the License. You may obtain
6
- # a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
- # License for the specific language governing permissions and limitations
14
- # under the License.
15
- #
16
-
17
- from osc_lib.command import command
18
- from osc_lib import exceptions
19
- from osc_lib import utils
20
- from osc_lib.utils import columns as column_util
21
- from oslo_log import log as logging
22
-
23
- from neutronclient._i18n import _
24
- from neutronclient.common import utils as nc_utils
25
- from neutronclient.osc import utils as osc_utils
26
- from neutronclient.osc.v2.vpnaas import utils as vpn_utils
27
-
28
-
29
- LOG = logging.getLogger(__name__)
30
-
31
- _attr_map = (
32
- ('id', 'ID', column_util.LIST_BOTH),
33
- ('name', 'Name', column_util.LIST_BOTH),
34
- ('auth_algorithm', 'Authentication Algorithm', column_util.LIST_BOTH),
35
- ('encryption_algorithm', 'Encryption Algorithm', column_util.LIST_BOTH),
36
- ('ike_version', 'IKE Version', column_util.LIST_BOTH),
37
- ('pfs', 'Perfect Forward Secrecy (PFS)', column_util.LIST_BOTH),
38
- ('description', 'Description', column_util.LIST_LONG_ONLY),
39
- ('phase1_negotiation_mode', 'Phase1 Negotiation Mode',
40
- column_util.LIST_LONG_ONLY),
41
- ('project_id', 'Project', column_util.LIST_LONG_ONLY),
42
- ('lifetime', 'Lifetime', column_util.LIST_LONG_ONLY),
43
- )
44
-
45
- _attr_map_dict = {
46
- 'id': 'ID',
47
- 'name': 'Name',
48
- 'auth_algorithm': 'Authentication Algorithm',
49
- 'encryption_algorithm': 'Encryption Algorithm',
50
- 'ike_version': 'IKE Version',
51
- 'pfs': 'Perfect Forward Secrecy (PFS)',
52
- 'phase1_negotiation_mode': 'Phase1 Negotiation Mode',
53
- 'lifetime': 'Lifetime',
54
- 'description': 'Description',
55
- 'tenant_id': 'Project',
56
- 'project_id': 'Project',
57
- }
58
-
59
- _auth_algorithms = [
60
- 'sha1',
61
- 'sha256',
62
- 'sha384',
63
- 'sha512',
64
- 'aes-xcbc',
65
- 'aes-cmac',
66
- ]
67
-
68
- _encryption_algorithms = [
69
- '3des',
70
- 'aes-128',
71
- 'aes-192',
72
- 'aes-256',
73
- 'aes-128-ccm-8',
74
- 'aes-192-ccm-8',
75
- 'aes-256-ccm-8',
76
- 'aes-128-ccm-12',
77
- 'aes-192-ccm-12',
78
- 'aes-256-ccm-12',
79
- 'aes-128-ccm-16',
80
- 'aes-192-ccm-16',
81
- 'aes-256-ccm-16',
82
- 'aes-128-gcm-8',
83
- 'aes-192-gcm-8',
84
- 'aes-256-gcm-8',
85
- 'aes-128-gcm-12',
86
- 'aes-192-gcm-12',
87
- 'aes-256-gcm-12',
88
- 'aes-128-gcm-16',
89
- 'aes-192-gcm-16',
90
- 'aes-256-gcm-16',
91
- 'aes-128-ctr',
92
- 'aes-192-ctr',
93
- 'aes-256-ctr',
94
- ]
95
-
96
- _pfs_groups = [
97
- 'group2',
98
- 'group5',
99
- 'group14',
100
- 'group15',
101
- 'group16',
102
- 'group17',
103
- 'group18',
104
- 'group19',
105
- 'group20',
106
- 'group21',
107
- 'group22',
108
- 'group23',
109
- 'group24',
110
- 'group25',
111
- 'group26',
112
- 'group27',
113
- 'group28',
114
- 'group29',
115
- 'group30',
116
- 'group31',
117
- ]
118
-
119
-
120
- def _convert_to_lowercase(string):
121
- return string.lower()
122
-
123
-
124
- def _get_common_parser(parser):
125
- parser.add_argument(
126
- '--description',
127
- metavar='<description>',
128
- help=_('Description of the IKE policy'))
129
- parser.add_argument(
130
- '--auth-algorithm',
131
- choices=_auth_algorithms,
132
- type=_convert_to_lowercase,
133
- help=_('Authentication algorithm'))
134
- parser.add_argument(
135
- '--encryption-algorithm',
136
- choices=_encryption_algorithms,
137
- type=_convert_to_lowercase,
138
- help=_('Encryption algorithm'))
139
- parser.add_argument(
140
- '--phase1-negotiation-mode',
141
- choices=['main', 'aggressive'],
142
- type=_convert_to_lowercase,
143
- help=_('IKE Phase1 negotiation mode'))
144
- parser.add_argument(
145
- '--ike-version',
146
- choices=['v1', 'v2'],
147
- type=_convert_to_lowercase,
148
- help=_('IKE version for the policy'))
149
- parser.add_argument(
150
- '--pfs',
151
- choices=_pfs_groups,
152
- type=_convert_to_lowercase,
153
- help=_('Perfect Forward Secrecy'))
154
- parser.add_argument(
155
- '--lifetime',
156
- metavar="units=UNITS,value=VALUE",
157
- type=nc_utils.str2dict_type(optional_keys=['units', 'value']),
158
- help=vpn_utils.lifetime_help("IKE"))
159
- return parser
160
-
161
-
162
- def _get_common_attrs(client_manager, parsed_args, is_create=True):
163
- attrs = {}
164
- if is_create:
165
- if 'project' in parsed_args and parsed_args.project is not None:
166
- attrs['project_id'] = osc_utils.find_project(
167
- client_manager.identity,
168
- parsed_args.project,
169
- parsed_args.project_domain,
170
- ).id
171
- if parsed_args.description:
172
- attrs['description'] = parsed_args.description
173
- if parsed_args.auth_algorithm:
174
- attrs['auth_algorithm'] = parsed_args.auth_algorithm
175
- if parsed_args.encryption_algorithm:
176
- attrs['encryption_algorithm'] = parsed_args.encryption_algorithm
177
- if parsed_args.phase1_negotiation_mode:
178
- attrs['phase1_negotiation_mode'] = parsed_args.phase1_negotiation_mode
179
- if parsed_args.ike_version:
180
- attrs['ike_version'] = parsed_args.ike_version
181
- if parsed_args.pfs:
182
- attrs['pfs'] = parsed_args.pfs
183
- if parsed_args.lifetime:
184
- vpn_utils.validate_lifetime_dict(parsed_args.lifetime)
185
- attrs['lifetime'] = parsed_args.lifetime
186
- return attrs
187
-
188
-
189
- class CreateIKEPolicy(command.ShowOne):
190
- _description = _("Create an IKE policy")
191
-
192
- def get_parser(self, prog_name):
193
- parser = super(CreateIKEPolicy, self).get_parser(prog_name)
194
- _get_common_parser(parser)
195
- parser.add_argument(
196
- 'name',
197
- metavar='<name>',
198
- help=_('Name of the IKE policy'))
199
- osc_utils.add_project_owner_option_to_parser(parser)
200
- return parser
201
-
202
- def take_action(self, parsed_args):
203
- client = self.app.client_manager.network
204
- attrs = _get_common_attrs(self.app.client_manager, parsed_args)
205
- if parsed_args.name:
206
- attrs['name'] = str(parsed_args.name)
207
- obj = client.create_vpn_ike_policy(**attrs)
208
- display_columns, columns = utils.get_osc_show_columns_for_sdk_resource(
209
- obj, _attr_map_dict, ['location', 'tenant_id', 'units', 'value'])
210
- data = utils.get_dict_properties(obj, columns)
211
- return display_columns, data
212
-
213
-
214
- class DeleteIKEPolicy(command.Command):
215
- _description = _("Delete IKE policy (policies)")
216
-
217
- def get_parser(self, prog_name):
218
- parser = super(DeleteIKEPolicy, self).get_parser(prog_name)
219
- parser.add_argument(
220
- 'ikepolicy',
221
- metavar='<ike-policy>',
222
- nargs='+',
223
- help=_('IKE policy to delete (name or ID)'))
224
- return parser
225
-
226
- def take_action(self, parsed_args):
227
- client = self.app.client_manager.network
228
- result = 0
229
- for ike in parsed_args.ikepolicy:
230
- try:
231
- ike_id = client.find_vpn_ike_policy(ike,
232
- ignore_missing=False)['id']
233
- client.delete_vpn_ike_policy(ike_id)
234
- except Exception as e:
235
- result += 1
236
- LOG.error(_("Failed to delete IKE policy with "
237
- "name or ID '%(ikepolicy)s': %(e)s"),
238
- {'ikepolicy': ike, 'e': e})
239
-
240
- if result > 0:
241
- total = len(parsed_args.ikepolicy)
242
- msg = (_("%(result)s of %(total)s IKE policy failed "
243
- "to delete.") % {'result': result, 'total': total})
244
- raise exceptions.CommandError(msg)
245
-
246
-
247
- class ListIKEPolicy(command.Lister):
248
- _description = _("List IKE policies that belong to a given project")
249
-
250
- def get_parser(self, prog_name):
251
- parser = super(ListIKEPolicy, self).get_parser(prog_name)
252
- parser.add_argument(
253
- '--long',
254
- action='store_true',
255
- help=_("List additional fields in output")
256
- )
257
- return parser
258
-
259
- def take_action(self, parsed_args):
260
- client = self.app.client_manager.network
261
- obj = client.vpn_ike_policies()
262
- headers, columns = column_util.get_column_definitions(
263
- _attr_map, long_listing=parsed_args.long)
264
- return (headers, (utils.get_dict_properties(s, columns) for s in obj))
265
-
266
-
267
- class SetIKEPolicy(command.Command):
268
- _description = _("Set IKE policy properties")
269
-
270
- def get_parser(self, prog_name):
271
- parser = super(SetIKEPolicy, self).get_parser(prog_name)
272
- _get_common_parser(parser)
273
- parser.add_argument(
274
- '--name',
275
- metavar='<name>',
276
- help=_('Name of the IKE policy'))
277
- parser.add_argument(
278
- 'ikepolicy',
279
- metavar='<ike-policy>',
280
- help=_('IKE policy to set (name or ID)'))
281
- return parser
282
-
283
- def take_action(self, parsed_args):
284
- client = self.app.client_manager.network
285
- attrs = _get_common_attrs(self.app.client_manager,
286
- parsed_args, is_create=False)
287
- if parsed_args.name:
288
- attrs['name'] = parsed_args.name
289
- ike_id = client.find_vpn_ike_policy(parsed_args.ikepolicy,
290
- ignore_missing=False)['id']
291
- try:
292
- client.update_vpn_ike_policy(ike_id, **attrs)
293
- except Exception as e:
294
- msg = (_("Failed to set IKE policy '%(ike)s': %(e)s")
295
- % {'ike': parsed_args.ikepolicy, 'e': e})
296
- raise exceptions.CommandError(msg)
297
-
298
-
299
- class ShowIKEPolicy(command.ShowOne):
300
- _description = _("Display IKE policy details")
301
-
302
- def get_parser(self, prog_name):
303
- parser = super(ShowIKEPolicy, self).get_parser(prog_name)
304
- parser.add_argument(
305
- 'ikepolicy',
306
- metavar='<ike-policy>',
307
- help=_('IKE policy to display (name or ID)'))
308
- return parser
309
-
310
- def take_action(self, parsed_args):
311
- client = self.app.client_manager.network
312
- ike_id = client.find_vpn_ike_policy(parsed_args.ikepolicy,
313
- ignore_missing=False)['id']
314
- obj = client.get_vpn_ike_policy(ike_id)
315
- display_columns, columns = utils.get_osc_show_columns_for_sdk_resource(
316
- obj, _attr_map_dict, ['location', 'tenant_id', 'units', 'value'])
317
- data = utils.get_dict_properties(obj, columns)
318
- return (display_columns, data)