29 1.02 KB
Newer Older
1 2 3 4 5 6
#
# Create new holding experiment for openflow vlans
#
use strict;
use libinstall;
use emdb;
7 8
use Experiment;
use EmulabConstants;
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34

my $EID       = "openflow-vlans";
my $DESC      = "Holding experiment for static openflow vlans";
my $SUDO      = "/usr/local/bin/sudo";
my $BATCHEXP  = "$TBROOT/bin/batchexp";

sub InstallUpdate($$)
{
    my ($version, $phase) = @_;
    my $pid  = "emulab-ops";


    if ($phase eq "pre") {
	#
	# Holding experiment.
	#
	Phase "experiment", "Creating openflow vlan holding experiment", sub {
	    PhaseSkip("Experiment exists")
		if (-d "$PROJROOT/$pid/exp/$EID");
	
	    ExecQuietFatal("$SUDO -u $PROTOUSER $WAP $BATCHEXP ".
			   "  -q -i -k -j -w -f -n ".
			   "  -S 'System Experiment' ".
			   "  -L 'System Experiment' ".
			   "  -E '$DESC - DO NOT DELETE' ".
			   "  -p $pid -e $EID");
35

Leigh B Stoller's avatar
Leigh B Stoller committed
36
	    my $experiment = Experiment->Lookup($PID, $EID);
37 38 39
	    if ($experiment) {
		$experiment->SetState(EXPTSTATE_ACTIVE());
	    }
40 41 42 43 44 45 46 47 48 49 50
	    PhaseSucceed();
	};
    }
    return 0;
}

1;

# Local Variables:
# mode:perl
# End: