Commit 0cdbeb52 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'develop' of https://labs.etsi.org/rep/tfs/controller into feat/l3-components

parents 90be042f 203e9cd5
Loading
Loading
Loading
Loading
+57 −1
Original line number Original line Diff line number Diff line
@@ -20,7 +20,24 @@
export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/"
export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/"


# Set the list of components, separated by spaces, you want to build images for, and deploy.
# Set the list of components, separated by spaces, you want to build images for, and deploy.
export TFS_COMPONENTS="context device automation monitoring pathcomp service slice compute webui"
#export TFS_COMPONENTS="context device pathcomp service slice compute webui load_generator"
export TFS_COMPONENTS="context device pathcomp service slice compute webui"

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

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

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

# Uncomment to activate L3 CyberSecurity
#export TFS_COMPONENTS="${TFS_COMPONENTS} l3_attackmitigator l3_centralizedattackdetector"

# Uncomment to activate TE
#export TFS_COMPONENTS="${TFS_COMPONENTS} te"


# Set the tag you want to use for your images.
# Set the tag you want to use for your images.
export TFS_IMAGE_TAG="dev"
export TFS_IMAGE_TAG="dev"
@@ -31,6 +48,12 @@ export TFS_K8S_NAMESPACE="tfs"
# Set additional manifest files to be applied after the deployment
# Set additional manifest files to be applied after the deployment
export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml"
export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml"


# Uncomment to monitor performance of components
export TFS_EXTRA_MANIFESTS="${TFS_EXTRA_MANIFESTS} manifests/servicemonitors.yaml"

# Uncomment when deploying Optical CyberSecurity
#export TFS_EXTRA_MANIFESTS="${TFS_EXTRA_MANIFESTS} manifests/cachingservice.yaml"

# Set the new Grafana admin password
# Set the new Grafana admin password
export TFS_GRAFANA_PASSWORD="admin123+"
export TFS_GRAFANA_PASSWORD="admin123+"


@@ -43,6 +66,12 @@ export TFS_SKIP_BUILD=""
# Set the namespace where CockroackDB will be deployed.
# Set the namespace where CockroackDB will be deployed.
export CRDB_NAMESPACE="crdb"
export CRDB_NAMESPACE="crdb"


# Set the external port CockroackDB Postgre SQL interface will be exposed to.
export CRDB_EXT_PORT_SQL="26257"

# Set the external port CockroackDB HTTP Mgmt GUI interface will be exposed to.
export CRDB_EXT_PORT_HTTP="8081"

# Set the database username to be used by Context.
# Set the database username to be used by Context.
export CRDB_USERNAME="tfs"
export CRDB_USERNAME="tfs"


@@ -68,6 +97,12 @@ export CRDB_REDEPLOY=""
# Set the namespace where NATS will be deployed.
# Set the namespace where NATS will be deployed.
export NATS_NAMESPACE="nats"
export NATS_NAMESPACE="nats"


# Set the external port NATS Client interface will be exposed to.
export NATS_EXT_PORT_CLIENT="4222"

# Set the external port NATS HTTP Mgmt GUI interface will be exposed to.
export NATS_EXT_PORT_HTTP="8222"

# Disable flag for re-deploying NATS from scratch.
# Disable flag for re-deploying NATS from scratch.
export NATS_REDEPLOY=""
export NATS_REDEPLOY=""


@@ -77,6 +112,15 @@ export NATS_REDEPLOY=""
# Set the namespace where QuestDB will be deployed.
# Set the namespace where QuestDB will be deployed.
export QDB_NAMESPACE="qdb"
export QDB_NAMESPACE="qdb"


# Set the external port QuestDB Postgre SQL interface will be exposed to.
export QDB_EXT_PORT_SQL="8812"

# Set the external port QuestDB Influx Line Protocol interface will be exposed to.
export QDB_EXT_PORT_ILP="9009"

# Set the external port QuestDB HTTP Mgmt GUI interface will be exposed to.
export QDB_EXT_PORT_HTTP="9000"

# Set the database username to be used for QuestDB.
# Set the database username to be used for QuestDB.
export QDB_USERNAME="admin"
export QDB_USERNAME="admin"


