Use 'IPsec' consistently

Previously both 'IPsec' and 'IPSec' are used. It is consistent.
In IETF we use 'IPsec' consistently and 'IPsec' looks a better choice.

This commit also updates unnecessary capitalizations like:
- IPsec Policy -> IPsec policy
- IKE Policy -> IKE policy
- IPsec Site Connection -> IPsec site connection
- VPN Service -> VPN service

In the horizon convention, every word is capitalized
only in page titles, action captions and field captions.
For other messages, there is no need to capitalize them.

Change-Id: I7f3ba10d5a7051fe598b45d13af79cc1ead0285f
Closes-Bug: #1713766
This commit is contained in:
Akihiro Motoki 2017-08-29 17:16:09 +00:00 committed by Cao Xuan Hoang
parent e448fadffc
commit e3156ce5f9
20 changed files with 260 additions and 255 deletions

View File

@ -25,19 +25,19 @@ neutronclient = neutron.neutronclient
class IKEPolicy(neutron.NeutronAPIDictWrapper): class IKEPolicy(neutron.NeutronAPIDictWrapper):
"""Wrapper for neutron VPN IKEPolicy.""" """Wrapper for neutron VPN IKE policy."""
class IPSecPolicy(neutron.NeutronAPIDictWrapper): class IPsecPolicy(neutron.NeutronAPIDictWrapper):
"""Wrapper for neutron VPN IPSecPolicy.""" """Wrapper for neutron VPN IPsec policy."""
class IPSecSiteConnection(neutron.NeutronAPIDictWrapper): class IPsecSiteConnection(neutron.NeutronAPIDictWrapper):
"""Wrapper for neutron IPSecSiteConnection.""" """Wrapper for neutron IPsec site connection."""
class VPNService(neutron.NeutronAPIDictWrapper): class VPNService(neutron.NeutronAPIDictWrapper):
"""Wrapper for neutron VPNService.""" """Wrapper for neutron VPN service."""
class EndpointGroup(neutron.NeutronAPIDictWrapper): class EndpointGroup(neutron.NeutronAPIDictWrapper):
@ -46,14 +46,14 @@ class EndpointGroup(neutron.NeutronAPIDictWrapper):
@profiler.trace @profiler.trace
def vpnservice_create(request, **kwargs): def vpnservice_create(request, **kwargs):
"""Create VPNService """Create VPN service
:param request: request context :param request: request context
:param admin_state_up: admin state (default on) :param admin_state_up: admin state (default on)
:param name: name for VPNService :param name: name for VPN service
:param description: description for VPNService :param description: description for VPN service
:param router_id: router id for router of VPNService :param router_id: router id for router of VPN service
:param subnet_id: subnet id for subnet of VPNService :param subnet_id: subnet id for subnet of VPN service
""" """
body = {'vpnservice': body = {'vpnservice':
{'admin_state_up': kwargs['admin_state_up'], {'admin_state_up': kwargs['admin_state_up'],
@ -205,17 +205,17 @@ def endpointgroup_delete(request, endpoint_group_id):
@profiler.trace @profiler.trace
def ikepolicy_create(request, **kwargs): def ikepolicy_create(request, **kwargs):
"""Create IKEPolicy """Create IKE policy
:param request: request context :param request: request context
:param name: name for IKEPolicy :param name: name for IKE policy
:param description: description for IKEPolicy :param description: description for IKE policy
:param auth_algorithm: authorization algorithm for IKEPolicy :param auth_algorithm: authorization algorithm for IKE policy
:param encryption_algorithm: encryption algorithm for IKEPolicy :param encryption_algorithm: encryption algorithm for IKE policy
:param ike_version: IKE version for IKEPolicy :param ike_version: IKE version for IKE policy
:param lifetime: Lifetime Units and Value for IKEPolicy :param lifetime: Lifetime Units and Value for IKE policy
:param pfs: Perfect Forward Secrecy for IKEPolicy :param pfs: Perfect Forward Secrecy for IKE policy
:param phase1_negotiation_mode: IKE Phase1 negotiation mode for IKEPolicy :param phase1_negotiation_mode: IKE Phase1 negotiation mode for IKE policy
""" """
body = {'ikepolicy': body = {'ikepolicy':
{'name': kwargs['name'], {'name': kwargs['name'],
@ -277,17 +277,17 @@ def ikepolicy_delete(request, ikepolicy_id):
@profiler.trace @profiler.trace
def ipsecpolicy_create(request, **kwargs): def ipsecpolicy_create(request, **kwargs):
"""Create IPSecPolicy """Create IPsec policy
:param request: request context :param request: request context
:param name: name for IPSecPolicy :param name: name for IPsec policy
:param description: description for IPSecPolicy :param description: description for IPsec policy
:param auth_algorithm: authorization algorithm for IPSecPolicy :param auth_algorithm: authorization algorithm for IPsec policy
:param encapsulation_mode: encapsulation mode for IPSecPolicy :param encapsulation_mode: encapsulation mode for IPsec policy
:param encryption_algorithm: encryption algorithm for IPSecPolicy :param encryption_algorithm: encryption algorithm for IPsec policy
:param lifetime: Lifetime Units and Value for IPSecPolicy :param lifetime: Lifetime Units and Value for IPsec policy
:param pfs: Perfect Forward Secrecy for IPSecPolicy :param pfs: Perfect Forward Secrecy for IPsec policy
:param transform_protocol: Transform Protocol for IPSecPolicy :param transform_protocol: Transform Protocol for IPsec policy
""" """
body = {'ipsecpolicy': body = {'ipsecpolicy':
{'name': kwargs['name'], {'name': kwargs['name'],
@ -301,7 +301,7 @@ def ipsecpolicy_create(request, **kwargs):
} }
ipsecpolicy = neutronclient(request).create_ipsecpolicy(body).get( ipsecpolicy = neutronclient(request).create_ipsecpolicy(body).get(
'ipsecpolicy') 'ipsecpolicy')
return IPSecPolicy(ipsecpolicy) return IPsecPolicy(ipsecpolicy)
@profiler.trace @profiler.trace
@ -317,7 +317,7 @@ def _ipsecpolicy_list(request, expand_conns=False, **kwargs):
for p in ipsecpolicies: for p in ipsecpolicies:
p['ipsecsiteconns'] = [c.id for c in ipsecsiteconns p['ipsecsiteconns'] = [c.id for c in ipsecsiteconns
if c.ipsecpolicy_id == p['id']] if c.ipsecpolicy_id == p['id']]
return [IPSecPolicy(v) for v in ipsecpolicies] return [IPsecPolicy(v) for v in ipsecpolicies]
@profiler.trace @profiler.trace
@ -333,14 +333,14 @@ def _ipsecpolicy_get(request, ipsecpolicy_id, expand_conns=False):
ipsecpolicy['ipsecsiteconns'] = [c for c in ipsecsiteconns ipsecpolicy['ipsecsiteconns'] = [c for c in ipsecsiteconns
if (c.ipsecpolicy_id == if (c.ipsecpolicy_id ==
ipsecpolicy['id'])] ipsecpolicy['id'])]
return IPSecPolicy(ipsecpolicy) return IPsecPolicy(ipsecpolicy)
@profiler.trace @profiler.trace
def ipsecpolicy_update(request, ipsecpolicy_id, **kwargs): def ipsecpolicy_update(request, ipsecpolicy_id, **kwargs):
ipsecpolicy = neutronclient(request).update_ipsecpolicy( ipsecpolicy = neutronclient(request).update_ipsecpolicy(
ipsecpolicy_id, kwargs).get('ipsecpolicy') ipsecpolicy_id, kwargs).get('ipsecpolicy')
return IPSecPolicy(ipsecpolicy) return IPsecPolicy(ipsecpolicy)
@profiler.trace @profiler.trace
@ -350,13 +350,13 @@ def ipsecpolicy_delete(request, ipsecpolicy_id):
@profiler.trace @profiler.trace
def ipsecsiteconnection_create(request, **kwargs): def ipsecsiteconnection_create(request, **kwargs):
"""Create IPSecSiteConnection """Create IPsec site connection
:param request: request context :param request: request context
:param name: name for IPSecSiteConnection :param name: name for IPsec site connection
:param description: description for IPSecSiteConnection :param description: description for IPsec site connection
:param dpd: dead peer detection action, interval and timeout :param dpd: dead peer detection action, interval and timeout
:param ikepolicy_id: IKEPolicy associated with this connection :param ikepolicy_id: IKE policy associated with this connection
:param initiator: initiator state :param initiator: initiator state
:param ipsecpolicy_id: IPsecPolicy associated with this connection :param ipsecpolicy_id: IPsecPolicy associated with this connection
:param mtu: MTU size for the connection :param mtu: MTU size for the connection
@ -364,7 +364,7 @@ def ipsecsiteconnection_create(request, **kwargs):
:param peer_cidrs: remote subnet(s) in CIDR format :param peer_cidrs: remote subnet(s) in CIDR format
:param peer_id: Peer router identity for authentication" :param peer_id: Peer router identity for authentication"
:param psk: Pre-Shared Key string :param psk: Pre-Shared Key string
:param vpnservice_id: VPNService associated with this connection :param vpnservice_id: VPN service associated with this connection
:param admin_state_up: admin state (default on) :param admin_state_up: admin state (default on)
""" """
body = { body = {
@ -389,7 +389,7 @@ def ipsecsiteconnection_create(request, **kwargs):
body['peer_cidrs'] = kwargs['peer_cidrs'] body['peer_cidrs'] = kwargs['peer_cidrs']
ipsecsiteconnection = neutronclient(request).create_ipsec_site_connection( ipsecsiteconnection = neutronclient(request).create_ipsec_site_connection(
{'ipsec_site_connection': body}).get('ipsec_site_connection') {'ipsec_site_connection': body}).get('ipsec_site_connection')
return IPSecSiteConnection(ipsecsiteconnection) return IPsecSiteConnection(ipsecsiteconnection)
@profiler.trace @profiler.trace
@ -423,7 +423,7 @@ def _ipsecsiteconnection_list(request, expand_ikepolicies=False,
for c in ipsecsiteconnections: for c in ipsecsiteconnections:
c['vpnservice_name'] = service_dict.get(c['vpnservice_id'] c['vpnservice_name'] = service_dict.get(c['vpnservice_id']
).name_or_id ).name_or_id
return [IPSecSiteConnection(v) for v in ipsecsiteconnections] return [IPsecSiteConnection(v) for v in ipsecsiteconnections]
@profiler.trace @profiler.trace
@ -448,14 +448,14 @@ def _ipsecsiteconnection_get(request, ipsecsiteconnection_id,
if expand_vpnservices: if expand_vpnservices:
ipsecsiteconnection['vpnservice'] = _vpnservice_get( ipsecsiteconnection['vpnservice'] = _vpnservice_get(
request, ipsecsiteconnection['vpnservice_id']) request, ipsecsiteconnection['vpnservice_id'])
return IPSecSiteConnection(ipsecsiteconnection) return IPsecSiteConnection(ipsecsiteconnection)
@profiler.trace @profiler.trace
def ipsecsiteconnection_update(request, ipsecsiteconnection_id, **kwargs): def ipsecsiteconnection_update(request, ipsecsiteconnection_id, **kwargs):
ipsecsiteconnection = neutronclient(request).update_ipsec_site_connection( ipsecsiteconnection = neutronclient(request).update_ipsec_site_connection(
ipsecsiteconnection_id, kwargs).get('ipsec_site_connection') ipsecsiteconnection_id, kwargs).get('ipsec_site_connection')
return IPSecSiteConnection(ipsecsiteconnection) return IPsecSiteConnection(ipsecsiteconnection)
@profiler.trace @profiler.trace

View File

@ -47,14 +47,14 @@ class UpdateVPNService(forms.SelfHandlingForm):
}} }}
vpnservice = api_vpn.vpnservice_update( vpnservice = api_vpn.vpnservice_update(
request, context['vpnservice_id'], **data) request, context['vpnservice_id'], **data)
msg = (_('VPN Service %s was successfully updated.') msg = (_('VPN service %s was successfully updated.')
% context['name']) % context['name'])
messages.success(request, msg) messages.success(request, msg)
return vpnservice return vpnservice
except Exception as e: except Exception as e:
LOG.info('Failed to update VPN Service %(id)s: %(exc)s', LOG.info('Failed to update VPN service %(id)s: %(exc)s',
{'id': context['vpnservice_id'], 'exc': e}) {'id': context['vpnservice_id'], 'exc': e})
msg = _('Failed to update VPN Service %s') % context['name'] msg = _('Failed to update VPN service %s') % context['name']
redirect = reverse(self.failure_url) redirect = reverse(self.failure_url)
exceptions.handle(request, msg, redirect=redirect) exceptions.handle(request, msg, redirect=redirect)
@ -161,19 +161,19 @@ class UpdateIKEPolicy(forms.SelfHandlingForm):
}} }}
ikepolicy = api_vpn.ikepolicy_update( ikepolicy = api_vpn.ikepolicy_update(
request, context['ikepolicy_id'], **data) request, context['ikepolicy_id'], **data)
msg = (_('IKE Policy %s was successfully updated.') msg = (_('IKE policy %s was successfully updated.')
% context['name']) % context['name'])
messages.success(request, msg) messages.success(request, msg)
return ikepolicy return ikepolicy
except Exception as e: except Exception as e:
LOG.info('Failed to update IKE Policy %(id)s: %(exc)s', LOG.info('Failed to update IKE policy %(id)s: %(exc)s',
{'id': context['ikepolicy_id'], 'exc': e}) {'id': context['ikepolicy_id'], 'exc': e})
msg = _('Failed to update IKE Policy %s') % context['name'] msg = _('Failed to update IKE policy %s') % context['name']
redirect = reverse(self.failure_url) redirect = reverse(self.failure_url)
exceptions.handle(request, msg, redirect=redirect) exceptions.handle(request, msg, redirect=redirect)
class UpdateIPSecPolicy(forms.SelfHandlingForm): class UpdateIPsecPolicy(forms.SelfHandlingForm):
name = forms.CharField(max_length=80, label=_("Name"), required=False) name = forms.CharField(max_length=80, label=_("Name"), required=False)
ipsecpolicy_id = forms.CharField( ipsecpolicy_id = forms.CharField(
label=_("ID"), label=_("ID"),
@ -239,19 +239,19 @@ class UpdateIPSecPolicy(forms.SelfHandlingForm):
}} }}
ipsecpolicy = api_vpn.ipsecpolicy_update( ipsecpolicy = api_vpn.ipsecpolicy_update(
request, context['ipsecpolicy_id'], **data) request, context['ipsecpolicy_id'], **data)
msg = (_('IPSec Policy %s was successfully updated.') msg = (_('IPsec policy %s was successfully updated.')
% context['name']) % context['name'])
messages.success(request, msg) messages.success(request, msg)
return ipsecpolicy return ipsecpolicy
except Exception as e: except Exception as e:
LOG.info('Failed to update IPSec Policy %(id)s: %(exc)s', LOG.info('Failed to update IPsec policy %(id)s: %(exc)s',
{'id': context['ipsecpolicy_id'], 'exc': e}) {'id': context['ipsecpolicy_id'], 'exc': e})
msg = _('Failed to update IPSec Policy %s') % context['name'] msg = _('Failed to update IPsec policy %s') % context['name']
redirect = reverse(self.failure_url) redirect = reverse(self.failure_url)
exceptions.handle(request, msg, redirect=redirect) exceptions.handle(request, msg, redirect=redirect)
class UpdateIPSecSiteConnection(forms.SelfHandlingForm): class UpdateIPsecSiteConnection(forms.SelfHandlingForm):
name = forms.CharField(max_length=80, label=_("Name"), required=False) name = forms.CharField(max_length=80, label=_("Name"), required=False)
ipsecsiteconnection_id = forms.CharField( ipsecsiteconnection_id = forms.CharField(
label=_("ID"), label=_("ID"),
@ -287,7 +287,7 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
peer_ep_group_id = forms.CharField( peer_ep_group_id = forms.CharField(
required=False, required=False,
label=_("Peer Endpoint Group(s)"), label=_("Peer Endpoint Group(s)"),
help_text=_("IPSec connection validation requires " help_text=_("IPsec connection validation requires "
"that peer endpoints are CIDRs")) "that peer endpoints are CIDRs"))
psk = forms.CharField( psk = forms.CharField(
widget=forms.PasswordInput(render_value=True), widget=forms.PasswordInput(render_value=True),
@ -328,7 +328,7 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
failure_url = 'horizon:project:vpn:index' failure_url = 'horizon:project:vpn:index'
def clean(self): def clean(self):
cleaned_data = super(UpdateIPSecSiteConnection, self).clean() cleaned_data = super(UpdateIPsecSiteConnection, self).clean()
interval = cleaned_data.get('dpd_interval') interval = cleaned_data.get('dpd_interval')
timeout = cleaned_data.get('dpd_timeout') timeout = cleaned_data.get('dpd_timeout')
@ -362,14 +362,14 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
ipsecsiteconnection = api_vpn.ipsecsiteconnection_update( ipsecsiteconnection = api_vpn.ipsecsiteconnection_update(
request, context['ipsecsiteconnection_id'], request, context['ipsecsiteconnection_id'],
ipsec_site_connection=data) ipsec_site_connection=data)
msg = (_('IPSec Site Connection %s was successfully updated.') msg = (_('IPsec site connection %s was successfully updated.')
% context['name']) % context['name'])
messages.success(request, msg) messages.success(request, msg)
return ipsecsiteconnection return ipsecsiteconnection
except Exception as e: except Exception as e:
LOG.info('Failed to update IPSec Site Connection %(id)s: %(exc)s', LOG.info('Failed to update IPsec site connection %(id)s: %(exc)s',
{'id': context['ipsecsiteconnection_id'], 'exc': e}) {'id': context['ipsecsiteconnection_id'], 'exc': e})
msg = (_('Failed to update IPSec Site Connection %s') msg = (_('Failed to update IPsec site connection %s')
% context['name']) % context['name'])
redirect = reverse(self.failure_url) redirect = reverse(self.failure_url)
exceptions.handle(request, msg, redirect=redirect) exceptions.handle(request, msg, redirect=redirect)

View File

@ -39,9 +39,9 @@ class AddIKEPolicyLink(tables.LinkAction):
policy_rules = (("network", "create_ikepolicy"),) policy_rules = (("network", "create_ikepolicy"),)
class AddIPSecPolicyLink(tables.LinkAction): class AddIPsecPolicyLink(tables.LinkAction):
name = "addipsecpolicy" name = "addipsecpolicy"
verbose_name = _("Add IPSec Policy") verbose_name = _("Add IPsec Policy")
url = "horizon:project:vpn:addipsecpolicy" url = "horizon:project:vpn:addipsecpolicy"
classes = ("ajax-modal",) classes = ("ajax-modal",)
icon = "plus" icon = "plus"
@ -66,9 +66,9 @@ class AddEndpointGroupLink(tables.LinkAction):
policy_rules = (("network", "create_endpointgroup"),) policy_rules = (("network", "create_endpointgroup"),)
class AddIPSecSiteConnectionLink(tables.LinkAction): class AddIPsecSiteConnectionLink(tables.LinkAction):
name = "addipsecsiteconnection" name = "addipsecsiteconnection"
verbose_name = _("Add IPSec Site Connection") verbose_name = _("Add IPsec Site Connection")
url = "horizon:project:vpn:addipsecsiteconnection" url = "horizon:project:vpn:addipsecsiteconnection"
classes = ("ajax-modal",) classes = ("ajax-modal",)
icon = "plus" icon = "plus"
@ -90,8 +90,8 @@ class DeleteVPNServiceLink(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Scheduled deletion of VPN Service", u"Scheduled deletion of VPN service",
u"Scheduled deletion of VPN Services", u"Scheduled deletion of VPN services",
count count
) )
@ -105,7 +105,7 @@ class DeleteVPNServiceLink(policy.PolicyTargetMixin, tables.DeleteAction):
api_vpn.vpnservice_delete(request, obj_id) api_vpn.vpnservice_delete(request, obj_id)
except Exception as e: except Exception as e:
exceptions.handle( exceptions.handle(
request, _('Unable to delete VPN Service. %s') % e) request, _('Unable to delete VPN service. %s') % e)
class DeleteEndpointGroupLink(policy.PolicyTargetMixin, tables.DeleteAction): class DeleteEndpointGroupLink(policy.PolicyTargetMixin, tables.DeleteAction):
@ -151,8 +151,8 @@ class DeleteIKEPolicyLink(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Scheduled deletion of IKE Policy", u"Scheduled deletion of IKE policy",
u"Scheduled deletion of IKE Policies", u"Scheduled deletion of IKE policies",
count count
) )
@ -166,26 +166,26 @@ class DeleteIKEPolicyLink(policy.PolicyTargetMixin, tables.DeleteAction):
api_vpn.ikepolicy_delete(request, obj_id) api_vpn.ikepolicy_delete(request, obj_id)
except Exception as e: except Exception as e:
exceptions.handle( exceptions.handle(
request, _('Unable to delete IKE Policy. %s') % e) request, _('Unable to delete IKE policy. %s') % e)
class DeleteIPSecPolicyLink(policy.PolicyTargetMixin, tables.DeleteAction): class DeleteIPsecPolicyLink(policy.PolicyTargetMixin, tables.DeleteAction):
name = "deleteipsecpolicy" name = "deleteipsecpolicy"
policy_rules = (("network", "delete_ipsecpolicy"),) policy_rules = (("network", "delete_ipsecpolicy"),)
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete IPSec Policy", u"Delete IPsec Policy",
u"Delete IPSec Policies", u"Delete IPsec Policies",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Scheduled deletion of IPSec Policy", u"Scheduled deletion of IPsec policy",
u"Scheduled deletion of IPSec Policies", u"Scheduled deletion of IPsec policies",
count count
) )
@ -199,10 +199,10 @@ class DeleteIPSecPolicyLink(policy.PolicyTargetMixin, tables.DeleteAction):
api_vpn.ipsecpolicy_delete(request, obj_id) api_vpn.ipsecpolicy_delete(request, obj_id)
except Exception as e: except Exception as e:
exceptions.handle( exceptions.handle(
request, _('Unable to delete IPSec Policy. %s') % e) request, _('Unable to delete IPsec policy. %s') % e)
class DeleteIPSecSiteConnectionLink(policy.PolicyTargetMixin, class DeleteIPsecSiteConnectionLink(policy.PolicyTargetMixin,
tables.DeleteAction): tables.DeleteAction):
name = "deleteipsecsiteconnection" name = "deleteipsecsiteconnection"
policy_rules = (("network", "delete_ipsec_site_connection"),) policy_rules = (("network", "delete_ipsec_site_connection"),)
@ -210,16 +210,16 @@ class DeleteIPSecSiteConnectionLink(policy.PolicyTargetMixin,
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete IPSec Site Connection", u"Delete IPsec Site Connection",
u"Delete IPSec Site Connections", u"Delete IPsec Site Connections",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Scheduled deletion of IPSec Site Connection", u"Scheduled deletion of IPsec site connection",
u"Scheduled deletion of IPSec Site Connections", u"Scheduled deletion of IPsec site connections",
count count
) )
@ -228,7 +228,7 @@ class DeleteIPSecSiteConnectionLink(policy.PolicyTargetMixin,
api_vpn.ipsecsiteconnection_delete(request, obj_id) api_vpn.ipsecsiteconnection_delete(request, obj_id)
except Exception as e: except Exception as e:
exceptions.handle( exceptions.handle(
request, _('Unable to delete IPSec Site Connection. %s') % e) request, _('Unable to delete IPsec site connection. %s') % e)
class UpdateVPNServiceLink(tables.LinkAction): class UpdateVPNServiceLink(tables.LinkAction):
@ -272,9 +272,9 @@ class UpdateIKEPolicyLink(tables.LinkAction):
return not datum['ipsecsiteconns'] return not datum['ipsecsiteconns']
class UpdateIPSecPolicyLink(tables.LinkAction): class UpdateIPsecPolicyLink(tables.LinkAction):
name = "updateipsecpolicy" name = "updateipsecpolicy"
verbose_name = _("Edit IPSec Policy") verbose_name = _("Edit IPsec Policy")
classes = ("ajax-modal", "btn-update",) classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "update_ipsecpolicy"),) policy_rules = (("network", "update_ipsecpolicy"),)
@ -286,7 +286,7 @@ class UpdateIPSecPolicyLink(tables.LinkAction):
return not datum['ipsecsiteconns'] return not datum['ipsecsiteconns']
class UpdateIPSecSiteConnectionLink(tables.LinkAction): class UpdateIPsecSiteConnectionLink(tables.LinkAction):
name = "updateipsecsiteconnection" name = "updateipsecsiteconnection"
verbose_name = _("Edit Connection") verbose_name = _("Edit Connection")
classes = ("ajax-modal", "btn-update",) classes = ("ajax-modal", "btn-update",)
@ -313,29 +313,34 @@ STATUS_CHOICES = (
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("active", pgettext_lazy("Current status of an IPSec Site Connection" ("active", pgettext_lazy("Current status of an IPsec site connection "
" and VPN Service", u"Active")), "and VPN service",
("down", pgettext_lazy("Current status of an IPSec Site Connection" u"Active")),
" and VPN Service", u"Down")), ("down", pgettext_lazy("Current status of an IPsec site connection "
("error", pgettext_lazy("Current status of an IPSec Site Connection" "and VPN service",
" and VPN Service", u"Error")), u"Down")),
("created", pgettext_lazy("Current status of an IPSec Site Connection" ("error", pgettext_lazy("Current status of an IPsec site connection "
" and VPN Service", u"Created")), "and VPN service",
("pending_create", pgettext_lazy("Current status of an" u"Error")),
" IPSec Site Connection and VPN Service", ("created", pgettext_lazy("Current status of an IPsec site connection "
"and VPN service",
u"Created")),
("pending_create", pgettext_lazy("Current status of an "
"IPsec site connection and VPN service",
u"Pending Create")), u"Pending Create")),
("pending_update", pgettext_lazy("Current status of an" ("pending_update", pgettext_lazy("Current status of an "
" IPSec Site Connection and VPN Service", "IPsec site connection and VPN service",
u"Pending Update")), u"Pending Update")),
("pending_delete", pgettext_lazy("Current status of an" ("pending_delete", pgettext_lazy("Current status of an "
" IPSec Site Connection and VPN Service", "IPsec site connection and VPN service",
u"Pending Delete")), u"Pending Delete")),
("inactive", pgettext_lazy("Current status of an IPSec Site Connection" ("inactive", pgettext_lazy("Current status of an IPsec site connection "
" and VPN Service", u"Inactive")), "and VPN service",
u"Inactive")),
) )
class UpdateIPSecSiteConnectionRow(tables.Row): class UpdateIPsecSiteConnectionRow(tables.Row):
ajax = True ajax = True
def get_data(self, request, conn_id): def get_data(self, request, conn_id):
@ -358,13 +363,13 @@ class IPSSCFilterAction(tables.FilterAction):
('vpnservice_id', _("VPN Service ID ="), True), ('vpnservice_id', _("VPN Service ID ="), True),
('ikepolicy', _("IKE Policy ="), True), ('ikepolicy', _("IKE Policy ="), True),
('ikepolicy_id', _("IKE Policy ID ="), True), ('ikepolicy_id', _("IKE Policy ID ="), True),
('ipsecpolicy', _("IPSec Policy ="), True), ('ipsecpolicy', _("IPsec Policy ="), True),
('ipsecpolicy_id', _("IPSec Policy ID ="), True), ('ipsecpolicy_id', _("IPsec Policy ID ="), True),
('status', _("Status ="), True) ('status', _("Status ="), True)
) )
class IPSecSiteConnectionsTable(tables.DataTable): class IPsecSiteConnectionsTable(tables.DataTable):
id = tables.Column('id', hidden=True) id = tables.Column('id', hidden=True)
name = tables.Column('name_or_id', verbose_name=_('Name'), name = tables.Column('name_or_id', verbose_name=_('Name'),
link="horizon:project:vpn:ipsecsiteconnectiondetails") link="horizon:project:vpn:ipsecsiteconnectiondetails")
@ -374,7 +379,7 @@ class IPSecSiteConnectionsTable(tables.DataTable):
ikepolicy_name = tables.Column('ikepolicy_name', ikepolicy_name = tables.Column('ikepolicy_name',
verbose_name=_('IKE Policy')) verbose_name=_('IKE Policy'))
ipsecpolicy_name = tables.Column('ipsecpolicy_name', ipsecpolicy_name = tables.Column('ipsecpolicy_name',
verbose_name=_('IPSec Policy')) verbose_name=_('IPsec Policy'))
status = tables.Column("status", status = tables.Column("status",
verbose_name=_("Status"), verbose_name=_("Status"),
status=True, status=True,
@ -386,14 +391,14 @@ class IPSecSiteConnectionsTable(tables.DataTable):
class Meta(object): class Meta(object):
name = "ipsecsiteconnectionstable" name = "ipsecsiteconnectionstable"
verbose_name = _("IPSec Site Connections") verbose_name = _("IPsec Site Connections")
status_columns = ['status'] status_columns = ['status']
row_class = UpdateIPSecSiteConnectionRow row_class = UpdateIPsecSiteConnectionRow
table_actions = (AddIPSecSiteConnectionLink, table_actions = (AddIPsecSiteConnectionLink,
DeleteIPSecSiteConnectionLink, DeleteIPsecSiteConnectionLink,
IPSSCFilterAction) IPSSCFilterAction)
row_actions = (UpdateIPSecSiteConnectionLink, row_actions = (UpdateIPsecSiteConnectionLink,
DeleteIPSecSiteConnectionLink) DeleteIPsecSiteConnectionLink)
def get_local_ips(vpn): def get_local_ips(vpn):
@ -531,7 +536,7 @@ class IKEPoliciesTable(tables.DataTable):
row_actions = (UpdateIKEPolicyLink, DeleteIKEPolicyLink) row_actions = (UpdateIKEPolicyLink, DeleteIKEPolicyLink)
class IPSecPoliciesTable(tables.DataTable): class IPsecPoliciesTable(tables.DataTable):
id = tables.Column('id', hidden=True) id = tables.Column('id', hidden=True)
name = tables.Column("name_or_id", verbose_name=_('Name'), name = tables.Column("name_or_id", verbose_name=_('Name'),
link="horizon:project:vpn:ipsecpolicydetails") link="horizon:project:vpn:ipsecpolicydetails")
@ -548,8 +553,8 @@ class IPSecPoliciesTable(tables.DataTable):
class Meta(object): class Meta(object):
name = "ipsecpoliciestable" name = "ipsecpoliciestable"
verbose_name = _("IPSec Policies") verbose_name = _("IPsec Policies")
table_actions = (AddIPSecPolicyLink, table_actions = (AddIPsecPolicyLink,
DeleteIPSecPolicyLink, DeleteIPsecPolicyLink,
PoliciesFilterAction) PoliciesFilterAction)
row_actions = (UpdateIPSecPolicyLink, DeleteIPSecPolicyLink) row_actions = (UpdateIPsecPolicyLink, DeleteIPsecPolicyLink)

View File

@ -24,9 +24,9 @@ from neutron_vpnaas_dashboard.api import vpn as api_vpn
from neutron_vpnaas_dashboard.dashboards.project.vpn import tables from neutron_vpnaas_dashboard.dashboards.project.vpn import tables
class IPSecSiteConnectionsTab(tabs.TableTab, htables.DataTableView): class IPsecSiteConnectionsTab(tabs.TableTab, htables.DataTableView):
table_classes = (tables.IPSecSiteConnectionsTable,) table_classes = (tables.IPsecSiteConnectionsTable,)
name = _("IPSec Site Connections") name = _("IPsec Site Connections")
slug = "ipsecsiteconnections" slug = "ipsecsiteconnections"
template_name = ("horizon/common/_detail_table.html") template_name = ("horizon/common/_detail_table.html")
FILTERS_MAPPING = {'admin_state_up': {_("up"): True, _("down"): False}} FILTERS_MAPPING = {'admin_state_up': {_("up"): True, _("down"): False}}
@ -59,7 +59,7 @@ class IPSecSiteConnectionsTab(tabs.TableTab, htables.DataTableView):
ipsecsiteconnections = [] ipsecsiteconnections = []
exceptions.handle( exceptions.handle(
self.tab_group.request, self.tab_group.request,
_('Unable to retrieve IPSec Site Connections list.')) _('Unable to retrieve IPsec site connections list.'))
return ipsecsiteconnections return ipsecsiteconnections
def get_filters(self): def get_filters(self):
@ -67,7 +67,7 @@ class IPSecSiteConnectionsTab(tabs.TableTab, htables.DataTableView):
self.handle_server_filter(self.request, table=self.table) self.handle_server_filter(self.request, table=self.table)
self.update_server_filter_action(self.request, table=self.table) self.update_server_filter_action(self.request, table=self.table)
return super(IPSecSiteConnectionsTab, return super(IPsecSiteConnectionsTab,
self).get_filters(filters_map=self.FILTERS_MAPPING) self).get_filters(filters_map=self.FILTERS_MAPPING)
@ -103,7 +103,7 @@ class VPNServicesTab(tabs.TableTab, htables.DataTableView):
except Exception: except Exception:
vpnservices = [] vpnservices = []
exceptions.handle(self.tab_group.request, exceptions.handle(self.tab_group.request,
_('Unable to retrieve VPN Services list.')) _('Unable to retrieve VPN services list.'))
return vpnservices return vpnservices
def get_filters(self): def get_filters(self):
@ -155,7 +155,7 @@ class IKEPoliciesTab(tabs.TableTab, htables.DataTableView):
except Exception: except Exception:
ikepolicies = [] ikepolicies = []
exceptions.handle(self.tab_group.request, exceptions.handle(self.tab_group.request,
_('Unable to retrieve IKE Policies list.')) _('Unable to retrieve IKE policies list.'))
return ikepolicies return ikepolicies
def get_filters(self): def get_filters(self):
@ -166,9 +166,9 @@ class IKEPoliciesTab(tabs.TableTab, htables.DataTableView):
return super(IKEPoliciesTab, self).get_filters() return super(IKEPoliciesTab, self).get_filters()
class IPSecPoliciesTab(tabs.TableTab, htables.DataTableView): class IPsecPoliciesTab(tabs.TableTab, htables.DataTableView):
table_classes = (tables.IPSecPoliciesTable,) table_classes = (tables.IPsecPoliciesTable,)
name = _("IPSec Policies") name = _("IPsec Policies")
slug = "ipsecpolicies" slug = "ipsecpolicies"
template_name = ("horizon/common/_detail_table.html") template_name = ("horizon/common/_detail_table.html")
@ -181,7 +181,7 @@ class IPSecPoliciesTab(tabs.TableTab, htables.DataTableView):
except Exception: except Exception:
ipsecpolicies = [] ipsecpolicies = []
exceptions.handle(self.tab_group.request, exceptions.handle(self.tab_group.request,
_('Unable to retrieve IPSec Policies list.')) _('Unable to retrieve IPsec policy list.'))
return ipsecpolicies return ipsecpolicies
def get_filters(self): def get_filters(self):
@ -189,14 +189,14 @@ class IPSecPoliciesTab(tabs.TableTab, htables.DataTableView):
self.handle_server_filter(self.request, table=self.table) self.handle_server_filter(self.request, table=self.table)
self.update_server_filter_action(self.request, table=self.table) self.update_server_filter_action(self.request, table=self.table)
return super(IPSecPoliciesTab, self).get_filters() return super(IPsecPoliciesTab, self).get_filters()
class VPNTabs(tabs.TabGroup): class VPNTabs(tabs.TabGroup):
slug = "vpntabs" slug = "vpntabs"
tabs = (IKEPoliciesTab, IPSecPoliciesTab, tabs = (IKEPoliciesTab, IPsecPoliciesTab,
VPNServicesTab, EndpointGroupTab, VPNServicesTab, EndpointGroupTab,
IPSecSiteConnectionsTab,) IPsecSiteConnectionsTab,)
sticky = True sticky = True
@ -215,8 +215,8 @@ class IKEPolicyDetailsTabs(tabs.TabGroup):
tabs = (IKEPolicyDetailsTab,) tabs = (IKEPolicyDetailsTab,)
class IPSecPolicyDetailsTab(tabs.Tab): class IPsecPolicyDetailsTab(tabs.Tab):
name = _("IPSec Policy Details") name = _("IPsec Policy Details")
slug = "ipsecpolicydetails" slug = "ipsecpolicydetails"
template_name = "project/vpn/_ipsecpolicy_details.html" template_name = "project/vpn/_ipsecpolicy_details.html"
@ -225,9 +225,9 @@ class IPSecPolicyDetailsTab(tabs.Tab):
return {'ipsecpolicy': ipsecpolicy} return {'ipsecpolicy': ipsecpolicy}
class IPSecPolicyDetailsTabs(tabs.TabGroup): class IPsecPolicyDetailsTabs(tabs.TabGroup):
slug = "ipsecpolicytabs" slug = "ipsecpolicytabs"
tabs = (IPSecPolicyDetailsTab,) tabs = (IPsecPolicyDetailsTab,)
class VPNServiceDetailsTab(tabs.Tab): class VPNServiceDetailsTab(tabs.Tab):
@ -260,8 +260,8 @@ class EndpointGroupDetailsTabs(tabs.TabGroup):
tabs = (EndpointGroupDetailsTab,) tabs = (EndpointGroupDetailsTab,)
class IPSecSiteConnectionDetailsTab(tabs.Tab): class IPsecSiteConnectionDetailsTab(tabs.Tab):
name = _("IPSec Site Connection Details") name = _("IPsec Site Connection Details")
slug = "ipsecsiteconnectiondetails" slug = "ipsecsiteconnectiondetails"
template_name = "project/vpn/_ipsecsiteconnection_details.html" template_name = "project/vpn/_ipsecsiteconnection_details.html"
@ -270,6 +270,6 @@ class IPSecSiteConnectionDetailsTab(tabs.Tab):
return {'ipsecsiteconnection': ipsecsiteconnection} return {'ipsecsiteconnection': ipsecsiteconnection}
class IPSecSiteConnectionDetailsTabs(tabs.TabGroup): class IPsecSiteConnectionDetailsTabs(tabs.TabGroup):
slug = "ipsecsiteconnectiontabs" slug = "ipsecsiteconnectiontabs"
tabs = (IPSecSiteConnectionDetailsTab,) tabs = (IPsecSiteConnectionDetailsTab,)

View File

@ -1,12 +1,12 @@
{% load i18n %} {% load i18n %}
<p>{% trans "Create IKE Policy for current project." %}</p> <p>{% trans "Create IKE policy for current project." %}</p>
<p>{% trans "An IKE policy is an association of the following attributes:" %}</p> <p>{% trans "An IKE policy is an association of the following attributes:" %}</p>
<dl class="dl-readable"> <dl class="dl-readable">
<dt>{% trans 'Authorization algorithm' %}</dt> <dt>{% trans 'Authorization algorithm' %}</dt>
<dd>{% trans 'Auth algorithm limited to SHA1 only.' %}</dd> <dd>{% trans 'Auth algorithm limited to SHA1 only.' %}</dd>
<dt>{% trans 'Encryption algorithm' %}</dt> <dt>{% trans 'Encryption algorithm' %}</dt>
<dd>{% trans 'The type of algorithm (3des, aes-128, aes-192, aes-256) used in the IKE Policy.' %}</dd> <dd>{% trans 'The type of algorithm (3des, aes-128, aes-192, aes-256) used in the IKE policy.' %}</dd>
<dt>{% trans 'IKE version' %}</dt> <dt>{% trans 'IKE version' %}</dt>
<dd>{% trans 'The type of version (v1/v2) that needs to be filtered.' %}</dd> <dd>{% trans 'The type of version (v1/v2) that needs to be filtered.' %}</dd>
<dt>{% trans 'Lifetime' %}</dt> <dt>{% trans 'Lifetime' %}</dt>

View File

@ -1,19 +1,19 @@
{% load i18n %} {% load i18n %}
<p>{% trans 'Create IPSec Policy for current project.' %}</p> <p>{% trans 'Create IPsec policy for current project.' %}</p>
<p>{% trans 'An IPSec policy is an association of the following attributes' %}</p> <p>{% trans 'An IPsec policy is an association of the following attributes' %}</p>
<dl class="dl-readable"> <dl class="dl-readable">
<dt>{% trans 'Authorization algorithm' %}</dt> <dt>{% trans 'Authorization algorithm' %}</dt>
<dd>{% trans 'Auth algorithm limited to SHA1 only.' %}</dd> <dd>{% trans 'Auth algorithm limited to SHA1 only.' %}</dd>
<dt>{% trans 'Encapsulation mode' %}</dt> <dt>{% trans 'Encapsulation mode' %}</dt>
<dd>{% trans 'The type of IPsec tunnel (tunnel/transport) to be used.' %}</dd> <dd>{% trans 'The type of IPsec tunnel (tunnel/transport) to be used.' %}</dd>
<dt>{% trans 'Encryption algorithm' %}</dt> <dt>{% trans 'Encryption algorithm' %}</dt>
<dd>{% trans 'The type of algorithm (3des, aes-128, aes-192, aes-256) used in the IPSec Policy.' %}</dd> <dd>{% trans 'The type of algorithm (3des, aes-128, aes-192, aes-256) used in the IPsec policy.' %}</dd>
<dt>{% trans 'Lifetime' %}</dt> <dt>{% trans 'Lifetime' %}</dt>
<dd>{% trans "Life time consists of units and value. Units in 'seconds' and the default value is 3600." %}</dd> <dd>{% trans "Life time consists of units and value. Units in 'seconds' and the default value is 3600." %}</dd>
<dt>{% trans 'Perfect Forward Secrecy' %}</dt> <dt>{% trans 'Perfect Forward Secrecy' %}</dt>
<dd>{% trans 'PFS limited to using Diffie-Hellman groups 2, 5 (default) and 14.' %}</dd> <dd>{% trans 'PFS limited to using Diffie-Hellman groups 2, 5 (default) and 14.' %}</dd>
<dt>{% trans 'Transform Protocol' %}</dt> <dt>{% trans 'Transform Protocol' %}</dt>
<dd>{% trans 'The type of protocol (esp, ah, ah-esp) used in IPSec Policy.' %}</dd> <dd>{% trans 'The type of protocol (esp, ah, ah-esp) used in IPsec policy.' %}</dd>
</dl> </dl>
<p>{% trans 'All fields are optional.' %}</p> <p>{% trans 'All fields are optional.' %}</p>

View File

@ -5,7 +5,7 @@
The VPN service is attached to a router and references to endpoint group The VPN service is attached to a router and references to endpoint group
or a single subnet to push to a remote site. or a single subnet to push to a remote site.
{% endblocktrans %}</p> {% endblocktrans %}</p>
<p>{% trans "Specify a name, description, router, and subnet (optional) for the VPN Service." %}</p> <p>{% trans "Specify a name, description, router, and subnet (optional) for the VPN service." %}</p>
<p>{% trans "Admin State is enabled by default." %}</p> <p>{% trans "Admin State is enabled by default." %}</p>
<p>{% trans "The router and admin state fields require to be enabled. All others are optional." %} </p> <p>{% trans "The router and admin state fields require to be enabled. All others are optional." %} </p>
<p>{% blocktrans trimmed %} <p>{% blocktrans trimmed %}

View File

@ -26,7 +26,7 @@
{% url 'horizon:project:vpn:ikepolicydetails' ipsecsiteconnection.ikepolicy_id as ikepolicy_url %} {% url 'horizon:project:vpn:ikepolicydetails' ipsecsiteconnection.ikepolicy_id as ikepolicy_url %}
<dd><a href="{{ ikepolicy_url }}">{{ ipsecsiteconnection.ikepolicy.name_or_id }}</a></dd> <dd><a href="{{ ikepolicy_url }}">{{ ipsecsiteconnection.ikepolicy.name_or_id }}</a></dd>
<dt>{% trans "IPSec Policy" %}</dt> <dt>{% trans "IPsec Policy" %}</dt>
{% url 'horizon:project:vpn:ipsecpolicydetails' ipsecsiteconnection.ipsecpolicy_id as ipsecpolicy_url %} {% url 'horizon:project:vpn:ipsecpolicydetails' ipsecsiteconnection.ipsecpolicy_id as ipsecpolicy_url %}
<dd><a href="{{ ipsecpolicy_url }}">{{ ipsecsiteconnection.ipsecpolicy.name_or_id }}</a></dd> <dd><a href="{{ ipsecpolicy_url }}">{{ ipsecsiteconnection.ipsecpolicy.name_or_id }}</a></dd>

View File

@ -3,5 +3,5 @@
{% block modal-body-right %} {% block modal-body-right %}
<h3>{% trans "Description:" %}</h3> <h3>{% trans "Description:" %}</h3>
<p>{% trans "You may update IKE Policy details here." %}</p> <p>{% trans "You may update IKE policy details here." %}</p>
{% endblock %} {% endblock %}

View File

@ -3,5 +3,5 @@
{% block modal-body-right %} {% block modal-body-right %}
<h3>{% trans "Description:" %}</h3> <h3>{% trans "Description:" %}</h3>
<p>{% trans "You may update IPSec Policy details here." %}</p> <p>{% trans "You may update IPsec policy details here." %}</p>
{% endblock %} {% endblock %}

View File

@ -3,5 +3,5 @@
{% block modal-body-right %} {% block modal-body-right %}
<h3>{% trans "Description:" %}</h3> <h3>{% trans "Description:" %}</h3>
<p>{% trans "You may update IPSec Site Connection details here." %}</p> <p>{% trans "You may update IPsec site connection details here." %}</p>
{% endblock %} {% endblock %}

View File

@ -3,5 +3,5 @@
{% block modal-body-right %} {% block modal-body-right %}
<h3>{% trans "Description:" %}</h3> <h3>{% trans "Description:" %}</h3>
<p>{% trans "You may update VPN Service details here." %}</p> <p>{% trans "You may update VPN service details here." %}</p>
{% endblock %} {% endblock %}

View File

@ -1,6 +1,6 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load i18n %} {% load i18n %}
{% block title %}{% trans "Edit IPSec Policy" %}{% endblock %} {% block title %}{% trans "Edit IPsec policy" %}{% endblock %}
{% block main %} {% block main %}
{% include 'project/vpn/_update_ipsecpolicy.html' %} {% include 'project/vpn/_update_ipsecpolicy.html' %}

View File

@ -1,6 +1,6 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load i18n %} {% load i18n %}
{% block title %}{% trans "Edit IPSec Site Connection" %}{% endblock %} {% block title %}{% trans "Edit IPsec site connection" %}{% endblock %}
{% block main %} {% block main %}
{% include 'project/vpn/_update_ipsecsiteconnection.html' %} {% include 'project/vpn/_update_ipsecsiteconnection.html' %}

