/
vpn_model.py
109 lines (85 loc) · 3.29 KB
/
vpn_model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# -*- coding: utf-8 -*-
"""
This module provide billing information and IkeConfig and IPSec
"""
class Billing(object):
"""
billing information
"""
def __init__(self, payment_timing=None, billing_method=None, reservation_length=None,
reservation_time_unit=None):
"""
:type payment_timing: string
:param payment_timing: 'Prepaid' 'Postpaid'
:type billing_method: string
:param billing_method: 'ByTraffic' 'ByBandwidt'
:type reservation_length: int
:param reservation_length: purchase length
:type reservation_time_unit: string
:param reservation_time_unit: time unit of purchasing,currently only supports monthly
"""
self.payment_timing = payment_timing
self.billing_method = billing_method
self.reservation_length = reservation_length or 1
self.reservation_time_unit = reservation_time_unit or 'Month'
class IkeConfig(object):
"""
IKE Configuration example
"""
def __init__(self, ike_version=None, ike_mode=None, ike_enc_alg=None, ike_auth_alg=None, ike_pfs=None,
ike_lifeTime=None):
"""
:type ike_version: string
:param ike_version: Version, value range :v1/v2
:type ike_mode: string
:param ike_mode: Negotiation mode, value range :main/aggressive
:type ike_enc_alg: string
:param ike_enc_alg: Encryption algorithm, value range :aes/aes192/aes256/3des
:type ike_auth_alg: string
:param ike_auth_alg: Authentication algorithm, value range :sha1/md5
:type ike_pfs: string
:param ike_pfs: DH Grouping, value range :group2/group5/group14/group24
:type ike_lifeTime: string
:param ike_lifeTime: SA Life cycle, value range :60-86400
"""
self.ike_version = ike_version
self.ike_mode = ike_mode
self.ike_enc_alg = ike_enc_alg
self.ike_auth_alg = ike_auth_alg
self.ike_pfs = ike_pfs
self.ike_lifeTime = ike_lifeTime
class IpsecConfig(object):
"""
IPSec Configuration example
"""
def __init__(self, ipsec_enc_alg=None, ipsec_auth_alg=None, ipsec_pfs=None, ipsec_lifetime=None):
"""
:type ipsec_enc_alg: string
:param ipsec_enc_alg: Encryption algorithm, value range :aes/aes192/aes256/3des
:type ipsec_auth_alg: string
:param ipsec_auth_alg: Authentication algorithm, value range :sha1/md5
:type ipsec_pfs: string
:param ipsec_pfs: group2/group5/group14/group24
:type ipsec_lifetime: string
:param ipsec_lifetime: SA Life cycle, value range :180-86400
"""
self.ipsec_enc_alg = ipsec_enc_alg
self.ipsec_auth_alg = ipsec_auth_alg
self.ipsec_pfs = ipsec_pfs
self.ipsec_lifetime = ipsec_lifetime
class SSLUser(object):
"""
ssl user example
"""
def __init__(self, user_name=None, password=None, description=None):
"""
:type user_name: string
:param user_name: user_name
:type password: string
:param password: password
:type description: string
:param description: description
"""
self.user_name = user_name
self.password = password
self.description = description