diff --git a/src/dlt/gateway/build.gradle.kts b/src/dlt/gateway/build.gradle.kts index 92d0b6bc7ee7540ba0f58237740c09bf14fb5297..c7213fbf7a1339ed660e9e4f7c8c64f761a10814 100644 --- a/src/dlt/gateway/build.gradle.kts +++ b/src/dlt/gateway/build.gradle.kts @@ -107,6 +107,7 @@ task("runServer", JavaExec::class) { sourceSets { main { proto { + srcDir("../../../proto") srcDir("src/main/kotlin/proto") } } diff --git a/src/dlt/gateway/src/main/kotlin/Main.kt b/src/dlt/gateway/src/main/kotlin/Main.kt index 432965137b99283e0cd98da7df853683959e96ae..576aeee5699ce7a9dc69342c31160efd170b88ef 100644 --- a/src/dlt/gateway/src/main/kotlin/Main.kt +++ b/src/dlt/gateway/src/main/kotlin/Main.kt @@ -35,34 +35,35 @@ // // THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY. +import context.ContextOuterClass import io.grpc.ManagedChannel import io.grpc.ManagedChannelBuilder import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking -import proto.ContextOuterClass -import proto.Dlt -import proto.DltServiceGrpcKt +import dlt.DltGateway +import dlt.DltGatewayServiceGrpcKt import java.io.Closeable import java.util.* import java.util.concurrent.TimeUnit class DltServiceClient(private val channel: ManagedChannel) : Closeable { - private val stub: DltServiceGrpcKt.DltServiceCoroutineStub = DltServiceGrpcKt.DltServiceCoroutineStub(channel) + private val stub: DltGatewayServiceGrpcKt.DltGatewayServiceCoroutineStub = + DltGatewayServiceGrpcKt.DltGatewayServiceCoroutineStub(channel) - suspend fun putData(data: Dlt.DltRecord) { + suspend fun putData(data: DltGateway.DltRecord) { println("Sending record ${data.recordId}...") val response = stub.recordToDlt(data) println("Response: ${response.recordId}") } - suspend fun getData(id: Dlt.DltRecordId) { + suspend fun getData(id: DltGateway.DltRecordId) { println("Requesting record $id...") val response = stub.getFromDlt(id) println("Got data: $response") } - fun subscribe(filter: Dlt.DltRecordSubscription) { + fun subscribe(filter: DltGateway.DltRecordSubscription) { val subscription = stub.subscribeToDlt(filter) GlobalScope.launch { subscription.collect { @@ -89,7 +90,7 @@ fun main() = runBlocking { println("New domain uuid $domainUuid") println("New record uuid $recordUuid") - val id = Dlt.DltRecordId.newBuilder() + val id = DltGateway.DltRecordId.newBuilder() .setDomainUuid( ContextOuterClass.Uuid.newBuilder() .setUuid(domainUuid) @@ -98,25 +99,25 @@ fun main() = runBlocking { ContextOuterClass.Uuid.newBuilder() .setUuid(recordUuid) ) - .setType(Dlt.DltRecordTypeEnum.DLTRECORDTYPE_SERVICE) + .setType(DltGateway.DltRecordTypeEnum.DLTRECORDTYPE_SERVICE) .build() - val subscription = Dlt.DltRecordSubscription.newBuilder() - .addType(Dlt.DltRecordTypeEnum.DLTRECORDTYPE_CONTEXT) - .addType(Dlt.DltRecordTypeEnum.DLTRECORDTYPE_LINK) - .addType(Dlt.DltRecordTypeEnum.DLTRECORDTYPE_SERVICE) - .addOperation(Dlt.DltRecordOperationEnum.DLTRECORDOPERATION_ADD) - .addOperation(Dlt.DltRecordOperationEnum.DLTRECORDOPERATION_UPDATE) - .addOperation(Dlt.DltRecordOperationEnum.DLTRECORDOPERATION_DELETE) + val subscription = DltGateway.DltRecordSubscription.newBuilder() + .addType(DltGateway.DltRecordTypeEnum.DLTRECORDTYPE_CONTEXT) + .addType(DltGateway.DltRecordTypeEnum.DLTRECORDTYPE_LINK) + .addType(DltGateway.DltRecordTypeEnum.DLTRECORDTYPE_SERVICE) + .addOperation(DltGateway.DltRecordOperationEnum.DLTRECORDOPERATION_ADD) + .addOperation(DltGateway.DltRecordOperationEnum.DLTRECORDOPERATION_UPDATE) + .addOperation(DltGateway.DltRecordOperationEnum.DLTRECORDOPERATION_DELETE) .build() client.subscribe(subscription) Thread.sleep(5000) - val data = Dlt.DltRecord.newBuilder() + val data = DltGateway.DltRecord.newBuilder() .setRecordId(id) - .setOperation(Dlt.DltRecordOperationEnum.DLTRECORDOPERATION_ADD) + .setOperation(DltGateway.DltRecordOperationEnum.DLTRECORDOPERATION_ADD) .setDataJson("{}") .build() @@ -126,9 +127,9 @@ fun main() = runBlocking { Thread.sleep(5000) - val updateData = Dlt.DltRecord.newBuilder() + val updateData = DltGateway.DltRecord.newBuilder() .setRecordId(id) - .setOperation(Dlt.DltRecordOperationEnum.DLTRECORDOPERATION_UPDATE) + .setOperation(DltGateway.DltRecordOperationEnum.DLTRECORDOPERATION_UPDATE) .setDataJson("{\"name\": \"test\"}") .build() @@ -138,9 +139,9 @@ fun main() = runBlocking { Thread.sleep(5000) - val removeData = Dlt.DltRecord.newBuilder() + val removeData = DltGateway.DltRecord.newBuilder() .setRecordId(id) - .setOperation(Dlt.DltRecordOperationEnum.DLTRECORDOPERATION_DELETE) + .setOperation(DltGateway.DltRecordOperationEnum.DLTRECORDOPERATION_DELETE) .setDataJson("{\"name\": \"test\"}") .build() diff --git a/src/dlt/gateway/src/main/kotlin/fabric/FabricConnector.kt b/src/dlt/gateway/src/main/kotlin/fabric/FabricConnector.kt index e4188d156ff3931e2ed5445f222bee6b7732180c..d175f601184ed796f90a6fe35409a74c9a15246b 100644 --- a/src/dlt/gateway/src/main/kotlin/fabric/FabricConnector.kt +++ b/src/dlt/gateway/src/main/kotlin/fabric/FabricConnector.kt @@ -37,9 +37,9 @@ package fabric +import dlt.DltGateway import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.runBlocking -import proto.Dlt import org.hyperledger.fabric.gateway.Contract import org.hyperledger.fabric.gateway.ContractEvent import org.hyperledger.fabric.gateway.Wallet @@ -56,7 +56,7 @@ class FabricConnector(val config: Config.DltConfig) { private val wallet: Wallet private val contract: Contract - private val channels: MutableList<Channel<Dlt.DltRecordEvent>> = mutableListOf() + private val channels: MutableList<Channel<DltGateway.DltRecordEvent>> = mutableListOf() init { // Create a CA client for interacting with the CA. @@ -78,7 +78,7 @@ class FabricConnector(val config: Config.DltConfig) { val consumer = Consumer { event: ContractEvent? -> run { println("new event detected") - val parsedEvent = Dlt.DltRecordEvent.parseFrom(event?.payload?.get()) + val parsedEvent = DltGateway.DltRecordEvent.parseFrom(event?.payload?.get()) println(parsedEvent.recordId.recordUuid) runBlocking { channels.forEach { @@ -96,7 +96,7 @@ class FabricConnector(val config: Config.DltConfig) { return getContract(config, wallet) } - fun putData(record: Dlt.DltRecord): String { + fun putData(record: DltGateway.DltRecord): String { println(record.toString()) return String( contract.submitTransaction( @@ -109,12 +109,12 @@ class FabricConnector(val config: Config.DltConfig) { ) } - fun getData(uuid: String): Dlt.DltRecord { + fun getData(uuid: String): DltGateway.DltRecord { val result = contract.evaluateTransaction("GetRecord", uuid) - return Dlt.DltRecord.parseFrom(result) + return DltGateway.DltRecord.parseFrom(result) } - fun updateData(record: Dlt.DltRecord): String { + fun updateData(record: DltGateway.DltRecord): String { return String( contract.submitTransaction( "UpdateRecord", @@ -126,7 +126,7 @@ class FabricConnector(val config: Config.DltConfig) { ) } - fun deleteData(record: Dlt.DltRecord): String { + fun deleteData(record: DltGateway.DltRecord): String { return String( contract.submitTransaction( "DeleteRecord", @@ -137,8 +137,8 @@ class FabricConnector(val config: Config.DltConfig) { ) } - fun subscribeForEvents(): Channel<Dlt.DltRecordEvent> { - val produceCh = Channel<Dlt.DltRecordEvent>() + fun subscribeForEvents(): Channel<DltGateway.DltRecordEvent> { + val produceCh = Channel<DltGateway.DltRecordEvent>() channels.add(produceCh) return produceCh } diff --git a/src/dlt/gateway/src/main/kotlin/grpc/GrpcHandler.kt b/src/dlt/gateway/src/main/kotlin/grpc/GrpcHandler.kt index c3d6d801f82df5a429dff580e64a42d5ec7d5cda..d39c24a1a87aacb32d828dcba8208b34312d7409 100644 --- a/src/dlt/gateway/src/main/kotlin/grpc/GrpcHandler.kt +++ b/src/dlt/gateway/src/main/kotlin/grpc/GrpcHandler.kt @@ -37,58 +37,59 @@ package grpc -import proto.Dlt import fabric.FabricConnector import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.consumeAsFlow -import proto.ContextOuterClass -import proto.DltServiceGrpcKt +import context.ContextOuterClass +import dlt.DltGateway +import dlt.DltGatewayServiceGrpcKt -class DLTService(private val connector: FabricConnector) : DltServiceGrpcKt.DltServiceCoroutineImplBase() { - override suspend fun recordToDlt(request: Dlt.DltRecord): Dlt.DltRecordStatus { +class DLTService(private val connector: FabricConnector) : + DltGatewayServiceGrpcKt.DltGatewayServiceCoroutineImplBase() { + override suspend fun recordToDlt(request: DltGateway.DltRecord): DltGateway.DltRecordStatus { println("Incoming request ${request.recordId.recordUuid}") val error = when (request.operation) { - Dlt.DltRecordOperationEnum.DLTRECORDOPERATION_ADD -> { + DltGateway.DltRecordOperationEnum.DLTRECORDOPERATION_ADD -> { println("Adding new record") connector.putData(request) } - Dlt.DltRecordOperationEnum.DLTRECORDOPERATION_UPDATE -> { + DltGateway.DltRecordOperationEnum.DLTRECORDOPERATION_UPDATE -> { println("Updating record") connector.updateData(request) } - Dlt.DltRecordOperationEnum.DLTRECORDOPERATION_DELETE -> { + DltGateway.DltRecordOperationEnum.DLTRECORDOPERATION_DELETE -> { println("Deleting record") connector.deleteData(request) } else -> "Undefined or unknown operation" } - val dltStatusEnum: Dlt.DltRecordStatusEnum = if (error == "") { - Dlt.DltRecordStatusEnum.DLTRECORDSTATUS_SUCCEEDED + val dltStatusEnum: DltGateway.DltRecordStatusEnum = if (error == "") { + DltGateway.DltRecordStatusEnum.DLTRECORDSTATUS_SUCCEEDED } else { - Dlt.DltRecordStatusEnum.DLTRECORDSTATUS_FAILED + DltGateway.DltRecordStatusEnum.DLTRECORDSTATUS_FAILED } - return Dlt.DltRecordStatus.newBuilder() + return DltGateway.DltRecordStatus.newBuilder() .setRecordId(request.recordId) .setStatus(dltStatusEnum) .setErrorMessage(error) .build() } - override suspend fun getFromDlt(request: Dlt.DltRecordId): Dlt.DltRecord { + override suspend fun getFromDlt(request: DltGateway.DltRecordId): DltGateway.DltRecord { return connector.getData(request.recordUuid.uuid) } - override fun subscribeToDlt(request: Dlt.DltRecordSubscription): Flow<Dlt.DltRecordEvent> { + override fun subscribeToDlt(request: DltGateway.DltRecordSubscription): Flow<DltGateway.DltRecordEvent> { println("Subscription request: $request") return connector.subscribeForEvents().consumeAsFlow() } - override suspend fun getDltStatus(request: ContextOuterClass.TeraFlowController): Dlt.DltPeerStatus { + override suspend fun getDltStatus(request: ContextOuterClass.TeraFlowController): DltGateway.DltPeerStatus { return super.getDltStatus(request) } - override suspend fun getDltPeers(request: ContextOuterClass.Empty): Dlt.DltPeerStatusList { + override suspend fun getDltPeers(request: ContextOuterClass.Empty): DltGateway.DltPeerStatusList { return super.getDltPeers(request) } } \ No newline at end of file diff --git a/src/dlt/gateway/src/main/kotlin/proto/context.proto b/src/dlt/gateway/src/main/kotlin/proto/context.proto deleted file mode 100644 index a7185ba1030c4605ed0221f1b5402a9b8f352b71..0000000000000000000000000000000000000000 --- a/src/dlt/gateway/src/main/kotlin/proto/context.proto +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) -// -// 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 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 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 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 RemoveService (ServiceId ) returns ( Empty ) {} - rpc GetServiceEvents (Empty ) returns (stream ServiceEvent ) {} - - rpc ListSliceIds (ContextId ) returns ( SliceIdList ) {} - rpc ListSlices (ContextId ) returns ( SliceList ) {} - rpc GetSlice (SliceId ) returns ( Slice ) {} - rpc SetSlice (Slice ) returns ( SliceId ) {} - rpc RemoveSlice (SliceId ) returns ( Empty ) {} - rpc GetSliceEvents (Empty ) returns (stream SliceEvent ) {} - - 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 Event { - double timestamp = 1; - EventTypeEnum event_type = 2; -} - -// ----- Context ------------------------------------------------------------------------------------------------------- -message ContextId { - Uuid context_uuid = 1; -} - -message Context { - ContextId context_id = 1; - repeated TopologyId topology_ids = 2; - repeated ServiceId service_ids = 3; - TeraFlowController controller = 4; -} - -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; - repeated DeviceId device_ids = 2; - repeated LinkId link_ids = 3; -} - -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 device_type = 2; - DeviceConfig device_config = 3; - DeviceOperationalStatusEnum device_operational_status = 4; - repeated DeviceDriverEnum device_drivers = 5; - repeated EndPoint device_endpoints = 6; -} - -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_352 = 5; -} - -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 DeviceEvent { - Event event = 1; - DeviceId device_id = 2; -} - - -// ----- Link ---------------------------------------------------------------------------------------------------------- -message LinkId { - Uuid link_uuid = 1; -} - -message Link { - LinkId link_id = 1; - repeated EndPointId link_endpoint_ids = 2; -} - -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; - ServiceTypeEnum service_type = 2; - repeated EndPointId service_endpoint_ids = 3; - repeated Constraint service_constraints = 4; - ServiceStatus service_status = 5; - ServiceConfig service_config = 6; -} - -enum ServiceTypeEnum { - SERVICETYPE_UNKNOWN = 0; - SERVICETYPE_L3NM = 1; - SERVICETYPE_L2NM = 2; - SERVICETYPE_TAPI_CONNECTIVITY_SERVICE = 3; -} - -enum ServiceStatusEnum { - SERVICESTATUS_UNDEFINED = 0; - SERVICESTATUS_PLANNED = 1; - SERVICESTATUS_ACTIVE = 2; - SERVICESTATUS_PENDING_REMOVAL = 3; -} - -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 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; - repeated EndPointId slice_endpoint_ids = 2; - repeated Constraint slice_constraints = 3; - repeated ServiceId slice_service_ids = 4; - repeated SliceId slice_subslice_ids = 5; - SliceStatus slice_status = 6; -} - -enum SliceStatusEnum { - SLICESTATUS_UNDEFINED = 0; - SLICESTATUS_PLANNED = 1; - SLICESTATUS_INIT = 2; - SLICESTATUS_ACTIVE = 3; - SLICESTATUS_DEINIT = 4; -} - -message SliceStatus { - SliceStatusEnum slice_status = 1; -} - -message SliceIdList { - repeated SliceId slice_ids = 1; -} - -message SliceList { - repeated Slice slices = 1; -} - -message SliceEvent { - Event event = 1; - SliceId slice_id = 2; -} - -// ----- Connection ---------------------------------------------------------------------------------------------------- -message ConnectionId { - Uuid connection_uuid = 1; -} - -message Connection { - ConnectionId connection_id = 1; - ServiceId service_id = 2; - repeated EndPointId path_hops_endpoint_ids = 3; - repeated ServiceId sub_service_ids = 4; -} - -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 endpoint_type = 2; - repeated KpiSampleType kpi_sample_types = 3; -} - - -// ----- Configuration ------------------------------------------------------------------------------------------------- -enum ConfigActionEnum { - CONFIGACTION_UNDEFINED = 0; - CONFIGACTION_SET = 1; - CONFIGACTION_DELETE = 2; -} - -message ConfigRule { - ConfigActionEnum action = 1; - string resource_key = 2; - string resource_value = 3; -} - - -// ----- Constraint ---------------------------------------------------------------------------------------------------- -message Constraint { - string constraint_type = 1; - string constraint_value = 2; -} - - -// ----- 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/dlt/gateway/src/main/kotlin/proto/dlt.proto b/src/dlt/gateway/src/main/kotlin/proto/dlt.proto deleted file mode 100644 index 7b145d2bc3fcfd26dae5e05b5a079b643e304c65..0000000000000000000000000000000000000000 --- a/src/dlt/gateway/src/main/kotlin/proto/dlt.proto +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) -// -// 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 proto; - -import "context.proto"; - -service DltService { - rpc RecordToDlt (DltRecord ) returns ( DltRecordStatus ) {} - rpc GetFromDlt (DltRecordId ) returns ( DltRecord ) {} - rpc SubscribeToDlt(DltRecordSubscription ) returns (stream DltRecordEvent ) {} - rpc GetDltStatus (TeraFlowController ) returns ( DltPeerStatus ) {} // NEC is checking if it is possible - rpc GetDltPeers (Empty ) returns ( DltPeerStatusList) {} // NEC is checking if it is possible -} - -enum DltRecordTypeEnum { - DLTRECORDTYPE_UNDEFINED = 0; - DLTRECORDTYPE_CONTEXT = 1; - DLTRECORDTYPE_TOPOLOGY = 2; - DLTRECORDTYPE_DEVICE = 3; - DLTRECORDTYPE_LINK = 4; - DLTRECORDTYPE_SERVICE = 5; - DLTRECORDTYPE_SLICE = 6; -} - -enum DltRecordOperationEnum { - DLTRECORDOPERATION_UNDEFINED = 0; - DLTRECORDOPERATION_ADD = 1; - DLTRECORDOPERATION_UPDATE = 2; - DLTRECORDOPERATION_DELETE = 3; -} - -enum DltRecordStatusEnum { - DLTRECORDSTATUS_UNDEFINED = 0; - DLTRECORDSTATUS_SUCCEEDED = 1; - DLTRECORDSTATUS_FAILED = 2; -} - -enum DltStatusEnum { - DLTSTATUS_UNDEFINED = 0; - DLTSTATUS_NOTAVAILABLE = 1; - DLTSTATUS_INITIALIZED = 2; - DLTSTATUS_AVAILABLE = 3; - DLTSTATUS_DEINIT = 4; -} - -message DltRecordId { - Uuid domain_uuid = 1; // unique identifier of domain owning the record - DltRecordTypeEnum type = 2; // type of record - Uuid record_uuid = 3; // unique identifier of the record within the domain context_uuid/topology_uuid -} - -message DltRecord { - DltRecordId record_id = 1; // record identifier - DltRecordOperationEnum operation = 2; // operation to be performed over the record - string data_json = 3; // record content: JSON-encoded record content -} - -message DltRecordSubscription { - // retrieved events have to match ALL conditions. - // i.e., type in types requested, AND operation in operations requested - // TODO: consider adding a more sophisticated filtering - repeated DltRecordTypeEnum type = 1; // selected event types, empty=all - repeated DltRecordOperationEnum operation = 2; // selected event operations, empty=all -} - -message DltRecordEvent { - Event event = 1; // common event data (timestamp & event_type) - DltRecordId record_id = 2; // record identifier associated with this event -} - -message DltRecordStatus { - DltRecordId record_id = 1; // identifier of the associated record - DltRecordStatusEnum status = 2; // status of the record - string error_message = 3; // error message in case of failure, empty otherwise -} - -message DltPeerStatus { - TeraFlowController controller = 1; // Identifier of the TeraFlow controller instance - DltStatusEnum status = 2; // Status of the TeraFlow controller instance -} - -message DltPeerStatusList { - repeated DltPeerStatus peers = 1; // List of peers and their status -} diff --git a/src/dlt/gateway/src/main/kotlin/proto/kpi_sample_types.proto b/src/dlt/gateway/src/main/kotlin/proto/kpi_sample_types.proto deleted file mode 100644 index 82ef51e80ea487072d0cb01aa45951a7ad7a939d..0000000000000000000000000000000000000000 --- a/src/dlt/gateway/src/main/kotlin/proto/kpi_sample_types.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) -// -// 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 proto; - -enum KpiSampleType { - KPISAMPLETYPE_UNKNOWN = 0; - KPISAMPLETYPE_PACKETS_TRANSMITTED = 101; - KPISAMPLETYPE_PACKETS_RECEIVED = 102; - KPISAMPLETYPE_BYTES_TRANSMITTED = 201; - KPISAMPLETYPE_BYTES_RECEIVED = 202; -}