Commit 932b7d30 authored by Leigh B Stoller's avatar Leigh B Stoller

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents 45c95b84 a78357c4
...@@ -64,7 +64,7 @@ notifications. The system defined fields include: ...@@ -64,7 +64,7 @@ notifications. The system defined fields include:
typedef struct { typedef struct {
char *site; /* Which Emulab site. */ char *site; /* Which Emulab site. */
char *expt; /* Project and experiment IDs */ char *expt; /* Project and experiment IDs */
char *group; /* User defined group of nodes */ char *group; /* Deprecated */
char *host; /* A specific host (ipaddr) */ char *host; /* A specific host (ipaddr) */
char *objtype; /* LINK, TRAFGEN, etc ... */ char *objtype; /* LINK, TRAFGEN, etc ... */
char *objname; /* link0, cbr0, cbr1, etc ... */ char *objname; /* link0, cbr0, cbr1, etc ... */
...@@ -72,6 +72,12 @@ notifications. The system defined fields include: ...@@ -72,6 +72,12 @@ notifications. The system defined fields include:
int scheduler; /* A dynamic event to schedule */ int scheduler; /* A dynamic event to schedule */
} address_tuple; } address_tuple;
Important Note: Event groups are *not* implemented by the group field
in the tuple. Rather, they are implemented by adding names to the
objname field treating it as a comma-delimited field. Since names are
not unique, the event is sent to every agent registered under the
group name.
The last field, scheduler, is used internally to route notifications to the The last field, scheduler, is used internally to route notifications to the
scheduler for an experiment. This is described in more detail below. scheduler for an experiment. This is described in more detail below.
......
...@@ -513,9 +513,12 @@ sub Sign($$) ...@@ -513,9 +513,12 @@ sub Sign($$)
# #
# Create a template xml file to sign. # Create a template xml file to sign.
# #
my $id = sprintf( "%04X%04X%04X%04X", int( rand( 0x10000 ) ),
int( rand( 0x10000 ) ), int( rand( 0x10000 ) ),
int( rand( 0x10000 ) ) );
my $template = my $template =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n". "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n".
"<credential xml:id=\"ref1\">\n". "<credential xml:id=\"ref$id\">\n".
" <type>privilege</type>\n". " <type>privilege</type>\n".
" <serial>$idx</serial>\n". " <serial>$idx</serial>\n".
" <owner_gid>$owner_cert</owner_gid>\n". " <owner_gid>$owner_cert</owner_gid>\n".
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
import datetime import datetime
import getopt import getopt
import os import os
import random
import re import re
import sys import sys
import tempfile import tempfile
...@@ -200,11 +201,14 @@ old = Lookup( doc.documentElement, "credential" ) ...@@ -200,11 +201,14 @@ old = Lookup( doc.documentElement, "credential" )
c = doc.createElement( "credential" ) c = doc.createElement( "credential" )
id = 1 # I really want do loops in Python...
while filter( lambda x: x.getAttribute( "xml:id" ) == "ref" + str( id ), while True:
doc.getElementsByTagName( "credential" ) ): id = "ref" + '%016X' % random.getrandbits( 64 )
id = id + 1 if not filter( lambda x: x.getAttribute( "xml:id" ) == "ref" + str( id ),
c.setAttribute( "xml:id", "ref" + str( id ) ) doc.getElementsByTagName( "credential" ) ):
break
c.setAttribute( "xml:id", str( id ) )
c.appendChild( Lookup( old, "type" ).cloneNode( True ) ) c.appendChild( Lookup( old, "type" ).cloneNode( True ) )
c.appendChild( SimpleNode( doc, "serial", "1" ) ) c.appendChild( SimpleNode( doc, "serial", "1" ) )
...@@ -258,7 +262,7 @@ p.appendChild( old ) ...@@ -258,7 +262,7 @@ p.appendChild( old )
c.appendChild( p ) c.appendChild( p )
signature = doc.createElement( "Signature" ); signature = doc.createElement( "Signature" );
signature.setAttribute( "xml:id", "Sig_ref" + str( id ) ) signature.setAttribute( "xml:id", "Sig_" + str( id ) )
signature.setAttribute( "xmlns", "http://www.w3.org/2000/09/xmldsig#" ) signature.setAttribute( "xmlns", "http://www.w3.org/2000/09/xmldsig#" )
Lookup( doc.documentElement, "signatures" ).appendChild( signature ) Lookup( doc.documentElement, "signatures" ).appendChild( signature )
signedinfo = doc.createElement( "SignedInfo" ) signedinfo = doc.createElement( "SignedInfo" )
...@@ -272,7 +276,7 @@ sigmeth.setAttribute( "Algorithm", ...@@ -272,7 +276,7 @@ sigmeth.setAttribute( "Algorithm",
"http://www.w3.org/2000/09/xmldsig#rsa-sha1" ) "http://www.w3.org/2000/09/xmldsig#rsa-sha1" )
signedinfo.appendChild( sigmeth ) signedinfo.appendChild( sigmeth )
reference = doc.createElement( "Reference" ); reference = doc.createElement( "Reference" );
reference.setAttribute( "URI", "#ref" + str( id ) ) reference.setAttribute( "URI", "#" + str( id ) )
signedinfo.appendChild( reference ) signedinfo.appendChild( reference )
transforms = doc.createElement( "Transforms" ) transforms = doc.createElement( "Transforms" )
reference.appendChild( transforms ) reference.appendChild( transforms )
...@@ -309,7 +313,7 @@ doc.writexml( tmpfile ) ...@@ -309,7 +313,7 @@ doc.writexml( tmpfile )
tmpfile.flush() tmpfile.flush()
ret = os.spawnlp( os.P_WAIT, XMLSEC1, XMLSEC1, "--sign", "--node-id", ret = os.spawnlp( os.P_WAIT, XMLSEC1, XMLSEC1, "--sign", "--node-id",
"Sig_ref" + str( id ), "--privkey-pem", "Sig_" + str( id ), "--privkey-pem",
CERTIFICATE + "," + CERTIFICATE, tmpfile.name ) CERTIFICATE + "," + CERTIFICATE, tmpfile.name )
if ret == 127: if ret == 127:
print >> sys.stderr, XMLSEC1 + ": invocation error\n" print >> sys.stderr, XMLSEC1 + ": invocation error\n"
......
...@@ -58,7 +58,8 @@ my $user = "geniuser"; ...@@ -58,7 +58,8 @@ my $user = "geniuser";
my $group = "GeniSlices"; my $group = "GeniSlices";
# Need a command line option. # Need a command line option.
my $debug = 1; my $debug = 0;
my $mailerrors = 1;
# Determined by version. # Determined by version.
my $responder; my $responder;
...@@ -296,6 +297,9 @@ if ($@) { ...@@ -296,6 +297,9 @@ if ($@) {
else { else {
if (GeniResponse::IsError($result)) { if (GeniResponse::IsError($result)) {
$message .= "Error: " . $result->{'code'} . "\n"; $message .= "Error: " . $result->{'code'} . "\n";
if ($mailerrors) {
print STDERR "Mail Errors is on.\n";
}
} }
else { else {
$message .= "Code: " . $result->{'code'} . "\n"; $message .= "Code: " . $result->{'code'} . "\n";
......
...@@ -1196,7 +1196,7 @@ if ($widearea && ! defined($component_name)) { ...@@ -1196,7 +1196,7 @@ if ($widearea && ! defined($component_name)) {
if ($iface && $genimode eq $NO_GENI) { if ($iface && $genimode eq $NO_GENI) {
print_simple_link($physnode, $iface, print_simple_link($physnode, $iface,
$fake_inet_switch, $fake_inet_iface, $fake_inet_switch, $fake_inet_iface,
100000, 0, 0, @inet_protos); 100000, 0, 0, \@inet_protos);
} }
# Insert into nodes array in case there are wires entries. # Insert into nodes array in case there are wires entries.
...@@ -1213,7 +1213,7 @@ if ($genimode ne $NO_GENI) { ...@@ -1213,7 +1213,7 @@ if ($genimode ne $NO_GENI) {
if (defined($nodes{$node})) { if (defined($nodes{$node})) {
print_simple_link($node, $iface, print_simple_link($node, $iface,
$fake_inet_switch, $fake_inet_iface, $fake_inet_switch, $fake_inet_iface,
100000, 0, 0, @inet_protos); 100000, 0, 0, \@inet_protos);
} }
} }
} }
...@@ -1413,7 +1413,7 @@ while (($node1,$card1,$port1,$node2,$card2,$port2) = ...@@ -1413,7 +1413,7 @@ while (($node1,$card1,$port1,$node2,$card2,$port2) =
print_simple_link($node1, $iface1, print_simple_link($node1, $iface1,
$node2, $iface2, $node2, $iface2,
$bw, 0, 0, @types); $bw, 0, 0, \@types);
} }
} }
} }
...@@ -1490,10 +1490,10 @@ if (! defined($component_name)) { ...@@ -1490,10 +1490,10 @@ if (! defined($component_name)) {
# This is really dumb - BigInts like to print out with a leading '+', # This is really dumb - BigInts like to print out with a leading '+',
# which we don't want. Stript it off. # which we don't want. Stript it off.
$speed =~ s/^\+|-//; $speed =~ s/^\+|-//;
print_named_link("link-$interconnect", print_named_interconnect("link-$interconnect",
$src, "(null)", $src, "(null)",
$dst, "(null)", $dst, "(null)",
$speed, 0, 0, "ethernet"); $speed, 0, 0, ["ethernet"]);
} }
} }
...@@ -1551,7 +1551,7 @@ if (! defined($component_name)) { ...@@ -1551,7 +1551,7 @@ if (! defined($component_name)) {
} }
print_simple_link($node, $iface, print_simple_link($node, $iface,
$fake_air_switch, $fake_air_iface, $fake_air_switch, $fake_air_iface,
$max_bw, 0, 0, @intersection); $max_bw, 0, 0, \@intersection);
} }
} }
...@@ -1977,19 +1977,20 @@ sub print_named_link_ptop ...@@ -1977,19 +1977,20 @@ sub print_named_link_ptop
my $bw = shift(@_); my $bw = shift(@_);
my $delay = shift(@_); my $delay = shift(@_);
my $loss = shift(@_); my $loss = shift(@_);
my $proto_count = scalar(@_); my @proto = @{ shift(@_) };
my $is_interconnect = shift(@_);
my $source_full = "$source:$source/$source_if"; my $source_full = "$source:$source/$source_if";
# Not sure about (null) stuff ... # Not sure about (null) stuff ...
my $dest_full = "$dest:" . my $dest_full = "$dest:" .
(($dest_if eq "(null)") ? "$dest_if" : "$dest/$dest_if"); (($dest_if eq "(null)") ? "$dest_if" : "$dest/$dest_if");
if ($source =~ /cisco/ && $dest =~ /cisco/) if ($is_interconnect)
{ {
$source_full = $source; $source_full = $source;
$dest_full = $dest; $dest_full = $dest;
} }
print "link $name $source_full " print "link $name $source_full "
. "$dest_full $bw $delay $loss 1 " . join(" ", @_) . "\n"; . "$dest_full $bw $delay $loss 1 " . join(" ", @proto) . "\n";
} }
sub print_named_link_xml sub print_named_link_xml
...@@ -2002,7 +2003,9 @@ sub print_named_link_xml ...@@ -2002,7 +2003,9 @@ sub print_named_link_xml
my $bw = shift(@_); my $bw = shift(@_);
my $delay = shift(@_); my $delay = shift(@_);
my $loss = shift(@_); my $loss = shift(@_);
my $proto_count = scalar(@_); my @proto = @{ shift(@_) };
my $is_interconnect = shift(@_);
my $proto_count = scalar(@proto);
if ($genimode ne $NO_GENI) { if ($genimode ne $NO_GENI) {
print "<link "; print "<link ";
my $cmurn = GeniHRN::Generate($OURDOMAIN, "authority", "sa"); my $cmurn = GeniHRN::Generate($OURDOMAIN, "authority", "sa");
...@@ -2044,12 +2047,12 @@ sub print_named_link_xml ...@@ -2044,12 +2047,12 @@ sub print_named_link_xml
my $i = 0; my $i = 0;
for (; $i < $proto_count; ++$i) { for (; $i < $proto_count; ++$i) {
if ($genimode eq $NO_GENI) { if ($genimode eq $NO_GENI) {
print " <link_type><type_name>" . $_[$i] print " <link_type><type_name>" . $proto[$i]
. "</type_name></link_type>\n"; . "</type_name></link_type>\n";
} elsif ($genimode eq $V_0_1 || $genimode eq $V_0_2) { } elsif ($genimode eq $V_0_1 || $genimode eq $V_0_2) {
print " <link_type type_name=\"" . $_[$i] . "\" />\n"; print " <link_type type_name=\"" . $proto[$i] . "\" />\n";
} elsif ($genimode eq $V_2) { } elsif ($genimode eq $V_2) {
print " <link_type name=\"" . $_[$i] . "\" />\n"; print " <link_type name=\"" . $proto[$i] . "\" />\n";
} }
} }
print "</link>\n\n"; print "</link>\n\n";
...@@ -2095,9 +2098,18 @@ sub print_interface_contents ...@@ -2095,9 +2098,18 @@ sub print_interface_contents
sub print_named_link sub print_named_link
{ {
if (!$do_xml) { if (!$do_xml) {
print_named_link_ptop(@_); print_named_link_ptop(@_, 0);
} elsif ($do_xml) { } elsif ($do_xml) {
print_named_link_xml(@_); print_named_link_xml(@_, 0);
}
}
sub print_named_interconnect
{
if (!$do_xml) {
print_named_link_ptop(@_, 1);
} elsif ($do_xml) {
print_named_link_xml(@_, 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