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

        # log event
        tpl = self.encapsule(ip_event=AdapterIP.received(),
                             udp_event=templates.stopped())
        self.logRecvEvent(shortEvt="stopped", tplEvt=tpl)
示例#2
0
    def onStopListening(self):
        """
		"""
        self.debug('on stop sniffing called')

        # log event
        ether_tpl = templates.ethernet(more=templates.stopped(
            interface=self.cfg['src-eth']))
        frame_tpl = self.encapsule(layer_ether=ether_tpl)
        self.logRecvEvent(shortEvt="stopped", tplEvt=frame_tpl)
示例#3
0
    def isStopped(self,
                  timeout=1.0,
                  versionIp=None,
                  sourceIp=None,
                  destinationIp=None,
                  sourcePort=None,
                  destinationPort=None):
        """
		Wait to receive "stopped" 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.stopped()
        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 isStopped(self,
                  timeout=1.0,
                  versionIp=None,
                  sourceIp=None,
                  destinationIp=None,
                  sourcePort=None,
                  destinationPort=None):
        """
		Wait to receive "stopped" 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.stopped()
        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
示例#5
0
    def isStopped(self, timeout=1.0):
        """
		Waits to receive "stopped" 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)

        ether_tpl = templates.ethernet(more=templates.stopped())
        expected = self.encapsule(layer_ether=ether_tpl)

        # try to match the template
        evt = self.received(expected=expected, timeout=timeout)
        return evt
示例#6
0
    def isStopped(self, timeout=1.0):
        """
		Wait to receive "stopped" 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.stopped()
        expected = self.getExpectedTemplate(tpl=tpl)

        # try to match the template
        evt = self.received(expected=expected, timeout=timeout)
        return evt
示例#7
0
    def isStopped(self, timeout=1.0):
        """
		Waits to receive "stopped" 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))

        ether_tpl = templates.ethernet(more=templates.stopped())
        expected = self.encapsule(layer_ether=ether_tpl)

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