X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=omf%2Fomf-slicemgr.py;h=0589aabcc46d0c987da8263b37996ea67276f99e;hb=3c4cc4bcddb573941570ffa26c51d287cfe32fa3;hp=310e65682d8d7e2789309c10e178f98597c6be2a;hpb=1cda98c34563ed3e90a9d2219730ae81f9705dc6;p=plcapi.git diff --git a/omf/omf-slicemgr.py b/omf/omf-slicemgr.py index 310e656..0589aab 100644 --- a/omf/omf-slicemgr.py +++ b/omf/omf-slicemgr.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # Baris Metin import os @@ -191,17 +192,17 @@ class PubSubClient(BaseClient): -class Slicemgr(PubSubClient, xmlrpc.XMLRPC): +class Slicemgr(xmlrpc.XMLRPC, PubSubClient): DOMAIN = "/OMF" RESOURCES = 'resources' def __init__(self, id, secret, verbose = False, log = None): + xmlrpc.XMLRPC.__init__(self, allowNone=True) PubSubClient.__init__(self, id, secret, verbose = verbose, log = log) self.command_queue = Queue.Queue() - # for xmlrpc interface - self.allowNone = True + xmlrpc.addIntrospection(self) def xmlrpc_createSlice(self, slice): self.create_slice(slice) @@ -253,9 +254,9 @@ if __name__ == "__main__": config = Config("/etc/planetlab/plc_config") - xmppserver = self.config.PLC_OMF_XMPP_SERVER - xmppuser = "@".join([self.config.PLC_OMF_XMPP_USER, xmppserver]) - xmpppass = self.config.PLC_OMF_XMPP_PASSWORD + xmppserver = config.PLC_OMF_XMPP_SERVER + xmppuser = "@".join([config.PLC_OMF_XMPP_USER, xmppserver]) + xmpppass = config.PLC_OMF_XMPP_PASSWORD slicemgr = Slicemgr(xmppuser, xmpppass, log=open("/var/log/omf/pubsub_client.log", "a"), verbose=True) @@ -263,7 +264,7 @@ if __name__ == "__main__": t = task.LoopingCall(slicemgr.flush_commands) t.start(5.0) # check every 5 seconds reactor.connectTCP(slicemgr.id.host, 5222, slicemgr.factory) - reactor.listenTCP(5053, server.Site(slicemgr)) + reactor.listenTCP(5053, server.Site(slicemgr), interface="localhost") reactor.run(installSignalHandlers=True)