From 0865e479bb444da7dab3e4434f3057de9c58f939 Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Thu, 5 Dec 2024 12:16:23 +0530 Subject: [PATCH 1/4] Update echo server to use host address --- localhost-echo-server/action.yml | 11 ++++++++++- localhost-echo-server/local_echo_server.py | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/localhost-echo-server/action.yml b/localhost-echo-server/action.yml index da284cb6..20416802 100644 --- a/localhost-echo-server/action.yml +++ b/localhost-echo-server/action.yml @@ -2,6 +2,10 @@ name: 'Localhost Echo Server' description: 'Starts an echo server using Python.' inputs: + host_address: + description: "Host address for echo server." + required: false + default: "127.0.0.1" port_number: description: "Port for echo server." required: True @@ -13,5 +17,10 @@ runs: shell: bash run: | python3 --version - python3 $GITHUB_ACTION_PATH/local_echo_server.py --port_number=${{ inputs.port_number }} & + # Use the host_address input if provided, otherwise default to 127.0.0.1 + HOST=${{ inputs.host_address }} + if [[ -z "$HOST" ]]; then + HOST="127.0.0.1" + fi + python3 $GITHUB_ACTION_PATH/local_echo_server.py --host=$HOST --port_number=${{ inputs.port_number }} & diff --git a/localhost-echo-server/local_echo_server.py b/localhost-echo-server/local_echo_server.py index b066f92e..2a63792d 100644 --- a/localhost-echo-server/local_echo_server.py +++ b/localhost-echo-server/local_echo_server.py @@ -17,6 +17,10 @@ async def echo_handler(reader, writer): if __name__ == '__main__': parser = ArgumentParser(description='Localhost Echo server.') + parser.add_argument('--host', + type=str, + required=True, + help='Host address for the echo server.') parser.add_argument('--port_number', type=int, required=True, @@ -28,7 +32,7 @@ async def echo_handler(reader, writer): asyncio.set_event_loop(loop) factory = asyncio.start_server( echo_handler, - os.environ.get('HOST'), + os.environ.get('HOST', args.host), os.environ.get('PORT', args.port_number) ) server = loop.run_until_complete(factory) From bc345a87e95408247e43033b93f3e05a119a4287 Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Thu, 5 Dec 2024 12:51:47 +0530 Subject: [PATCH 2/4] Update MQTT broker to use host address --- localhost-mqtt-broker/action.yml | 13 ++++++++++++- localhost-mqtt-broker/localhost_mqtt_broker.py | 8 ++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/localhost-mqtt-broker/action.yml b/localhost-mqtt-broker/action.yml index 0ccd88de..ef0b2a99 100644 --- a/localhost-mqtt-broker/action.yml +++ b/localhost-mqtt-broker/action.yml @@ -2,6 +2,10 @@ name: 'Localhost MQTT Broker' description: 'Starts an MQTT Broker using Python. For TLS connections (including mutual authentication), connect to localhost:8883. For plaintext connections, connect to localhost:1883.' inputs: + host_address: + description: "Host address for echo server." + required: false + default: "127.0.0.1" root-ca-cert-path: description: "Root CA certificate file path." required: True @@ -19,5 +23,12 @@ runs: run: pip install -r $GITHUB_ACTION_PATH/requirements.txt shell: bash - name: Run localhost MQTT broker - run: python3 $GITHUB_ACTION_PATH/localhost_mqtt_broker.py --root-ca-cert-path=${{ inputs.root-ca-cert-path }} --server-priv-key-path=${{ inputs.server-priv-key-path }} --server-cert-path=${{ inputs.server-cert-path }} & + run: | + python3 --version + # Use the host_address input if provided, otherwise default to 127.0.0.1 + HOST=${{ inputs.host_address }} + if [[ -z "$HOST" ]]; then + HOST="127.0.0.1" + fi + python3 $GITHUB_ACTION_PATH/localhost_mqtt_broker.py --host=$HOST --root-ca-cert-path=${{ inputs.root-ca-cert-path }} --server-priv-key-path=${{ inputs.server-priv-key-path }} --server-cert-path=${{ inputs.server-cert-path }} & shell: bash diff --git a/localhost-mqtt-broker/localhost_mqtt_broker.py b/localhost-mqtt-broker/localhost_mqtt_broker.py index 60d40850..5dbd289a 100644 --- a/localhost-mqtt-broker/localhost_mqtt_broker.py +++ b/localhost-mqtt-broker/localhost_mqtt_broker.py @@ -12,6 +12,10 @@ # Parse passed in credentials parser = ArgumentParser(description='Localhost MQTT broker.') +parser.add_argument('--host', + type=str, + required=True, + help='Host address for the echo server.') parser.add_argument('--root-ca-cert-path', type=str, required=True, @@ -31,12 +35,12 @@ "listeners": { "default": { "type": "tcp", - "bind": f"{LOCAL_HOST_IP}:1883", + "bind": f"{args.host}:1883", "max-connections": 1000, }, "tls": { "type": "tcp", - "bind": f"{LOCAL_HOST_IP}:8883", + "bind": f"{args.host}:8883", "max-connections": 1000, "ssl": "on", "cafile": args.root_ca_cert_path, From c6ff3aaee3c4d54841d2cf33cf54526ddad6038c Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Thu, 5 Dec 2024 15:01:26 +0530 Subject: [PATCH 3/4] Fix CI checks --- .github/workflows/pr_checks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index cf082fc0..2c50d53b 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -349,6 +349,7 @@ jobs: repository: FreeRTOS-Plus-TCP, org: FreeRTOS, branch: main, + exclude-dirs: source/portable/NetworkInterface/STM32 }, { repository: FreeRTOS, From 1be95b0e61b803f5fabe91ea40945be771b520eb Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Thu, 5 Dec 2024 15:04:28 +0530 Subject: [PATCH 4/4] Fix CI checks --- .github/workflows/pr_checks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index 2c50d53b..309b7550 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -38,6 +38,7 @@ jobs: run-spelling-check: true, run-complexity: false, run-doxygen: false, + exclude-dirs: source/portable/NetworkInterface/STM32 }, { repository: FreeRTOS,