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
a8080999
Commit
a8080999
authored
Dec 18, 2000
by
Christopher Alfeld
Browse files
Replaced by resetvlans.pl
parent
13ee7a18
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/resetvlans.tcl
deleted
100755 → 0
View file @
13ee7a18
#!/usr/local/bin/tclsh
# This takes a list of machine names and removes all VLANs containing
# only a subset of those machines.
set snmpit
[
file dirname
[
info script
]]
/snmpit
if
{[
catch
"open
\"
|
$snmpit
-l
\"
r"
vlanFp
]}
{
puts stderr
"Error running
$snmpit
-l (
$vlan
Fp)"
exit 1
}
foreach arg $argv
{
set machines
(
$arg
)
{}
}
set toremove
{}
while
{[
gets $vlanFp line
]
>= 0
}
{
set id
[
lindex $line 0
]
if
{
!
[
regexp
{[
0-9
]
+
}
$id
]}
{
continue
}
if
{[
lindex $line 1
]
==
"Control"
}
{
continue
}
if
{[
lindex $line 1
]
==
"System"
}
{
continue
}
set remove 1
foreach member
[
lrange $line 2 end
]
{
set mname
[
lindex
[
split $member :
]
0
]
if
{
!
[
info exists machines
(
$mname
)]}
{
set remove 0
break
}
}
if
{
$remove
== 1
}
{
lappend toremove $id
}
}
puts
"Removing VLANs:
$toremove
"
if
{
$toremove
!=
{}}
{
if
{[
catch
"exec
$snmpit
-debug -u -r
$toremove
>@ stdout 2>@ stderr"
err
]}
{
puts stderr
"Error running
$snmpit
-u -r (
$err
)"
exit 1
}
}
puts
"VLANs removed."
Write
Preview
Supports
Markdown
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