Commit 6c1560d0 authored by Leigh Stoller's avatar Leigh Stoller

Support for stitch to Lan:

1. A trivial change in GeniCM; only look at the first two interfaces in the
   link if it references an external node. We already depend on the fact
   that the first two interfaces are in the same order as the two stitch
   points in the stitching section, so as long as we ignore external nodes
   after the second interface, setting up the virtual state for a lan works
   just peachy.

2. libvtop_test: a bit less trivial, mostly cause of vlan tag pre
   reservation when stitching. When we encapsulate a lan we build another
   lans table entry that is linked. There is no need to do this when the
   encapsulation is vlan, and in fact I had changed links a long time ago
   to not do this, for the exact same reason. Lans are little bit more
   complicated but I think I got it.
parent f4929aa5
......@@ -2031,6 +2031,7 @@ sub GetTicketAuxAux($$$$$$$$$$)
}
my $edgecount = 0;
my $irefcount = 0;
foreach my $ref (@interfaces) {
my $node_nickname = GeniXML::GetInterfaceNodeId($ref);
......@@ -2040,6 +2041,7 @@ sub GetTicketAuxAux($$$$$$$$$$)
if (! GeniXML::IsVersion0($ref) && defined($iface_id)) {
$node_nickname = $iface2node{$iface_id};
}
$irefcount++;
#
# Look for links that are really lans; one of the interfaces
......@@ -2064,6 +2066,9 @@ sub GetTicketAuxAux($$$$$$$$$$)
# the user has specified something impossible.
#
if (exists($external_nodemap{$node_nickname})) {
next
if ($irefcount > 2);
my $external_noderef = $external_nodemap{$node_nickname};
my $stitchpath = GeniStitch->Lookup($lanname, $rspec);
if (! defined($stitchpath)) {
......
......@@ -6647,7 +6647,7 @@ sub InterpLinksAux($)
#
my $protovlan;
if (1) {
if ($virtlan->_encapstyle() ne "vlan") {
if (exists($protovlans{$lan})) {
$protovlan = $protovlans{$lan};
}
......@@ -6683,8 +6683,8 @@ sub InterpLinksAux($)
return -1
if (!defined($virtiface));
$portA = $virtiface->viface();
$virtiface->_vlanname($protovlan->vname());
$virtiface->_vlanname((defined($protovlan) ?
$protovlan->vname() : $lan));
}
#
# We need to reserve the shared bandwidth.
......@@ -6723,7 +6723,8 @@ sub InterpLinksAux($)
# which case we have to set its link pointer
# to the protovlan.
#
if ($protolan->type() eq "trivial") {
if ($protolan->type() eq "trivial" &&
defined($protovlan)) {
$protolan->SetLink($protovlan);
}
}
......@@ -6733,10 +6734,30 @@ sub InterpLinksAux($)
$self->alloconly(),
$protovlan);
}
$protolan->SetType("emulated");
$protolan->SetRole("link/lan");
$protolan->AddInterface($nodeA, $vnodeA, $vportA, $portA);
if (defined($protovlan)) {
$protolan->SetType("emulated");
$protolan->SetRole("link/lan");
}
else {
$protolan->SetType("vlan");
$protolan->SetRole("emulated");
$protolan->SetAttribute("link/lan", $lan);
if (defined($pathA)) {
my $path = $protolan->GetAttribute("switchpath");
$protolan->SetAttribute("switchpath",
AddToSwitchPath($path, $pathA));
}
}
$protolan->AddInterface($nodeA, $vnodeA, $vportA,
(defined($virtiface) ?
$virtiface->viface() : $portA),
(defined($protovlan) ?
undef : $portA));
# For below.
$portA = $virtiface->viface()
if (defined($virtiface));
#
# If the "lannode" is placed on a node, and that node is
# different than the current node, we have to connect the
......@@ -6748,10 +6769,12 @@ sub InterpLinksAux($)
$member0->_lanport() ne "null" &&
$member0->_lannode() eq $nodeA &&
$member0->_lanport() eq $portA)) {
$protovlan->AddMember($member0->_lannode(),
$member0->_lanport())
if (!$protovlan->IsMember($member0->_lannode(),
$member0->_lanport()));
my $plan = $protovlan || $protolan;
$plan->AddMember($member0->_lannode(),
$member0->_lanport())
if (!$plan->IsMember($member0->_lannode(),
$member0->_lanport()));
$self->AddVirtPatch($lan,
$member0->_lannode(),
$member0->_lanport());
......
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