@@ -86,8 +130,20 @@ export QDB_PASSWORD="quest"
# Set the table name to be used by Monitoring for KPIs.
# Set the table name to be used by Monitoring for KPIs.
export QDB_TABLE_MONITORING_KPIS="tfs_monitoring_kpis"
export QDB_TABLE_MONITORING_KPIS="tfs_monitoring_kpis"


# Set the table name to be used by Slice for plotting groups.
export QDB_TABLE_SLICE_GROUPS="tfs_slice_groups"

# Disable flag for dropping tables if they exist.
# Disable flag for dropping tables if they exist.
export QDB_DROP_TABLES_IF_EXIST="YES"
export QDB_DROP_TABLES_IF_EXIST="YES"


# Disable flag for re-deploying QuestDB from scratch.
# Disable flag for re-deploying QuestDB from scratch.
export QDB_REDEPLOY=""
export QDB_REDEPLOY=""


# ----- K8s Observability ------------------------------------------------------

# Set the external port Prometheus Mgmt HTTP GUI interface will be exposed to.
export PROM_EXT_PORT_HTTP="9090"

# Set the external port Grafana HTTP Dashboards will be exposed to.
export GRAF_EXT_PORT_HTTP="3000"
+23 −2
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@


import logging, time
import logging, time
from common.Constants import DEFAULT_CONTEXT_NAME
from common.Constants import DEFAULT_CONTEXT_NAME
from common.proto.context_pb2 import ContextId, Empty
from common.proto.context_pb2 import ContextId, DeviceOperationalStatusEnum, Empty
from common.proto.monitoring_pb2 import KpiDescriptorList
from common.proto.monitoring_pb2 import KpiDescriptorList
from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results, validate_empty_scenario
from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results, validate_empty_scenario
from common.tools.object_factory.Context import json_context_id
from common.tools.object_factory.Context import json_context_id
@@ -46,6 +46,27 @@ def test_scenario_bootstrap(
    assert len(response.service_ids) == 0
    assert len(response.service_ids) == 0
    assert len(response.slice_ids) == 0
    assert len(response.slice_ids) == 0


def test_scenario_devices_enabled(
    context_client : ContextClient,         # pylint: disable=redefined-outer-name
) -> None:
    """
    This test validates that the devices are enabled.
    """
    DEVICE_OP_STATUS_ENABLED = DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED

    num_devices = -1
    num_devices_enabled, num_retry = 0, 0
    while (num_devices != num_devices_enabled) and (num_retry < 10):
        time.sleep(1.0)
        response = context_client.ListDevices(Empty())
        num_devices = len(response.devices)
        num_devices_enabled = 0
        for device in response.devices:
            if device.device_operational_status != DEVICE_OP_STATUS_ENABLED: continue
            num_devices_enabled += 1
        LOGGER.info('Num Devices enabled: {:d}/{:d}'.format(num_devices_enabled, num_devices))
        num_retry += 1
    assert num_devices_enabled == num_devices


def test_scenario_kpis_created(
def test_scenario_kpis_created(
    context_client : ContextClient,         # pylint: disable=redefined-outer-name
    context_client : ContextClient,         # pylint: disable=redefined-outer-name
@@ -67,7 +88,7 @@ def test_scenario_kpis_created(
    LOGGER.info('Num KPIs expected: {:d}'.format(num_kpis_expected))
    LOGGER.info('Num KPIs expected: {:d}'.format(num_kpis_expected))


    num_kpis_created, num_retry = 0, 0
    num_kpis_created, num_retry = 0, 0
    while (num_kpis_created != num_kpis_expected) and (num_retry < 5):
    while (num_kpis_created != num_kpis_expected) and (num_retry < 10):
        response: KpiDescriptorList = monitoring_client.GetKpiDescriptorList(Empty())
        response: KpiDescriptorList = monitoring_client.GetKpiDescriptorList(Empty())
        num_kpis_created = len(response.kpi_descriptor_list)
        num_kpis_created = len(response.kpi_descriptor_list)
        LOGGER.info('Num KPIs created: {:d}'.format(num_kpis_created))
        LOGGER.info('Num KPIs created: {:d}'.format(num_kpis_created))