Skip to content

Commit

Permalink
Merge pull request #47 from PelionIoT/containers
Browse files Browse the repository at this point in the history
Containers check in testnet, internal id to info & some GitHub actions
  • Loading branch information
JanneKiiskila authored Oct 12, 2023
2 parents 90d5005 + 1672ba0 commit d3af297
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 5 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/pr-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,26 @@ jobs:
- run: git clone [email protected]:PelionIoT/scripts-internal.git
#- run: git clone https://github.com/PelionIoT/scripts-internal.git
- run: echo "." >scripts-internal/.nopyshcheck
- run: .github/workflows/pysh-checker.sh ${{ github.event.repository.default_branch }} ${{ github.ref_name }}
- run: .github/workflows/pysh-checker.sh ${{ github.event.repository.default_branch }} ${{ github.ref_name }}

run-edge-testnet:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Run edge-testnet
run: fw-tools/edge-testnet

versions-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: ./check_versions.sh

misspell:
runs-on: ubuntu-22.04
steps:
- name: Run misspell (findings may not increase)
run: |
curl -L -o ./install-misspell.sh https://git.io/misspell
sh ./install-misspell.sh
bin/misspell -i mosquitto
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Izuma Edge utilities 2.3.0
1. [edge-testnet] - add support for container registry.
1. [edge-info] - add printout for internal id.

## Izuma Edge utilities 2.2.2
1. Version number bump from 2.2.0 to 2.2.2.

Expand Down Expand Up @@ -56,7 +60,7 @@

## Pelion Edge utilities 2.0.6

1. [identity] Update the filter to accept any values of LwM2M service address and generate respecitve Edge gateway service addresses.
1. [identity] Update the filter to accept any values of LwM2M service address and generate respective Edge gateway service addresses.
1. [identity] Removed the API address from identity file.
1. [info] Report Gateway service address as cloud server.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# pe-utils

Utilities and a light-weight programs for Izuma Edge
Utilities and light-weight programs for Izuma Edge.
39 changes: 39 additions & 0 deletions check_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
#
# Copyright (c) 2023, Izuma Networks
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

edgeinfover=$(head -n 32 "edge-info/edge-info" | tail -n 1)
# Use grep with a regular expression to extract the version
if [[ $edgeinfover =~ version=\"([^\"]+)\" ]]; then
extracted_ver="${BASH_REMATCH[1]}"
else
echo "Version not found from line 32 in edge-info/edge-info -file ($edgeinfover)."
exit 1
fi
devidver=$(head -n 1 "identity-tools/developer_identity/VERSION")
chgver=$(head -n 1 "CHANGELOG.md" | awk '{ for (i=1; i<=NF; i++) if ($i ~ /^[0-9]+\.[0-9]+\.[0-9]+$/) { print $i; exit } }')
echo "ChangeLog version: $chgver"
echo "edge-info version: $extracted_ver"
echo "Identity tool version: $devidver"
if [ "$extracted_ver" != "$devidver" ] || \
[ "$extracted_ver" != "$chgver" ]; then
echo "Versions do not match! @extracted_ver vs. $devidver vs. $chgver"
echo "Fix required."
exit 1
else
echo "Versions match."
fi
4 changes: 3 additions & 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.2.2"
version="2.3.0"
export LogToTerm=1
loglevel=info;

Expand Down Expand Up @@ -177,6 +177,7 @@ load_statistics(){
AccountID=$(echo "$EDGECORESTATUS" | jq -r '."account-id"')
Status=$(echo "$EDGECORESTATUS" | jq -r '."status"')
DID=$(echo "$EDGECORESTATUS" | jq -r '."endpoint-name"')
INTID=$(echo "$EDGECORESTATUS" | jq -r '."internal-id"')
URL_LWM2Mserver=$(echo "$EDGECORESTATUS" | jq -r '."lwm2m-server-uri"'| awk -F "?" '{print $1}')
if [[ -e "$IFILE" ]]; then
# shellcheck disable=SC2002
Expand Down Expand Up @@ -394,6 +395,7 @@ account(){
_placeTitle "Account Information"
_placeLine " - AccountID:" "$AccountID"
_placeLine " - Device ID:" "$DID"
_placeLine " - Internal ID:" "$INTID"
_placeLine " - LwM2M Service:" "$URL_LWM2Mserver"
_placeLine " - Gateway Service:" "$URL_gatewayServicesAddress"
_placeLine " - K8s Service:" "$URL_edgek8sServicesAddress"
Expand Down
28 changes: 28 additions & 0 deletions fw-tools/edge-testnet
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ gwT=$temp/gateway.txt
LWT=$temp/test-lwm2m.txt
L3T=$temp/layer3.txt
L4T=$temp/layer4.txt
gwR=$temp/registry.txt

# For faster testing w/o actually building the whole snap
#SNAP="snap-test"
Expand Down Expand Up @@ -158,6 +159,31 @@ test_gateway() {
fi
}

test_registry() {
verbose "Test container registry server connection (port $port)"
verbose "------------------------------------------------------"
verbose "Uses openssl to connect to container registry."
verbose "Write openssl output to $gwR."
echo | openssl s_client -connect containers.us-east-1.mbedcloud.com:"$port" 2>"$gwR" >"$gwR"

# get openssl return code
RESULT=$(grep 'Verify return code' "$gwR")
if [ -z "$RESULT" ]; then
clihelp::failure "openssl failed with: $(cat "$gwR")"
fi
# print result
CODE=$(echo "$RESULT" | awk -F' ' '{print $4}')
if [ "$CODE" = 0 ]; then
clihelp::success "TLS to registry server (port $port)"
else
clihelp::failure "TLS to registry server (port $port)"
echo "--------------"
echo "$RESULT"
echo "--------------"
fi
}


test_L3() {
_url() {
if [[ $(ping -q -c 1 "$1" >>"$L3T" 2>&1) -eq 0 ]]; then
Expand Down Expand Up @@ -199,6 +225,7 @@ test_L4() {
_nc 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
if [[ -n "${SNAP}" ]]; then
# https://snapcraft.io/docs/network-requirements
_nc api.snapcraft.io 443
Expand All @@ -224,6 +251,7 @@ main() {
# K8S and Gateway server only operate on port 443
test_k8s
test_gateway
test_registry
if [[ "$DONTDELETE" -eq 0 ]]; then
rm -rf "$temp"
else
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.2.2
2.3.0

0 comments on commit d3af297

Please sign in to comment.