imperituroard 0.5.2 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/imperituroard.gemspec +3 -2
  3. data/lib/.DS_Store +0 -0
  4. data/lib/imperituroard.rb +49 -19
  5. data/lib/imperituroard/.DS_Store +0 -0
  6. data/lib/imperituroard/add_functions/logger/any_functions.rb +22 -0
  7. data/lib/imperituroard/platforms/cps/cps_multiple_thread_req.rb +0 -0
  8. data/lib/imperituroard/platforms/staros/get_data_ssh.rb +54 -0
  9. data/lib/imperituroard/platforms/staros/staros_automation.rb +95 -0
  10. data/lib/imperituroard/platforms/staros/staros_automation_fun.rb +37 -0
  11. data/lib/imperituroard/platforms/staros/staros_parser.rb +141 -0
  12. data/lib/imperituroard/projects/dns.rb +1 -1
  13. data/lib/imperituroard/projects/iot.rb +66 -4
  14. data/lib/imperituroard/projects/iot/add_functions.rb +27 -27
  15. data/lib/imperituroard/projects/mhub.rb +8 -4
  16. data/lib/imperituroard/projects/mhub/infobip.rb +1 -1
  17. data/lib/imperituroard/projects/mhub/sk.rb +171 -157
  18. data/lib/imperituroard/projects/mhub/subs/dabrab/dabrab_proced.rb +124 -12
  19. data/lib/imperituroard/projects/ukaz60.rb +140 -0
  20. data/lib/imperituroard/projects/ukaz60/belgim.rb +221 -0
  21. data/lib/imperituroard/projects/ukaz60/dns.rb +18 -0
  22. data/lib/imperituroard/projects/{dns/ukaz60 → ukaz60}/dns_update.rb +2 -134
  23. data/lib/imperituroard/projects/ukaz60/fortigate.rb +210 -0
  24. data/lib/imperituroard/projects/ukaz60/staros.rb +141 -0
  25. data/lib/imperituroard/projects/ukaz60/ukaz60_add_func.rb +306 -0
  26. data/lib/imperituroard/projects/vpn/ezuev_fun/functions_ezuev.rb +29 -0
  27. data/lib/imperituroard/version.rb +1 -1
  28. metadata +31 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e82d66d85db1bd66d2a98362544e98de744cf142
4
- data.tar.gz: 71a88db5237cc41dbc305efcfb3de6ea5158379e
3
+ metadata.gz: dec8fb3791d83727a6bfd54fc71889481af42b42
4
+ data.tar.gz: 583739817cad732740861c08845910e849770b55
5
5
  SHA512:
6
- metadata.gz: 7a30826bee6fcb2d3bf180bda82fa41893138b471d28f611065874f1d05ebb13bc3246f613d1b292a50aa44501f1301e6606b0f700aba0f1c195fa1f5362ceb7
7
- data.tar.gz: 85e5c0a75b626cd7eaaeda049a6ca3c2209b58b120b3930bfebaa2f74c2b4fb6300ceb6d23b10465a0dcb7088e3d302ad62b8ee56d08a66628ca4c679601d67b
6
+ metadata.gz: 27b131265896d1793261ea994a011e436171f6d5e74bc0c11a4d2e7039545a715ca693be6faab217e321d52e41ae92a6488fb00027c9c2a3beab8fc24b4f198b
7
+ data.tar.gz: c5d72b86f1168829d5287c14120f70705a1bfb317ee896071d84b161a0a6b2ec3495a3e3c525a2e1aa2aa0a7d530c78f76c8d790dfe0a290a9c56401a7d9f71e
@@ -10,7 +10,8 @@ Gem::Specification.new do |spec|
10
10
  spec.description = %q{Gem from imperituroard for different actions}
11
11
  spec.homepage = "https://rubygems.org/"
12
12
  spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
14
15
 
15
16
  spec.metadata["allowed_push_host"] = "https://rubygems.org/"
16
17
 
@@ -51,6 +52,6 @@ Gem::Specification.new do |spec|
51
52
  spec.add_dependency "simpleidn", "0.1.1"
52
53
  spec.add_dependency "net-scp", "3.0.0"
