Commit 951c2cee authored by Waleed Akbar's avatar Waleed Akbar
Browse files

Add wait_for_restconf function and enhance log collection scripts

parent 2b49a194
Loading
Loading
Loading
Loading
+21 −2
Changes for src/tests/mwc26-f5ga/deploy.sh: 21 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -33,6 +33,23 @@ restore_webui_title() {
    sed -i 's|\(<h2>ETSI TeraFlowSDN Controller\) ([^)]*)</h2>|\1</h2>|' "${WEBUI_HOME_HTML}"
}

# Block until a RESTCONF endpoint answers on its host-meta discovery URL. The
# NCE mocks resolve the SIMAP DataStore at import time and have no retry, so
# starting them before it is ready makes them exit(3) with a misleading error.
wait_for_restconf() {
    local name="$1" url="$2" attempts="${3:-60}"
    echo "Waiting for ${name} at ${url}..."
    for ((i=1; i<=attempts; i++)); do
        if curl --silent --fail --max-time 2 --output /dev/null "${url}"; then
            echo "${name} is ready."
            return 0
        fi
        sleep 1
    done
    echo "ERROR: ${name} did not become ready at ${url} after ${attempts}s." >&2
    return 1
}

# Assuming the instances are named as: simap-datastore, tfs-e2e-ctrl, tfs-agg-ctrl, tfs-ip-ctrl

# Get the current hostname
@@ -40,8 +57,8 @@ HOSTNAME=$(hostname)
echo "Deploying in ${HOSTNAME}..."

case "$HOSTNAME" in
    simap-datastore)
        echo "Building SIMAP DataStore..."
    simap-server)
        echo "Building SIMAP Server..."
        cd "${REPO_ROOT}"
        docker buildx build -t simap-datastore:mock -f ./src/tests/tools/simap_datastore/Dockerfile .

@@ -66,6 +83,8 @@ case "$HOSTNAME" in
          -e INFLUXDB_PORT=8181 \
          simap-datastore:mock

        wait_for_restconf "SIMAP DataStore" "http://10.254.0.9:8080/.well-known/host-meta"

        docker run --detach --name nce-fan-ctrl --publish 8081:8080 \
          --env SIMAP_ADDRESS=10.254.0.9 \
          --env SIMAP_PORT=8080 \
+1 −1
Changes for src/tests/tools/simap_datastore/simap_datastore/TelemetryCallbacks.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import logging
import re
from typing import Any, Dict, Optional, Union

from .....common.tools.rest_conf.server.restconf_server.Callbacks import _Callback
from common.tools.rest_conf.server.restconf_server.Callbacks import _Callback
from .influxdb_client import SimapInfluxDBClient