Commit f2f95184 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Code Cleanup

parent c05075fe
Loading
Loading
Loading
Loading

src/interdomain/genproto.sh

deleted100755 → 0
+0 −52
Original line number Diff line number Diff line
#!/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

src/interdomain/proto/__init__.py

deleted100644 → 0
+0 −14
Original line number Diff line number Diff line
# 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.
+0 −3071

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −98
Original line number Diff line number Diff line
# -*- 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)
+0 −198
Original line number Diff line number Diff line
# 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)
Loading