vpn_model.py 3.3 KB

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