Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FW-utils - add support for tcp-lwm2m server URI #50

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Izuma Edge utilities 2.3.2
1. [fw-tools] - add `tcp-lwm2m.mbedcloud.com` address to be tested.
1. [fw-tools] - add option `-e` for echoing/debugging the script.

## Izuma Edge utilities 2.3.1
1. [edge-info] - remove echo $NORM at beginning of firmware info, it's not coming out right.

Expand Down
2 changes: 1 addition & 1 deletion edge-info/edge-info
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ GREEN="\u001b[32m"
YELLOW="\u001b[33m"
MAGENTA="\u001b[35m"
CYAN="\u001b[36m"
version="2.3.1"
version="2.3.2"
export LogToTerm=1
loglevel=info;

Expand Down
35 changes: 28 additions & 7 deletions fw-tools/edge-testnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# allows you to use port 443 as well.
# - k8s and gateway service is available only via port 443.
#
DEBUG=0
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CRED_DIR="$SCRIPT_DIR/credentials"
temp=$(mktemp -d /tmp/IzumaNetTest-XXXXX)
Expand Down Expand Up @@ -85,12 +86,21 @@ test_bootstrap() {
fi
}

# test_lwm2m - test openssl connect to LwM2M server
#
# Arguments (optional)
# - $1 - URL to connect to, default https://lwm2m.us-east-1.mbedcloud.com
# - $2 - port to connect to, default 5684
test_lwm2m() {
verbose "Test LwM2M server connection (port $port)"
verbose "----------------------------------------"
verbose "Uses openssl to connect to LwM2M server using device credentials."
local URL=$1
URL=${1:-"https://lwm2m.us-east-1.mbedcloud.com"}
local PORT
PORT=${2:-"5684"}
verbose "Test LwM2M server connection (port $port) to $1"
verbose "-----------------------------------------------"
verbose "Uses openssl to connect to LwM2M server $URL:$port using device credentials."
verbose "Write openssl output to $LWT."
echo | openssl s_client -CAfile "$CRED_DIR/lwm2m.pem" -key "$CRED_DIR/device01_key.pem" -cert "$CRED_DIR/device01_cert.pem" -connect lwm2m.us-east-1.mbedcloud.com:"$port" 2>"$LWT" >"$LWT"
echo | openssl s_client -CAfile "$CRED_DIR/lwm2m.pem" -key "$CRED_DIR/device01_key.pem" -cert "$CRED_DIR/device01_cert.pem" -connect "${URL}":"$PORT" 2>"$LWT" >"$LWT"
# get openssl return code
RESULT=$(grep "Verify return code" "$LWT")

Expand Down Expand Up @@ -196,6 +206,7 @@ test_L3() {
verbose "---------------------------------"
_url bootstrap.us-east-1.mbedcloud.com
_url lwm2m.us-east-1.mbedcloud.com
_url tcp-lwm2m.us-east-1.mbedcloud.com
# Check if we're running as a snap or not and change port accordingly.
# If env variable SNAP exists, we're running as SNAP.
if [[ -n "${SNAP}" ]]; then
Expand Down Expand Up @@ -223,6 +234,8 @@ test_L4() {
_nc bootstrap.us-east-1.mbedcloud.com 5684
_nc lwm2m.us-east-1.mbedcloud.com 443
_nc lwm2m.us-east-1.mbedcloud.com 5684
_nc tcp-lwm2m.us-east-1.mbedcloud.com 443
_nc tcp-lwm2m.us-east-1.mbedcloud.com 5684
_nc k8s.us-east-1.mbedcloud.com 443
_nc gateways.us-east-1.mbedcloud.com 443
_nc containers.us-east-1.mbedcloud.com 443
Expand All @@ -244,10 +257,12 @@ main() {
test_L3
test_L4
test_bootstrap
test_lwm2m
test_lwm2m "https://lwm2m.us-east-1.mbedcloud.com"
test_lwm2m "https://tcp-lwm2m.us-east-1.mbedcloud.com"
port=443
test_bootstrap
test_lwm2m
test_lwm2m "https://lwm2m.us-east-1.mbedcloud.com" 443
test_lwm2m "https://tcp-lwm2m.us-east-1.mbedcloud.com" 443
# K8S and Gateway server only operate on port 443
test_k8s
test_gateway
Expand All @@ -267,11 +282,13 @@ displayHelp() {
}

argprocessor() {
while getopts "hHdv" optsin; do
while getopts "hHdev" optsin; do
case "${optsin}" in
#
d) DONTDELETE=1 ;;
#
e) DEBUG=1 ;;
#
h) displayHelp ;;
#
H) displayHelp ;;
Expand All @@ -290,6 +307,10 @@ argprocessor() {
displayHelp
else
shift
# set echo on if DEBUG=1
if [[ "$DEBUG" -eq 1 ]]; then
set -x
fi
main "$@"
fi
}
Expand Down
2 changes: 1 addition & 1 deletion identity-tools/developer_identity/VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
2.3.1
2.3.2