53
54
 
54
-
55
+ spec.add_dependency "rails", "5.2.4.2"
55
56
 
56
57
  end
Binary file
@@ -5,6 +5,7 @@ $LOAD_PATH.unshift File.expand_path("../projects/mhub/subs/dabrab", __dir__)
5
5
  $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
+ $LOAD_PATH.unshift File.expand_path("../projects/dns", __dir__)
8
9
 
9
10
 
10
11
  require "imperituroard/version"
@@ -23,6 +24,8 @@ require 'imperituroard/projects/iot'
23
24
  require 'imperituroard/projects/dns'
24
25
  require 'imperituroard/platforms/cps/qps_connector'
25
26
  require 'imperituroard/platforms/public/telegram'
27
+ require 'imperituroard/projects/ukaz60'
28
+
26
29
  require 'json'
27
30
  require 'ipaddr'
28
31
  require 'date'
@@ -194,8 +197,6 @@ class Iot
194
197
  end
195
198
 
196
199
 
197
-
198
-
199
200
  #!5 add address to device
200
201
  #login
201
202
  #imei = newdevice_list
@@ -254,7 +255,7 @@ class Iot
254
255
  end
255
256
 
256
257
  def test111
257
- iot_connector.test
258
+ iot_connector.test1278493
258
259
  end
259
260
 
260
261
 
@@ -272,7 +273,7 @@ class Mhub_2
272
273
  :static_callback,
273
274
  :crm_connector
274
275
 
275
- def initialize(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback, crm_callback_url, crm_login, crm_password)
276
+ def initialize(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback, crm_callback_url, crm_login, crm_password, sms_alphaname)
276
277
  @sk_url = sk_url_simple
277
278
  @sk_login = sk_login
278
279
  @sk_password = sk_password
@@ -280,13 +281,11 @@ class Mhub_2
280
281
  @mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id)
281
282
  @internal_func = InternalFunc.new
282
283
  @dabrab_connecter = Dabrab.new
283
-
284
284
  @static_callback = static_callback
285
285
  @crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id)
286
- @mhub_connector = MhubFunctions_2.new(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback, crm_callback_url, crm_login, crm_password)
286
+ @mhub_connector = MhubFunctions_2.new(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback, crm_callback_url, crm_login, crm_password, sms_alphaname)
287
287
  end
288
288
 
289
-
290
289
  #{"destinations"=>[{"to"=>{"phoneNumber"=>"375297116638", "emailAddress"=>nil}}],
291
290
  # "scenarioKey"=>"1", "viber"=>nil, "sms"=>{"text"=>"карточка готова"},
292
291
  # "sendAt"=>"2019-08-15T08:40:00.000", "notifyUrl"=>"https://bpmonline.bankdabrabyt.by:444/0/ServiceModel/ScGetReports.svc/GetReports",
@@ -296,18 +295,14 @@ class Mhub_2
296
295
  # "notifyUrl"=>"https://bpmonline.bankdabrabyt.by:444/0/ServiceModel/ScGetReports.svc/GetReports",
297
296
  # "notifyContentType"=>"application/json"}}
298
297
 
299
-
300
298
  def get_send_message(params, ip_src, ip_real, ip_vip)
301
299
  mhub_connector.get_send_message_2(params, ip_src, ip_real, ip_vip)
302
300
  end
303
301
 
304
-
305
302
  def recieve_delivery_report(params, ip_src, ip_real, ip_vip)
306
303
  mhub_connector.rec_deliv_report_2(params, ip_src, ip_real, ip_vip)
307
304
  end
308
305
 
309
-
310
-
311
306
  end
312
307
 
313
308
 
@@ -334,7 +329,8 @@ end
334
329
 
335
330
  class Ukaz60Automation_2
336
331
 
337
- attr_accessor :dns
332
+ attr_accessor :dns,
333
+ :ukaz60_func
338
334
 
