Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
4ed799f8
Commit
4ed799f8
authored
Jan 09, 2009
by
Gary Wong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the certificate issuer as the default XMLRPC server (or www.emulab.net
as the default clearinghouse).
parent
26d9f4f2
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
149 additions
and
988 deletions
+149
-988
protogeni/test/binduser.py
protogeni/test/binduser.py
+2
-89
protogeni/test/createslice.py
protogeni/test/createslice.py
+2
-89
protogeni/test/createsliver.py
protogeni/test/createsliver.py
+2
-89
protogeni/test/deleteslice.py
protogeni/test/deleteslice.py
+2
-89
protogeni/test/deletesliver.py
protogeni/test/deletesliver.py
+2
-89
protogeni/test/getticket.py
protogeni/test/getticket.py
+2
-89
protogeni/test/linktest.py
protogeni/test/linktest.py
+2
-89
protogeni/test/listcomponents.py
protogeni/test/listcomponents.py
+3
-91
protogeni/test/lookupuser.py
protogeni/test/lookupuser.py
+2
-91
protogeni/test/shutdownslice.py
protogeni/test/shutdownslice.py
+2
-89
protogeni/test/test-common.py
protogeni/test/test-common.py
+125
-0
protogeni/test/tuntest.py
protogeni/test/tuntest.py
+3
-94
No files found.
protogeni/test/binduser.py
View file @
4ed799f8
...
...
@@ -23,96 +23,9 @@ import os
import
time
import
re
import
xmlrpclib
from
M2Crypto
import
X509
# Default server
XMLRPC_SERVER
=
"boss"
SERVER_PATH
=
":443/protogeni/xmlrpc/"
HOME
=
os
.
environ
[
"HOME"
]
# Path to my certificate
CERTIFICATE
=
HOME
+
"/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE
=
HOME
+
"/.ssl/password"
passphrase
=
""
# Debugging output.
debug
=
0
impotent
=
0
def
Fatal
(
message
):
print
message
sys
.
exit
(
1
)
return
def
PassPhraseCB
(
v
,
prompt1
=
'Enter passphrase:'
,
prompt2
=
'Verify passphrase:'
):
passphrase
=
open
(
PASSPHRASEFILE
).
readline
()
passphrase
=
passphrase
.
strip
()
return
passphrase
#
# Call the rpc server.
#
def
do_method
(
module
,
method
,
params
,
URI
=
None
):
if
debug
:
print
module
+
" "
+
method
+
" "
+
str
(
params
);
pass
if
not
os
.
path
.
exists
(
CERTIFICATE
):
return
Fatal
(
"error: missing emulab certificate: %s
\n
"
%
CERTIFICATE
)
from
M2Crypto.m2xmlrpclib
import
SSL_Transport
from
M2Crypto
import
SSL
if
URI
==
None
:
URI
=
"https://"
+
XMLRPC_SERVER
+
SERVER_PATH
+
module
else
:
URI
=
URI
+
"/"
+
module
pass
ctx
=
SSL
.
Context
(
"sslv23"
)
ctx
.
load_cert
(
CERTIFICATE
,
CERTIFICATE
,
PassPhraseCB
)
ctx
.
set_verify
(
SSL
.
verify_none
,
16
)
ctx
.
set_allow_unknown_ca
(
0
)
# Get a handle on the server,
server
=
xmlrpclib
.
ServerProxy
(
URI
,
SSL_Transport
(
ctx
),
verbose
=
0
)
# Get a pointer to the function we want to invoke.
meth
=
getattr
(
server
,
method
)
meth_args
=
[
params
]
#
# Make the call.
#
try
:
response
=
apply
(
meth
,
meth_args
)
pass
except
xmlrpclib
.
Fault
,
e
:
print
e
.
faultString
return
(
-
1
,
None
)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if
len
(
response
[
"output"
]):
print
response
[
"output"
],
print
": "
,
pass
rval
=
response
[
"code"
]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if
rval
:
if
response
[
"value"
]:
rval
=
response
[
"value"
]
pass
pass
return
(
rval
,
response
)
execfile
(
"test-common.py"
)
#
# Get a credential for myself, that allows me to do things at the SA.
...
...
protogeni/test/createslice.py
View file @
4ed799f8
...
...
@@ -22,96 +22,9 @@ import getopt
import
os
import
re
import
xmlrpclib
from
M2Crypto
import
X509
# Default server
XMLRPC_SERVER
=
"boss"
SERVER_PATH
=
":443/protogeni/xmlrpc/"
HOME
=
os
.
environ
[
"HOME"
]
# Path to my certificate
CERTIFICATE
=
HOME
+
"/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE
=
HOME
+
"/.ssl/password"
passphrase
=
""
# Debugging output.
debug
=
0
impotent
=
0
def
Fatal
(
message
):
print
message
sys
.
exit
(
1
)
return
def
PassPhraseCB
(
v
,
prompt1
=
'Enter passphrase:'
,
prompt2
=
'Verify passphrase:'
):
passphrase
=
open
(
PASSPHRASEFILE
).
readline
()
passphrase
=
passphrase
.
strip
()
return
passphrase
#
# Call the rpc server.
#
def
do_method
(
module
,
method
,
params
,
URI
=
None
):
if
debug
:
print
module
+
" "
+
method
+
" "
+
str
(
params
);
pass
if
not
os
.
path
.
exists
(
CERTIFICATE
):
return
Fatal
(
"error: missing emulab certificate: %s
\n
"
%
CERTIFICATE
)
from
M2Crypto.m2xmlrpclib
import
SSL_Transport
from
M2Crypto
import
SSL
if
URI
==
None
:
URI
=
"https://"
+
XMLRPC_SERVER
+
SERVER_PATH
+
module
else
:
URI
=
URI
+
"/"
+
module
pass
ctx
=
SSL
.
Context
(
"sslv23"
)
ctx
.
load_cert
(
CERTIFICATE
,
CERTIFICATE
,
PassPhraseCB
)
ctx
.
set_verify
(
SSL
.
verify_none
,
16
)
ctx
.
set_allow_unknown_ca
(
0
)
# Get a handle on the server,
server
=
xmlrpclib
.
ServerProxy
(
URI
,
SSL_Transport
(
ctx
),
verbose
=
0
)
# Get a pointer to the function we want to invoke.
meth
=
getattr
(
server
,
method
)
meth_args
=
[
params
]
#
# Make the call.
#
try
:
response
=
apply
(
meth
,
meth_args
)
pass
except
xmlrpclib
.
Fault
,
e
:
print
e
.
faultString
return
(
-
1
,
None
)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if
len
(
response
[
"output"
]):
print
response
[
"output"
],
print
": "
,
pass
rval
=
response
[
"code"
]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if
rval
:
if
response
[
"value"
]:
rval
=
response
[
"value"
]
pass
pass
return
(
rval
,
response
)
execfile
(
"test-common.py"
)
#
# Get a credential for myself, that allows me to do things at the SA.
...
...
protogeni/test/createsliver.py
View file @
4ed799f8
...
...
@@ -23,96 +23,9 @@ import os
import
time
import
re
import
xmlrpclib
from
M2Crypto
import
X509
# Default server
XMLRPC_SERVER
=
"boss"
SERVER_PATH
=
":443/protogeni/xmlrpc/"
HOME
=
os
.
environ
[
"HOME"
]
# Path to my certificate
CERTIFICATE
=
HOME
+
"/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE
=
HOME
+
"/.ssl/password"
passphrase
=
""
# Debugging output.
debug
=
0
impotent
=
0
def
Fatal
(
message
):
print
message
sys
.
exit
(
1
)
return
def
PassPhraseCB
(
v
,
prompt1
=
'Enter passphrase:'
,
prompt2
=
'Verify passphrase:'
):
passphrase
=
open
(
PASSPHRASEFILE
).
readline
()
passphrase
=
passphrase
.
strip
()
return
passphrase
#
# Call the rpc server.
#
def
do_method
(
module
,
method
,
params
,
URI
=
None
):
if
debug
:
print
module
+
" "
+
method
+
" "
+
str
(
params
);
pass
if
not
os
.
path
.
exists
(
CERTIFICATE
):
return
Fatal
(
"error: missing emulab certificate: %s
\n
"
%
CERTIFICATE
)
from
M2Crypto.m2xmlrpclib
import
SSL_Transport
from
M2Crypto
import
SSL
if
URI
==
None
:
URI
=
"https://"
+
XMLRPC_SERVER
+
SERVER_PATH
+
module
else
:
URI
=
URI
+
"/"
+
module
pass
ctx
=
SSL
.
Context
(
"sslv23"
)
ctx
.
load_cert
(
CERTIFICATE
,
CERTIFICATE
,
PassPhraseCB
)
ctx
.
set_verify
(
SSL
.
verify_none
,
16
)
ctx
.
set_allow_unknown_ca
(
0
)
# Get a handle on the server,
server
=
xmlrpclib
.
ServerProxy
(
URI
,
SSL_Transport
(
ctx
),
verbose
=
0
)
# Get a pointer to the function we want to invoke.
meth
=
getattr
(
server
,
method
)
meth_args
=
[
params
]
#
# Make the call.
#
try
:
response
=
apply
(
meth
,
meth_args
)
pass
except
xmlrpclib
.
Fault
,
e
:
print
e
.
faultString
return
(
-
1
,
None
)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if
len
(
response
[
"output"
]):
print
response
[
"output"
],
print
": "
,
pass
rval
=
response
[
"code"
]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if
rval
:
if
response
[
"value"
]:
rval
=
response
[
"value"
]
pass
pass
return
(
rval
,
response
)
execfile
(
"test-common.py"
)
#
# Get a credential for myself, that allows me to do things at the SA.
...
...
protogeni/test/deleteslice.py
View file @
4ed799f8
...
...
@@ -22,96 +22,9 @@ import getopt
import
os
import
re
import
xmlrpclib
from
M2Crypto
import
X509
# Default server
XMLRPC_SERVER
=
"boss"
SERVER_PATH
=
":443/protogeni/xmlrpc/"
HOME
=
os
.
environ
[
"HOME"
]
# Path to my certificate
CERTIFICATE
=
HOME
+
"/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE
=
HOME
+
"/.ssl/password"
passphrase
=
""
# Debugging output.
debug
=
0
impotent
=
0
def
Fatal
(
message
):
print
message
sys
.
exit
(
1
)
return
def
PassPhraseCB
(
v
,
prompt1
=
'Enter passphrase:'
,
prompt2
=
'Verify passphrase:'
):
passphrase
=
open
(
PASSPHRASEFILE
).
readline
()
passphrase
=
passphrase
.
strip
()
return
passphrase
#
# Call the rpc server.
#
def
do_method
(
module
,
method
,
params
,
URI
=
None
):
if
debug
:
print
module
+
" "
+
method
+
" "
+
str
(
params
);
pass
if
not
os
.
path
.
exists
(
CERTIFICATE
):
return
Fatal
(
"error: missing emulab certificate: %s
\n
"
%
CERTIFICATE
)
from
M2Crypto.m2xmlrpclib
import
SSL_Transport
from
M2Crypto
import
SSL
if
URI
==
None
:
URI
=
"https://"
+
XMLRPC_SERVER
+
SERVER_PATH
+
module
else
:
URI
=
URI
+
"/"
+
module
pass
ctx
=
SSL
.
Context
(
"sslv23"
)
ctx
.
load_cert
(
CERTIFICATE
,
CERTIFICATE
,
PassPhraseCB
)
ctx
.
set_verify
(
SSL
.
verify_none
,
16
)
ctx
.
set_allow_unknown_ca
(
0
)
# Get a handle on the server,
server
=
xmlrpclib
.
ServerProxy
(
URI
,
SSL_Transport
(
ctx
),
verbose
=
0
)
# Get a pointer to the function we want to invoke.
meth
=
getattr
(
server
,
method
)
meth_args
=
[
params
]
#
# Make the call.
#
try
:
response
=
apply
(
meth
,
meth_args
)
pass
except
xmlrpclib
.
Fault
,
e
:
print
e
.
faultString
return
(
-
1
,
None
)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if
len
(
response
[
"output"
]):
print
response
[
"output"
],
print
": "
,
pass
rval
=
response
[
"code"
]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if
rval
:
if
response
[
"value"
]:
rval
=
response
[
"value"
]
pass
pass
return
(
rval
,
response
)
execfile
(
"test-common.py"
)
#
# Get a credential for myself, that allows me to do things at the SA.
...
...
protogeni/test/deletesliver.py
View file @
4ed799f8
...
...
@@ -22,96 +22,9 @@ import getopt
import
os
import
re
import
xmlrpclib
from
M2Crypto
import
X509
# Default server
XMLRPC_SERVER
=
"boss"
SERVER_PATH
=
":443/protogeni/xmlrpc/"
HOME
=
os
.
environ
[
"HOME"
]
# Path to my certificate
CERTIFICATE
=
HOME
+
"/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE
=
HOME
+
"/.ssl/password"
passphrase
=
""
# Debugging output.
debug
=
0
impotent
=
0
def
Fatal
(
message
):
print
message
sys
.
exit
(
1
)
return
def
PassPhraseCB
(
v
,
prompt1
=
'Enter passphrase:'
,
prompt2
=
'Verify passphrase:'
):
passphrase
=
open
(
PASSPHRASEFILE
).
readline
()
passphrase
=
passphrase
.
strip
()
return
passphrase
#
# Call the rpc server.
#
def
do_method
(
module
,
method
,
params
,
URI
=
None
):
if
debug
:
print
module
+
" "
+
method
+
" "
+
str
(
params
);
pass
if
not
os
.
path
.
exists
(
CERTIFICATE
):
return
Fatal
(
"error: missing emulab certificate: %s
\n
"
%
CERTIFICATE
)
from
M2Crypto.m2xmlrpclib
import
SSL_Transport
from
M2Crypto
import
SSL
if
URI
==
None
:
URI
=
"https://"
+
XMLRPC_SERVER
+
SERVER_PATH
+
module
else
:
URI
=
URI
+
"/"
+
module
pass
ctx
=
SSL
.
Context
(
"sslv23"
)
ctx
.
load_cert
(
CERTIFICATE
,
CERTIFICATE
,
PassPhraseCB
)
ctx
.
set_verify
(
SSL
.
verify_none
,
16
)
ctx
.
set_allow_unknown_ca
(
0
)
# Get a handle on the server,
server
=
xmlrpclib
.
ServerProxy
(
URI
,
SSL_Transport
(
ctx
),
verbose
=
0
)
# Get a pointer to the function we want to invoke.
meth
=
getattr
(
server
,
method
)
meth_args
=
[
params
]
#
# Make the call.
#
try
:
response
=
apply
(
meth
,
meth_args
)
pass
except
xmlrpclib
.
Fault
,
e
:
print
e
.
faultString
return
(
-
1
,
None
)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if
len
(
response
[
"output"
]):
print
response
[
"output"
],
print
": "
,
pass
rval
=
response
[
"code"
]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if
rval
:
if
response
[
"value"
]:
rval
=
response
[
"value"
]
pass
pass
return
(
rval
,
response
)
execfile
(
"test-common.py"
)
#
# Get a credential for myself, that allows me to do things at the SA.
...
...
protogeni/test/getticket.py
View file @
4ed799f8
...
...
@@ -23,96 +23,9 @@ import os
import
time
import
re
import
xmlrpclib
from
M2Crypto
import
X509
# Default server
XMLRPC_SERVER
=
"boss"
SERVER_PATH
=
":443/protogeni/xmlrpc/"
HOME
=
os
.
environ
[
"HOME"
]
# Path to my certificate
CERTIFICATE
=
HOME
+
"/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE
=
HOME
+
"/.ssl/password"
passphrase
=
""
# Debugging output.
debug
=
0
impotent
=
0
def
Fatal
(
message
):
print
message
sys
.
exit
(
1
)
return
def
PassPhraseCB
(
v
,
prompt1
=
'Enter passphrase:'
,
prompt2
=
'Verify passphrase:'
):
passphrase
=
open
(
PASSPHRASEFILE
).
readline
()
passphrase
=
passphrase
.
strip
()
return
passphrase
#
# Call the rpc server.
#
def
do_method
(
module
,
method
,
params
,
URI
=
None
):
if
debug
:
print
module
+
" "
+
method
+
" "
+
str
(
params
);
pass
if
not
os
.
path
.
exists
(
CERTIFICATE
):
return
Fatal
(
"error: missing emulab certificate: %s
\n
"
%
CERTIFICATE
)
from
M2Crypto.m2xmlrpclib
import
SSL_Transport
from
M2Crypto
import
SSL
if
URI
==
None
:
URI
=
"https://"
+
XMLRPC_SERVER
+
SERVER_PATH
+
module
else
:
URI
=
URI
+
"/"
+
module
pass
ctx
=
SSL
.
Context
(
"sslv23"
)
ctx
.
load_cert
(
CERTIFICATE
,
CERTIFICATE
,
PassPhraseCB
)
ctx
.
set_verify
(
SSL
.
verify_none
,
16
)
ctx
.
set_allow_unknown_ca
(
0
)
# Get a handle on the server,
server
=
xmlrpclib
.
ServerProxy
(
URI
,
SSL_Transport
(
ctx
),
verbose
=
0
)
# Get a pointer to the function we want to invoke.
meth
=
getattr
(
server
,
method
)
meth_args
=
[
params
]
#
# Make the call.
#
try
:
response
=
apply
(
meth
,
meth_args
)
pass
except
xmlrpclib
.
Fault
,
e
:
print
e
.
faultString
return
(
-
1
,
None
)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if
len
(
response
[
"output"
]):
print
response
[
"output"
],
print
": "
,
pass
rval
=
response
[
"code"
]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if
rval
:
if
response
[
"value"
]:
rval
=
response
[
"value"
]
pass
pass
return
(
rval
,
response
)
execfile
(
"test-common.py"
)
#
# Get a credential for myself, that allows me to do things at the SA.
...
...
protogeni/test/linktest.py
View file @
4ed799f8
...
...
@@ -23,96 +23,9 @@ import os
import
time
import
re
import
xmlrpclib
from
M2Crypto
import
X509
# Default server
XMLRPC_SERVER
=
"boss"
SERVER_PATH
=
":443/protogeni/xmlrpc/"
HOME
=
os
.
environ
[
"HOME"
]
# Path to my certificate
CERTIFICATE
=
HOME
+
"/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE
=
HOME
+
"/.ssl/password"
passphrase
=
""
# Debugging output.
debug
=
0
impotent
=
0
def
Fatal
(
message
):
print
message
sys
.
exit
(
1
)