Example #1
0
def onLogNotification(probeUri, logClass, logInfo):
    probeUri = str(probeUri)
    try:
        # if we receive the notification, that's we subscribe for the probe - normally
        if not WatchedProbes.has_key(probeUri):
            return

        if logClass == "system-sent":
            label = logInfo["label"]
            payload = logInfo["payload"]
            sutAddress = logInfo.get('sut-address', None)
            # TODO/FIXME: retrieve the tsiPort from the probeUri
            TestermanTCI.logSystemSent(tsiPort=probeUri,
                                       label=label,
                                       payload=payload,
                                       sutAddress=sutAddress)

        elif logClass == "system-received":
            label = logInfo["label"]
            payload = logInfo["payload"]
            sutAddress = logInfo.get('sut-address', None)
            # TODO/FIXME: retrieve the tsiPort from the probeUri
            TestermanTCI.logSystemReceived(tsiPort=probeUri,
                                           label=label,
                                           payload=payload,
                                           sutAddress=sutAddress)

    except Exception, e:
        log("Exception in onLogNotification: %s" % str(e))
Example #2
0
	def info(self, txt): TestermanTCI.logInternal("SA: %s" % txt)


################################################################################
# The TRI interface - TE Provided
################################################################################

TE_triEnqueueMsg = None
Example #3
0
def triSUTactionInformal(message, timeout, tc):
    _ActionLock.acquire()
    _ActionEvent.clear()
    # Send a "signal" to the job subscribers to display a prompt
    TestermanTCI.logActionRequested(message, timeout, tc)
    # Wait
    _ActionEvent.wait(timeout)
    # Send a "signal clear" to the job subscribers to hide the prompt, if needed
    TestermanTCI.logActionCleared(reason="n/a", tc=tc)
    _ActionLock.release()
Example #4
0
def triSUTactionInformal(message, timeout, tc):
	_ActionLock.acquire()
	_ActionEvent.clear()
	# Send a "signal" to the job subscribers to display a prompt
	TestermanTCI.logActionRequested(message, timeout, tc)
	# Wait
	_ActionEvent.wait(timeout)
	# Send a "signal clear" to the job subscribers to hide the prompt, if needed
	TestermanTCI.logActionCleared(reason = "n/a", tc = tc)
	_ActionLock.release()
Example #5
0
def triSend(componentId, tsiPortId, sutAddress, message):
    """
	@type  componentId: string
	@param componentId: the name of the TC that sends the message (not used yet)
	@type  tsiPortId: string
	@param tsiPortId: the name of the system port from which we send the message. Must be bound to a test adapter.
	@type  sutAddress: test adapter/probe dependent
	@param sutAddress: test adapter/probe-dependent (IP address, URL, ...)
	@type  message: test adapter/probe-dependent, but valid "Testerman" message structure
	@param message: test adapter/probe-dependent message (already encoded through possible codecs)
	
	@rtype: integer
	@returns: TR_Error (1) if the probe resource was unavailable or cannot be found.
	          TR_OK (0) if the resource was correctly acquired.
	@throws: TestermanException, Exception
	"""
    # Look for a test adapter bound to this system port
    if not ProbeBindings.has_key(tsiPortId):
        raise TestermanSAException(
            "Internal error: trying to send a message through unbound test system port %s"
            % tsiPortId)

    # Test adapter found. Send the message through it.
    probe = ProbeBindings[tsiPortId]
    try:
        probe.onTriSend(message, sutAddress)
    except Exception:
        raise TestermanSAException(
            "Unable to send message through TSI port '%s': %s " %
            (tsiPortId, TestermanTCI.getBacktrace()))

    return TR_OK
Example #6
0
def onLogNotification(probeUri, logClass, logInfo):
	probeUri = str(probeUri)
	try:
		# if we receive the notification, that's we subscribe for the probe - normally
		if not WatchedProbes.has_key(probeUri): 
			return

		if logClass == "system-sent":
			label = logInfo["label"]
			payload = logInfo["payload"]
			sutAddress = logInfo.get('sut-address', None)
			# TODO/FIXME: retrieve the tsiPort from the probeUri
			TestermanTCI.logSystemSent(tsiPort = probeUri, label = label, payload = payload, sutAddress = sutAddress)

		elif logClass == "system-received":
			label = logInfo["label"]
			payload = logInfo["payload"]
			sutAddress = logInfo.get('sut-address', None)
			# TODO/FIXME: retrieve the tsiPort from the probeUri
			TestermanTCI.logSystemReceived(tsiPort = probeUri, label = label, payload = payload, sutAddress = sutAddress)

	except Exception, e:
		log("Exception in onLogNotification: %s" % str(e))