View File

@ -461,9 +461,9 @@ class VPNTests(test.TestCase):
workflow = res.context['workflow'] workflow = res.context['workflow']
self.assertTemplateUsed(res, views.WorkflowView.template_name) self.assertTemplateUsed(res, views.WorkflowView.template_name)
self.assertEqual(workflow.name, workflows.AddIPSecPolicy.name) self.assertEqual(workflow.name, workflows.AddIPsecPolicy.name)
expected_objs = ['<AddIPSecPolicyStep: addipsecpolicyaction>', ] expected_objs = ['<AddIPsecPolicyStep: addipsecpolicyaction>', ]
self.assertQuerysetEqual(workflow.steps, expected_objs) self.assertQuerysetEqual(workflow.steps, expected_objs)
@test.create_stubs({api_vpn: ('ipsecpolicy_create', )}) @test.create_stubs({api_vpn: ('ipsecpolicy_create', )})
@ -536,11 +536,11 @@ class VPNTests(test.TestCase):
workflow = res.context['workflow'] workflow = res.context['workflow']
self.assertTemplateUsed(res, views.WorkflowView.template_name) self.assertTemplateUsed(res, views.WorkflowView.template_name)
self.assertEqual(workflow.name, workflows.AddIPSecSiteConnection.name) self.assertEqual(workflow.name, workflows.AddIPsecSiteConnection.name)
expected_objs = ['<AddIPSecSiteConnectionStep: ' expected_objs = ['<AddIPsecSiteConnectionStep: '
'addipsecsiteconnectionaction>', 'addipsecsiteconnectionaction>',
'<AddIPSecSiteConnectionOptionalStep: ' '<AddIPsecSiteConnectionOptionalStep: '
'addipsecsiteconnectionoptionalaction>', ] 'addipsecsiteconnectionoptionalaction>', ]
self.assertQuerysetEqual(workflow.steps, expected_objs) self.assertQuerysetEqual(workflow.steps, expected_objs)

