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

Code Cleanup

parent c05075fe
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!42Interdomain Component
#!/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 interdomain.proto
python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto slice.proto
rm proto/context_pb2_grpc.py
rm proto/kpi_sample_types_pb2_grpc.py
rm proto/slice_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/kpi_sample_types_pb2.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/interdomain_pb2.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/interdomain_pb2_grpc.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/slice_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.
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: interdomain.proto
"""Generated protocol buffer code."""
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()
from . import context_pb2 as context__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='interdomain.proto',
package='interdomain',
syntax='proto3',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x11interdomain.proto\x12\x0binterdomain\x1a\rcontext.proto2\xc4\x02\n\x12InterdomainService\x12\x32\n\x0cRequestSlice\x12\x0e.context.Slice\x1a\x10.context.SliceId\"\x00\x12L\n\x0c\x41uthenticate\x12\x1b.context.TeraFlowController\x1a\x1d.context.AuthenticationResult\"\x00\x12\x31\n\x0bLookUpSlice\x12\x0e.context.Slice\x1a\x10.context.SliceId\"\x00\x12\x39\n\x15OrderSliceFromCatalog\x12\x0e.context.Slice\x1a\x0e.context.Slice\"\x00\x12>\n\x1a\x43reateSliceAndAddToCatalog\x12\x0e.context.Slice\x1a\x0e.context.Slice\"\x00\x62\x06proto3'
,
dependencies=[context__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_INTERDOMAINSERVICE = _descriptor.ServiceDescriptor(
name='InterdomainService',
full_name='interdomain.InterdomainService',
file=DESCRIPTOR,
index=0,
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_start=50,
serialized_end=374,
methods=[
_descriptor.MethodDescriptor(
name='RequestSlice',
full_name='interdomain.InterdomainService.RequestSlice',
index=0,
containing_service=None,
input_type=context__pb2._SLICE,
output_type=context__pb2._SLICEID,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='Authenticate',
full_name='interdomain.InterdomainService.Authenticate',
index=1,
containing_service=None,
input_type=context__pb2._TERAFLOWCONTROLLER,
output_type=context__pb2._AUTHENTICATIONRESULT,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='LookUpSlice',
full_name='interdomain.InterdomainService.LookUpSlice',
index=2,
containing_service=None,
input_type=context__pb2._SLICE,
output_type=context__pb2._SLICEID,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='OrderSliceFromCatalog',
full_name='interdomain.InterdomainService.OrderSliceFromCatalog',
index=3,
containing_service=None,
input_type=context__pb2._SLICE,
output_type=context__pb2._SLICE,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='CreateSliceAndAddToCatalog',
full_name='interdomain.InterdomainService.CreateSliceAndAddToCatalog',
index=4,
containing_service=None,
input_type=context__pb2._SLICE,
output_type=context__pb2._SLICE,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
])
_sym_db.RegisterServiceDescriptor(_INTERDOMAINSERVICE)
DESCRIPTOR.services_by_name['InterdomainService'] = _INTERDOMAINSERVICE
# @@protoc_insertion_point(module_scope)
# 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
class InterdomainServiceStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.RequestSlice = channel.unary_unary(
'/interdomain.InterdomainService/RequestSlice',
request_serializer=context__pb2.Slice.SerializeToString,
response_deserializer=context__pb2.SliceId.FromString,
)
self.Authenticate = channel.unary_unary(
'/interdomain.InterdomainService/Authenticate',
request_serializer=context__pb2.TeraFlowController.SerializeToString,
response_deserializer=context__pb2.AuthenticationResult.FromString,
)
self.LookUpSlice = channel.unary_unary(
'/interdomain.InterdomainService/LookUpSlice',
request_serializer=context__pb2.Slice.SerializeToString,
response_deserializer=context__pb2.SliceId.FromString,
)
self.OrderSliceFromCatalog = channel.unary_unary(
'/interdomain.InterdomainService/OrderSliceFromCatalog',
request_serializer=context__pb2.Slice.SerializeToString,
response_deserializer=context__pb2.Slice.FromString,
)
self.CreateSliceAndAddToCatalog = channel.unary_unary(
'/interdomain.InterdomainService/CreateSliceAndAddToCatalog',
request_serializer=context__pb2.Slice.SerializeToString,
response_deserializer=context__pb2.Slice.FromString,
)
class InterdomainServiceServicer(object):
"""Missing associated documentation comment in .proto file."""
def RequestSlice(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 Authenticate(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 LookUpSlice(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 OrderSliceFromCatalog(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 CreateSliceAndAddToCatalog(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_InterdomainServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'RequestSlice': grpc.unary_unary_rpc_method_handler(
servicer.RequestSlice,
request_deserializer=context__pb2.Slice.FromString,
response_serializer=context__pb2.SliceId.SerializeToString,
),
'Authenticate': grpc.unary_unary_rpc_method_handler(
servicer.Authenticate,
request_deserializer=context__pb2.TeraFlowController.FromString,
response_serializer=context__pb2.AuthenticationResult.SerializeToString,
),
'LookUpSlice': grpc.unary_unary_rpc_method_handler(
servicer.LookUpSlice,
request_deserializer=context__pb2.Slice.FromString,
response_serializer=context__pb2.SliceId.SerializeToString,
),
'OrderSliceFromCatalog': grpc.unary_unary_rpc_method_handler(
servicer.OrderSliceFromCatalog,
request_deserializer=context__pb2.Slice.FromString,
response_serializer=context__pb2.Slice.SerializeToString,
),
'CreateSliceAndAddToCatalog': grpc.unary_unary_rpc_method_handler(
servicer.CreateSliceAndAddToCatalog,
request_deserializer=context__pb2.Slice.FromString,
response_serializer=context__pb2.Slice.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'interdomain.InterdomainService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class InterdomainService(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def RequestSlice(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, '/interdomain.InterdomainService/RequestSlice',
context__pb2.Slice.SerializeToString,
context__pb2.SliceId.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def Authenticate(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, '/interdomain.InterdomainService/Authenticate',
context__pb2.TeraFlowController.SerializeToString,
context__pb2.AuthenticationResult.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def LookUpSlice(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, '/interdomain.InterdomainService/LookUpSlice',
context__pb2.Slice.SerializeToString,
context__pb2.SliceId.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def OrderSliceFromCatalog(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, '/interdomain.InterdomainService/OrderSliceFromCatalog',
context__pb2.Slice.SerializeToString,
context__pb2.Slice.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def CreateSliceAndAddToCatalog(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, '/interdomain.InterdomainService/CreateSliceAndAddToCatalog',
context__pb2.Slice.SerializeToString,
context__pb2.Slice.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)
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: slice.proto
"""Generated protocol buffer code."""
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()
from . import context_pb2 as context__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='slice.proto',
package='slice',
syntax='proto3',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x0bslice.proto\x12\x05slice\x1a\rcontext.proto2\xa7\x01\n\x0cSliceService\x12\x31\n\x0b\x43reateSlice\x12\x0e.context.Slice\x1a\x10.context.SliceId\"\x00\x12\x31\n\x0bUpdateSlice\x12\x0e.context.Slice\x1a\x10.context.SliceId\"\x00\x12\x31\n\x0b\x44\x65leteSlice\x12\x10.context.SliceId\x1a\x0e.context.Empty\"\x00\x62\x06proto3'
,
dependencies=[context__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_SLICESERVICE = _descriptor.ServiceDescriptor(
name='SliceService',
full_name='slice.SliceService',
file=DESCRIPTOR,
index=0,
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_start=38,
serialized_end=205,
methods=[
_descriptor.MethodDescriptor(
name='CreateSlice',
full_name='slice.SliceService.CreateSlice',
index=0,
containing_service=None,
input_type=context__pb2._SLICE,
output_type=context__pb2._SLICEID,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='UpdateSlice',
full_name='slice.SliceService.UpdateSlice',
index=1,
containing_service=None,
input_type=context__pb2._SLICE,
output_type=context__pb2._SLICEID,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='DeleteSlice',
full_name='slice.SliceService.DeleteSlice',
index=2,
containing_service=None,
input_type=context__pb2._SLICEID,
output_type=context__pb2._EMPTY,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
])
_sym_db.RegisterServiceDescriptor(_SLICESERVICE)
DESCRIPTOR.services_by_name['SliceService'] = _SLICESERVICE
# @@protoc_insertion_point(module_scope)
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