Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
f28266fa
Commit
f28266fa
authored
May 26, 2005
by
Robert Ricci
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a new function, getTrunkHash(), that returns a hash of all known
trunks for convenient checking against.
parent
5afef257
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
tbsetup/snmpit_lib.pm
tbsetup/snmpit_lib.pm
+24
-1
No files found.
tbsetup/snmpit_lib.pm
View file @
f28266fa
#!/usr/bin/perl -w
#
# EMULAB-LGPL
# Copyright (c) 2000-200
4
University of Utah and the Flux Group.
# Copyright (c) 2000-200
5
University of Utah and the Flux Group.
# All rights reserved.
#
...
...
@@ -21,6 +21,7 @@ use Exporter;
getSwitchStacks
getStackType getStackLeader
getDeviceOptions getTrunks getTrunksFromSwitches
getTrunkHash
getExperimentPorts snmpitGet snmpitGetWarn snmpitGetFatal
snmpitSet snmpitSetWarn snmpitSetFatal snmpitWarn snmpitFatal
printVars tbsort )
;
...
...
@@ -684,6 +685,28 @@ sub getTrunksFromSwitches($@) {
}
#
# Make a hash of all trunk ports for easy checking - the keys into the hash are
# in the form "switch/mod.port" - the contents are 1 if the port belongs to a
# trunk, and undef if not
#
# ('cisco1' => { 'cisco3' => ['1.1','1.2'] },
# 'cisco3' => { 'cisco1' => ['2.1','2.2'] } )
#
sub
getTrunkHash
()
{
my
%trunks
=
getTrunks
();
my
%trunkhash
=
();
foreach
my
$switch1
(
keys
%trunks
)
{
foreach
my
$switch2
(
keys
%
{
$trunks
{
$switch1
}})
{
foreach
my
$port
(
@
{
$trunks
{
$switch1
}{
$switch2
}})
{
my
$portstr
=
"
$switch1
/
$port
";
$trunkhash
{
$portstr
}
=
1
;
}
}
}
return
%trunkhash
;
}
#
# Execute and SNMP command, retrying in case there are transient errors.
#
...
...
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