View File

@ -23,14 +23,14 @@ urlpatterns = [
url(r'^update_ikepolicy/(?P<ikepolicy_id>[^/]+)/$', url(r'^update_ikepolicy/(?P<ikepolicy_id>[^/]+)/$',
views.UpdateIKEPolicyView.as_view(), name='update_ikepolicy'), views.UpdateIKEPolicyView.as_view(), name='update_ikepolicy'),
url(r'^addipsecpolicy$', url(r'^addipsecpolicy$',
views.AddIPSecPolicyView.as_view(), name='addipsecpolicy'), views.AddIPsecPolicyView.as_view(), name='addipsecpolicy'),
url(r'^update_ipsecpolicy/(?P<ipsecpolicy_id>[^/]+)/$', url(r'^update_ipsecpolicy/(?P<ipsecpolicy_id>[^/]+)/$',
views.UpdateIPSecPolicyView.as_view(), name='update_ipsecpolicy'), views.UpdateIPsecPolicyView.as_view(), name='update_ipsecpolicy'),
url(r'^addipsecsiteconnection$', url(r'^addipsecsiteconnection$',
views.AddIPSecSiteConnectionView.as_view(), views.AddIPsecSiteConnectionView.as_view(),
name='addipsecsiteconnection'), name='addipsecsiteconnection'),
url(r'^update_ipsecsiteconnection/(?P<ipsecsiteconnection_id>[^/]+)/$', url(r'^update_ipsecsiteconnection/(?P<ipsecsiteconnection_id>[^/]+)/$',
views.UpdateIPSecSiteConnectionView.as_view(), views.UpdateIPsecSiteConnectionView.as_view(),
name='update_ipsecsiteconnection'), name='update_ipsecsiteconnection'),
url(r'^addvpnservice$', url(r'^addvpnservice$',
views.AddVPNServiceView.as_view(), name='addvpnservice'), views.AddVPNServiceView.as_view(), name='addvpnservice'),
@ -43,12 +43,12 @@ urlpatterns = [
url(r'^ikepolicy/(?P<ikepolicy_id>[^/]+)/$', url(r'^ikepolicy/(?P<ikepolicy_id>[^/]+)/$',
views.IKEPolicyDetailsView.as_view(), name='ikepolicydetails'), views.IKEPolicyDetailsView.as_view(), name='ikepolicydetails'),
url(r'^ipsecpolicy/(?P<ipsecpolicy_id>[^/]+)/$', url(r'^ipsecpolicy/(?P<ipsecpolicy_id>[^/]+)/$',
views.IPSecPolicyDetailsView.as_view(), name='ipsecpolicydetails'), views.IPsecPolicyDetailsView.as_view(), name='ipsecpolicydetails'),
url(r'^vpnservice/(?P<vpnservice_id>[^/]+)/$', url(r'^vpnservice/(?P<vpnservice_id>[^/]+)/$',
views.VPNServiceDetailsView.as_view(), name='vpnservicedetails'), views.VPNServiceDetailsView.as_view(), name='vpnservicedetails'),
url(r'^endpointgroup/(?P<endpoint_group_id>[^/]+)/$', url(r'^endpointgroup/(?P<endpoint_group_id>[^/]+)/$',
views.EndpointGroupDetailsView.as_view(), name='endpointgroupdetails'), views.EndpointGroupDetailsView.as_view(), name='endpointgroupdetails'),
url(r'^ipsecsiteconnection/(?P<ipsecsiteconnection_id>[^/]+)/$', url(r'^ipsecsiteconnection/(?P<ipsecsiteconnection_id>[^/]+)/$',
views.IPSecSiteConnectionDetailsView.as_view(), views.IPsecSiteConnectionDetailsView.as_view(),
name='ipsecsiteconnectiondetails'), name='ipsecsiteconnectiondetails'),
] ]

