Commit 71812015 authored by Leigh Stoller's avatar Leigh Stoller

Library functions to set/clr the enabled/tagged bits in the new

interface_state table.
parent 0a004176
......@@ -27,6 +27,7 @@ use Exporter;
getExperimentControlPorts
snmpitSet snmpitSetWarn snmpitSetFatal
snmpitBulkwalk snmpitBulkwalkWarn snmpitBulkwalkFatal
setPortEnabled setPortTagged
printVars tbsort );
use English;
......@@ -177,7 +178,8 @@ sub getVlanPorts (@) {
}
#
# Returns an an array of trunked ports (in node:card form) used by an experiment
# Returns an an array of trunked ports (in node:card form) used by an
# experiment
#
sub getExperimentTrunks($$) {
my ($pid, $eid) = @_;
......@@ -218,6 +220,33 @@ sub setVlanTag ($$) {
return 0;
}
#
# Update database to mark port as enabled or disabled.
#
sub setPortEnabled($$) {
my ($port, $enabled) = @_;
$port =~ /^(.+):(\d+)$/;
my ($node, $card) = ($1, $2);
$enabled = ($enabled ? 1 : 0);
DBQueryFatal("update interface_state set enabled=$enabled ".
"where node_id='$node' and card='$card'");
return 0;
}
# Ditto for trunked.
sub setPortTagged($$) {
my ($port, $tagged) = @_;
$port =~ /^(.+):(\d+)$/;
my ($node, $card) = ($1, $2);
$tagged = ($tagged ? 1 : 0);
DBQueryFatal("update interface_state set tagged=$tagged ".
"where node_id='$node' and card='$card'");
}
#
# Convert an entire list of ports in port:iface format to into port:card -
# returns other port forms unchanged.
......
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