Exemple #1
0
    def onStartListeningFailed(self, e):
        """
		"""
        self.debug(e)
        # log event
        tpl = self.encapsule(ip_event=AdapterIP.received(),
                             udp_event=templates.listening_failed())
        self.logRecvEvent(shortEvt="listening failed", tplEvt=tpl)
Exemple #2
0
    def isListeningFailed(self,
                          timeout=1.0,
                          versionIp=None,
                          sourceIp=None,
                          destinationIp=None,
                          sourcePort=None,
                          destinationPort=None):
        """
		Wait to receive "listening failed" 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_failed()
        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
Exemple #3
0
    def isListeningFailed(self,
                          timeout=1.0,
                          versionIp=None,
                          sourceIp=None,
                          destinationIp=None,
                          sourcePort=None,
                          destinationPort=None):
        """
		Wait to receive "listening failed" 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_failed()
        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
Exemple #4
0
    def isListeningFailed(self, timeout=1.0):
        """
		Wait to receive "listening failed" 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_failed()
        expected = self.getExpectedTemplate(tpl=tpl)

        # try to match the template
        evt = self.received(expected=expected, timeout=timeout)
        return evt
Exemple #5
0
    def isListeningFailed(self, timeout=1.0):
        """
		Wait to receive "listening failed" 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_failed()
        expected = self.getExpectedTemplate(tpl=tpl)

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