示例#1
0
    def onStartListening(self):
        """
		"""
        self.debug('on start listening called')

        # log event
        tpl = self.encapsule(ip_event=AdapterIP.received(),
                             udp_event=templates.listening())
        self.logRecvEvent(shortEvt="listening", tplEvt=tpl)
示例#2
0
    def isListening(self,
                    timeout=1.0,
                    versionIp=None,
                    sourceIp=None,
                    destinationIp=None,
                    sourcePort=None,
                    destinationPort=None):
        """
		Wait to receive "listening" event until the end of the timeout
		
		@param timeout: time max to wait to receive event in second (default=1s)
		@type timeout: float		

		@param versionIp: version ip expected
		@type versionIp: string/operators/none	

		@param sourceIp: source ip expected
		@type sourceIp:	string/operators/none	
		
		@param destinationIp: destination ip expected
		@type destinationIp: string/operators/none	
		
		@param sourcePort: source port expected
		@type sourcePort:	string/operators/none
		
		@param destinationPort: destination port expected
		@type destinationPort: string/operators/none	
		
		@return: an event matching with the template or None otherwise
		@rtype: templatemessage		
		"""
        if not (isinstance(timeout, int)
                or isinstance(timeout, float)) or isinstance(timeout, bool):
            raise TestAdapterLib.ValueException(
                TestAdapterLib.caller(),
                "timeout argument is not a float or integer (%s)" %
                type(timeout))

        # construct the expected template
        tpl = templates.listening()
        expected = self.getExpectedTemplate(tpl=tpl,
                                            versionIp=versionIp,
                                            sourceIp=sourceIp,
                                            destinationIp=destinationIp,
                                            sourcePort=sourcePort,
                                            destinationPort=destinationPort)

        # try to match the template
        evt = self.received(expected=expected, timeout=timeout)
        return evt
示例#3
0
    def isListening(self,
                    timeout=1.0,
                    versionIp=None,
                    sourceIp=None,
                    destinationIp=None,
                    sourcePort=None,
                    destinationPort=None):
        """
		Wait to receive "listening" event until the end of the timeout
		
		@param timeout: time max to wait to receive event in second (default=1s)
		@type timeout: float		

		@param versionIp: version ip expected
		@type versionIp: string/operators/none	

		@param sourceIp: source ip expected
		@type sourceIp:	string/operators/none	
		
		@param destinationIp: destination ip expected
		@type destinationIp: string/operators/none	
		
		@param sourcePort: source port expected
		@type sourcePort:	string/operators/none
		
		@param destinationPort: destination port expected
		@type destinationPort: string/operators/none	
		
		@return: an event matching with the template or None otherwise
		@rtype: templatemessage		
		"""
        TestAdapterLib.check_timeout(caller=TestAdapterLib.caller(),
                                     timeout=timeout)

        # construct the expected template
        tpl = templates.listening()
        expected = self.getExpectedTemplate(tpl=tpl,
                                            versionIp=versionIp,
                                            sourceIp=sourceIp,
                                            destinationIp=destinationIp,
                                            sourcePort=sourcePort,
                                            destinationPort=destinationPort)

        # try to match the template
        evt = self.received(expected=expected, timeout=timeout)
        return evt
示例#4
0
    def isListening(self, timeout=1.0):
        """
		Wait to receive "listening" event until the end of the timeout
		
		@param timeout: time max to wait to receive event in second (default=1s)
		@type timeout: float		

		@return: an event matching with the template or None otherwise
		@rtype: templatemessage		
		"""
        TestAdapterLib.check_timeout(caller=TestAdapterLib.caller(),
                                     timeout=timeout)

        # construct the expected template
        tpl = templates.listening()
        expected = self.getExpectedTemplate(tpl=tpl)

        # try to match the template
        evt = self.received(expected=expected, timeout=timeout)
        return evt
示例#5
0
    def isListening(self, timeout=1.0):
        """
		Wait to receive "listening" event until the end of the timeout
		
		@param timeout: time max to wait to receive event in second (default=1s)
		@type timeout: float		

		@return: an event matching with the template or None otherwise
		@rtype: templatemessage		
		"""
        if not (isinstance(timeout, int)
                or isinstance(timeout, float)) or isinstance(timeout, bool):
            raise TestAdapterLib.ValueException(
                TestAdapterLib.caller(),
                "timeout argument is not a float or integer (%s)" %
                type(timeout))

        # construct the expected template
        tpl = templates.listening()
        expected = self.getExpectedTemplate(tpl=tpl)

        # try to match the template
        evt = self.received(expected=expected, timeout=timeout)
        return evt