View File

@ -43,16 +43,16 @@ class AddEndpointGroupView(horizon_workflows.WorkflowView):
workflow_class = workflows.AddEndpointGroup workflow_class = workflows.AddEndpointGroup
class AddIPSecSiteConnectionView(horizon_workflows.WorkflowView): class AddIPsecSiteConnectionView(horizon_workflows.WorkflowView):
workflow_class = workflows.AddIPSecSiteConnection workflow_class = workflows.AddIPsecSiteConnection
class AddIKEPolicyView(horizon_workflows.WorkflowView): class AddIKEPolicyView(horizon_workflows.WorkflowView):
workflow_class = workflows.AddIKEPolicy workflow_class = workflows.AddIKEPolicy
class AddIPSecPolicyView(horizon_workflows.WorkflowView): class AddIPsecPolicyView(horizon_workflows.WorkflowView):
workflow_class = workflows.AddIPSecPolicy workflow_class = workflows.AddIPsecPolicy
class IKEPolicyDetailsView(horizon_tabs.TabView): class IKEPolicyDetailsView(horizon_tabs.TabView):
@ -66,7 +66,7 @@ class IKEPolicyDetailsView(horizon_tabs.TabView):
try: try:
return api_vpn.ikepolicy_get(self.request, pid) return api_vpn.ikepolicy_get(self.request, pid)
except Exception: except Exception:
msg = _('Unable to retrieve IKE Policy details.') msg = _('Unable to retrieve IKE policy details.')
exceptions.handle(self.request, msg, exceptions.handle(self.request, msg,
redirect=self.get_redirect_url()) redirect=self.get_redirect_url())
@ -88,8 +88,8 @@ class IKEPolicyDetailsView(horizon_tabs.TabView):
return reverse_lazy('horizon:project:vpn:index') return reverse_lazy('horizon:project:vpn:index')
class IPSecPolicyDetailsView(horizon_tabs.TabView): class IPsecPolicyDetailsView(horizon_tabs.TabView):
tab_group_class = tabs.IPSecPolicyDetailsTabs tab_group_class = tabs.IPsecPolicyDetailsTabs
template_name = 'horizon/common/_detail.html' template_name = 'horizon/common/_detail.html'
page_title = "{{ ipsecpolicy.name|default:ipsecpolicy.id }}" page_title = "{{ ipsecpolicy.name|default:ipsecpolicy.id }}"
@ -99,15 +99,15 @@ class IPSecPolicyDetailsView(horizon_tabs.TabView):
try: try:
return api_vpn.ipsecpolicy_get(self.request, pid) return api_vpn.ipsecpolicy_get(self.request, pid)
except Exception: except Exception:
msg = _('Unable to retrieve IPSec Policy details.') msg = _('Unable to retrieve IPsec policy details.')
exceptions.handle(self.request, msg, exceptions.handle(self.request, msg,
redirect=self.get_redirect_url()) redirect=self.get_redirect_url())
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(IPSecPolicyDetailsView, self).get_context_data( context = super(IPsecPolicyDetailsView, self).get_context_data(
**kwargs) **kwargs)
ipsecpolicy = self.get_data() ipsecpolicy = self.get_data()
table = tables.IPSecPoliciesTable(self.request) table = tables.IPsecPoliciesTable(self.request)
context["ipsecpolicy"] = ipsecpolicy context["ipsecpolicy"] = ipsecpolicy
context["url"] = self.get_redirect_url() context["url"] = self.get_redirect_url()
context["actions"] = table.render_row_actions(ipsecpolicy) context["actions"] = table.render_row_actions(ipsecpolicy)
@ -135,7 +135,7 @@ class VPNServiceDetailsView(horizon_tabs.TabView):
vpnservice = api_vpn.vpnservice_get(self.request, sid) vpnservice = api_vpn.vpnservice_get(self.request, sid)
except Exception: except Exception:
vpnservice = [] vpnservice = []
msg = _('Unable to retrieve VPN Service details.') msg = _('Unable to retrieve VPN service details.')
exceptions.handle(self.request, msg, exceptions.handle(self.request, msg,
redirect=self.get_redirect_url()) redirect=self.get_redirect_url())
try: try:
@ -209,8 +209,8 @@ class EndpointGroupDetailsView(horizon_tabs.TabView):
return reverse('horizon:project:vpn:index') return reverse('horizon:project:vpn:index')
class IPSecSiteConnectionDetailsView(horizon_tabs.TabView): class IPsecSiteConnectionDetailsView(horizon_tabs.TabView):
tab_group_class = tabs.IPSecSiteConnectionDetailsTabs tab_group_class = tabs.IPsecSiteConnectionDetailsTabs
template_name = 'horizon/common/_detail.html' template_name = 'horizon/common/_detail.html'
page_title = "{{ ipsecsiteconnection.name|default:ipsecsiteconnection.id}}" page_title = "{{ ipsecsiteconnection.name|default:ipsecsiteconnection.id}}"
@ -220,15 +220,15 @@ class IPSecSiteConnectionDetailsView(horizon_tabs.TabView):
try: try:
return api_vpn.ipsecsiteconnection_get(self.request, cid) return api_vpn.ipsecsiteconnection_get(self.request, cid)
except Exception: except Exception:
msg = _('Unable to retrieve IPSec Site Connection details.') msg = _('Unable to retrieve IPsec site connection details.')
exceptions.handle(self.request, msg, exceptions.handle(self.request, msg,
redirect=self.get_redirect_url()) redirect=self.get_redirect_url())
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(IPSecSiteConnectionDetailsView, self).get_context_data( context = super(IPsecSiteConnectionDetailsView, self).get_context_data(
**kwargs) **kwargs)
ipsecsiteconnection = self.get_data() ipsecsiteconnection = self.get_data()
table = tables.IPSecSiteConnectionsTable(self.request) table = tables.IPsecSiteConnectionsTable(self.request)
context["ipsecsiteconnection"] = ipsecsiteconnection context["ipsecsiteconnection"] = ipsecsiteconnection
context["url"] = self.get_redirect_url() context["url"] = self.get_redirect_url()
context["actions"] = table.render_row_actions(ipsecsiteconnection) context["actions"] = table.render_row_actions(ipsecsiteconnection)
@ -269,7 +269,7 @@ class UpdateVPNServiceView(horizon_forms.ModalFormView):
return api_vpn.vpnservice_get(self.request, vpnservice_id) return api_vpn.vpnservice_get(self.request, vpnservice_id)
except Exception as e: except Exception as e:
redirect = self.success_url redirect = self.success_url
msg = _('Unable to retrieve VPN Service details. %s') % e msg = _('Unable to retrieve VPN service details. %s') % e
exceptions.handle(self.request, msg, redirect=redirect) exceptions.handle(self.request, msg, redirect=redirect)
def get_initial(self): def get_initial(self):
@ -339,7 +339,7 @@ class UpdateIKEPolicyView(horizon_forms.ModalFormView):
return api_vpn.ikepolicy_get(self.request, ikepolicy_id) return api_vpn.ikepolicy_get(self.request, ikepolicy_id)
except Exception as e: except Exception as e:
redirect = self.success_url redirect = self.success_url
msg = _('Unable to retrieve IKE Policy details. %s') % e msg = _('Unable to retrieve IKE policy details. %s') % e
exceptions.handle(self.request, msg, redirect=redirect) exceptions.handle(self.request, msg, redirect=redirect)
def get_initial(self): def get_initial(self):
@ -357,18 +357,18 @@ class UpdateIKEPolicyView(horizon_forms.ModalFormView):
'phase1_negotiation_mode']} 'phase1_negotiation_mode']}
class UpdateIPSecPolicyView(horizon_forms.ModalFormView): class UpdateIPsecPolicyView(horizon_forms.ModalFormView):
form_class = forms.UpdateIPSecPolicy form_class = forms.UpdateIPsecPolicy
form_id = "update_ipsecpolicy_form" form_id = "update_ipsecpolicy_form"
template_name = "project/vpn/update_ipsecpolicy.html" template_name = "project/vpn/update_ipsecpolicy.html"
context_object_name = 'ipsecpolicy' context_object_name = 'ipsecpolicy'
submit_label = _("Save Changes") submit_label = _("Save Changes")
submit_url = "horizon:project:vpn:update_ipsecpolicy" submit_url = "horizon:project:vpn:update_ipsecpolicy"
success_url = reverse_lazy("horizon:project:vpn:index") success_url = reverse_lazy("horizon:project:vpn:index")
page_title = _("Edit IPSec Policy") page_title = _("Edit IPsec Policy")
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(UpdateIPSecPolicyView, self).get_context_data(**kwargs) context = super(UpdateIPsecPolicyView, self).get_context_data(**kwargs)
context["ipsecpolicy_id"] = self.kwargs['ipsecpolicy_id'] context["ipsecpolicy_id"] = self.kwargs['ipsecpolicy_id']
args = (self.kwargs['ipsecpolicy_id'],) args = (self.kwargs['ipsecpolicy_id'],)
context['submit_url'] = reverse(self.submit_url, args=args) context['submit_url'] = reverse(self.submit_url, args=args)
@ -381,7 +381,7 @@ class UpdateIPSecPolicyView(horizon_forms.ModalFormView):
return api_vpn.ipsecpolicy_get(self.request, ipsecpolicy_id) return api_vpn.ipsecpolicy_get(self.request, ipsecpolicy_id)
except Exception as e: except Exception as e:
redirect = self.success_url redirect = self.success_url
msg = _('Unable to retrieve IPSec Policy details. %s') % e msg = _('Unable to retrieve IPsec policy details. %s') % e
exceptions.handle(self.request, msg, redirect=redirect) exceptions.handle(self.request, msg, redirect=redirect)
def get_initial(self): def get_initial(self):
@ -398,19 +398,19 @@ class UpdateIPSecPolicyView(horizon_forms.ModalFormView):
'transform_protocol': ipsecpolicy['transform_protocol']} 'transform_protocol': ipsecpolicy['transform_protocol']}
class UpdateIPSecSiteConnectionView(horizon_forms.ModalFormView): class UpdateIPsecSiteConnectionView(horizon_forms.ModalFormView):
form_class = forms.UpdateIPSecSiteConnection form_class = forms.UpdateIPsecSiteConnection
form_id = "update_ipsecsiteconnection_form" form_id = "update_ipsecsiteconnection_form"
template_name = "project/vpn/update_ipsecsiteconnection.html" template_name = "project/vpn/update_ipsecsiteconnection.html"
context_object_name = 'ipsecsiteconnection' context_object_name = 'ipsecsiteconnection'
submit_label = _("Save Changes") submit_label = _("Save Changes")
submit_url = "horizon:project:vpn:update_ipsecsiteconnection" submit_url = "horizon:project:vpn:update_ipsecsiteconnection"
success_url = reverse_lazy("horizon:project:vpn:index") success_url = reverse_lazy("horizon:project:vpn:index")
page_title = _("Edit IPSec Site Connection") page_title = _("Edit IPsec Site Connection")
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super( context = super(
UpdateIPSecSiteConnectionView, self).get_context_data(**kwargs) UpdateIPsecSiteConnectionView, self).get_context_data(**kwargs)
context["ipsecsiteconnection_id"] = self.kwargs[ context["ipsecsiteconnection_id"] = self.kwargs[
'ipsecsiteconnection_id'] 'ipsecsiteconnection_id']
args = (self.kwargs['ipsecsiteconnection_id'],) args = (self.kwargs['ipsecsiteconnection_id'],)
@ -424,7 +424,7 @@ class UpdateIPSecSiteConnectionView(horizon_forms.ModalFormView):
return api_vpn.ipsecsiteconnection_get(self.request, connection_id) return api_vpn.ipsecsiteconnection_get(self.request, connection_id)
except Exception as e: except Exception as e:
redirect = self.success_url redirect = self.success_url
msg = _('Unable to retrieve IPSec Site Connection details. %s') % e msg = _('Unable to retrieve IPsec site connection details. %s') % e
exceptions.handle(self.request, msg, redirect=redirect) exceptions.handle(self.request, msg, redirect=redirect)
def get_initial(self): def get_initial(self):

