Commit c08aa00d authored by Leigh B Stoller's avatar Leigh B Stoller

When changing a shared vlan membership, store the new switch path in the

lans table entry so we have it easily available.
parent 3c816ec0
......@@ -2764,6 +2764,23 @@ sub syncVlansFromTables($$@) {
goto bad;
}
}
#
#
#
foreach my $vlan (values(%expvlans)) {
next
if (!$vlan->IsShared());
my $switchpath = getSwitchTrunkPath($vlan);
debug("Storing switch trunk path for $vlan: $switchpath\n");
next
if ($impotent);
# Useful info, currently goes into Geni manifest. Needs to
# be updated as the lan changes with each experiment using it.
$vlan->SetAttribute("switchtrunks", $switchpath, "string");
}
return 0;
bad:
......
......@@ -65,7 +65,8 @@ $PORT_FORMAT_PORTINDEX= 5;
convertPortFromString convertPortsFromStrings
mapVlansToSwitches mapStaleVlansToSwitches
getTrunksForVlan getExperimentTrunksForVlan
setSwitchTrunkPath mapPortsToSwitches findAndDumpLan
getSwitchTrunkPath setSwitchTrunkPath
mapPortsToSwitches findAndDumpLan
$PORT_FORMAT_IFINDEX $PORT_FORMAT_MODPORT
$PORT_FORMAT_NODEPORT $PORT_FORMAT_PORT $PORT_FORMAT_PORTINDEX
);
......@@ -1558,7 +1559,7 @@ sub mapPortsToSwitches(@)
#
#
#
sub setSwitchTrunkPath($)
sub getSwitchTrunkPath($)
{
my ($vlan) = @_;
my %switches = ();
......@@ -1566,9 +1567,15 @@ sub setSwitchTrunkPath($)
my @ports = getVlanPorts($vlan->lanid());
my %map = mapPortsToDevices(@ports);
my @trunks = getTrunksForVlan($vlan->lanid(), keys(%map));
my $path = join(" ", map { join(":", @$_) } @trunks);
return $vlan->SetSwitchPath($path);
return join(" ", map { join(":", @$_) } @trunks);
}
sub setSwitchTrunkPath($)
{
my ($vlan) = @_;
return $vlan->SetSwitchPath(getSwitchTrunkPath($vlan));
}
#
......
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