Beispiel #1
0
    def sequence2(self):
        ports = {}
        atleast_one = False
        if len(self.input_ports) == 0:
            self.logger.info("There are no ports in the ICD satisfying the " \
                             "scripts criteria")
            return
        for port in self.input_ports:
            key = (port.udp_dst, port.ip_dst)

            if ports.has_key(key):
                port.ip_src = "10.1.33.1"
                ports[key].append(port)
                atleast_one = True
            else:
                port.ip_src = "10.1.33.2"
                ports[key] = [port]
        if not atleast_one:
            self.logger.info("Sequence 2 cannot proceed. ICD has no ports "\
                             "satisfying the script requirements")
            return
        self.captureForSequence(2)
        self.sendRSET()

        for key in ports.keys():
            sel_ports = ports[key]
            if len(sel_ports) > 1:
                self.__fillRxPorts(sel_ports)

                for port in sel_ports:
                    rrpc = RRPC(port)
                    self.send(rrpc.buildCommand(), Factory.GET_TX_Port())

                    if not pollForResponse("RRPC"):
                        self.logger.error("The ES has not responded for RRPC")
Beispiel #2
0
    def sequence1(self, capture = True):
        if capture:
            self.captureForSequence(1)
        if len(self.input_ports) == 0:
            self.logger.error("The ICD has no ports satisfying the scripts "\
                              "criteria")
            return
        self.sendRSET()
        port = self.input_ports[0]
        skews = [port.skew_max, port.skew_max + 1000,  port.skew_max - 1000]
        for skew in skews:
            message = buildShortMessage(port, "Skew = %d" % skew)
            sleep_time_micros = float(skew)/1000
            self.logger.info("Sending packet with skew of %d ms" % \
                             sleep_time_micros)
            networks = [NETWORK_A, NETWORK_B]
            if sleep_time_micros < 65.5:
                networks.reverse()

            for network in networks:
                self.network = network
                self.send(message, port)
                time.sleep(float(sleep_time_micros)/1000)

            self.logger.info("Sending an RRPC")
            rrpc = RRPC(port)
            self.network = NETWORK_A
            self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
Beispiel #3
0
    def sequence1(self):
        self.captureForSequence(1)
        if len(self.input_ports) == 0:
            self.logger.info("There are no ports in the ICD satisfying the " \
                             "scripts criteria")
            return
        self.sendRSET()
        for port in self.input_ports:
            rrpc = RRPC( port)
            if port.port_characteristic == PORT_SAP:
                continue

            for count in range(0, 4):
                message = "Message %d" % count
                message = buildShortMessage(port, message)
                self.send(message, port)
                self.logger.info("Filling the port %s" % port.RX_AFDX_port_id)
                if count == 0 or count == 3:
                    self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
                    self.logger.info("Sending an RRPC")
                if count <= 1:
                    self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
                    self.logger.info("Sending an RRPC")
                elif count == 2:
                    continue
                pollForResponse('RRPC')
Beispiel #4
0
 def sequence4(self):
     self.captureForSequence(4)
     self.sendRSET()
     for port in self.input_ports:
         if port.port_characteristic != PORT_QUEUING:
             continue
         message = buildBigMessage(port, "Big message")
         self.send(message, port)
         rrpc = RRPC(port)
         self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
         pollForResponse('RRPC')
Beispiel #5
0
    def do_operation(self, networks):
        if len(self.input_ports) == 0:
            self.logger.info("There are no ports in the ICD satisfying the " \
                             "scripts criteria")
            return
        for port in self.input_ports:
            message = buildFragmentedMessage(port, len(networks), "Big message")
            outport = Factory.WRITE(port.RX_AFDX_port_id, message)

            self.application.transmitter.transmit(outport, networks)

            rrpc = RRPC(port)
            self.send(rrpc.buildCommand(), port)
            pollForResponse('RRPC')
