Release TeraFlowSDN Controller 8.0

Release Notes:

Merge request reports

Loading
+125 −0
Changes for deploy/tests/test_monitoring_dependencies.py: 125 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Copyright 2022-2026 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# 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.

"""Offline checks for optional legacy monitoring infrastructure."""

from pathlib import Path
import shutil
import subprocess
import tempfile
import unittest

import yaml


ROOT = Path(__file__).resolve().parents[2]


class MonitoringDependenciesTests(unittest.TestCase):
    def test_all_only_invokes_monitoring_dependencies_when_selected(self):
        with tempfile.TemporaryDirectory() as directory:
            root = Path(directory)
            (root / "deploy").mkdir()
            (root / "scripts").mkdir()
            for filename in ("all.sh", "monitoring_dependencies.sh"):
                shutil.copy(ROOT / "deploy" / filename, root / "deploy")
            (root / "scripts/dockerhub_login.sh").write_text("exit 0\n")
            for name in ("crdb", "nats", "qdb", "kafka",
                         "expose_dashboard", "tfs", "show"):
                script = root / "deploy" / (name + ".sh")
                script.write_text('#!/bin/bash\necho ' + name + ' >> calls\n')
                script.chmod(0o755)
            for components, expected in [
                ("context device webui", False),
                ("context monitoring webui", True),
                ("context slice webui", True),
            ]:
                with self.subTest(components=components):
                    (root / "calls").write_text("")
                    result = subprocess.run(
                        ["bash", "deploy/all.sh"], cwd=root,
                        env={"PATH": "/usr/bin:/bin",
                             "TFS_COMPONENTS": components},
                        capture_output=True, text=True,
                    )
                    self.assertEqual(result.returncode, 0, result.stderr)
                    calls = (root / "calls").read_text().splitlines()
                    for dependency in ("qdb", "expose_dashboard"):
                        self.assertEqual(dependency in calls, expected)
                    self.assertIn("tfs", calls)

    def test_exact_component_membership(self):
        for components, enabled in [
            ("context device webui", False), ("monitoring", True),
            ("slice", True), ("context slice webui", True),
            ("monitoring slice", True), ("kpi_manager telemetry", False),
            ("monitoring_extra slice_extra", False), ("", False),
        ]:
            with self.subTest(components=components):
                result = subprocess.run(
                    ["bash", "-c",
                     'source deploy/monitoring_dependencies.sh; '
                     'TFS_COMPONENTS="$1"; uses_legacy_monitoring',
                     "_", components],
                    cwd=ROOT, check=False,
                )
                self.assertEqual(result.returncode == 0, enabled)

    def test_webui_has_no_grafana_resources(self):
        docs = list(yaml.safe_load_all(
            (ROOT / "manifests/webuiservice.yaml").read_text()
        ))
        self.assertFalse(any(d["kind"] == "PersistentVolumeClaim"
                             for d in docs))
        deployment = next(d for d in docs if d["kind"] == "Deployment")
        spec = deployment["spec"]["template"]["spec"]
        self.assertEqual([c["name"] for c in spec["containers"]], ["server"])
        self.assertNotIn("volumes", spec)
        service = next(d for d in docs if d["kind"] == "Service")
        self.assertEqual([p["port"] for p in service["spec"]["ports"]], [8004])

    def test_grafana_is_self_contained(self):
        docs = list(yaml.safe_load_all(
            (ROOT / "manifests/grafanaservice.yaml").read_text()
        ))
        self.assertEqual([d["kind"] for d in docs], [
            "PersistentVolumeClaim", "Deployment", "Service", "Ingress",
        ])
        pvc, deployment, service, ingress = docs
        spec = deployment["spec"]["template"]["spec"]
        self.assertEqual(
            spec["volumes"][0]["persistentVolumeClaim"]["claimName"],
            pvc["metadata"]["name"],
        )
        self.assertEqual(service["spec"]["selector"],
                         deployment["spec"]["selector"]["matchLabels"])
        backend = ingress["spec"]["rules"][0]["http"]["paths"][0]["backend"]
        self.assertEqual(backend["service"]["name"],
                         service["metadata"]["name"])
        self.assertEqual(backend["service"]["port"]["number"], 3000)
        base = (ROOT / "manifests/nginx_ingress_http.yaml").read_text()
        self.assertNotIn("/grafana", base)

    def test_dashboard_exposure_disabled_without_cluster_access(self):
        result = subprocess.run(
            ["bash", "deploy/expose_dashboard.sh"], cwd=ROOT,
            env={"PATH": "/usr/bin:/bin", "TFS_COMPONENTS": "context webui"},
            capture_output=True, text=True,
        )
        self.assertEqual(result.returncode, 0, result.stderr)
        self.assertIn("Skipping dashboard exposure", result.stdout)


