====== Todo List ====== ===== Timeout waiting for a particular response ===== * For instance, to conform with tcp protocol, every segment sent must be acknowledged. * So, to test that, we need to send some segment and wait for the acknowledgment. * But, we need wait up to 2 MSL(Maximum Segment Lifetime) ONLY. * Then, if timeout occurs the test will fail. * \\ * Another usage, is about testing RESET generation. * \\ \\ ===== Get ether address by ip ===== * Today we need set ether address like that: ethernet.ether_atob("00:1c:42:9d:57:c9") * It will be pretty good better like: * ethernet(ip_pkt_already_configured) # constructor * ethernet.configure(ip_pkt_already_configured) # or a utility method * . \\ \\ ===== Two side test, One script testing two piers ===== * **As a introducing for this idea, we need to make a overview of the tcptest internals.** * \\ at the tcptest: * \\ to identify a pier we use constants: * * self.thisside = 0 * * self.thatside = 1 \\ the constants are used to configure the socket. (eg) * tcb.ip = { self.thisside : pcs.inet_atol("10.211.55.210") , self.thatside : pcs.inet_atol("10.211.55.220")} \\ and the same constants are used to access the interface * tcb.output = { self.thisside : pcs.%%PcapConnector%%("ed0") , self.thatside : pcs.%%PcapConnector%%("ed0") } * . \\ **Through libpcap we can connect directly with the network interface or through dump files.** \\ * \\ **So, if we would access the remote interface or access the remote dump file, so we can have the total control of the test.(eg)** * tcb.output = { self.thisside : pcs.%%PcapConnector%%("ed0") , self.thatside : pcs.%%PcapConnector%%("/mnt/sshfs/pcap.dump") } * \\ **As a example we would check if the send packet is the same received.** * (ipsyn, tcpsyn) = createsyn(self, tcb, from_, to) * createwritepacket(self, tcb, ipsyn, tcpsyn, from_, to) * \\ (ipsynreceived, tcpsynreceived) = receive(self, tcb, to, from_) # NOTICE TO AND FROM_ SWITCHED * \\ **assertEqual(ipsyn, ipsynreceived, 'the fail warn')** * \\ \\ For the complete understanding see the receive method * \\ def receive(self, tcb, from_, to): * """receive packet for this socket * This method must handle timmers""" * (ip, tcp) = (None, None) * while 1: * reply = tcb.output[ from_ ].read() * try: * packet = ethernet.ethernet(reply) * ip = packet.data * tcp = ip.data * if (tcb.ip[ from_ ]==ip.dst and \ * tcb.ip[ to ]==ip.src and \ * tcb.tcpport[ from_ ]==tcp.dport and \ * tcb.tcpport[ to ]==tcp.sport): * break * except: * print "packet ignored" * pass * return (ip, tcp)