339
335
  def initialize(telegram_api_url,
340
336
  telegram_chat_id,
@@ -348,7 +344,26 @@ class Ukaz60Automation_2
348
344
  dns_password,
349
345
  belgim_login,
350
346
  belgim_password,
351
- belgim_url)
347
+ belgim_url,
348
+
349
+ ###########for fortigate############
350
+ ansible_tmp_folder, #folder on fortigate ansible server where url list uploaded
351
+ local_tmp_directory, #folder on local mashin where script work
352
+ ansible_ssh_user,
353
+ ansible_ssh_password,
354
+ ansible_host, #fortigate ansible server
355
+ url_backup_dir,
356
+ ####################################
357
+
358
+ #########for STAROS#############
359
+ staros_login,
360
+ staros_password,
361
+ ukaz60_http_groups,
362
+ ukaz60_https_groups,
363
+ staros_hosts
364
+
365
+ )
366
+ =begin
352
367
  @ukaz69_dns_func = Dns_2.new(telegram_api_url,
353
368
  telegram_chat_id,
354
369
  work_directory,
@@ -362,14 +377,29 @@ class Ukaz60Automation_2
362
377
  belgim_login,
363
378
  belgim_password,
364
379
  belgim_url)
380
+ =end
381
+
382
+ @ukaz60_func = Ukaz60All_2.new(telegram_api_url,
383
+ telegram_chat_id,
384
+ belgim_login,
385
+ belgim_password,
386
+ belgim_url,
387
+ ansible_tmp_folder,
388
+ local_tmp_directory,
389
+ ansible_ssh_user,
390
+ ansible_ssh_password,
391
+ ansible_host,
392
+ url_backup_dir,
393
+ staros_login,
394
+ staros_password,
395
+ ukaz60_http_groups,
396
+ ukaz60_https_groups,
397
+ staros_hosts)
365
398
  end
366
399
 
367
-
368
- def test
369
-
400
+ #1 block all devices by belgim list
401
+ def no_pasaran
402
+ ukaz60_func.no_pasaran
370
403
  end
371
404
 
372
-
373
-
374
-
375
405
  end
