1 | #! /usr/bin/env python |
---|
2 | # |
---|
3 | # GENIPUBLIC-COPYRIGHT |
---|
4 | # Copyright (c) 2008-2010 University of Utah and the Flux Group. |
---|
5 | # All rights reserved. |
---|
6 | # |
---|
7 | # Permission to use, copy, modify and distribute this software is hereby |
---|
8 | # granted provided that (1) source code retains these copyright, permission, |
---|
9 | # and disclaimer notices, and (2) redistributions including binaries |
---|
10 | # reproduce the notices in supporting documentation. |
---|
11 | # |
---|
12 | # THE UNIVERSITY OF UTAH ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" |
---|
13 | # CONDITION. THE UNIVERSITY OF UTAH DISCLAIMS ANY LIABILITY OF ANY KIND |
---|
14 | # FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. |
---|
15 | # |
---|
16 | |
---|
17 | # |
---|
18 | # |
---|
19 | import sys |
---|
20 | import pwd |
---|
21 | import getopt |
---|
22 | import os |
---|
23 | import time |
---|
24 | import re |
---|
25 | import xmlrpclib |
---|
26 | from M2Crypto import X509 |
---|
27 | |
---|
28 | ACCEPTSLICENAME=1 |
---|
29 | |
---|
30 | execfile( os.path.dirname(os.path.abspath(__file__)) + os.sep + "test-common.py" ) |
---|
31 | |
---|
32 | if len(REQARGS) > 0: |
---|
33 | Usage() |
---|
34 | sys.exit( 1 ) |
---|
35 | |
---|
36 | # |
---|
37 | # Get a credential for myself, that allows me to do things at the SA. |
---|
38 | # |
---|
39 | mycredential = get_self_credential() |
---|
40 | print "Got my SA credential, looking up " + SLICENAME |
---|
41 | |
---|
42 | # |
---|
43 | # Lookup slice. |
---|
44 | # |
---|
45 | params = {} |
---|
46 | params["credential"] = mycredential |
---|
47 | params["type"] = "Slice" |
---|
48 | params["hrn"] = SLICENAME |
---|
49 | rval,response = do_method("sa", "Resolve", params) |
---|
50 | if rval: |
---|
51 | # |
---|
52 | # Exit |
---|
53 | # |
---|
54 | Fatal("Error resolving slice: " + response); |
---|
55 | pass |
---|
56 | else: |
---|
57 | # |
---|
58 | # Get the slice credential. |
---|
59 | # |
---|
60 | print "Asking for slice credential for " + SLICENAME |
---|
61 | myslice = get_slice_credential( response[ "value" ], mycredential ) |
---|
62 | print "Got the slice credential" |
---|
63 | pass |
---|
64 | |
---|
65 | |
---|
66 | print "Asking for my lamp certificate" |
---|
67 | |
---|
68 | lampca = "https://blackseal.damsl.cis.udel.edu/protogeni/xmlrpc/lampca" |
---|
69 | |
---|
70 | params = {} |
---|
71 | params["credential"] = (myslice,) |
---|
72 | rval,response = do_method("lamp", "GetLAMPSliceCertificate", params, URI=lampca) |
---|
73 | if rval: |
---|
74 | Fatal("Could not get ticket: " + response) |
---|
75 | pass |
---|
76 | |
---|
77 | print "Paste the following certificate *as is* into a file called lampcert.pem" |
---|
78 | print "Upload the certificate to all LAMP enabled nodes at /usr/local/etc/protogeni/ssl/lampcert.pem" |
---|
79 | print response["value"] |
---|
80 | |
---|