Example #7
0
 def debug(self, txt):
     TestermanTCI.logInternal("SA: %s" % txt)
Example #8
0
 def error(self, txt):
     TestermanTCI.logInternal("SA: %s" % txt)
Example #9
0
 def warning(self, txt):
     TestermanTCI.logInternal("SA: %s" % txt)
Example #10
0
 def logReceivedPayload(self, label, payload, sutAddress=None):
     TestermanTCI.logSystemReceived(tsiPort=self.getUri(),
                                    label=label,
                                    payload=payload,
                                    sutAddress=sutAddress)
Example #11
0
 def logSentPayload(self, label, payload, sutAddress=None):
     TestermanTCI.logSystemSent(tsiPort=self.getUri(),
                                label=label,
                                payload=payload,
                                sutAddress=sutAddress)
Example #12
0
def log(msg):
    TestermanTCI.logInternal("SA: %s" % msg)
Example #13
0
def log(msg):
	TestermanTCI.logInternal("SA: %s" % msg)
Example #14
0
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
##

##
# Codec manager - view from the TE
##

import CodecManager
import TestermanTCI

from CodecManager import CodecNotFoundException

CodecManager.instance().setLogCallback(
    lambda x: TestermanTCI.logInternal("CD: %s" % x))


def instance():
    return CodecManager.instance()


def alias(name, codec, **kwargs):
    return instance().alias(name, codec, **kwargs)


def registerCodecClass(name, class_):
    return instance().registerCodecClass(name, class_)


def encode(name, template):
Example #15
0
	def logSentPayload(self, label, payload, sutAddress = None):
		TestermanTCI.logSystemSent(tsiPort = self.getUri(), label = label, payload = payload, sutAddress = sutAddress)
Example #16
0
	def critical(self, txt): TestermanTCI.logInternal("SA: %s" % txt)
	def info(self, txt): TestermanTCI.logInternal("SA: %s" % txt)
Example #17
0
	def error(self, txt): TestermanTCI.logInternal("SA: %s" % txt)
	def debug(self, txt): TestermanTCI.logInternal("SA: %s" % txt)
Example #18
0
	def warning(self, txt): TestermanTCI.logInternal("SA: %s" % txt)
	def error(self, txt): TestermanTCI.logInternal("SA: %s" % txt)
Example #19
0
 def critical(self, txt):
     TestermanTCI.logInternal("SA: %s" % txt)
Example #20
0
def triSend(componentId, tsiPortId, sutAddress, message):
	"""
	@type  componentId: string
	@param componentId: the name of the TC that sends the message (not used yet)
	@type  tsiPortId: string
	@param tsiPortId: the name of the system port from which we send the message. Must be bound to a test adapter.
	@type  sutAddress: test adapter/probe dependent
	@param sutAddress: test adapter/probe-dependent (IP address, URL, ...)
	@type  message: test adapter/probe-dependent, but valid "Testerman" message structure
	@param message: test adapter/probe-dependent message (already encoded through possible codecs)
	
	@rtype: integer
	@returns: TR_Error (1) if the probe resource was unavailable or cannot be found.
	          TR_OK (0) if the resource was correctly acquired.
	@throws: TestermanException, Exception
	"""
	# Look for a test adapter bound to this system port
	if not ProbeBindings.has_key(tsiPortId):
		raise TestermanSAException("Internal error: trying to send a message through unbound test system port %s" % tsiPortId)

	# Test adapter found. Send the message through it.
	probe = ProbeBindings[tsiPortId]
	try:
		probe.onTriSend(message, sutAddress)
	except Exception:
		raise TestermanSAException("Unable to send message through TSI port '%s': %s " % (tsiPortId, TestermanTCI.getBacktrace()))

	return TR_OK
Example #21
0
 def info(self, txt):
     TestermanTCI.logInternal("SA: %s" % txt)
Example #22
0
	def logReceivedPayload(self, label, payload, sutAddress = None):
		TestermanTCI.logSystemReceived(tsiPort = self.getUri(), label = label, payload = payload, sutAddress = sutAddress)
Example #23
0
def log(message):
	TestermanTCI.logInternal("PA: %s" % str(message))
Example #24
0
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
##

##
# Codec manager - view from the TE
##

import CodecManager
import TestermanTCI

from CodecManager import CodecNotFoundException


CodecManager.instance().setLogCallback(lambda x: TestermanTCI.logInternal("CD: %s" % x))

def instance():
	return CodecManager.instance()

def alias(name, codec, **kwargs):
	return instance().alias(name, codec, **kwargs)

def registerCodecClass(name, class_):
	return instance().registerCodecClass(name, class_)

def encode(name, template):
	return instance().encode(name, template)

def decode(name, data):
	return instance().decode(name, data)