if __name__ == "__main__":
    unittest.main()

deploy/README.md

0 → 100644
+40 −0
Changes for deploy/README.md: 40 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Optional Monitoring Infrastructure

QuestDB and the bundled Grafana instance are deployed only when
`TFS_COMPONENTS` includes the complete token `monitoring` or `slice`.
Both are legacy components. Selecting only core, optical, MCP or Agentic
components does not deploy this infrastructure.
The fallback component list in `deploy/all.sh` still includes `slice` for
compatibility; select an explicit component list without `slice` or
`monitoring` for a lightweight deployment, as the ECOC demo specs do.

`manifests/webuiservice.yaml` contains only the WebUI.
`manifests/grafanaservice.yaml` contains a separate Grafana Deployment,
Service, PVC and ingress at `/grafana/`. The deployment script enables the
WebUI navigation link through `TFS_GRAFANA_ENABLED=YES` only in the legacy
monitoring mode, and configures datasources through the Grafana Service.

The `qdb-data` Secret and dashboard exposure/configuration are skipped when
neither legacy consumer is selected. Shared Kubernetes observability
installations are not automatically removed or disabled.
Explicit calls to `deploy/qdb.sh` still deploy QuestDB for operators who need
to manage that infrastructure separately.

Existing QuestDB namespaces/storage and previously deployed Grafana resources
are not pruned automatically. Back up any required data and clean up obsolete
resources explicitly when migrating. Direct manifest users must apply the
new Grafana manifest separately and enable its WebUI link if desired.

For the ECOC demo, the branch-only root `redeploy.sh` delegates to
`src/tests/ecoc26-hyr-agentic-optical/redeploy-all.sh`.
Run `./redeploy.sh --help` before the first reset. This convenience wrapper
is not intended for the upstream merge.

Offline deployment checks:

```bash
python -m unittest discover -s deploy/tests -v
```

