Skip to content
Snippets Groups Projects
Commit 1a2ad3f9 authored by Manuel Angel Jimenez Quesada's avatar Manuel Angel Jimenez Quesada
Browse files

Code cleanup

parent 492e11c6
No related branches found
No related tags found
2 merge requests!359Release TeraFlowSDN 5.0,!338Resolve "(EVIDEN) SmartNIC support"
Showing
with 34 additions and 2003 deletions
......@@ -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;
......
// 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) {}
}
// 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) {}
}
......@@ -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(
......
......@@ -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,
}
......
// 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";
......
......@@ -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)))
......@@ -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))
......@@ -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):
......
......@@ -24,4 +24,3 @@
]
}
\ No newline at end of file
# 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" ]
src/main/docker/Dockerfile.multistage.jvm
\ No newline at end of file
// 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;
}
../../../../../proto/acl.proto
\ No newline at end of file
// 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;
}
../../../../../proto/context.proto
\ No newline at end of file
// 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 ) {}
}
../../../../../proto/context_policy.proto
\ No newline at end of file
// 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;
}
../../../../../proto/device.proto
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment