network-utility 1.1.50 → 1.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/document/bgp-CR16010H-F.md +12 -8
- data/document/bgp-CR16018-F.md +12 -8
- data/document/bgp-CR19000-20.md +12 -8
- data/document/bgp-M6000-16E.md +8 -8
- data/document/bgp-M6000-18S.md +8 -8
- data/document/bgp-M6000-8.md +8 -8
- data/document/bgp-M6000-8E.md +8 -8
- data/document/bgp-MA5200G-8.md +12 -8
- data/document/bgp-ME60-16.md +12 -8
- data/document/bgp-ME60-X16.md +12 -8
- data/document/bgp-NE40E-X16.md +12 -8
- data/document/bgp-NE40E-X16A.md +12 -8
- data/document/bgp-NE40E-X8.md +12 -8
- data/document/bgp-NE40E.md +12 -8
- data/document/bgp-NE5000E-20.md +12 -8
- data/document/bgp-NE5000E-X16.md +12 -8
- data/document/bgp-NE5000E-X16A.md +12 -8
- data/document/bgp-NE80E.md +12 -8
- data/document/bgp-T8000-18.md +24 -0
- data/document/config.md +45 -44
- data/document/if-ALCATEL7750.md +174 -12
- data/document/if-CRS-16.md +54 -2
- data/document/if-Nokia7750.md +174 -12
- data/document/isis-NE5000E-20.md +141 -0
- data/document/isis-NE5000E-X16.md +141 -0
- data/document/isis-NE5000E-X16A.md +141 -0
- data/document/pool-ALCATEL7750.md +20 -0
- data/document/pool-CR16010H-F.md +108 -0
- data/document/pool-CR16018-F.md +108 -0
- data/document/pool-Nokia7750.md +20 -0
- data/document/pool-V6000.md +126 -0
- data/document/pool-VNE9000.md +63 -0
- data/document/static-ALCATEL7750.md +32 -0
- data/document/static-CR16010H-F.md +2 -2
- data/document/static-CR16018-F.md +2 -2
- data/document/static-CRS-16.md +40 -0
- data/document/static-Nokia7750.md +32 -0
- data/document/static-V6000.md +34 -0
- data/document/static-VNE9000.md +28 -0
- data/network.rb +1 -1
- data/utility/ipv4_address.rb +7 -0
- metadata +16 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# CR16018-F pool
|
|
2
|
+
|
|
3
|
+
```ruby
|
|
4
|
+
@sign << ['CR16018-F', '地址池解析']
|
|
5
|
+
@sign << ['CR16018-F', 'nat地址配置']
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
module CR16018_F
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
def 地址池解析 配置散列
|
|
12
|
+
地址池列表 = []; 分组列表 = {}
|
|
13
|
+
地址池配置 = 配置散列['ip'].select{|配置|配置.include?('ip pool ')}
|
|
14
|
+
地址池分组 = 配置散列['ip'].select{|配置|配置.include?('ip pool-group')}
|
|
15
|
+
地址池分组.each do|分组|
|
|
16
|
+
tag = nil
|
|
17
|
+
分组.each_line do|line|
|
|
18
|
+
if line.include?('pool-group') and (args = line.split('ip pool-group ')[-1].split(' '))
|
|
19
|
+
tag = args[0]
|
|
20
|
+
分组列表[tag] ||= {}
|
|
21
|
+
end
|
|
22
|
+
if line.include?('pool') and !line.include?('pool-group') and (args = line.split('pool ')[-1].strip)
|
|
23
|
+
分组列表[tag]['pool'] ||= []
|
|
24
|
+
分组列表[tag]['pool'] << args
|
|
25
|
+
end
|
|
26
|
+
if line.include?('vpn-instance') and (args = line.split('vpn-instance ')[-1].strip)
|
|
27
|
+
分组列表[tag]['vpn-instance'] = args
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
地址池配置.each do|地址池|参数 = {}
|
|
33
|
+
地址池.each_line do|line|
|
|
34
|
+
if line.include?('ip pool') and (args = line.split('ip pool ')[-1].split(' '))
|
|
35
|
+
参数['name'] = args[0]
|
|
36
|
+
分组列表.each do|tag,args|
|
|
37
|
+
参数['vpn-instance'] = args['vpn-instance'] if args['pool'].include?(参数['name']) && args['vpn-instance']
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
if line.include?('gateway') and (args = line.split('gateway-list ')[-1].split(' '))
|
|
41
|
+
参数['gateway'] = args[0]
|
|
42
|
+
参数['mode'] = args[1] if args.size>1
|
|
43
|
+
end
|
|
44
|
+
if line.include?('network') and (args = line.split('network ')[-1].split(' '))
|
|
45
|
+
参数['network'] ||= []
|
|
46
|
+
参数['gatemsk'] = args[2]
|
|
47
|
+
参数['network'] << [args[0],args[2]] # network, netmask
|
|
48
|
+
end
|
|
49
|
+
if line.include?('dns-list') and (args = line.split('dns-list ')[-1].split(' '))
|
|
50
|
+
参数['dns-list'] = args
|
|
51
|
+
end
|
|
52
|
+
# if line.include?('forbidden-ip') and (args = line.split('forbidden-ip ')[-1].split(' '))
|
|
53
|
+
# 参数['forbidden-ip'] = args
|
|
54
|
+
# end
|
|
55
|
+
end
|
|
56
|
+
地址池列表 << 参数
|
|
57
|
+
end
|
|
58
|
+
地址池列表
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def nat地址配置 配置散列
|
|
62
|
+
nat地址组 = {}
|
|
63
|
+
address_groups = 配置散列['nat'].select{|配置|配置.include?('nat address-group')}
|
|
64
|
+
address_groups.each do|地址组|
|
|
65
|
+
id = nil
|
|
66
|
+
地址组.each_line do|line|
|
|
67
|
+
if line.include?('nat address-group') and (args = line.split('nat address-group ')[-1].split(' '))
|
|
68
|
+
id = args[0]
|
|
69
|
+
nat地址组[id] ||= {}
|
|
70
|
+
end
|
|
71
|
+
if line.include?('port-range') and (args = line.split('port-range ')[-1].split(' '))
|
|
72
|
+
nat地址组[id]['port-range'] = args.map{|a|a.to_i}
|
|
73
|
+
end
|
|
74
|
+
if line.include?('port-block') and (args = line.split('port-block ')[-1].split(' '))
|
|
75
|
+
nat地址组[id]['port-block'] = args.last.to_i
|
|
76
|
+
end
|
|
77
|
+
if line.include?('address') and !line.include?('nat address') and (args = line.split('address ')[-1].split(' '))
|
|
78
|
+
nat地址组[id]['address'] ||= []
|
|
79
|
+
nat地址组[id]['address'] << [args[0],args[1]] # start, finish
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
nat_instances = 配置散列['nat'].select{|配置|配置.include?('nat instance')}
|
|
85
|
+
nat_instances.each do|nat_instance|
|
|
86
|
+
nat_inst_id,nat_inst_name,service_inst_group,addr_group,vpn_inst = nil,nil,nil,nil,nil
|
|
87
|
+
nat_instance.each_line do|line|
|
|
88
|
+
if line.include?('nat instance')
|
|
89
|
+
nat_inst_id = line.split('id').last.to_i
|
|
90
|
+
nat_inst_name = line.split('instance').last.split(' ').first.strip
|
|
91
|
+
end
|
|
92
|
+
if line.include?('service-instance-group')
|
|
93
|
+
service_inst_group = line.split('service-instance-group ')[-1].strip
|
|
94
|
+
end
|
|
95
|
+
if line.include?('address-group')
|
|
96
|
+
addr_group = line.split('address-group ')[-1].split(' ').first
|
|
97
|
+
vpn_inst = line.split('vpn-instance ')[-1] if line.include?('vpn-instance')
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
nat地址组[addr_group]['nat-instance-id'] = nat_inst_id
|
|
101
|
+
nat地址组[addr_group]['nat-instance-name'] = nat_inst_name
|
|
102
|
+
nat地址组[addr_group]['service-inst-group'] = service_inst_group
|
|
103
|
+
nat地址组[addr_group]['vpn-instance'] = vpn_inst
|
|
104
|
+
end
|
|
105
|
+
nat地址组
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
# Nokia7750 pool
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['Nokia7750', '地址池解析']
|
|
6
|
+
@sign << ['Nokia7750', 'nat地址配置']
|
|
7
|
+
|
|
8
|
+
module Nokia7750
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
def 地址池解析 配置散列
|
|
12
|
+
_intfs, _subintfs, abpools, vpn_apply = self.接口关联 配置散列
|
|
13
|
+
return (abpools + vpn_apply).select{|a|!a[-1].empty?}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def nat地址配置 配置散列
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
```
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
|
|
2
|
+
# V6000 pool
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['V6000', '地址池接口']
|
|
6
|
+
@sign << ['V6000', '地址池配置']
|
|
7
|
+
@sign << ['V6000', '地址池解析']
|
|
8
|
+
@sign << ['V6000', 'nat地址配置']
|
|
9
|
+
@sign << ['V6000', '地址池日志']
|
|
10
|
+
|
|
11
|
+
module V6000
|
|
12
|
+
module_function
|
|
13
|
+
|
|
14
|
+
def 地址池接口 配置散列
|
|
15
|
+
虚接口正文,录入 = '',false;虚接口列表,虚接口散列 = [],{}
|
|
16
|
+
(配置散列['AM'] || 配置散列['am']).each_line do|line|
|
|
17
|
+
录入 = true if / interface vbui(.)*/.match(line)
|
|
18
|
+
虚接口正文 << line if 录入
|
|
19
|
+
(虚接口列表 << 虚接口正文;虚接口正文,录入 = '',false) if " \$\n"==line # M6k-8 is / \$/.match(line)
|
|
20
|
+
end
|
|
21
|
+
虚接口列表.delete("")
|
|
22
|
+
虚接口列表.each{|虚接口|虚接口散列[虚接口.split("\n")[0].split(' ')[1].strip]=虚接口}
|
|
23
|
+
虚接口散列
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def 地址池配置 虚接口文本
|
|
27
|
+
地址池正文,录入 = '',false;地址池列表 = []
|
|
28
|
+
虚接口文本.each_line do|line|
|
|
29
|
+
录入 = true if / ip-pool pool-name(.)*/.match(line)
|
|
30
|
+
地址池正文 << line if 录入
|
|
31
|
+
(地址池列表 << 地址池正文;地址池正文,录入 = '',false) if " \$\n"==line # M6k-8 is / \$/.match(line)
|
|
32
|
+
end
|
|
33
|
+
地址池列表
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def 地址池解析 配置散列
|
|
37
|
+
地址池列表,地址池配置,虚接口散列 = [],[],地址池接口(配置散列)
|
|
38
|
+
虚接口散列.values.each{|虚接口|地址池配置 += 地址池配置(虚接口)}
|
|
39
|
+
地址池配置.each do|地址池|参数 = {};index = 1
|
|
40
|
+
地址池.each_line do|line|
|
|
41
|
+
if line.include?('ip-pool') && line.include?('pool-name')
|
|
42
|
+
参数['name'] = line.strip.split(' ')[-3]
|
|
43
|
+
参数['id'] = line.strip.split(' ')[-1]
|
|
44
|
+
end
|
|
45
|
+
if line.include?('access-domain')
|
|
46
|
+
参数['access-domain'] ||= []
|
|
47
|
+
参数['access-domain'] << line.strip.split(' ')[-1]
|
|
48
|
+
end
|
|
49
|
+
if line.include?('pppoe-dns-server') || line.include?('ipoe-dns-server')
|
|
50
|
+
参数['dns-server'] ||= []
|
|
51
|
+
参数['dns-server'] << line.chop.gsub('second','').strip.split(' ')[-1]
|
|
52
|
+
参数['dns-server'].uniq!
|
|
53
|
+
end
|
|
54
|
+
if line.include?('member')
|
|
55
|
+
index = line.split(' ').last.strip
|
|
56
|
+
end
|
|
57
|
+
if line.include?('start-ip') and line.include?('end-ip')
|
|
58
|
+
参数['member'] ||= []
|
|
59
|
+
开始ip = line.strip.split(' ')[-3]
|
|
60
|
+
结束ip = line.strip.split(' ')[-1]
|
|
61
|
+
参数['member'] << [index,开始ip,结束ip]
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
地址池列表 << 参数
|
|
65
|
+
end
|
|
66
|
+
地址池列表
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def nat地址配置 配置散列
|
|
70
|
+
地址池列表 = [];参数 = {}
|
|
71
|
+
(配置散列['CGN'] || 配置散列['cgn'] || "").each_line do|line|
|
|
72
|
+
if line.include?("node")
|
|
73
|
+
参数['node'] ||= []
|
|
74
|
+
a,node_id,board = line.split(" ")
|
|
75
|
+
参数['node'] << [node_id,board]
|
|
76
|
+
end
|
|
77
|
+
参数['tcp-mss-clamping'] = line.split(" ")[-1].strip if line.include?("tcp-mss-clamping")
|
|
78
|
+
if line.include?("cgn-pool")
|
|
79
|
+
参数['pool'] ||= {}
|
|
80
|
+
参数['pool']['name'] = line.split(" ")[1]
|
|
81
|
+
参数['pool']['id'] = line.split(" ")[3]
|
|
82
|
+
end
|
|
83
|
+
参数['pool']['port-range'] = line.split(" ")[-1] if line.include?("port-range")
|
|
84
|
+
if line.include?("section")
|
|
85
|
+
参数['pool']['section'] ||= []
|
|
86
|
+
a,section,stip,edip = line.split(" ")
|
|
87
|
+
参数['pool']['section'] << [section,stip,edip]
|
|
88
|
+
end
|
|
89
|
+
if line.include?("domain")
|
|
90
|
+
参数['domain name'] = line.split(" ")[1]
|
|
91
|
+
参数['domain id'] = line.split(" ")[2]
|
|
92
|
+
参数['domain type'] = line.split(" ")[4..5].join(" ")
|
|
93
|
+
end
|
|
94
|
+
参数['tcp-timeout-unwell-known-fin-rst'] = line.split(" ")[-1] if line.include?("unwell-known-port")
|
|
95
|
+
参数['tcp-timeout-well-known-fin-rst'] = line.split(" ")[-1] if line.include?("well-known-port")
|
|
96
|
+
if line.include?("dynamic")
|
|
97
|
+
参数['acl rule'] ||= []
|
|
98
|
+
参数['acl rule'] << line.strip
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
地址池列表 << 参数
|
|
102
|
+
地址池列表
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def 地址池日志 详细信息
|
|
106
|
+
地址池列表 = [];时间标签 = Time.now.form
|
|
107
|
+
分片信息 = 详细信息.split("----------------------------------------\n")[1..-1]
|
|
108
|
+
分片信息.each do|片段|单池 = {"Scan Time"=>时间标签}
|
|
109
|
+
单池['Pool Id'] = /pool\-id( )*:(.+)/.match(片段).to_s.split(":")[1].to_s.strip.split(" ")[0]
|
|
110
|
+
单池['Pool Name'] = /pool\-name( )*:(.+)/.match(片段).to_s.split(":")[1].to_s.strip#.split(" ")[0]
|
|
111
|
+
单池['Description'] = /description( )*:(.+)/.match(片段).to_s.split(":")[1].to_s.strip#.split(" ")[0]
|
|
112
|
+
单池['Domain Name'] = /domain\-name( )*:(.+)/.match(片段).to_s.split(":")[1].to_s.strip#.split(" ")[0]
|
|
113
|
+
其他域名 = 片段.split("\n").select{|line|line.split(" ").size==1 and !line.include?("#") and !line.include?("^")}
|
|
114
|
+
单池['Domain Name'] = ( [单池['Domain Name']] + 其他域名.select{|l|!l.include?("[TelnetMajin]")}.map{|line|line.strip} ).join(";")
|
|
115
|
+
单池['Vpn Id'] = /vpn\-id( )*:(.+)/.match(片段).to_s.split(":")[1].to_s.strip.split(" ")[0]
|
|
116
|
+
单池['Vbui Name'] = /vbui\-name( )*:(.+)/.match(片段).to_s.split(":")[1].to_s.strip#.split(" ")[0]
|
|
117
|
+
单池['Address Total'] = /address\-total( )*:(.+)/.match(片段).to_s.split(":")[1].to_s.strip.split(" ")[0]
|
|
118
|
+
单池['Unusable Rate'] = /unusable\-rate( )*:(.+)/.match(片段).to_s.split(":")[1].to_s.strip#.split(" ")[0]
|
|
119
|
+
单池['Used Rate'] = /used\-rate( )*:(.+)/.match(片段).to_s.split(":")[1].to_s.strip.split(" ")[0]
|
|
120
|
+
单池['Free Rate'] = /free\-rate( )*:(.+)/.match(片段).to_s.split(":")[1].to_s.strip#.split(" ")[0]
|
|
121
|
+
地址池列表 << 单池
|
|
122
|
+
end
|
|
123
|
+
地址池列表
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
# VNE9000 pool
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['VNE9000', '地址池解析']
|
|
6
|
+
@sign << ['VNE9000', 'nat地址配置']
|
|
7
|
+
|
|
8
|
+
module VNE9000
|
|
9
|
+
module_function
|
|
10
|
+
|
|
11
|
+
def 地址池解析 配置散列
|
|
12
|
+
地址池列表 = []
|
|
13
|
+
地址池配置 = 配置散列['dap-server'].select{|配置|配置.include?('ip pool')}
|
|
14
|
+
地址池配置.each do|地址池|参数 = {}
|
|
15
|
+
地址池.each_line do|line|
|
|
16
|
+
if line.include?('ip pool') and (args = line.split('ip pool ')[-1].split(' '))
|
|
17
|
+
参数['name'] = args[0]
|
|
18
|
+
end
|
|
19
|
+
if line.include?('network') and (args = line.split('network ')[-1].split(' '))
|
|
20
|
+
参数['network'] ||= []
|
|
21
|
+
参数['network'] << [args[0],args[1],args[4]] # 0:network 1:masklen 2:blocklen
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
地址池列表 << 参数
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
新地址池列表 = []
|
|
28
|
+
地址池配置2 = 配置散列['ip'].select{|配置|配置.include?('ip pool')}
|
|
29
|
+
地址池配置2.each do|地址池|参数 = {}
|
|
30
|
+
地址池.each_line do|line|
|
|
31
|
+
if line.include?('ip pool') and (args = line.split('ip pool ')[-1].split(' '))
|
|
32
|
+
参数['name'] = args[0]
|
|
33
|
+
参数['mode'] = args[1..-1].join(' ')
|
|
34
|
+
end
|
|
35
|
+
if line.include?('dap-server') and (args = line.split('pool ')[-1].split(' '))
|
|
36
|
+
参数['dap-pool'] = args[0]
|
|
37
|
+
end
|
|
38
|
+
if line.include?('subnet') and (args = line.split(' '))
|
|
39
|
+
参数['subnet-length'] = [args[args.index('initial')+1], args[args.index('extend')+1]] # 0:initial 1:extend
|
|
40
|
+
end
|
|
41
|
+
if line.include?('vpn-instance') and (args = line.split('vpn-instance ')[-1].split(' '))
|
|
42
|
+
参数['vpn-instance'] = args.first
|
|
43
|
+
end
|
|
44
|
+
if line.include?('dns-server') and (args = line.split('dns-server ')[-1].split(' '))
|
|
45
|
+
参数['dns-server'] = args
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
if 地址池 = 地址池列表.find{|地址池|地址池['name'] == 参数['dap-pool']}
|
|
50
|
+
参数.delete('name')
|
|
51
|
+
新地址池列表 << 地址池.merge(参数)
|
|
52
|
+
地址池列表.delete(地址池)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
新地址池列表 + 地址池列表
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def nat地址配置 配置散列
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
# ALCATEL7750 static
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['ALCATEL7750', '静态路由']
|
|
6
|
+
|
|
7
|
+
module ALCATEL7750
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
# [head='static', target-network, target-netmask, next-hop, preference, status='']
|
|
11
|
+
def 静态路由 配置散列
|
|
12
|
+
records = []
|
|
13
|
+
statics = 配置散列["Static Route Configuration"]
|
|
14
|
+
statics.each do|static|
|
|
15
|
+
words = static.split(" ")
|
|
16
|
+
if words.index("static-route")
|
|
17
|
+
target = words[words.index("static-route")+1]
|
|
18
|
+
network, netmask = target.split("/")
|
|
19
|
+
end
|
|
20
|
+
if words.index("next-hop")
|
|
21
|
+
nexthop = words[words.index("next-hop")+1]
|
|
22
|
+
end
|
|
23
|
+
if words.index("preference")
|
|
24
|
+
preference = words[words.index("preference")+1]
|
|
25
|
+
end
|
|
26
|
+
records << ['static', network, netmask, nexthop, preference, '']
|
|
27
|
+
end
|
|
28
|
+
return records
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
```
|
|
@@ -11,7 +11,7 @@ module CR16010H_F
|
|
|
11
11
|
static_routes = []
|
|
12
12
|
['ip','ipv6'].each do|tag|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
|
-
if part.include?('route-static
|
|
14
|
+
if part.include?('route-static')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
16
|
next unless line.include?('route-static ')
|
|
17
17
|
items = line.split(" ")
|
|
@@ -38,7 +38,7 @@ module CR16010H_F
|
|
|
38
38
|
tab = []
|
|
39
39
|
(conf['ip'] || []).each do|part|
|
|
40
40
|
part.split("\n").each do|line|
|
|
41
|
-
next unless line.include?
|
|
41
|
+
next unless line.include?('ip subscriber session')
|
|
42
42
|
words = line.split(' ')
|
|
43
43
|
tab << words
|
|
44
44
|
end
|
|
@@ -11,7 +11,7 @@ module CR16018_F
|
|
|
11
11
|
static_routes = []
|
|
12
12
|
['ip','ipv6'].each do|tag|
|
|
13
13
|
(配置散列[tag] || []).each do|part|
|
|
14
|
-
if part.include?('route-static
|
|
14
|
+
if part.include?('route-static')
|
|
15
15
|
part.split("\n").each do|line|
|
|
16
16
|
next unless line.include?('route-static ')
|
|
17
17
|
items = line.split(" ")
|
|
@@ -38,7 +38,7 @@ module CR16018_F
|
|
|
38
38
|
tab = []
|
|
39
39
|
(conf['ip'] || []).each do|part|
|
|
40
40
|
part.split("\n").each do|line|
|
|
41
|
-
next unless line.include?
|
|
41
|
+
next unless line.include?('ip subscriber session')
|
|
42
42
|
words = line.split(' ')
|
|
43
43
|
tab << words
|
|
44
44
|
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
# CRS-16 静态路由
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['CRS-16', '静态路由']
|
|
6
|
+
|
|
7
|
+
module CRS_16
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
def 静态路由 配置散列
|
|
11
|
+
routes = []
|
|
12
|
+
配置散列['router'].each do|seg|
|
|
13
|
+
flag = false
|
|
14
|
+
seg.split("\n").each do|line|
|
|
15
|
+
flag = true if line.include?('router static')
|
|
16
|
+
if flag && !line.include?('!')
|
|
17
|
+
words = line.split(" ")
|
|
18
|
+
target = words.first
|
|
19
|
+
if /[a-zA-Z\-]+/.match(words[1])
|
|
20
|
+
nextif = words[1]
|
|
21
|
+
nexthop = words[2] if /[\d\.]+/.match(words[2])
|
|
22
|
+
elsif /[\d\.]+/.match(words[1])
|
|
23
|
+
nexthop = words[1]
|
|
24
|
+
end
|
|
25
|
+
description = words[words.index('description')+1] if words.index('description')
|
|
26
|
+
tag = words[words.index('tag')+1] if words.index('tag')
|
|
27
|
+
routes << ['static',target, nextif, nexthop, description, tag]
|
|
28
|
+
end
|
|
29
|
+
flag = false if line.include?('!')
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
routes.delete(["static", "router", "static", nil, nil, nil])
|
|
33
|
+
routes.delete(["static", "maximum", "path", "ipv4", nil, nil])
|
|
34
|
+
routes.delete(["static", "maximum", "path", "ipv6", nil, nil])
|
|
35
|
+
routes.delete(["static", "address-family", "ipv4", nil, nil, nil])
|
|
36
|
+
routes
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
# Nokia7750 static
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['Nokia7750', '静态路由']
|
|
6
|
+
|
|
7
|
+
module Nokia7750
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
# [head='static', target-network, target-netmask, next-hop, preference, status='']
|
|
11
|
+
def 静态路由 配置散列
|
|
12
|
+
statics = 配置散列["Static Route Configuration"].join("\n").match_paragraph("\n static-route-entry", "\n exit")
|
|
13
|
+
records = []
|
|
14
|
+
statics.each do|static|
|
|
15
|
+
record = [nil, nil, nil, '', '']
|
|
16
|
+
static.split("\n").each_with_index do|context, index|
|
|
17
|
+
if index==0
|
|
18
|
+
record = context.strip.split('/') + [nil,'','']
|
|
19
|
+
else
|
|
20
|
+
record[2] = 'black-hole' if context.include?('black-hole')
|
|
21
|
+
record[2] = context.split(' ').last if context.include?('next-hop')
|
|
22
|
+
record[3] = context.split('preference ').last if context.include?('preference')
|
|
23
|
+
record[4] = 'shutdown' if context.include?('shutdown') && !context.include?('no shutdown')
|
|
24
|
+
(records << ['static']+record.clone;record = [record[0], record[1]]+[nil, '', '']) if context.include?('exit')
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
return records
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
# V6000 static
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['V6000', '静态路由']
|
|
6
|
+
|
|
7
|
+
module V6000
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
def 静态路由 配置散列
|
|
11
|
+
static_routes = []
|
|
12
|
+
['static','ipv6-static-route'].each do|tag|
|
|
13
|
+
lines = (配置散列[tag] || "").split("\n")
|
|
14
|
+
lines.each_with_index do|line,index|
|
|
15
|
+
next unless line.include?('route ')
|
|
16
|
+
if line.size==80 && lines[index+1][0..1]!='ip'
|
|
17
|
+
items = (line+lines[index+1]).split(" ")
|
|
18
|
+
else
|
|
19
|
+
items = line.split(" ")
|
|
20
|
+
end
|
|
21
|
+
if items[2].include?('vrf')
|
|
22
|
+
head = "static:#{items[3]}"
|
|
23
|
+
tail = items[4].include?(':') ? items[4].split('/')+items[5..-1].to_a : items[4..-1].to_a
|
|
24
|
+
else
|
|
25
|
+
head = "static"
|
|
26
|
+
tail = items[2].include?(':') ? items[2].split('/')+items[3..-1].to_a : items[2..-1].to_a
|
|
27
|
+
end
|
|
28
|
+
static_routes << [head]+tail
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
return static_routes
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
# VNE9000 static
|
|
3
|
+
|
|
4
|
+
```ruby
|
|
5
|
+
@sign << ['VNE9000', '静态路由']
|
|
6
|
+
|
|
7
|
+
module VNE9000
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
def 静态路由 配置散列
|
|
11
|
+
static_routes = []
|
|
12
|
+
['ip','ipv6'].each do|tag|
|
|
13
|
+
(配置散列[tag] || []).each do|part|
|
|
14
|
+
if part.include?('route-static')
|
|
15
|
+
part.split("\n").each do|line|
|
|
16
|
+
next unless line.include?('route-static ')
|
|
17
|
+
items = line.split(" ")
|
|
18
|
+
record = items[2].include?('vpn-') ? ["static:#{items[3]}"]+items[4..-1].to_a : ["static"]+items[2..-1].to_a
|
|
19
|
+
static_routes << record
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
return static_routes
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
```
|
data/network.rb
CHANGED
data/utility/ipv4_address.rb
CHANGED
|
@@ -320,4 +320,11 @@ module IP
|
|
|
320
320
|
(start2 <= start1 && start1 <= finish2) ||
|
|
321
321
|
(start2 <= finish1 && finish1 <= finish2)
|
|
322
322
|
end
|
|
323
|
+
|
|
324
|
+
def xross range1, range2, option=:v4 # or :v6
|
|
325
|
+
start1, finish1 = range1
|
|
326
|
+
start2, finish2 = range2
|
|
327
|
+
return [start1, finish1, start2, finish2].sort.uniq.map{|n|IP.send(option, '0.0.0.0')+n} if option==:v4
|
|
328
|
+
return [start1, finish1, start2, finish2].sort.uniq.map{|n|IP.send(option, '::')+n} if option==:v6
|
|
329
|
+
end
|
|
323
330
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: network-utility
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.51
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt
|
|
@@ -82,6 +82,7 @@ files:
|
|
|
82
82
|
- document/bgp-NE5000E-X16.md
|
|
83
83
|
- document/bgp-NE5000E-X16A.md
|
|
84
84
|
- document/bgp-NE80E.md
|
|
85
|
+
- document/bgp-T8000-18.md
|
|
85
86
|
- document/config.md
|
|
86
87
|
- document/document.rb
|
|
87
88
|
- document/flexe-CX600-X16A.md
|
|
@@ -122,6 +123,9 @@ files:
|
|
|
122
123
|
- document/isis-CX600-X16A.md
|
|
123
124
|
- document/isis-CX600-X8A.md
|
|
124
125
|
- document/isis-NE40E-X16A.md
|
|
126
|
+
- document/isis-NE5000E-20.md
|
|
127
|
+
- document/isis-NE5000E-X16.md
|
|
128
|
+
- document/isis-NE5000E-X16A.md
|
|
125
129
|
- document/isis-NE8000E-X8.md
|
|
126
130
|
- document/isis-NE8100-X8.md
|
|
127
131
|
- document/lic-M6000-16E.md
|
|
@@ -179,6 +183,9 @@ files:
|
|
|
179
183
|
- document/policy-NE80E.md
|
|
180
184
|
- document/policy-NE8100-X8.md
|
|
181
185
|
- document/policy-VNE9000.md
|
|
186
|
+
- document/pool-ALCATEL7750.md
|
|
187
|
+
- document/pool-CR16010H-F.md
|
|
188
|
+
- document/pool-CR16018-F.md
|
|
182
189
|
- document/pool-M6000-16E.md
|
|
183
190
|
- document/pool-M6000-18S.md
|
|
184
191
|
- document/pool-M6000-8.md
|
|
@@ -191,9 +198,14 @@ files:
|
|
|
191
198
|
- document/pool-NE40E-X8.md
|
|
192
199
|
- document/pool-NE40E.md
|
|
193
200
|
- document/pool-NE80E.md
|
|
201
|
+
- document/pool-Nokia7750.md
|
|
202
|
+
- document/pool-V6000.md
|
|
203
|
+
- document/pool-VNE9000.md
|
|
204
|
+
- document/static-ALCATEL7750.md
|
|
194
205
|
- document/static-CR16010H-F.md
|
|
195
206
|
- document/static-CR16018-F.md
|
|
196
207
|
- document/static-CR19000-20.md
|
|
208
|
+
- document/static-CRS-16.md
|
|
197
209
|
- document/static-CX600-X16A.md
|
|
198
210
|
- document/static-CX600-X8A.md
|
|
199
211
|
- document/static-M6000-16E.md
|
|
@@ -213,7 +225,10 @@ files:
|
|
|
213
225
|
- document/static-NE8000E-X8.md
|
|
214
226
|
- document/static-NE80E.md
|
|
215
227
|
- document/static-NE8100-X8.md
|
|
228
|
+
- document/static-Nokia7750.md
|
|
216
229
|
- document/static-T8000-18.md
|
|
230
|
+
- document/static-V6000.md
|
|
231
|
+
- document/static-VNE9000.md
|
|
217
232
|
- document/static-ZXCTN9000-18EA.md
|
|
218
233
|
- document/static-ZXCTN9000-8EA.md
|
|
219
234
|
- document/statistics-M6000-16E.md
|