Beispiel #6
0
 def sequence3(self):
     self.captureForSequence(3)
     self.sendRSET()
     for port in self.input_ports:
         if port.port_characteristic != PORT_QUEUING:
             continue
         rrpc = RRPC(port)
         self.send(rrpc.buildCommand(), port)
         for count in range(0, 3):
             message = buildShortMessage(port, "Message = %s" % count)
             self.send(message, port)
         for count in range(0, 3):
             self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
             pollForResponse('RRPC')
Beispiel #7
0
 def send_modified_snfragments(self, ports, networks):
     self.sendRSET()
     for port in ports:
         message = "PortId = %s" % port.RX_AFDX_port_id
         message = buildFragmentedMessage(port, len(networks), message)
         outport = Factory.WRITE(port.RX_AFDX_port_id, message)
         setattr(outport, 'sn_func', self.sn_modifier)
         self.application.transmitter.transmit(outport, networks)
         self.logger.info("Filling rx port : %s" % port.RX_AFDX_port_id)
         rrpc = RRPC(port)
         self.network = NETWORK_A
         self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
         self.logger.info("Sending an RRPC on network %s" % self.network)
         pollForResponse('RRPC')
Beispiel #8
0
    def sendOnDisconnectedInterface(self, rx_port, tx_port):
        self.sendRSET()
        self.network = NETWORK_AB
        self.logger.info("Checking the transmission port")
        eipc = EIPC(tx_port)
        message = "PortId = %s" % tx_port.tx_AFDX_port_id
        message = buildShortMessage(tx_port, message)      
        self.send(eipc.buildCommand(message = message), Factory.GET_TX_Port())
        pollForResponse('EIPC')

        self.logger.info("Checking the reception port")
        message = "PortId = %s" % rx_port.RX_AFDX_port_id
        message = buildShortMessage(rx_port, message)
        self.send(message, rx_port)
        rrpc = RRPC(rx_port)
        self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
        pollForResponse('RRPC')
Beispiel #9
0
 def sequence2(self):
     self.captureForSequence(2)
     self.sendRSET()
     for port in self.input_ports:
         if port.port_characteristic != PORT_SAMPLING:
             continue
         self.logger.info("Testing port %s" % port.RX_AFDX_port_id)
         rrpc = RRPC( port)
         message = "PortId = %d" % port.RX_AFDX_port_id
         message = buildShortMessage(port, message)
         self.send(message, port)
         time.sleep(1) 
         self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
         self.logger.info("Sending RRPC command")
         self.logger.info("Sleeping for 10 seconds")
         time.sleep(10)
         self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
Beispiel #10
0
    def sequence1(self):

        if len(self.input_ports) == 0:
            self.logger.info("There are no ports in the ICD satisfying the " \
                             "scripts criteria")
            return
        self.captureForSequence(1)
        self.sendRSET()
        self.__fillRxPorts(self.input_ports)

        for port in self.input_ports:
            rrpc = RRPC(port)
            self.logger.info("Sending RRPC for port = %s" % \
                             port.RX_AFDX_port_id)
            self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
        
            if not pollForResponse("RRPC"):
                self.logger.error("The ES has not responded for RRPC")
Beispiel #11
0
    def sendMessage(self, seqNo, ports, networks):
        if len(ports) == 0 :
            self.logger.error("This sequence cannot proceed as there are no" \
                              " ports in the ICD satisfying the sequence" \
                              " requirements")
            return

        self.captureForSequence(seqNo)
        self.sendRSET()
        pollForResponse('OK')

        for port in ports:
            message = buildFragmentedMessage(port, 6, message = "Fragmented")
            outPort = Factory.WRITE(port.RX_AFDX_port_id, message)
            self.application.transmitter.transmit(outPort, \
                                          network = networks)
            rrpc = RRPC(port)
            self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
            pollForResponse('RRPC')
Beispiel #12
0
    def sequence1(self):
        if len(self.input_ports) == 0:
            self.logger.info("There are no ports in the ICD satisfying the " \
                             "scripts criteria")
            return
        self.captureForSequence(1)
        self.sendRSET()
        for port in self.input_ports:
            self.logger.info("Filling rx port : %s" % port.RX_AFDX_port_id)
            for network in [NETWORK_AB, NETWORK_A, NETWORK_B]:
                message = "PortId = %s %s" % (port.RX_AFDX_port_id, network)
                message = buildShortMessage(port, message)
                self.network = network
                self.send(message, port)

                rrpc = RRPC(port)
                self.network = NETWORK_A
                self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
                self.logger.info("Sending an RRPC on network %s" % network)
                pollForResponse('RRPC')
Beispiel #13
0
    def send_modified_snpackets(self, ports, networks):
        if len(ports) == 0:
            self.logger.error("There are no ports in the icd file satisfying" \
                              " this criteria. Hence quitting the sequence")
            return
        self.sendRSET()
        for port in ports:
            for network in networks:
                message = "PortId = %s %s" % (port.RX_AFDX_port_id, network)
                message = buildShortMessage(port, message)

                outport = Factory.WRITE(port.RX_AFDX_port_id, message)
                setattr(outport, 'sn_func', self.sn_modifier)
                self.application.transmitter.transmit(outport, network)
                self.logger.info("Filling rx port : %s" % port.RX_AFDX_port_id)
                rrpc = RRPC(port)
                self.network = NETWORK_A
                self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
                self.logger.info("Sending an RRPC on network %s" % self.network)
                pollForResponse('RRPC')
Beispiel #14
0
    def sequence3(self):
        self.captureForSequence(3)
        self.sendRSET()
        rx_port = None

        for port in self.input_ports:
            if port.buffer_size == 8192:
                rx_port = port
                break
        if rx_port == None:
            self.logger.error("The ICD has no entries satisfying the " "sequences criteria")
            return
        message = buildStaticMessage(8192, "Message size = %d" % (8192))
        self.send(message, port)
        rrpc = RRPC(port)
        self.send(rrpc.buildCommand(), Factory.GET_TX_Port())

        # even though we set this size as 31, during fragmentation its size
        # becomes 32 as 32 % 8 == 0
        port.max_frame_size = 31
        self.send(message, port)
        self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
Beispiel #15
0
    def run(self):
        if len(self.input_ports) == 0:
            self.logger.info("There are no ports in the ICD satisfying the " "scripts criteria")
            return
        self.sendRSET()
        for port in self.input_ports:
            message = buildShortMessage(port, "PortId = %s" % port.RX_AFDX_port_id)
            size = len(self.sns)

            while size > 0:
                outport = Factory.WRITE(port.RX_AFDX_port_id, message)
                setattr(port, "sn_func", self.sn_func)
                self.application.transmitter.transmit(outport, self.network)
                delattr(port, "sn_func")
                rrpc = RRPC(port)
                self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
                pollForResponse("RRPC")
                size -= 1

        erpq = ERPQ(port)
        self.logger.info("Sending an ERPQ command")
        self.send(erpq.buildCommand(), port)
        pollForResponse("ERPQ")
Beispiel #16
0
 def sequence2(self):
     if len(self.input_ports) == 0:
         self.logger.info("There are no ports in the ICD satisfying the " \
                          "scripts criteria")
         return
     self.captureForSequence(2)
     self.sendRSET()
     ports = []
     for port in self.input_ports:
         if port.rma:
             continue
         ports.append(port)
     if len(ports) < 1:
         self.logger.error("There are no ICD entries which have rma" \
                           " as inactive")
         return
     for port in ports:
         message = buildStaticMessage(port.max_frame_size + 2, "Frag")
         outPort = Factory.WRITE(port.RX_AFDX_port_id, message)
         self.application.transmitter.transmit(outPort, \
                                               network = [NETWORK_A, 'C'])
         rrpc = RRPC(port)
         self.send(rrpc.buildCommand(), port)
Beispiel #17
0
 def sendRRPC():
     rrpc = RRPC(port)
     self.send(rrpc.buildCommand(), Factory.GET_TX_Port())
     pollForResponse('RRPC')