...
  View open merge request
Commits (7)
......@@ -3,13 +3,13 @@
"sw-imag"
],
"backplane_bps": 800000000000,
"ip": "172.16.31.254",
"kind": "router",
"linecards": [
{
"backplane_bps": 48000000000,
"kavlan_pattern": "%PORT%",
"kind": "node",
"port": "eth0",
"ports": [
{
},
......@@ -202,28 +202,23 @@
{
},
{
"kind": "other",
"port": "eth0",
"kind": "server",
"uid": "dighyp1"
},
{
"kind": "other",
"port": "eth0",
"kind": "server",
"uid": "dighyp2"
},
{
"kind": "other",
"port": "eth0",
"kind": "server",
"uid": "digsed"
},
{
"kind": "other",
"port": "eth0",
"kind": "server",
"uid": "digsed"
},
{
"kind": "other",
"port": "eth0",
"kind": "server",
"uid": "digwatt"
},
{
......@@ -232,7 +227,6 @@
},
{
"kind": "other",
"port": "eth0",
"uid": "renater5"
}
],
......@@ -241,12 +235,6 @@
}
],
"model": "ExtremeNetworks",
"sensors": {
"network": {
"available": true,
"resolution": 1
}
},
"site": "grenoble",
"snmp_community": "public",
"type": "network_equipment",
......
{
"backplane_bps": 36000000000000,
"channels": {
"port-channel1": {
"kind": "router",
"ports": [
"Ethernet1/53",
"Ethernet1/54"
],
"rate": 200000000000,
"uid": "port-channel1"
}
},
"ip": "172.17.47.221",
"kind": "switch",
"linecards": [
{
......@@ -7,7 +19,7 @@
{
"backplane_bps": 36000000000000,
"kavlan_pattern": "Ethernet%LINECARD%/%PORT%",
"kind": "virtual",
"kind": "node",
"ports": [
{
},
......@@ -212,15 +224,13 @@
{
},
{
"aggregation": "lacp",
"kind": "router",
"kind": "channel",
"port": "Ethernet1/52",
"rate": 100000000000,
"uid": "sw-chiclet-2"
},
{
"aggregation": "lacp",
"kind": "router",
"kind": "channel",
"port": "Ethernet1/51",
"rate": 100000000000,
"uid": "sw-chiclet-2"
......@@ -231,12 +241,6 @@
}
],
"model": "cisco 93180YC-EX",
"sensors": {
"network": {
"available": true,
"resolution": 1
}
},
"site": "lille",
"snmp_community": "public",
"type": "network_equipment",
......
{
"backplane_bps": 36000000000000,
"channels": {
"port-channel1": {
"kind": "switch",
"ports": [
"Ethernet1/51",
"Ethernet1/52"
],
"rate": 200000000000,
"uid": "port-channel1"
},
"port-channel2": {
"kind": "switch",
"ports": [
"Ethernet1/53",
"Ethernet1/54"
],
"rate": 200000000000,
"uid": "port-channel1"
}
},
"ip": "172.17.47.222",
"kind": "router",
"linecards": [
{
......@@ -7,8 +28,7 @@
{
"backplane_bps": 36000000000000,
"kavlan_pattern": "Ethernet%LINECARD%/%PORT%",
"kind": "virtual",
"port": "eth0",
"kind": "other",
"ports": [
{
},
......@@ -78,14 +98,13 @@
},
{
"kind": "other",
"port": "eth0",
"uid": "renater5-FON"
},
{
},
{
"kind": "other",
"port": "eth0",
"rate": 1000000000,
"uid": "labo"
},
{
......@@ -119,29 +138,25 @@
{
},
{
"aggregation": "lacp",
"kind": "switch",
"kind": "channel",
"port": "Ethernet1/54",
"rate": 100000000000,
"uid": "sw-chiclet-1"
},
{
"aggregation": "lacp",
"kind": "switch",
"kind": "channel",
"port": "Ethernet1/53",
"rate": 100000000000,
"uid": "sw-chiclet-1"
},
{
"aggregation": "lacp",
"kind": "switch",
"kind": "channel",
"port": "Ethernet1/53",
"rate": 100000000000,
"uid": "sw-chiclet-3"
},
{
"aggregation": "lacp",
"kind": "switch",
"kind": "channel",
"port": "Ethernet1/54",
"rate": 100000000000,
"uid": "sw-chiclet-3"
......@@ -152,12 +167,6 @@
}
],
"model": "cisco 93180YC-EX",
"sensors": {
"network": {
"available": true,
"resolution": 1
}
},
"site": "lille",
"snmp_community": "public",
"type": "network_equipment",
......
{
"backplane_bps": 36000000000000,
"channels": {
"port-channel1": {
"kind": "router",
"ports": [
"Ethernet1/53",
"Ethernet1/54"
],
"rate": 200000000000,
"uid": "port-channel2"
}
},
"ip": "172.17.47.223",
"kind": "switch",
"linecards": [
{
......@@ -7,7 +19,7 @@
{
"backplane_bps": 36000000000000,
"kavlan_pattern": "Ethernet%LINECARD%/%PORT%",
"kind": "virtual",
"kind": "node",
"ports": [
{
},
......@@ -254,15 +266,13 @@
{
},
{
"aggregation": "lacp",
"kind": "router",
"kind": "channel",
"port": "Ethernet1/53",
"rate": 100000000000,
"uid": "sw-chiclet-2"
},
{
"aggregation": "lacp",
"kind": "router",
"kind": "channel",
"port": "Ethernet1/54",
"rate": 100000000000,
"uid": "sw-chiclet-2"
......@@ -273,12 +283,6 @@
}
],
"model": "cisco 93180YC-EX",
"sensors": {
"network": {
"available": true,
"resolution": 1
}
},
"site": "lille",
"snmp_community": "public",
"type": "network_equipment",
......
......@@ -115,7 +115,8 @@
},
{
"kind": "node",
"uid": "node-mapping-undocumented-for-this-ib-switch"
"port": "mapping-undocumented-for-this-ib-switch",
"uid": "node"
}
],
"rate": 20000000000,
......
......@@ -35,11 +35,13 @@
},
{
"kind": "node",
"uid": "grele-13-when-undead"
"port": "when-undead",
"uid": "grele-13"
},
{
"kind": "node",
"uid": "grele-14-when-undead"
"port": "when-undead",
"uid": "grele-14"
}
],
"rate": 100000000000,
......
......@@ -7,10 +7,7 @@ gw:
warranty: expired
backplane_bps: 800000000000
snmp_community: public
sensors:
network:
available: true
resolution: 1
ip: 172.16.31.254
vlans:
"vlan100":
administrative: yes
......@@ -68,7 +65,6 @@ gw:
kavlan_pattern: "%PORT%"
backplane_bps: 48000000000
kind: node
port: eth0
rate: 10000000000
ports:
1: dahu-1
......@@ -109,19 +105,19 @@ gw:
36: yeti-4
41:
uid: dighyp1
kind: other
kind: server
42:
uid: dighyp2
kind: other
kind: server
43:
uid: digsed
kind: other
kind: server
44:
uid: digsed
kind: other
kind: server
45:
uid: digwatt
kind: other
kind: server
48:
uid: renater5
kind: other
......@@ -2,17 +2,14 @@
sw-chiclet-1:
model: cisco 93180YC-EX
warranty: 2021-11-30
ip: 172.17.47.221
kind: switch
site: lille
snmp_community: public
sensors:
network:
available: true
resolution: 1
backplane_bps: 36000000000000
linecards:
1:
kind: virtual
kind: node
snmp_pattern: Ethernet%LINECARD%/%PORT%
kavlan_pattern: Ethernet%LINECARD%/%PORT%
backplane_bps: 36000000000000
......@@ -20,141 +17,83 @@ sw-chiclet-1:
ports:
1:
uid: chifflot-1
port: eth0
kind: node
2:
uid: chifflot-2
port: eth0
kind: node
3:
uid: chifflot-3
port: eth0
kind: node
4:
uid: chifflot-4
port: eth0
kind: node
5:
uid: chifflot-5
port: eth0
kind: node
6:
uid: chifflot-6
port: eth0
kind: node
7:
uid: chifflot-7
port: eth0
kind: node
8:
uid: chifflot-8
port: eth0
kind: node
9:
uid: chiclet-1
port: eth0
kind: node
10:
uid: chiclet-2
port: eth0
kind: node
11:
uid: chiclet-3
port: eth0
kind: node
12:
uid: chiclet-4
port: eth0
kind: node
13:
uid: chiclet-5
port: eth0
kind: node
14:
uid: chiclet-6
port: eth0
kind: node
15:
uid: chiclet-7
port: eth0
kind: node
16:
uid: chiclet-8
port: eth0
kind: node
17:
uid: chifflot-1
port: eth1
kind: node
uid: chifflot-1-eth1
18:
uid: chifflot-2
port: eth1
kind: node
uid: chifflot-2-eth1
19:
uid: chifflot-3
port: eth1
kind: node
uid: chifflot-3-eth1
20:
uid: chifflot-4
port: eth1
kind: node
uid: chifflot-4-eth1
21:
uid: chifflot-5
port: eth1
kind: node
uid: chifflot-5-eth1
22:
uid: chifflot-6
port: eth1
kind: node
uid: chifflot-6-eth1
23:
uid: chifflot-7
port: eth1
kind: node
uid: chifflot-7-eth1
24:
uid: chifflot-8
port: eth1
kind: node
uid: chifflot-8-eth1
25:
uid: chiclet-1
port: eth1
kind: node
uid: chiclet-1-eth1
26:
uid: chiclet-2
port: eth1
kind: node
uid: chiclet-2-eth1
27:
uid: chiclet-3
port: eth1
kind: node
uid: chiclet-3-eth1
28:
uid: chiclet-4
port: eth1
kind: node
uid: chiclet-4-eth1
29:
uid: chiclet-5
port: eth1
kind: node
uid: chiclet-5-eth1
30:
uid: chiclet-6
port: eth1
kind: node
uid: chiclet-6-eth1
31:
uid: chiclet-7
port: eth1
kind: node
uid: chiclet-7-eth1
32:
uid: chiclet-8
port: eth1
kind: node
uid: chiclet-8-eth1
53:
uid: sw-chiclet-2
kind: router
kind: channel
port: Ethernet1/52
aggregation: lacp
rate: 100000000000
54:
uid: sw-chiclet-2
kind: router
kind: channel
port: Ethernet1/51
aggregation: lacp
rate: 100000000000
channels:
port-channel1:
ports:
- Ethernet1/53
- Ethernet1/54
uid: port-channel1
kind: router
rate: 200000000000
......@@ -2,13 +2,10 @@
sw-chiclet-2:
model: cisco 93180YC-EX
warranty: 2021-11-30
ip: 172.17.47.222
kind: router
site: lille
snmp_community: public
sensors:
network:
available: true
resolution: 1
backplane_bps: 36000000000000
vlans:
"vlan100":
......@@ -63,12 +60,11 @@ sw-chiclet-2:
- 10.11.192.0/18
linecards:
1:
kind: virtual
kind: other
snmp_pattern: Ethernet%LINECARD%/%PORT%
kavlan_pattern: Ethernet%LINECARD%/%PORT%
backplane_bps: 36000000000000
rate: 10000000000
port: eth0
ports:
33:
uid: renater5-FON
......@@ -76,27 +72,39 @@ sw-chiclet-2:
35:
uid: labo
kind: other
rate: 1000000000
51:
uid: sw-chiclet-1
kind: switch
kind: channel
port: Ethernet1/54
aggregation: lacp
rate: 100000000000
52:
uid: sw-chiclet-1
kind: switch
kind: channel
port: Ethernet1/53
aggregation: lacp
rate: 100000000000
53:
uid: sw-chiclet-3
kind: switch
kind: channel
port: Ethernet1/53
aggregation: lacp
rate: 100000000000
54:
uid: sw-chiclet-3
kind: switch
kind: channel
port: Ethernet1/54
aggregation: lacp
rate: 100000000000
channels:
port-channel1:
ports:
- Ethernet1/51
- Ethernet1/52
uid: port-channel1
kind: switch
rate: 200000000000
port-channel2:
ports:
- Ethernet1/53
- Ethernet1/54
uid: port-channel1
kind: switch
rate: 200000000000
......@@ -2,17 +2,14 @@
sw-chiclet-3:
model: cisco 93180YC-EX
warranty: 2021-11-30
ip: 172.17.47.223
kind: switch
site: lille
snmp_community: public
sensors:
network:
available: true
resolution: 1
backplane_bps: 36000000000000
linecards:
1:
kind: virtual
kind: node
snmp_pattern: Ethernet%LINECARD%/%PORT%
kavlan_pattern: Ethernet%LINECARD%/%PORT%
backplane_bps: 36000000000000
......@@ -20,197 +17,111 @@ sw-chiclet-3:
ports:
1:
uid: chetemi-1
port: eth0
kind: node
2:
uid: chetemi-2
port: eth0
kind: node
3:
uid: chetemi-3
port: eth0
kind: node
4:
uid: chetemi-4
port: eth0
kind: node
5:
uid: chetemi-5
port: eth0
kind: node
6:
uid: chetemi-6
port: eth0
kind: node
7:
uid: chetemi-7
port: eth0
kind: node
8:
uid: chetemi-8
port: eth0
kind: node
9:
uid: chetemi-9
port: eth0
kind: node
10:
uid: chetemi-10
port: eth0
kind: node
11:
uid: chetemi-11
port: eth0
kind: node
12:
uid: chetemi-12
port: eth0
kind: node
13:
uid: chetemi-13
port: eth0
kind: node
14:
uid: chetemi-14
port: eth0
kind: node
15:
uid: chetemi-15
port: eth0
kind: node
17:
uid: chifflet-1
port: eth0
kind: node
18:
uid: chifflet-2
port: eth0
kind: node
19:
uid: chifflet-3
port: eth0
kind: node
20:
uid: chifflet-4
port: eth0
kind: node
21:
uid: chifflet-5
port: eth0
kind: node
22:
uid: chifflet-6
port: eth0
kind: node
23:
uid: chifflet-7
port: eth0
kind: node
24:
uid: chifflet-8
port: eth0
kind: node
25:
uid: chetemi-1
port: eth1
kind: node
uid: chetemi-1-eth1
26:
uid: chetemi-2
port: eth1
kind: node
uid: chetemi-2-eth1
27:
uid: chetemi-3
port: eth1
kind: node
uid: chetemi-3-eth1
28:
uid: chetemi-4
port: eth1
kind: node
uid: chetemi-4-eth1
29:
uid: chetemi-5
port: eth1
kind: node
uid: chetemi-5-eth1
30:
uid: chetemi-6
port: eth1
kind: node
uid: chetemi-6-eth1
31:
uid: chetemi-7
port: eth1
kind: node
uid: chetemi-7-eth1
32:
uid: chetemi-8
port: eth1
kind: node
uid: chetemi-8-eth1
33:
uid: chetemi-9
port: eth1
kind: node
uid: chetemi-9-eth1
34:
uid: chetemi-10
port: eth1
kind: node
uid: chetemi-10-eth1
35:
uid: chetemi-11
port: eth1
kind: node
uid: chetemi-11-eth1
36:
uid: chetemi-12
port: eth1
kind: node
uid: chetemi-12-eth1
37:
uid: chetemi-13
port: eth1
kind: node
uid: chetemi-13-eth1
38:
uid: chetemi-14
port: eth1
kind: node
uid: chetemi-14-eth1
39:
uid: chetemi-15
port: eth1
kind: node
uid: chetemi-15-eth1
40:
uid: chifflet-1
port: eth1
kind: node
uid: chifflet-1-eth1
41:
uid: chifflet-2
port: eth1
kind: node
uid: chifflet-2-eth1
42:
uid: chifflet-3
port: eth1
kind: node
uid: chifflet-3-eth1
43:
uid: chifflet-4
port: eth1
kind: node
uid: chifflet-4-eth1
44:
uid: chifflet-5
port: eth1
kind: node
uid: chifflet-5-eth1
45:
uid: chifflet-6
port: eth1
kind: node
uid: chifflet-6-eth1
46:
uid: chifflet-7
port: eth1
kind: node
uid: chifflet-7-eth1
47:
uid: chifflet-8
port: eth1
kind: node
uid: chifflet-8-eth1
53:
uid: sw-chiclet-2
kind: router
kind: channel
port: Ethernet1/53
aggregation: lacp
rate: 100000000000
54:
uid: sw-chiclet-2
kind: router
kind: channel
port: Ethernet1/54
aggregation: lacp
rate: 100000000000
channels:
port-channel1:
ports:
- Ethernet1/53
- Ethernet1/54
uid: port-channel2
rate: 200000000000
kind: router
......@@ -7,7 +7,6 @@ require 'refrepo/valid/input/monitoring'
# the interface parameter must be used.
def net_switch_port_lookup(site, node_uid, interface='')
site["networks"].each do |switch_uid, switch|
#pp switch_uid
switch["linecards"].each do |lc_uid,lc|
lc["ports"].each do |port_uid,port|
if port.is_a?(Hash)
......@@ -17,6 +16,11 @@ def net_switch_port_lookup(site, node_uid, interface='')
switch_remote_port = lc["port"] || ""
switch_remote_uid = port
end
if switch_remote_uid =~ /([a-z]*-[0-9]*)-(.*)/
n, p = switch_remote_uid.match(/([a-z]*-[0-9]*)-(.*)/).captures
switch_remote_uid = n
switch_remote_port = p
end
if switch_remote_uid == node_uid and switch_remote_port == interface
# Build port name from snmp_naming_pattern
# Example: '3 2 GigabitEthernet%LINECARD%/%PORT%' -> 'GigabitEthernet3/2'
......@@ -30,7 +34,7 @@ def net_switch_port_lookup(site, node_uid, interface='')
end
# Creation du fichier network_equipment
def create_network_equipment(network_uid, network, refapi_path, site_uid=nil)
def create_network_equipment(network_uid, network, refapi_path, site_uid = nil)
network["type"] = "network_equipment"
network["uid"] = network_uid
......@@ -51,7 +55,7 @@ def create_network_equipment(network_uid, network, refapi_path, site_uid=nil)
network["linecards"].each do |linecard_index, linecard|
ports = []
linecard.delete("ports").each do |port_index, port|
port = {"uid"=>port} if port.is_a? String
port = { "uid"=> port } if port.is_a? String
if port.is_a? Hash
# complete entries (see bug 8587)
if port['port'].nil? and linecard['port']
......@@ -60,10 +64,19 @@ def create_network_equipment(network_uid, network, refapi_path, site_uid=nil)
if port['kind'].nil? and linecard['kind']
port['kind'] = linecard['kind']
end
if ((!linecard['kind'].nil? &&
port['kind'].nil? &&
linecard['kind'] == 'node') ||
port['kind'] == 'node') &&
port['port'].nil?
p = port['uid'].match(/([a-z]*-[0-9]*)-?(.*)/).captures[1]
port['port'] = p != '' ? p : 'eth0'
port['uid'] = port['uid'].gsub(/-#{p}$/, '')
end
end
ports[port_index] = port
end
linecard["ports"] = ports.map{|p| p || {}}
linecard["ports"] = ports.map { |p| p || {} }
linecards_array[linecard_index] = linecard
end
network["linecards"] = linecards_array.map{|l| l || {}}
......
......@@ -8,6 +8,7 @@ alias : optional_array
backplane_bps: optional_integer
mtu: optional_integer
snmp_community: string
ip: optional_string
network_adapters: optional
weathermap:
<optional_hash>:
......@@ -50,3 +51,10 @@ linecards:
port: optional_string
ports:
<multi>: linecard_port #custom linecard port validation (see lib/custom-validators.rb)
channels:
<optional_hash>:
<multi>:
ports: array
uid: string
kind: string
rate: integer
......@@ -87,8 +87,8 @@ def check_network_description(options)
puts "This is an HPC switch. ERRORs will be non-fatal."
oldok = ok
end
eq['linecards'].each do |lc|
(lc['ports'] || []).each do |port|
eq['linecards'].each_with_index do |lc, lc_i|
(lc['ports'] || []).each_with_index do |port, port_i|
# skip if empty port
next if port == {}
......@@ -105,13 +105,35 @@ def check_network_description(options)
mynetnodes = netnodes.select { |n| n.values_at('kind', 'uid') == port.values_at('kind', 'uid') }
if mynetnodes.length == 1
mynetnodes.first['found'] += 1
links << { 'nicknames' => [ eq['uid'], mynetnodes.first['nickname'] ].sort, 'switch' => eq['uid'], 'target' => mynetnodes.first['nickname'], 'rate' => port['rate'] || lc['rate'], 'target_node' => mynetnodes.first['uid'], 'port' => mynetnodes.first['port'] }
links << {
'nicknames' => [ eq['uid'], mynetnodes.first['nickname'] ].sort,
'switch' => eq['uid'],
'target' => mynetnodes.first['nickname'],
'rate' => port['rate'] || lc['rate'],
'target_node' => mynetnodes.first['uid'],
'port' => mynetnodes.first['port']
}
else
puts "ERROR: this port is connected to a switch or router that does not exist: #{port}"
ok = false
end
elsif port['kind'] == 'other' or port['kind'] == 'virtual'
puts "INFO: skipping port kind #{port['kind']} for #{port['uid']}"
elsif port['kind'] == 'channel'
port_to_lookup = lc['snmp_pattern'].gsub(/%LINECARD%/, lc_i.to_s).gsub(/%PORT%/, port_i.to_s)
channel = eq['channels'].select { |k,v|
v['ports'].include?(port_to_lookup)
}.first[1]
if channel['kind'] == 'switch' or channel['kind'] == 'router'
links << {
'nicknames' => [ eq['uid'], port['uid'] ].sort,
'switch' => eq['uid'],
'target' => port['uid'],
'rate' => port['rate'] || lc['rate'],
'target_node' => port['uid'],
'port' => nil
}
end
else
puts "ERROR: unknown port kind: #{port}"
ok = false
......@@ -220,7 +242,7 @@ def generate_dot(netnodes, links, site)
header = []
content = []
trailer = []
header << "graph graphname {"
router = mynetnodes.select { |n| n['kind'] == 'router' }.first['nickname']
header << "root=\"#{router}\";"
......@@ -266,7 +288,7 @@ def generate_dot(netnodes, links, site)
end
end
trailer << "}"
name = "#{site.capitalize}Network"
data = [header, content.sort, trailer].flatten.join("\n")
IO.write("#{name}.dot", data)
......