summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a844edd)
Hi Sapan
Finally, I got everything to work fine. The two main issues I realized
late were that 1) the wsdl has changed to include the request_hash,
and 2) the SOAPpy module needs to be installed for SOAP to work in the
SFA server. All good now.
Please check in the attached updated version of the RSpec manager.
Thanks
Srini.
from sfa.util.misc import *
from sfa.util.rspec import Rspec
from sfa.server.registry import Registries
from sfa.util.misc import *
from sfa.util.rspec import Rspec
from sfa.server.registry import Registries
+from sfa.util.config import Config
from sfa.plc.nodes import *
import sys
from sfa.plc.nodes import *
import sys
-# Probably the following is not essential
+#The following is not essential
#from soaplib.wsgi_soap import SimpleWSGISoapApp
#from soaplib.serializers.primitive import *
#from soaplib.serializers.clazz import *
#from soaplib.wsgi_soap import SimpleWSGISoapApp
#from soaplib.serializers.primitive import *
#from soaplib.serializers.clazz import *
import socket
import struct
import socket
import struct
-SOAP_INTERFACE_PORT = 7889
-AGGREGATE_MANAGER_PORT = 2603
-AGGREGATE_MANAGER_IP = 'localhost'
-#AGGREGATE_MANAGER_IP = 'openflowvisor.stanford.edu'
-
# Message IDs for all the GENI light calls
# This will be used by the aggrMgr controller
SFA_GET_RESOURCES = 101
# Message IDs for all the GENI light calls
# This will be used by the aggrMgr controller
SFA_GET_RESOURCES = 101
- print 'done extracting response from aggrMgr'
+ print 'Done extracting %d bytes of response from aggrMgr' % len(msg)
return msg
def connect(server, port):
return msg
def connect(server, port):
sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
sock.connect ( ( server, port) )
sock.settimeout(1)
sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
sock.connect ( ( server, port) )
sock.settimeout(1)
- print 'connected to aggregate manager module'
+ if DEBUG: print 'Connected!'
return sock
def connect_aggrMgr():
return sock
def connect_aggrMgr():
- return connect(AGGREGATE_MANAGER_IP, AGGREGATE_MANAGER_PORT)
+ (aggr_mgr_ip, aggr_mgr_port) = Config().get_openflow_aggrMgr_info()
+ if DEBUG: print """Connecting to port %d of %s""" % (aggr_mgr_port, aggr_mgr_ip)
+ return connect(aggr_mgr_ip, aggr_mgr_port)
def generate_slide_id(cred, hrn):
if cred == None:
cred = ""
if hrn == None:
hrn = ""
def generate_slide_id(cred, hrn):
if cred == None:
cred = ""
if hrn == None:
hrn = ""
- return cred + '_' + hrn
+ #return cred + '_' + hrn
+ return str(hrn)
def msg_aggrMgr(cred, hrn, msg_id):
slice_id = generate_slide_id(cred, hrn)
def msg_aggrMgr(cred, hrn, msg_id):
slice_id = generate_slide_id(cred, hrn)
aggrMgr_sock.send(buf)
aggrMgr_sock.close()
return 1
aggrMgr_sock.send(buf)
aggrMgr_sock.close()
return 1
- except socketerror, message:
+ except socket.error, message:
print "Socket error"
except IOerror, message:
print "IO error"
print "Socket error"
except IOerror, message:
print "IO error"
if DEBUG: print "Received create_slice call"
slice_id = generate_slide_id(cred, hrn)
if DEBUG: print "Received create_slice call"
slice_id = generate_slide_id(cred, hrn)
- msg = struct.pack('> B%ds%ds' % len(slice_id), SFA_CREATE_SLICE, slice_id, rspec)
+ msg = struct.pack('> B%ds%ds' % (len(slice_id)+1, len(rspec)), SFA_CREATE_SLICE, slice_id, rspec)
buf = struct.pack('> H', len(msg)+2) + msg
try:
aggrMgr_sock = connect_aggrMgr()
aggrMgr_sock.send(buf)
buf = struct.pack('> H', len(msg)+2) + msg
try:
aggrMgr_sock = connect_aggrMgr()
aggrMgr_sock.send(buf)
+ if DEBUG: print "Sent %d bytes and closing connection" % len(buf)
+
+ if DEBUG: print "----------------"
- except socketerror, message:
+ except socket.error, message:
print "Socket error"
except IOerror, message:
print "IO error"
return 0
print "Socket error"
except IOerror, message:
print "IO error"
return 0
-def get_resources(cred, hrn=None):
- if DEBUG: print "Received get_resources call"
+def get_rspec(cred, hrn=None):
+ if DEBUG: print "Received get_rspec call"
slice_id = generate_slide_id(cred, hrn)
msg = struct.pack('> B%ds' % len(slice_id), SFA_GET_RESOURCES, slice_id)
slice_id = generate_slide_id(cred, hrn)
msg = struct.pack('> B%ds' % len(slice_id), SFA_GET_RESOURCES, slice_id)
resource_list = extract(aggrMgr_sock);
aggrMgr_sock.close()
resource_list = extract(aggrMgr_sock);
aggrMgr_sock.close()
+ if DEBUG: print "----------------"
- except socketerror, message:
+ except socket.error, message:
print "Socket error"
except IOerror, message:
print "IO error"
print "Socket error"
except IOerror, message:
print "IO error"