Skip to content

Commit 78cc959

Browse files
committed
In response to: IOTSFW-325
1. Removed globaly initialized data inside class test() function 2. Removed global variables initialization dependency. Any cause some Python implementations and configurations to fail in runtime 3. Added info about Echo port #7 rationale. 4. Testsed with K64F and network tests: Test summary: +--------+--------+---------+----------------------------+--------------------+ | Result | Target | Test ID | Test Description | Elapsed Time (sec) | +--------+--------+---------+----------------------------+--------------------+ | OK | K64F | NET_1 | TCP client hello world | 3.26 | | OK | K64F | NET_13 | TCP client echo loop | 2.05 | | OK | K64F | NET_2 | NIST Internet Time Service | 3.43 | | OK | K64F | NET_3 | TCP echo server | 1.54 | | OK | K64F | NET_4 | TCP echo client | 1.54 | | OK | K64F | NET_5 | UDP echo server | 1.46 | | OK | K64F | NET_6 | UDP echo client | 1.6 | | OK | K64F | NET_7 | HTTP client hello world | 3.4 | | OK | K64F | NET_8 | NTP client | 2.39 | +--------+--------+---------+----------------------------+--------------------+ Result: 9 OK Completed in 122.18 sec
1 parent 4d5b877 commit 78cc959

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

workspace_tools/host_tests/tcpecho_client_auto.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
from sys import stdout
2121
from SocketServer import BaseRequestHandler, TCPServer
2222

23-
SERVER_IP = str(socket.gethostbyname(socket.getfqdn()))
24-
SERVER_PORT = 7
25-
2623
class TCPEchoClient_Handler(BaseRequestHandler):
2724
def handle(self):
2825
""" One handle per connection
@@ -67,6 +64,22 @@ def send_server_ip_port(self, selftest, ip_address, port_no):
6764
selftest.notify(c.strip())
6865

6966
def test(self, selftest):
67+
# We need to discover SERVEP_IP and set up SERVER_PORT
68+
# Note: Port 7 is Echo Protocol:
69+
#
70+
# Port number rationale:
71+
#
72+
# The Echo Protocol is a service in the Internet Protocol Suite defined
73+
# in RFC 862. It was originally proposed for testing and measurement
74+
# of round-trip times[citation needed] in IP networks.
75+
#
76+
# A host may connect to a server that supports the Echo Protocol using
77+
# the Transmission Control Protocol (TCP) or the User Datagram Protocol
78+
# (UDP) on the well-known port number 7. The server sends back an
79+
# identical copy of the data it received.
80+
SERVER_IP = str(socket.gethostbyname(socket.getfqdn()))
81+
SERVER_PORT = 7
82+
7083
# Returning none will suppress host test from printing success code
7184
server = TCPServer((SERVER_IP, SERVER_PORT), TCPEchoClient_Handler)
7285
print "HOST: Listening for TCP connections: " + SERVER_IP + ":" + str(SERVER_PORT)

workspace_tools/host_tests/udpecho_client_auto.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
from sys import stdout
2121
from SocketServer import BaseRequestHandler, UDPServer
2222

23-
SERVER_IP = str(socket.gethostbyname(socket.getfqdn()))
24-
SERVER_PORT = 7
25-
2623
class UDPEchoClient_Handler(BaseRequestHandler):
2724
def handle(self):
2825
""" One handle per connection
@@ -57,6 +54,22 @@ def send_server_ip_port(self, selftest, ip_address, port_no):
5754
return selftest.RESULT_PASSIVE
5855

5956
def test(self, selftest):
57+
# We need to discover SERVEP_IP and set up SERVER_PORT
58+
# Note: Port 7 is Echo Protocol:
59+
#
60+
# Port number rationale:
61+
#
62+
# The Echo Protocol is a service in the Internet Protocol Suite defined
63+
# in RFC 862. It was originally proposed for testing and measurement
64+
# of round-trip times[citation needed] in IP networks.
65+
#
66+
# A host may connect to a server that supports the Echo Protocol using
67+
# the Transmission Control Protocol (TCP) or the User Datagram Protocol
68+
# (UDP) on the well-known port number 7. The server sends back an
69+
# identical copy of the data it received.
70+
SERVER_IP = str(socket.gethostbyname(socket.getfqdn()))
71+
SERVER_PORT = 7
72+
6073
# Returning none will suppress host test from printing success code
6174
server = UDPServer((SERVER_IP, SERVER_PORT), UDPEchoClient_Handler)
6275
print "HOST: Listening for UDP connections..."

0 commit comments

Comments
 (0)