+++ /dev/null
-#! /usr/bin/env python
-from __future__ import with_statement
-
-# sfi -- slice-based facility interface
-
-import sys
-import os, os.path
-import getopt
-import tempfile
-from geni.util.cert import Keypair, Certificate
-from geni.util.credential import Credential
-from geni.util.geniclient import GeniClient
-from geni.util.record import GeniRecord
-from geni.util.gid import GID
-from geni.util.gid import create_uuid
-
-pubkeyfile = None
-infile = None
-outfile = None
-gidfile = None
-email = None
-ip = None
-dns = None
-hrn = None
-type = None
-dump = False
-extractgid = None
-researcher = []
-
-long_opts = ["infile=", "outfile=", "email=", "ip=", "dns=", "gidfile=", "hrn=", "pubkeyfile=", "type=", "addresearcher=", "delresearcher=", "dump", "extractgid="]
-
-def showhelp():
- print "syntax: editRecord.py <options>"
- print " --help ... show help"
- print " --infile <name> ... read record from file"
- print " --outfile <name> ... write record to file"
- print " --dump ... dump record to stdout"
- print " --extractgid <fn> ... extract GID to filename"
- print " --gidfile <fn> ... load gid from file"
- print " --pubkeyfile <name> ... key to use when creating gid"
- print " --hrn <name> ... set hrn"
- print " --type <type> ... set type (user|slice|sa|ma|...)"
- print " --email <addr> ... user: set email address"
- print " --ip <addr> ... node: set ip address"
- print " --dns <hostname> ... node: set hostname"
- print " --addresearcher <hrn> ... slice: add researcher"
- print " --delresearcher <hrn> ... slice: delete researcher"
-
-def load_publickey_string(fn):
- f = file(fn,"r")
- key_string = f.read()
-
- # if the filename is a private key file, then extract the public key
- if "PRIVATE KEY" in key_string:
- outfn = tempfile.mktemp()
- cmd = "openssl rsa -in " + fn + " -pubout -outform PEM -out " + outfn
- os.system(cmd)
- f = file(outfn, "r")
- key_string = f.read()
- os.remove(outfn)
-
- return key_string
-
-def process_options():
- global infile, outfile
- global email, ip, dns, gidfile, hrn, type
- global researcher
- global dump, extractgid
- global pubkeyfile
-
- (options, args) = getopt.getopt(sys.argv[1:], '', long_opts)
- for opt in options:
- name = opt[0]
- val = opt[1]
-
- if name == "--help":
- showhelp()
- sys.exit(0)
- elif name == "--infile":
- infile = val
- elif name == "--outfile":
- outfile = val
- elif name == "--email":
- email = val
- elif name == "--ip":
- ip = val
- elif name == "--dns":
- dns = val
- elif name == "--gidfile":
- gidfile = val
- elif name == "--pubkeyfile":
- pubkeyfile = val
- elif name == "--hrn":
- hrn = val
- elif name == "--type":
- type = val
- elif name == "--dump":
- dump = True
- elif name == "--extractgid":
- extractgid = val
- elif name == "--addresearcher":
- researcher.append(val)
- elif name == "--delresearcher":
- researcher.append("-" + val)
-
-def errorcheck(record):
- geni_info = record.get_geni_info()
-
- if not record.type:
- print "Warning: no type specified"
- if not record.type in ["user", "sa", "ma", "slice", "node"]:
- print "Warning: unknown record type"
- if not record.name:
- print "Warning: unknown record name"
- if (not record.gid) and (not ("create_gid" in geni_info)):
- print "Warning: unknown record gid"
- print " use --hrn and --pubkeyfile to cause a gid to be created"
-
- if record.type == "user":
- if geni_info.get("email", None) == None:
- print "Warning: unknown email in user record"
-
- if record.type == "node":
- if geni_info.get("ip",None) == None:
- print "Warning: unknown ip in node record"
- if geni_info.get("dns",None) == None:
- print "Warning: unknown dns in node record"
-
-# updates is a list of items to add or remove. If an item starts with "-", then
-# it will be removed. Otherwise it will be added
-def update_list(dict, listname, updates):
- list = dict.get(listname, [])
- for hrn in updates:
- if hrn.startswith("-"):
- real_hrn = hrn[1:]
- if real_hrn in list:
- list.remove(real_hrn)
- else:
- print "Error:", real_hrn, "is not in researcher list:", list
- else:
- if not hrn in list:
- list.append(hrn)
-
- dict[listname] = list
-
-def main():
- process_options()
-
- # if the user didn't tell us to do much of anything, then maybe he needs
- # some help
- if (not infile) and (not outfile) and (not dump) and (extractgid==None):
- showhelp()
- return
-
- if infile:
- str = file(infile, "r").read()
- record = GeniRecord(string = str)
- else:
- record = GeniRecord()
-
- geni_info = record.get_geni_info()
- geni_info_orig = geni_info.copy()
-
- if email:
- geni_info["email"] = email
-
- if ip:
- geni_info["ip"] = ip
-
- if dns:
- geni_info["dns"] = dns
-
- if hrn:
- record.name = hrn
-
- if type:
- record.type = type
-
- if gidfile:
- gid_str = file(gidfile, "r").read()
- gid = GID(string=gid_str)
- record.set_gid(gid)
-
- if pubkeyfile:
- if gidfile:
- print "You should not use --gidfile and --pubkeyfile together"
- sys.exit(-1)
-
- if not record.name:
- print "You must specify --hrn when you specify --pubkeyfile"
- sys.exit(-1)
-
- geni_info["create_gid"] = True
- geni_info["create_gid_hrn"] = record.name
- geni_info["create_gid_key"] = load_publickey_string(pubkeyfile).replace("\n", "|") # XXX smbaker: the rspec kills newlines
-
- if researcher:
- update_list(geni_info, "researcher", researcher)
-
- if (geni_info != geni_info_orig):
- record.set_geni_info(geni_info)
-
- errorcheck(record)
-
- if dump:
- record.dump(False)
-
- if extractgid:
- record.get_gid_object().save_to_file(extractgid, save_parents=True)
- print "write GID to", extractgid
-
- if outfile:
- str = record.save_to_string()
- file(outfile, "w").write(str)
- print "wrote record to", outfile
-
-if __name__=="__main__":
- main()
+++ /dev/null
-# command line interface
-
-import getopt
-import sys
-import os
-from geni.util.cert import *
-from geni.util.geniclient import *
-from geni.util.geniticket import *
-
-long_opts = ["keyfile=", "help", "outfile=", "credfile=", "ticketfile=",
- "username=", "email=", "ip=", "dns=", "dump_parents", "server=",
- "filter=", "short"]
-
-# default command line options
-username = "client"
-opname = None
-type = None
-hrn = None
-
-key_file = None
-cred_file = None
-cert_file = None
-out_file = None
-ticket_file = None
-
-short = False
-ip = None
-dns = None
-email = None
-uuid = None
-gid_pkey_fn = None
-gid_fn = None
-filter = None
-
-dump_fn = None
-
-dump_parents = False
-
-leaf_name = None
-server_url = "https://localhost:12345/"
-
-def get_leaf(hrn):
- parts = hrn.split(".")\r
- return parts[-1]
-
-def showhelp():
- print "syntax: cli <options> command <args>"
- print "options:"
- print " --username ... username (or hrn) of user making call"
- print " --outfile ... save response to a file"
- print " --credfile ... credential of user making call (or 'None')"
- print " --keyfile ... private key file of user making call"
- print " --ticketfile ... filename of ticket (for redeemticket)"
- print " --email ... email address (for registering users)"
- print " --ip ... IP address (for registering nodes)"
- print " --dns ... DNS address (for registering nodes)"
- print " --dump_parents ... dump parents"
- print " --server ... geni server (registry/component) to connect to"
- print " --filter <type> ... filter the results of a list operation (user | slice | node ...)"
- print " --short ... list records in short format (name only)"
- print "commands:"
- print " resolve <hrn>"
- print " dumpCredential <filename>"
- print " dumpGid <filename>"
- print " getCredential <type> <hrn>"
- print " list <hrn>"
- print " start <hrn>"
- print " createKey <filename>"
- print " createGid <hrn> <uuid|None> <pubkey_fn>"
- print " register <type> <hrn> <gid_filename>"
- print " remove <type> <hrn>"
- print " update <type> <hrn>"
- print " startSlice"
- print " stopSlice"
- print " listSlices"
-
-def process_options():
- global username
- global opname
- global type, hrn
- global cert_file, cred_file
- global key_file, out_file, ticket_file
- global uuid, pkey_fn, gid_fn, email, gid_pkey_fn, ip, dns
- global dump_parents
- global server_url
- global filter
- global short
- global dump_fn
-
- (options, args) = getopt.getopt(sys.argv[1:], '', long_opts)
- for opt in options:
- name = opt[0]
- val = opt[1]
-
- if name == "--help":
- showhelp()
- sys.exit(0)
- elif name == "--username":
- username = val
- elif name == "--outfile":
- out_file = val
- elif name == "--credfile":
- cred_file = val
- elif name == "--certfile":
- cred_file = val
- elif name == "--keyfile":
- key_file = val
- elif name == "--ticketfile":
- ticket_file = val
- elif name == "--email":
- email = val
- elif name == "--ip":
- ip = val
- elif name == "--dns":
- dns = val
- elif name == "--dump_parents":
- dump_parents = True
- elif name == "--server":
- server_url = val
- elif name == "--filter":
- filter = val
- elif name == "--short":
- short = True
-
- if not args:
- print "no operation specified"
- sys.exit(-1)
-
- opname = args[0]
-
- if opname == "resolve":
- if len(args) < 2:
- print "syntax: resolve <hrn>"
- sys.exit(-1)
- hrn = args[1]
-
- elif opname == "getCredential":
- if len(args) < 3:
- print "syntax: getcredential <type> <hrn>"
- sys.exit(-1)
- type = args[1]
- hrn = args[2]
-
- elif opname == "list":
- if len(args) < 2:
- print "syntax: list <hrn>"
- sys.exit(-1)
- hrn = args[1]
-
-
- elif opname == "createGid":
- if len(args) < 4:
- print "syntax: createGid <hrn> <uuid|None> <pubkey_fn>"
- hrn = args[1]
- if args[2]=="None":
- uuid=None
- else:
- uuid = int(args[2])
- gid_pkey_fn = args[3]
-
- elif opname == "register":
- if len(args) < 4:
- print "syntax: register <type> <hrn> <gid_filename>"
- type = args[1]
- hrn = args[2]
- gid_fn = args[3]
-
- elif opname == "remove":
- if len(args) < 3:
- print "syntax: remove <type> <hrn>"
- type = args[1]
- hrn = args[2]
-
- elif opname == "update":
- if len(args) < 3:
- print "syntax: update <type> <hrn>"
- type = args[1]
- hrn = args[2]
-
- elif opname == "getTicket":
- if len(args) < 2:
- print "syntax: getTicket <hrn>"
- sys.exit(-1)
- hrn = args[1]
-
- elif opname == "dumpGid":
- if len(args) < 2:
- print "syntax: dumpGid <filename>"
- sys.exit(-1)
- dump_fn = args[1]
-
- leaf_name = get_leaf(username)
-
- if cert_file == None:
- cert_file = leaf_name + ".cert"
-
- if key_file == None:
- key_file = leaf_name + ".pkey"
-
- if cred_file == None:
- cred_file = leaf_name + ".cred"
-
-def show_options():
- print " server:", server_url
- print " username:", username
- print "cert_file:", cert_file
- print " key_file:", key_file
- print "cred_file:", cred_file
- print "operation:", opname
- print " type:", type
- print " hrn:", hrn
- print " out_file:", out_file
-
-def get_authority(x):
- parts = x.split(".")
- return ".".join(parts[:3])
-
-def dumpCredential():
- pass
-
-def dumpGid():
- gid = GID(filename = dump_fn)
- gid.dump()
-
-# creates a self-signed certificate and private key
-def createKey():
- k = Keypair(create=True)
-
- self_signed = False
- if self_signed:
- ik = k
- iname = username
- else:
- ik = Keypair(create=True)
- iname = "issuer"
-
- print "writing private key to", key_file
- k.save_to_file(key_file)
-
- #cert = Certificate(subject=username)
- #cert.set_pubkey(k)
- #cert.set_issuer(ik, iname)
- #cert.sign()
- #print "writing self-signed cert to", cert_file
- #cert.save_to_file(cert_file)
-
-def load_publickey_string(fn):
- f = file(fn,"r")
- key_string = f.read()
-
- # if the filename is a private key file, then extract the public key
- if "PRIVATE KEY" in key_string:
- outfn = tempfile.mktemp()
- cmd = "openssl rsa -in " + fn + " -pubout -outform PEM -out " + outfn
- os.system(cmd)
- f = file(outfn, "r")
- key_string = f.read()
- os.remove(outfn)
-
- return key_string
-
-def main():
- process_options()
- show_options()
-
- result = None
-
- # if the operation is not a local operation, then create a geniclient to
- # talk to the server
- if (opname != "dumpCredential") and (opname != "help") and (opname != "createKey") and (opname != "dumpGid"):
- if not os.path.exists(key_file):
- print "key file", key_file, "does not exist"
- sys.exit(-1)
- if not os.path.exists(cert_file):
- k = Keypair(filename = key_file)
- cert = Certificate(subject=username)
- cert.set_pubkey(k)
- cert.set_issuer(k, username)
- cert.sign()
- print "writing self-signed cert to", cert_file
- cert.save_to_file(cert_file)
- client = GeniClient(server_url, key_file, cert_file)
-
- # if a cred_file was specified, then load the credential
- if (cred_file=="None") or (opname == "help") or (opname == "createKey") or \
- (opname == "redeemTicket") or (opname == "dumpCredential") or (opname == "dumpGid"):
- cred = None
- else:
- cred = Credential(filename = cred_file)
-
- if opname == "dumpCredential":
- dumpCredential()
-
- elif opname == "dumpGid":
- dumpGid()
-
- elif opname == "help":
- showhelp()
-
- elif opname == "createKey":
- createKey()
-
- elif (opname == "resolve"):
- result = client.resolve(cred, hrn)
- if result:
- for record in result:
- print "RESULT:"
- record.dump(dump_parents=dump_parents)
- else:
- print "NO RESULT"
-
- elif (opname == "getCredential"):
- result = client.get_credential(cred, type, hrn)
- if result:
- print "RESULT:"
- result.dump(dump_parents=dump_parents)
- if out_file:
- file(out_file, "w").write(result.save_to_string(save_parents=True))
- else:
- print "NO RESULT"
-
- elif (opname == "list"):
- result = client.list(cred, hrn)
- if result:
- if filter:
- result = [r for r in result if r.type==filter]
- print "RESULT:"
- for record in result:
- if short:
- print " ", record.get_name()
- else:
- record.dump(dump_parents=dump_parents)
- else:
- print "NO RESULT"
-
- elif (opname == "createGid"):
- # try loading it from a private or a public key file
- pkey_string = load_publickey_string(gid_pkey_fn)
-
- gid = client.create_gid(cred, hrn, uuid, pkey_string)
- if gid:
- print "RESULT:"
- gid.dump(dump_parents=dump_parents)
- if out_file:
- file(out_file,"w").write(gid.save_to_string(save_parents=True))
- else:
- print "NO RESULT"
-
- elif (opname == "register"):
- geni_info = {}
- if type == "user":
- if not email:
- print "ERROR: must specify --email <addr> when registering users"
- geni_info['email'] = email
-
- if type == "node":
- if not ip:
- print "ERROR: must specify --ip <addr> when registering nodes"
- geni_info['ip'] = ip
- if not dns:
- print "ERROR: must specify --dns <addr> when registering nodes"
- geni_info['dns'] = dns
-
- gid = GID(filename=gid_fn)
- record = GeniRecord(name=hrn, gid=gid, type=type, pointer=-1)
- record.set_geni_info(geni_info)
-
- result = client.register(cred, record)
-
- elif (opname == "remove"):
- client.remove(cred, type, hrn)
-
- elif (opname == "update"):
- record_list = client.resolve(cred, hrn)
- if not record_list:
- print "no records match hrn"
-
- matching_records = []
- for record in record_list:
- if record.get_type() == type:
- matching_records.append(record)
-
- if not matching_records:
- print "records match hrn, but no records match type"
-
- for record in matching_records:
- geni_info = record.get_geni_info()
-
- if email:
- geni_info['email'] = email
- if ip:
- geni_info['ip'] = ip
- if dns:
- geni_info['dns'] = dns
-
- client.update(cred, record)
-
- elif (opname == "stopSlice"):
- client.stop_slice(cred)
-
- elif (opname == "startSlice"):
- client.start_slice(cred)
-
- elif (opname == "resetSlice"):
- client.reset_slice(cred)
-
- elif (opname == "deleteSlice"):
- client.delete_slice(cred)
-
- elif (opname == "listSlices"):
- result = client.list_slices(cred)
- print "RESULT:"
- print "\n".join(result)
- if out_file:
- file(out_file,"w").write("\n".join(result))
-
- elif (opname == "getTicket"):
- result = client.get_ticket(cred, hrn, {})
- if result:
- print "RESULT:"
- result.dump(dump_parents=dump_parents)
- if out_file:
- file(out_file,"w").write(result.save_to_string(save_parents=True))
- else:
- print "NO RESULT"
-
- elif (opname == "redeemTicket"):
- ticket = Ticket(filename = ticket_file)
- result = client.redeem_ticket(ticket)
-
- else:
- print "unknown operation: " + opname
-
-if __name__=="__main__":
- main()
-
+++ /dev/null
-# Assumptions:
-# planetlab.us.pl.account_test is a user that exists on the registry
-# planetlab.us.pl.test1 (pl_test1) is a slice that exists on the node
-
-rm -f test.cred
-rm -f test.cert
-rm -f pltest1.cred
-
-#USERNAME=test
-#PARENT_HRN=planetlab.us.pl
-#USER_HRN=$PARENT_HRN.account_test
-
-# The following lines use Tony Mack's planetlab account on a live PLC
-# database (tony: copy your private key to tmack.pkey in the current directory)
-USERNAME=tmack
-PARENT_HRN=planetlab.us.princeton
-USER_HRN=$PARENT_HRN.Mack_Tony
-
-NODE_URL=https://198.0.0.131:12345/
-
-# The following URL is the URL of the plc wrapper.
-
-PLC_URL=https://localhost:12345/
-
-#PLC_URL=https://198.0.0.132:12345/
-
-SA_CRED_FN=rootsa.cred
-
-SLICE_KEY_NAME=testcw
-SLICE_KEY_FN=$SLICE_KEY_NAME.pkey
-
-SLICE_NAME=$PARENT_HRN.testcw
-SLICE_CRED_NAME=testcw.cred
-SLICE_TICKET_NAME=testcw.ticket
-SLICE_GID_NAME=testcw.gid
-
-CRED_FN=$USERNAME.cred
-CERT_FN=$USERNAME.cert
-
-rm -f $SA_CRED_FN
-rm -f $CRED_FN
-rm -f $CERT_FN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Getting User Credential
-python ./genicli.py --server $PLC_URL --username $USERNAME --credfile None --outfile $CRED_FN getCredential user $USER_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Create a private key
-python ./genicli.py --server $PLC_URL --username $SLICE_KEY_NAME createKey
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Getting SA Credential
-python ./genicli.py --server $PLC_URL --username $USERNAME --outfile $SA_CRED_FN getCredential sa $PARENT_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Create a GID for a slice
-python ./genicli.py --server $PLC_URL --username $USERNAME --credfile $SA_CRED_FN --outfile $SLICE_GID_NAME createGid $SLICE_NAME None $SLICE_KEY_FN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX If the test slice already exists, Remove the test slice
-python ./genicli.py --server $PLC_URL --username $USERNAME --credfile $SA_CRED_FN remove slice $SLICE_NAME
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Register a slice
-python ./genicli.py --server $PLC_URL --username $USERNAME --credfile $SA_CRED_FN register slice $SLICE_NAME $SLICE_GID_NAME
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Get Slice Credential
-python ./genicli.py --server $PLC_URL --username $USERNAME --outfile $SLICE_CRED_NAME getCredential slice $SLICE_NAME
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Get a Ticket
-python ./genicli.py --server $PLC_URL --username $USERNAME --credfile $SLICE_CRED_NAME --outfile $SLICE_TICKET_NAME getTicket $SLICE_NAME
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Redeem a Ticket
-python ./genicli.py --server $NODE_URL --username $USERNAME --ticketfile $SLICE_TICKET_NAME redeemTicket
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Stop a Slice
-python ./genicli.py --server $NODE_URL --username $USERNAME --credfile $SLICE_CRED_NAME stopSlice
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Start a Slice
-python ./genicli.py --server $NODE_URL --username $USERNAME --credfile $SLICE_CRED_NAME startSlice
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Reset a Slice
-python ./genicli.py --server $NODE_URL --username $USERNAME --credfile $SLICE_CRED_NAME resetSlice
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Delete a Slice
-python ./genicli.py --server $NODE_URL --username $USERNAME --credfile $SLICE_CRED_NAME deleteSlice
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX List Slices
-python ./genicli.py --server $NODE_URL --username $USERNAME --credfile $SLICE_CRED_NAME listSlices
+++ /dev/null
-rm -f root.cred
-rm -f root.cert
-rm -f rootsa.cred
-rm -f testkey.pkey
-rm -f testkey.gid
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Getting Self Credential
-python ./genicli.py --username root --credfile None --outfile root.cred getCredential user planetlab.us.pl.Administrator_Default
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Getting SA Credential
-python ./genicli.py --username root --outfile rootsa.cred getCredential sa planetlab.us
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Create a private key
-python ./genicli.py --username testkey createKey
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Create a GID for an authority
-python ./genicli.py --username root --credfile rootsa.cred --outfile testauth.gid createGid planetlab.us.testauth None testkey.pkey
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Register a slice authority
-python ./genicli.py --username root --credfile rootsa.cred register sa planetlab.us.testauth testauth.gid
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Register a management authority
-python ./genicli.py --username root --credfile rootsa.cred register ma planetlab.us.testauth testauth.gid
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Resolve the test slice authority
-python ./genicli.py --username root --credfile rootsa.cred resolve planetlab.us.testauth
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Remove a the test management authority
-python ./genicli.py --username root --credfile rootsa.cred remove ma planetlab.us.testauth
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Remove the test slice authority
-python ./genicli.py --username root --credfile rootsa.cred remove sa planetlab.us.testauth
+++ /dev/null
-# The following lines use the root account of the MyPLC. This assumes that the
-# Administrator_Default has a private key that is located in the file
-# root.pkey in the current directory.
-#USERNAME=root
-#PARENT_HRN=planetlab.us.pl
-#USER_HRN=$PARENT_HRN.Administrator_Default
-
-# The following lines use Tony Mack's planetlab account on a live PLC
-# database (tony: copy your private key to tmack.pkey in the current directory)
-USERNAME=tmack
-PARENT_HRN=planetlab.us.princeton
-USER_HRN=$PARENT_HRN.Mack_Tony
-
-TEST_USER_HRN=$PARENT_HRN.testuser
-TEST_SLICE_HRN=$PARENT_HRN.testslice1
-TEST_NODE_HRN=$PARENT_HRN.testnode1
-
-TEST_NODE_IP=198.0.0.133
-
-CRED_FN=$USERNAME.cred
-CERT_FN=$USERNAME.cert
-SA_CRED_FN=$USERNAME_ma.cred
-
-rm -f $CRED_FN
-rm -f $CERT_FN
-rm -f $SA_CRED_FN
-rm -f testkey.pkey
-rm -f testkey.gid
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Getting Self Credential
-python ./genicli.py --username $USERNAME --credfile None --outfile $CRED_FN getCredential user $USER_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Resolving Self
-python ./genicli.py --username $USERNAME resolve $USER_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Getting SA Credential
-python ./genicli.py --username $USERNAME --outfile $SA_CRED_FN getCredential sa $PARENT_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX List records in an authority
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN list
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Create a private key
-python ./genicli.py --username testkey createKey
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Create a GID for a user
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN --outfile testuser.gid createGid $TEST_USER_HRN None testkey.pkey
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Create a GID for a slice
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN --outfile testslice.gid createGid $TEST_SLICE_HRN None testkey.pkey
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Create a GID for a node
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN --outfile testnode.gid createGid $TEST_NODE_HRN None testkey.pkey
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Register a user
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN --email test1234@test.com register user $TEST_USER_HRN testuser.gid
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Resolve the test user
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN resolve $TEST_USER_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Register a slice
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN register slice $TEST_SLICE_HRN testslice.gid
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Resolve the test slice
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN resolve $TEST_SLICE_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Register a node
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN --ip $TEST_NODE_IP --dns testnode1.lan register node $TEST_NODE_HRN testnode.gid
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Resolve the test node
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN resolve $TEST_NODE_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Remove the test node
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN remove node $TEST_NODE_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Remove the test slice
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN remove slice $TEST_SLICE_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Remove a user
-python ./genicli.py --username $USERNAME --credfile $SA_CRED_FN remove user $TEST_USER_HRN
+++ /dev/null
-# Assumptions
-# 1) PLC Wrapper is up and running
-# 2) Private key for test user has been copied into $USERNAME.pkey in the
-# current directory. (If this private key has a passphrase, remove it by
-# doing "ssh-keygen -pf <filename>")
-
-# The following lines use a test account. The account has a first name of "test"
-# and a last name of "account". The private key should be in the file test.pkey
-USERNAME=${USERNAME-`whoami`}
-PARENT_HRN=planetlab.us.pl
-USER_HRN=$PARENT_HRN.account_test
-
-# The following lines use Scott Baker's planetlab account on a live PLC
-# database. Modify these to use the appropriate values
-# USERNAME=bakers
-# PARENT_HRN=planetlab.us.arizona
-# USER_HRN=$PARENT_HRN.Baker_Scott
-
-# The following lines use Tony Mack's planetlab account on a live PLC
-# database (tony: copy your private key to tmack.pkey in the current directory)
-#USERNAME=tmack
-#PARENT_HRN=planetlab.us.princeton
-#USER_HRN=$PARENT_HRN.Mack_Tony
-
-PRIVKEY_FN=$USERNAME.pkey
-CRED_FN=$USERNAME.cred
-CERT_FN=$USERNAME.cert
-
-# The following URL is the URL of the plc wrapper.
-
-PLC_URL=https://localhost:12345/
-
-# PLC_URL=https://198.0.0.132:12345/
-
-rm -f $CRED_FN
-rm -f $CERT_FN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Getting Credential
-python ./genicli.py --server $PLC_URL --username $USERNAME --credfile None --outfile $CRED_FN getCredential user $USER_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Resolving Authority
-python ./genicli.py --server $PLC_URL --username $USERNAME resolve $PARENT_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Resolving Self
-python ./genicli.py --server $PLC_URL --username $USERNAME resolve $USER_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX Update Self
-python ./genicli.py --server $PLC_URL --username $USERNAME update user $USER_HRN
-
-echo XXXXX -------------------------------------------------------------------
-echo XXXXX List Records in parent authority
-python ./genicli.py --server $PLC_URL --username $USERNAME --short list $PARENT_HRN
\ No newline at end of file
Requires: pyOpenSSL >= 0.7
Requires: m2crypto
+Summary: the GENI layer around MyPLC
+Group: Applications/System
-Summary: Geniwrapper
+%package sfi
+Summary: the GENI layer around MyPLC - client side
Group: Applications/System
-%description
-Geniwrapper description...
+%description
+Geniwrapper implements the Geni interface which serves as a layer
+between the existing PlanetLab interfaces and the Geni API.
+
+%description sfi
+This package provides the client side of the Geni API, in particular
+sfi.py, together with less important utilities.
%prep
%setup -q
rm -rf $RPM_BUILD_ROOT
make install DESTDIR="$RPM_BUILD_ROOT"
-# hack to add installed files to the package
-python -c "print '\n'.join(['%s*'%i.strip() for i in open('GENI_INSTALLED_FILES').readlines() if not i.strip().endswith('.pyc')])" |uniq > GENI_INSTALLED_FILES.all
-
%clean
rm -rf $RPM_BUILD_ROOT
-%files -f GENI_INSTALLED_FILES.all
+%files
%defattr(-,root,root)
-/usr/share/keyconvert
%config (noreplace) /etc/geni/geni_config
-%config (noreplace) /etc/geni/sfi_config
%config (noreplace) /etc/geni/aggregates.xml
%config (noreplace) /etc/geni/registries.xml
+/usr/share/keyconvert/
+/etc/init.d/geni
+%{_bindir}/geni-config-tty
+%{_bindir}/gimport.py
+%{_bindir}/plc.py
+%{python_sitelib}/*
+
+%files sfi
+%config (noreplace) /etc/geni/sfi_config
+%{_bindir}/sfi.py
+%{_bindir}/getNodes.py
+%{_bindir}/getRecord.py
+%{_bindir}/setRecord.py
+%{_bindir}/genidump.py
%post
chkconfig --add geni
import shutil
from distutils.core import setup, Extension
-scripts = ['geni/gimport.py', 'geni/plc.py', 'cmdline/sfi.py', 'config/geni-config-tty']
+scripts = [ 'geni/gimport.py',
+ 'geni/plc.py',
+ 'config/geni-config-tty',
+ 'cmdline/sfi.py',
+ 'cmdline/getNodes.py',
+ 'cmdline/getRecord.py',
+ 'cmdline/setRecord.py',
+ 'cmdline/genidump.py',
+ ]
package_dirs = ['geni', 'geni/util', 'geni/methods']
data_files = [ ('/etc/geni/', ['config/aggregates.xml', 'config/registries.xml',
'config/geni_config', 'config/sfi_config']),
else:
# avoid repeating what's in the specfile already
- setup(packages = package_dirs,
+ setup(name='geni',
+ packages = package_dirs,
data_files = data_files,
ext_modules = [],
py_modules = [],