From 6ae490f8eb6b19a30996a2df023ca87b5bcaf9e9 Mon Sep 17 00:00:00 2001 From: Julien Tribino Date: Thu, 21 Feb 2013 10:38:42 +0100 Subject: [PATCH] factoring code debug --- examples/omf-nitos-vlc.py | 6 ++-- examples/omf-plexuslab-vlc.py | 4 +-- src/nepi/testbeds/omf/omf_client.py | 52 ++++++++++++----------------- 3 files changed, 28 insertions(+), 34 deletions(-) diff --git a/examples/omf-nitos-vlc.py b/examples/omf-nitos-vlc.py index 3475703f..33f13d3e 100644 --- a/examples/omf-nitos-vlc.py +++ b/examples/omf-nitos-vlc.py @@ -83,7 +83,8 @@ channel.connector("devs").connect(iface2.connector("chan")) # Add a vlc server to stream a video using multicast app1 = omf_desc.create("OmfApplication") app1.set_attribute_value("appId", "Vlc#1") -app1.set_attribute_value("arguments", "/opt/bbb_240p_mpeg4_lq.ts --sout '#rtp{dst=239.255.0.1,port=1234,mux=ts}' vlc://quit") +#app1.set_attribute_value("arguments", "/opt/bbb_240p_mpeg4_lq.ts --sout '#rtp{dst=239.255.0.1,port=1234,mux=ts}' vlc://quit") +app1.set_attribute_value("arguments", "/opt/10-by-p0d.avi --sout '#rtp{dst=192.168.0.20,port=1234,mux=ts}' vlc://quit") app1.set_attribute_value("path", "/opt/vlc-1.1.13/cvlc") app1.set_attribute_value("env", "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority") app1.connector("node").connect(node1.connector("apps")) @@ -91,7 +92,8 @@ app1.connector("node").connect(node1.connector("apps")) # Add a vlc client to receive the video stream app2 = omf_desc.create("OmfApplication") app2.set_attribute_value("appId", "Vlc#2") -app2.set_attribute_value("arguments", "rtp://239.255.0.1:1234") +#app2.set_attribute_value("arguments", "rtp://239.255.0.1:1234") +app2.set_attribute_value("arguments", "rtp://192.168.0.20:1234") app2.set_attribute_value("path", "/opt/vlc-1.1.13/cvlc") # To see the stream to a ssh -X connection, the DISPLAY variable must be set to the value of the node. # Also don't forget to execute in 'xhost + localhost' in the node diff --git a/examples/omf-plexuslab-vlc.py b/examples/omf-plexuslab-vlc.py index 0601cd03..7127c1c7 100644 --- a/examples/omf-plexuslab-vlc.py +++ b/examples/omf-plexuslab-vlc.py @@ -26,7 +26,7 @@ omf_provider = FactoriesProvider(testbed_id) omf_desc = exp_desc.add_testbed_description(omf_provider) omf_desc.set_attribute_value("homeDirectory", root_dir) omf_desc.set_attribute_value("enableDebug", True) -omf_desc.set_attribute_value("xmppSlice", "default_slice") +omf_desc.set_attribute_value("xmppSlice", "nepi") omf_desc.set_attribute_value("xmppHost", "xmpp-plexus.onelab.eu") omf_desc.set_attribute_value("xmppPort", 5222) omf_desc.set_attribute_value("xmppPassword", "1234") @@ -84,7 +84,7 @@ channel.connector("devs").connect(iface2.connector("chan")) app1 = omf_desc.create("OmfApplication") app1.set_attribute_value("appId", "Vlc#1") #app1.set_attribute_value("arguments", "/opt/bbb_240p_mpeg4_lq.ts --sout '#rtp{dst=239.255.0.1,port=1234,mux=ts}' vlc://quit") -app1.set_attribute_value("arguments", "/opt/bbb_240p_mpeg4_lq.ts --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}' vlc://quit") +app1.set_attribute_value("arguments", "/opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}' vlc://quit") app1.set_attribute_value("path", "/opt/vlc-1.1.13/cvlc") app1.set_attribute_value("env", "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority") app1.connector("node").connect(node1.connector("apps")) diff --git a/src/nepi/testbeds/omf/omf_client.py b/src/nepi/testbeds/omf/omf_client.py index eb3d2d84..9312753e 100644 --- a/src/nepi/testbeds/omf/omf_client.py +++ b/src/nepi/testbeds/omf/omf_client.py @@ -149,8 +149,10 @@ class OMFClient(sleekxmpp.ClientXMPP): def subscribe(self, node): try: result = self['xep_0060'].subscribe(self._server, node) + #self._logger.debug('Subscribed %s to node %s' \ + #% (self.boundjid.bare, node)) self._logger.info('Subscribed %s to node %s' \ - % (self.boundjid.bare, self.boundjid)) + % (self.boundjid.user, node)) except: error = traceback.format_exc() self._logger.error('Could not subscribe %s to node %s\ntraceback:\n%s' \ @@ -172,40 +174,30 @@ class OMFClient(sleekxmpp.ClientXMPP): else : return None - def _check_app_event(self, treeroot, namespaces): - message = self._check_for_tag(treeroot, namespaces, 'MESSAGE') - if message is not None : - target = self._check_for_tag(treeroot, namespaces, 'TARGET') - if target is not None : - self._logger.info(target.text + ": APP_EVENT: " + message.text) - - def _check_configure(self, treeroot, namespaces, status): - for message in treeroot.iter(namespaces + status): - reason = self._check_for_tag(treeroot, namespaces, 'REASON') - if reason is not None and reason.text!="ENROLLED" : - target = self._check_for_tag(treeroot, namespaces, 'TARGET') - if target is not None : - path = self._check_for_tag(treeroot, namespaces, 'PATH') - if path is not None : - self._logger.debug(target.text+ ": " +reason.text+ ": " +path.text) - else : - self._logger.debug(target.text+ ": " +reason.text ) + def _check_output(self, treeroot, namespaces): + output_param = ["TARGET", "REASON", "PATH", "APPID", "VALUE"] + response = "" + for elt in output_param: + msg = self._check_for_tag(treeroot, namespaces, elt) + if msg is not None: + response = response + msg.text + ": " + #if (log = Debug !!!) : + # deb = self._check_for_tag(treeroot, namespaces, "MESSAGE") + # if deb is not None: + # self._logger.debug(response + deb.text) + #else : + # self._logger.info(response) + deb = self._check_for_tag(treeroot, namespaces, "MESSAGE") + if deb is not None: + self._logger.debug(response + deb.text) + else : + self._logger.debug(response) def handle_omf_message(self, iq): namespaces = "{http://jabber.org/protocol/pubsub}" for i in iq['pubsub_event']['items']: root = ET.fromstring(str(i)) - self._check_app_event(root, namespaces) - self._check_configure(root, namespaces, "OK") - self._check_configure(root, namespaces, "ERROR") + self._check_output(root, namespaces) #self._logger.debug(i) - -#default_slice-2012-12-20t12.07.02+02.00CONFIGUREDomf.plexus.wlab17default_slicecvlcmodenet/w0/essid - -#default_slice-2012-12-20t12.07.02+02.00FAILED_CONFIGUREomf.plexus.wlab17default_slicegnet/w0/type - - #2default_slicenodeHandler::NodeHandlerdefault_slice-2012-09-28t16.22.17+02.00INFOOMF Experiment Controller 5.4 (git 529a626) - - -- 2.47.0