1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """
17 Resource class and its manager for VPN services 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 ('router', 'router_id', mapper.Resource('neutron.router')),
31 ('subnet', 'subnet_id', mapper.Resource('neutron.subnet')),
32 ('project', 'tenant_id', mapper.Resource('project')),
33 ('is_enabled', 'admin_state_up', mapper.Noop),
34 ('status', 'status', mapper.Noop),
35 ]
36
37
39 """Resource class for VPN services in Networking V2 API"""
40
43 """
44 Update properties of a VPN service
45
46 @keyword name: VPN service name
47 @type name: str
48 @keyword description: Description
49 @type description: str
50 @keyword is_enabled: Is vpn enabled
51 @type is_enabled: bool
52 @rtype: None
53 """
54 super(Resource, self).update(
55 name=name,
56 description=description,
57 is_enabled=is_enabled)
58
59
61 """Manager class for VPN services in Networking V2 API"""
62
63 resource_class = Resource
64 service_type = 'network'
65 _attr_mapping = ATTRIBUTE_MAPPING
66 _json_resource_key = 'vpnservice'
67 _json_resources_key = 'vpnservices'
68 _url_resource_path = '/v2.0/vpn/vpnservices'
69
72 """
73 Create a VPN service
74
75 @keyword name: VPN name
76 @type name: str
77 @keyword description: Description
78 @type description: str
79 @keyword router: Router object
80 @type router: yakumo.neutron.v2.router.Resource
81 @keyword subnet: Subnet object
82 @type subnet: yakumo.neutron.v2.subnet.Resource
83 @keyword project: Project object
84 @type project: yakumo.project.Resource
85 @keyword is_enabled: Whether the VPN service is enabled
86 @type is_enabled: bool
87 @return: Created VPN service
88 @rtype: yakumo.neutron.v2.vpn.service.Resource
89 """
90 return super(Manager, self).create(
91 name=name,
92 description=description,
93 router=router,
94 subnet=subnet,
95 project=project,
96 is_enabled=is_enabled)
97