imperituroard 1.1.14 → 1.1.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,7 +57,7 @@ class Crm_2
57
57
  res = https.request(req)
58
58
 
59
59
  internal_func.printer_texter({:input => "After send request to crm", :procedure => "Crm_2.crm_status_2"}, log_level)
60
- internal_func.printer_texter({:input => {:res_code => res.code, :res_body => JSON.parse(res.body.to_s)}, :procedure => "Crm_2.crm_status_2"}, log_level)
60
+ internal_func.printer_texter({:input => {:res_code => res.code, :res_body => res.body.to_s}, :procedure => "Crm_2.crm_status_2"}, log_level)
61
61
 
62
62
  }
63
63
 
@@ -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": 60}
104
+ sk_format = {"text": text, "ttl": viberttl}
105
105
  when 1
106
- sk_format = {"text": text, "ttl": 60, "caption": button_text, "action": button_url}
106
+ sk_format = {"text": text, "ttl": viberttl, "caption": button_text, "action": button_url}
107
107
  when 2
108
- sk_format = {"text": text, "ttl": 60, "caption": button_text, "action": button_url, "img": image}
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": 60}
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 = "domain"
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 = "url"
99
+ type = 'url'
98
100
  end
99
101
  else
100
- type = "empty"
102
+ type = 'empty'
101
103
  end
102
- 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}
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 => "Data not found"}
107
+ output_answer = {:code => 202, :result => 'Data not found'}
106
108
  end
107
109
  rescue
108
- output_answer = {:code => 507, :result => "Something wrong"}
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]] = "Failed"
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["unknown"] = aaa.to_s
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, :clientcps
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 = clientcps.call(:get_subscriber) do
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 = {"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
- if !aaa.is_a?(Hash)
40
- for i in aaa
41
- if i[:code]=="FRAMED-IP-ADDRESS"
42
- li["FRAMED-IP-ADDRESS"]=1
43
- elsif i[:code]=="FRAMED-NETMASK"
44
- li["FRAMED-NETMASK"]=1
45
- elsif i[:code]=="Default-Gateway"
46
- li["Default-Gateway"]=1
47
- elsif i[:code]=="VRF-ID"
48
- li["VRF-ID"]=1
49
- elsif i[:code]=="DHCP-CLASS"
50
- li["DHCP-CLASS"]=1
51
- elsif i[:code]=="IPV4-UNNUMB"
52
- li["IPV4-UNNUMB"]=1
53
- elsif i[:code]=="FRAMED-ROUTE-1"
54
- li["FRAMED-ROUTE-1"]=1
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 = clientcps.call(:change_subscriber_avps) do
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 = clientcps.call(:get_subscriber) do
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 = clientcps.call(:change_subscriber_avps) do
115
+ response = client_cps.call(:change_subscriber_avps) do
115
116
  message(message1)
116
117
  end
117
118
  response.to_hash
@@ -55,8 +55,8 @@ class StateWTTX
55
55
  if !result_code
56
56
  "false"
57
57
  else
58
- reg_imsi = /<field code=\"imsi\" value=\"([0-9]{10,15})\"/
59
- reg_imei = /<field code=\"imei\" value=\"([0-9]{10,17})\"/
58
+ reg_imsi = /<field code="imsi" value="([0-9]{10,15})"/
59
+ reg_imei = /<field code="imei" value="([0-9]{10,17})"/
60
60
 
61
61
  m1 = reg_imsi.match(content)
62
62
  m2 = reg_imei.match(content)
@@ -1,4 +1,4 @@
1
1
  module Imperituroard
2
- VERSION = "1.1.14"
2
+ VERSION = '1.1.20'
3
3
  end
4
4
 
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.14
4
+ version: 1.1.20
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-09-19 00:00:00.000000000 Z
11
+ date: 2020-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -206,6 +206,7 @@ files:
206
206
  - lib/imperituroard.rb
207
207
  - lib/imperituroard/.DS_Store
208
208
  - lib/imperituroard/add_functions/logger/any_functions.rb
209
+ - lib/imperituroard/platforms/cps/cps_mongo_connector.rb
209
210
  - lib/imperituroard/platforms/cps/cps_multiple_thread_req.rb
210
211
  - lib/imperituroard/platforms/cps/qps_connector.rb
211
212
  - lib/imperituroard/platforms/cps/request_formatter.rb
@@ -233,6 +234,7 @@ files:
233
234
  - lib/imperituroard/projects/mhub/subs/dabrab/dabrab_platform.rb
234
235
  - lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb
235
236
  - lib/imperituroard/projects/mhub/subs/evrotorg/gms_connector.rb
237
+ - lib/imperituroard/projects/oats/fttx_acl/add_acl_fttx.rb
236
238
  - lib/imperituroard/projects/ukaz60.rb
237
239
  - lib/imperituroard/projects/ukaz60/belgim.rb
238
240
  - lib/imperituroard/projects/ukaz60/dns.rb