Commit 6d8821b5 authored by Waleed Akbar's avatar Waleed Akbar
Browse files

feat: Add telemetry subscription script for different controller types

parent 14765779
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -13,14 +13,20 @@
# limitations under the License.


import sys
import requests
from requests.auth import HTTPBasicAuth


if len(sys.argv) < 3:
    print('Usage: {:s} <network_name> <link_name>'.format(sys.argv[0]))
    print('Example: {:s} e2e E2E-L1'.format(sys.argv[0]))
    sys.exit(1)

RESTCONF_ADDRESS  = '127.0.0.1'
RESTCONF_PORT     = 80
TARGET_SIMAP_NAME = 'e2e'
TARGET_LINK_NAME  = 'E2E-L1'
TARGET_SIMAP_NAME = sys.argv[1]
TARGET_LINK_NAME  = sys.argv[2]
SAMPLING_INTERVAL = 10.0


@@ -39,7 +45,7 @@ REQUEST = {


def main() -> None:
    print('[E2E] Subscribe Telemetry slice1...')
    print('[{:s}] Subscribe Telemetry slice1 for link {:s}...'.format(TARGET_SIMAP_NAME.upper(), TARGET_LINK_NAME))
    headers = {'accept': 'application/json'}
    auth = HTTPBasicAuth('admin', 'admin')
    print(SUBSCRIBE_URL)
+42 −0
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2022-2025 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.

# Set working directory
cd "$(dirname "$0")" || exit 1

# Get the current hostname
HOSTNAME=$(hostname)
echo "Starting telemetry subscription for ${HOSTNAME}..."

case "$HOSTNAME" in
    tfs-e2e-ctrl)
        echo "Subscribing to E2E Controller telemetry..."
        python3 telemetry-subscribe-slice1.py e2e E2E-L1
        ;;
    tfs-agg-ctrl)
        echo "Subscribing to Aggregation Controller telemetry..."
        python3 telemetry-subscribe-slice1.py agg AggNet-L1
        ;;
    tfs-ip-ctrl)
        echo "Subscribing to IP Controller telemetry..."
        python3 telemetry-subscribe-slice1.py ip Trans-L1
        ;;
    *)
        echo "Unknown host: $HOSTNAME"
        echo "Usage: $0"
        echo "  This script must be run on tfs-e2e-ctrl, tfs-agg-ctrl, or tfs-ip-ctrl"
        exit 1
        ;;
esac