Commit c11e0589 authored by Keith Sklower's avatar Keith Sklower

Necesssary and sufficient changes for DETER to find the control mac

addresses on HP switches, including ones which have both control and
Experiment ports.
parent 02fd1bcd
......@@ -1683,7 +1683,9 @@ sub readifIndex($) {
}
foreach $j (keys %{$self->{TRUNKS}}) {
$ifindex = $j + $t_off;
$port = "1." . $ifindex;
if (my $lref = $self->{TRUNKS}{$j}) {
$port = $self->{IFINDEX}{@$lref[0]}; #actually modport
} else { $port = "1." . $ifindex; } # the else should never happen
$self->{IFINDEX}{$ifindex} = $port;
$self->{IFINDEX}{$port} = $ifindex;
$self->{TRUNKINDEX}{$ifindex} = 0; # simplifies convertPortIndex
......
......@@ -1721,7 +1721,9 @@ sub readifIndex($) {
}
foreach $j (keys %{$self->{TRUNKS}}) {
$ifindex = $j + $t_off;
$port = "1." . $ifindex;
if (my $lref = $self->{TRUNKS}{$j}) {
$port = $self->{IFINDEX}{@$lref[0]}; #actually modport
} else { $port = "1." . $ifindex; } # the else should never happen
$self->{IFINDEX}{$ifindex} = $port;
$self->{IFINDEX}{$port} = $ifindex;
$self->{TRUNKINDEX}{$ifindex} = 0; # simplifies convertPortIndex
......
......@@ -190,7 +190,7 @@ SWITCH:
$switchtype = "intel"; last;};
(/^nortel/) && do { $snmpversion = "1"; $useindexing = 0;
$switchtype = "nortel"; last;};
(/^hp/) && do { $snmpversion = "1"; $useindexing = 0;
(/^hp/) && do { $snmpversion = "2c"; $useindexing = 0;
$switchtype = "hp"; last;};
(/^foundry/) && do { $snmpversion = "1"; $useindexing = 0;
$switchtype = "foundry"; last;};
......
......@@ -36,22 +36,20 @@ function find_switch_macs(&$mac_list) {
$class = $exploded[4];
if (!preg_match("/^([\w-]+)\/(\d+)\.(\d+)$/",$switchport,$matches)) {
echo "<h3>Bad line from switchmac: $line</h3>\n";
}
$switch = $matches[1];
$card = $matches[2];
$port = $matches[3];
if (isset($mac_list[$MAC]) &&
(is_null($mac_list[$MAC]["class"]) ||
!isset($mac_list[$MAC]["class"]) ||
($mac_list[$MAC]["class"] == $class))) {
$mac_list[$MAC]["switch"] = $switch;
$mac_list[$MAC]["switch_card"] = $card;
$mac_list[$MAC]["switch_port"] = $port;
if ($ELABINELAB) {
# We let switchmac tell us.
$mac_list[$MAC]["class"] = $class;
# Need this to reorder the interfaces.
$mac_list[$MAC]["iface"] = $iface;
} else {
$switch = $matches[1];
$card = $matches[2];
$port = $matches[3];
if (isset($mac_list[$MAC]) ) {
$mac_list[$MAC]["switch"] = $switch;
$mac_list[$MAC]["switch_card"] = $card;
$mac_list[$MAC]["switch_port"] = $port;
if ($ELABINELAB) {
# We let switchmac tell us.
$mac_list[$MAC]["class"] = $class;
# Need this to reorder the interfaces.
$mac_list[$MAC]["iface"] = $iface;
}
}
}
$line = fgets($macs);
......
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