1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """
17 Resource class and its manager for VPN IKE 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 ('phase1_negotiation_mode', 'phase1_negotiation_mode', mapper.Noop),
34 ('lifetime', 'lifetime', mapper.Noop),
35 ('ike_version', 'ike_version', mapper.Noop),
36 ('project', 'tenant_id', mapper.Resource('project')),
37 ]
38
39
41 """Resource class for VPN IKE policies in Networking V2 API"""
42
47 """
48 Update an IKE policy
49
50 @keyword name: IKE 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 phase1_negotiation_mode: IKE mode; only 'main'
63 @type phase1_negotiation_mode: str
64 @keyword lifetime: Life time; e.q.'3600seconds'
65 @type lifetime: str
66 @keyword ike_version: IKE version; 'v1' or 'v2'
67 @type ike_version: str
68 @keyword project: Project
69 @type project: yakumo.project.Resource
70 @rtype: None
71 """
72 super(Resource, self).update(
73 name=name,
74 description=description,
75 auth_algorithm=auth_algorithm,
76 encryption_algorithm=encryption_algorithm,
77 pfs=pfs,
78 phase1_negotiation_mode=phase1_negotiation_mode,
79 lifetime=lifetime,
80 ike_version=ike_version,
81 project=project)
82
83
85 """Manager class for VPN IKE policies in Networking V2 API"""
86
87 resource_class = Resource
88 service_type = 'network'
89 _attr_mapping = ATTRIBUTE_MAPPING
90 _json_resource_key = 'ike_policy'
91 _json_resources_key = 'ike_policies'
92 _url_resource_path = '/v2.0/vpn/ike_policies'
93
98 """
99 Create an IKE policy
100
101 @keyword name: IKE policy name
102 @type name: str
103 @keyword description: Description
104 @type description: str
105 @keyword auth_algorithm: Auth algorithm; only 'sha1'
106 @type auth_algorithm: str
107 @keyword encryption_algorithm: Encryption algorithm
108 ('3des', 'aes-128', 'aes-192', ...)
109 @type encryption_algorithm: str
110 @keyword pfs: Perfect forward secrecy
111 ('Group2', 'Group5', 'Group14', ...)
112 @type pfs: str
113 @keyword phase1_negotiation_mode: IKE mode; only 'main'
114 @type phase1_negotiation_mode: str
115 @keyword lifetime: Life time; e.q.'3600seconds'
116 @type lifetime: str
117 @keyword ike_version: IKE version; 'v1' or 'v2'
118 @type ike_version: str
119 @keyword project: Project object
120 @type project: yakumo.project.Resource
121 @return: Created policy
122 @rtype: yakumo.neutron.v2.vpn.ike_policy.Resource
123 """
124 return super(Manager, self).create(
125 name=name,
126 description=description,
127 auth_algorithm=auth_algorithm,
128 encryption_algorithm=encryption_algorithm,
129 pfs=pfs,
130 phase1_negotiation_mode=phase1_negotiation_mode,
131 lifetime=lifetime,
132 ike_version=ike_version,
133 project=project)
134