Index: fedd/abac_client.py
===================================================================
--- fedd/abac_client.py	(revision 19a3e06e1d4620767d0d9a8593b731bb3bfd6ec5)
+++ fedd/abac_client.py	(revision 181cf9cdb0c6f6c74c0c351b41434bba3f7a9c3c)
@@ -227,4 +227,10 @@
 	self.add_option("-l","--label", action="store", dest="label",
 		type="string", help="Label for output")
+	self.add_option("-i", "--context_id", action="store", dest="id",
+		type="string",
+		help="Negotiation context identifier (required)")
+	self.add_option("-g", "--goal", action="store", dest="goal",
+		type="string",
+		help="Trust target goal for negotiation (required)")
 	if add_node_callback:
 	    self.add_option("-n", "--node", action="callback", type="string", 
@@ -494,5 +500,5 @@
 #	out_certfile = opts.out_certfile
 
-	print "file = %s" % opts.file
+	print "New context using file: %s" % opts.file
 #	msg = { 'ContextIn': { 'contextFile': opts.file } }
 	msg = { 'contextFile': opts.file }
@@ -513,5 +519,90 @@
 	if opts.debug > 1: print >>sys.stderr, resp_dict
 
-	ea = resp_dict.get('experimentAccess', None)
+#	ea = resp_dict.get('experimentAccess', None)
+	id = resp_dict.get('contextID', None)
+	print "New context loaded w/id = %s" % id
+
+class negotiate(abac_rpc):
+    def __init__(self): 
+	abac_rpc.__init__(self, "Negotiate")
+    def __call__(self):
+	access_keys = []
+	# Process the options using the customized option parser defined above
+	parser = abac_create_opts(access_keys, self.add_ssh_key,
+		self.add_x509_cert)
+
+	(opts, args) = parser.parse_args()
+
+	if opts.trusted:
+	    if ( not os.access(opts.trusted, os.R_OK) ) :
+		sys.exit("Cannot read trusted certificates (%s)" % opts.trusted)
+
+	if not opts.project :
+	    parser.error('--project is required')
+
+	if opts.debug > 0: opts.tracefile=sys.stderr
+
+	(user, cert) = self.get_user_info(access_keys)
+
+	if opts.user: user = opts.user
+
+	if opts.cert != None: cert = opts.cert
+
+	if cert == None:
+	    sys.exit("No certificate given (--cert) or found")
+
+	if os.access(cert, os.R_OK):
+	    fid = fedid(file=cert)
+	    if opts.use_fedid == True:
+		user = fid
+	else:
+	    sys.exit("Cannot read certificate (%s)" % cert)
+
+	if opts.file:
+	    exp_desc = ""
+	    try:
+		f = open(opts.file, 'r')
+		for line in f:
+		    exp_desc += line
+		f.close()
+	    except IOError:
+		sys.exit("Cannot read description file (%s)" %opts.file)
+	else:
+	    sys.exit("Must specify an experiment description (--file)")
+
+	if not opts.master:
+	    sys.exit("Must specify a master testbed (--master)")
+
+	out_certfile = opts.out_certfile
+
+	msg = {
+		'experimentdescription': { 'ns2description': exp_desc },
+		'master': opts.master,
+		'exportProject': { 'localname': opts.project },
+		'user' : [ {\
+			'userID': pack_id(user), \
+			'access': [ { a.type: a.buf } for a in access_keys]\
+			} ]
+		}
+
+	if opts.exp_name:
+	    msg['experimentID'] = { 'localname': opts.exp_name }
+
+	if opts.debug > 1: print >>sys.stderr, msg
+
+	try:
+	    resp_dict = self.do_rpc(msg, 
+		    opts.url, opts.transport, cert, opts.trusted, 
+		    serialize_only=opts.serialize_only,
+		    tracefile=opts.tracefile)
+	except self.RPCException, e:
+	    exit_with_fault(\
+		    {'desc': e.desc, 'errstr': e.errstr, 'code': e.code})
+	except RuntimeError, e:
+	    sys.exit("Error processing RPC: %s" % e)
+
+	if opts.debug > 1: print >>sys.stderr, resp_dict
+
+	ea = resp_dict.get('goal')
 	if out_certfile and ea and ea.has_key('X509'):
 	    try:
@@ -530,11 +621,11 @@
 	    print "status: %s" % st
 
-class negotiate(abac_rpc):
+class access(abac_rpc):
     def __init__(self): 
-	abac_rpc.__init__(self, "Negotiate")
+	abac_rpc.__init__(self, "Access")
     def __call__(self):
 	access_keys = []
 	# Process the options using the customized option parser defined above
-	parser = abac_create_opts(access_keys, self.add_ssh_key,
+	parser = abac_access_opts(access_keys, self.add_ssh_key,
 		self.add_x509_cert)
 
@@ -545,12 +636,9 @@
 		sys.exit("Cannot read trusted certificates (%s)" % opts.trusted)
 
-	if not opts.project :
-	    parser.error('--project is required')
-
 	if opts.debug > 0: opts.tracefile=sys.stderr
 
 	(user, cert) = self.get_user_info(access_keys)
 
-	if opts.user: user = opts.user
+#	if opts.user: user = opts.user
 
 	if opts.cert != None: cert = opts.cert
@@ -566,33 +654,16 @@
 	    sys.exit("Cannot read certificate (%s)" % cert)
 
-	if opts.file:
-	    exp_desc = ""
-	    try:
-		f = open(opts.file, 'r')
-		for line in f:
-		    exp_desc += line
-		f.close()
-	    except IOError:
-		sys.exit("Cannot read description file (%s)" %opts.file)
-	else:
-	    sys.exit("Must specify an experiment description (--file)")
-
-	if not opts.master:
-	    sys.exit("Must specify a master testbed (--master)")
-
-	out_certfile = opts.out_certfile
+	if not opts.id:
+	    sys.exit("Must specify a negotiator id (--id)")
+
+	if not opts.goal:
+	    sys.exit("Must specify a goal (--goal)")
+
+#	out_certfile = opts.out_certfile
 
 	msg = {
-		'experimentdescription': { 'ns2description': exp_desc },
-		'master': opts.master,
-		'exportProject': { 'localname': opts.project },
-		'user' : [ {\
-			'userID': pack_id(user), \
-			'access': [ { a.type: a.buf } for a in access_keys]\
-			} ]
+                'context': { 'contextID': opts.id },
+                'goal': opts.goal
 		}
-
-	if opts.exp_name:
-	    msg['experimentID'] = { 'localname': opts.exp_name }
 
 	if opts.debug > 1: print >>sys.stderr, msg
@@ -611,104 +682,7 @@
 	if opts.debug > 1: print >>sys.stderr, resp_dict
 
-	ea = resp_dict.get('experimentAccess', None)
-	if out_certfile and ea and ea.has_key('X509'):
-	    try:
-		f = open(out_certfile, "w")
-		print >>f, ea['X509']
-		f.close()
-	    except IOError:
-		sys.exit('Could not write to %s' %  out_certfile)
-	eid = resp_dict.get('experimentID', None)
-	if eid:
-	    for id in eid:
-		for k in id.keys():
-		    print "%s: %s" % (k, id[k])
-	st = resp_dict.get('experimentStatus', None)
-	if st:
-	    print "status: %s" % st
-
-class access(abac_rpc):
-    def __init__(self): 
-	abac_rpc.__init__(self, "Access")
-    def __call__(self):
-	access_keys = []
-	# Process the options using the customized option parser defined above
-	parser = abac_create_opts(access_keys, self.add_ssh_key,
-		self.add_x509_cert)
-
-	(opts, args) = parser.parse_args()
-
-	if opts.trusted:
-	    if ( not os.access(opts.trusted, os.R_OK) ) :
-		sys.exit("Cannot read trusted certificates (%s)" % opts.trusted)
-
-	if not opts.project :
-	    parser.error('--project is required')
-
-	if opts.debug > 0: opts.tracefile=sys.stderr
-
-	(user, cert) = self.get_user_info(access_keys)
-
-	if opts.user: user = opts.user
-
-	if opts.cert != None: cert = opts.cert
-
-	if cert == None:
-	    sys.exit("No certificate given (--cert) or found")
-
-	if os.access(cert, os.R_OK):
-	    fid = fedid(file=cert)
-	    if opts.use_fedid == True:
-		user = fid
-	else:
-	    sys.exit("Cannot read certificate (%s)" % cert)
-
-	if not opts.id:
-	    sys.exit("Must specify a negotiator id (--id)")
-
-	if not opts.goal:
-	    sys.exit("Must specify a goal (--file)")
-
-	out_certfile = opts.out_certfile
-
-	msg = {
-                'context': { 'contextID': opts.contextID },
-                'goal': opts.goal
-		}
-
-	if opts.exp_name:
-	    msg['experimentID'] = { 'localname': opts.exp_name }
-
-	if opts.debug > 1: print >>sys.stderr, msg
-
-	try:
-	    resp_dict = self.do_rpc(msg, 
-		    opts.url, opts.transport, cert, opts.trusted, 
-		    serialize_only=opts.serialize_only,
-		    tracefile=opts.tracefile)
-	except self.RPCException, e:
-	    exit_with_fault(\
-		    {'desc': e.desc, 'errstr': e.errstr, 'code': e.code})
-	except RuntimeError, e:
-	    sys.exit("Error processing RPC: %s" % e)
-
-	if opts.debug > 1: print >>sys.stderr, resp_dict
-
-	ea = resp_dict.get('experimentAccess', None)
-	if out_certfile and ea and ea.has_key('X509'):
-	    try:
-		f = open(out_certfile, "w")
-		print >>f, ea['X509']
-		f.close()
-	    except IOError:
-		sys.exit('Could not write to %s' %  out_certfile)
-	eid = resp_dict.get('experimentID', None)
-	if eid:
-	    for id in eid:
-		for k in id.keys():
-		    print "%s: %s" % (k, id[k])
-	st = resp_dict.get('experimentStatus', None)
-	if st:
-	    print "status: %s" % st
+	result = resp_dict.get('result', None)
+	goal = resp_dict.get('goal', None)
+        print "%s: %s" % (goal, result)
 
 def exit_with_fault(dict, out=sys.stderr):
