diff --git a/proto/context.proto b/proto/context.proto index b6b55c15ff01282acaefa875c35e43899274c3ab..d22dcdc4395e625e672e50af3c4024f195b0201c 100644 --- a/proto/context.proto +++ b/proto/context.proto @@ -497,7 +497,7 @@ message EndPointId { message EndPoint { EndPointId endpoint_id = 1; string name = 2; - string endpoint_type = 3; // == 'smartnics' + string endpoint_type = 3; repeated kpi_sample_types.KpiSampleType kpi_sample_types = 4; Location endpoint_location = 5; map<string, google.protobuf.Any> capabilities = 6; diff --git a/proto/nfv_client.proto b/proto/nfv_client.proto deleted file mode 100644 index d903e7907980c779ea8ee9a047bf040aaaffc6df..0000000000000000000000000000000000000000 --- a/proto/nfv_client.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package nfv_client; - -import "context.proto"; - -message Nsd { - string nsd_name = 1; - string config_params=2; -} - -message Ns { - string ns_id=1; - string ns_name=2; - string nsd_name=3; - string vim_account=4; - string config_params=5; - string status = 6; - string status_message = 7; -} - -message NsList { - repeated Ns ns = 1; -} - -message NsdList { - repeated Nsd nsd = 1; -} - -service nfv_client { - rpc GetNsList (context.Empty) returns (NsList) {} - rpc GetNsdList (context.Empty) returns (NsdList) {} - rpc CreateNs (Ns) returns (Ns) {} - rpc UpdateNs (Ns) returns (Ns) {} - rpc DeleteNs (Ns) returns (context.Empty) {} -} - - diff --git a/proto/nos_client.proto b/proto/nos_client.proto deleted file mode 100644 index e0e35a6481f457db7df926c8d1af9deec4fd6459..0000000000000000000000000000000000000000 --- a/proto/nos_client.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package nos_client; - -message NOS_SW { - string ztp_device_sw_url = 1; - bytes ztp_device_sw_file = 2; -} - -message Config_Script { - string config_script_url = 1; - bytes config_script_file = 2; -} - -service nos_client { - rpc GetNOSFile (NOS_SW) returns (NOS_SW) {} - rpc GetConfigScriptFile (Config_Script) returns (Config_Script) {} -} - - diff --git a/src/common/tools/object_factory/Device.py b/src/common/tools/object_factory/Device.py index bb5c856343ed837900fee5813af16fa26e06eca5..3d09d7156783e4a7e44510900dd55d2d684b299f 100644 --- a/src/common/tools/object_factory/Device.py +++ b/src/common/tools/object_factory/Device.py @@ -12,13 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import copy, logging +import copy from typing import Dict, List, Optional, Tuple from common.DeviceTypes import DeviceTypeEnum from common.proto.context_pb2 import DeviceDriverEnum, DeviceOperationalStatusEnum from common.tools.object_factory.ConfigRule import json_config_rule_set -LOGGER = logging.getLogger(__name__) DEVICE_DISABLED = DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_DISABLED DEVICE_EMUDC_TYPE = DeviceTypeEnum.EMULATED_DATACENTER.value @@ -53,7 +52,6 @@ DEVICE_IETF_ACTN_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_IETF_ACTN] DEVICE_SMARTNIC_TYPE = DeviceTypeEnum.SMARTNIC.value DEVICE_SMARTNIC_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_SMARTNIC] - def json_device_id(device_uuid : str): return {'device_uuid': {'uuid': device_uuid}} @@ -63,13 +61,13 @@ def json_device( ): result = { 'device_id' : json_device_id(device_uuid), - 'name' : name, 'device_type' : device_type, 'device_config' : {'config_rules': copy.deepcopy(config_rules)}, 'device_operational_status': status, 'device_drivers' : copy.deepcopy(drivers), 'device_endpoints' : copy.deepcopy(endpoints), } + if name is not None: result['name'] = name return result def json_device_emulated_packet_router_disabled( diff --git a/src/device/service/drivers/__init__.py b/src/device/service/drivers/__init__.py index 3c1baf5df8d2b9babca862a7f76f9590d8caf1e7..ccb348c05c17708b4acc62d140f70396cc7cd4a6 100644 --- a/src/device/service/drivers/__init__.py +++ b/src/device/service/drivers/__init__.py @@ -167,7 +167,7 @@ if LOAD_ALL_DEVICE_DRIVERS: DRIVERS.append( (SmartnicDriver, [ { - # Real P4 Switch, specifying P4 Driver => use P4Driver + # Real SmartNics device => use SmartNicsDriver FilterFieldEnum.DEVICE_TYPE: DeviceTypeEnum.SMARTNIC, FilterFieldEnum.DRIVER : DeviceDriverEnum.DEVICEDRIVER_SMARTNIC, } diff --git a/src/device/service/drivers/smartnic/probes-agent.yang b/src/device/service/drivers/smartnic/probes-agent.yang index 897d2f129aa9e449e7f0554936c3170e24b18904..0ed81170a631cb9a7ec74b0557179447f9487588 100644 --- a/src/device/service/drivers/smartnic/probes-agent.yang +++ b/src/device/service/drivers/smartnic/probes-agent.yang @@ -1,3 +1,17 @@ +// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + module probes-agent { namespace "urn:probes-agent"; diff --git a/src/nbi/service/rest_server/nbi_plugins/agent_probes/Resources.py b/src/nbi/service/rest_server/nbi_plugins/agent_probes/Resources.py index 50e8e77afd6c197e8142e3536cc89e0df9b978ac..3c3184323da4f94f4660bb888024019e8fa649da 100644 --- a/src/nbi/service/rest_server/nbi_plugins/agent_probes/Resources.py +++ b/src/nbi/service/rest_server/nbi_plugins/agent_probes/Resources.py @@ -12,162 +12,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -import json -from flask.json import jsonify from flask_restful import Resource, request from common.proto.context_pb2 import Empty -from common.tools.grpc.Tools import grpc_message_to_json from context.client.ContextClient import ContextClient from device.client.DeviceClient import DeviceClient -from service.client.ServiceClient import ServiceClient -from .Tools import ( - format_grpc_to_json, grpc_connection_id, grpc_context_id, grpc_device, grpc_device_id, grpc_link_id, grpc_policy_rule_id, - grpc_service_id, grpc_service, grpc_slice_id, grpc_topology_id) +from .Tools import format_grpc_to_json, grpc_device, grpc_device_id class _Resource(Resource): def __init__(self) -> None: super().__init__() self.client = ContextClient() self.device_client = DeviceClient() - self.service_client = ServiceClient() - -class ContextIds(_Resource): - def get(self): - return format_grpc_to_json(self.client.ListContextIds(Empty())) - -class Contexts(_Resource): - def get(self): - return format_grpc_to_json(self.client.ListContexts(Empty())) - -class DummyContexts(_Resource): - def get(self): - contexts = grpc_message_to_json(self.client.ListContexts(Empty()), use_integers_for_enums=True)['contexts'] - devices = grpc_message_to_json(self.client.ListDevices(Empty()), use_integers_for_enums=True)['devices'] - links = grpc_message_to_json(self.client.ListLinks(Empty()), use_integers_for_enums=True)['links'] - - topologies = list() - slices = list() - services = list() - connections = list() - - for context in contexts: - context_uuid = context['context_id']['context_uuid']['uuid'] - context_id = grpc_context_id(context_uuid) - - topologies.extend(grpc_message_to_json( - self.client.ListTopologies(context_id), - use_integers_for_enums=True - )['topologies']) - - slices.extend(grpc_message_to_json( - self.client.ListSlices(context_id), - use_integers_for_enums=True - )['slices']) - - context_services = grpc_message_to_json( - self.client.ListServices(context_id), - use_integers_for_enums=True - )['services'] - services.extend(context_services) - - for service in context_services: - service_uuid = service['service_id']['service_uuid']['uuid'] - service_id = grpc_service_id(context_uuid, service_uuid) - connections.extend(grpc_message_to_json( - self.client.ListConnections(service_id), - use_integers_for_enums=True - )['connections']) - - for device in devices: - for config_rule in device['device_config']['config_rules']: - if 'custom' not in config_rule: continue - resource_value = config_rule['custom']['resource_value'] - if not isinstance(resource_value, str): continue - try: - resource_value = json.loads(resource_value) - except: # pylint: disable=bare-except - pass - config_rule['custom']['resource_value'] = resource_value - - dummy_context = {'dummy_mode': True} - if len(contexts ) > 0: dummy_context['contexts' ] = contexts - if len(topologies ) > 0: dummy_context['topologies' ] = topologies - if len(devices ) > 0: dummy_context['devices' ] = devices - if len(links ) > 0: dummy_context['links' ] = links - if len(slices ) > 0: dummy_context['slices' ] = slices - if len(services ) > 0: dummy_context['services' ] = services - if len(connections) > 0: dummy_context['connections'] = connections - return jsonify(dummy_context) - -class Context(_Resource): - def get(self, context_uuid : str): - return format_grpc_to_json(self.client.GetContext(grpc_context_id(context_uuid))) - -class TopologyIds(_Resource): - def get(self, context_uuid : str): - return format_grpc_to_json(self.client.ListTopologyIds(grpc_context_id(context_uuid))) - -class Topologies(_Resource): - def get(self, context_uuid : str): - return format_grpc_to_json(self.client.ListTopologies(grpc_context_id(context_uuid))) - -class Topology(_Resource): - def get(self, context_uuid : str, topology_uuid : str): - return format_grpc_to_json(self.client.GetTopology(grpc_topology_id(context_uuid, topology_uuid))) - -class ServiceIds(_Resource): - def get(self, context_uuid : str): - return format_grpc_to_json(self.client.ListServiceIds(grpc_context_id(context_uuid))) - -class Services(_Resource): - def get(self, context_uuid : str): - return format_grpc_to_json(self.client.ListServices(grpc_context_id(context_uuid))) - -class Service(_Resource): - def get(self, context_uuid : str, service_uuid : str): - return format_grpc_to_json(self.client.GetService(grpc_service_id(context_uuid, service_uuid))) - - def post(self, context_uuid : str, service_uuid : str): # pylint: disable=unused-argument - service = request.get_json()['services'][0] - return format_grpc_to_json(self.service_client.CreateService(grpc_service( - service_uuid = service['service_id']['service_uuid']['uuid'], - service_type = service['service_type'], - context_uuid = service['service_id']['context_id']['context_uuid']['uuid'], - ))) - - def put(self, context_uuid : str, service_uuid : str): # pylint: disable=unused-argument - service = request.get_json()['services'][0] - return format_grpc_to_json(self.service_client.UpdateService(grpc_service( - service_uuid = service['service_id']['service_uuid']['uuid'], - service_type = service['service_type'], - context_uuid = service['service_id']['context_id']['context_uuid']['uuid'], - status = service['service_status']['service_status'], - endpoint_ids = service['service_endpoint_ids'], - constraints = service['service_constraints'], - config_rules = service['service_config']['config_rules'] - ))) - - def delete(self, context_uuid : str, service_uuid : str): - return format_grpc_to_json(self.service_client.DeleteService(grpc_service_id( - context_uuid, service_uuid, - ))) - -class SliceIds(_Resource): - def get(self, context_uuid : str): - return format_grpc_to_json(self.client.ListSliceIds(grpc_context_id(context_uuid))) - -class Slices(_Resource): - def get(self, context_uuid : str): - return format_grpc_to_json(self.client.ListSlices(grpc_context_id(context_uuid))) - -class Slice(_Resource): - def get(self, context_uuid : str, slice_uuid : str): - return format_grpc_to_json(self.client.GetSlice(grpc_slice_id(context_uuid, slice_uuid))) class DeviceIds(_Resource): def get(self): return format_grpc_to_json(self.client.ListDeviceIds(Empty())) - + class Devices(_Resource): def get(self): return format_grpc_to_json(self.client.ListDevices(Empty())) @@ -208,39 +68,3 @@ class Device(_Resource): config_rules = device['device_config']['config_rules'], drivers = device['device_drivers'] ))) - -class LinkIds(_Resource): - def get(self): - return format_grpc_to_json(self.client.ListLinkIds(Empty())) - -class Links(_Resource): - def get(self): - return format_grpc_to_json(self.client.ListLinks(Empty())) - -class Link(_Resource): - def get(self, link_uuid : str): - return format_grpc_to_json(self.client.GetLink(grpc_link_id(link_uuid))) - -class ConnectionIds(_Resource): - def get(self, context_uuid : str, service_uuid : str): - return format_grpc_to_json(self.client.ListConnectionIds(grpc_service_id(context_uuid, service_uuid))) - -class Connections(_Resource): - def get(self, context_uuid : str, service_uuid : str): - return format_grpc_to_json(self.client.ListConnections(grpc_service_id(context_uuid, service_uuid))) - -class Connection(_Resource): - def get(self, connection_uuid : str): - return format_grpc_to_json(self.client.GetConnection(grpc_connection_id(connection_uuid))) - -class PolicyRuleIds(_Resource): - def get(self): - return format_grpc_to_json(self.client.ListPolicyRuleIds(Empty())) - -class PolicyRules(_Resource): - def get(self): - return format_grpc_to_json(self.client.ListPolicyRules(Empty())) - -class PolicyRule(_Resource): - def get(self, policy_rule_uuid : str): - return format_grpc_to_json(self.client.GetPolicyRule(grpc_policy_rule_id(policy_rule_uuid))) diff --git a/src/nbi/service/rest_server/nbi_plugins/agent_probes/Tools.py b/src/nbi/service/rest_server/nbi_plugins/agent_probes/Tools.py index 6cffbb5cc5e9522393d9dfece70e61f79ff0b90f..27a2780bb2d8008618ba906675d6a908f803c0f4 100644 --- a/src/nbi/service/rest_server/nbi_plugins/agent_probes/Tools.py +++ b/src/nbi/service/rest_server/nbi_plugins/agent_probes/Tools.py @@ -12,45 +12,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging from flask.json import jsonify from common.proto.context_pb2 import ( - ConnectionId, ContextId, DeviceDriverEnum, Device, DeviceId, DeviceOperationalStatusEnum, LinkId, ServiceId, SliceId, TopologyId, Service, ServiceStatusEnum + DeviceDriverEnum, Device, DeviceId, DeviceOperationalStatusEnum ) -from common.proto.policy_pb2 import PolicyRuleId -from common.proto.context_pb2 import ConfigActionEnum -from common.tools.grpc.Tools import grpc_message_to_json, grpc_message_to_json_string -from common.tools.object_factory.Connection import json_connection_id -from common.tools.object_factory.Context import json_context_id +from common.tools.grpc.Tools import grpc_message_to_json from common.tools.object_factory.ConfigRule import json_config_rule -from common.tools.object_factory.Constraint import json_constraint_custom -from common.tools.object_factory.EndPoint import json_endpoint_id, json_endpoint +from common.tools.object_factory.EndPoint import json_endpoint from common.tools.object_factory.Device import json_device_id, json_device -from common.tools.object_factory.Link import json_link_id -from common.tools.object_factory.PolicyRule import json_policyrule_id -from common.tools.object_factory.Service import json_service_id, json_service -from common.tools.object_factory.Slice import json_slice_id -from common.tools.object_factory.Topology import json_topology_id - -LOGGER = logging.getLogger(__name__) -LOGGER.setLevel(logging.DEBUG) def format_grpc_to_json(grpc_reply): return jsonify(grpc_message_to_json(grpc_reply)) -def grpc_connection_id(connection_uuid): - return ConnectionId(**json_connection_id(connection_uuid)) - -def grpc_context_id(context_uuid): - return ContextId(**json_context_id(context_uuid)) - def grpc_device_id(device_uuid): return DeviceId(**json_device_id(device_uuid)) def grpc_device( device_uuid, device_type, status, endpoints=None, config_rules=None, drivers=None ): - json_config_rules = [ json_config_rule( config_rule['action'], @@ -74,49 +53,3 @@ def grpc_device( ] if endpoints else [] return Device(**json_device( device_uuid, device_type, json_status, None, json_endpoints, json_config_rules, json_drivers)) - -def grpc_link_id(link_uuid): - return LinkId(**json_link_id(link_uuid)) - -def grpc_service_id(context_uuid, service_uuid): - return ServiceId(**json_service_id(service_uuid, context_id=json_context_id(context_uuid))) - -def grpc_service( - service_uuid, service_type, context_uuid, status=None, endpoint_ids=None, constraints=None, config_rules=None -): - json_context = json_context_id(context_uuid) - json_status = status if status else ServiceStatusEnum.SERVICESTATUS_PLANNED - json_endpoints_ids = [ - json_endpoint_id( - json_device_id(endpoint_id['device_id']['device_uuid']['uuid']), - endpoint_id['endpoint_uuid']['uuid'] - ) - for endpoint_id in endpoint_ids - ] if endpoint_ids else [] - json_constraints = [ - json_constraint_custom( - constraint['custom']['constraint_type'], - constraint['custom']['constraint_value'] - ) - for constraint in constraints - ] if constraints else [] - json_config_rules = [ - json_config_rule( - config_rule['action'], - config_rule['custom']['resource_key'], - config_rule['custom']['resource_value'] - ) - for config_rule in config_rules - ] if config_rules else [] - return Service(**json_service( - service_uuid, service_type, json_context, json_status, - json_endpoints_ids, json_constraints, json_config_rules)) - -def grpc_slice_id(context_uuid, slice_uuid): - return SliceId(**json_slice_id(slice_uuid, context_id=json_context_id(context_uuid))) - -def grpc_topology_id(context_uuid, topology_uuid): - return TopologyId(**json_topology_id(topology_uuid, context_id=json_context_id(context_uuid))) - -def grpc_policy_rule_id(policy_rule_uuid): - return PolicyRuleId(**json_policyrule_id(policy_rule_uuid)) diff --git a/src/nbi/service/rest_server/nbi_plugins/agent_probes/__init__.py b/src/nbi/service/rest_server/nbi_plugins/agent_probes/__init__.py index 0b85500fce83112fa2aef74d30e2668691bebe55..f28a2ad566360bc130efe3a81a08d7770540ec9a 100644 --- a/src/nbi/service/rest_server/nbi_plugins/agent_probes/__init__.py +++ b/src/nbi/service/rest_server/nbi_plugins/agent_probes/__init__.py @@ -13,55 +13,16 @@ # limitations under the License. from nbi.service.rest_server.RestServer import RestServer -from .Resources import ( - Connection, ConnectionIds, Connections, - Context, ContextIds, Contexts, - Device, DeviceIds, Devices, - DummyContexts, - Link, LinkIds, Links, - PolicyRule, PolicyRuleIds, PolicyRules, - Service, ServiceIds, Services, - Slice, SliceIds, Slices, - Topologies, Topology, TopologyIds -) +from .Resources import Device, DeviceIds, Devices URL_PREFIX = '/agent-probes' # Use 'path' type since some identifiers might contain char '/' and Flask is unable to recognize them in 'string' type. RESOURCES = [ # (endpoint_name, resource_class, resource_url) - # ('api.context_ids', ContextIds, '/context_ids'), - # ('api.contexts', Contexts, '/contexts'), - # ('api.dummy_contexts', DummyContexts, '/dummy_contexts'), - # ('api.context', Context, '/context/<path:context_uuid>'), - - # ('api.topology_ids', TopologyIds, '/context/<path:context_uuid>/topology_ids'), - # ('api.topologies', Topologies, '/context/<path:context_uuid>/topologies'), - # ('api.topology', Topology, '/context/<path:context_uuid>/topology/<path:topology_uuid>'), - - # ('api.service_ids', ServiceIds, '/context/<path:context_uuid>/service_ids'), - # ('api.services', Services, '/context/<path:context_uuid>/services'), - # ('api.service', Service, '/context/<path:context_uuid>/service/<path:service_uuid>'), - - # ('api.slice_ids', SliceIds, '/context/<path:context_uuid>/slice_ids'), - # ('api.slices', Slices, '/context/<path:context_uuid>/slices'), - # ('api.slice', Slice, '/context/<path:context_uuid>/slice/<path:slice_uuid>'), - ('api.smartnic.device_ids', DeviceIds, '/device_ids'), ('api.smartnic.devices', Devices, '/devices'), ('api.smartnic.device', Device, '/device/<path:device_uuid>'), - - # ('api.link_ids', LinkIds, '/link_ids'), - # ('api.links', Links, '/links'), - # ('api.link', Link, '/link/<path:link_uuid>'), - - # ('api.connection_ids', ConnectionIds, '/context/<path:context_uuid>/service/<path:service_uuid>/connection_ids'), - # ('api.connections', Connections, '/context/<path:context_uuid>/service/<path:service_uuid>/connections'), - # ('api.connection', Connection, '/connection/<path:connection_uuid>'), - - # ('api.policyrule_ids', PolicyRuleIds, '/policyrule_ids'), - # ('api.policyrules', PolicyRules, '/policyrules'), - # ('api.policyrule', PolicyRule, '/policyrule/<path:policyrule_uuid>'), ] def register_agent_probes(rest_server : RestServer): diff --git a/src/nbi/tests/data/agent_probes_device.json b/src/nbi/tests/data/agent_probes_device.json index e9d931528cb9e8b642aa9ed21aca743632512b6d..6170e88a1dbf3cf01d3c9c347064aa85ce282044 100644 --- a/src/nbi/tests/data/agent_probes_device.json +++ b/src/nbi/tests/data/agent_probes_device.json @@ -24,4 +24,3 @@ ] } - \ No newline at end of file diff --git a/src/policy/Dockerfile b/src/policy/Dockerfile deleted file mode 100644 index 2c6412d0766558edf3bb469b17c7f2b6a1c7dd08..0000000000000000000000000000000000000000 --- a/src/policy/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -# Multi-stage Docker image build - -# Stage 1 -FROM maven:3-jdk-11 AS builder - -# Define working directory -WORKDIR /app - -# Copy every file in working directory, as defined in .dockerignore file -COPY ./pom.xml pom.xml -COPY ./src src/ -COPY ./target/generated-sources/ target/generated-sources/ -RUN mvn --errors --batch-mode package -Dmaven.test.skip=true - -# Stage 2 -FROM builder AS unit-test - -RUN mvn --errors --batch-mode -Pgenerate-consolidated-coverage verify - -# Stage 3 -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 AS release - -ARG JAVA_PACKAGE=java-11-openjdk-headless -ARG RUN_JAVA_VERSION=1.3.8 -ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' -# Install java and the run-java script -# Also set up permissions for user `1001` -RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ - && microdnf update \ - && microdnf clean all \ - && mkdir /deployments \ - && chown 1001 /deployments \ - && chmod "g+rwX" /deployments \ - && chown 1001:root /deployments \ - && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ - && chown 1001 /deployments/run-java.sh \ - && chmod 540 /deployments/run-java.sh \ - && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security - -# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. -ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" -# We make four distinct layers so if there are application changes the library layers can be re-used -COPY --from=builder --chown=1001 /app/target/quarkus-app/lib/ /deployments/lib/ -COPY --from=builder --chown=1001 /app/target/quarkus-app/*.jar /deployments/ -COPY --from=builder --chown=1001 /app/target/quarkus-app/app/ /deployments/app/ -COPY --from=builder --chown=1001 /app/target/quarkus-app/quarkus/ /deployments/quarkus/ - -EXPOSE 8080 -EXPOSE 6060 -USER 1001 - -ENTRYPOINT [ "/deployments/run-java.sh" ] diff --git a/src/policy/Dockerfile b/src/policy/Dockerfile new file mode 120000 index 0000000000000000000000000000000000000000..eec732273e12372d1a11fef9d958b124e9d8df1f --- /dev/null +++ b/src/policy/Dockerfile @@ -0,0 +1 @@ +src/main/docker/Dockerfile.multistage.jvm \ No newline at end of file diff --git a/src/policy/src/main/proto/acl.proto b/src/policy/src/main/proto/acl.proto deleted file mode 100644 index 3dba735dccf44d584a998eb02b4835bac7ceddd1..0000000000000000000000000000000000000000 --- a/src/policy/src/main/proto/acl.proto +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package acl; - -enum AclRuleTypeEnum { - ACLRULETYPE_UNDEFINED = 0; - ACLRULETYPE_IPV4 = 1; - ACLRULETYPE_IPV6 = 2; - ACLRULETYPE_L2 = 3; - ACLRULETYPE_MPLS = 4; - ACLRULETYPE_MIXED = 5; -} - -enum AclForwardActionEnum { - ACLFORWARDINGACTION_UNDEFINED = 0; - ACLFORWARDINGACTION_DROP = 1; - ACLFORWARDINGACTION_ACCEPT = 2; - ACLFORWARDINGACTION_REJECT = 3; -} - -enum AclLogActionEnum { - ACLLOGACTION_UNDEFINED = 0; - ACLLOGACTION_NOLOG = 1; - ACLLOGACTION_SYSLOG = 2; -} - -message AclMatch { - uint32 dscp = 1; - uint32 protocol = 2; - string src_address = 3; - string dst_address = 4; - uint32 src_port = 5; - uint32 dst_port = 6; - uint32 start_mpls_label = 7; - uint32 end_mpls_label = 8; -} - -message AclAction { - AclForwardActionEnum forward_action = 1; - AclLogActionEnum log_action = 2; -} - -message AclEntry { - uint32 sequence_id = 1; - string description = 2; - AclMatch match = 3; - AclAction action = 4; -} - -message AclRuleSet { - string name = 1; - AclRuleTypeEnum type = 2; - string description = 3; - string user_id = 4; - repeated AclEntry entries = 5; -} diff --git a/src/policy/src/main/proto/acl.proto b/src/policy/src/main/proto/acl.proto new file mode 120000 index 0000000000000000000000000000000000000000..158ae78eb5bdea534ba7008114c2b97ed6dffed8 --- /dev/null +++ b/src/policy/src/main/proto/acl.proto @@ -0,0 +1 @@ +../../../../../proto/acl.proto \ No newline at end of file diff --git a/src/policy/src/main/proto/context.proto b/src/policy/src/main/proto/context.proto deleted file mode 100644 index fce1e71ad4cc8ee0146e2e8d4a79ae4677ecd37e..0000000000000000000000000000000000000000 --- a/src/policy/src/main/proto/context.proto +++ /dev/null @@ -1,615 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package context; - -import "acl.proto"; -import "kpi_sample_types.proto"; - -service ContextService { - rpc ListContextIds (Empty ) returns ( ContextIdList ) {} - rpc ListContexts (Empty ) returns ( ContextList ) {} - rpc GetContext (ContextId ) returns ( Context ) {} - rpc SetContext (Context ) returns ( ContextId ) {} - rpc RemoveContext (ContextId ) returns ( Empty ) {} - rpc GetContextEvents (Empty ) returns (stream ContextEvent ) {} - - rpc ListTopologyIds (ContextId ) returns ( TopologyIdList ) {} - rpc ListTopologies (ContextId ) returns ( TopologyList ) {} - rpc GetTopology (TopologyId ) returns ( Topology ) {} - rpc GetTopologyDetails (TopologyId ) returns ( TopologyDetails ) {} - rpc SetTopology (Topology ) returns ( TopologyId ) {} - rpc RemoveTopology (TopologyId ) returns ( Empty ) {} - rpc GetTopologyEvents (Empty ) returns (stream TopologyEvent ) {} - - rpc ListDeviceIds (Empty ) returns ( DeviceIdList ) {} - rpc ListDevices (Empty ) returns ( DeviceList ) {} - rpc GetDevice (DeviceId ) returns ( Device ) {} - rpc SetDevice (Device ) returns ( DeviceId ) {} - rpc RemoveDevice (DeviceId ) returns ( Empty ) {} - rpc GetDeviceEvents (Empty ) returns (stream DeviceEvent ) {} - rpc SelectDevice (DeviceFilter ) returns ( DeviceList ) {} - rpc ListEndPointNames (EndPointIdList) returns ( EndPointNameList) {} - - rpc ListLinkIds (Empty ) returns ( LinkIdList ) {} - rpc ListLinks (Empty ) returns ( LinkList ) {} - rpc GetLink (LinkId ) returns ( Link ) {} - rpc SetLink (Link ) returns ( LinkId ) {} - rpc RemoveLink (LinkId ) returns ( Empty ) {} - rpc GetLinkEvents (Empty ) returns (stream LinkEvent ) {} - - rpc ListServiceIds (ContextId ) returns ( ServiceIdList ) {} - rpc ListServices (ContextId ) returns ( ServiceList ) {} - rpc GetService (ServiceId ) returns ( Service ) {} - rpc SetService (Service ) returns ( ServiceId ) {} - rpc UnsetService (Service ) returns ( ServiceId ) {} - rpc RemoveService (ServiceId ) returns ( Empty ) {} - rpc GetServiceEvents (Empty ) returns (stream ServiceEvent ) {} - rpc SelectService (ServiceFilter ) returns ( ServiceList ) {} - - rpc ListSliceIds (ContextId ) returns ( SliceIdList ) {} - rpc ListSlices (ContextId ) returns ( SliceList ) {} - rpc GetSlice (SliceId ) returns ( Slice ) {} - rpc SetSlice (Slice ) returns ( SliceId ) {} - rpc UnsetSlice (Slice ) returns ( SliceId ) {} - rpc RemoveSlice (SliceId ) returns ( Empty ) {} - rpc GetSliceEvents (Empty ) returns (stream SliceEvent ) {} - rpc SelectSlice (SliceFilter ) returns ( SliceList ) {} - - rpc ListConnectionIds (ServiceId ) returns ( ConnectionIdList) {} - rpc ListConnections (ServiceId ) returns ( ConnectionList ) {} - rpc GetConnection (ConnectionId ) returns ( Connection ) {} - rpc SetConnection (Connection ) returns ( ConnectionId ) {} - rpc RemoveConnection (ConnectionId ) returns ( Empty ) {} - rpc GetConnectionEvents(Empty ) returns (stream ConnectionEvent ) {} -} - -// ----- Generic ------------------------------------------------------------------------------------------------------- -message Empty {} - -message Uuid { - string uuid = 1; -} - -enum EventTypeEnum { - EVENTTYPE_UNDEFINED = 0; - EVENTTYPE_CREATE = 1; - EVENTTYPE_UPDATE = 2; - EVENTTYPE_REMOVE = 3; -} - -message Timestamp { - double timestamp = 1; -} - -message Event { - Timestamp timestamp = 1; - EventTypeEnum event_type = 2; -} - -// ----- Context ------------------------------------------------------------------------------------------------------- -message ContextId { - Uuid context_uuid = 1; -} - -message Context { - ContextId context_id = 1; - string name = 2; - repeated TopologyId topology_ids = 3; - repeated ServiceId service_ids = 4; - repeated SliceId slice_ids = 5; - TeraFlowController controller = 6; -} - -message ContextIdList { - repeated ContextId context_ids = 1; -} - -message ContextList { - repeated Context contexts = 1; -} - -message ContextEvent { - Event event = 1; - ContextId context_id = 2; -} - - -// ----- Topology ------------------------------------------------------------------------------------------------------ -message TopologyId { - ContextId context_id = 1; - Uuid topology_uuid = 2; -} - -message Topology { - TopologyId topology_id = 1; - string name = 2; - repeated DeviceId device_ids = 3; - repeated LinkId link_ids = 4; -} - -message TopologyDetails { - TopologyId topology_id = 1; - string name = 2; - repeated Device devices = 3; - repeated Link links = 4; -} - -message TopologyIdList { - repeated TopologyId topology_ids = 1; -} - -message TopologyList { - repeated Topology topologies = 1; -} - -message TopologyEvent { - Event event = 1; - TopologyId topology_id = 2; -} - - -// ----- Device -------------------------------------------------------------------------------------------------------- -message DeviceId { - Uuid device_uuid = 1; -} - -message Device { - DeviceId device_id = 1; - string name = 2; - string device_type = 3; - DeviceConfig device_config = 4; - DeviceOperationalStatusEnum device_operational_status = 5; - repeated DeviceDriverEnum device_drivers = 6; - repeated EndPoint device_endpoints = 7; - repeated Component components = 8; // Used for inventory - DeviceId controller_id = 9; // Identifier of node controlling the actual device -} - -message Component { //Defined previously to this section - Tested OK - Uuid component_uuid = 1; - string name = 2; - string type = 3; - - map<string, string> attributes = 4; // dict[attr.name => json.dumps(attr.value)] - string parent = 5; -} - -message DeviceConfig { - repeated ConfigRule config_rules = 1; -} - -enum DeviceDriverEnum { - DEVICEDRIVER_UNDEFINED = 0; // also used for emulated - DEVICEDRIVER_OPENCONFIG = 1; - DEVICEDRIVER_TRANSPORT_API = 2; - DEVICEDRIVER_P4 = 3; - DEVICEDRIVER_IETF_NETWORK_TOPOLOGY = 4; - DEVICEDRIVER_ONF_TR_532 = 5; - DEVICEDRIVER_XR = 6; - DEVICEDRIVER_IETF_L2VPN = 7; - DEVICEDRIVER_GNMI_OPENCONFIG = 8; - DEVICEDRIVER_FLEXSCALE = 9; - DEVICEDRIVER_IETF_ACTN = 10; - DEVICEDRIVER_SMARTNIC = 11; -} - -enum DeviceOperationalStatusEnum { - DEVICEOPERATIONALSTATUS_UNDEFINED = 0; - DEVICEOPERATIONALSTATUS_DISABLED = 1; - DEVICEOPERATIONALSTATUS_ENABLED = 2; -} - -message DeviceIdList { - repeated DeviceId device_ids = 1; -} - -message DeviceList { - repeated Device devices = 1; -} - -message DeviceFilter { - DeviceIdList device_ids = 1; - bool include_endpoints = 2; - bool include_config_rules = 3; - bool include_components = 4; -} - -message DeviceEvent { - Event event = 1; - DeviceId device_id = 2; - DeviceConfig device_config = 3; -} - - -// ----- Link ---------------------------------------------------------------------------------------------------------- -message LinkId { - Uuid link_uuid = 1; -} - -message LinkAttributes { - float total_capacity_gbps = 1; - float used_capacity_gbps = 2; -} - -message Link { - LinkId link_id = 1; - string name = 2; - repeated EndPointId link_endpoint_ids = 3; - LinkAttributes attributes = 4; -} - -message LinkIdList { - repeated LinkId link_ids = 1; -} - -message LinkList { - repeated Link links = 1; -} - -message LinkEvent { - Event event = 1; - LinkId link_id = 2; -} - - -// ----- Service ------------------------------------------------------------------------------------------------------- -message ServiceId { - ContextId context_id = 1; - Uuid service_uuid = 2; -} - -message Service { - ServiceId service_id = 1; - string name = 2; - ServiceTypeEnum service_type = 3; - repeated EndPointId service_endpoint_ids = 4; - repeated Constraint service_constraints = 5; - ServiceStatus service_status = 6; - ServiceConfig service_config = 7; - Timestamp timestamp = 8; -} - -enum ServiceTypeEnum { - SERVICETYPE_UNKNOWN = 0; - SERVICETYPE_L3NM = 1; - SERVICETYPE_L2NM = 2; - SERVICETYPE_TAPI_CONNECTIVITY_SERVICE = 3; - SERVICETYPE_TE = 4; - SERVICETYPE_E2E = 5; -} - -enum ServiceStatusEnum { - SERVICESTATUS_UNDEFINED = 0; - SERVICESTATUS_PLANNED = 1; - SERVICESTATUS_ACTIVE = 2; - SERVICESTATUS_UPDATING = 3; - SERVICESTATUS_PENDING_REMOVAL = 4; - SERVICESTATUS_SLA_VIOLATED = 5; -} - -message ServiceStatus { - ServiceStatusEnum service_status = 1; -} - -message ServiceConfig { - repeated ConfigRule config_rules = 1; -} - -message ServiceIdList { - repeated ServiceId service_ids = 1; -} - -message ServiceList { - repeated Service services = 1; -} - -message ServiceFilter { - ServiceIdList service_ids = 1; - bool include_endpoint_ids = 2; - bool include_constraints = 3; - bool include_config_rules = 4; -} - -message ServiceEvent { - Event event = 1; - ServiceId service_id = 2; -} - -// ----- Slice --------------------------------------------------------------------------------------------------------- -message SliceId { - ContextId context_id = 1; - Uuid slice_uuid = 2; -} - -message Slice { - SliceId slice_id = 1; - string name = 2; - repeated EndPointId slice_endpoint_ids = 3; - repeated Constraint slice_constraints = 4; - repeated ServiceId slice_service_ids = 5; - repeated SliceId slice_subslice_ids = 6; - SliceStatus slice_status = 7; - SliceConfig slice_config = 8; - SliceOwner slice_owner = 9; - Timestamp timestamp = 10; -} - -message SliceOwner { - Uuid owner_uuid = 1; - string owner_string = 2; -} - -enum SliceStatusEnum { - SLICESTATUS_UNDEFINED = 0; - SLICESTATUS_PLANNED = 1; - SLICESTATUS_INIT = 2; - SLICESTATUS_ACTIVE = 3; - SLICESTATUS_DEINIT = 4; - SLICESTATUS_SLA_VIOLATED = 5; -} - -message SliceStatus { - SliceStatusEnum slice_status = 1; -} - -message SliceConfig { - repeated ConfigRule config_rules = 1; -} - -message SliceIdList { - repeated SliceId slice_ids = 1; -} - -message SliceList { - repeated Slice slices = 1; -} - -message SliceFilter { - SliceIdList slice_ids = 1; - bool include_endpoint_ids = 2; - bool include_constraints = 3; - bool include_service_ids = 4; - bool include_subslice_ids = 5; - bool include_config_rules = 6; -} - -message SliceEvent { - Event event = 1; - SliceId slice_id = 2; -} - -// ----- Connection ---------------------------------------------------------------------------------------------------- -message ConnectionId { - Uuid connection_uuid = 1; -} - -message ConnectionSettings_L0 { - string lsp_symbolic_name = 1; -} - -message ConnectionSettings_L2 { - string src_mac_address = 1; - string dst_mac_address = 2; - uint32 ether_type = 3; - uint32 vlan_id = 4; - uint32 mpls_label = 5; - uint32 mpls_traffic_class = 6; -} - -message ConnectionSettings_L3 { - string src_ip_address = 1; - string dst_ip_address = 2; - uint32 dscp = 3; - uint32 protocol = 4; - uint32 ttl = 5; -} - -message ConnectionSettings_L4 { - uint32 src_port = 1; - uint32 dst_port = 2; - uint32 tcp_flags = 3; - uint32 ttl = 4; -} - -message ConnectionSettings { - ConnectionSettings_L0 l0 = 1; - ConnectionSettings_L2 l2 = 2; - ConnectionSettings_L3 l3 = 3; - ConnectionSettings_L4 l4 = 4; -} - -message Connection { - ConnectionId connection_id = 1; - ServiceId service_id = 2; - repeated EndPointId path_hops_endpoint_ids = 3; - repeated ServiceId sub_service_ids = 4; - ConnectionSettings settings = 5; -} - -message ConnectionIdList { - repeated ConnectionId connection_ids = 1; -} - -message ConnectionList { - repeated Connection connections = 1; -} - -message ConnectionEvent { - Event event = 1; - ConnectionId connection_id = 2; -} - - -// ----- Endpoint ------------------------------------------------------------------------------------------------------ -message EndPointId { - TopologyId topology_id = 1; - DeviceId device_id = 2; - Uuid endpoint_uuid = 3; -} - -message EndPoint { - EndPointId endpoint_id = 1; - string name = 2; - string endpoint_type = 3; - repeated kpi_sample_types.KpiSampleType kpi_sample_types = 4; - Location endpoint_location = 5; -} - -message EndPointName { - EndPointId endpoint_id = 1; - string device_name = 2; - string endpoint_name = 3; - string endpoint_type = 4; -} - -message EndPointIdList { - repeated EndPointId endpoint_ids = 1; -} - -message EndPointNameList { - repeated EndPointName endpoint_names = 1; -} - - -// ----- Configuration ------------------------------------------------------------------------------------------------- -enum ConfigActionEnum { - CONFIGACTION_UNDEFINED = 0; - CONFIGACTION_SET = 1; - CONFIGACTION_DELETE = 2; -} - -message ConfigRule_Custom { - string resource_key = 1; - string resource_value = 2; -} - -message ConfigRule_ACL { - EndPointId endpoint_id = 1; - acl.AclRuleSet rule_set = 2; -} - -message ConfigRule { - ConfigActionEnum action = 1; - oneof config_rule { - ConfigRule_Custom custom = 2; - ConfigRule_ACL acl = 3; - } -} - - -// ----- Constraint ---------------------------------------------------------------------------------------------------- -enum ConstraintActionEnum { - CONSTRAINTACTION_UNDEFINED = 0; - CONSTRAINTACTION_SET = 1; - CONSTRAINTACTION_DELETE = 2; -} - -message Constraint_Custom { - string constraint_type = 1; - string constraint_value = 2; -} - -message Constraint_Schedule { - float start_timestamp = 1; - float duration_days = 2; -} - -message GPS_Position { - float latitude = 1; - float longitude = 2; -} - -message Location { - oneof location { - string region = 1; - GPS_Position gps_position = 2; - } -} - -message Constraint_EndPointLocation { - EndPointId endpoint_id = 1; - Location location = 2; -} - -message Constraint_EndPointPriority { - EndPointId endpoint_id = 1; - uint32 priority = 2; -} - -message Constraint_SLA_Latency { - float e2e_latency_ms = 1; -} - -message Constraint_SLA_Capacity { - float capacity_gbps = 1; -} - -message Constraint_SLA_Availability { - uint32 num_disjoint_paths = 1; - bool all_active = 2; - float availability = 3; // 0.0 .. 100.0 percentage of availability -} - -enum IsolationLevelEnum { - NO_ISOLATION = 0; - PHYSICAL_ISOLATION = 1; - LOGICAL_ISOLATION = 2; - PROCESS_ISOLATION = 3; - PHYSICAL_MEMORY_ISOLATION = 4; - PHYSICAL_NETWORK_ISOLATION = 5; - VIRTUAL_RESOURCE_ISOLATION = 6; - NETWORK_FUNCTIONS_ISOLATION = 7; - SERVICE_ISOLATION = 8; -} - -message Constraint_SLA_Isolation_level { - repeated IsolationLevelEnum isolation_level = 1; -} - -message Constraint_Exclusions { - bool is_permanent = 1; - repeated DeviceId device_ids = 2; - repeated EndPointId endpoint_ids = 3; - repeated LinkId link_ids = 4; -} - -message Constraint { - ConstraintActionEnum action = 1; - oneof constraint { - Constraint_Custom custom = 2; - Constraint_Schedule schedule = 3; - Constraint_EndPointLocation endpoint_location = 4; - Constraint_EndPointPriority endpoint_priority = 5; - Constraint_SLA_Capacity sla_capacity = 6; - Constraint_SLA_Latency sla_latency = 7; - Constraint_SLA_Availability sla_availability = 8; - Constraint_SLA_Isolation_level sla_isolation = 9; - Constraint_Exclusions exclusions = 10; - } -} - - -// ----- Miscellaneous ------------------------------------------------------------------------------------------------- -message TeraFlowController { - ContextId context_id = 1; - string ip_address = 2; - uint32 port = 3; -} - -message AuthenticationResult { - ContextId context_id = 1; - bool authenticated = 2; -} diff --git a/src/policy/src/main/proto/context.proto b/src/policy/src/main/proto/context.proto new file mode 120000 index 0000000000000000000000000000000000000000..7f33c4bc783bd20d031d94ab3b2e94f0d76ecd95 --- /dev/null +++ b/src/policy/src/main/proto/context.proto @@ -0,0 +1 @@ +../../../../../proto/context.proto \ No newline at end of file diff --git a/src/policy/src/main/proto/context_policy.proto b/src/policy/src/main/proto/context_policy.proto deleted file mode 100644 index f6dae48306e2ef7fe8a0682185ec46e1f2ad637e..0000000000000000000000000000000000000000 --- a/src/policy/src/main/proto/context_policy.proto +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package context_policy; - -import "context.proto"; -import "policy.proto"; - -// created as a separate service to prevent import-loops in context and policy -service ContextPolicyService { - rpc ListPolicyRuleIds(context.Empty ) returns (policy.PolicyRuleIdList) {} - rpc ListPolicyRules (context.Empty ) returns (policy.PolicyRuleList ) {} - rpc GetPolicyRule (policy.PolicyRuleId ) returns (policy.PolicyRule ) {} - rpc SetPolicyRule (policy.PolicyRule ) returns (policy.PolicyRuleId ) {} - rpc RemovePolicyRule (policy.PolicyRuleId ) returns (context.Empty ) {} -} diff --git a/src/policy/src/main/proto/context_policy.proto b/src/policy/src/main/proto/context_policy.proto new file mode 120000 index 0000000000000000000000000000000000000000..d41593ddeb8b8b89878587e4fb389c94394ab340 --- /dev/null +++ b/src/policy/src/main/proto/context_policy.proto @@ -0,0 +1 @@ +../../../../../proto/context_policy.proto \ No newline at end of file diff --git a/src/policy/src/main/proto/device.proto b/src/policy/src/main/proto/device.proto deleted file mode 100644 index 30e60079db6c1eb8641d10115f6f43840eabf39c..0000000000000000000000000000000000000000 --- a/src/policy/src/main/proto/device.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package device; - -import "context.proto"; -import "monitoring.proto"; - -service DeviceService { - rpc AddDevice (context.Device ) returns (context.DeviceId ) {} - rpc ConfigureDevice (context.Device ) returns (context.DeviceId ) {} - rpc DeleteDevice (context.DeviceId ) returns (context.Empty ) {} - rpc GetInitialConfig(context.DeviceId ) returns (context.DeviceConfig) {} - rpc MonitorDeviceKpi(MonitoringSettings) returns (context.Empty ) {} -} - -message MonitoringSettings { - monitoring.KpiId kpi_id = 1; - monitoring.KpiDescriptor kpi_descriptor = 2; - float sampling_duration_s = 3; - float sampling_interval_s = 4; -} diff --git a/src/policy/src/main/proto/device.proto b/src/policy/src/main/proto/device.proto new file mode 120000 index 0000000000000000000000000000000000000000..ad6e7c47eb9fb50c5cc8a7b3562caaf933ba0469 --- /dev/null +++ b/src/policy/src/main/proto/device.proto @@ -0,0 +1 @@ +../../../../../proto/device.proto \ No newline at end of file diff --git a/src/policy/src/main/proto/kpi_sample_types.proto b/src/policy/src/main/proto/kpi_sample_types.proto deleted file mode 100644 index 5b234a4e35197557f41770984f7c8f6603672411..0000000000000000000000000000000000000000 --- a/src/policy/src/main/proto/kpi_sample_types.proto +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package kpi_sample_types; - -enum KpiSampleType { - KPISAMPLETYPE_UNKNOWN = 0; - - KPISAMPLETYPE_PACKETS_TRANSMITTED = 101; - KPISAMPLETYPE_PACKETS_RECEIVED = 102; - KPISAMPLETYPE_PACKETS_DROPPED = 103; - KPISAMPLETYPE_BYTES_TRANSMITTED = 201; - KPISAMPLETYPE_BYTES_RECEIVED = 202; - KPISAMPLETYPE_BYTES_DROPPED = 203; - - KPISAMPLETYPE_LINK_TOTAL_CAPACITY_GBPS = 301; - KPISAMPLETYPE_LINK_USED_CAPACITY_GBPS = 302; - - KPISAMPLETYPE_ML_CONFIDENCE = 401; //. can be used by both optical and L3 without any issue - - KPISAMPLETYPE_OPTICAL_SECURITY_STATUS = 501; //. can be used by both optical and L3 without any issue - - KPISAMPLETYPE_L3_UNIQUE_ATTACK_CONNS = 601; - KPISAMPLETYPE_L3_TOTAL_DROPPED_PACKTS = 602; - KPISAMPLETYPE_L3_UNIQUE_ATTACKERS = 603; - KPISAMPLETYPE_L3_UNIQUE_COMPROMISED_CLIENTS = 604; - KPISAMPLETYPE_L3_SECURITY_STATUS_CRYPTO = 605; - - KPISAMPLETYPE_SERVICE_LATENCY_MS = 701; -} diff --git a/src/policy/src/main/proto/kpi_sample_types.proto b/src/policy/src/main/proto/kpi_sample_types.proto new file mode 120000 index 0000000000000000000000000000000000000000..98e748bbf4fbadbc04c3657f458d733f1bc7bdb8 --- /dev/null +++ b/src/policy/src/main/proto/kpi_sample_types.proto @@ -0,0 +1 @@ +../../../../../proto/kpi_sample_types.proto \ No newline at end of file diff --git a/src/policy/src/main/proto/monitoring.proto b/src/policy/src/main/proto/monitoring.proto deleted file mode 100644 index 45ba48b0271c6e8890d7125ff44f62d2b6da6b58..0000000000000000000000000000000000000000 --- a/src/policy/src/main/proto/monitoring.proto +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package monitoring; - -import "context.proto"; -import "kpi_sample_types.proto"; - -service MonitoringService { - rpc SetKpi (KpiDescriptor ) returns (KpiId ) {} // Stable not final - rpc DeleteKpi (KpiId ) returns (context.Empty ) {} // Stable and final - rpc GetKpiDescriptor (KpiId ) returns (KpiDescriptor ) {} // Stable and final - rpc GetKpiDescriptorList (context.Empty ) returns (KpiDescriptorList ) {} // Stable and final - rpc IncludeKpi (Kpi ) returns (context.Empty ) {} // Stable and final - rpc MonitorKpi (MonitorKpiRequest ) returns (context.Empty ) {} // Stable and final - rpc QueryKpiData (KpiQuery ) returns (RawKpiTable ) {} // Not implemented - rpc SetKpiSubscription (SubsDescriptor ) returns (stream SubsResponse ) {} // Stable not final - rpc GetSubsDescriptor (SubscriptionID ) returns (SubsDescriptor ) {} // Stable and final - rpc GetSubscriptions (context.Empty ) returns (SubsList ) {} // Stable and final - rpc DeleteSubscription (SubscriptionID ) returns (context.Empty ) {} // Stable and final - rpc SetKpiAlarm (AlarmDescriptor ) returns (AlarmID ) {} // Stable not final - rpc GetAlarms (context.Empty ) returns (AlarmList ) {} // Stable and final - rpc GetAlarmDescriptor (AlarmID ) returns (AlarmDescriptor ) {} // Stable and final - rpc GetAlarmResponseStream(AlarmSubscription ) returns (stream AlarmResponse) {} // Not Stable not final - rpc DeleteAlarm (AlarmID ) returns (context.Empty ) {} // Stable and final - rpc GetStreamKpi (KpiId ) returns (stream Kpi ) {} // Stable not final - rpc GetInstantKpi (KpiId ) returns (Kpi ) {} // Stable not final -} - -message KpiDescriptor { - KpiId kpi_id = 1; - string kpi_description = 2; - repeated KpiId kpi_id_list = 3; - kpi_sample_types.KpiSampleType kpi_sample_type = 4; - context.DeviceId device_id = 5; - context.EndPointId endpoint_id = 6; - context.ServiceId service_id = 7; - context.SliceId slice_id = 8; - context.ConnectionId connection_id = 9; - context.LinkId link_id = 10; -} - -message MonitorKpiRequest { - KpiId kpi_id = 1; - float monitoring_window_s = 2; - float sampling_rate_s = 3; - // Pending add field to reflect Available Device Protocols -} - -message KpiQuery { - repeated KpiId kpi_ids = 1; - float monitoring_window_s = 2; - uint32 last_n_samples = 3; // used when you want something like "get the last N many samples - context.Timestamp start_timestamp = 4; // used when you want something like "get the samples since X date/time" - context.Timestamp end_timestamp = 5; // used when you want something like "get the samples until X date/time" -} - - -message RawKpi { // cell - context.Timestamp timestamp = 1; - KpiValue kpi_value = 2; -} - -message RawKpiList { // column - KpiId kpi_id = 1; - repeated RawKpi raw_kpis = 2; -} - -message RawKpiTable { // table - repeated RawKpiList raw_kpi_lists = 1; -} - -message KpiId { - context.Uuid kpi_id = 1; -} - -message Kpi { - KpiId kpi_id = 1; - context.Timestamp timestamp = 2; - KpiValue kpi_value = 3; -} - -message KpiValueRange { - KpiValue kpiMinValue = 1; - KpiValue kpiMaxValue = 2; - bool inRange = 3; // by default True - bool includeMinValue = 4; // False is outside the interval - bool includeMaxValue = 5; // False is outside the interval -} - -message KpiValue { - oneof value { - int32 int32Val = 1; - uint32 uint32Val = 2; - int64 int64Val = 3; - uint64 uint64Val = 4; - float floatVal = 5; - string stringVal = 6; - bool boolVal = 7; - } -} - - -message KpiList { - repeated Kpi kpi = 1; -} - -message KpiDescriptorList { - repeated KpiDescriptor kpi_descriptor_list = 1; -} - -message SubsDescriptor{ - SubscriptionID subs_id = 1; - KpiId kpi_id = 2; - float sampling_duration_s = 3; - float sampling_interval_s = 4; - context.Timestamp start_timestamp = 5; // used when you want something like "get the samples since X date/time" - context.Timestamp end_timestamp = 6; // used when you want something like "get the samples until X date/time" - // Pending add field to reflect Available Device Protocols -} - -message SubscriptionID { - context.Uuid subs_id = 1; -} - -message SubsResponse { - SubscriptionID subs_id = 1; - KpiList kpi_list = 2; -} - -message SubsList { - repeated SubsDescriptor subs_descriptor = 1; -} - -message AlarmDescriptor { - AlarmID alarm_id = 1; - string alarm_description = 2; - string name = 3; - KpiId kpi_id = 4; - KpiValueRange kpi_value_range = 5; - context.Timestamp timestamp = 6; -} - -message AlarmID{ - context.Uuid alarm_id = 1; -} - -message AlarmSubscription{ - AlarmID alarm_id = 1; - float subscription_timeout_s = 2; - float subscription_frequency_ms = 3; -} - -message AlarmResponse { - AlarmID alarm_id = 1; - string text = 2; - KpiList kpi_list = 3; -} - -message AlarmList { - repeated AlarmDescriptor alarm_descriptor = 1; -} diff --git a/src/policy/src/main/proto/monitoring.proto b/src/policy/src/main/proto/monitoring.proto new file mode 120000 index 0000000000000000000000000000000000000000..aceaa7328099fe736163be048ee1ad21a61d79a2 --- /dev/null +++ b/src/policy/src/main/proto/monitoring.proto @@ -0,0 +1 @@ +../../../../../proto/monitoring.proto \ No newline at end of file diff --git a/src/policy/src/main/proto/policy.proto b/src/policy/src/main/proto/policy.proto deleted file mode 100644 index a6f16015035096c6baf13a7b4e707c06e9ab1727..0000000000000000000000000000000000000000 --- a/src/policy/src/main/proto/policy.proto +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package policy; - -import "context.proto"; -import "policy_condition.proto"; -import "policy_action.proto"; - -service PolicyService { - rpc PolicyAddService (PolicyRuleService) returns (PolicyRuleState) {} - rpc PolicyAddDevice (PolicyRuleDevice) returns (PolicyRuleState) {} - rpc PolicyUpdateService (PolicyRuleService) returns (PolicyRuleState) {} - rpc PolicyUpdateDevice (PolicyRuleDevice) returns (PolicyRuleState) {} - rpc PolicyDelete (PolicyRuleId) returns (PolicyRuleState) {} - rpc GetPolicyService (PolicyRuleId) returns (PolicyRuleService) {} - rpc GetPolicyDevice (PolicyRuleId) returns (PolicyRuleDevice) {} - rpc GetPolicyByServiceId (context.ServiceId) returns (PolicyRuleServiceList) {} -} - -enum PolicyRuleStateEnum { - POLICY_UNDEFINED = 0; // Undefined rule state - POLICY_FAILED = 1; // Rule failed - POLICY_INSERTED = 2; // Rule is just inserted - POLICY_VALIDATED = 3; // Rule content is correct - POLICY_PROVISIONED = 4; // Rule subscribed to Monitoring - POLICY_ACTIVE = 5; // Rule is currently active (alarm is just thrown by Monitoring) - POLICY_ENFORCED = 6; // Rule action is successfully enforced - POLICY_INEFFECTIVE = 7; // The applied rule action did not work as expected - POLICY_EFFECTIVE = 8; // The applied rule action did work as expected - POLICY_UPDATED = 9; // Operator requires a policy to change - POLICY_REMOVED = 10; // Operator requires to remove a policy -} - -message PolicyRuleId { - context.Uuid uuid = 1; -} - -message PolicyRuleState { - PolicyRuleStateEnum policyRuleState = 1; - string policyRuleStateMessage = 2; -} - -// Basic policy rule attributes -message PolicyRuleBasic { - PolicyRuleId policyRuleId = 1; - PolicyRuleState policyRuleState = 2; //policy.proto:58:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default. - uint32 priority = 3; - - // Event-Condition-Action (ECA) model - repeated PolicyRuleCondition conditionList = 4; // When these policy conditions are met, an event is automatically thrown - BooleanOperator booleanOperator = 5; // Evaluation operator to be used - repeated PolicyRuleAction actionList = 6; // One or more actions should be applied -} - -// Service-oriented policy rule -message PolicyRuleService { - // Basic policy rule attributes - PolicyRuleBasic policyRuleBasic = 1; - - // Affected service and (some of) its device(s) - context.ServiceId serviceId = 2; - repeated context.DeviceId deviceList = 3; // List of devices this service is traversing (not exhaustive) -} - -// Device-oriented policy rule -message PolicyRuleDevice { - // Basic policy rule attributes - PolicyRuleBasic policyRuleBasic = 1; - - // Affected device(s) - repeated context.DeviceId deviceList = 2; -} - -// Wrapper policy rule object -message PolicyRule { - oneof policy_rule { - PolicyRuleService service = 1; - PolicyRuleDevice device = 2; - } -} - -// A list of policy rule IDs -message PolicyRuleIdList { - repeated PolicyRuleId policyRuleIdList = 1; -} - -// A list of service-oriented policy rules -message PolicyRuleServiceList { - repeated PolicyRuleService policyRuleServiceList = 1; -} - -// A list of device-oriented policy rules -message PolicyRuleDeviceList { - repeated PolicyRuleDevice policyRuleDeviceList = 1; -} - -// A list of policy rules -message PolicyRuleList { - repeated PolicyRule policyRules = 1; -} diff --git a/src/policy/src/main/proto/policy.proto b/src/policy/src/main/proto/policy.proto new file mode 120000 index 0000000000000000000000000000000000000000..df455f9611632300f34c690b7b3ddcc1f97d10ec --- /dev/null +++ b/src/policy/src/main/proto/policy.proto @@ -0,0 +1 @@ +../../../../../proto/policy.proto \ No newline at end of file diff --git a/src/policy/src/main/proto/policy_action.proto b/src/policy/src/main/proto/policy_action.proto deleted file mode 100644 index d547e97790cf2cafe2e4cb9ec8c8b06d8a2e0404..0000000000000000000000000000000000000000 --- a/src/policy/src/main/proto/policy_action.proto +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package policy; - -// Action -message PolicyRuleAction { - PolicyRuleActionEnum action = 1; - repeated PolicyRuleActionConfig action_config = 2; -} - -enum PolicyRuleActionEnum { - POLICYRULE_ACTION_NO_ACTION = 0; - POLICYRULE_ACTION_SET_DEVICE_STATUS = 1; - POLICYRULE_ACTION_ADD_SERVICE_CONFIGRULE = 2; - POLICYRULE_ACTION_ADD_SERVICE_CONSTRAINT = 3; - POLICY_RULE_ACTION_CALL_SERVICE_RPC = 4; - POLICY_RULE_ACTION_RECALCULATE_PATH = 5; -} - -// Action configuration -message PolicyRuleActionConfig { - string action_key = 1; - string action_value = 2; -} - -// message PolicyRuleAction { -// PolicyRuleActionEnum action = 1; -// repeated string parameters = 2; -// } diff --git a/src/policy/src/main/proto/policy_action.proto b/src/policy/src/main/proto/policy_action.proto new file mode 120000 index 0000000000000000000000000000000000000000..63dcef3d2c6753f9b732dc7491baa5f449e55eff --- /dev/null +++ b/src/policy/src/main/proto/policy_action.proto @@ -0,0 +1 @@ +../../../../../proto/policy_action.proto \ No newline at end of file diff --git a/src/policy/src/main/proto/policy_condition.proto b/src/policy/src/main/proto/policy_condition.proto deleted file mode 100644 index 2037af93c375838209e78a07ec95e25d469d1d5a..0000000000000000000000000000000000000000 --- a/src/policy/src/main/proto/policy_condition.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package policy; - -import "monitoring.proto"; - -// Condition -message PolicyRuleCondition { - monitoring.KpiId kpiId = 1; - NumericalOperator numericalOperator = 2; - monitoring.KpiValue kpiValue = 3; -} - -// Operator to be used when comparing Kpis with condition values -enum NumericalOperator { - POLICYRULE_CONDITION_NUMERICAL_UNDEFINED = 0; // Kpi numerical operator undefined - POLICYRULE_CONDITION_NUMERICAL_EQUAL = 1; // Kpi is equal with value - POLICYRULE_CONDITION_NUMERICAL_NOT_EQUAL = 2; // Kpi is not equal with value - POLICYRULE_CONDITION_NUMERICAL_LESS_THAN = 3; // Kpi is less than value - POLICYRULE_CONDITION_NUMERICAL_LESS_THAN_EQUAL = 4; // Kpi is less than or equal with value - POLICYRULE_CONDITION_NUMERICAL_GREATER_THAN = 5; // Kpi is greater than value - POLICYRULE_CONDITION_NUMERICAL_GREATER_THAN_EQUAL = 6; // Kpi is less than or equal with value -} - -// Operator to be used when evaluating each condition -enum BooleanOperator { - POLICYRULE_CONDITION_BOOLEAN_UNDEFINED = 0; // Boolean operator undefined - POLICYRULE_CONDITION_BOOLEAN_AND = 1; // Boolean AND operator - POLICYRULE_CONDITION_BOOLEAN_OR = 2; // Boolean OR operator -} \ No newline at end of file diff --git a/src/policy/src/main/proto/policy_condition.proto b/src/policy/src/main/proto/policy_condition.proto new file mode 120000 index 0000000000000000000000000000000000000000..31f7d9d10539de8c0a1bf06cf6393b86ab223c16 --- /dev/null +++ b/src/policy/src/main/proto/policy_condition.proto @@ -0,0 +1 @@ +../../../../../proto/policy_condition.proto \ No newline at end of file diff --git a/src/policy/src/main/proto/service.proto b/src/policy/src/main/proto/service.proto deleted file mode 100644 index 658859e3c5aac58e792d508a89b467e937198c5b..0000000000000000000000000000000000000000 --- a/src/policy/src/main/proto/service.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package service; - -import "context.proto"; - -service ServiceService { - rpc CreateService (context.Service ) returns (context.ServiceId) {} - rpc UpdateService (context.Service ) returns (context.ServiceId) {} - rpc DeleteService (context.ServiceId) returns (context.Empty ) {} - rpc RecomputeConnections(context.Service ) returns (context.Empty ) {} -} diff --git a/src/policy/src/main/proto/service.proto b/src/policy/src/main/proto/service.proto new file mode 120000 index 0000000000000000000000000000000000000000..5ca543da01298ca25912a534f460d4a7183e3a60 --- /dev/null +++ b/src/policy/src/main/proto/service.proto @@ -0,0 +1 @@ +../../../../../proto/service.proto \ No newline at end of file diff --git a/src/ztp/Dockerfile b/src/ztp/Dockerfile deleted file mode 100644 index 43fef96b4f72497c26ae9b3f457791b357249e81..0000000000000000000000000000000000000000 --- a/src/ztp/Dockerfile +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -# Multi-stage Docker image build - -# Stage 1 -FROM maven:3-jdk-11 AS builder - -# Define working directory -WORKDIR /app - -# Copy every file in working directory, as defined in .dockerignore file -COPY ./pom.xml pom.xml -COPY ./src src/ -COPY ./target/generated-sources/ target/generated-sources/ -RUN mvn --errors --batch-mode package -Dmaven.test.skip=true - -# Stage 2 -FROM builder AS unit-test - -RUN mvn --errors --batch-mode -Pgenerate-consolidated-coverage verify - -# Stage 3 -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 AS release - -ARG JAVA_PACKAGE=java-11-openjdk-headless -ARG RUN_JAVA_VERSION=1.3.8 -ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' -# Install java and the run-java script -# Also set up permissions for user `1001` -RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ - && microdnf update \ - && microdnf clean all \ - && mkdir /deployments \ - && chown 1001 /deployments \ - && chmod "g+rwX" /deployments \ - && chown 1001:root /deployments \ - && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ - && chown 1001 /deployments/run-java.sh \ - && chmod 540 /deployments/run-java.sh \ - && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security - -# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. -ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" -# We make four distinct layers so if there are application changes the library layers can be re-used -COPY --from=builder --chown=1001 /app/target/quarkus-app/lib/ /deployments/lib/ -COPY --from=builder --chown=1001 /app/target/quarkus-app/*.jar /deployments/ -COPY --from=builder --chown=1001 /app/target/quarkus-app/app/ /deployments/app/ -COPY --from=builder --chown=1001 /app/target/quarkus-app/quarkus/ /deployments/quarkus/ - -EXPOSE 8080 -EXPOSE 5050 -USER 1001 - -ENTRYPOINT [ "/deployments/run-java.sh" ] - diff --git a/src/ztp/Dockerfile b/src/ztp/Dockerfile new file mode 120000 index 0000000000000000000000000000000000000000..eec732273e12372d1a11fef9d958b124e9d8df1f --- /dev/null +++ b/src/ztp/Dockerfile @@ -0,0 +1 @@ +src/main/docker/Dockerfile.multistage.jvm \ No newline at end of file diff --git a/src/ztp/src/main/proto/acl.proto b/src/ztp/src/main/proto/acl.proto deleted file mode 100644 index 3dba735dccf44d584a998eb02b4835bac7ceddd1..0000000000000000000000000000000000000000 --- a/src/ztp/src/main/proto/acl.proto +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package acl; - -enum AclRuleTypeEnum { - ACLRULETYPE_UNDEFINED = 0; - ACLRULETYPE_IPV4 = 1; - ACLRULETYPE_IPV6 = 2; - ACLRULETYPE_L2 = 3; - ACLRULETYPE_MPLS = 4; - ACLRULETYPE_MIXED = 5; -} - -enum AclForwardActionEnum { - ACLFORWARDINGACTION_UNDEFINED = 0; - ACLFORWARDINGACTION_DROP = 1; - ACLFORWARDINGACTION_ACCEPT = 2; - ACLFORWARDINGACTION_REJECT = 3; -} - -enum AclLogActionEnum { - ACLLOGACTION_UNDEFINED = 0; - ACLLOGACTION_NOLOG = 1; - ACLLOGACTION_SYSLOG = 2; -} - -message AclMatch { - uint32 dscp = 1; - uint32 protocol = 2; - string src_address = 3; - string dst_address = 4; - uint32 src_port = 5; - uint32 dst_port = 6; - uint32 start_mpls_label = 7; - uint32 end_mpls_label = 8; -} - -message AclAction { - AclForwardActionEnum forward_action = 1; - AclLogActionEnum log_action = 2; -} - -message AclEntry { - uint32 sequence_id = 1; - string description = 2; - AclMatch match = 3; - AclAction action = 4; -} - -message AclRuleSet { - string name = 1; - AclRuleTypeEnum type = 2; - string description = 3; - string user_id = 4; - repeated AclEntry entries = 5; -} diff --git a/src/ztp/src/main/proto/acl.proto b/src/ztp/src/main/proto/acl.proto new file mode 120000 index 0000000000000000000000000000000000000000..158ae78eb5bdea534ba7008114c2b97ed6dffed8 --- /dev/null +++ b/src/ztp/src/main/proto/acl.proto @@ -0,0 +1 @@ +../../../../../proto/acl.proto \ No newline at end of file diff --git a/src/ztp/src/main/proto/context.proto b/src/ztp/src/main/proto/context.proto deleted file mode 100644 index fce1e71ad4cc8ee0146e2e8d4a79ae4677ecd37e..0000000000000000000000000000000000000000 --- a/src/ztp/src/main/proto/context.proto +++ /dev/null @@ -1,615 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package context; - -import "acl.proto"; -import "kpi_sample_types.proto"; - -service ContextService { - rpc ListContextIds (Empty ) returns ( ContextIdList ) {} - rpc ListContexts (Empty ) returns ( ContextList ) {} - rpc GetContext (ContextId ) returns ( Context ) {} - rpc SetContext (Context ) returns ( ContextId ) {} - rpc RemoveContext (ContextId ) returns ( Empty ) {} - rpc GetContextEvents (Empty ) returns (stream ContextEvent ) {} - - rpc ListTopologyIds (ContextId ) returns ( TopologyIdList ) {} - rpc ListTopologies (ContextId ) returns ( TopologyList ) {} - rpc GetTopology (TopologyId ) returns ( Topology ) {} - rpc GetTopologyDetails (TopologyId ) returns ( TopologyDetails ) {} - rpc SetTopology (Topology ) returns ( TopologyId ) {} - rpc RemoveTopology (TopologyId ) returns ( Empty ) {} - rpc GetTopologyEvents (Empty ) returns (stream TopologyEvent ) {} - - rpc ListDeviceIds (Empty ) returns ( DeviceIdList ) {} - rpc ListDevices (Empty ) returns ( DeviceList ) {} - rpc GetDevice (DeviceId ) returns ( Device ) {} - rpc SetDevice (Device ) returns ( DeviceId ) {} - rpc RemoveDevice (DeviceId ) returns ( Empty ) {} - rpc GetDeviceEvents (Empty ) returns (stream DeviceEvent ) {} - rpc SelectDevice (DeviceFilter ) returns ( DeviceList ) {} - rpc ListEndPointNames (EndPointIdList) returns ( EndPointNameList) {} - - rpc ListLinkIds (Empty ) returns ( LinkIdList ) {} - rpc ListLinks (Empty ) returns ( LinkList ) {} - rpc GetLink (LinkId ) returns ( Link ) {} - rpc SetLink (Link ) returns ( LinkId ) {} - rpc RemoveLink (LinkId ) returns ( Empty ) {} - rpc GetLinkEvents (Empty ) returns (stream LinkEvent ) {} - - rpc ListServiceIds (ContextId ) returns ( ServiceIdList ) {} - rpc ListServices (ContextId ) returns ( ServiceList ) {} - rpc GetService (ServiceId ) returns ( Service ) {} - rpc SetService (Service ) returns ( ServiceId ) {} - rpc UnsetService (Service ) returns ( ServiceId ) {} - rpc RemoveService (ServiceId ) returns ( Empty ) {} - rpc GetServiceEvents (Empty ) returns (stream ServiceEvent ) {} - rpc SelectService (ServiceFilter ) returns ( ServiceList ) {} - - rpc ListSliceIds (ContextId ) returns ( SliceIdList ) {} - rpc ListSlices (ContextId ) returns ( SliceList ) {} - rpc GetSlice (SliceId ) returns ( Slice ) {} - rpc SetSlice (Slice ) returns ( SliceId ) {} - rpc UnsetSlice (Slice ) returns ( SliceId ) {} - rpc RemoveSlice (SliceId ) returns ( Empty ) {} - rpc GetSliceEvents (Empty ) returns (stream SliceEvent ) {} - rpc SelectSlice (SliceFilter ) returns ( SliceList ) {} - - rpc ListConnectionIds (ServiceId ) returns ( ConnectionIdList) {} - rpc ListConnections (ServiceId ) returns ( ConnectionList ) {} - rpc GetConnection (ConnectionId ) returns ( Connection ) {} - rpc SetConnection (Connection ) returns ( ConnectionId ) {} - rpc RemoveConnection (ConnectionId ) returns ( Empty ) {} - rpc GetConnectionEvents(Empty ) returns (stream ConnectionEvent ) {} -} - -// ----- Generic ------------------------------------------------------------------------------------------------------- -message Empty {} - -message Uuid { - string uuid = 1; -} - -enum EventTypeEnum { - EVENTTYPE_UNDEFINED = 0; - EVENTTYPE_CREATE = 1; - EVENTTYPE_UPDATE = 2; - EVENTTYPE_REMOVE = 3; -} - -message Timestamp { - double timestamp = 1; -} - -message Event { - Timestamp timestamp = 1; - EventTypeEnum event_type = 2; -} - -// ----- Context ------------------------------------------------------------------------------------------------------- -message ContextId { - Uuid context_uuid = 1; -} - -message Context { - ContextId context_id = 1; - string name = 2; - repeated TopologyId topology_ids = 3; - repeated ServiceId service_ids = 4; - repeated SliceId slice_ids = 5; - TeraFlowController controller = 6; -} - -message ContextIdList { - repeated ContextId context_ids = 1; -} - -message ContextList { - repeated Context contexts = 1; -} - -message ContextEvent { - Event event = 1; - ContextId context_id = 2; -} - - -// ----- Topology ------------------------------------------------------------------------------------------------------ -message TopologyId { - ContextId context_id = 1; - Uuid topology_uuid = 2; -} - -message Topology { - TopologyId topology_id = 1; - string name = 2; - repeated DeviceId device_ids = 3; - repeated LinkId link_ids = 4; -} - -message TopologyDetails { - TopologyId topology_id = 1; - string name = 2; - repeated Device devices = 3; - repeated Link links = 4; -} - -message TopologyIdList { - repeated TopologyId topology_ids = 1; -} - -message TopologyList { - repeated Topology topologies = 1; -} - -message TopologyEvent { - Event event = 1; - TopologyId topology_id = 2; -} - - -// ----- Device -------------------------------------------------------------------------------------------------------- -message DeviceId { - Uuid device_uuid = 1; -} - -message Device { - DeviceId device_id = 1; - string name = 2; - string device_type = 3; - DeviceConfig device_config = 4; - DeviceOperationalStatusEnum device_operational_status = 5; - repeated DeviceDriverEnum device_drivers = 6; - repeated EndPoint device_endpoints = 7; - repeated Component components = 8; // Used for inventory - DeviceId controller_id = 9; // Identifier of node controlling the actual device -} - -message Component { //Defined previously to this section - Tested OK - Uuid component_uuid = 1; - string name = 2; - string type = 3; - - map<string, string> attributes = 4; // dict[attr.name => json.dumps(attr.value)] - string parent = 5; -} - -message DeviceConfig { - repeated ConfigRule config_rules = 1; -} - -enum DeviceDriverEnum { - DEVICEDRIVER_UNDEFINED = 0; // also used for emulated - DEVICEDRIVER_OPENCONFIG = 1; - DEVICEDRIVER_TRANSPORT_API = 2; - DEVICEDRIVER_P4 = 3; - DEVICEDRIVER_IETF_NETWORK_TOPOLOGY = 4; - DEVICEDRIVER_ONF_TR_532 = 5; - DEVICEDRIVER_XR = 6; - DEVICEDRIVER_IETF_L2VPN = 7; - DEVICEDRIVER_GNMI_OPENCONFIG = 8; - DEVICEDRIVER_FLEXSCALE = 9; - DEVICEDRIVER_IETF_ACTN = 10; - DEVICEDRIVER_SMARTNIC = 11; -} - -enum DeviceOperationalStatusEnum { - DEVICEOPERATIONALSTATUS_UNDEFINED = 0; - DEVICEOPERATIONALSTATUS_DISABLED = 1; - DEVICEOPERATIONALSTATUS_ENABLED = 2; -} - -message DeviceIdList { - repeated DeviceId device_ids = 1; -} - -message DeviceList { - repeated Device devices = 1; -} - -message DeviceFilter { - DeviceIdList device_ids = 1; - bool include_endpoints = 2; - bool include_config_rules = 3; - bool include_components = 4; -} - -message DeviceEvent { - Event event = 1; - DeviceId device_id = 2; - DeviceConfig device_config = 3; -} - - -// ----- Link ---------------------------------------------------------------------------------------------------------- -message LinkId { - Uuid link_uuid = 1; -} - -message LinkAttributes { - float total_capacity_gbps = 1; - float used_capacity_gbps = 2; -} - -message Link { - LinkId link_id = 1; - string name = 2; - repeated EndPointId link_endpoint_ids = 3; - LinkAttributes attributes = 4; -} - -message LinkIdList { - repeated LinkId link_ids = 1; -} - -message LinkList { - repeated Link links = 1; -} - -message LinkEvent { - Event event = 1; - LinkId link_id = 2; -} - - -// ----- Service ------------------------------------------------------------------------------------------------------- -message ServiceId { - ContextId context_id = 1; - Uuid service_uuid = 2; -} - -message Service { - ServiceId service_id = 1; - string name = 2; - ServiceTypeEnum service_type = 3; - repeated EndPointId service_endpoint_ids = 4; - repeated Constraint service_constraints = 5; - ServiceStatus service_status = 6; - ServiceConfig service_config = 7; - Timestamp timestamp = 8; -} - -enum ServiceTypeEnum { - SERVICETYPE_UNKNOWN = 0; - SERVICETYPE_L3NM = 1; - SERVICETYPE_L2NM = 2; - SERVICETYPE_TAPI_CONNECTIVITY_SERVICE = 3; - SERVICETYPE_TE = 4; - SERVICETYPE_E2E = 5; -} - -enum ServiceStatusEnum { - SERVICESTATUS_UNDEFINED = 0; - SERVICESTATUS_PLANNED = 1; - SERVICESTATUS_ACTIVE = 2; - SERVICESTATUS_UPDATING = 3; - SERVICESTATUS_PENDING_REMOVAL = 4; - SERVICESTATUS_SLA_VIOLATED = 5; -} - -message ServiceStatus { - ServiceStatusEnum service_status = 1; -} - -message ServiceConfig { - repeated ConfigRule config_rules = 1; -} - -message ServiceIdList { - repeated ServiceId service_ids = 1; -} - -message ServiceList { - repeated Service services = 1; -} - -message ServiceFilter { - ServiceIdList service_ids = 1; - bool include_endpoint_ids = 2; - bool include_constraints = 3; - bool include_config_rules = 4; -} - -message ServiceEvent { - Event event = 1; - ServiceId service_id = 2; -} - -// ----- Slice --------------------------------------------------------------------------------------------------------- -message SliceId { - ContextId context_id = 1; - Uuid slice_uuid = 2; -} - -message Slice { - SliceId slice_id = 1; - string name = 2; - repeated EndPointId slice_endpoint_ids = 3; - repeated Constraint slice_constraints = 4; - repeated ServiceId slice_service_ids = 5; - repeated SliceId slice_subslice_ids = 6; - SliceStatus slice_status = 7; - SliceConfig slice_config = 8; - SliceOwner slice_owner = 9; - Timestamp timestamp = 10; -} - -message SliceOwner { - Uuid owner_uuid = 1; - string owner_string = 2; -} - -enum SliceStatusEnum { - SLICESTATUS_UNDEFINED = 0; - SLICESTATUS_PLANNED = 1; - SLICESTATUS_INIT = 2; - SLICESTATUS_ACTIVE = 3; - SLICESTATUS_DEINIT = 4; - SLICESTATUS_SLA_VIOLATED = 5; -} - -message SliceStatus { - SliceStatusEnum slice_status = 1; -} - -message SliceConfig { - repeated ConfigRule config_rules = 1; -} - -message SliceIdList { - repeated SliceId slice_ids = 1; -} - -message SliceList { - repeated Slice slices = 1; -} - -message SliceFilter { - SliceIdList slice_ids = 1; - bool include_endpoint_ids = 2; - bool include_constraints = 3; - bool include_service_ids = 4; - bool include_subslice_ids = 5; - bool include_config_rules = 6; -} - -message SliceEvent { - Event event = 1; - SliceId slice_id = 2; -} - -// ----- Connection ---------------------------------------------------------------------------------------------------- -message ConnectionId { - Uuid connection_uuid = 1; -} - -message ConnectionSettings_L0 { - string lsp_symbolic_name = 1; -} - -message ConnectionSettings_L2 { - string src_mac_address = 1; - string dst_mac_address = 2; - uint32 ether_type = 3; - uint32 vlan_id = 4; - uint32 mpls_label = 5; - uint32 mpls_traffic_class = 6; -} - -message ConnectionSettings_L3 { - string src_ip_address = 1; - string dst_ip_address = 2; - uint32 dscp = 3; - uint32 protocol = 4; - uint32 ttl = 5; -} - -message ConnectionSettings_L4 { - uint32 src_port = 1; - uint32 dst_port = 2; - uint32 tcp_flags = 3; - uint32 ttl = 4; -} - -message ConnectionSettings { - ConnectionSettings_L0 l0 = 1; - ConnectionSettings_L2 l2 = 2; - ConnectionSettings_L3 l3 = 3; - ConnectionSettings_L4 l4 = 4; -} - -message Connection { - ConnectionId connection_id = 1; - ServiceId service_id = 2; - repeated EndPointId path_hops_endpoint_ids = 3; - repeated ServiceId sub_service_ids = 4; - ConnectionSettings settings = 5; -} - -message ConnectionIdList { - repeated ConnectionId connection_ids = 1; -} - -message ConnectionList { - repeated Connection connections = 1; -} - -message ConnectionEvent { - Event event = 1; - ConnectionId connection_id = 2; -} - - -// ----- Endpoint ------------------------------------------------------------------------------------------------------ -message EndPointId { - TopologyId topology_id = 1; - DeviceId device_id = 2; - Uuid endpoint_uuid = 3; -} - -message EndPoint { - EndPointId endpoint_id = 1; - string name = 2; - string endpoint_type = 3; - repeated kpi_sample_types.KpiSampleType kpi_sample_types = 4; - Location endpoint_location = 5; -} - -message EndPointName { - EndPointId endpoint_id = 1; - string device_name = 2; - string endpoint_name = 3; - string endpoint_type = 4; -} - -message EndPointIdList { - repeated EndPointId endpoint_ids = 1; -} - -message EndPointNameList { - repeated EndPointName endpoint_names = 1; -} - - -// ----- Configuration ------------------------------------------------------------------------------------------------- -enum ConfigActionEnum { - CONFIGACTION_UNDEFINED = 0; - CONFIGACTION_SET = 1; - CONFIGACTION_DELETE = 2; -} - -message ConfigRule_Custom { - string resource_key = 1; - string resource_value = 2; -} - -message ConfigRule_ACL { - EndPointId endpoint_id = 1; - acl.AclRuleSet rule_set = 2; -} - -message ConfigRule { - ConfigActionEnum action = 1; - oneof config_rule { - ConfigRule_Custom custom = 2; - ConfigRule_ACL acl = 3; - } -} - - -// ----- Constraint ---------------------------------------------------------------------------------------------------- -enum ConstraintActionEnum { - CONSTRAINTACTION_UNDEFINED = 0; - CONSTRAINTACTION_SET = 1; - CONSTRAINTACTION_DELETE = 2; -} - -message Constraint_Custom { - string constraint_type = 1; - string constraint_value = 2; -} - -message Constraint_Schedule { - float start_timestamp = 1; - float duration_days = 2; -} - -message GPS_Position { - float latitude = 1; - float longitude = 2; -} - -message Location { - oneof location { - string region = 1; - GPS_Position gps_position = 2; - } -} - -message Constraint_EndPointLocation { - EndPointId endpoint_id = 1; - Location location = 2; -} - -message Constraint_EndPointPriority { - EndPointId endpoint_id = 1; - uint32 priority = 2; -} - -message Constraint_SLA_Latency { - float e2e_latency_ms = 1; -} - -message Constraint_SLA_Capacity { - float capacity_gbps = 1; -} - -message Constraint_SLA_Availability { - uint32 num_disjoint_paths = 1; - bool all_active = 2; - float availability = 3; // 0.0 .. 100.0 percentage of availability -} - -enum IsolationLevelEnum { - NO_ISOLATION = 0; - PHYSICAL_ISOLATION = 1; - LOGICAL_ISOLATION = 2; - PROCESS_ISOLATION = 3; - PHYSICAL_MEMORY_ISOLATION = 4; - PHYSICAL_NETWORK_ISOLATION = 5; - VIRTUAL_RESOURCE_ISOLATION = 6; - NETWORK_FUNCTIONS_ISOLATION = 7; - SERVICE_ISOLATION = 8; -} - -message Constraint_SLA_Isolation_level { - repeated IsolationLevelEnum isolation_level = 1; -} - -message Constraint_Exclusions { - bool is_permanent = 1; - repeated DeviceId device_ids = 2; - repeated EndPointId endpoint_ids = 3; - repeated LinkId link_ids = 4; -} - -message Constraint { - ConstraintActionEnum action = 1; - oneof constraint { - Constraint_Custom custom = 2; - Constraint_Schedule schedule = 3; - Constraint_EndPointLocation endpoint_location = 4; - Constraint_EndPointPriority endpoint_priority = 5; - Constraint_SLA_Capacity sla_capacity = 6; - Constraint_SLA_Latency sla_latency = 7; - Constraint_SLA_Availability sla_availability = 8; - Constraint_SLA_Isolation_level sla_isolation = 9; - Constraint_Exclusions exclusions = 10; - } -} - - -// ----- Miscellaneous ------------------------------------------------------------------------------------------------- -message TeraFlowController { - ContextId context_id = 1; - string ip_address = 2; - uint32 port = 3; -} - -message AuthenticationResult { - ContextId context_id = 1; - bool authenticated = 2; -} diff --git a/src/ztp/src/main/proto/context.proto b/src/ztp/src/main/proto/context.proto new file mode 120000 index 0000000000000000000000000000000000000000..7f33c4bc783bd20d031d94ab3b2e94f0d76ecd95 --- /dev/null +++ b/src/ztp/src/main/proto/context.proto @@ -0,0 +1 @@ +../../../../../proto/context.proto \ No newline at end of file diff --git a/src/ztp/src/main/proto/device.proto b/src/ztp/src/main/proto/device.proto deleted file mode 100644 index 30e60079db6c1eb8641d10115f6f43840eabf39c..0000000000000000000000000000000000000000 --- a/src/ztp/src/main/proto/device.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package device; - -import "context.proto"; -import "monitoring.proto"; - -service DeviceService { - rpc AddDevice (context.Device ) returns (context.DeviceId ) {} - rpc ConfigureDevice (context.Device ) returns (context.DeviceId ) {} - rpc DeleteDevice (context.DeviceId ) returns (context.Empty ) {} - rpc GetInitialConfig(context.DeviceId ) returns (context.DeviceConfig) {} - rpc MonitorDeviceKpi(MonitoringSettings) returns (context.Empty ) {} -} - -message MonitoringSettings { - monitoring.KpiId kpi_id = 1; - monitoring.KpiDescriptor kpi_descriptor = 2; - float sampling_duration_s = 3; - float sampling_interval_s = 4; -} diff --git a/src/ztp/src/main/proto/device.proto b/src/ztp/src/main/proto/device.proto new file mode 120000 index 0000000000000000000000000000000000000000..ad6e7c47eb9fb50c5cc8a7b3562caaf933ba0469 --- /dev/null +++ b/src/ztp/src/main/proto/device.proto @@ -0,0 +1 @@ +../../../../../proto/device.proto \ No newline at end of file diff --git a/src/ztp/src/main/proto/kpi_sample_types.proto b/src/ztp/src/main/proto/kpi_sample_types.proto deleted file mode 100644 index 5b234a4e35197557f41770984f7c8f6603672411..0000000000000000000000000000000000000000 --- a/src/ztp/src/main/proto/kpi_sample_types.proto +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package kpi_sample_types; - -enum KpiSampleType { - KPISAMPLETYPE_UNKNOWN = 0; - - KPISAMPLETYPE_PACKETS_TRANSMITTED = 101; - KPISAMPLETYPE_PACKETS_RECEIVED = 102; - KPISAMPLETYPE_PACKETS_DROPPED = 103; - KPISAMPLETYPE_BYTES_TRANSMITTED = 201; - KPISAMPLETYPE_BYTES_RECEIVED = 202; - KPISAMPLETYPE_BYTES_DROPPED = 203; - - KPISAMPLETYPE_LINK_TOTAL_CAPACITY_GBPS = 301; - KPISAMPLETYPE_LINK_USED_CAPACITY_GBPS = 302; - - KPISAMPLETYPE_ML_CONFIDENCE = 401; //. can be used by both optical and L3 without any issue - - KPISAMPLETYPE_OPTICAL_SECURITY_STATUS = 501; //. can be used by both optical and L3 without any issue - - KPISAMPLETYPE_L3_UNIQUE_ATTACK_CONNS = 601; - KPISAMPLETYPE_L3_TOTAL_DROPPED_PACKTS = 602; - KPISAMPLETYPE_L3_UNIQUE_ATTACKERS = 603; - KPISAMPLETYPE_L3_UNIQUE_COMPROMISED_CLIENTS = 604; - KPISAMPLETYPE_L3_SECURITY_STATUS_CRYPTO = 605; - - KPISAMPLETYPE_SERVICE_LATENCY_MS = 701; -} diff --git a/src/ztp/src/main/proto/kpi_sample_types.proto b/src/ztp/src/main/proto/kpi_sample_types.proto new file mode 120000 index 0000000000000000000000000000000000000000..98e748bbf4fbadbc04c3657f458d733f1bc7bdb8 --- /dev/null +++ b/src/ztp/src/main/proto/kpi_sample_types.proto @@ -0,0 +1 @@ +../../../../../proto/kpi_sample_types.proto \ No newline at end of file diff --git a/src/ztp/src/main/proto/monitoring.proto b/src/ztp/src/main/proto/monitoring.proto deleted file mode 100644 index 45ba48b0271c6e8890d7125ff44f62d2b6da6b58..0000000000000000000000000000000000000000 --- a/src/ztp/src/main/proto/monitoring.proto +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package monitoring; - -import "context.proto"; -import "kpi_sample_types.proto"; - -service MonitoringService { - rpc SetKpi (KpiDescriptor ) returns (KpiId ) {} // Stable not final - rpc DeleteKpi (KpiId ) returns (context.Empty ) {} // Stable and final - rpc GetKpiDescriptor (KpiId ) returns (KpiDescriptor ) {} // Stable and final - rpc GetKpiDescriptorList (context.Empty ) returns (KpiDescriptorList ) {} // Stable and final - rpc IncludeKpi (Kpi ) returns (context.Empty ) {} // Stable and final - rpc MonitorKpi (MonitorKpiRequest ) returns (context.Empty ) {} // Stable and final - rpc QueryKpiData (KpiQuery ) returns (RawKpiTable ) {} // Not implemented - rpc SetKpiSubscription (SubsDescriptor ) returns (stream SubsResponse ) {} // Stable not final - rpc GetSubsDescriptor (SubscriptionID ) returns (SubsDescriptor ) {} // Stable and final - rpc GetSubscriptions (context.Empty ) returns (SubsList ) {} // Stable and final - rpc DeleteSubscription (SubscriptionID ) returns (context.Empty ) {} // Stable and final - rpc SetKpiAlarm (AlarmDescriptor ) returns (AlarmID ) {} // Stable not final - rpc GetAlarms (context.Empty ) returns (AlarmList ) {} // Stable and final - rpc GetAlarmDescriptor (AlarmID ) returns (AlarmDescriptor ) {} // Stable and final - rpc GetAlarmResponseStream(AlarmSubscription ) returns (stream AlarmResponse) {} // Not Stable not final - rpc DeleteAlarm (AlarmID ) returns (context.Empty ) {} // Stable and final - rpc GetStreamKpi (KpiId ) returns (stream Kpi ) {} // Stable not final - rpc GetInstantKpi (KpiId ) returns (Kpi ) {} // Stable not final -} - -message KpiDescriptor { - KpiId kpi_id = 1; - string kpi_description = 2; - repeated KpiId kpi_id_list = 3; - kpi_sample_types.KpiSampleType kpi_sample_type = 4; - context.DeviceId device_id = 5; - context.EndPointId endpoint_id = 6; - context.ServiceId service_id = 7; - context.SliceId slice_id = 8; - context.ConnectionId connection_id = 9; - context.LinkId link_id = 10; -} - -message MonitorKpiRequest { - KpiId kpi_id = 1; - float monitoring_window_s = 2; - float sampling_rate_s = 3; - // Pending add field to reflect Available Device Protocols -} - -message KpiQuery { - repeated KpiId kpi_ids = 1; - float monitoring_window_s = 2; - uint32 last_n_samples = 3; // used when you want something like "get the last N many samples - context.Timestamp start_timestamp = 4; // used when you want something like "get the samples since X date/time" - context.Timestamp end_timestamp = 5; // used when you want something like "get the samples until X date/time" -} - - -message RawKpi { // cell - context.Timestamp timestamp = 1; - KpiValue kpi_value = 2; -} - -message RawKpiList { // column - KpiId kpi_id = 1; - repeated RawKpi raw_kpis = 2; -} - -message RawKpiTable { // table - repeated RawKpiList raw_kpi_lists = 1; -} - -message KpiId { - context.Uuid kpi_id = 1; -} - -message Kpi { - KpiId kpi_id = 1; - context.Timestamp timestamp = 2; - KpiValue kpi_value = 3; -} - -message KpiValueRange { - KpiValue kpiMinValue = 1; - KpiValue kpiMaxValue = 2; - bool inRange = 3; // by default True - bool includeMinValue = 4; // False is outside the interval - bool includeMaxValue = 5; // False is outside the interval -} - -message KpiValue { - oneof value { - int32 int32Val = 1; - uint32 uint32Val = 2; - int64 int64Val = 3; - uint64 uint64Val = 4; - float floatVal = 5; - string stringVal = 6; - bool boolVal = 7; - } -} - - -message KpiList { - repeated Kpi kpi = 1; -} - -message KpiDescriptorList { - repeated KpiDescriptor kpi_descriptor_list = 1; -} - -message SubsDescriptor{ - SubscriptionID subs_id = 1; - KpiId kpi_id = 2; - float sampling_duration_s = 3; - float sampling_interval_s = 4; - context.Timestamp start_timestamp = 5; // used when you want something like "get the samples since X date/time" - context.Timestamp end_timestamp = 6; // used when you want something like "get the samples until X date/time" - // Pending add field to reflect Available Device Protocols -} - -message SubscriptionID { - context.Uuid subs_id = 1; -} - -message SubsResponse { - SubscriptionID subs_id = 1; - KpiList kpi_list = 2; -} - -message SubsList { - repeated SubsDescriptor subs_descriptor = 1; -} - -message AlarmDescriptor { - AlarmID alarm_id = 1; - string alarm_description = 2; - string name = 3; - KpiId kpi_id = 4; - KpiValueRange kpi_value_range = 5; - context.Timestamp timestamp = 6; -} - -message AlarmID{ - context.Uuid alarm_id = 1; -} - -message AlarmSubscription{ - AlarmID alarm_id = 1; - float subscription_timeout_s = 2; - float subscription_frequency_ms = 3; -} - -message AlarmResponse { - AlarmID alarm_id = 1; - string text = 2; - KpiList kpi_list = 3; -} - -message AlarmList { - repeated AlarmDescriptor alarm_descriptor = 1; -} diff --git a/src/ztp/src/main/proto/monitoring.proto b/src/ztp/src/main/proto/monitoring.proto new file mode 120000 index 0000000000000000000000000000000000000000..aceaa7328099fe736163be048ee1ad21a61d79a2 --- /dev/null +++ b/src/ztp/src/main/proto/monitoring.proto @@ -0,0 +1 @@ +../../../../../proto/monitoring.proto \ No newline at end of file diff --git a/src/ztp/src/main/proto/ztp.proto b/src/ztp/src/main/proto/ztp.proto deleted file mode 100644 index 5c895900d8c8b379fc6e58a16bbf4dad3918276b..0000000000000000000000000000000000000000 --- a/src/ztp/src/main/proto/ztp.proto +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. - -syntax = "proto3"; -package ztp; - -import "context.proto"; - -service ZtpService { - rpc ZtpGetDeviceRole(DeviceRoleId) returns (DeviceRole) {} - rpc ZtpGetDeviceRolesByDeviceId(context.DeviceId) returns (DeviceRoleList) {} - rpc ZtpAdd(DeviceRole) returns (DeviceRoleState) {} - rpc ZtpUpdate(DeviceRoleConfig) returns (DeviceRoleState) {} - rpc ZtpDelete(DeviceRole) returns (DeviceRoleState) {} - rpc ZtpDeleteAll(context.Empty) returns (DeviceDeletionResult) {} -} - -enum DeviceRoleType { - NONE = 0; - DEV_OPS = 1; - DEV_CONF = 2; - PIPELINE_CONF = 3; -} - -message DeviceRoleId { - context.Uuid devRoleId = 1; - context.DeviceId devId = 2; -} - -message DeviceRole { - DeviceRoleId devRoleId = 1; - DeviceRoleType devRoleType = 2; -} - -message DeviceRoleConfig { - DeviceRole devRole = 1; - context.DeviceConfig devConfig = 2; -} - -message DeviceRoleList { - repeated DeviceRole devRole = 1; -} - -message DeviceRoleState { - DeviceRoleId devRoleId = 1; - ZtpDeviceState devRoleState = 2; -} - -message DeviceDeletionResult { - repeated string deleted = 1; -} - -enum ZtpDeviceState { - ZTP_DEV_STATE_UNDEFINED = 0; - ZTP_DEV_STATE_CREATED = 1; - ZTP_DEV_STATE_UPDATED = 2; - ZTP_DEV_STATE_DELETED = 3; -} diff --git a/src/ztp/src/main/proto/ztp.proto b/src/ztp/src/main/proto/ztp.proto new file mode 120000 index 0000000000000000000000000000000000000000..9183ce531e28ade191ea9a9659feb97bf8bc7bf5 --- /dev/null +++ b/src/ztp/src/main/proto/ztp.proto @@ -0,0 +1 @@ +../../../../../proto/ztp.proto \ No newline at end of file