Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
27aea9a2
Commit
27aea9a2
authored
Aug 06, 2008
by
Robert Ricci
Browse files
Add a special case for Cisco 29xx switches, which skip one of the layers
of indirection. Also add a little bit more debugging information.
parent
fac4826c
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/switchmac.in
View file @
27aea9a2
...
...
@@ -157,10 +157,14 @@ foreach my $switchref (@switches) {
#
my
$type
=
getDeviceType
(
$switch
);
my
(
$snmpversion
,
$useindexing
,
$switchtype
);
my
$cisco_29xx
=
0
;
SWITCH:
for
(
$type
)
{
(
/^cisco/
||
/^catalyst/
)
&&
do
{
$snmpversion
=
"
2c
";
$useindexing
=
1
;
$switchtype
=
"
cisco
";
last
;};
(
/^cisco/
||
/^catalyst/
)
&&
do
{
$snmpversion
=
"
2c
";
$useindexing
=
1
;
$switchtype
=
"
cisco
";
if
(
$type
=~
/29\d\d/
)
{
DEBUG
"
Cisco 29xx
\n
";
$cisco_29xx
=
1
;
}
last
;
};
(
/^intel/
)
&&
do
{
$snmpversion
=
"
1
";
$useindexing
=
0
;
$switchtype
=
"
intel
";
last
;};
(
/^nortel/
)
&&
do
{
$snmpversion
=
"
1
";
$useindexing
=
0
;
...
...
@@ -355,7 +359,17 @@ SWITCH:
#
foreach
my
$index
(
keys
%bridgeports
)
{
my
$bridgeport
=
$bridgeports
{
$index
};
my
$ifIndex
=
$ifIndexMap
{
$bridgeport
};
#
# Funny special case for cisco 29xx series - it doesn't need
# to go throug the map!
#
my
$ifIndex
;
if
(
$cisco_29xx
)
{
$ifIndex
=
$bridgeport
;
}
else
{
$ifIndex
=
$ifIndexMap
{
$bridgeport
};
}
if
(
!
$ifIndex
)
{
DEBUG
"
ifIndex conversion failed for
$bridgeport
!
\n
";
next
;
...
...
@@ -395,20 +409,29 @@ SWITCH:
# off-switch (eg. a trunk port)
#
DEBUG
"
printing for index
$index
\n
";
next
unless
(
$status
{
$index
}
&&
(
$status
{
$index
}
eq
"
learned
"
||
$status
{
$index
}
eq
"
3
"));
if
(
!
(
$status
{
$index
}
&&
(
$status
{
$index
}
eq
"
learned
"
||
$status
{
$index
}
eq
"
3
")))
{
DEBUG
"
Skipping MAC that wasn't learned
\n
";
next
;
}
#
# As far as I can tell, this is a bug with (at least some versions
# of) CatOS - we sometimes get back MACs that are not even in
# this vlan, and those end up with an empty $realport
#
next
if
((
!
$realports
{
$index
})
||
(
$realports
{
$index
}
=~
/ifIndex/
));
if
((
!
$realports
{
$index
})
||
(
$realports
{
$index
}
=~
/ifIndex/
))
{
DEBUG
"
Skipping MAC with bad realport (
$realports
{
$index
})
\n
";
next
;
}
#
# Skip ports that belong to known trunks - we only want to learn
# about nodes that are directly connected to each switch
#
next
if
(
$trunks
{
$realports
{
$index
}});
if
(
$trunks
{
$realports
{
$index
}})
{
DEBUG
"
Skipping MAC on a trunk
\n
";
next
;
}
print
"
$MACs
{
$index
},
$realports
{
$index
},
$vlan_number
,
"
.
"
$interfaces
{
$index
},
$class_str
\n
";
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment