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

Implement my part of #64; ability to specify no interswitch links via this

rspec syntax in the link element: <emulab:interswitch allow="false"/>
parent b3b51a1f
......@@ -2116,6 +2116,8 @@ sub GetTicketAuxAux($$$$$$$$$$$)
if (GeniXML::HasBestEffortSetting($linkref)) {
$besteffort = 1;
}
# Ditto for new direct link option.
my $nointerswitch = GeniXML::NoInterSwitch($linkref);
#
# Look for general link attributes. We cannot use the
......@@ -2520,6 +2522,7 @@ sub GetTicketAuxAux($$$$$$$$$$$)
"trivial_ok" => $trivial_ok,
"emulated" => $emulated,
"nobwshaping" => $besteffort,
"nointerswitch" => $nointerswitch,
"ip" => $ip,
"delay" => $latency,
"bandwidth" => $bandwidth, # kbps
......
#!/usr/bin/perl -w
#
# Copyright (c) 2010-2015 University of Utah and the Flux Group.
# Copyright (c) 2010-2016 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
......@@ -1029,6 +1029,19 @@ sub HasMultiplexSetting($)
return scalar(@tmp);
}
sub NoInterSwitch($)
{
my ($link) = @_;
my $result = 0;
my @tmp = FindNodesNS("n:interswitch", $link,
$EMULAB_NS)->get_nodelist();
if (scalar(@tmp) > 0) {
my $allow = GetText("allow", $tmp[0]);
$result = (defined($allow) && $allow eq "false" ? 1 : 0);
}
return $result;
}
sub HasBestEffortSetting($)
{
my ($link) = @_;
......
......@@ -1840,6 +1840,7 @@ sub LoadVirtLans($)
my $isemulated = $vlanmember->emulated();
my $uselinkdelay = $vlanmember->uselinkdelay();
my $nobwshaping = $vlanmember->nobwshaping();
my $nointerswitch = $vlanmember->nointerswitch();
my $trivial_ok = $vlanmember->trivial_ok();
my $protocol = $vlanmember->protocol();
my $mustdelay = $vlanmember->mustdelay();
......@@ -1876,6 +1877,7 @@ sub LoadVirtLans($)
$virtlan->_encapstyle($encap);
# User has said that colocating is okay. Not typical.
$virtlan->_trivial_ok($trivial_ok);
$virtlan->_nointerswitch($nointerswitch);
# Link is connected to a remote node, and gets a tunnel.
$virtlan->_tunnel(0);
# Netmask for the entire lan.
......@@ -2743,6 +2745,7 @@ sub GenVirtLans($)
my $uselinkdelay = $vlan->_uselinkdelay();
my $mustdelay = $vlan->_mustdelay();
my $nobwshaping = $vlan->_nobwshaping();
my $nointerswitch= $vlan->_nointerswitch();
my $protocol = $vlan->_protocol();
my $linkencap = $vlan->_encapstyle();
my $layer = $vlan->_layer();
......@@ -2894,7 +2897,7 @@ sub GenVirtLans($)
# Just a wire.
#
if ($layer == 1 &&
($trivial_ok || $emulated || $uselinkdelay ||
($trivial_ok || $emulated || $uselinkdelay || $nointerswitch ||
$mustdelay || $nobwshaping || $sharednodes || $simnodes)) {
tberror("$vname is a layer 1 link, no options please.\n");
return -1;
......@@ -3481,6 +3484,9 @@ sub GenVirtLans($)
if ($trivial_ok) {
$others->{'trivial_ok'} = 1;
}
if ($nointerswitch) {
$others->{'nointerswitch'} = 1;
}
#
# If the virtnode is a VM and it has been fixed to
# a topology node, then we have to use that node
......@@ -3625,6 +3631,9 @@ sub GenVirtLans($)
$rdelay,$rbw,$rbackfill,$rloss,1.000000];
}
}
if ($nointerswitch) {
$others->{'nointerswitch'} = 1;
}
if (defined($vlan->_implemented_by())) {
#
# We post pass these links. Save.
......@@ -3817,6 +3826,9 @@ sub GenVirtLans($)
if ($trivial_ok) {
$others->{'trivial_ok'} = 1;
}
if ($nointerswitch) {
$others->{'nointerswitch'} = 1;
}
#
# If the virtnode is a VM and it has been fixed to
# a topology node, then we have to use that node
......@@ -3922,6 +3934,9 @@ sub GenVirtLans($)
if ($trivial_ok) {
$others->{'trivial_ok'} = 1;
}
if ($nointerswitch) {
$others->{'nointerswitch'} = 1;
}
#
# If the virtnode is a VM and it has been fixed to
# a topology node, then we have to use that node
......@@ -4040,6 +4055,9 @@ sub PrintTop($;$)
if (exists($link->{'trivial_ok'})) {
$output .= 'trivial_ok' . ' ';
}
if (exists($link->{'nointerswitch'})) {
$output .= 'no_interswitch' . ' ';
}
if (exists($link->{'interface_ref'}->[0]->{'virtual_interface_id'})) {
my $if1 = $link->{'interface_ref'}->[0]->{'virtual_interface_id'};
if (exists($fixedifaces{$if1})) {
......
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