imperituroard 1.1.23 → 1.1.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df0315f95d36982cd1cf6ad9ac5925220a3e59b3
4
- data.tar.gz: 62923d40fde4cfa7ec258081b889d092caf97993
3
+ metadata.gz: b9721c57d17add5eafa89b7c993e697f2a44656d
4
+ data.tar.gz: ee1014240665ab3334aedeed49099aa9d4b59912
5
5
  SHA512:
6
- metadata.gz: 961910f9feb82ef16f3bd8e14336cf60f763f367235f0671fc7d45650e53ce888e947b95cd7b2c5e3cc7d183da60a084dab10d7638d17746dcbafe19b782efdc
7
- data.tar.gz: da42b0f9d31a6bf7378c0ee37051571fb21d8f9cc9c7f80a3a2f72468fb78f93a04b32019489830f09f0c81e7f2f3a7ca9c2f5bb73df9d37282e1a5c83fd7669
6
+ metadata.gz: 581c10b16b6d3e219883cb0e93666a4172b9317b17330784d0992d462e16791289418d451f195f0a47d884e564c29655835fb9fe28b8c1e42a265674e4c37c17
7
+ data.tar.gz: 0532e7f7aa4a0e23a0188c167035279d1c3d1023359486d60b9940db0038d55452b673db8cede102d879d4dfebbe62a21cf5cfd314089ad74ee83c36934b68ef
@@ -0,0 +1,64 @@
1
+
2
+
3
+ module AdditionalImperituroard
4
+
5
+ def self.stat_parse_ip_num(ipnum)
6
+ #translated prefix from ip address number
7
+ prefixmask=0
8
+
9
+ #translation from ip addresses number to prefix
10
+ if ipnum == 1
11
+ prefixmask=32
12
+ elsif ipnum == 2
13
+ prefixmask = 31
14
+ elsif ipnum>2 && ipnum<=8
15
+ prefixmask=29
16
+ elsif ipnum>8 && ipnum<=16
17
+ prefixmask=28
18
+ elsif ipnum>16 && ipnum <=32
19
+ prefixmask=27
20
+ elsif ipnum>32 && ipnum <=64
21
+ prefixmask=26
22
+ elsif ipnum >64 && ipnum <=128
23
+ prefixmask=25
24
+ elsif ipnum >128 && ipnum <=256
25
+ prefixmask=24
26
+ elsif ipnum >256 && ipnum <=512
27
+ prefixmask=23
28
+ elsif ipnum >512 && ipnum <=1024
29
+ prefixmask=22
30
+ elsif ipnum >1024 && ipnum <=2048
31
+ prefixmask=21
32
+ elsif ipnum >2046 && ipnum <=4094
33
+ prefixmask=20
34
+ elsif ipnum >4094 && ipnum <=8190
35
+ prefixmask=19
36
+ elsif ipnum >8190 && ipnum <=16382
37
+ prefixmask=18
38
+ elsif ipnum >16382 && ipnum <=32766
39
+ prefixmask=17
40
+ elsif ipnum >32766 && ipnum <=65534
41
+ prefixmask=16
42
+ elsif ipnum >65534 && ipnum <=131070
43
+ prefixmask=15
44
+ elsif ipnum >131070 && ipnum <=262142
45
+ prefixmask=14
46
+ elsif ipnum >262142 && ipnum <=524286
47
+ prefixmask=13
48
+ elsif ipnum >524286 && ipnum <=1048574
49
+ prefixmask=12
50
+ elsif ipnum >1048574 && ipnum <=2097150
51
+ prefixmask=11
52
+ elsif ipnum >2097150 && ipnum <=4194302
53
+ prefixmask=10
54
+ elsif ipnum >4194302 && ipnum <=8388606
55
+ prefixmask=9
56
+ elsif ipnum >8388606 && ipnum <=16777214
57
+ prefixmask=8
58
+ end
59
+ ##
60
+
61
+ prefixmask
62
+
63
+ end
64
+ end
@@ -14,7 +14,7 @@ class LogAddFunctions_2
14
14
  end
15
15
 
16
16
  def printer_texter(text, log_level)
17
- if log_level == debug
17
+ if log_level == "debug"
18
18
  mess = {:datetime => datetimenow, :sdk => "imperituroard", :sdk_version => Imperituroard::VERSION, :message => text}
19
19
  p mess
20
20
  end
@@ -1,32 +1,64 @@
1
-
2
-
3
-
4
1
  class Telegram_2
5
2
 
6
- attr_accessor :telegram_api_url, :telegram_chat_id
3
+ attr_accessor :telegram_api_url, :telegram_chat_id, :telegram_log
7
4
 
8
- def initialize(telegram_api_url, telegram_chat_id)
5
+ def initialize(telegram_api_url, telegram_chat_id, telegram_log=1)
9
6
  @telegram_api_url = telegram_api_url
10
7
  @telegram_chat_id = telegram_chat_id
8
+ @telegram_log = telegram_log
11
9
  end
12
10
 
13
11
  #procedure for send log to telegram chat
14
12
  def telegram_message(message)
15
13
  begin
