imperituroard 1.1.15 → 1.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/lib/imperituroard.rb +6 -5
- data/lib/imperituroard/add_functions/logger/any_functions.rb +1 -1
- data/lib/imperituroard/platforms/cps/cps_mongo_connector.rb +394 -0
- data/lib/imperituroard/platforms/cps/qps_connector.rb +63 -0
- data/lib/imperituroard/platforms/iwag/iwag_database_worker.rb +1 -1
- data/lib/imperituroard/platforms/iwag/iwag_telnet_connector.rb +9 -9
- data/lib/imperituroard/projects/iot.rb +30 -0
- data/lib/imperituroard/projects/iot/add_functions.rb +3 -3
- data/lib/imperituroard/projects/iot/hua_oceanconnect_adapter.rb +9 -9
- data/lib/imperituroard/projects/iot/internal_functions.rb +5 -5
- data/lib/imperituroard/projects/iot/mongoconnector.rb +25 -0
- data/lib/imperituroard/projects/mhub.rb +60 -13
- data/lib/imperituroard/projects/mhub/gms.rb +29 -29
- data/lib/imperituroard/projects/mhub/sk.rb +12 -9
- data/lib/imperituroard/projects/mhub/subs/dabrab/dabrab_platform.rb +17 -4
- data/lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb +5 -5
- data/lib/imperituroard/projects/oats/fttx_acl/add_acl_fttx.rb +187 -0
- data/lib/imperituroard/projects/ukaz60/belgim.rb +3 -2
- data/lib/imperituroard/projects/ukaz60/ukaz60_add_func.rb +15 -13
- data/lib/imperituroard/projects/wttx/phpipamcps.rb +29 -28
- data/lib/imperituroard/projects/wttx/updatepostcps.rb +2 -2
- data/lib/imperituroard/version.rb +1 -1
- metadata +4 -2
@@ -148,7 +148,7 @@ class Sksk_2
|
|
148
148
|
output_params
|
149
149
|
end
|
150
150
|
|
151
|
-
def sk_send_viber_sms_one(msisdn, callback_url, sms_text, viber_txt, alphaname)
|
151
|
+
def sk_send_viber_sms_one(msisdn, callback_url, sms_text, viber_txt, alphaname, smsttl=600)
|
152
152
|
|
153
153
|
input_params = {:msisdn => msisdn, :callback_url => callback_url, :sms_text => sms_text, :viber_txt => viber_txt, :alphaname => alphaname}
|
154
154
|
output_params = {}
|
@@ -188,7 +188,7 @@ class Sksk_2
|
|
188
188
|
"sms": {
|
189
189
|
"text": sms_text,
|
190
190
|
"alpha_name": alphaname,
|
191
|
-
"ttl":
|
191
|
+
"ttl": smsttl
|
192
192
|
},
|
193
193
|
"viber": viber_mess_ans[:body][:to_sk_format]
|
194
194
|
}
|
@@ -220,7 +220,7 @@ class Sksk_2
|
|
220
220
|
end
|
221
221
|
|
222
222
|
|
223
|
-
def sk_send_sms_list(msisdn_list, callback_url, text, alphaname, time_pause_minutes=1)
|
223
|
+
def sk_send_sms_list(msisdn_list, callback_url, text, alphaname, time_pause_minutes=1, smsttl)
|
224
224
|
|
225
225
|
input_params = {:msisdn_list => msisdn_list, :callback_url => callback_url, :text => text, :alphaname => alphaname}
|
226
226
|
output_params = {}
|
@@ -256,7 +256,7 @@ class Sksk_2
|
|
256
256
|
"sms": {
|
257
257
|
"alpha_name": alphaname,
|
258
258
|
"text": text,
|
259
|
-
"ttl":
|
259
|
+
"ttl": smsttl
|
260
260
|
}
|
261
261
|
}
|
262
262
|
}
|
@@ -282,7 +282,10 @@ class Sksk_2
|
|
282
282
|
end
|
283
283
|
|
284
284
|
|
285
|
-
def sk_send_viber_list(msisdn_list, callback_url, text, time_pause_minutes)
|
285
|
+
def sk_send_viber_list(msisdn_list, callback_url, text, time_pause_minutes, viberttl)
|
286
|
+
|
287
|
+
internal_func.printer_texter({:input => "Fun started", :output => {}, :procedure => "Sksk_2.sk_send_viber_list"}, log_level)
|
288
|
+
|
286
289
|
|
287
290
|
input_params = {:msisdn_list => msisdn_list, :callback_url => callback_url, :text => text}
|
288
291
|
output_params = {}
|
@@ -292,7 +295,7 @@ class Sksk_2
|
|
292
295
|
|
293
296
|
thr_sk_send_viber_list = Thread.new do
|
294
297
|
|
295
|
-
viber_mess_ans = dabrab_add_func.dabrabyt_text_field_parse(text)
|
298
|
+
viber_mess_ans = dabrab_add_func.dabrabyt_text_field_parse(text, viberttl)
|
296
299
|
|
297
300
|
if viber_mess_ans[:code] == 200
|
298
301
|
uri = URI(sk_url_broadcast)
|
@@ -346,7 +349,7 @@ class Sksk_2
|
|
346
349
|
end
|
347
350
|
|
348
351
|
|
349
|
-
def sk_send_viber_sms_list(msisdn_list, callback_url, sms_text, viber_text, alphaname, time_pause_minutes)
|
352
|
+
def sk_send_viber_sms_list(msisdn_list, callback_url, sms_text, viber_text, alphaname, time_pause_minutes, viberttl, smsttl)
|
350
353
|
input_params = {:msisdn_list => msisdn_list, :callback_url => callback_url, :sms_text => sms_text, :viber_text => viber_text, :alphaname => alphaname}
|
351
354
|
output_params = {}
|
352
355
|
request_message = {}
|
@@ -355,7 +358,7 @@ class Sksk_2
|
|
355
358
|
thr_sk_send_viber_sms_list = Thread.new do
|
356
359
|
|
357
360
|
|
358
|
-
viber_mess_ans = dabrab_add_func.dabrabyt_text_field_parse(viber_text)
|
361
|
+
viber_mess_ans = dabrab_add_func.dabrabyt_text_field_parse(viber_text, viberttl)
|
359
362
|
|
360
363
|
if viber_mess_ans[:code] == 200
|
361
364
|
|
@@ -388,7 +391,7 @@ class Sksk_2
|
|
388
391
|
"sms": {
|
389
392
|
"alpha_name": alphaname,
|
390
393
|
"text": sms_text,
|
391
|
-
"ttl":
|
394
|
+
"ttl": smsttl
|
392
395
|
},
|
393
396
|
"viber": viber_mess_ans[:body][:to_sk_format]
|
394
397
|
}
|
@@ -22,11 +22,13 @@ class Crm_2
|
|
22
22
|
|
23
23
|
begin
|
24
24
|
|
25
|
-
internal_func.printer_texter({:input =>
|
25
|
+
internal_func.printer_texter({:input => 'Start process', :procedure => "Crm_2.crm_status_2"}, log_level)
|
26
26
|
|
27
27
|
|
28
28
|
thr_crm_status_2 = Thread.new do
|
29
29
|
|
30
|
+
internal_func.printer_texter({:input => 'Thread start', :procedure => 'Crm_2.crm_status_2'}, log_level)
|
31
|
+
|
30
32
|
partnnn = crm_payload[:results].each_slice(slice_num).to_a
|
31
33
|
|
32
34
|
partnnn.each { |one_part_reports|
|
@@ -37,6 +39,8 @@ class Crm_2
|
|
37
39
|
uri = URI(crm_callback_url)
|
38
40
|
#8 - client id
|
39
41
|
|
42
|
+
internal_func.printer_texter({:input => 'before net', :procedure => 'Crm_2.crm_status_2'}, log_level)
|
43
|
+
|
40
44
|
https = Net::HTTP.new(uri.host, uri.port)
|
41
45
|
https.use_ssl = true
|
42
46
|
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
@@ -54,10 +58,19 @@ class Crm_2
|
|
54
58
|
|
55
59
|
internal_func.printer_texter({:input => "Before send request to crm", :procedure => "Crm_2.crm_status_2"}, log_level)
|
56
60
|
|
57
|
-
|
61
|
+
begin
|
62
|
+
|
63
|
+
res = https.request(req)
|
64
|
+
internal_func.printer_texter({:input => "After send request to crm Ok", :procedure => "Crm_2.crm_status_2"}, log_level)
|
65
|
+
internal_func.printer_texter({:input => {:res_code => res.code, :res_body => res.body.to_s}, :procedure => "Crm_2.crm_status_2"}, log_level)
|
66
|
+
|
67
|
+
rescue
|
68
|
+
|
69
|
+
res = 'dabrabyt error'
|
70
|
+
internal_func.printer_texter({:input => "After send request to crm error", :procedure => "Crm_2.crm_status_2"}, log_level)
|
71
|
+
internal_func.printer_texter({:input => {:res_code => "500", :res_body => res}, :procedure => "Crm_2.crm_status_2"}, log_level)
|
58
72
|
|
59
|
-
|
60
|
-
internal_func.printer_texter({:input => {:res_code => res.code, :res_body => res.body.to_s}, :procedure => "Crm_2.crm_status_2"}, log_level)
|
73
|
+
end
|
61
74
|
|
62
75
|
}
|
63
76
|
|
@@ -9,7 +9,7 @@ class Dabrab
|
|
9
9
|
@log_level = log_level
|
10
10
|
end
|
11
11
|
|
12
|
-
def dabrabyt_text_field_parse(stri)
|
12
|
+
def dabrabyt_text_field_parse(stri, viberttl)
|
13
13
|
button_url = ""
|
14
14
|
image = ""
|
15
15
|
button_text = ""
|
@@ -101,13 +101,13 @@ class Dabrab
|
|
101
101
|
|
102
102
|
case scheme
|
103
103
|
when 0
|
104
|
-
sk_format = {"text": text, "ttl":
|
104
|
+
sk_format = {"text": text, "ttl": viberttl}
|
105
105
|
when 1
|
106
|
-
sk_format = {"text": text, "ttl":
|
106
|
+
sk_format = {"text": text, "ttl": viberttl, "caption": button_text, "action": button_url}
|
107
107
|
when 2
|
108
|
-
sk_format = {"text": text, "ttl":
|
108
|
+
sk_format = {"text": text, "ttl": viberttl, "caption": button_text, "action": button_url, "img": image}
|
109
109
|
when 3
|
110
|
-
sk_format = {"img": image, "ttl":
|
110
|
+
sk_format = {"img": image, "ttl": viberttl}
|
111
111
|
else
|
112
112
|
nil
|
113
113
|
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
require 'imperituroard/platforms/cps/qps_connector'
|
2
|
+
require 'imperituroard/platforms/cps/cps_mongo_connector'
|
3
|
+
|
4
|
+
class Kosmonavty_2
|
5
|
+
attr_accessor :file_of_changed_prof,
|
6
|
+
:qps_connector,
|
7
|
+
:cps_mongo,
|
8
|
+
:filename_processed_added,
|
9
|
+
:logfile,
|
10
|
+
:filename_failed_add,
|
11
|
+
:logfile_return,
|
12
|
+
:filename_processed_return,
|
13
|
+
:filename_failed_return
|
14
|
+
|
15
|
+
def initialize(file_of_changed_prof)
|
16
|
+
@file_of_changed_prof = file_of_changed_prof
|
17
|
+
@qps_connector = Qps_2.new('http://172.24.220.65:8080/ua/wsdl/UnifiedApi.wsdl', 'http://172.24.220.65:8080/ua/soap', 'http://broadhop.com/unifiedapi/soap/types')
|
18
|
+
@cps_mongo = MongoCPS_2.new('site1-ca-pri-sessionmgr01', '27720', 'spr')
|
19
|
+
|
20
|
+
@filename_processed_added = 'testfile.txt'
|
21
|
+
@filename_processed_return = 'testfile_return.txt'
|
22
|
+
@logfile = 'day60log.txt'
|
23
|
+
@logfile_return = 'day60log_return.txt'
|
24
|
+
@filename_failed_add = 'testfile_failed.txt'
|
25
|
+
@filename_failed_return = 'testfile_failed_return.txt'
|
26
|
+
end
|
27
|
+
|
28
|
+
def write_to_file_rewr(new_text)
|
29
|
+
File.open(file_of_changed_prof + filename_processed_added, 'w') {|file| file.write(new_text)}
|
30
|
+
end
|
31
|
+
|
32
|
+
def add_line_to_file(new_line, filename)
|
33
|
+
File.open(file_of_changed_prof + filename, 'a') do |file|
|
34
|
+
line = new_line + "\n"
|
35
|
+
file.write line
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_msisdn_from_file
|
40
|
+
begin
|
41
|
+
file = File.open(file_of_changed_prof + filename_processed_added)
|
42
|
+
file_data = file.read
|
43
|
+
output = []
|
44
|
+
splitted_lines = file_data.split("\n")
|
45
|
+
splitted_lines.each do |aaa|
|
46
|
+
if aaa != '' && aaa != "\n" && aaa.include?(';')
|
47
|
+
msssisdn = aaa.split(';')
|
48
|
+
output.push(msssisdn[0])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
return output
|
52
|
+
rescue
|
53
|
+
return []
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_msisdn_from_file_for_del
|
58
|
+
begin
|
59
|
+
file = File.open(file_of_changed_prof + filename_processed_added)
|
60
|
+
file_data = file.read
|
61
|
+
output = []
|
62
|
+
splitted_lines = file_data.split("\n")
|
63
|
+
splitted_lines.each do |aaa|
|
64
|
+
if aaa != '' && aaa != "\n" && aaa.include?(';')
|
65
|
+
msssisdn = aaa.split(';')
|
66
|
+
output.push({:msisdn => msssisdn[0], :devId => msssisdn[1]})
|
67
|
+
end
|
68
|
+
end
|
69
|
+
return output
|
70
|
+
rescue
|
71
|
+
return []
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def main_processor_add_acl
|
76
|
+
process_json = {}
|
77
|
+
process_msisdn_list = []
|
78
|
+
|
79
|
+
#dat_cps = cps_mongo.get_minsk_fttx_fizlic
|
80
|
+
dat_cps = cps_mongo.get_minsk_fttx_zone2
|
81
|
+
|
82
|
+
dat_cps.each do |t|
|
83
|
+
gg = t.split(';')
|
84
|
+
process_json[gg[0]] = gg[1]
|
85
|
+
process_msisdn_list.push(gg[0])
|
86
|
+
end
|
87
|
+
|
88
|
+
from_file = get_msisdn_from_file
|
89
|
+
list_for_process = process_msisdn_list - from_file
|
90
|
+
uniq_list_for_proc = list_for_process.uniq
|
91
|
+
|
92
|
+
uniq_list_for_proc.each do |ddd|
|
93
|
+
ans = qps_connector.add_avp_acl(ddd, 'GTFU_IN')
|
94
|
+
#ans = {:change_subscriber_avps_response => {:error_code => '0'}}
|
95
|
+
begin
|
96
|
+
if ans[:change_subscriber_avps_response][:error_code] == '0'
|
97
|
+
add_line_to_file(ddd + ';' + process_json[ddd], filename_processed_added)
|
98
|
+
resp = qps_connector.stop_session_username(process_json[ddd])
|
99
|
+
add_line_to_file(ddd + ';' + process_json[ddd] + 'stop_session: ' + resp.to_s, logfile)
|
100
|
+
else
|
101
|
+
add_line_to_file(ddd + ';' + process_json[ddd], filename_failed_add)
|
102
|
+
add_line_to_file(ddd + ';' + process_json[ddd] + 'add_avps: ' + ans.to_s, logfile)
|
103
|
+
end
|
104
|
+
rescue
|
105
|
+
add_line_to_file(ddd + ';' + process_json[ddd], filename_failed_add)
|
106
|
+
add_line_to_file(ddd + ';' + process_json[ddd] + 'add_avps: ' + ans.to_s, logfile)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def main_processor_del_acl
|
112
|
+
from_file = get_msisdn_from_file_for_del
|
113
|
+
|
114
|
+
from_file.each do |ddd1|
|
115
|
+
ans = qps_connector.delete_avp_acl(ddd1[:msisdn])
|
116
|
+
if ans[:change_subscriber_avps_response][:error_code] == '0'
|
117
|
+
add_line_to_file(ddd1.to_s, filename_processed_return)
|
118
|
+
resp = qps_connector.stop_session_username(ddd1[:devId])
|
119
|
+
add_line_to_file(ddd1.to_s + ';' + ddd1[:devId] + 'stop_session: ' + resp.to_s, logfile_return)
|
120
|
+
else
|
121
|
+
add_line_to_file(ddd1.to_s, filename_failed_return)
|
122
|
+
add_line_to_file(ddd1.to_s + ';' + ddd1[:devId] + 'del_avp: ' + ans.to_s, logfile_return)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def test
|
128
|
+
qps_connector.stop_session_username('Ethernet1/0/7:1907.0 Min_Rokossovskogo_145_5/0/0/1/0/7')
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_mongo
|
132
|
+
|
133
|
+
dat_cps = cps_mongo.get_minsk_fttx_zone2
|
134
|
+
dat_cps2 = cps_mongo.get_minsk_fttx_zone3_rokos
|
135
|
+
dat_cps3 = cps_mongo.get_minsk_fttx_zone4_mega
|
136
|
+
dat_cps4 = cps_mongo.get_minsk_fttx_zone5_koles
|
137
|
+
dat_cps5 = cps_mongo.get_minsk_fttx_zone6_all
|
138
|
+
dat_cps7 = cps_mongo.get_minsk_fttx_zone7_3last
|
139
|
+
|
140
|
+
#1
|
141
|
+
p "get_minsk_fttx_zone2"
|
142
|
+
p dat_cps
|
143
|
+
p dat_cps.length
|
144
|
+
|
145
|
+
#2
|
146
|
+
p "get_minsk_fttx_zone3_rokos"
|
147
|
+
p dat_cps2
|
148
|
+
p dat_cps2.length
|
149
|
+
|
150
|
+
|
151
|
+
#3
|
152
|
+
p "get_minsk_fttx_zone4_mega"
|
153
|
+
p dat_cps3
|
154
|
+
p dat_cps3.length
|
155
|
+
|
156
|
+
|
157
|
+
#4
|
158
|
+
p "get_minsk_fttx_zone5_koles"
|
159
|
+
p dat_cps4
|
160
|
+
p dat_cps4.length
|
161
|
+
|
162
|
+
#5
|
163
|
+
p "get_minsk_fttx_zone6_all"
|
164
|
+
p dat_cps5
|
165
|
+
p dat_cps5.length
|
166
|
+
|
167
|
+
|
168
|
+
p "get_minsk_fttx_zone7_3last"
|
169
|
+
p dat_cps7
|
170
|
+
p dat_cps7.length
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
#p test.delete_avp_acl("375298766719")
|
178
|
+
#p test.add_avp_acl("375298766719", "ffgfg2")
|
179
|
+
|
180
|
+
#test2 = Kosmonavty_2.new('/Users/imperituroard/Desktop/')
|
181
|
+
|
182
|
+
#test2.main_processor_add_acl
|
183
|
+
|
184
|
+
#test2.main_processor_del_acl
|
185
|
+
|
186
|
+
#test2.test_mongo
|
187
|
+
|
@@ -74,13 +74,14 @@ class Belgim_2
|
|
74
74
|
elem = elem.gsub(" ", "")
|
75
75
|
end
|
76
76
|
|
77
|
-
if elem.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
|
77
|
+
#if elem.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
|
78
|
+
if elem.match(/[а-яА-ЯЁё]/)
|
78
79
|
elem = SimpleIDN.to_ascii(elem)
|
79
80
|
end
|
80
81
|
|
81
82
|
if elem != "-" && elem != ""
|
82
83
|
domain_parsed.push(elem)
|
83
|
-
if_www = elem[0]+elem[1]+elem[2]+elem[3]
|
84
|
+
if_www = elem[0] + elem[1] + elem[2] + elem[3]
|
84
85
|
|
85
86
|
#if not contain www - add domain with www
|
86
87
|
if if_www != "www."
|
@@ -76,36 +76,38 @@ class AddFuncUkaz60_2
|
|
76
76
|
if !processed_domain_in_url.include? "/"
|
77
77
|
#it is domain. Process domain
|
78
78
|
#if it is kirillica then process
|
79
|
-
if processed_domain_in_url.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
|
79
|
+
#if processed_domain_in_url.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
|
80
|
+
if processed_domain_in_url.match(/[а-яА-ЯЁё]/)
|
80
81
|
processed_domain_in_url = SimpleIDN.to_ascii(processed_domain_in_url)
|
81
82
|
end
|
82
83
|
domain_only = domain_only + processed_domain_in_url
|
83
|
-
type =
|
84
|
+
type = 'domain'
|
84
85
|
else
|
85
86
|
#it is url. process url
|
86
|
-
hh = processed_domain_in_url.split(
|
87
|
+
hh = processed_domain_in_url.split('/')
|
87
88
|
domain_only = hh[0]
|
88
|
-
if domain_only.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
|
89
|
+
#if domain_only.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/)
|
90
|
+
if domain_only.match(/[а-яА-ЯЁё]/)
|
89
91
|
hh[0] = SimpleIDN.to_ascii(domain_only)
|
90
|
-
processed_domain_in_url =
|
92
|
+
processed_domain_in_url = ''
|
91
93
|
for t in hh
|
92
|
-
processed_domain_in_url = processed_domain_in_url + t +
|
94
|
+
processed_domain_in_url = processed_domain_in_url + t + '/'
|
93
95
|
end
|
94
96
|
sss1len = processed_domain_in_url.size
|
95
97
|
processed_domain_in_url = processed_domain_in_url[0..sss1len-2]
|
96
98
|
end
|
97
|
-
type =
|
99
|
+
type = 'url'
|
98
100
|
end
|
99
101
|
else
|
100
|
-
type =
|
102
|
+
type = 'empty'
|
101
103
|
end
|
102
|
-
output_answer = {:code => 200, :result =>
|
104
|
+
output_answer = {:code => 200, :result => 'Request processed', :ishodnye_dannye => stroka, :first_url => first_url, :processed_domain_in_url => processed_domain_in_url, :domain_only => domain_only, :protocol => protocol, :type => type}
|
103
105
|
|
104
106
|
else
|
105
|
-
output_answer = {:code => 202, :result =>
|
107
|
+
output_answer = {:code => 202, :result => 'Data not found'}
|
106
108
|
end
|
107
109
|
rescue
|
108
|
-
output_answer = {:code => 507, :result =>
|
110
|
+
output_answer = {:code => 507, :result => 'Something wrong'}
|
109
111
|
end
|
110
112
|
output_answer
|
111
113
|
end
|
@@ -132,12 +134,12 @@ class AddFuncUkaz60_2
|
|
132
134
|
#result_out.push({aaa[0] => "Ok"})
|
133
135
|
num_ok = num_ok + 1
|
134
136
|
else
|
135
|
-
result_out[aaa[0]] =
|
137
|
+
result_out[aaa[0]] = 'Failed'
|
136
138
|
#result_out.push({aaa[0] => "Failed"})
|
137
139
|
num_failed = num_failed + 1
|
138
140
|
end
|
139
141
|
rescue
|
140
|
-
result_out[
|
142
|
+
result_out['unknown'] = aaa.to_s
|
141
143
|
#result_out.push({"unknown" => aaa.to_s})
|
142
144
|
num_failed = num_failed + 1
|
143
145
|
end
|
@@ -5,7 +5,7 @@ require 'savon'
|
|
5
5
|
|
6
6
|
|
7
7
|
class Pcps
|
8
|
-
attr_accessor :wsdl, :endpoint, :namespace, :
|
8
|
+
attr_accessor :wsdl, :endpoint, :namespace, :client_cps
|
9
9
|
|
10
10
|
def initialize(wsdl, endpoint, namespace)
|
11
11
|
@wsdl = wsdl
|
@@ -24,34 +24,35 @@ class Pcps
|
|
24
24
|
def avp_attr_list(username)
|
25
25
|
|
26
26
|
message2 = {:networkId => username}
|
27
|
-
response =
|
27
|
+
response = client_cps.call(:get_subscriber) do
|
28
28
|
message(message2)
|
29
29
|
end
|
30
30
|
aaa = response.to_hash[:get_subscriber_response][:subscriber][:avp]
|
31
31
|
#li = {"FRAMED-IP-ADDRESS":0,"FRAMED-NETMASK":0,"Default-Gateway":0,"VRF-ID":0,"DHCP-CLASS":0,"IPV4-UNNUMB":0,"PREFIX":0}
|
32
|
-
li = {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
32
|
+
li = {'FRAMED-IP-ADDRESS' => 0,
|
33
|
+
'FRAMED-NETMASK' => 0,
|
34
|
+
'Default-Gateway' => 0,
|
35
|
+
'VRF-ID' => 0,
|
36
|
+
'DHCP-CLASS' => 0,
|
37
|
+
'IPV4-UNNUMB' => 0,
|
38
|
+
'FRAMED-ROUTE-1' => 0}
|
39
|
+
is_hash = !aaa.is_a?(Hash)
|
40
|
+
if is_hash
|
41
|
+
aaa.each do |i|
|
42
|
+
if i[:code]=='FRAMED-IP-ADDRESS'
|
43
|
+
li['FRAMED-IP-ADDRESS']=1
|
44
|
+
elsif i[:code]=='FRAMED-NETMASK'
|
45
|
+
li['FRAMED-NETMASK']=1
|
46
|
+
elsif i[:code]=='Default-Gateway'
|
47
|
+
li['Default-Gateway']=1
|
48
|
+
elsif i[:code]=='VRF-ID'
|
49
|
+
li['VRF-ID']=1
|
50
|
+
elsif i[:code]=='DHCP-CLASS'
|
51
|
+
li['DHCP-CLASS']=1
|
52
|
+
elsif i[:code]=='IPV4-UNNUMB'
|
53
|
+
li['IPV4-UNNUMB']=1
|
54
|
+
elsif i[:code]=='FRAMED-ROUTE-1'
|
55
|
+
li['FRAMED-ROUTE-1']=1
|
55
56
|
end
|
56
57
|
end
|
57
58
|
end
|
@@ -81,7 +82,7 @@ class Pcps
|
|
81
82
|
# {:code => "PREFIX"}
|
82
83
|
]
|
83
84
|
}
|
84
|
-
response =
|
85
|
+
response = client_cps.call(:change_subscriber_avps) do
|
85
86
|
message(message2)
|
86
87
|
end
|
87
88
|
response
|
@@ -98,7 +99,7 @@ class Pcps
|
|
98
99
|
|
99
100
|
def get_current_attributes(msisdn)
|
100
101
|
message2 = {:networkId => msisdn}
|
101
|
-
response =
|
102
|
+
response = client_cps.call(:get_subscriber) do
|
102
103
|
message(message2)
|
103
104
|
end
|
104
105
|
aaa = response.to_hash[:get_subscriber_response][:subscriber][:avp]
|
@@ -111,7 +112,7 @@ class Pcps
|
|
111
112
|
:networkId => username,
|
112
113
|
:newAvp => attlist
|
113
114
|
}
|
114
|
-
response =
|
115
|
+
response = client_cps.call(:change_subscriber_avps) do
|
115
116
|
message(message1)
|
116
117
|
end
|
117
118
|
response.to_hash
|