1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """
17 Resource class and its manager for VPN IPSec policies in Networking V2 API
18 """
19
20 from yakumo import base
21 from yakumo.constant import UNDEF
22 from yakumo import mapper
23 from yakumo import utils
24
25
26 ATTRIBUTE_MAPPING = [
27 ('id', 'id', mapper.Noop),
28 ('name', 'name', mapper.Noop),
29 ('description', 'description', mapper.Noop),
30 ('auth_algorithm', 'auth_algorithm', mapper.Noop),
31 ('encryption_algorithm', 'encryption_algorithm', mapper.Noop),
32 ('pfs', 'pfs', mapper.Noop),
33 ('lifetime', 'lifetime', mapper.Noop),
34 ('encapsulation_mode', 'encapsulation_mode', mapper.Noop),
35 ('transform_protocol', 'transform_protocol', mapper.Noop),
36 ('project', 'tenant_id', mapper.Resource('project')),
37 ]
38
39
41 """Resource class for VPN IPSec policies in Networking V2 API"""
42
47 """
48 Update properties of an IPSec policy
49
50 @keyword name: IPSec policy name
51 @type name: str
52 @keyword description: Description
53 @type description: str
54 @keyword auth_algorithm: Auth algorithm; only 'sha1'
55 @type auth_algorithm: str
56 @keyword encryption_algorithm: Encryption algorithm
57 ('3des', 'aes-128', 'aes-192', ...)
58 @type encryption_algorithm: str
59 @keyword pfs: Perfect forward secrecy
60 ('Group2', 'Group5', 'Group14', ...)
61 @type pfs: str
62 @keyword encapsulation_mode: Encapsulation mode
63 'tunnel' or 'transport'
64 @type encapsulation_mode: str
65 @keyword lifetime: Life time; e.q.'3600seconds'
66 @type lifetime: str
67 @keyword transform_protocol: Transform protocol
68 'ESP', 'AH', or 'AH-ESP'
69 @type transform_protocol: str
70 @keyword project: Project object
71 @type project: yakumo.project.Resource
72 @rtype: None
73 """
74 super(Resource, self).update(
75 name=name,
76 description=description,
77 auth_algorithm=auth_algorithm,
78 encryption_algorithm=encryption_algorithm,
79 pfs=pfs,
80 phase1_negotiation_mode=phase1_negotiation_mode,
81 lifetime=lifetime,
82 ike_version=ike_version,
83 project=project)
84
85
87 """Manager class for VPN IPSec policies in Networking V2 API"""
88
89 resource_class = Resource
90 service_type = 'network'
91 _attr_mapping = ATTRIBUTE_MAPPING
92 _json_resource_key = 'ike_policy'
93 _json_resources_key = 'ike_policies'
94 _url_resource_path = '/v2.0/vpn/ike_policies'
95
100 """
101 Create an IPSec policy
102
103 @keyword name: IPSec policy name
104 @type name: str
105 @keyword description: Description
106 @type description: str
107 @keyword auth_algorithm: Auth algorithm; only 'sha1'
108 @type auth_algorithm: str
109 @keyword encryption_algorithm: Encryption algorithm
110 ('3des', 'aes-128', 'aes-192', ...)
111 @type encryption_algorithm: str
112 @keyword pfs: Perfect forward secrecy
113 ('Group2', 'Group5', 'Group14', ...)
114 @type pfs: str
115 @keyword encapsulation_mode: Encapsulation mode
116 'tunnel' or 'transport'
117 @type encapsulation_mode: str
118 @keyword lifetime: Life time; e.q.'3600seconds'
119 @type lifetime: str
120 @keyword transform_protocol: Transform protocol
121 'ESP', 'AH', or 'AH-ESP'
122 @type transform_protocol: str
123 @keyword project: Project object
124 @type project: yakumo.project.Resource
125 @return: Created policy
126 @rtype: yakumo.neutron.v2.vpn.ipsec_policy.Resource
127 """
128 return super(Manager, self).create(
129 name=name,
130 description=description,
131 auth_algorithm=auth_algorithm,
132 encryption_algorithm=encryption_algorithm,
133 pfs=pfs,
134 phase1_negotiation_mode=phase1_negotiation_mode,
135 lifetime=lifetime,
136 ike_version=ike_version,
137 project=project)
138