Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit ce39340e authored by RINGOT Patrice's avatar RINGOT Patrice

Merge branch 'kavlan_pattern' into 'master'

[kavlang5k.rb] allow kavlan pattern to be given at the port level

See merge request !160
parents 25c73d8b 01480990
Pipeline #200736 passed with stages
in 7 minutes and 47 seconds
......@@ -4,9 +4,11 @@ def kavlan_switch_port_lookup(switch, node_uid, interface='')
switch["linecards"].each_with_index do |lc, lc_uid|
next if not lc["ports"]
lc["ports"].each_with_index do |port, port_uid|
pattern_source = lc
if port.is_a?(Hash)
switch_remote_port = port["port"] || lc["port"] || ""
switch_remote_uid = port["uid"]
pattern_source = port if port.has_key?('snmp_pattern') or port.has_key?('kavlan_pattern')
else
switch_remote_port = lc["port"] || ""
switch_remote_uid = port
......@@ -15,7 +17,7 @@ def kavlan_switch_port_lookup(switch, node_uid, interface='')
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'
pattern = lc.has_key?("kavlan_pattern") ? lc["kavlan_pattern"] : lc["snmp_pattern"]
pattern = pattern_source.has_key?("kavlan_pattern") ? pattern_source["kavlan_pattern"] : pattern_source["snmp_pattern"]
port_name = pattern.sub("%LINECARD%",lc_uid.to_s).sub("%PORT%",port_uid.to_s)
return port_name
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment