def sequence1(self): self.captureForSequence(1) msg_8kb = buildStaticMessage(8192, "Message size = 8192") msg_64kb = buildStaticMessage(64 * 1024, "Message size = 65536") msg = "ping test" msgs = [msg_8kb, msg_64kb, msg] for port in self.icmp_ports: setattr(port, 'ip_src', get("NMF_IP")) self.logger.info("Sending an ICMP from NMF ip : %s" % get("NMF_IP")) for msg in msgs: self.sendICMP(port, msg, False)
def sequence3(self): self.captureForSequence(3) msg_small = buildStaticMessage(63, "small message") for port in self.icmp_ports: setattr(port, 'ip_src', get("NMF_IP")) self.logger.info("Sending an ICMP from NMF ip : %s with "\ "small message" % get("NMF_IP")) self.sendICMP(port, msg_small, False) msg_big = buildStaticMessage(65, "big message") for port in self.icmp_ports: setattr(port, 'ip_src', get("NMF_IP")) self.logger.info("Sending an ICMP from NMF ip : %s with "\ "big message" % get("NMF_IP")) self.sendICMP(port, msg_big, False)
def sequence1(self): self.captureForSequence(1) self.sendRSET(poll=True) sizes = (64, 65, 80) for port in self.icmp_ports: for size in sizes: self.sendSNMP() message = buildStaticMessage(size, "Size = %d" % size) self.__sendicmp(port, message, poll=False)
def doOperation(self, port, snmp_port): eipc = EIPC(port) message = buildStaticMessage(port.max_frame_size + 1, "Big message") self.sendSNMP(snmp_port) self.send(eipc.buildCommand(message), Factory.GET_TX_Port()) self.sendSNMP(snmp_port) message = buildShortMessage(port, "Short message", eipc.command_size) self.send(eipc.buildCommand(message), Factory.GET_TX_Port())
def sequence3(self): self.captureForSequence(3) self.sendRSET(poll=True) for port in self.icmp_ports: message = buildStaticMessage(64, "Test") count = 150 while count > 0: self.__sendicmp(port, message, poll=False) count -= 1 self.sendICMP(port, "ES Test ping")
def sequence2(self): self.captureForSequence(2) self.sendRSET(poll=True) for port in self.icmp_ports: self.sendSNMP() message = buildStaticMessage(64, "Wrong type field") port = Factory.WRITE_ICMP(port.rx_vl_id, message) packet = self.application.transmitter.transmit(port, self.network, send=False)[0] packet[ICMP].code = 1 self.application.transmitter.transmit_packets([packet], self.network)
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.output_ports: if port.ip_frag_allowed: continue eipc = EIPC(port) message = buildStaticMessage(int(port.max_frame_size), \ "MFS + 1") self.send(eipc.buildCommand(message = message), \ Factory.GET_TX_Port()) self.logger.info("Sending an EIPC command on port : %s" % \ port.tx_AFDX_port_id) pollForResponse('EIPC')
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())
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)