Commit 307f2285 authored by Leigh Stoller's avatar Leigh Stoller

Replace firewall port with iface, snmpit just as happy with node:iface.

parent 867f04b2
......@@ -3253,19 +3253,19 @@ sub IsFirewalled($;$$$)
}
#
# Get the firewall node name and port number for an experiment;
# Get the firewall node name and iface for an experiment;
# e.g., for use in an snmpit call.
# Return 1 if successful, 0 on error.
#
sub FirewallAndPort($$$)
sub FirewallAndIface($$$)
{
my ($self, $fwnodep, $fwportp) = @_;
my ($self, $fwnodep, $fwifacep) = @_;
# Must be a real reference.
return -1
if (! ref($self));
TBExptFirewallAndPort($self->pid(), $self->eid(), $fwnodep, $fwportp)
TBExptFirewallAndPort($self->pid(), $self->eid(), $fwnodep, $fwifacep)
or return -1;
return 0;
}
......
#!/usr/bin/perl -w
#
# Copyright (c) 2009-2014 University of Utah and the Flux Group.
# Copyright (c) 2009-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -541,14 +541,14 @@ done:
my $op;
if ($doall) {
my $fwport;
if ($experiment->FirewallAndPort(\$fwnode, \$fwport) != 0 ||
system("$SNMPIT -d ${fwnode}:${fwport}") != 0) {
my $fwiface;
if ($experiment->FirewallAndIface(\$fwnode, \$fwiface) != 0 ||
system("$SNMPIT -d ${fwnode}:${fwiface}") != 0) {
push(@fwstate,
"Firewall cnet interface ${fwnode}:${fwport} NOT disabled");
"Firewall cnet interface ${fwnode}:${fwiface} NOT disabled");
} else {
push(@fwstate,
"Firewall cnet interface ${fwnode}:${fwport} disabled");
"Firewall cnet interface ${fwnode}:${fwiface} disabled");
}
$experiment->SetPanicBit(2);
$op = "Swapout";
......@@ -600,9 +600,9 @@ sub Panic($$$)
my $eid = $experiment->eid();
my $firewalled = $experiment->IsFirewalled();
my ($firewall, $port);
my ($firewall, $iface);
if ($firewalled) {
if ($experiment->FirewallAndPort(\$firewall, \$port) != 0) {
if ($experiment->FirewallAndIface(\$firewall, \$iface) != 0) {
print STDERR "Could not determine firewall port for $experiment\n";
return -1;
}
......@@ -728,7 +728,7 @@ sub Panic($$$)
else {
print "Enabling the control network ...\n";
if ($firewalled) {
system("$SNMPIT -e ${firewall}:${port}");
system("$SNMPIT -e ${firewall}:${iface}");
}
else {
system("$SNMPIT -R $pid $eid");
......@@ -779,7 +779,7 @@ sub Panic($$$)
level2:
print "Disabling the control network ...\n";
if ($firewalled) {
system("$SNMPIT -d ${firewall}:${port}");
system("$SNMPIT -d ${firewall}:${iface}");
}
else {
system("$SNMPIT -D $pid $eid");
......
......@@ -65,7 +65,7 @@ use vars qw(@ISA @EXPORT);
TBExptIsElabInElab TBExptIsPlabInElab
TBExptPlabInElabPLC TBExptPlabInElabNodes
TBBatchUnLockExp TBExptIsBatchExp
TBExptFirewall TBNodeFirewall TBExptFirewallAndPort
TBExptFirewall TBNodeFirewall TBExptFirewallAndIface
TBSetExptFirewallVlan TBClearExptFirewallVlan
TBNodeConsoleTail TBExptGetSwapoutAction TBExptGetSwapState
TBNodeSubNodes
......@@ -2196,27 +2196,26 @@ sub TBExptFirewall ($$;$$$$) {
}
#
# Get the firewall node name and port number for an experiment;
# Get the firewall node name and iface for an experiment;
# e.g., for use in an snmpit call.
# Return 1 if successful, 0 on error.
#
sub TBExptFirewallAndPort($$$$) {
my ($pid, $eid, $fwnodep, $fwportp) = @_;
sub TBExptFirewallAndIface($$$$) {
my ($pid, $eid, $fwnodep, $fwifacep) = @_;
my $fwnode;
require Interface;
if (!TBExptFirewall($pid, $eid, \$fwnode)) {
return 0;
}
my $query_result =
DBQueryWarn("select card1 from wires ".
"where node_id1='$fwnode' AND type='Control'");
if (!$query_result || !$query_result->numrows) {
my $interface = Interface->LookupControl($fwnode);
if (!defined($interface)) {
print STDERR "*** Could not lookup control interface for $fwnode\n";
return 0;
}
$$fwnodep = $fwnode;
($$fwportp) = $query_result->fetchrow_array();
($$fwifacep) = $interface->iface();
return 1;
}
......
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