These repository-level checks require PyYAML and stay separate from component
unit tests, whose container images do not contain deployment manifests.
+22 −0
Changes for deploy/all.sh: 22 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -72,6 +72,14 @@ export TFS_COMPONENTS=${TFS_COMPONENTS:-"context device pathcomp service slice n
# Uncomment to activate Pluggables Component
#export TFS_COMPONENTS="${TFS_COMPONENTS} pluggables"

# Uncomment to activate MCP Server.
# Keep it near the end so it is deployed after optional components it can expose.
#export TFS_COMPONENTS="${TFS_COMPONENTS} mcp_server"

# Uncomment to activate Agentic Module.
# Keep it after MCP Server so it can discover the local TFS MCP tool catalogue.
#export TFS_COMPONENTS="${TFS_COMPONENTS} agentic"

# If not already set, set the tag you want to use for your images.
export TFS_IMAGE_TAG=${TFS_IMAGE_TAG:-"dev"}

@@ -88,6 +96,11 @@ export TFS_GRAFANA_PASSWORD=${TFS_GRAFANA_PASSWORD:-"admin123+"}
# If TFS_SKIP_BUILD is "YES", the containers are not rebuilt-retagged-repushed and existing ones are used.
export TFS_SKIP_BUILD=${TFS_SKIP_BUILD:-""}

# Optionally set Docker Hub credentials to avoid anonymous pull rate limits while building/pulling public images.
# If either variable is empty, Docker Hub is used anonymously.
export DOCKERHUB_USER_NAME=${DOCKERHUB_USER_NAME:-""}
export DOCKERHUB_ACCESS_TOKEN=${DOCKERHUB_ACCESS_TOKEN:-""}


# ----- CockroachDB ------------------------------------------------------------

@@ -243,6 +256,9 @@ export GRAF_EXT_PORT_HTTP=${GRAF_EXT_PORT_HTTP:-"3000"}
# Automated steps start here
########################################################################################################################

bash scripts/dockerhub_login.sh
source deploy/monitoring_dependencies.sh

# Deploy CockroachDB
./deploy/crdb.sh

@@ -250,7 +266,11 @@ export GRAF_EXT_PORT_HTTP=${GRAF_EXT_PORT_HTTP:-"3000"}
./deploy/nats.sh

# Deploy QuestDB
if uses_legacy_monitoring; then
    ./deploy/qdb.sh
else
    echo "Skipping QuestDB: neither monitoring nor slice is selected."
fi

# Deploy Apache Kafka
./deploy/kafka.sh
@@ -259,7 +279,9 @@ export GRAF_EXT_PORT_HTTP=${GRAF_EXT_PORT_HTTP:-"3000"}
# ./deploy/monitoring.sh

# Expose Dashboard
if uses_legacy_monitoring; then
    ./deploy/expose_dashboard.sh
fi

# Deploy TeraFlowSDN
./deploy/tfs.sh
+7 −0
Changes for deploy/build-only.sh: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -32,11 +32,18 @@ export TFS_COMPONENTS=${TFS_COMPONENTS:-"context device pathcomp service slice n
# If not already set, set the tag you want to use for your images.
export TFS_IMAGE_TAG=${TFS_IMAGE_TAG:-"dev"}

# Optionally set Docker Hub credentials to avoid anonymous pull rate limits while building/pulling public images.
# If either variable is empty, Docker Hub is used anonymously.
export DOCKERHUB_USER_NAME=${DOCKERHUB_USER_NAME:-""}
export DOCKERHUB_ACCESS_TOKEN=${DOCKERHUB_ACCESS_TOKEN:-""}


########################################################################################################################
# Automated steps start here
########################################################################################################################

bash scripts/dockerhub_login.sh

# Create a tmp folder for files modified during the deployment
TMP_LOGS_FOLDER="./tmp/build"
mkdir -p $TMP_LOGS_FOLDER
+17 −0
Changes for deploy/component.sh: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -36,10 +36,17 @@ export TFS_EXTRA_MANIFESTS=${TFS_EXTRA_MANIFESTS:-""}
# If not already set, set the neew Grafana admin password
export TFS_GRAFANA_PASSWORD=${TFS_GRAFANA_PASSWORD:-"admin123+"}

# Optionally set Docker Hub credentials to avoid anonymous pull rate limits while building/pulling public images.
# If either variable is empty, Docker Hub is used anonymously.
export DOCKERHUB_USER_NAME=${DOCKERHUB_USER_NAME:-""}
export DOCKERHUB_ACCESS_TOKEN=${DOCKERHUB_ACCESS_TOKEN:-""}

########################################################################################################################
# Automated steps start here
########################################################################################################################

bash scripts/dockerhub_login.sh

DOCKER_BUILD="docker build"
DOCKER_MAJOR_VERSION=$(docker --version | grep -o -E "Docker version [0-9]+\." | grep -o -E "[0-9]+" | cut -c 1-3)
if [[ $DOCKER_MAJOR_VERSION -ge 23 ]]; then
@@ -63,6 +70,8 @@ TMP_FOLDER="./tmp"
TMP_MANIFESTS_FOLDER="$TMP_FOLDER/manifests"
TMP_LOGS_FOLDER="$TMP_FOLDER/logs"

bash scripts/dockerhub_k8s_secret.sh "$TFS_K8S_NAMESPACE"

echo "Deploying component and collecting environment variables..."
ENV_VARS_SCRIPT=tfs_runtime_env_vars.sh

@@ -152,6 +161,14 @@ for COMPONENT in $TFS_COMPONENTS; do

    echo "  Deploying '$COMPONENT' component to Kubernetes..."
    DEPLOY_LOG="$TMP_LOGS_FOLDER/deploy_${COMPONENT}.log"
    if [ "$COMPONENT" == "agentic" ]; then
        kubectl --namespace $TFS_K8S_NAMESPACE delete ingress \
            tfs-ingress-agentic --ignore-not-found >> "$DEPLOY_LOG"
        kubectl --namespace $TFS_K8S_NAMESPACE delete ingress \
            tfs-ingress-agentic-api --ignore-not-found >> "$DEPLOY_LOG"
        kubectl --namespace $TFS_K8S_NAMESPACE delete ingress \
            tfs-ingress-agentic-web --ignore-not-found >> "$DEPLOY_LOG"
    fi
    kubectl --namespace $TFS_K8S_NAMESPACE delete -f "$MANIFEST" > "$DEPLOY_LOG"
    kubectl --namespace $TFS_K8S_NAMESPACE apply -f "$MANIFEST" > "$DEPLOY_LOG"
    COMPONENT_OBJNAME=$(echo "${COMPONENT}" | sed "s/\_/-/")
Loading
Loading