Commit 737c0343 authored by Waleed Akbar's avatar Waleed Akbar
Browse files

feat: Add log dumping script and teardown script for ZSM test artifacts

parent f25eb3dc
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -13,6 +13,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.

LOG_DIR="$(dirname "$0")/logs"
LOG_DIR="$(dirname "$0")/logs/"
mkdir -p "${LOG_DIR}"
kubectl --namespace tfs logs deployment/telemetryservice -c backend > "${LOG_DIR}/teleservice_backend_$(date '+%Y%m%d_%H%M').log"

echo "Dumping logs for telemetryservice..."
kubectl --namespace tfs logs deployment/telemetryservice -c backend > "${LOG_DIR}/telemetryservice/telemetryservice_backend_$(date '+%Y%m%d_%H%M').log"

echo "Dumping logs for analyticsservice..."
kubectl --namespace tfs logs deployment/analyticsservice -c backend > "${LOG_DIR}/analyticsservice/analyticsservice_$(date '+%Y%m%d_%H%M').log"

echo "Dumping logs for policyservice..."
kubectl --namespace tfs logs deployment/policyservice > "${LOG_DIR}/policyservice/policyservice_$(date '+%Y%m%d_%H%M').log"

echo "Dumping logs for automationservice..."
kubectl --namespace tfs logs deployment/automationservice -c server > "${LOG_DIR}/automationservice/automationservice_$(date '+%Y%m%d_%H%M').log"

echo "Logs dumped successfully in ${LOG_DIR}<service_name>/"

echo "Dumping logs for NETCONF Mock Server..."
kubectl --namespace netconf-mock logs deployment/netconf-oc-optical-mock > "${LOG_DIR}/netconf_mock/netconf-mock_$(date '+%Y%m%d_%H%M').log"

echo "DONE."
+4 −4
Original line number Diff line number Diff line
@@ -22,11 +22,14 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/"
# Set the list of components, separated by spaces, you want to build images for, and deploy.
export TFS_COMPONENTS="context device pathcomp service nbi webui"

# Uncomment to activate Policy Manager (it takes long time to build, better to deploy it first)
export TFS_COMPONENTS="${TFS_COMPONENTS} policy"

# Uncomment to activate Monitoring (old)
#export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring"

# Uncomment to activate Monitoring Framework (new)
export TFS_COMPONENTS="${TFS_COMPONENTS} kpi_manager kpi_value_api telemetry"
export TFS_COMPONENTS="${TFS_COMPONENTS} kpi_manager telemetry analytics automation"
#export TFS_COMPONENTS="${TFS_COMPONENTS} kpi_manager kpi_value_writer kpi_value_api telemetry analytics automation"

# Uncomment to activate QoS Profiles
@@ -48,9 +51,6 @@ export TFS_COMPONENTS="${TFS_COMPONENTS} kpi_manager kpi_value_api telemetry"
# Uncomment to activate ZTP
#export TFS_COMPONENTS="${TFS_COMPONENTS} ztp"

# Uncomment to activate Policy Manager
#export TFS_COMPONENTS="${TFS_COMPONENTS} policy"

# Uncomment to activate Optical CyberSecurity
#export TFS_COMPONENTS="${TFS_COMPONENTS} dbscanserving opticalattackmitigator opticalattackdetector opticalattackmanager"

+70 −0
Original line number Diff line number Diff line
#!/bin/bash
# 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.
#
# Teardown script for ZSM failure notification test artifacts.
#
# Removes devices, topology, and context created by the ecoc26_pluggables
# test scenario.  Idempotent — safe to run multiple times.
# Does NOT tear down TFS itself.
#
# Usage:
#   ./teardown_zsm_test.sh

set -euo pipefail

echo "Tearing down ZSM test artifacts..."

python3 -c "
from context.client.ContextClient import ContextClient
from common.proto.context_pb2 import ContextId, TopologyId, DeviceId
from src.tests.ecoc26_pluggables.descriptors.ecoc26_messages import (
    ROUTER_HUB_DEVICE_UUID, ROUTER_LEAF_DEVICE_UUID)

c = ContextClient()

# ── Remove devices first (FK: endpoints reference topology) ──────────────────
for uuid in [ROUTER_HUB_DEVICE_UUID, ROUTER_LEAF_DEVICE_UUID]:
    d = DeviceId()
    d.device_uuid.uuid = uuid
    try:
        c.RemoveDevice(d)
        print(f'Device {uuid} removed')
    except Exception as ex:
        print(f'Device {uuid} already removed or not found: {ex}')

# ── Remove topology ──────────────────────────────────────────────────────────
ctx = ContextId()
ctx.context_uuid.uuid = '43813baf-195e-5da6-af20-b3d0922e71a7'
topo = TopologyId()
topo.topology_uuid.uuid = 'c76135e3-24a8-5e92-9bed-c3c9139359c8'
topo.context_id.CopyFrom(ctx)
try:
    c.RemoveTopology(topo)
    print('Topology c76135e3-... removed')
except Exception as ex:
    print(f'Topology already removed or not found: {ex}')

# ── Remove context ───────────────────────────────────────────────────────────
try:
    c.RemoveContext(ctx)
    print('Context 43813baf-... removed')
except Exception as ex:
    print(f'Context already removed or not found: {ex}')

c.close()
print('Teardown complete')
"

echo "[✓] Teardown finished"