16
- uri = URI.parse(telegram_api_url)
17
- https_connector = Net::HTTP.new(uri.host, uri.port)
18
- https_connector.use_ssl = true
19
- data = {chat_id: telegram_chat_id, text: message}
20
- request_mess = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'})
21
- request_mess.body = data.to_json
22
- response_mess = https_connector.request(request_mess)
23
- body = response_mess.body
24
- return {:code => 200,
25
- :result => "Request completed successfully",
26
- :body => {:telegram_resp => JSON.parse(body.to_s),
27
- :description => "Telegram message to telegram_chat_id: #{telegram_chat_id.to_s}"}}
14
+ if telegram_log == 1
15
+ uri = URI.parse(telegram_api_url)
16
+ https_connector = Net::HTTP.new(uri.host, uri.port)
17
+ https_connector.use_ssl = true
18
+ data = {chat_id: telegram_chat_id, text: message}
19
+ request_mess = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'})
20
+ request_mess.body = data.to_json
21
+ response_mess = https_connector.request(request_mess)
22
+ body = response_mess.body
23
+ return {:code => 200,
24
+ :result => 'Request completed successfully',
25
+ :body => {:telegram_resp => JSON.parse(body.to_s),
26
+ :description => "Telegram message to telegram_chat_id: #{telegram_chat_id.to_s}"}}
27
+ else
28
+ return {:code => 404, :result => 'Notification disabled'}
29
+ end
30
+ rescue
31
+ return {:code => 507, :result => 'Unknown SDK error'}
32
+ end
33
+ end
34
+
35
+ #procedure for send log to telegram chat in separate thread
36
+ def telegram_message2(message)
37
+ begin
38
+ if telegram_log == 1
39
+ Thread.new do
40
+ begin
41
+ uri = URI.parse(telegram_api_url)
42
+ https_connector = Net::HTTP.new(uri.host, uri.port)
43
+ https_connector.use_ssl = true
44
+ data = {chat_id: telegram_chat_id, text: message}
45
+ request_mess = Net::HTTP::Post.new(uri.request_uri, {'Content-Type': 'application/json'})
46
+ request_mess.body = data.to_json
47
+ response_mess = https_connector.request(request_mess)
48
+ body = response_mess.body
49
+ return {:code => 200,
50
+ :result => 'Request completed successfully',
51
+ :body => {:telegram_resp => JSON.parse(body.to_s),
52
+ :description => "Telegram message to telegram_chat_id: #{telegram_chat_id.to_s}"}}
53
+ rescue
54
+ return {:code => 508, :result => 'Unknown SDK error'}
55
+ end
56
+ end
57
+ else
58
+ return {:code => 404, :result => 'Notification disabled'}
59
+ end
28
60
  rescue
29
- return {:code => 507, :result => "Unknown SDK error"}
61
+ return {:code => 507, :result => 'Unknown SDK error'}
30
62
  end
31
63
  end
32
64
 
@@ -6,7 +6,7 @@ class EzuevFun_2
6
6
 
7
7
  def vpn_create_client
8
8
  command = "/usr/bin/python3.6 /projects/vpn_test/methods/create_client.py '{\"unp\": \"\", \"company_name\": \"MinskTrans\", \"full_name\":\"MinskTransTest\", \"info\": \"NewYork\", \"profile\": \"IoT\", \"net_type\": \"static\", \"number_sims\": 1024, \"msisdns\": [37529, 37528]}'"
9
- Net::SSH.start("172.24.157.24", "soapgw", :password => "3g8Yh2Sl7Vz9Nbd358") do |ssh|
9
+ Net::SSH.start(Imperituroard::AUTOVPN_SERVER_IP, Imperituroard::AUTOVPN_SERVER_USERNAME, :password => "3g8Yh2Sl7Vz9Nbd358") do |ssh|
10
10
  result = ssh.exec!(command)
11
11
  p result
12
12
  end
@@ -14,7 +14,7 @@ class EzuevFun_2
14
14
 
15
15
  def vpn_update_client
16
16
  command = "/usr/bin/python3.6 /projects/vpn_test/methods/update_client.py '{\"unp\": \"\", \"old_company_name\": \"MinskTrans\", \"new_company_name\": \"MinskTrans1\", \"new_full_name\": \"MinskTransTest1\", \"new_address\": \"NewYork\", \"new_contact_name\": \"1\", \"new_contact_number\": \"1\"}'"
17
- Net::SSH.start("172.24.157.24", "soapgw", :password => "3g8Yh2Sl7Vz9Nbd358") do |ssh|
17
+ Net::SSH.start(Imperituroard::AUTOVPN_SERVER_IP, Imperituroard::AUTOVPN_SERVER_USERNAME, :password => '3g8Yh2Sl7Vz9Nbd358') do |ssh|
18
18
  result = ssh.exec!(command)
19
19
  p result
20
20
  end
@@ -11,12 +11,12 @@ class MongoVpn
11
11
 
12
12
  attr_accessor :mongo_vpn_ip, :mongo_vpn_port, :client_vpn, :mongo_vpn_database, :internal_vpn_func, :logger_any
13
13
 
14
- def initialize(mongo_vpn_ip, mongo_vpn_port, mongo_vpn_database)
15
- @mongo_vpn_database = mongo_vpn_database
16
- @mongo_vpn_ip = mongo_vpn_ip
17
- @mongo_vpn_port = mongo_vpn_port
18
- client_vpn_host = [mongo_vpn_ip + ":" + mongo_vpn_port]
19
- @client_vpn = Mongo::Client.new(client_vpn_host, :database => mongo_vpn_database)
14
+ def initialize
15
+ @mongo_vpn_database = Imperituroard::AUTOVPN_MONGO_VPN_DATABASE
16
+ @mongo_vpn_ip = Imperituroard::AUTOVPN_MONGO_IP
17
+ @mongo_vpn_port = Imperituroard::AUTOVPN_MONGO_VPN_PORT
18
+ client_vpn_host = [mongo_vpn_ip + ':' + @mongo_vpn_port]
19
+ @client_vpn = Mongo::Client.new(client_vpn_host, :database => @mongo_vpn_database)
20
20
  @logger_any = LogAddFunctions_2.new
21
21
  end
22
22
 
@@ -25,30 +25,80 @@ class MongoVpn
25
25
  out_resp = {}
26
26
  begin
27
27
  msisdn_data = []
