Commit 6c17edfe authored by Robert Ricci's avatar Robert Ricci

Add a long-needed feature that prints the device-specific VLAN number,

in addition to the testbed VLAN id.
parent 8a7d4c1e
...@@ -65,6 +65,7 @@ VLAN Control: ...@@ -65,6 +65,7 @@ VLAN Control:
-t <pid> <eid> Create all VLANs from database tables for an experiment -t <pid> <eid> Create all VLANs from database tables for an experiment
-r <pid> <eid> Remove all VLANs from database tables for an experiment -r <pid> <eid> Remove all VLANs from database tables for an experiment
-l List all VLANs -l List all VLANs
-w Used with -l, includes device-specific VLAN number
-m <name> [ports] Create a new VLAN with name <name>, if it doesn't exist, -m <name> [ports] Create a new VLAN with name <name>, if it doesn't exist,
and put [ports] in it and put [ports] in it
-y <type> When used with -m, the new VLAN becomes a private VLAN -y <type> When used with -m, the new VLAN becomes a private VLAN
...@@ -97,7 +98,7 @@ END ...@@ -97,7 +98,7 @@ END
my %opt = (); my %opt = ();
GetOptions(\%opt, 'a','c','d','e','g','h','i=s@','l','m=s@','n','o=s@','p=s', GetOptions(\%opt, 'a','c','d','e','g','h','i=s@','l','m=s@','n','o=s@','p=s',
'r','s','t','u=s','v','y=s','x=s','z=s'); 'r','s','t','u=s','v','w','y=s','x=s','z=s');
# Unused: b,f,j,q,w # Unused: b,f,j,q,w
if ($opt{h}) { if ($opt{h}) {
...@@ -527,10 +528,10 @@ sub doListVlans ($) { ...@@ -527,10 +528,10 @@ sub doListVlans ($) {
# the results from each stack, based on the VLAN identifier # the results from each stack, based on the VLAN identifier
# #
foreach my $stack (@$stacks) { foreach my $stack (@$stacks) {
# TODO: Add a way to print ddep
my @vlanList = $stack->listVlans(); my @vlanList = $stack->listVlans();
foreach my $vlan (@vlanList) { foreach my $vlan (@vlanList) {
my ($id,$ddep,$memberref) = @$vlan; my ($id,$ddep,$memberref) = @$vlan;
${$vlans{$id}}[0] = $ddep;
push @{${$vlans{$id}}[1]}, @$memberref; push @{${$vlans{$id}}[1]}, @$memberref;
} }
} }
...@@ -539,21 +540,40 @@ sub doListVlans ($) { ...@@ -539,21 +540,40 @@ sub doListVlans ($) {
# These need to be declared here for the benefit of the format string # These need to be declared here for the benefit of the format string
# See perlform(1) for help with formats # See perlform(1) for help with formats
# #
my ($vlan_id,$pideid,$vname,$members); my ($vlan_id,$ddep,$pideid,$vname,$members);
print << "END"; #
# Check to see if they want device-specific VLAN numbers, which makes the
# display more cramped, but is useful for debugging
#
if (!$opt{w}) {
print << "END";
VLAN Project/Experiment VName Members VLAN Project/Experiment VName Members
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
END END
format vlanlist = format vlanlist =
@<<<<<<< @<<<<<<<<<<<<<<<<< @<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<< @<<<<<<<<<<<<<<<<< @<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$vlan_id,$pideid, $vname, $members $vlan_id,$pideid, $vname, $members
~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$members $members
. .
$FORMAT_NAME = 'vlanlist';
} else {
print << "END";
VLAN Number Project/Experiment VName Members
--------------------------------------------------------------------------------
END
format vlanlist2 =
@<<<<<<< @<<<<< @<<<<<<<<<<<<<<<<< @<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$vlan_id,$ddep, $pideid, $vname, $members
~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$members
.
$FORMAT_NAME = 'vlanlist2';
}
$FORMAT_NAME = 'vlanlist';
foreach $vlan_id (sort {tbsort($a,$b)} keys %vlans) { foreach $vlan_id (sort {tbsort($a,$b)} keys %vlans) {
my ($ddep,$memberref) = @{$vlans{$vlan_id}}; my $memberref;
($ddep,$memberref) = @{$vlans{$vlan_id}};
# #
# Find which, if any, experiment this VLAN belongs to. # Find which, if any, experiment this VLAN belongs to.
......
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