View File

@ -94,8 +94,8 @@ class AddVPNService(workflows.Workflow):
slug = "addvpnservice" slug = "addvpnservice"
name = _("Add VPN Service") name = _("Add VPN Service")
finalize_button_name = _("Add") finalize_button_name = _("Add")
success_message = _('Added VPN Service "%s".') success_message = _('Added VPN service "%s".')
failure_message = _('Unable to add VPN Service "%s".') failure_message = _('Unable to add VPN service "%s".')
success_url = "horizon:project:vpn:index" success_url = "horizon:project:vpn:index"
default_steps = (AddVPNServiceStep,) default_steps = (AddVPNServiceStep,)
@ -122,7 +122,7 @@ class AddEndpointGroupAction(workflows.Action):
label=_("Description")) label=_("Description"))
type = forms.ThemableChoiceField( type = forms.ThemableChoiceField(
label=_("Type"), label=_("Type"),
help_text=_("IPSec connection validation requires that local " help_text=_("IPsec connection validation requires that local "
"endpoints are subnets, and peer endpoints are CIDRs."), "endpoints are subnets, and peer endpoints are CIDRs."),
choices=[('cidr', _('CIDR (for external systems)')), choices=[('cidr', _('CIDR (for external systems)')),
('subnet', _('Subnet (for local systems)'))], ('subnet', _('Subnet (for local systems)'))],
@ -298,8 +298,8 @@ class AddIKEPolicy(workflows.Workflow):
slug = "addikepolicy" slug = "addikepolicy"
name = _("Add IKE Policy") name = _("Add IKE Policy")
finalize_button_name = _("Add") finalize_button_name = _("Add")
success_message = _('Added IKE Policy "%s".') success_message = _('Added IKE policy "%s".')
failure_message = _('Unable to add IKE Policy "%s".') failure_message = _('Unable to add IKE policy "%s".')
success_url = "horizon:project:vpn:index" success_url = "horizon:project:vpn:index"
default_steps = (AddIKEPolicyStep,) default_steps = (AddIKEPolicyStep,)
@ -314,7 +314,7 @@ class AddIKEPolicy(workflows.Workflow):
return False return False
class AddIPSecPolicyAction(workflows.Action): class AddIPsecPolicyAction(workflows.Action):
name = forms.CharField(max_length=80, label=_("Name"), required=False) name = forms.CharField(max_length=80, label=_("Name"), required=False)
description = forms.CharField( description = forms.CharField(
initial="", required=False, initial="", required=False,
@ -337,7 +337,7 @@ class AddIPSecPolicyAction(workflows.Action):
required=False) required=False)
def __init__(self, request, *args, **kwargs): def __init__(self, request, *args, **kwargs):
super(AddIPSecPolicyAction, self).__init__(request, *args, **kwargs) super(AddIPsecPolicyAction, self).__init__(request, *args, **kwargs)
auth_algorithm_choices = [("sha1", "sha1")] auth_algorithm_choices = [("sha1", "sha1")]
self.fields['auth_algorithm'].choices = auth_algorithm_choices self.fields['auth_algorithm'].choices = auth_algorithm_choices
@ -373,20 +373,20 @@ class AddIPSecPolicyAction(workflows.Action):
self.fields['transform_protocol'].choices = transform_protocol_choices self.fields['transform_protocol'].choices = transform_protocol_choices
class Meta(object): class Meta(object):
name = _("Add New IPSec Policy") name = _("Add New IPsec Policy")
permissions = ('openstack.services.network',) permissions = ('openstack.services.network',)
help_text_template = 'project/vpn/_add_ipsec_policy_help.html' help_text_template = 'project/vpn/_add_ipsec_policy_help.html'
class AddIPSecPolicyStep(workflows.Step): class AddIPsecPolicyStep(workflows.Step):
action_class = AddIPSecPolicyAction action_class = AddIPsecPolicyAction
contributes = ("name", "description", "auth_algorithm", contributes = ("name", "description", "auth_algorithm",
"encapsulation_mode", "encryption_algorithm", "encapsulation_mode", "encryption_algorithm",
"lifetime_units", "lifetime_value", "lifetime_units", "lifetime_value",
"pfs", "transform_protocol") "pfs", "transform_protocol")
def contribute(self, data, context): def contribute(self, data, context):
context = super(AddIPSecPolicyStep, self).contribute(data, context) context = super(AddIPsecPolicyStep, self).contribute(data, context)
context['lifetime'] = {'units': data['lifetime_units'], context['lifetime'] = {'units': data['lifetime_units'],
'value': data['lifetime_value']} 'value': data['lifetime_value']}
context.pop('lifetime_units') context.pop('lifetime_units')
@ -395,14 +395,14 @@ class AddIPSecPolicyStep(workflows.Step):
return context return context
class AddIPSecPolicy(workflows.Workflow): class AddIPsecPolicy(workflows.Workflow):
slug = "addipsecpolicy" slug = "addipsecpolicy"
name = _("Add IPSec Policy") name = _("Add IPsec Policy")
finalize_button_name = _("Add") finalize_button_name = _("Add")
success_message = _('Added IPSec Policy "%s".') success_message = _('Added IPsec policy "%s".')
failure_message = _('Unable to add IPSec Policy "%s".') failure_message = _('Unable to add IPsec policy "%s".')
success_url = "horizon:project:vpn:index" success_url = "horizon:project:vpn:index"
default_steps = (AddIPSecPolicyStep,) default_steps = (AddIPsecPolicyStep,)
def format_status_message(self, message): def format_status_message(self, message):
return message % self.context.get('name') return message % self.context.get('name')
@ -415,13 +415,13 @@ class AddIPSecPolicy(workflows.Workflow):
return False return False
class AddIPSecSiteConnectionAction(workflows.Action): class AddIPsecSiteConnectionAction(workflows.Action):
name = forms.CharField(max_length=80, label=_("Name"), required=False) name = forms.CharField(max_length=80, label=_("Name"), required=False)
description = forms.CharField( description = forms.CharField(
initial="", required=False, initial="", required=False,
max_length=80, label=_("Description")) max_length=80, label=_("Description"))
vpnservice_id = forms.ChoiceField( vpnservice_id = forms.ChoiceField(
label=_("VPN Service associated with this connection")) label=_("VPN service associated with this connection"))
local_ep_group_id = forms.ChoiceField( local_ep_group_id = forms.ChoiceField(
required=False, required=False,
label=_("Endpoint Group for local subnet(s)"), label=_("Endpoint Group for local subnet(s)"),
@ -429,9 +429,9 @@ class AddIPSecSiteConnectionAction(workflows.Action):
"connected to. Required if no subnet is specified " "connected to. Required if no subnet is specified "
"in a VPN service selected.")) "in a VPN service selected."))
ikepolicy_id = forms.ChoiceField( ikepolicy_id = forms.ChoiceField(
label=_("IKE Policy associated with this connection")) label=_("IKE policy associated with this connection"))
ipsecpolicy_id = forms.ChoiceField( ipsecpolicy_id = forms.ChoiceField(
label=_("IPSec Policy associated with this connection")) label=_("IPsec policy associated with this connection"))
peer_address = forms.IPField( peer_address = forms.IPField(
label=_("Peer gateway public IPv4/IPv6 Address or FQDN"), label=_("Peer gateway public IPv4/IPv6 Address or FQDN"),
help_text=_("Peer gateway public IPv4/IPv6 address or FQDN for " help_text=_("Peer gateway public IPv4/IPv6 address or FQDN for "
@ -447,7 +447,7 @@ class AddIPSecSiteConnectionAction(workflows.Action):
peer_ep_group_id = forms.ChoiceField( peer_ep_group_id = forms.ChoiceField(
required=False, required=False,
label=_("Endpoint Group for remote peer CIDR(s)"), label=_("Endpoint Group for remote peer CIDR(s)"),
help_text=_("Remote peer CIDR(s) connected to the new IPSec " help_text=_("Remote peer CIDR(s) connected to the new IPsec "
"connection.")) "connection."))
peer_cidrs = forms.MultiIPField( peer_cidrs = forms.MultiIPField(
required=False, required=False,
@ -466,13 +466,13 @@ class AddIPSecSiteConnectionAction(workflows.Action):
"between the two peers of the VPN connection")) "between the two peers of the VPN connection"))
def populate_ikepolicy_id_choices(self, request, context): def populate_ikepolicy_id_choices(self, request, context):
ikepolicy_id_choices = [('', _("Select IKE Policy"))] ikepolicy_id_choices = [('', _("Select IKE policy"))]
try: try:
tenant_id = self.request.user.tenant_id tenant_id = self.request.user.tenant_id
ikepolicies = api_vpn.ikepolicy_list(request, tenant_id=tenant_id) ikepolicies = api_vpn.ikepolicy_list(request, tenant_id=tenant_id)
except Exception: except Exception:
exceptions.handle(request, exceptions.handle(request,
_('Unable to retrieve IKE Policies list.')) _('Unable to retrieve IKE policies list.'))
ikepolicies = [] ikepolicies = []
for p in ikepolicies: for p in ikepolicies:
ikepolicy_id_choices.append((p.id, p.name)) ikepolicy_id_choices.append((p.id, p.name))
@ -480,14 +480,14 @@ class AddIPSecSiteConnectionAction(workflows.Action):
return ikepolicy_id_choices return ikepolicy_id_choices
def populate_ipsecpolicy_id_choices(self, request, context): def populate_ipsecpolicy_id_choices(self, request, context):
ipsecpolicy_id_choices = [('', _("Select IPSec Policy"))] ipsecpolicy_id_choices = [('', _("Select IPsec Policy"))]
try: try:
tenant_id = self.request.user.tenant_id tenant_id = self.request.user.tenant_id
ipsecpolicies = api_vpn.ipsecpolicy_list(request, ipsecpolicies = api_vpn.ipsecpolicy_list(request,
tenant_id=tenant_id) tenant_id=tenant_id)
except Exception: except Exception:
exceptions.handle(request, exceptions.handle(request,
_('Unable to retrieve IPSec Policies list.')) _('Unable to retrieve IPsec policies list.'))
ipsecpolicies = [] ipsecpolicies = []
for p in ipsecpolicies: for p in ipsecpolicies:
ipsecpolicy_id_choices.append((p.id, p.name)) ipsecpolicy_id_choices.append((p.id, p.name))
@ -495,13 +495,13 @@ class AddIPSecSiteConnectionAction(workflows.Action):
return ipsecpolicy_id_choices return ipsecpolicy_id_choices
def populate_vpnservice_id_choices(self, request, context): def populate_vpnservice_id_choices(self, request, context):
vpnservice_id_choices = [('', _("Select VPN Service"))] vpnservice_id_choices = [('', _("Select VPN service"))]
try: try:
tenant_id = self.request.user.tenant_id tenant_id = self.request.user.tenant_id
vpnservices = api_vpn.vpnservice_list(request, tenant_id=tenant_id) vpnservices = api_vpn.vpnservice_list(request, tenant_id=tenant_id)
except Exception: except Exception:
exceptions.handle(request, exceptions.handle(request,
_('Unable to retrieve VPN Services list.')) _('Unable to retrieve VPN services list.'))
vpnservices = [] vpnservices = []
for s in vpnservices: for s in vpnservices:
vpnservice_id_choices.append((s.id, s.name)) vpnservice_id_choices.append((s.id, s.name))
@ -539,24 +539,24 @@ class AddIPSecSiteConnectionAction(workflows.Action):
return peer_ep_group_ids return peer_ep_group_ids
class Meta(object): class Meta(object):
name = _("Add New IPSec Site Connection") name = _("Add New IPsec Site Connection")
permissions = ('openstack.services.network',) permissions = ('openstack.services.network',)
help_text = _("Create IPSec Site Connection for current " help_text = _("Create IPsec site connection for current "
"project. Assign a name and description for the " "project. Assign a name and description for the "
"IPSec Site Connection. " "IPsec site connection. "
"All fields in this tab are required." "All fields in this tab are required."
) )
class AddIPSecSiteConnectionStep(workflows.Step): class AddIPsecSiteConnectionStep(workflows.Step):
action_class = AddIPSecSiteConnectionAction action_class = AddIPsecSiteConnectionAction
contributes = ("name", "description", contributes = ("name", "description",
"vpnservice_id", "ikepolicy_id", "ipsecpolicy_id", "vpnservice_id", "ikepolicy_id", "ipsecpolicy_id",
"peer_address", "peer_id", "peer_cidrs", "psk", "peer_address", "peer_id", "peer_cidrs", "psk",
"local_ep_group_id", "peer_ep_group_id") "local_ep_group_id", "peer_ep_group_id")
class AddIPSecSiteConnectionOptionalAction(workflows.Action): class AddIPsecSiteConnectionOptionalAction(workflows.Action):
mtu = forms.IntegerField( mtu = forms.IntegerField(
min_value=68, min_value=68,
label=_("Maximum Transmission Unit size for the connection"), label=_("Maximum Transmission Unit size for the connection"),
@ -580,14 +580,14 @@ class AddIPSecSiteConnectionOptionalAction(workflows.Action):
initiator = forms.ChoiceField(label=_("Initiator state"), required=False) initiator = forms.ChoiceField(label=_("Initiator state"), required=False)
admin_state_up = forms.BooleanField( admin_state_up = forms.BooleanField(
label=_("Enable Admin State"), label=_("Enable Admin State"),
help_text=_("The state of IPSec site connection to start in. " help_text=_("The state of IPsec site connection to start in. "
"If disabled (not checked), IPSec site connection " "If disabled (not checked), IPsec site connection "
"does not forward packets."), "does not forward packets."),
initial=True, initial=True,
required=False) required=False)
def __init__(self, request, *args, **kwargs): def __init__(self, request, *args, **kwargs):
super(AddIPSecSiteConnectionOptionalAction, self).__init__( super(AddIPsecSiteConnectionOptionalAction, self).__init__(
request, *args, **kwargs) request, *args, **kwargs)
initiator_choices = [("bi-directional", "bi-directional"), initiator_choices = [("bi-directional", "bi-directional"),
@ -604,7 +604,7 @@ class AddIPSecSiteConnectionOptionalAction(workflows.Action):
return dpd_action_choices return dpd_action_choices
def clean(self): def clean(self):
cleaned_data = super(AddIPSecSiteConnectionOptionalAction, cleaned_data = super(AddIPsecSiteConnectionOptionalAction,
self).clean() self).clean()
interval = cleaned_data.get('dpd_interval') interval = cleaned_data.get('dpd_interval')
timeout = cleaned_data.get('dpd_timeout') timeout = cleaned_data.get('dpd_timeout')
@ -619,18 +619,18 @@ class AddIPSecSiteConnectionOptionalAction(workflows.Action):
permissions = ('openstack.services.network',) permissions = ('openstack.services.network',)
help_text = _("Fields in this tab are optional. " help_text = _("Fields in this tab are optional. "
"You can configure the detail of " "You can configure the detail of "
"IPSec site connection created." "IPsec site connection created."
) )
class AddIPSecSiteConnectionOptionalStep(workflows.Step): class AddIPsecSiteConnectionOptionalStep(workflows.Step):
action_class = AddIPSecSiteConnectionOptionalAction action_class = AddIPsecSiteConnectionOptionalAction
contributes = ("dpd_action", "dpd_interval", "dpd_timeout", contributes = ("dpd_action", "dpd_interval", "dpd_timeout",
"initiator", "mtu", "admin_state_up") "initiator", "mtu", "admin_state_up")
def contribute(self, data, context): def contribute(self, data, context):
context = super( context = super(
AddIPSecSiteConnectionOptionalStep, self).contribute(data, context) AddIPsecSiteConnectionOptionalStep, self).contribute(data, context)
context['dpd'] = {'action': data['dpd_action'], context['dpd'] = {'action': data['dpd_action'],
'interval': data['dpd_interval'], 'interval': data['dpd_interval'],
'timeout': data['dpd_timeout']} 'timeout': data['dpd_timeout']}
@ -646,15 +646,15 @@ class AddIPSecSiteConnectionOptionalStep(workflows.Step):
return context return context
class AddIPSecSiteConnection(workflows.Workflow): class AddIPsecSiteConnection(workflows.Workflow):
slug = "addipsecsiteconnection" slug = "addipsecsiteconnection"
name = _("Add IPSec Site Connection") name = _("Add IPsec Site Connection")
finalize_button_name = _("Add") finalize_button_name = _("Add")
success_message = _('Added IPSec Site Connection "%s".') success_message = _('Added IPsec site connection "%s".')
failure_message = _('Unable to add IPSec Site Connection "%s".') failure_message = _('Unable to add IPsec site connection "%s".')
success_url = "horizon:project:vpn:index" success_url = "horizon:project:vpn:index"
default_steps = (AddIPSecSiteConnectionStep, default_steps = (AddIPsecSiteConnectionStep,
AddIPSecSiteConnectionOptionalStep) AddIPsecSiteConnectionOptionalStep)
def format_status_message(self, message): def format_status_message(self, message):
return message % self.context.get('name') return message % self.context.get('name')

View File

@ -226,7 +226,7 @@ class VPNaasApiTests(test.APITestCase):
self.mox.ReplayAll() self.mox.ReplayAll()
ret_val = api_vpn.ipsecpolicy_create(self.request, **form_data) ret_val = api_vpn.ipsecpolicy_create(self.request, **form_data)
self.assertIsInstance(ret_val, api_vpn.IPSecPolicy) self.assertIsInstance(ret_val, api_vpn.IPsecPolicy)
@test.create_stubs({neutronclient: ('list_ipsecpolicies', @test.create_stubs({neutronclient: ('list_ipsecpolicies',
'list_ipsec_site_connections')}) 'list_ipsec_site_connections')})
@ -244,7 +244,7 @@ class VPNaasApiTests(test.APITestCase):
ret_val = api_vpn.ipsecpolicy_list(self.request) ret_val = api_vpn.ipsecpolicy_list(self.request)
for (v, d) in zip(ret_val, ipsecpolicies['ipsecpolicies']): for (v, d) in zip(ret_val, ipsecpolicies['ipsecpolicies']):
self.assertIsInstance(v, api_vpn.IPSecPolicy) self.assertIsInstance(v, api_vpn.IPsecPolicy)
self.assertTrue(v.name, d.name) self.assertTrue(v.name, d.name)
self.assertTrue(v.id) self.assertTrue(v.id)
@ -264,7 +264,7 @@ class VPNaasApiTests(test.APITestCase):
self.mox.ReplayAll() self.mox.ReplayAll()
ret_val = api_vpn.ipsecpolicy_get(self.request, ipsecpolicy.id) ret_val = api_vpn.ipsecpolicy_get(self.request, ipsecpolicy.id)
self.assertIsInstance(ret_val, api_vpn.IPSecPolicy) self.assertIsInstance(ret_val, api_vpn.IPsecPolicy)
@test.create_stubs({neutronclient: ('create_ipsec_site_connection',)}) @test.create_stubs({neutronclient: ('create_ipsec_site_connection',)})
def test_ipsecsiteconnection_create(self): def test_ipsecsiteconnection_create(self):
@ -294,7 +294,7 @@ class VPNaasApiTests(test.APITestCase):
ret_val = api_vpn.ipsecsiteconnection_create( ret_val = api_vpn.ipsecsiteconnection_create(
self.request, **form_data) self.request, **form_data)
self.assertIsInstance(ret_val, api_vpn.IPSecSiteConnection) self.assertIsInstance(ret_val, api_vpn.IPsecSiteConnection)
@test.create_stubs({neutronclient: ('list_ipsec_site_connections', @test.create_stubs({neutronclient: ('list_ipsec_site_connections',
'list_ikepolicies', 'list_ikepolicies',
@ -320,7 +320,7 @@ class VPNaasApiTests(test.APITestCase):
ret_val = api_vpn.ipsecsiteconnection_list(self.request) ret_val = api_vpn.ipsecsiteconnection_list(self.request)
for (v, d) in zip(ret_val, for (v, d) in zip(ret_val,
ipsecsiteconnections['ipsec_site_connections']): ipsecsiteconnections['ipsec_site_connections']):
self.assertIsInstance(v, api_vpn.IPSecSiteConnection) self.assertIsInstance(v, api_vpn.IPsecSiteConnection)
self.assertTrue(v.name, d.name) self.assertTrue(v.name, d.name)
self.assertTrue(v.id) self.assertTrue(v.id)
@ -348,4 +348,4 @@ class VPNaasApiTests(test.APITestCase):
ret_val = api_vpn.ipsecsiteconnection_get(self.request, ret_val = api_vpn.ipsecsiteconnection_get(self.request,
ipsecsiteconnection.id) ipsecsiteconnection.id)
self.assertIsInstance(ret_val, api_vpn.IPSecSiteConnection) self.assertIsInstance(ret_val, api_vpn.IPsecSiteConnection)

View File

@ -32,7 +32,7 @@ def data(TEST):
TEST.api_ipsecsiteconnections = utils.TestDataContainer() TEST.api_ipsecsiteconnections = utils.TestDataContainer()
TEST.api_endpointgroups = utils.TestDataContainer() TEST.api_endpointgroups = utils.TestDataContainer()
# 1st VPNService. # 1st VPN service.
vpnservice_dict = {'id': '09a26949-6231-4f72-942a-0c8c0ddd4d61', vpnservice_dict = {'id': '09a26949-6231-4f72-942a-0c8c0ddd4d61',
'tenant_id': '1', 'tenant_id': '1',
'name': 'cloud_vpn1', 'name': 'cloud_vpn1',
@ -48,7 +48,7 @@ def data(TEST):
TEST.api_vpnservices.add(vpnservice_dict) TEST.api_vpnservices.add(vpnservice_dict)
TEST.vpnservices.add(vpn.VPNService(vpnservice_dict)) TEST.vpnservices.add(vpn.VPNService(vpnservice_dict))
# 2nd VPNService. # 2nd VPN service.
vpnservice_dict = {'id': '09a26949-6231-4f72-942a-0c8c0ddd4d62', vpnservice_dict = {'id': '09a26949-6231-4f72-942a-0c8c0ddd4d62',
'tenant_id': '1', 'tenant_id': '1',
'name': 'cloud_vpn2', 'name': 'cloud_vpn2',
@ -77,7 +77,7 @@ def data(TEST):
TEST.api_endpointgroups.add(endpointgroup_dict) TEST.api_endpointgroups.add(endpointgroup_dict)
TEST.endpointgroups.add(vpn.EndpointGroup(endpointgroup_dict)) TEST.endpointgroups.add(vpn.EndpointGroup(endpointgroup_dict))
# 1st IKEPolicy # 1st IKE policy
ikepolicy_dict = {'id': 'a1f009b7-0ffa-43a7-ba19-dcabb0b4c981', ikepolicy_dict = {'id': 'a1f009b7-0ffa-43a7-ba19-dcabb0b4c981',
'tenant_id': '1', 'tenant_id': '1',
'name': 'ikepolicy_1', 'name': 'ikepolicy_1',
@ -92,7 +92,7 @@ def data(TEST):
TEST.api_ikepolicies.add(ikepolicy_dict) TEST.api_ikepolicies.add(ikepolicy_dict)
TEST.ikepolicies.add(vpn.IKEPolicy(ikepolicy_dict)) TEST.ikepolicies.add(vpn.IKEPolicy(ikepolicy_dict))
# 2nd IKEPolicy # 2nd IKE policy
ikepolicy_dict = {'id': 'a1f009b7-0ffa-43a7-ba19-dcabb0b4c982', ikepolicy_dict = {'id': 'a1f009b7-0ffa-43a7-ba19-dcabb0b4c982',
'tenant_id': '1', 'tenant_id': '1',
'name': 'ikepolicy_2', 'name': 'ikepolicy_2',
@ -107,7 +107,7 @@ def data(TEST):
TEST.api_ikepolicies.add(ikepolicy_dict) TEST.api_ikepolicies.add(ikepolicy_dict)
TEST.ikepolicies.add(vpn.IKEPolicy(ikepolicy_dict)) TEST.ikepolicies.add(vpn.IKEPolicy(ikepolicy_dict))
# 1st IPSecPolicy # 1st IPsec policy
ipsecpolicy_dict = {'id': '8376e1dd-2b1c-4346-b23c-6989e75ecdb8', ipsecpolicy_dict = {'id': '8376e1dd-2b1c-4346-b23c-6989e75ecdb8',
'tenant_id': '1', 'tenant_id': '1',
'name': 'ipsecpolicy_1', 'name': 'ipsecpolicy_1',
@ -120,9 +120,9 @@ def data(TEST):
'transform_protocol': 'esp', 'transform_protocol': 'esp',
'ipsecsiteconns': TEST.ipsecsiteconnections.list()} 'ipsecsiteconns': TEST.ipsecsiteconnections.list()}
TEST.api_ipsecpolicies.add(ipsecpolicy_dict) TEST.api_ipsecpolicies.add(ipsecpolicy_dict)
TEST.ipsecpolicies.add(vpn.IPSecPolicy(ipsecpolicy_dict)) TEST.ipsecpolicies.add(vpn.IPsecPolicy(ipsecpolicy_dict))
# 2nd IPSecPolicy # 2nd IPsec policy
ipsecpolicy_dict = {'id': '8376e1dd-2b1c-4346-b23c-6989e75ecdb9', ipsecpolicy_dict = {'id': '8376e1dd-2b1c-4346-b23c-6989e75ecdb9',
'tenant_id': '1', 'tenant_id': '1',
'name': 'ipsecpolicy_2', 'name': 'ipsecpolicy_2',
@ -135,9 +135,9 @@ def data(TEST):
'transform_protocol': 'esp', 'transform_protocol': 'esp',
'ipsecsiteconns': []} 'ipsecsiteconns': []}
TEST.api_ipsecpolicies.add(ipsecpolicy_dict) TEST.api_ipsecpolicies.add(ipsecpolicy_dict)
TEST.ipsecpolicies.add(vpn.IPSecPolicy(ipsecpolicy_dict)) TEST.ipsecpolicies.add(vpn.IPsecPolicy(ipsecpolicy_dict))
# 1st IPSecSiteConnection # 1st IPsec site connection
ipsecsiteconnection_dict = {'id': 'dd1dd3a0-f349-49be-b013-245e147763d6', ipsecsiteconnection_dict = {'id': 'dd1dd3a0-f349-49be-b013-245e147763d6',
'tenant_id': '1', 'tenant_id': '1',
'name': 'ipsec_connection_1', 'name': 'ipsec_connection_1',
@ -160,9 +160,9 @@ def data(TEST):
'status': 'Active'} 'status': 'Active'}
TEST.api_ipsecsiteconnections.add(ipsecsiteconnection_dict) TEST.api_ipsecsiteconnections.add(ipsecsiteconnection_dict)
TEST.ipsecsiteconnections.add( TEST.ipsecsiteconnections.add(
vpn.IPSecSiteConnection(ipsecsiteconnection_dict)) vpn.IPsecSiteConnection(ipsecsiteconnection_dict))
# 2nd IPSecSiteConnection # 2nd IPsec site connection
ipsecsiteconnection_dict = {'id': 'dd1dd3a0-f349-49be-b013-245e147763d7', ipsecsiteconnection_dict = {'id': 'dd1dd3a0-f349-49be-b013-245e147763d7',
'tenant_id': '1', 'tenant_id': '1',
'name': 'ipsec_connection_2', 'name': 'ipsec_connection_2',
@ -183,4 +183,4 @@ def data(TEST):
'status': 'Active'} 'status': 'Active'}
TEST.api_ipsecsiteconnections.add(ipsecsiteconnection_dict) TEST.api_ipsecsiteconnections.add(ipsecsiteconnection_dict)
TEST.ipsecsiteconnections.add( TEST.ipsecsiteconnections.add(
vpn.IPSecSiteConnection(ipsecsiteconnection_dict)) vpn.IPsecSiteConnection(ipsecsiteconnection_dict))