Binary file
@@ -0,0 +1,22 @@
1
+ require 'net/http'
2
+ require 'net/https'
3
+ require 'json'
4
+ require 'date'
5
+
6
+
7
+ class LogAddFunctions_2
8
+
9
+
10
+ def datetimenow()
11
+ d_curr = DateTime.now
12
+ time_zone = 'Europe/Minsk'
13
+ DateTime.now.to_s
14
+ end
15
+
16
+ def printer_texter(text, log_level)
17
+ mess = {:datetime => datetimenow, :sdk => "imperituroard", :sdk_version => Imperituroard::VERSION, :message => text}
18
+ p mess
19
+ end
20
+
21
+
22
+ end
@@ -0,0 +1,54 @@
1
+ require 'net/ssh'
2
+
3
+ require 'imperituroard/platforms/staros/staros_parser'
4
+
5
+ class StarosGet_2
6
+
7
+ attr_accessor :staros_parser, :staros_login, :staros_password
8
+
9
+ def initialize(staros_login, staros_password)
10
+ @staros_parser = StarosParser_2.new
11
+ @staros_login = staros_login
12
+ @staros_password = staros_password
13
+ end
14
+
15
+
16
+ #get all active-charging data
17
+ #host - staros device IP address
18
+ #return parsed ECS configuration in JSON
19
+ def get_all_active_charging(host_ip)
20
+
21
+ input_data = {:host_ip => host_ip}
22
+ out_data = {}
23
+ config_all = []
24
+
25
+ begin
26
+
27
+ Net::SSH.start(host_ip, staros_login, :password => staros_password) do |ssh|
28
+ staros_answer = ssh.exec!("show configuration active-charging service all")
29
+ staros_answer = staros_answer.gsub("#exit", "exit")
30
+ #staros_answer = staros_answer.gsub("\n", " ")
31
+ #p staros_answer
32
+ #host_pool_regexp = /(host-pool.+\s+exit)/
33
+ #fff = staros_answer.scan(host_pool_regexp)
34
+ #p fff
35
+
36
+ staros_answer = staros_answer.split("\n")
37
+ for ttt in staros_answer
38
+ regexp_full_command = /\s+(.+)/
39
+ group_ruled_ukaz60_9 = ttt.match(regexp_full_command)
40
+ if group_ruled_ukaz60_9 != nil
41
+ config_all.push(group_ruled_ukaz60_9[1])
42
+ else
43
+ config_all.push(ttt)
44
+ end
45
+ end
46
+ end
47
+ staros_json = staros_parser.ecs_config_parser(config_all)
48
+ out_data = {:code => 200, :result => "Successfully completed", :parsed_data => staros_json}
49
+ rescue
50
+ out_data = {:code => 507, :result => "get_all_active_charging: Unknown SDK error"}
51
+ end
52
+ out_data
53
+ end
54
+ end
@@ -0,0 +1,95 @@
1
+ require 'net/ssh'
2
+
3
+ staros_thr_1233 = []
4
+ conf = {}
5
+
6
+ staros_hosts = {
7
+ #5700
8
+ }
9
+
10
+ def printer (config)
11
+ for gggg1 in config
12
+
13
+ p ""
14
+ p ""
15
+ p "##{gggg1[0]}"
16
+ for jjj in gggg1[1]
17
+ p jjj
18
+ end
19
+ end
20
+ end
21
+
22
+ staros_hosts.each do |ggsn|
23
+ staros_thr_1233 << Thread.new do
24
+
25
+ p ggsn
26
+
27
+ begin
28
+
29
+ conf[ggsn[0]] = []
30
+
31
+ Net::SSH.start(ggsn[1], "ывапывап", :password => "пыапыва") do |ssh|
32
+ staros_answer = ssh.exec!("show configuration context Ga | grep edr")
33
+
34
+ regexp = /file name (\S+) rotation volume (\d+) rotation time \d+ storage-limit \d+ headers edr-format-name compression gzip file-sequence-number rulebase-seq-num/
35
+
36
+ ggg = staros_answer.match(regexp)
37
+ conf[ggsn[0]].push("configure")
38
+ conf[ggsn[0]].push("context Ga")
39
+ conf[ggsn[0]].push("edr-module active-charging-service charging")
40
+ conf[ggsn[0]].push("file name #{ggg[1]} rotation volume 40000000 rotation time 600 storage-limit 536870912 headers edr-format-name compression gzip file-sequence-number rulebase-seq-num")
41
+ conf[ggsn[0]].push("end")
42
+
43
+ #config
44
+ # staros_answer1 = ssh.exec!("configure")
45
+ # p staros_answer1
46
+ # staros_answer2 = ssh.exec!("context Ga")
47
+ # p staros_answer2
48
+ # staros_answer3 = ssh.exec!("edr-module active-charging-service charging")
49
+ # p staros_answer3
50
+ # staros_answer4 = ssh.exec!("file name #{ggg[1]} rotation volume 40000000 rotation time 600 storage-limit 536870912 headers edr-format-name compression gzip file-sequence-number rulebase-seq-num")
51
+ # p staros_answer4
52
+ # staros_answer5 = ssh.exec!("end")
53
+ # p staros_answer5
54
+
55
+ #check
56
+ staros_answer7 = ssh.exec!("show configuration | grep hostname")
57
+ reggg = /system hostname (\S+)/
58
+ hostname_this = staros_answer7.match(reggg)[1]
59
+
60
+ staros_answer8 = ssh.exec!("show configuration context Ga | grep edr")
61
+ regexp2 = /file name (\S+) rotation volume (\d+) rotation time \d+ storage-limit \d+ headers edr-format-name compression gzip file-sequence-number rulebase-seq-num/
62
+
63
+ ggg2 = staros_answer8.match(regexp2)
64
+
65
+ a1 = ggg2[1].gsub("edr-", "")
66
+ #p a1
67
+ #p hostname_this
68
+ #p ggg2
69
+
70
+ if a1 != hostname_this
71
+ p "incorrect: #{hostname_this}"
72
+ end
73
+
74
+
75
+ if ggg2[2] == "40000000"
76
+ else
77
+ p "incorrect value: #{hostname_this}"
78
+ end
79
+
80
+ end
81
+
82
+ rescue
83
+
84
+ p "#{ggsn[0]} ERROR"
85
+
86
+ end
87
+
88
+ end
89
+ end
90
+ staros_thr_1233.each(&:join)
91
+
92
+ #p conf
93
+
94
+
95
+ #printer(conf)
@@ -0,0 +1,37 @@
1
+ require 'net/ssh'
2
+
3
+ class StarosAutomationFun
4
+
5
+ attr_accessor :ignore_y
6
+
7
+ def initialize
8
+ @ignore_y = 1 #1-yes, 0-no
9
+ end
10
+
11
+ def staros_massive_command(staros_hosts, staros_login, staros_password, command_array)
12
+
13
+
14
+ staros_thr_pool_222 = []
15
+
16
+ staros_hosts.each do |ggsn|
17
+ staros_thr_pool_222 << Thread.new do
18
+
19
+ Net::SSH.start(ggsn[1], staros_login, :password => staros_password) do |session|
20
+
21
+ gg = session.exec!("context AAA")
22
+ p gg
23
+ gg1 = session.exec!("show subscribers summary")
24
+ p gg1
25
+
26
+
27
+
28
+ end
29
+
30
+
31
+
32
+ end
33
+ end
34
+ staros_thr_pool_222.each(&:join)
35
+
36
+ end
37
+ end
@@ -0,0 +1,141 @@
1
+ class StarosParser_2
2
+
3
+
4
+ #parser for staros ECS configuration
5
+ def ecs_config_parser(config_string_array)
6
+
7
+ out_ans = {}
8
+ parsed_config = {"config" => {"active-charging service" => []}}
9
+ config_string_array.shift
10
+
11
+ # {"config" => {"active-charging service" => [{"ECS-SVC" => {"root" => [], "host-pool"=>{"1b1.nekurims.top"=>["ip 185.59.101.182/32"]}, "ruledef"=>{"VKONTAKTE_CDN_b"=>[]}}}}]}
12
+
13
+ flag_inter_ecs_name = 0
14
+ current_ecs_name = ""
15
+ current_section = "root"
16
+ current_section_name = ""
17
+ section_flag = 0
18
+ section_deep = 0
19
+ ecs_number = 0
20
+ for aaa in config_string_array
21
+ if section_deep == 0 && aaa[0..22] == "active-charging service" #&& flag_inter_ecs_name == 0
22
+ ecs_name_regexp = /active-charging service (\S+)/
23
+ current_ecs_name = aaa.match(ecs_name_regexp)[1]
24
+ #p current_ecs_name
25
+ parsed_config["config"]["active-charging service"].push({current_ecs_name => {"root" => [],
26
+ "host-pool" => {},
27
+ "port-map" => {},
28
+ "ruledef" => {},
29
+ "access-ruledef" => {},
30
+ "group-of-ruledefs" => {},
31
+ "packet-filter" => {},
32
+ "edr-format" => {},
33
+ "xheader-format" => {},
34
+ "charging-action" => {},
35
+ "rulebase" => {},
36
+ "fw-and-nat policy" => {}
37
+ }})
38
+ flag_inter_ecs_name = 1
39
+ section_deep = 1
40
+ current_section = "root"
41
+ else
42
+ if aaa == "exit" && section_deep == 2
43
+ section_flag = 0
44
+ section_deep = section_deep - 1
45
+ current_section = "root"
46
+ elsif aaa[0..9] == "host-pool " && section_flag == 0 && section_deep == 1
47
+ current_section = "host-pool"
48
+ ecs_hostpool_regexp = /host-pool\s+(.+)/
49
+ current_section_name = aaa.match(ecs_hostpool_regexp)[1]
50
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name] = []
51
+ section_flag = 1
52
+ section_deep = section_deep + 1
53
+ elsif aaa[0..8] == "port-map " && section_flag == 0 && section_deep == 1
54
+ current_section = "port-map"
55
+ ecs_portmap_regexp = /port-map\s+(.+)/
56
+ current_section_name = aaa.match(ecs_portmap_regexp)[1]
57
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name] = []
58
+ section_flag = 1
59
+ section_deep = section_deep + 1
60
+ elsif aaa[0..7] == "ruledef " && section_flag == 0 && section_deep == 1
61
+ current_section = "ruledef"
62
+ ecs_ruldef_regexp = /ruledef\s+(.+)/
63
+ current_section_name = aaa.match(ecs_ruldef_regexp)[1]
64
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name] = []
65
+ section_flag = 1
66
+ section_deep = section_deep + 1
67
+ elsif aaa[0..14] == "access-ruledef " && section_flag == 0 && section_deep == 1
68
+ current_section = "access-ruledef"
69
+ ecs_accruldef_regexp = /access-ruledef\s+(.+)/
70
+ current_section_name = aaa.match(ecs_accruldef_regexp)[1]
71
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name] = []
72
+ section_flag = 1
73
+ section_deep = section_deep + 1
74
+ elsif aaa[0..17] == "group-of-ruledefs " && section_flag == 0 && section_deep == 1
75
+ current_section = "group-of-ruledefs"
76
+ ecs_grruldef_regexp = /group-of-ruledefs\s+(.+)/
77
+ current_section_name = aaa.match(ecs_grruldef_regexp)[1]
78
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name] = []
79
+ section_flag = 1
80
+ section_deep = section_deep + 1
81
+ elsif aaa[0..13] == "packet-filter " && section_flag == 0 && section_deep == 1
82
+ current_section = "packet-filter"
83
+ ecs_packfil_regexp = /packet-filter\s+(.+)/
84
+ current_section_name = aaa.match(ecs_packfil_regexp)[1]
85
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name] = []
86
+ section_flag = 1
87
+ section_deep = section_deep + 1
88
+ elsif aaa[0..10] == "edr-format " && section_flag == 0 && section_deep == 1
89
+ current_section = "edr-format"
90
+ ecs_edrformat_regexp = /edr-format\s+(.+)/
91
+ current_section_name = aaa.match(ecs_edrformat_regexp)[1]
92
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name] = []
93
+ section_flag = 1
94
+ section_deep = section_deep + 1
95
+ elsif aaa[0..14] == "xheader-format " && section_flag == 0 && section_deep == 1
96
+ current_section = "xheader-format"
97
+ ecs_xheader_regexp = /xheader-format\s+(.+)/
98
+ current_section_name = aaa.match(ecs_xheader_regexp)[1]
99
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name] = []
100
+ section_flag = 1
101
+ section_deep = section_deep + 1
102
+ elsif aaa[0..15] == "charging-action " && section_flag == 0 && section_deep == 1
103
+ current_section = "charging-action"
104
+ ecs_xheader_regexp = /charging-action\s+(.+)/
105
+ current_section_name = aaa.match(ecs_xheader_regexp)[1]
106
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name] = []
107
+ section_flag = 1
108
+ section_deep = section_deep + 1
109
+ elsif aaa[0..8] == "rulebase " && section_flag == 0 && section_deep == 1
110
+ current_section = "rulebase"
111
+ ecs_xheader_regexp = /rulebase\s+(.+)/
112
+ current_section_name = aaa.match(ecs_xheader_regexp)[1]
113
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name] = []
114
+ section_flag = 1
115
+ section_deep = section_deep + 1
116
+ elsif aaa[0..17] == "fw-and-nat policy " && section_flag == 0 && section_deep == 1
117
+ current_section = "fw-and-nat policy"
118
+ ecs_xheader_regexp = /fw-and-nat policy\s+(.+)/
119
+ current_section_name = aaa.match(ecs_xheader_regexp)[1]
120
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name] = []
121
+ section_flag = 1
122
+ section_deep = section_deep + 1
123
+ elsif section_flag == 1 && current_section != "root" && current_section != "end" && section_deep == 2
124
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name][current_section][current_section_name].push(aaa)
125
+ elsif current_section == "root" && section_deep == 1 && aaa != "end"
126
+ parsed_config["config"]["active-charging service"][ecs_number][current_ecs_name]["root"].push(aaa)
127
+ elsif aaa == "end"
128
+ section_flag = 0
129
+ section_deep = 0
130
+ current_section = "end"
131
+ p "end"
132
+ else
133
+ p aaa
134
+ end
135
+ end
136
+ end
137
+ parsed_config
138
+ end
139
+ end
140
+
141
+