Mentions légales du service

Skip to content
Snippets Groups Projects
Commit bffdd034 authored by Philippe Virouleau's avatar Philippe Virouleau Committed by POUILLOUX Laurent
Browse files

[valid:network] Consider all linecards for connection

parent 6ab80f90
Branches
No related tags found
1 merge request!680Consider all linecards when validating connection between equipments
Pipeline #948985 passed
...@@ -156,10 +156,13 @@ def check_network_description(options) ...@@ -156,10 +156,13 @@ def check_network_description(options)
puts "INFO: skipping channel for #{channel['kind']} #{port['uid']}" puts "INFO: skipping channel for #{channel['kind']} #{port['uid']}"
elsif channel && ['switch','router'].include?(channel['kind']) elsif channel && ['switch','router'].include?(channel['kind'])
channel_ports = eq['linecards'].reject { |i| i == {} }.map do |i| select_ports = -> (linecards, uid) do
i['ports'].reject { |j| j == {} } linecards.map do |l|
.select { |k| k['uid'] == port['uid'] } l['ports']&.select { |p| p['uid'] == uid }
end.reject { |i| i == [] }.first end.flatten.compact
end
channel_ports = select_ports.call(eq['linecards'], port['uid'])
# Check that port of kind channel is referencing a port of type channel # Check that port of kind channel is referencing a port of type channel
# only if the channel is connected to router/switch # only if the channel is connected to router/switch
...@@ -171,10 +174,7 @@ def check_network_description(options) ...@@ -171,10 +174,7 @@ def check_network_description(options)
next next
end end
connected_to = connected_to['linecards'].reject { |i| i == {} }.map do |i| connected_to = select_ports.call(connected_to['linecards'], channel['port'])
i['ports'].reject { |j| j == {} }
.select { |k| k['uid'] == channel['port'] }
end.reject { |i| i == [] }.first
if connected_to.length == 0 if connected_to.length == 0
puts "ERROR: port #{port_to_lookup} on #{eq['uid']} is not connected to an endpoint" puts "ERROR: port #{port_to_lookup} on #{eq['uid']} is not connected to an endpoint"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment