Commit 231fea1f authored by Tarun Prabhu's avatar Tarun Prabhu

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

parents b4fdc62f a78357c4
......@@ -64,7 +64,7 @@ notifications. The system defined fields include:
typedef struct {
char *site; /* Which Emulab site. */
char *expt; /* Project and experiment IDs */
char *group; /* User defined group of nodes */
char *group; /* Deprecated */
char *host; /* A specific host (ipaddr) */
char *objtype; /* LINK, TRAFGEN, etc ... */
char *objname; /* link0, cbr0, cbr1, etc ... */
......@@ -72,6 +72,12 @@ notifications. The system defined fields include:
int scheduler; /* A dynamic event to schedule */
} 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
scheduler for an experiment. This is described in more detail below.
......
......@@ -513,9 +513,12 @@ sub 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 =
"<?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".
" <serial>$idx</serial>\n".
" <owner_gid>$owner_cert</owner_gid>\n".
......
......@@ -16,6 +16,7 @@
import datetime
import getopt
import os
import random
import re
import sys
import tempfile
......@@ -200,11 +201,14 @@ old = Lookup( doc.documentElement, "credential" )
c = doc.createElement( "credential" )
id = 1
while filter( lambda x: x.getAttribute( "xml:id" ) == "ref" + str( id ),
doc.getElementsByTagName( "credential" ) ):
id = id + 1
c.setAttribute( "xml:id", "ref" + str( id ) )
# I really want do loops in Python...
while True:
id = "ref" + '%016X' % random.getrandbits( 64 )
if not filter( lambda x: x.getAttribute( "xml:id" ) == "ref" + str( id ),
doc.getElementsByTagName( "credential" ) ):
break
c.setAttribute( "xml:id", str( id ) )
c.appendChild( Lookup( old, "type" ).cloneNode( True ) )
c.appendChild( SimpleNode( doc, "serial", "1" ) )
......@@ -258,7 +262,7 @@ p.appendChild( old )
c.appendChild( p )
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#" )
Lookup( doc.documentElement, "signatures" ).appendChild( signature )
signedinfo = doc.createElement( "SignedInfo" )
......@@ -272,7 +276,7 @@ sigmeth.setAttribute( "Algorithm",
"http://www.w3.org/2000/09/xmldsig#rsa-sha1" )
signedinfo.appendChild( sigmeth )
reference = doc.createElement( "Reference" );
reference.setAttribute( "URI", "#ref" + str( id ) )
reference.setAttribute( "URI", "#" + str( id ) )
signedinfo.appendChild( reference )
transforms = doc.createElement( "Transforms" )
reference.appendChild( transforms )
......@@ -309,7 +313,7 @@ doc.writexml( tmpfile )
tmpfile.flush()
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 )
if ret == 127:
print >> sys.stderr, XMLSEC1 + ": invocation error\n"
......
......@@ -1203,7 +1203,7 @@ if ($widearea && ! defined($component_name)) {
if ($iface && $genimode eq $NO_GENI) {
print_simple_link($physnode, $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.
......@@ -1220,7 +1220,7 @@ if ($genimode ne $NO_GENI) {
if (defined($nodes{$node})) {
print_simple_link($node, $iface,
$fake_inet_switch, $fake_inet_iface,
100000, 0, 0, @inet_protos);
100000, 0, 0, \@inet_protos);
}
}
}
......@@ -1420,7 +1420,7 @@ while (($node1,$card1,$port1,$node2,$card2,$port2) =
print_simple_link($node1, $iface1,
$node2, $iface2,
$bw, 0, 0, @types);
$bw, 0, 0, \@types);
}
}
}
......@@ -1497,10 +1497,10 @@ if (! defined($component_name)) {
# This is really dumb - BigInts like to print out with a leading '+',
# which we don't want. Stript it off.
$speed =~ s/^\+|-//;
print_named_link("link-$interconnect",
print_named_interconnect("link-$interconnect",
$src, "(null)",
$dst, "(null)",
$speed, 0, 0, "ethernet");
$speed, 0, 0, ["ethernet"]);
}
}
......@@ -1558,7 +1558,7 @@ if (! defined($component_name)) {
}
print_simple_link($node, $iface,
$fake_air_switch, $fake_air_iface,
$max_bw, 0, 0, @intersection);
$max_bw, 0, 0, \@intersection);
}
}
......@@ -2064,19 +2064,20 @@ sub print_named_link_ptop
my $bw = shift(@_);
my $delay = shift(@_);
my $loss = shift(@_);
my $proto_count = scalar(@_);
my @proto = @{ shift(@_) };
my $is_interconnect = shift(@_);
my $source_full = "$source:$source/$source_if";
# Not sure about (null) stuff ...
my $dest_full = "$dest:" .
(($dest_if eq "(null)") ? "$dest_if" : "$dest/$dest_if");
if ($source =~ /cisco/ && $dest =~ /cisco/)
if ($is_interconnect)
{
$source_full = $source;
$dest_full = $dest;
}
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
......@@ -2089,7 +2090,9 @@ sub print_named_link_xml
my $bw = shift(@_);
my $delay = 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) {
print "<link ";
my $cmurn = GeniHRN::Generate($OURDOMAIN, "authority", "sa");
......@@ -2131,12 +2134,12 @@ sub print_named_link_xml
my $i = 0;
for (; $i < $proto_count; ++$i) {
if ($genimode eq $NO_GENI) {
print " <link_type><type_name>" . $_[$i]
print " <link_type><type_name>" . $proto[$i]
. "</type_name></link_type>\n";
} 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) {
print " <link_type name=\"" . $_[$i] . "\" />\n";
print " <link_type name=\"" . $proto[$i] . "\" />\n";
}
}
print "</link>\n\n";
......@@ -2182,9 +2185,18 @@ sub print_interface_contents
sub print_named_link
{
if (!$do_xml) {
print_named_link_ptop(@_);
print_named_link_ptop(@_, 0);
} 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