Skip to content
Snippets Groups Projects
Commit ea50d792 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

DLT component:

- restructured component and separated it into "connector" and "gateway" subcomponents.
- arranged name typos in DLT proto file
- prepared component folders for dlt-connector component
parent b11c1176
No related branches found
No related tags found
1 merge request!54Release 2.0.0
Showing
with 4126 additions and 6 deletions
...@@ -63,16 +63,17 @@ message DltRecordId { ...@@ -63,16 +63,17 @@ message DltRecordId {
} }
message DltRecord { message DltRecord {
DltRecordId record_id = 1; // record identifier DltRecordId record_id = 1; // record identifier
DltRecordOperation operation = 2; // operation to be performed over the record DltRecordOperationEnum operation = 2; // operation to be performed over the record
string data_json = 3; // record content: JSON-encoded record content string data_json = 3; // record content: JSON-encoded record content
} }
message DltRecordSubscription { message DltRecordSubscription {
// retrieved events should match both conditions // 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 // TODO: consider adding a more sophisticated filtering
repeated DltRecordType type = 1; // only receive subscriptions of the selected types, empty=all repeated DltRecordTypeEnum type = 1; // selected event types, empty=all
repeated DltRecordOperation operation = 2; // only receive subscriptions of the selected operations, empty=all repeated DltRecordOperationEnum operation = 2; // selected event operations, empty=all
} }
message DltRecordEvent { message DltRecordEvent {
......
# 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.
# 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.
# 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.
#!/bin/bash -eu
#
# 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.
# Make folder containing the script the root folder for its execution
cd $(dirname $0)
rm -rf proto/*.py
rm -rf proto/__pycache__
tee proto/__init__.py << EOF > /dev/null
# 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.
EOF
python -m grpc_tools.protoc -I../../../proto --python_out=proto --grpc_python_out=proto context.proto
python -m grpc_tools.protoc -I../../../proto --python_out=proto --grpc_python_out=proto kpi_sample_types.proto
python -m grpc_tools.protoc -I../../../proto --python_out=proto --grpc_python_out=proto dlt.proto
rm proto/context_pb2_grpc.py
rm proto/kpi_sample_types_pb2_grpc.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/context_pb2.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/dlt_pb2.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/dlt_pb2_grpc.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/kpi_sample_types_pb2.py
# 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.
This diff is collapsed.
This diff is collapsed.
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from . import context_pb2 as context__pb2
from . import dlt_pb2 as dlt__pb2
class DltServiceStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.RecordToDlt = channel.unary_unary(
'/dlt.DltService/RecordToDlt',
request_serializer=dlt__pb2.DltRecord.SerializeToString,
response_deserializer=dlt__pb2.DltRecordStatus.FromString,
)
self.GetFromDlt = channel.unary_unary(
'/dlt.DltService/GetFromDlt',
request_serializer=dlt__pb2.DltRecordId.SerializeToString,
response_deserializer=dlt__pb2.DltRecord.FromString,
)
self.SubscribeToDlt = channel.unary_stream(
'/dlt.DltService/SubscribeToDlt',
request_serializer=dlt__pb2.DltRecordSubscription.SerializeToString,
response_deserializer=dlt__pb2.DltRecordEvent.FromString,
)
self.GetDltStatus = channel.unary_unary(
'/dlt.DltService/GetDltStatus',
request_serializer=context__pb2.TeraFlowController.SerializeToString,
response_deserializer=dlt__pb2.DltPeerStatus.FromString,
)
self.GetDltPeers = channel.unary_unary(
'/dlt.DltService/GetDltPeers',
request_serializer=context__pb2.Empty.SerializeToString,
response_deserializer=dlt__pb2.DltPeerStatusList.FromString,
)
class DltServiceServicer(object):
"""Missing associated documentation comment in .proto file."""
def RecordToDlt(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def GetFromDlt(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def SubscribeToDlt(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def GetDltStatus(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def GetDltPeers(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_DltServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'RecordToDlt': grpc.unary_unary_rpc_method_handler(
servicer.RecordToDlt,
request_deserializer=dlt__pb2.DltRecord.FromString,
response_serializer=dlt__pb2.DltRecordStatus.SerializeToString,
),
'GetFromDlt': grpc.unary_unary_rpc_method_handler(
servicer.GetFromDlt,
request_deserializer=dlt__pb2.DltRecordId.FromString,
response_serializer=dlt__pb2.DltRecord.SerializeToString,
),
'SubscribeToDlt': grpc.unary_stream_rpc_method_handler(
servicer.SubscribeToDlt,
request_deserializer=dlt__pb2.DltRecordSubscription.FromString,
response_serializer=dlt__pb2.DltRecordEvent.SerializeToString,
),
'GetDltStatus': grpc.unary_unary_rpc_method_handler(
servicer.GetDltStatus,
request_deserializer=context__pb2.TeraFlowController.FromString,
response_serializer=dlt__pb2.DltPeerStatus.SerializeToString,
),
'GetDltPeers': grpc.unary_unary_rpc_method_handler(
servicer.GetDltPeers,
request_deserializer=context__pb2.Empty.FromString,
response_serializer=dlt__pb2.DltPeerStatusList.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'dlt.DltService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class DltService(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def RecordToDlt(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/dlt.DltService/RecordToDlt',
dlt__pb2.DltRecord.SerializeToString,
dlt__pb2.DltRecordStatus.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def GetFromDlt(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/dlt.DltService/GetFromDlt',
dlt__pb2.DltRecordId.SerializeToString,
dlt__pb2.DltRecord.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def SubscribeToDlt(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/dlt.DltService/SubscribeToDlt',
dlt__pb2.DltRecordSubscription.SerializeToString,
dlt__pb2.DltRecordEvent.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def GetDltStatus(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/dlt.DltService/GetDltStatus',
context__pb2.TeraFlowController.SerializeToString,
dlt__pb2.DltPeerStatus.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def GetDltPeers(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/dlt.DltService/GetDltPeers',
context__pb2.Empty.SerializeToString,
dlt__pb2.DltPeerStatusList.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: kpi_sample_types.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='kpi_sample_types.proto',
package='kpi_sample_types',
syntax='proto3',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x16kpi_sample_types.proto\x12\x10kpi_sample_types*\xbe\x01\n\rKpiSampleType\x12\x19\n\x15KPISAMPLETYPE_UNKNOWN\x10\x00\x12%\n!KPISAMPLETYPE_PACKETS_TRANSMITTED\x10\x65\x12\"\n\x1eKPISAMPLETYPE_PACKETS_RECEIVED\x10\x66\x12$\n\x1fKPISAMPLETYPE_BYTES_TRANSMITTED\x10\xc9\x01\x12!\n\x1cKPISAMPLETYPE_BYTES_RECEIVED\x10\xca\x01\x62\x06proto3'
)
_KPISAMPLETYPE = _descriptor.EnumDescriptor(
name='KpiSampleType',
full_name='kpi_sample_types.KpiSampleType',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='KPISAMPLETYPE_UNKNOWN', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='KPISAMPLETYPE_PACKETS_TRANSMITTED', index=1, number=101,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='KPISAMPLETYPE_PACKETS_RECEIVED', index=2, number=102,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='KPISAMPLETYPE_BYTES_TRANSMITTED', index=3, number=201,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='KPISAMPLETYPE_BYTES_RECEIVED', index=4, number=202,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=45,
serialized_end=235,
)
_sym_db.RegisterEnumDescriptor(_KPISAMPLETYPE)
KpiSampleType = enum_type_wrapper.EnumTypeWrapper(_KPISAMPLETYPE)
KPISAMPLETYPE_UNKNOWN = 0
KPISAMPLETYPE_PACKETS_TRANSMITTED = 101
KPISAMPLETYPE_PACKETS_RECEIVED = 102
KPISAMPLETYPE_BYTES_TRANSMITTED = 201
KPISAMPLETYPE_BYTES_RECEIVED = 202
DESCRIPTOR.enum_types_by_name['KpiSampleType'] = _KPISAMPLETYPE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
# @@protoc_insertion_point(module_scope)
# 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.
# 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.
File moved
File moved
File moved
File moved
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