28
- collection = client_vpn[:msisdn_list]
29
- collection.find({:msisdn => msisdn.to_s}).each {|row|
28
+ collection = client_vpn[:sdp_msisdn_list]
29
+ collection.find({'msisdn': msisdn.to_s}).each {|row|
30
30
  msisdn_data = row
31
31
  }
32
- if msisdn_data != [] && msisdn_data["msisdn"] != nil && msisdn_data["msisdn"] != ""
33
- if msisdn_data["group_id"] != [] && msisdn_data["group_id"] != nil && msisdn_data["group_id"] != ""
34
- if msisdn_data["profile_id"] != [] && msisdn_data["profile_id"] != nil && msisdn_data["profile_id"] != ""
35
- out_resp = {:code => 200, :result => "get_mongo_msisdn: Request completed successfully", :body => msisdn_data}
32
+ if msisdn_data != [] && msisdn_data['msisdn'] != nil && msisdn_data['msisdn'] != ''
33
+ if msisdn_data['group_id'] != [] && msisdn_data['group_id'] != nil && msisdn_data['group_id'] != ''
34
+ if msisdn_data['profile_id'] != [] && msisdn_data['profile_id'] != nil && msisdn_data['profile_id'] != ''
35
+ out_resp = {:code => 200, :result => 'get_mongo_msisdn: Request completed successfully', :body => msisdn_data}
36
36
  else
37
- out_resp = {:code => 406, :result => "get_mongo_msisdn: invalid data. profile_id not found"}
37
+ out_resp = {:code => 406, :result => 'get_mongo_msisdn: invalid data. profile_id not found'}
38
38
  end
39
39
  else
40
- out_resp = {:code => 405, :result => "get_mongo_msisdn: invalid data. organization_id not found"}
40
+ out_resp = {:code => 405, :result => 'get_mongo_msisdn: invalid data. organization_id not found'}
41
41
  end
42
42
  else
43
- out_resp = {:code => 404, :result => "get_mongo_msisdn: login not found in database"}
43
+ out_resp = {:code => 404, :result => 'get_mongo_msisdn: login not found in database'}
44
44
  end
45
45
  rescue
46
- out_resp = {:code => 507, :result => "get_mongo_msisdn: Unknown SDK error"}
46
+ out_resp = {:code => 507, :result => 'get_mongo_msisdn: Unknown SDK error'}
47
47
  end
48
- logger_any.printer_texter(out_resp, "debug")
48
+ logger_any.printer_texter(out_resp, 'debug')
49
49
  out_resp
50
50
  end
51
51
 
52
+ def get_mongo_organization_id(id)
53
+ out_resp = {}
54
+ begin
55
+ mongo_data = []
56
+ collection = client_vpn[:attr_organizations]
57
+ collection.find({'organization_id': id.to_s}).each {|row|
58
+ mongo_data = row
59
+ }
60
+ if mongo_data != [] && mongo_data['organization_id'] != nil && mongo_data['organization_id'] != ''
61
+ if mongo_data['customer_id'] != [] && mongo_data['customer_id'] != nil && mongo_data['customer_id'] != ''
62
+ out_resp = {:code => 200, :result => 'get_mongo_organization_id: Request completed successfully', :body => mongo_data}
63
+ else
64
+ out_resp = {:code => 405, :result => 'get_mongo_organization_id: invalid data. customer_id not found'}
65
+ end
66
+ else
67
+ out_resp = {:code => 404, :result => 'get_mongo_organization_id: organization_id not found in database'}
68
+ end
69
+ rescue
70
+ out_resp = {:code => 507, :result => 'get_mongo_organization_id: Unknown SDK error'}
71
+ end
72
+ logger_any.printer_texter(out_resp, 'debug')
73
+ out_resp
74
+ end
75
+
76
+
77
+ def get_mongo_profile_id(id)
78
+ out_resp = {}
79
+ begin
80
+ mongo_data = []
81
+ collection = client_vpn[:attr_profiles]
82
+ collection.find({'profile_id': id.to_s}).each {|row|
83
+ mongo_data = row
84
+ }
85
+ if mongo_data != [] && mongo_data['profile_id'] != nil && mongo_data['profile_id'] != ''
86
+ if mongo_data['attribute_list'] != [] && mongo_data['attribute_list'] != nil && mongo_data['attribute_list'] != ''
87
+ out_resp = {:code => 200, :result => 'get_mongo_profile_id: Request completed successfully', :body => mongo_data}
88
+ else
89
+ out_resp = {:code => 405, :result => 'get_mongo_profile_id: invalid data. customer_id not found'}
90
+ end
91
+ else
92
+ out_resp = {:code => 404, :result => 'get_mongo_profile_id: organization_id not found in database'}
93
+ end
94
+ rescue
95
+ out_resp = {:code => 507, :result => 'get_mongo_profile_id: Unknown SDK error'}
96
+ end
97
+ logger_any.printer_texter(out_resp, 'debug')
98
+ out_resp
99
+ end
100
+
101
+
52
102
 
53
103
 
54
104
  end
@@ -1,27 +1,19 @@
1
1
  require 'imperituroard/projects/autovpn/mongo_vpn'
2
2
 
3
- class Autovpn
3
+ class AutovpnClass
4
4
 
5
5
  attr_accessor :mongo_client
6
6
 
7
- def initialize(mongo_vpn_ip, mongo_vpn_port, mongo_vpn_database)
8
- @mongo_client = MongoVpn.new(mongo_vpn_ip, mongo_vpn_port, mongo_vpn_database)
7
+ def initialize
8
+ @mongo_client = MongoVpn.new
9
9
  end
10
10
 
11
11
  def vpn_add_msisdn_by_example_2(new_msisdn, example_msisdn)
12
12
 
13
13
  end
14
14
 
15
- def test
16
- mongo_client.get_mongo_msisdn("375298766719")
15
+ def get_attr_by_example_msisdn(example_msisdn)
16
+ mongo_client.get_mongo_msisdn(example_msisdn)
17
17
  end
18
18
 
19
19
  end
20
-
21
-
22
- vvv = Autovpn.new("172.24.210.177",
23
- "27017",
24
- "autovpn"
25
- )
26
-
27
- vvv.test
@@ -69,7 +69,10 @@ class Dabrab
69
69
  rescue
70
70
  nil
71
71
  end
72
- text = text.gsub(/\s+$/, '').gsub(/\n$/, '')
72
+
73
+ #corrected text rewrite for arutskiy. commented 20210921
74
+ #we don't need do any text changes
75
+ #text = text.gsub(/\s+$/, '').gsub(/\n$/, '')
73
76
 
74
77
 
75
78
  if button_url != "" && button_text != "" && image != "" #111
@@ -0,0 +1,747 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ require 'imperituroard/projects/static/phpipamforcps'
4
+ require 'imperituroard/platforms/public/telegram'
5
+ require 'imperituroard/add_functions/add/additional'
6
+
7
+
8
+ class StaticImperituroard
9
+
10
+
11
+ attr_accessor :telegram, :cps_ipam_connector
12
+
13
+ def initialize(telegram_api_url,
14
+ telegram_chat_id,
15
+ telegram_log)
16
+ @telegram = Telegram_2.new(telegram_api_url, telegram_chat_id, telegram_log)
17
+ @cps_ipam_connector = PHPipamcps.new
18
+
19
+ end
20
+
21
+
22
+
23
+ #mts_1_add_new_address
24
+ def mts_add_new_addr
25
+
26
+ begin
27
+
28
+ prefix = 'not implemented'
29
+
30
+ #request id generation for logging
31
+ o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten
32
+ request_id = (0...50).map {o[rand(o.length)]}.join
33
+
34
+ #logging before processing
35
+ mess1 = "input Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure with such parameter as: type of service: #{params[:type]}, MSISDN: #{params[:msisdn]}, region: #{params[:region]}, description: #{params[:description]}, note: #{params[:note]}, ipcount: #{params[:ipcount].to_s}, ipversion: #{params[:ipversion].to_s} "
36
+ logger.info mess1
37
+ telegram.telegram_message2(mess1)
38
+
39
+ #checking if msisdn exist in database
40
+ begin
41
+ dfd = DatabaseMethods2.new
42
+ che = dfd.phpipam_get_address(params[:msisdn])
43
+
44
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and processed from database: #{che}"
45
+ logger.info mess
46
+
47
+
48
+ telegram.telegram_message2(mess)
49
+
50
+ rescue
51
+
52
+ mess = "Request ID: error. cant get address from database, Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and processed from database: #{che}"
53
+ logger.info mess
54
+
55
+ telegram.telegram_message2(mess)
56
+
57
+ end
58
+
59
+ # if che=1 - address not exist in database
60
+ if che=='1'
61
+
62
+ #type of subscriber
63
+ #type - tip abonenta (0 - obychnyj abonent fizicheskoe lico, 1 - government, 2 - ord, 3 - government ord filter)
64
+ type = params[:type]
65
+
66
+ #subscribers msisdn
67
+ msisdn = params[:msisdn]
68
+
69
+ #region Minsk, Brest, Gomel etc.
70
+ region = params[:region]
71
+
72
+ #old parameter. not need now
73
+ iptype = "ip"
74
+
75
+ #description - lyuboj tekst. predlagaetsya zdes ukazyvat adres abonenta
76
+ description = params[:description]
77
+
78
+ #note - vtoroj deskripshn. tozhe lyuboj tekst pri neobxodimosti
79
+ note = params[:note]
80
+
81
+ prefixmask = AdditionalImperituroard::stat_parse_ip_num(params[:ipcount])
82
+
83
+ #adding ip address to phpipam
84
+ #first iteration. If one ip address
85
+
86
+
87
+ #ip address inserting to phpipam procedure
88
+ begin
89
+ php = PHPipam.new
90
+ respo = php.insertip("FTTx", iptype, region, prefixmask, description, note, msisdn, params[:type], params[:ipcount].to_s, params[:ipversion].to_s)
91
+ #parse = respo.split("---")
92
+ p respo
93
+ addr = respo[:address]
94
+ mask = respo[:netmask]
95
+ gateway = respo[:gateway]
96
+
97
+ if addr!="unknown" && mask!="unknown" && gateway!="unknown"
98
+ output = {:answercode => "200", :message => "Request completed successfully", :stataddress => addr, :network => mask, :gateway => gateway, :prefix => prefix}
99
+ else
100
+ mess = "Output error. Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output errorMethod, No available addresses."
101
+ logger.info mess
102
+
103
+ telegram.telegram_message2(mess)
104
+
105
+ raise SOAPError, "ERROR. No available addresses."
106
+ end
107
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and recieved #{output.to_s} response"
108
+ logger.info mess
109
+
110
+ telegram.telegram_message2(mess)
111
+
112
+ rescue
113
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output errorMethod, Cant get ip address from phpipam. "
114
+ logger.info mess
115
+
116
+ telegram.telegram_message2(mess)
117
+ raise SOAPError, "ERROR. Request ID: '#{request_id}' Cant get ip address from phpipam."
118
+ end
119
+
120
+
121
+ p prefixmask
122
+ begin
123
+ if prefixmask<32
124
+ p "stata"
125
+ php1 = PHPipam.new
126
+ rere = php1.ins_prefix_ip("prefix", region, msisdn, prefixmask, note, description, php1.gettoken)
127
+
128
+ prefix = rere[:prefix]
129
+ output[:prefix] = prefix
130
+
131
+ cpsxxx = PHPipamcps.new
132
+ resppp = cpsxxx.add_attribute_prefix(msisdn, rere[:prefix])
133
+ if resppp=="0"
134
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output: #{output.to_s}"
135
+ logger.info mess
136
+
137
+ telegram.telegram_message2(mess)
138
+ else
139
+
140
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output cant insert address to CPS."
141
+ logger.info mess
142
+
143
+ telegram.telegram_message2(mess)
144
+ raise SOAPError, "ERROR. cant insert address to CPS."
145
+ end
146
+
147
+ elsif prefixmask==32
148
+
149
+ else
150
+ raise SOAPError, "ERROR. Unknown parameter."
151
+ end
152
+
153
+ rescue
154
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output errorMethod, Cant insert prefix framed route into CPS. "
155
+ logger.info mess
156
+
157
+ telegram.telegram_message2(mess)
158
+
159
+ raise SOAPError, "ERROR. Request ID: '#{request_id}' Cant insert prefix into CPS."
160
+ end
161
+
162
+ #inserting address to cps
163
+ begin
164
+ if params[:type]=="0"
165
+ cpsxxx = PHPipamcps.new
166
+ p resppp = cpsxxx.add_attribute(msisdn, addr, mask, gateway)
167
+ if resppp=="0"
168
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output: #{output.to_s}"
169
+ logger.info mess
170
+ telegram.telegram_message2(mess)
171
+
172
+ begin
173
+ cps_ipam_connector.stop_session(params[:msisdn])
174
+ rescue
175
+ p "f"
176
+ end
177
+
178
+ render :soap => output
179
+ else
180
+
181
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output cant insert address to CPS."
182
+ logger.info mess
183
+
184
+ telegram.telegram_message2(mess)
185
+
186
+ raise SOAPError, "ERROR. cant insert address to CPS."
187
+ end
188
+
189
+ elsif params[:type]=="1"
190
+ cpsxxx = PHPipamcps.new
191
+ resppp = cpsxxx.add_attribute1(msisdn, addr, mask, gateway)
192
+ p resppp
193
+ if resppp.to_s=="0"
194
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output: #{output.to_s}"
195
+ logger.info mess
196
+ p "p1"
197
+
198
+ telegram.telegram_message2(mess)
199
+
200
+ p "p2"
201
+
202
+ begin
203
+ cps_ipam_connector.stop_session(params[:msisdn])
204
+ rescue
205
+ p "f"
206
+ end
207
+
208
+ render :soap => output
209
+ else
210
+
211
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output cant insert address to CPS."
212
+ logger.info mess
213
+
214
+ telegram.telegram_message2(mess)
215
+ p "Errrrr"
216
+ raise SOAPError, "ERROR. cant insert address to CPS."
217
+ end
218
+
219
+ elsif params[:type]=="2"
220
+ cpsxxx = PHPipamcps.new
221
+ p resppp = cpsxxx.add_attribute2(msisdn, addr, mask, gateway)
222
+ if resppp=="0"
223
+
224
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output: #{output.to_s}"
225
+ logger.info mess
226
+
227
+ telegram.telegram_message2(mess)
228
+
229
+ begin
230
+ cps_ipam_connector.stop_session(params[:msisdn])
231
+ rescue
232
+ p "f"
233
+ end
234
+
235
+
236
+ render :soap => output
237
+ else
238
+
239
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output cant insert address to CPS."
240
+ logger.info mess
241
+
242
+ telegram.telegram_message2(mess)
243
+ p "Errrrr1"
244
+ raise SOAPError, "ERROR. cant insert address to CPS."
245
+ end
246
+
247
+ elsif params[:type]=="3"
248
+ cpsxxx = PHPipamcps.new
249
+ p resppp = cpsxxx.add_attribute3(msisdn, addr, mask, gateway)
250
+ if resppp=="0"
251
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output: #{output.to_s}"
252
+ logger.info mess
253
+
254
+ telegram.telegram_message2(mess)
255
+
256
+ begin
257
+ cps_ipam_connector.stop_session(params[:msisdn])
258
+ rescue
259
+ p "f"
260
+ end
261
+
262
+ render :soap => output
263
+ else
264
+
265
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output cant insert address to CPS."
266
+ logger.info mess
267
+
268
+ telegram.telegram_message2(mess)
269
+
270
+ p "Errrrr2"
271
+ raise SOAPError, "ERROR. cant insert address to CPS."
272
+ end
273
+ else
274
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output ERROR. Unknown parameter."
275
+ logger.info mess
276
+
277
+ telegram.telegram_message2(mess)
278
+ raise SOAPError, "ERROR. Unknown parameter."
279
+ end
280
+
281
+
282
+ rescue
283
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output cant insert address to CPS. Unknown error"
284
+
285
+ logger.info mess
286
+
287
+ telegram.telegram_message2(mess)
288
+
289
+ p "Errrrr5"
290
+ raise SOAPError, "ERROR. cant insert address to CPS. Unknown error"
291
+ end
292
+
293
+
294
+ else
295
+
296
+ #objavlenie peremennix
297
+ sended_ipaddress = che
298
+ prefix = ''
299
+ gateway = ''
300
+ subnet = ''
301
+ editdate = ''
302
+ hostname = ''
303
+ region = ''
304
+ broadcast = ''
305
+ netmask = ''
306
+ wildcardmask = ''
307
+ minhostip = ''
308
+ maxhostip = ''
309
+ numberofhosts = ''
310
+ sectionid = ''
311
+ description = ''
312
+ note = ''
313
+ code = ''
314
+ resp1 = ''
315
+
316
+ #get ip address from phpipam database
317
+ begin
318
+ php = PHPipam.new
319
+ p respo = php.getaddressinfo(sended_ipaddress)
320
+ if respo == '404'
321
+ resp1 = 'Address not found'
322
+ code = '404'
323
+ elsif respo == '500'
324
+ code = '500'
325
+ resp1 = 'Error'
326
+ else
327
+ para = respo.split("---")
328
+ prefix = para[0]
329
+ gateway = para[1]
330
+ subnet = para[2]
331
+ editdate = para[3]
332
+ hostname = para[4]
333
+ region = para[5]
334
+ broadcast = para[6]
335
+ netmask = para[7]
336
+ wildcardmask = para[8]
337
+ minhostip = para[9]
338
+ maxhostip = para[10]
339
+ numberofhosts = para[11]
340
+ sectionid = para[12]
341
+ description = para[13]
342
+ note = para[14]
343
+ resp1 = 'Request completed successfully'
344
+ code = '200'
345
+ end
346
+ output = {:answercode => '200', :message => 'Address already exists', :stataddress => sended_ipaddress, :network => netmask, :gateway => gateway}
347
+
348
+ begin
349
+ dfd = DatabaseMethods2.new
350
+ che = dfd.phpipam_get_address_pre(params[:msisdn])
351
+ if che=='1'
352
+ output[:prefix]= 'not implemented'
353
+ else
354
+ output[:prefix]=che
355
+ end
356
+ rescue
357
+
358
+ telegram.telegram_message2('ERROR. With getting prefix from database')
359
+
360
+
361
+
362
+
363
+ raise SOAPError, 'ERROR. With getting prefix from database'
364
+ end
365
+
366
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output: #{output.to_s}"
367
+ logger.info mess
368
+
369
+ telegram.telegram_message2(mess)
370
+
371
+ begin
372
+ cps_ipam_connector.stop_session(params[:msisdn])
373
+ rescue
374
+ p 'f'
375
+ end
376
+
377
+ render :soap => output
378
+ rescue
379
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output ERROR Unknown error. can't get ip address from phpipam API"
380
+ logger.info mess
381
+ telegram.telegram_message2(mess)
382
+ raise SOAPError, "ERROR. Unknown error. can't get ip address from phpipam API"
383
+ end
384
+ end
385
+ rescue
386
+ mess = "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_1_add_new_address procedure and output FATALITY ERROR"
387
+ logger.info mess
388
+ telegram.telegram_message2(mess)
389
+ raise SOAPError, 'ERROR. FATAL FATAL FATAL'
390
+ end
391
+ end
392
+
393
+
394
+ #mts_2_delete_address
395
+ def mts_2_delete_address
396
+
397
+ #formirovanie request ID
398
+ o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten
399
+ request_id = (0...50).map {o[rand(o.length)]}.join
400
+ mess = "HAproxy input Request ID: #{request_id}, RemoteIP: #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']}, requested mts_2_delete_address procedure with such parameter as msisdn: #{params[:msisdn]}"
401
+
402
+ logger.info mess
403
+ telegram.telegram_message2(mess)
404
+
405
+ begin
406
+
407
+ p '1'
408
+ #opredelenie adresa po msisdn
409
+ dfd = DatabaseMethods2.new
410
+ ipaddr = dfd.phpipam_get_address(params[:msisdn])
411
+
412
+ #udalenie addresa iz bazi phpipam
413
+ php = PHPipam.new
414
+ respo = php.deleteip(ipaddr)
415
+
416
+ p '2'
417
+ #udalenie podseti iz bazi phpipam
418
+ begin
419
+ php.deletesubnet(params[:msisdn])
420
+ rescue
421
+ p 'f'
422
+ end
423
+
424
+ code = ''
425
+ resp1 = ''
426
+ if respo == '200'
427
+ code = '200'
428
+ resp1 = 'Request completed successfully'
429
+ else
430
+ if respo == '404'
431
+ resp1 = 'Address not found'
432
+ code = '404'
433
+ else
434
+ code = '500'
435
+ resp1 = 'Error'
436
+ end
437
+ end
438
+
439
+ #udalenie atributa iz CPS
440
+ cpsxxx = PHPipamcps.new
441
+ cpsxxx.del_attribute(params[:msisdn])
442
+
443
+ #clear session
444
+ begin
445
+ cpsxxx11345 = PHPipamcps.new
446
+ cpsxxx11345.stop_session(params[:msisdn])
447
+ rescue
448
+ p 'f'
449
+ end
450
+
451
+ #formirovanie otveta
452
+ output = {:answercode => code, :message => resp1}
453
+ mess = "HAproxy output Request ID: #{request_id}, RemoteIP: #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']}, requested mts_2_delete_address procedure with such parameter as msisdn: #{params[:msisdn]} and recieved #{output} response"
454
+ logger.info mess
455
+ telegram.telegram_message2(mess)
456
+ render :soap => output
457
+
458
+ rescue
459
+ mess = "HAproxy output error Request ID: #{request_id}, RemoteIP: #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']}, requested mts_2_delete_address procedure with such parameter as msisdn: #{params[:msisdn]} and recieved ERROR. Something wrong. response"
460
+ logger.info mess
461
+ telegram.telegram_message2(mess)
462
+ raise SOAPError, 'ERROR. Something wrong.'
463
+ end
464
+
465
+ end
466
+
467
+ #mts_3_technical_reconnect
468
+ def mts_3_technical_reconnect
469
+
470
+ o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten
471
+ request_id = (0...50).map {o[rand(o.length)]}.join
472
+
473
+
474
+ output={}
475
+
476
+
477
+ begin
478
+
479
+
480
+ dfd = DatabaseMethods2.new
481
+ ipaddr = dfd.phpipam_get_address(params[:msisdn])
482
+
483
+ if ipaddr == '1'
484
+ raise SOAPError, 'ERROR. Address not found in phpipam.'
485
+ end
486
+
487
+ cpsxxx = PHPipamcps.new
488
+ cpsxxx.del_attribute(params[:msisdn])
489
+ begin
490
+
491
+ sended_ipaddress = ipaddr
492
+ prefix=""
493
+ gateway=""
494
+ subnet=""
495
+ editdate=""
496
+ hostname=""
497
+ region=""
498
+ broadcast=""
499
+ netmask=""
500
+ wildcardmask=""
501
+ minhostip=""
502
+ maxhostip=""
503
+ numberofhosts=""
504
+ sectionid=""
505
+ description=""
506
+ note=""
507
+ substype = ""
508
+ ipcount = ""
509
+ ipversion = ""
510
+
511
+ code =""
512
+ resp1 =""
513
+
514
+ php = PHPipam.new
515
+ respo = php.getaddressinfo2(sended_ipaddress)
516
+ p respo
517
+ if respo[:code] == '404'
518
+ resp1 = 'Address not found'
519
+ code = '404'
520
+ elsif respo[:code] == '500'
521
+ code = '500'
522
+ resp1 = 'Error'
523
+ else
524
+ #attributes from procedure getaddressinfo2 to procedure for adding avp to cps
525
+ gateway = respo[:gateway]
526
+ subnet = respo[:submask]
527
+ substype = respo[:substype],
528
+ ipcount = respo[:ipcount],
529
+ ipversion = respo[:ipversion]
530
+
531
+ resp1 = 'Request completed successfully'
532
+ code = '200'
533
+ end
534
+
535
+ cpsxxx1 = PHPipamcps.new
536
+
537
+ resppp = ""
538
+
539
+ p params[:msisdn]
540
+ p ipaddr
541
+ p subnet
542
+ p gateway
543
+ p substype
544
+
545
+ begin
546
+ if substype[0].to_i == 0
547
+ resppp = cpsxxx1.add_attribute(params[:msisdn], ipaddr, subnet, gateway)
548
+ elsif substype[0].to_i == 1
549
+ resppp = cpsxxx1.add_attribute1(params[:msisdn], ipaddr, subnet, gateway)
550
+ elsif substype[0].to_i == 2
551
+ resppp = cpsxxx1.add_attribute2(params[:msisdn], ipaddr, subnet, gateway)
552
+ elsif substype[0].to_i == 3
553
+ resppp = cpsxxx1.add_attribute3(params[:msisdn], ipaddr, subnet, gateway)
554
+ end
555
+ rescue
556
+ thr21 = Thread.new do
557
+ begin
558
+ telegram('ERROR. Something wrong with CPS.')
559
+ rescue
560
+ p 'f'
561
+ end
562
+ end
563
+
564
+ raise SOAPError, 'ERROR. Something wrong with CPS.'
565
+ end
566
+
567
+ p ipcount
568
+
569
+ p params[:msisdn]
570
+ if ipcount.to_i>1
571
+ p 'qwerty'
572
+ dfd2 = DatabaseMethods2.new
573
+ prrr = dfd2.phpipam_get_address_pre(params[:msisdn])
574
+ resppp = cpsxxx1.add_attribute_prefix(params[:msisdn], prrr)
575
+ end
576
+
577
+
578
+ code = ''
579
+ resp1 = ''
580
+ if resppp == '0'
581
+ code = '200'
582
+ resp1 = 'Request completed successfully'
583
+ else
584
+ if resppp == '404'
585
+ resp1 = 'Address not found'
586
+ code = '404'
587
+ else
588
+ code = '500'
589
+ resp1 = 'Error'
590
+ end
591
+ end
592
+ output = {:answercode => code, :message => resp1}
593
+
594
+ # if resppp=="0"
595
+ # logger.info "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Client']} requested mts_1_add_new_address procedure and output: #{output}"
596
+ #
597
+ # #render :soap => output
598
+ # else
599
+ #
600
+ # logger.info "Request ID: '#{request_id}' HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Client']} requested mts_1_add_new_address procedure and output cant insert address to CPS."
601
+ #
602
+ # raise SOAPError, "ERROR. cant insert address to CPS."
603
+ # end
604
+
605
+ rescue
606
+ raise SOAPError, 'ERROR. Something wrong.'
607
+ end
608
+
609
+ #cpsxxx = PHPipamcps.new
610
+ #resppp = cpsxxx.reconnect(params[:msisdn])
611
+
612
+
613
+ output = {:answercode => '200', :message => 'Request completed successfully'}
614
+
615
+ #output = {:answercode => "200", :message => "Request completed successfully"}
616
+
617
+ mess = "HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_3_technical_reconnect procedure with such parameter as: MSISDN: #{params[:msisdn]}, and recieved #{output} response"
618
+ logger.info mess
619
+ thr29 = Thread.new do
620
+ begin
621
+ telegram(mess)
622
+ rescue
623
+ p 'f'
624
+ end
625
+ end
626
+ render :soap => output
627
+ rescue
628
+ puts 'SOAP mts_3_technical_reconnect errorMethod'
629
+ mess = 'ERROR. Something wrong gen.'
630
+ logger.info mess
631
+ telegram.telegram_message2(mess)
632
+
633
+ raise SOAPError, 'ERROR. Something wrong gen.'
634
+ end
635
+
636
+
637
+ end
638
+
639
+ #mts_4_change_attr
640
+ def mts_4_change_attr
641
+
642
+
643
+ type = params[:type]
644
+ msisdn = params[:msisdn]
645
+ region = params[:region]
646
+ iptype = 'ip'
647
+ description = params[:description]
648
+ prefixlength = '32'
649
+ note = params[:note]
650
+ begin
651
+ php = PHPipam.new
652
+ substype = 'ip'
653
+ ipcount = '1'
654
+ ipversion = 'IPv4'
655
+ respo = php.insertip(type, iptype, region, prefixlength, description, note, msisdn, substype, ipcount, ipversion)
656
+ parse = respo.split('---')
657
+ addr = parse[0]
658
+ mask = parse[1]
659
+ gateway = parse[2]
660
+
661
+ if addr!='unknown' && mask!='unknown' && gateway!='unknown'
662
+ output = {:answercode => '200', :message => 'Request completed successfully', :stataddress => addr, :network => mask, :gateway => gateway}
663
+ else
664
+ output = {:answercode => '407', :message => 'No available address', :stataddress => '', :network => '', :gateway => ""}
665
+ end
666
+ logger.info "HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Client']} requested mts_4_change_attr procedure with such parameter as: type of service: #{params[:type]}, MSISDN: #{params[:msisdn]}, region: #{params[:region]}, description: #{params[:description]}, note: #{params[:note]} and recieved #{output} response"
667
+ render :soap => output
668
+ rescue
669
+ puts 'SOAP mts_4_change_attr errorMethod'
670
+ raise SOAPError, 'ERROR. Something wrong.'
671
+ end
672
+
673
+ end
674
+
675
+ #mts_5_save_avp
676
+ def mts_5_save_avp
677
+
678
+ o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten
679
+ request_id = (0...50).map {o[rand(o.length)]}.join
680
+
681
+
682
+ begin
683
+ cpsxx11 = PHPipamcps.new
684
+ cpsxx11.getavp_backup_tomongo(params[:msisdn])
685
+
686
+ mess12 = "HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_5_save_avp procedure with such parameter as: MSISDN: #{params[:msisdn]}, and processed success"
687
+ logger.info mess12
688
+ telegram.telegram_message2(mess12)
689
+
690
+ output = {:answercode => "200", :message => "Request completed successfully"}
691
+ render :soap => output
692
+
693
+ rescue
694
+ mess12 = "HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_5_save_avp procedure with such parameter as: MSISDN: #{params[:msisdn]}, and recieved ERROR. Failed to backup avp from CPS response"
695
+ logger.info mess12
696
+ telegram.telegram_message2(mess12)
697
+ raise SOAPError, 'ERROR. Failed to backup avp from CPS'
698
+ end
699
+
700
+ end
701
+
702
+ #mts_7_technical_reconnect
703
+ def mts_7_technical_reconnect
704
+
705
+ o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten
706
+ request_id = (0...50).map {o[rand(o.length)]}.join
707
+
708
+
709
+ begin
710
+ p 'dfs'
711
+ tee = PHPipamcps.new
712
+ t = Phpipam.new
713
+
714
+ p '0'
715
+ li = t.form_attr_list(params[:msisdn])
716
+ p li
717
+
718
+ p '1'
719
+ ans = ''
720
+ mess =''
721
+ if li != 'notfound'
722
+ ans = tee.return_backup_tomongo(params[:msisdn], li)
723
+ mess = 'Request completed successfully'
724
+ else
725
+ ans ='404'
726
+ mess = 'Not found backup'
727
+ end
728
+
729
+ rescue
730
+ mess12 = "HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_7_technical_reconnect procedure with such parameter as: MSISDN: #{params[:msisdn]}, and recieved ERROR. something wrong"
731
+ logger.info mess12
732
+ telegram.telegram_message2(mess12)
733
+
734
+ raise SOAPError, 'ERROR. mts_7_technical_reconnect something wrong'
735
+ end
736
+
737
+
738
+ output= {:answercode => ans, :message => mess}
739
+
740
+ mess12 = "HAproxy #{request.remote_ip}, request device real ip: #{request.headers['X-Forwarded-For']} requested mts_7_technical_reconnect procedure with such parameter as: MSISDN: #{params[:msisdn]}, and recieved SUCCESS #{output.to_s}"
741
+ logger.info mess12
742
+ telegram.telegram_message2(mess12)
743
+ render :soap => output
744
+ end
745
+
746
+
747
+ end
@@ -1,4 +1,4 @@
1
1
  module Imperituroard
2
- VERSION = '1.1.23'
2
+ VERSION = '1.1.24'
3
3
  end
4
4
 
data/lib/imperituroard.rb CHANGED
@@ -6,9 +6,10 @@ $LOAD_PATH.unshift File.expand_path("../platforms/cps", __dir__)
6
6
  $LOAD_PATH.unshift File.expand_path("../platforms/public", __dir__)
7
7
  $LOAD_PATH.unshift File.expand_path("../projects", __dir__)
8
8
  $LOAD_PATH.unshift File.expand_path("../projects/dns", __dir__)
9
-
9
+ $LOAD_PATH.unshift File.expand_path("../projects/autovpn", __dir__)
10
10
 
11
11
  require "imperituroard/version"
12
+ require "imperituroard/settings"
12
13
  require "imperituroard/projects/wttx/phpipamdb"
13
14
  require "imperituroard/projects/wttx/phpipamcps"
14
15
  require "imperituroard/projects/iot/mongoconnector"
@@ -26,6 +27,8 @@ require 'imperituroard/platforms/cps/qps_connector'
26
27
  require 'imperituroard/platforms/public/telegram'
27
28
  require 'imperituroard/projects/ukaz60'
28
29
  require 'imperituroard/projects/mhub/gms'
30
+ require 'imperituroard/projects/autovpn/mongo_vpn'
31
+ require 'imperituroard/projects/autovpn'
29
32
 
30
33
  require 'json'
31
34
  require 'ipaddr'
@@ -473,14 +476,19 @@ end
473
476
 
474
477
 
475
478
  class Autovpn
476
- attr_accessor :vpn_connector
479
+ attr_accessor :vpn_connector, :mongo_connector
477
480
 
478
- def initialize (mongo_vpn_ip, mongo_vpn_port, mongo_vpn_database)
479
- @vpn_connector = Autovpn.new(mongo_vpn_ip, mongo_vpn_port, mongo_vpn_database)
481
+ def initialize
482
+ @mongo_connector = MongoVpn.new
483
+ @vpn_connector = AutovpnClass.new
480
484
  end
481
485
 
482
486
  def vpn_add_msisdn_by_example(new_msisdn, example_msisdn)
483
487
  vpn_connector.vpn_add_msisdn_by_example_2(new_msisdn, example_msisdn)
484
488
  end
485
489
 
490
+ def vpn_test
491
+ vpn_connector.get_attr_by_example_msisdn("375297776403")
492
+ end
493
+
486
494
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imperituroard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.23
4
+ version: 1.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dzmitry Buynovskiy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-23 00:00:00.000000000 Z
11
+ date: 2021-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -205,6 +205,7 @@ files:
205
205
  - lib/.DS_Store
206
206
  - lib/imperituroard.rb
207
207
  - lib/imperituroard/.DS_Store
208
+ - lib/imperituroard/add_functions/add/additional.rb
208
209
  - lib/imperituroard/add_functions/logger/any_functions.rb
209
210
  - lib/imperituroard/platforms/cps/cps_mongo_connector.rb
210
211
  - lib/imperituroard/platforms/cps/cps_multiple_thread_req.rb
@@ -235,6 +236,7 @@ files:
235
236
  - lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb
236
237
  - lib/imperituroard/projects/mhub/subs/evrotorg/gms_connector.rb
237
238
  - lib/imperituroard/projects/oats/fttx_acl/add_acl_fttx.rb
239
+ - lib/imperituroard/projects/static.rb
238
240
  - lib/imperituroard/projects/ukaz60.rb
239
241
  - lib/imperituroard/projects/ukaz60/belgim.rb
240
242
  - lib/imperituroard/projects/ukaz60/dns.rb