diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 00000000..d2acacc5 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,36 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Continuous Integration + +on: + push: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + max-parallel: 1 + fail-fast: false + matrix: + python-version: [ "3.11" ] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + flake8 . + - name: Test with pytest + run: | + pytest diff --git a/.github/workflows/linting-for-all-versions.yml b/.github/workflows/linting-for-all-versions.yml new file mode 100644 index 00000000..b0f7e225 --- /dev/null +++ b/.github/workflows/linting-for-all-versions.yml @@ -0,0 +1,35 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Continuous Integration + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + max-parallel: 1 + fail-fast: false + matrix: + python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + flake8 . diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index 6a9d349b..00000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,38 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python package - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors, undefined names or other warnings - flake8 . - - name: Test with pytest - run: | - pytest diff --git a/.gitignore b/.gitignore index 980ae2ce..50311447 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,8 @@ venv *.log *.log.* .env -.pytest_cache \ No newline at end of file +.pytest_cache +/paho/ +/paho_mqtt-1.6.1.dist-info/ +/paho/ +/paho_mqtt-1.6.1.dist-info/ diff --git a/README.adoc b/README.adoc index a8a74271..81425962 100644 --- a/README.adoc +++ b/README.adoc @@ -6,42 +6,48 @@ [abstract] == Abstract -image::agrirouter.svg[agrirouter] -The agrirouter is a universal data exchange platform for farmers and agricultural contractors that makes it possible to connect machinery and agricultural software, regardless of vendor or manufacturer. Agrirouter does not save data; it transfers data. -As a universal data exchange platform, agrirouter fills a gap on the way to Farming 4.0. Its underlying concept unites cross-vendor and discrimination-free data transfer. You retain full control over your data. Even data exchange with service providers (e.g. agricultural contractors) and other partners is uncomplicated: Data are very rapidly transferred via the online connection, and if you wish, is intelligently connected to other datasets. +image::agrirouter.svg[agrirouter] +The agrirouter is a universal data exchange platform for farmers and agricultural contractors that makes it possible to connect machinery and agricultural software, regardless of vendor or manufacturer. +Agrirouter does not save data; it transfers data. +As a universal data exchange platform, agrirouter fills a gap on the way to Farming 4.0. Its underlying concept unites cross-vendor and discrimination-free data transfer. +You retain full control over your data. +Even data exchange with service providers (e.g. agricultural contractors) and other partners is uncomplicated: Data are very rapidly transferred via the online connection, and if you wish, is intelligently connected to other datasets. == The current project you're looking at -This project contains the SDK for the communication with the agrirouter. Everything you need for the onboard process, secure communication and much more. +This project contains the SDK for the communication with the agrirouter. +Everything you need for the onboard process, secure communication and much more. == Installation -The necessary dependencies are installed via `composer`. Just run the following command to add the SDK to your project. - - -`$ git clone https://github.com/DKE-Data/agrirouter-sdk-python.git` - -To install the SDK run the 'setup.py' script in the main directory (for a global install you will need to run this command with root privileges): - -`$ cd agrirouter-sdk-python` - -`$ virtualenv venv` - -`...` +Create your virtual environment using any kind of `conda` setup you would like to have. +The SDK is tested with Python 3.8, 3.9, 3.10 and 3.11. -`$ . venv/bin/activate` +[source,bash] +---- +conda create -n agrirouter-sdk-python python=3.8 +conda create -n agrirouter-sdk-python python=3.9 +conda create -n agrirouter-sdk-python python=3.10 +conda create -n agrirouter-sdk-python python=3.11 +---- -`$ python setup.py install` +Create one of the environments and activate it: -For more install options type: +[source,bash] +---- +conda activate agrirouter-sdk-python +---- -`$ python setup.py --help` +After the activation you are ready to install the requirements for the SDK: -== Requirements +[source,bash] +---- +pip install -r requirements.txt +---- -Python 3.6 or above is required. +You are able to select the virtual environment when working with the IDE. == Running unit tests diff --git a/agrirouter/__init__.py b/agrirouter/__init__.py index 019cff51..810c3163 100644 --- a/agrirouter/__init__.py +++ b/agrirouter/__init__.py @@ -1,17 +1,14 @@ from agrirouter.auth.auth import Authorization from agrirouter.auth.parameters import AuthUrlParameter - -from agrirouter.onboarding.onboarding import SoftwareOnboarding -from agrirouter.onboarding.parameters import SoftwareOnboardingParameter - -from agrirouter.revoking.revoking import Revoking -from agrirouter.revoking.parameters import RevokingParameter - from agrirouter.messaging.parameters.service import MessageHeaderParameters, MessagePayloadParameters, \ QueryMessageParameters, QueryHeaderParameters, CloudOffboardParameters, CloudOnboardParameters, \ - CapabilityParameters, FeedConfirmParameters, FeedDeleteParameters, ListEndpointsParameters, MessageParameters, \ + CapabilitiesParameters, FeedConfirmParameters, FeedDeleteParameters, ListEndpointsParameters, MessageParameters, \ SubscriptionParameters, ImageParameters, TaskParameters, EfdiParameters from agrirouter.messaging.services.cloud import CloudOnboardService, CloudOffboardService -from agrirouter.messaging.services.messaging import SubscriptionService, CapabilityService, FeedConfirmService,\ - FeedDeleteService, QueryHeaderService, QueryMessagesService, ListEndpointsService, ImageService, TaskService, EfdiTimelogService, EfdiTimelogPublishService, EfdiDeviceDscService - +from agrirouter.messaging.services.messaging import SubscriptionService, CapabilitiesService, FeedConfirmService, \ + FeedDeleteService, QueryHeaderService, QueryMessagesService, ListEndpointsService, SendChunkedMessageService, \ + ImageService, TaskService, EfdiTimelogService, EfdiTimelogPublishService, EfdiDeviceDscService +from agrirouter.onboarding.onboarding import SecuredOnboardingService, OnboardingService +from agrirouter.onboarding.parameters import OnboardParameters +from agrirouter.revoking.parameters import RevokingParameter +from agrirouter.revoking.revoking import Revoking diff --git a/agrirouter/constants/__init__.py b/agrirouter/api/__init__.py similarity index 100% rename from agrirouter/constants/__init__.py rename to agrirouter/api/__init__.py diff --git a/agrirouter/api/enums.py b/agrirouter/api/enums.py new file mode 100644 index 00000000..de6762f5 --- /dev/null +++ b/agrirouter/api/enums.py @@ -0,0 +1,32 @@ +from enum import Enum + + +class BaseEnum(Enum): + @classmethod + def choices(cls): + return [(key.value, key.name) for key in cls] + + @classmethod + def values_list(cls): + return [key.value for key in cls] + + +class ResponseTypes(BaseEnum): + VERIFY = "verify" + ONBOARD = "onboard" + + +class ContentTypes(BaseEnum): + APPLICATION_JSON = "application/json" + + +class Environments(BaseEnum): + PRODUCTION: str = "production" + QA: str = "qa" + + +class RequestHeaders(BaseEnum): + AUTHORIZATION: str = "Authorization" + X_AGRIROUTER_SIGNATURE: str = "X-Agrirouter-Signature" + CONTENT_TYPE: str = "Content-Type" + X_AGRIROUTER_APPLICATION_ID: str = "X-Agrirouter-ApplicationId" diff --git a/agrirouter/environments/environments.py b/agrirouter/api/environments.py similarity index 84% rename from agrirouter/environments/environments.py rename to agrirouter/api/environments.py index ac1f8202..0e03b8fc 100644 --- a/agrirouter/environments/environments.py +++ b/agrirouter/api/environments.py @@ -1,18 +1,16 @@ -from agrirouter.environments.keys import AR_QA_PUBLIC_KEY, AR_PROD_PUBLIC_KEY +from agrirouter.api.keys import AR_QA_PUBLIC_KEY, AR_PROD_PUBLIC_KEY class BaseEnvironment: - _AGRIROUTER_LOGIN_URL = "/app" + _LOGIN_URL = "/app" _MQTT_URL_TEMPLATE = "ssl://{host}:{port}" _SECURED_ONBOARDING_AUTHORIZATION_LINK_TEMPLATE = \ "/application/{application_id}/authorize" \ "?response_type={response_type}&state={state}" - _ENV_BASE_URL = "" _API_PREFIX = "" _REGISTRATION_SERVICE_URL = "" - - AR_PUBLIC_KEY = None + _AR_PUBLIC_KEY = None def get_base_url(self) -> str: return self._ENV_BASE_URL @@ -36,7 +34,7 @@ def get_revoke_url(self) -> str: return self.get_registration_service_url() + self.get_api_prefix() + "/registration/onboard/revoke" def get_agrirouter_login_url(self) -> str: - return self.get_base_url() + self._AGRIROUTER_LOGIN_URL + return self.get_base_url() + self._LOGIN_URL def get_secured_onboarding_authorization_url(self, application_id, response_type, state, redirect_uri=None) -> str: auth_url = self.get_base_url() + self._SECURED_ONBOARDING_AUTHORIZATION_LINK_TEMPLATE.format( @@ -50,20 +48,18 @@ def get_mqtt_server_url(self, host, port) -> str: return self._MQTT_URL_TEMPLATE.format(host=host, port=port) def get_env_public_key(self): - return self.AR_PUBLIC_KEY + return self._AR_PUBLIC_KEY -class ProductionEnvironment(BaseEnvironment): +class Production(BaseEnvironment): _ENV_BASE_URL = "https://goto.my-agrirouter.com" _API_PREFIX = "/api/v1.0" _REGISTRATION_SERVICE_URL = "https://onboard.my-agrirouter.com" + _AR_PUBLIC_KEY = AR_PROD_PUBLIC_KEY - #AR_PUBLIC_KEY = AR_PROD_PUBLIC_KEY - -class QAEnvironment(BaseEnvironment): +class QA(BaseEnvironment): _ENV_BASE_URL = "https://agrirouter-qa.cfapps.eu10.hana.ondemand.com" _API_PREFIX = "/api/v1.0" _REGISTRATION_SERVICE_URL = "https://agrirouter-registration-service-hubqa-eu10.cfapps.eu10.hana.ondemand.com" - - AR_PUBLIC_KEY = AR_QA_PUBLIC_KEY + _AR_PUBLIC_KEY = AR_QA_PUBLIC_KEY diff --git a/agrirouter/api/exceptions.py b/agrirouter/api/exceptions.py new file mode 100644 index 00000000..610fe2dd --- /dev/null +++ b/agrirouter/api/exceptions.py @@ -0,0 +1,68 @@ +class AgrirouterBaseException(Exception): + """ Base class for internal exceptions. """ + _message = ... + + def __init__(self, message=None): + """ Initialize the exception and define the message. """ + if not message: + message = self._message + self.message = message + + +class BadAuthResponse(AgrirouterBaseException): + _message = "Bad Response. Response could is not verified." + + +class InvalidEnvironmentSetup(AgrirouterBaseException): + _message = "Invalid value of env parameter. [QA] or [Production] values are allowed. " \ + "Please use environments.enums.Environments enum for configure environment properly" + + +class TypeUrlNotFound(AgrirouterBaseException): + _message = "Given type url not found" + + +class WrongField(AgrirouterBaseException): + _message = "Unknown field" + + +class CanNotDecodeMessage(AgrirouterBaseException): + _message = "Can't decode message" + + +class CanNotFetchOutboxMessage(AgrirouterBaseException): + _message = "Can't fetch outbox message" + + +class WrongCertificationType(AgrirouterBaseException): + """ Exception for wrong certification type. """ + _message = "Wrong Certification type. Use 'onboarding.enums.CertificationTypes' values instead." + + +class WrongGateWayType(AgrirouterBaseException): + """ Exception if there is wrong gateway Type. """ + _message = "Wrong Gate Way Id. Use onboarding.enums.GateWays values instead." + + +class RequestNotSigned(AgrirouterBaseException): + """ Exception if request is not signed correctly. """ + _message = """ + Request does not contain signature header. Please sign the request with request.sign() method.\n + Details on: https://docs.my-agrirouter.com/agrirouter-interface-documentation/latest/ + integration/onboarding.html#signing-requests + """ + + +class BadMessagingResult(AgrirouterBaseException): + """ Exception if the messaging result is not ok. """ + _message = "Messaging request failed" + + +class UnexpectedErrorDuringOnboarding(AgrirouterBaseException): + """ Exception if onboarding failed (most likely in case of an unexpected error). """ + _message = "Unexpected error during onboarding." + + +class MissingRegistrationCode(AgrirouterBaseException): + """ Exception if registration code is missing. """ + _message = "Registration code is required" diff --git a/agrirouter/environments/keys.py b/agrirouter/api/keys.py similarity index 100% rename from agrirouter/environments/keys.py rename to agrirouter/api/keys.py diff --git a/agrirouter/auth/auth.py b/agrirouter/auth/auth.py index b33527c0..ff32ea75 100644 --- a/agrirouter/auth/auth.py +++ b/agrirouter/auth/auth.py @@ -6,7 +6,6 @@ class Authorization(EnvironmentalService): - SIGNATURE_KEY = "signature" STATE_KEY = "state" TOKEN_KEY = "token" diff --git a/agrirouter/auth/dto.py b/agrirouter/auth/dto.py index 55d1bbbb..a70dbd36 100644 --- a/agrirouter/auth/dto.py +++ b/agrirouter/auth/dto.py @@ -1,7 +1,7 @@ import json from typing import Union -from agrirouter.messaging.exceptions import WrongFieldError +from agrirouter.api.exceptions import WrongField class AuthorizationToken: @@ -29,7 +29,7 @@ def json_deserialize(self, data: Union[str, dict]) -> None: elif key == self.EXPIRES: self.expires = value else: - raise WrongFieldError(f"Unknown field {key} for AuthorizationToken class") + raise WrongField(f"Unknown field {key} for AuthorizationToken class") def get_account(self) -> str: return self.account diff --git a/agrirouter/auth/enums.py b/agrirouter/auth/enums.py deleted file mode 100644 index e7d275c9..00000000 --- a/agrirouter/auth/enums.py +++ /dev/null @@ -1,16 +0,0 @@ -from enum import Enum - - -class BaseEnum(Enum): - @classmethod - def choices(cls): - return [(key.value, key.name) for key in cls] - - @classmethod - def values_list(cls): - return [key.value for key in cls] - - -class ResponseType(BaseEnum): - VERIFY = "verify" - ONBOARD = "onboard" diff --git a/agrirouter/auth/exceptions.py b/agrirouter/auth/exceptions.py deleted file mode 100644 index 106f9c20..00000000 --- a/agrirouter/auth/exceptions.py +++ /dev/null @@ -1,6 +0,0 @@ - -class BadAuthResponse(Exception): - def __init__(self, message=None): - if not message: - message = "Bad Response. Response could is not verified." - self.message = message diff --git a/agrirouter/auth/parameters.py b/agrirouter/auth/parameters.py index a7d9902d..ab513203 100644 --- a/agrirouter/auth/parameters.py +++ b/agrirouter/auth/parameters.py @@ -1,6 +1,6 @@ from uuid import uuid4 -from agrirouter.auth.enums import ResponseType +from agrirouter.api.enums import ResponseTypes class AuthUrlParameter: @@ -39,5 +39,5 @@ def generate_unique_state() -> str: @staticmethod def validate_response_type(response_type) -> None: - if response_type not in ResponseType.values_list(): + if response_type not in ResponseTypes.values_list(): raise ValueError("Invalid response_type parameter value.") diff --git a/agrirouter/auth/response.py b/agrirouter/auth/response.py index 9da72c3d..0464c2d7 100644 --- a/agrirouter/auth/response.py +++ b/agrirouter/auth/response.py @@ -3,10 +3,16 @@ from typing import Union from urllib.parse import unquote -#from cryptography.exceptions import InvalidSignature +from cryptography.exceptions import InvalidSignature from agrirouter.auth.dto import AuthorizationToken, AuthorizationResultUrl -#from agrirouter.onboarding.signature import verify_signature +from agrirouter.onboarding.signature import verify_signature + + +# from cryptography.exceptions import InvalidSignature + + +# from agrirouter.onboarding.signature import verify_signature class AuthResponse: @@ -34,28 +40,29 @@ def is_valid(self): return self._is_valid -# def verify(self, public_key) -> None: + def verify(self, public_key) -> None: """ Validates signature according to docs: https://docs.my-agrirouter.com/agrirouter-interface-documentation/latest/integration/authorization.html#analyse-result - + # If signature is not valid, all actions with AuthResponse instance - will fail with BadAuthResponse - + will fail with BadAuthResponse + # :return: """ -# encoded_data = self.state + self.token -# unquoted_signature = unquote(self.signature) -# encoded_signature = base64.b64decode(unquoted_signature.encode("utf-8")) - -# self._is_valid = True -# try: -# verify_signature(encoded_data, encoded_signature, public_key) -# except InvalidSignature: -# print("Response is invalid: invalid signature.") -# self._is_valid = False -# finally: -# self._was_verified = True + + encoded_data = self.state + self.token + unquoted_signature = unquote(self.signature) + encoded_signature = base64.b64decode(unquoted_signature.encode("utf-8")) + + self._is_valid = True + try: + verify_signature(encoded_data, encoded_signature, public_key) + except InvalidSignature: + print("Response is invalid: invalid signature.") + self._is_valid = False + finally: + self._was_verified = True @staticmethod def decode_token(token: Union[str, bytes]) -> AuthorizationToken: diff --git a/agrirouter/constants/media_types.py b/agrirouter/constants/media_types.py deleted file mode 100644 index 56d454f0..00000000 --- a/agrirouter/constants/media_types.py +++ /dev/null @@ -1,5 +0,0 @@ -from agrirouter.auth.enums import BaseEnum - - -class ContentTypes(BaseEnum): - APPLICATION_JSON = "application/json" diff --git a/agrirouter/environments/environmental_services.py b/agrirouter/environments/environmental_services.py index c502becd..eaed3fdb 100644 --- a/agrirouter/environments/environmental_services.py +++ b/agrirouter/environments/environmental_services.py @@ -1,15 +1,32 @@ -from agrirouter.environments.exceptions import InvalidEnvironmentSetup -from agrirouter.environments.environments import ProductionEnvironment, QAEnvironment +from agrirouter.api.enums import Environments +from agrirouter.api.exceptions import InvalidEnvironmentSetup +from agrirouter.api.environments import Production, QA class EnvironmentalService: - def __init__(self, env): + """ + A class that provides environmental services based on the provided environment value. + + Attributes: + - _environment (Environment): The current environment. + """ + + def __init__(self, env: str): self._set_env(env) def _set_env(self, env) -> None: - if env == "QA": - self._environment = QAEnvironment() - elif env == "Production": - self._environment = ProductionEnvironment() + """ + Sets the environment based on the provided value. + + Parameters: + - env (str): The desired environment value. Must be one of the following: `qa` or `production`. + + Raises: + - InvalidEnvironmentSetup: If the provided environment value is not valid. + """ + if env == Environments.QA.value: + self._environment = QA() + elif env == Environments.PRODUCTION.value: + self._environment = Production() else: - raise InvalidEnvironmentSetup(env=env) + raise InvalidEnvironmentSetup(f"Invalid environment value: {env}") diff --git a/agrirouter/environments/exceptions.py b/agrirouter/environments/exceptions.py deleted file mode 100644 index 6430b632..00000000 --- a/agrirouter/environments/exceptions.py +++ /dev/null @@ -1,11 +0,0 @@ - - -class InvalidEnvironmentSetup(Exception): - - def __init__(self, message=None, env=None): - if not message: - message = "Invalid value of env parameter. [QA] or [Production] values are allowed. " \ - "Please use environments.enums.Enviroments enum for configure environment properly" - - self.message = message - self.env = env diff --git a/agrirouter/generated/cloud_provider_integration/cloud_virtualized_app_registration_pb2.py b/agrirouter/generated/cloud_provider_integration/cloud_virtualized_app_registration_pb2.py index 2ce2e547..e37e87c5 100644 --- a/agrirouter/generated/cloud_provider_integration/cloud_virtualized_app_registration_pb2.py +++ b/agrirouter/generated/cloud_provider_integration/cloud_virtualized_app_registration_pb2.py @@ -6,262 +6,269 @@ 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 agrirouter.generated.commons import message_pb2 as commons_dot_message__pb2 - DESCRIPTOR = _descriptor.FileDescriptor( - name='cloud-provider-integration/cloud-virtualized-app-registration.proto', - package='agrirouter.cloud.registration', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\nCcloud-provider-integration/cloud-virtualized-app-registration.proto\x12\x1d\x61grirouter.cloud.registration\x1a\x15\x63ommons/message.proto\"\xb7\x01\n\x11OnboardingRequest\x12i\n\x13onboarding_requests\x18\x01 \x03(\x0b\x32L.agrirouter.cloud.registration.OnboardingRequest.EndpointRegistrationDetails\x1a\x37\n\x1b\x45ndpointRegistrationDetails\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\"\xaf\x03\n\x12OnboardingResponse\x12j\n\x13onboarded_endpoints\x18\x01 \x03(\x0b\x32M.agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails\x12L\n\x08\x66\x61ilures\x18\x02 \x03(\x0b\x32:.agrirouter.cloud.registration.OnboardingResponse.Failures\x1a\x99\x01\n\x1b\x45ndpointRegistrationDetails\x12\n\n\x02id\x18\x01 \x01(\t\x12\x1b\n\x13\x64\x65vice_alternate_id\x18\x02 \x01(\t\x12\x1b\n\x13sensor_alternate_id\x18\x03 \x01(\t\x12\x1f\n\x17\x63\x61pability_alternate_id\x18\x04 \x01(\t\x12\x13\n\x0b\x65ndpoint_id\x18\x05 \x01(\t\x1a\x43\n\x08\x46\x61ilures\x12\n\n\x02id\x18\x01 \x01(\t\x12+\n\x06reason\x18\x02 \x01(\x0b\x32\x1b.agrirouter.commons.Message\"\'\n\x12OffboardingRequest\x12\x11\n\tendpoints\x18\x01 \x03(\tb\x06proto3' - , - dependencies=[commons_dot_message__pb2.DESCRIPTOR,]) - - - + name='cloud-provider-integration/cloud-virtualized-app-registration.proto', + package='agrirouter.cloud.registration', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\nCcloud-provider-integration/cloud-virtualized-app-registration.proto\x12\x1d\x61grirouter.cloud.registration\x1a\x15\x63ommons/message.proto\"\xb7\x01\n\x11OnboardingRequest\x12i\n\x13onboarding_requests\x18\x01 \x03(\x0b\x32L.agrirouter.cloud.registration.OnboardingRequest.EndpointRegistrationDetails\x1a\x37\n\x1b\x45ndpointRegistrationDetails\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\"\xaf\x03\n\x12OnboardingResponse\x12j\n\x13onboarded_endpoints\x18\x01 \x03(\x0b\x32M.agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails\x12L\n\x08\x66\x61ilures\x18\x02 \x03(\x0b\x32:.agrirouter.cloud.registration.OnboardingResponse.Failures\x1a\x99\x01\n\x1b\x45ndpointRegistrationDetails\x12\n\n\x02id\x18\x01 \x01(\t\x12\x1b\n\x13\x64\x65vice_alternate_id\x18\x02 \x01(\t\x12\x1b\n\x13sensor_alternate_id\x18\x03 \x01(\t\x12\x1f\n\x17\x63\x61pability_alternate_id\x18\x04 \x01(\t\x12\x13\n\x0b\x65ndpoint_id\x18\x05 \x01(\t\x1a\x43\n\x08\x46\x61ilures\x12\n\n\x02id\x18\x01 \x01(\t\x12+\n\x06reason\x18\x02 \x01(\x0b\x32\x1b.agrirouter.commons.Message\"\'\n\x12OffboardingRequest\x12\x11\n\tendpoints\x18\x01 \x03(\tb\x06proto3' + , + dependencies=[commons_dot_message__pb2.DESCRIPTOR, ]) _ONBOARDINGREQUEST_ENDPOINTREGISTRATIONDETAILS = _descriptor.Descriptor( - name='EndpointRegistrationDetails', - full_name='agrirouter.cloud.registration.OnboardingRequest.EndpointRegistrationDetails', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='id', full_name='agrirouter.cloud.registration.OnboardingRequest.EndpointRegistrationDetails.id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='name', full_name='agrirouter.cloud.registration.OnboardingRequest.EndpointRegistrationDetails.name', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=254, - serialized_end=309, + name='EndpointRegistrationDetails', + full_name='agrirouter.cloud.registration.OnboardingRequest.EndpointRegistrationDetails', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='agrirouter.cloud.registration.OnboardingRequest.EndpointRegistrationDetails.id', + index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='name', full_name='agrirouter.cloud.registration.OnboardingRequest.EndpointRegistrationDetails.name', + index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=254, + serialized_end=309, ) _ONBOARDINGREQUEST = _descriptor.Descriptor( - name='OnboardingRequest', - full_name='agrirouter.cloud.registration.OnboardingRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='onboarding_requests', full_name='agrirouter.cloud.registration.OnboardingRequest.onboarding_requests', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_ONBOARDINGREQUEST_ENDPOINTREGISTRATIONDETAILS, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=126, - serialized_end=309, + name='OnboardingRequest', + full_name='agrirouter.cloud.registration.OnboardingRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='onboarding_requests', full_name='agrirouter.cloud.registration.OnboardingRequest.onboarding_requests', + index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_ONBOARDINGREQUEST_ENDPOINTREGISTRATIONDETAILS, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=126, + serialized_end=309, ) - _ONBOARDINGRESPONSE_ENDPOINTREGISTRATIONDETAILS = _descriptor.Descriptor( - name='EndpointRegistrationDetails', - full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='id', full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails.id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='device_alternate_id', full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails.device_alternate_id', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sensor_alternate_id', full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails.sensor_alternate_id', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='capability_alternate_id', full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails.capability_alternate_id', index=3, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='endpoint_id', full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails.endpoint_id', index=4, - number=5, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=521, - serialized_end=674, + name='EndpointRegistrationDetails', + full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails.id', + index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_alternate_id', + full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails.device_alternate_id', + index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sensor_alternate_id', + full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails.sensor_alternate_id', + index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='capability_alternate_id', + full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails.capability_alternate_id', + index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='endpoint_id', + full_name='agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails.endpoint_id', + index=4, + number=5, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=521, + serialized_end=674, ) _ONBOARDINGRESPONSE_FAILURES = _descriptor.Descriptor( - name='Failures', - full_name='agrirouter.cloud.registration.OnboardingResponse.Failures', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='id', full_name='agrirouter.cloud.registration.OnboardingResponse.Failures.id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='reason', full_name='agrirouter.cloud.registration.OnboardingResponse.Failures.reason', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=676, - serialized_end=743, + name='Failures', + full_name='agrirouter.cloud.registration.OnboardingResponse.Failures', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='agrirouter.cloud.registration.OnboardingResponse.Failures.id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='reason', full_name='agrirouter.cloud.registration.OnboardingResponse.Failures.reason', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=676, + serialized_end=743, ) _ONBOARDINGRESPONSE = _descriptor.Descriptor( - name='OnboardingResponse', - full_name='agrirouter.cloud.registration.OnboardingResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='onboarded_endpoints', full_name='agrirouter.cloud.registration.OnboardingResponse.onboarded_endpoints', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='failures', full_name='agrirouter.cloud.registration.OnboardingResponse.failures', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_ONBOARDINGRESPONSE_ENDPOINTREGISTRATIONDETAILS, _ONBOARDINGRESPONSE_FAILURES, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=312, - serialized_end=743, + name='OnboardingResponse', + full_name='agrirouter.cloud.registration.OnboardingResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='onboarded_endpoints', + full_name='agrirouter.cloud.registration.OnboardingResponse.onboarded_endpoints', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='failures', full_name='agrirouter.cloud.registration.OnboardingResponse.failures', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_ONBOARDINGRESPONSE_ENDPOINTREGISTRATIONDETAILS, _ONBOARDINGRESPONSE_FAILURES, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=312, + serialized_end=743, ) - _OFFBOARDINGREQUEST = _descriptor.Descriptor( - name='OffboardingRequest', - full_name='agrirouter.cloud.registration.OffboardingRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='endpoints', full_name='agrirouter.cloud.registration.OffboardingRequest.endpoints', index=0, - number=1, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=745, - serialized_end=784, + name='OffboardingRequest', + full_name='agrirouter.cloud.registration.OffboardingRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='endpoints', full_name='agrirouter.cloud.registration.OffboardingRequest.endpoints', index=0, + number=1, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=745, + serialized_end=784, ) _ONBOARDINGREQUEST_ENDPOINTREGISTRATIONDETAILS.containing_type = _ONBOARDINGREQUEST @@ -278,48 +285,49 @@ OnboardingRequest = _reflection.GeneratedProtocolMessageType('OnboardingRequest', (_message.Message,), { - 'EndpointRegistrationDetails' : _reflection.GeneratedProtocolMessageType('EndpointRegistrationDetails', (_message.Message,), { - 'DESCRIPTOR' : _ONBOARDINGREQUEST_ENDPOINTREGISTRATIONDETAILS, - '__module__' : 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OnboardingRequest.EndpointRegistrationDetails) - }) - , - 'DESCRIPTOR' : _ONBOARDINGREQUEST, - '__module__' : 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OnboardingRequest) - }) + 'EndpointRegistrationDetails': _reflection.GeneratedProtocolMessageType('EndpointRegistrationDetails', + (_message.Message,), { + 'DESCRIPTOR': _ONBOARDINGREQUEST_ENDPOINTREGISTRATIONDETAILS, + '__module__': 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OnboardingRequest.EndpointRegistrationDetails) + }) + , + 'DESCRIPTOR': _ONBOARDINGREQUEST, + '__module__': 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OnboardingRequest) +}) _sym_db.RegisterMessage(OnboardingRequest) _sym_db.RegisterMessage(OnboardingRequest.EndpointRegistrationDetails) OnboardingResponse = _reflection.GeneratedProtocolMessageType('OnboardingResponse', (_message.Message,), { - 'EndpointRegistrationDetails' : _reflection.GeneratedProtocolMessageType('EndpointRegistrationDetails', (_message.Message,), { - 'DESCRIPTOR' : _ONBOARDINGRESPONSE_ENDPOINTREGISTRATIONDETAILS, - '__module__' : 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails) - }) - , + 'EndpointRegistrationDetails': _reflection.GeneratedProtocolMessageType('EndpointRegistrationDetails', + (_message.Message,), { + 'DESCRIPTOR': _ONBOARDINGRESPONSE_ENDPOINTREGISTRATIONDETAILS, + '__module__': 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OnboardingResponse.EndpointRegistrationDetails) + }) + , - 'Failures' : _reflection.GeneratedProtocolMessageType('Failures', (_message.Message,), { - 'DESCRIPTOR' : _ONBOARDINGRESPONSE_FAILURES, - '__module__' : 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OnboardingResponse.Failures) + 'Failures': _reflection.GeneratedProtocolMessageType('Failures', (_message.Message,), { + 'DESCRIPTOR': _ONBOARDINGRESPONSE_FAILURES, + '__module__': 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OnboardingResponse.Failures) }) - , - 'DESCRIPTOR' : _ONBOARDINGRESPONSE, - '__module__' : 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OnboardingResponse) - }) + , + 'DESCRIPTOR': _ONBOARDINGRESPONSE, + '__module__': 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OnboardingResponse) +}) _sym_db.RegisterMessage(OnboardingResponse) _sym_db.RegisterMessage(OnboardingResponse.EndpointRegistrationDetails) _sym_db.RegisterMessage(OnboardingResponse.Failures) OffboardingRequest = _reflection.GeneratedProtocolMessageType('OffboardingRequest', (_message.Message,), { - 'DESCRIPTOR' : _OFFBOARDINGREQUEST, - '__module__' : 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OffboardingRequest) - }) + 'DESCRIPTOR': _OFFBOARDINGREQUEST, + '__module__': 'cloud_provider_integration.cloud_virtualized_app_registration_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.cloud.registration.OffboardingRequest) +}) _sym_db.RegisterMessage(OffboardingRequest) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/commons/chunk_pb2.py b/agrirouter/generated/commons/chunk_pb2.py index 005fddf2..ab080906 100644 --- a/agrirouter/generated/commons/chunk_pb2.py +++ b/agrirouter/generated/commons/chunk_pb2.py @@ -6,86 +6,80 @@ 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='commons/chunk.proto', - package='agrirouter.commons', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x13\x63ommons/chunk.proto\x12\x12\x61grirouter.commons\"X\n\x0e\x43hunkComponent\x12\x12\n\ncontext_id\x18\x01 \x01(\t\x12\x0f\n\x07\x63urrent\x18\x02 \x01(\x03\x12\r\n\x05total\x18\x03 \x01(\x03\x12\x12\n\ntotal_size\x18\x04 \x01(\x03\x62\x06proto3' + name='commons/chunk.proto', + package='agrirouter.commons', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x13\x63ommons/chunk.proto\x12\x12\x61grirouter.commons\"X\n\x0e\x43hunkComponent\x12\x12\n\ncontext_id\x18\x01 \x01(\t\x12\x0f\n\x07\x63urrent\x18\x02 \x01(\x03\x12\r\n\x05total\x18\x03 \x01(\x03\x12\x12\n\ntotal_size\x18\x04 \x01(\x03\x62\x06proto3' ) - - - _CHUNKCOMPONENT = _descriptor.Descriptor( - name='ChunkComponent', - full_name='agrirouter.commons.ChunkComponent', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='context_id', full_name='agrirouter.commons.ChunkComponent.context_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='current', full_name='agrirouter.commons.ChunkComponent.current', index=1, - number=2, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='total', full_name='agrirouter.commons.ChunkComponent.total', index=2, - number=3, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='total_size', full_name='agrirouter.commons.ChunkComponent.total_size', index=3, - number=4, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=43, - serialized_end=131, + name='ChunkComponent', + full_name='agrirouter.commons.ChunkComponent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='agrirouter.commons.ChunkComponent.context_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='current', full_name='agrirouter.commons.ChunkComponent.current', index=1, + number=2, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='total', full_name='agrirouter.commons.ChunkComponent.total', index=2, + number=3, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='total_size', full_name='agrirouter.commons.ChunkComponent.total_size', index=3, + number=4, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=43, + serialized_end=131, ) DESCRIPTOR.message_types_by_name['ChunkComponent'] = _CHUNKCOMPONENT _sym_db.RegisterFileDescriptor(DESCRIPTOR) ChunkComponent = _reflection.GeneratedProtocolMessageType('ChunkComponent', (_message.Message,), { - 'DESCRIPTOR' : _CHUNKCOMPONENT, - '__module__' : 'commons.chunk_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.commons.ChunkComponent) - }) + 'DESCRIPTOR': _CHUNKCOMPONENT, + '__module__': 'commons.chunk_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.commons.ChunkComponent) +}) _sym_db.RegisterMessage(ChunkComponent) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/commons/message_pb2.py b/agrirouter/generated/commons/message_pb2.py index 73433729..705c23a1 100644 --- a/agrirouter/generated/commons/message_pb2.py +++ b/agrirouter/generated/commons/message_pb2.py @@ -6,170 +6,163 @@ 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='commons/message.proto', - package='agrirouter.commons', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x15\x63ommons/message.proto\x12\x12\x61grirouter.commons\"\x92\x01\n\x07Message\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x14\n\x0cmessage_code\x18\x02 \x01(\t\x12\x33\n\x04\x61rgs\x18\x03 \x03(\x0b\x32%.agrirouter.commons.Message.ArgsEntry\x1a+\n\tArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\x1d\n\x08Metadata\x12\x11\n\tfile_name\x18\x01 \x01(\t\"9\n\x08Messages\x12-\n\x08messages\x18\x01 \x03(\x0b\x32\x1b.agrirouter.commons.Messageb\x06proto3' + name='commons/message.proto', + package='agrirouter.commons', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x15\x63ommons/message.proto\x12\x12\x61grirouter.commons\"\x92\x01\n\x07Message\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x14\n\x0cmessage_code\x18\x02 \x01(\t\x12\x33\n\x04\x61rgs\x18\x03 \x03(\x0b\x32%.agrirouter.commons.Message.ArgsEntry\x1a+\n\tArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\x1d\n\x08Metadata\x12\x11\n\tfile_name\x18\x01 \x01(\t\"9\n\x08Messages\x12-\n\x08messages\x18\x01 \x03(\x0b\x32\x1b.agrirouter.commons.Messageb\x06proto3' ) - - - _MESSAGE_ARGSENTRY = _descriptor.Descriptor( - name='ArgsEntry', - full_name='agrirouter.commons.Message.ArgsEntry', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='key', full_name='agrirouter.commons.Message.ArgsEntry.key', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='value', full_name='agrirouter.commons.Message.ArgsEntry.value', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=b'8\001', - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=149, - serialized_end=192, + name='ArgsEntry', + full_name='agrirouter.commons.Message.ArgsEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='agrirouter.commons.Message.ArgsEntry.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='value', full_name='agrirouter.commons.Message.ArgsEntry.value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=b'8\001', + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=149, + serialized_end=192, ) _MESSAGE = _descriptor.Descriptor( - name='Message', - full_name='agrirouter.commons.Message', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='message', full_name='agrirouter.commons.Message.message', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='message_code', full_name='agrirouter.commons.Message.message_code', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='args', full_name='agrirouter.commons.Message.args', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_MESSAGE_ARGSENTRY, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=46, - serialized_end=192, + name='Message', + full_name='agrirouter.commons.Message', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='message', full_name='agrirouter.commons.Message.message', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='message_code', full_name='agrirouter.commons.Message.message_code', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='args', full_name='agrirouter.commons.Message.args', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_MESSAGE_ARGSENTRY, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=46, + serialized_end=192, ) - _METADATA = _descriptor.Descriptor( - name='Metadata', - full_name='agrirouter.commons.Metadata', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='file_name', full_name='agrirouter.commons.Metadata.file_name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=194, - serialized_end=223, + name='Metadata', + full_name='agrirouter.commons.Metadata', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='file_name', full_name='agrirouter.commons.Metadata.file_name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=194, + serialized_end=223, ) - _MESSAGES = _descriptor.Descriptor( - name='Messages', - full_name='agrirouter.commons.Messages', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='messages', full_name='agrirouter.commons.Messages.messages', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=225, - serialized_end=282, + name='Messages', + full_name='agrirouter.commons.Messages', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='messages', full_name='agrirouter.commons.Messages.messages', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=225, + serialized_end=282, ) _MESSAGE_ARGSENTRY.containing_type = _MESSAGE @@ -182,33 +175,32 @@ Message = _reflection.GeneratedProtocolMessageType('Message', (_message.Message,), { - 'ArgsEntry' : _reflection.GeneratedProtocolMessageType('ArgsEntry', (_message.Message,), { - 'DESCRIPTOR' : _MESSAGE_ARGSENTRY, - '__module__' : 'commons.message_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.commons.Message.ArgsEntry) + 'ArgsEntry': _reflection.GeneratedProtocolMessageType('ArgsEntry', (_message.Message,), { + 'DESCRIPTOR': _MESSAGE_ARGSENTRY, + '__module__': 'commons.message_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.commons.Message.ArgsEntry) }) - , - 'DESCRIPTOR' : _MESSAGE, - '__module__' : 'commons.message_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.commons.Message) - }) + , + 'DESCRIPTOR': _MESSAGE, + '__module__': 'commons.message_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.commons.Message) +}) _sym_db.RegisterMessage(Message) _sym_db.RegisterMessage(Message.ArgsEntry) Metadata = _reflection.GeneratedProtocolMessageType('Metadata', (_message.Message,), { - 'DESCRIPTOR' : _METADATA, - '__module__' : 'commons.message_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.commons.Metadata) - }) + 'DESCRIPTOR': _METADATA, + '__module__': 'commons.message_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.commons.Metadata) +}) _sym_db.RegisterMessage(Metadata) Messages = _reflection.GeneratedProtocolMessageType('Messages', (_message.Message,), { - 'DESCRIPTOR' : _MESSAGES, - '__module__' : 'commons.message_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.commons.Messages) - }) + 'DESCRIPTOR': _MESSAGES, + '__module__': 'commons.message_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.commons.Messages) +}) _sym_db.RegisterMessage(Messages) - _MESSAGE_ARGSENTRY._options = None # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/messaging/request/payload/account/endpoints_pb2.py b/agrirouter/generated/messaging/request/payload/account/endpoints_pb2.py index 15313f5d..d0d9373f 100644 --- a/agrirouter/generated/messaging/request/payload/account/endpoints_pb2.py +++ b/agrirouter/generated/messaging/request/payload/account/endpoints_pb2.py @@ -6,92 +6,88 @@ 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='messaging/request/payload/account/endpoints.proto', - package='agrirouter.request.payload.account', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n1messaging/request/payload/account/endpoints.proto\x12\"agrirouter.request.payload.account\"\xbf\x01\n\x12ListEndpointsQuery\x12\x1e\n\x16technical_message_type\x18\x01 \x01(\t\x12S\n\tdirection\x18\x02 \x01(\x0e\x32@.agrirouter.request.payload.account.ListEndpointsQuery.Direction\"4\n\tDirection\x12\x08\n\x04SEND\x10\x00\x12\x0b\n\x07RECEIVE\x10\x01\x12\x10\n\x0cSEND_RECEIVE\x10\x02\x62\x06proto3' + name='messaging/request/payload/account/endpoints.proto', + package='agrirouter.request.payload.account', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n1messaging/request/payload/account/endpoints.proto\x12\"agrirouter.request.payload.account\"\xbf\x01\n\x12ListEndpointsQuery\x12\x1e\n\x16technical_message_type\x18\x01 \x01(\t\x12S\n\tdirection\x18\x02 \x01(\x0e\x32@.agrirouter.request.payload.account.ListEndpointsQuery.Direction\"4\n\tDirection\x12\x08\n\x04SEND\x10\x00\x12\x0b\n\x07RECEIVE\x10\x01\x12\x10\n\x0cSEND_RECEIVE\x10\x02\x62\x06proto3' ) - - _LISTENDPOINTSQUERY_DIRECTION = _descriptor.EnumDescriptor( - name='Direction', - full_name='agrirouter.request.payload.account.ListEndpointsQuery.Direction', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='SEND', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='RECEIVE', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEND_RECEIVE', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=229, - serialized_end=281, + name='Direction', + full_name='agrirouter.request.payload.account.ListEndpointsQuery.Direction', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='SEND', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RECEIVE', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SEND_RECEIVE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=229, + serialized_end=281, ) _sym_db.RegisterEnumDescriptor(_LISTENDPOINTSQUERY_DIRECTION) - _LISTENDPOINTSQUERY = _descriptor.Descriptor( - name='ListEndpointsQuery', - full_name='agrirouter.request.payload.account.ListEndpointsQuery', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='technical_message_type', full_name='agrirouter.request.payload.account.ListEndpointsQuery.technical_message_type', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='direction', full_name='agrirouter.request.payload.account.ListEndpointsQuery.direction', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _LISTENDPOINTSQUERY_DIRECTION, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=90, - serialized_end=281, + name='ListEndpointsQuery', + full_name='agrirouter.request.payload.account.ListEndpointsQuery', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='technical_message_type', + full_name='agrirouter.request.payload.account.ListEndpointsQuery.technical_message_type', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='direction', full_name='agrirouter.request.payload.account.ListEndpointsQuery.direction', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _LISTENDPOINTSQUERY_DIRECTION, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=90, + serialized_end=281, ) _LISTENDPOINTSQUERY.fields_by_name['direction'].enum_type = _LISTENDPOINTSQUERY_DIRECTION @@ -100,11 +96,10 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR) ListEndpointsQuery = _reflection.GeneratedProtocolMessageType('ListEndpointsQuery', (_message.Message,), { - 'DESCRIPTOR' : _LISTENDPOINTSQUERY, - '__module__' : 'messaging.request.payload.account.endpoints_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.request.payload.account.ListEndpointsQuery) - }) + 'DESCRIPTOR': _LISTENDPOINTSQUERY, + '__module__': 'messaging.request.payload.account.endpoints_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.request.payload.account.ListEndpointsQuery) +}) _sym_db.RegisterMessage(ListEndpointsQuery) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/messaging/request/payload/endpoint/capabilities_pb2.py b/agrirouter/generated/messaging/request/payload/endpoint/capabilities_pb2.py index a31856ca..e3139e87 100644 --- a/agrirouter/generated/messaging/request/payload/endpoint/capabilities_pb2.py +++ b/agrirouter/generated/messaging/request/payload/endpoint/capabilities_pb2.py @@ -6,181 +6,185 @@ 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='messaging/request/payload/endpoint/capabilities.proto', - package='agrirouter.request.payload.endpoint', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n5messaging/request/payload/endpoint/capabilities.proto\x12#agrirouter.request.payload.endpoint\"\xb9\x04\n\x17\x43\x61pabilitySpecification\x12]\n\x0c\x63\x61pabilities\x18\x01 \x03(\x0b\x32G.agrirouter.request.payload.endpoint.CapabilitySpecification.Capability\x12\x1c\n\x14\x61pp_certification_id\x18\x02 \x01(\t\x12$\n\x1c\x61pp_certification_version_id\x18\x03 \x01(\t\x12p\n\x19\x65nable_push_notifications\x18\x04 \x01(\x0e\x32M.agrirouter.request.payload.endpoint.CapabilitySpecification.PushNotification\x1a\x87\x01\n\nCapability\x12\x1e\n\x16technical_message_type\x18\x01 \x01(\t\x12Y\n\tdirection\x18\x02 \x01(\x0e\x32\x46.agrirouter.request.payload.endpoint.CapabilitySpecification.Direction\"4\n\tDirection\x12\x08\n\x04SEND\x10\x00\x12\x0b\n\x07RECEIVE\x10\x01\x12\x10\n\x0cSEND_RECEIVE\x10\x02\"I\n\x10PushNotification\x12\x0c\n\x08\x44ISABLED\x10\x00\x12\x0b\n\x07\x45NABLED\x10\x01\x12\x1a\n\x16\x45NABLED_HIGH_FREQUENCY\x10\x02\x62\x06proto3' + name='messaging/request/payload/endpoint/capabilities.proto', + package='agrirouter.request.payload.endpoint', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n5messaging/request/payload/endpoint/capabilities.proto\x12#agrirouter.request.payload.endpoint\"\xb9\x04\n\x17\x43\x61pabilitySpecification\x12]\n\x0c\x63\x61pabilities\x18\x01 \x03(\x0b\x32G.agrirouter.request.payload.endpoint.CapabilitySpecification.Capability\x12\x1c\n\x14\x61pp_certification_id\x18\x02 \x01(\t\x12$\n\x1c\x61pp_certification_version_id\x18\x03 \x01(\t\x12p\n\x19\x65nable_push_notifications\x18\x04 \x01(\x0e\x32M.agrirouter.request.payload.endpoint.CapabilitySpecification.PushNotification\x1a\x87\x01\n\nCapability\x12\x1e\n\x16technical_message_type\x18\x01 \x01(\t\x12Y\n\tdirection\x18\x02 \x01(\x0e\x32\x46.agrirouter.request.payload.endpoint.CapabilitySpecification.Direction\"4\n\tDirection\x12\x08\n\x04SEND\x10\x00\x12\x0b\n\x07RECEIVE\x10\x01\x12\x10\n\x0cSEND_RECEIVE\x10\x02\"I\n\x10PushNotification\x12\x0c\n\x08\x44ISABLED\x10\x00\x12\x0b\n\x07\x45NABLED\x10\x01\x12\x1a\n\x16\x45NABLED_HIGH_FREQUENCY\x10\x02\x62\x06proto3' ) - - _CAPABILITYSPECIFICATION_DIRECTION = _descriptor.EnumDescriptor( - name='Direction', - full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.Direction', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='SEND', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='RECEIVE', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEND_RECEIVE', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=537, - serialized_end=589, + name='Direction', + full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.Direction', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='SEND', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RECEIVE', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SEND_RECEIVE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=537, + serialized_end=589, ) _sym_db.RegisterEnumDescriptor(_CAPABILITYSPECIFICATION_DIRECTION) _CAPABILITYSPECIFICATION_PUSHNOTIFICATION = _descriptor.EnumDescriptor( - name='PushNotification', - full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.PushNotification', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='DISABLED', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ENABLED', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ENABLED_HIGH_FREQUENCY', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=591, - serialized_end=664, + name='PushNotification', + full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.PushNotification', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='DISABLED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ENABLED', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ENABLED_HIGH_FREQUENCY', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=591, + serialized_end=664, ) _sym_db.RegisterEnumDescriptor(_CAPABILITYSPECIFICATION_PUSHNOTIFICATION) - _CAPABILITYSPECIFICATION_CAPABILITY = _descriptor.Descriptor( - name='Capability', - full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.Capability', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='technical_message_type', full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.Capability.technical_message_type', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='direction', full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.Capability.direction', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=400, - serialized_end=535, + name='Capability', + full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.Capability', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='technical_message_type', + full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.Capability.technical_message_type', + index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='direction', + full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.Capability.direction', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=400, + serialized_end=535, ) _CAPABILITYSPECIFICATION = _descriptor.Descriptor( - name='CapabilitySpecification', - full_name='agrirouter.request.payload.endpoint.CapabilitySpecification', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='capabilities', full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.capabilities', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='app_certification_id', full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.app_certification_id', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='app_certification_version_id', full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.app_certification_version_id', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='enable_push_notifications', full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.enable_push_notifications', index=3, - number=4, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_CAPABILITYSPECIFICATION_CAPABILITY, ], - enum_types=[ - _CAPABILITYSPECIFICATION_DIRECTION, - _CAPABILITYSPECIFICATION_PUSHNOTIFICATION, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=95, - serialized_end=664, + name='CapabilitySpecification', + full_name='agrirouter.request.payload.endpoint.CapabilitySpecification', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='capabilities', full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.capabilities', + index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='app_certification_id', + full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.app_certification_id', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='app_certification_version_id', + full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.app_certification_version_id', + index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='enable_push_notifications', + full_name='agrirouter.request.payload.endpoint.CapabilitySpecification.enable_push_notifications', index=3, + number=4, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_CAPABILITYSPECIFICATION_CAPABILITY, ], + enum_types=[ + _CAPABILITYSPECIFICATION_DIRECTION, + _CAPABILITYSPECIFICATION_PUSHNOTIFICATION, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=95, + serialized_end=664, ) _CAPABILITYSPECIFICATION_CAPABILITY.fields_by_name['direction'].enum_type = _CAPABILITYSPECIFICATION_DIRECTION _CAPABILITYSPECIFICATION_CAPABILITY.containing_type = _CAPABILITYSPECIFICATION _CAPABILITYSPECIFICATION.fields_by_name['capabilities'].message_type = _CAPABILITYSPECIFICATION_CAPABILITY -_CAPABILITYSPECIFICATION.fields_by_name['enable_push_notifications'].enum_type = _CAPABILITYSPECIFICATION_PUSHNOTIFICATION +_CAPABILITYSPECIFICATION.fields_by_name[ + 'enable_push_notifications'].enum_type = _CAPABILITYSPECIFICATION_PUSHNOTIFICATION _CAPABILITYSPECIFICATION_DIRECTION.containing_type = _CAPABILITYSPECIFICATION _CAPABILITYSPECIFICATION_PUSHNOTIFICATION.containing_type = _CAPABILITYSPECIFICATION DESCRIPTOR.message_types_by_name['CapabilitySpecification'] = _CAPABILITYSPECIFICATION @@ -188,18 +192,17 @@ CapabilitySpecification = _reflection.GeneratedProtocolMessageType('CapabilitySpecification', (_message.Message,), { - 'Capability' : _reflection.GeneratedProtocolMessageType('Capability', (_message.Message,), { - 'DESCRIPTOR' : _CAPABILITYSPECIFICATION_CAPABILITY, - '__module__' : 'messaging.request.payload.endpoint.capabilities_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.request.payload.endpoint.CapabilitySpecification.Capability) + 'Capability': _reflection.GeneratedProtocolMessageType('Capability', (_message.Message,), { + 'DESCRIPTOR': _CAPABILITYSPECIFICATION_CAPABILITY, + '__module__': 'messaging.request.payload.endpoint.capabilities_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.request.payload.endpoint.CapabilitySpecification.Capability) }) - , - 'DESCRIPTOR' : _CAPABILITYSPECIFICATION, - '__module__' : 'messaging.request.payload.endpoint.capabilities_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.request.payload.endpoint.CapabilitySpecification) - }) + , + 'DESCRIPTOR': _CAPABILITYSPECIFICATION, + '__module__': 'messaging.request.payload.endpoint.capabilities_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.request.payload.endpoint.CapabilitySpecification) +}) _sym_db.RegisterMessage(CapabilitySpecification) _sym_db.RegisterMessage(CapabilitySpecification.Capability) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/messaging/request/payload/endpoint/subscription_pb2.py b/agrirouter/generated/messaging/request/payload/endpoint/subscription_pb2.py index fa456a6f..a786bd8c 100644 --- a/agrirouter/generated/messaging/request/payload/endpoint/subscription_pb2.py +++ b/agrirouter/generated/messaging/request/payload/endpoint/subscription_pb2.py @@ -6,99 +6,99 @@ 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='messaging/request/payload/endpoint/subscription.proto', - package='agrirouter.request.payload.endpoint', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n5messaging/request/payload/endpoint/subscription.proto\x12#agrirouter.request.payload.endpoint\"\xdd\x01\n\x0cSubscription\x12n\n\x17technical_message_types\x18\x01 \x03(\x0b\x32M.agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem\x1a]\n\x1bMessageTypeSubscriptionItem\x12\x1e\n\x16technical_message_type\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x64is\x18\x02 \x03(\r\x12\x10\n\x08position\x18\x03 \x01(\x08\x62\x06proto3' + name='messaging/request/payload/endpoint/subscription.proto', + package='agrirouter.request.payload.endpoint', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n5messaging/request/payload/endpoint/subscription.proto\x12#agrirouter.request.payload.endpoint\"\xdd\x01\n\x0cSubscription\x12n\n\x17technical_message_types\x18\x01 \x03(\x0b\x32M.agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem\x1a]\n\x1bMessageTypeSubscriptionItem\x12\x1e\n\x16technical_message_type\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x64is\x18\x02 \x03(\r\x12\x10\n\x08position\x18\x03 \x01(\x08\x62\x06proto3' ) - - - _SUBSCRIPTION_MESSAGETYPESUBSCRIPTIONITEM = _descriptor.Descriptor( - name='MessageTypeSubscriptionItem', - full_name='agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='technical_message_type', full_name='agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem.technical_message_type', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='ddis', full_name='agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem.ddis', index=1, - number=2, type=13, cpp_type=3, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='position', full_name='agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem.position', index=2, - number=3, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=223, - serialized_end=316, + name='MessageTypeSubscriptionItem', + full_name='agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='technical_message_type', + full_name='agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem.technical_message_type', + index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='ddis', full_name='agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem.ddis', + index=1, + number=2, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='position', + full_name='agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem.position', index=2, + number=3, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=223, + serialized_end=316, ) _SUBSCRIPTION = _descriptor.Descriptor( - name='Subscription', - full_name='agrirouter.request.payload.endpoint.Subscription', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='technical_message_types', full_name='agrirouter.request.payload.endpoint.Subscription.technical_message_types', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_SUBSCRIPTION_MESSAGETYPESUBSCRIPTIONITEM, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=95, - serialized_end=316, + name='Subscription', + full_name='agrirouter.request.payload.endpoint.Subscription', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='technical_message_types', + full_name='agrirouter.request.payload.endpoint.Subscription.technical_message_types', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_SUBSCRIPTION_MESSAGETYPESUBSCRIPTIONITEM, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=95, + serialized_end=316, ) _SUBSCRIPTION_MESSAGETYPESUBSCRIPTIONITEM.containing_type = _SUBSCRIPTION @@ -108,18 +108,18 @@ Subscription = _reflection.GeneratedProtocolMessageType('Subscription', (_message.Message,), { - 'MessageTypeSubscriptionItem' : _reflection.GeneratedProtocolMessageType('MessageTypeSubscriptionItem', (_message.Message,), { - 'DESCRIPTOR' : _SUBSCRIPTION_MESSAGETYPESUBSCRIPTIONITEM, - '__module__' : 'messaging.request.payload.endpoint.subscription_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem) - }) - , - 'DESCRIPTOR' : _SUBSCRIPTION, - '__module__' : 'messaging.request.payload.endpoint.subscription_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.request.payload.endpoint.Subscription) - }) + 'MessageTypeSubscriptionItem': _reflection.GeneratedProtocolMessageType('MessageTypeSubscriptionItem', + (_message.Message,), { + 'DESCRIPTOR': _SUBSCRIPTION_MESSAGETYPESUBSCRIPTIONITEM, + '__module__': 'messaging.request.payload.endpoint.subscription_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.request.payload.endpoint.Subscription.MessageTypeSubscriptionItem) + }) + , + 'DESCRIPTOR': _SUBSCRIPTION, + '__module__': 'messaging.request.payload.endpoint.subscription_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.request.payload.endpoint.Subscription) +}) _sym_db.RegisterMessage(Subscription) _sym_db.RegisterMessage(Subscription.MessageTypeSubscriptionItem) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/messaging/request/payload/feed/feed_requests_pb2.py b/agrirouter/generated/messaging/request/payload/feed/feed_requests_pb2.py index 54c4b0df..fbd1de8d 100644 --- a/agrirouter/generated/messaging/request/payload/feed/feed_requests_pb2.py +++ b/agrirouter/generated/messaging/request/payload/feed/feed_requests_pb2.py @@ -6,187 +6,180 @@ 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 google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 - DESCRIPTOR = _descriptor.FileDescriptor( - name='messaging/request/payload/feed/feed-requests.proto', - package='agrirouter.feed.request', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n2messaging/request/payload/feed/feed-requests.proto\x12\x17\x61grirouter.feed.request\x1a\x1fgoogle/protobuf/timestamp.proto\"l\n\x0eValidityPeriod\x12-\n\tsent_from\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\x07sent_to\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"v\n\x0cMessageQuery\x12\x13\n\x0bmessage_ids\x18\x01 \x03(\t\x12\x0f\n\x07senders\x18\x02 \x03(\t\x12@\n\x0fvalidity_period\x18\x03 \x01(\x0b\x32\'.agrirouter.feed.request.ValidityPeriod\"%\n\x0eMessageConfirm\x12\x13\n\x0bmessage_ids\x18\x01 \x03(\t\"w\n\rMessageDelete\x12\x13\n\x0bmessage_ids\x18\x01 \x03(\t\x12\x0f\n\x07senders\x18\x02 \x03(\t\x12@\n\x0fvalidity_period\x18\x03 \x01(\x0b\x32\'.agrirouter.feed.request.ValidityPeriodb\x06proto3' - , - dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) - - - + name='messaging/request/payload/feed/feed-requests.proto', + package='agrirouter.feed.request', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n2messaging/request/payload/feed/feed-requests.proto\x12\x17\x61grirouter.feed.request\x1a\x1fgoogle/protobuf/timestamp.proto\"l\n\x0eValidityPeriod\x12-\n\tsent_from\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\x07sent_to\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"v\n\x0cMessageQuery\x12\x13\n\x0bmessage_ids\x18\x01 \x03(\t\x12\x0f\n\x07senders\x18\x02 \x03(\t\x12@\n\x0fvalidity_period\x18\x03 \x01(\x0b\x32\'.agrirouter.feed.request.ValidityPeriod\"%\n\x0eMessageConfirm\x12\x13\n\x0bmessage_ids\x18\x01 \x03(\t\"w\n\rMessageDelete\x12\x13\n\x0bmessage_ids\x18\x01 \x03(\t\x12\x0f\n\x07senders\x18\x02 \x03(\t\x12@\n\x0fvalidity_period\x18\x03 \x01(\x0b\x32\'.agrirouter.feed.request.ValidityPeriodb\x06proto3' + , + dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, ]) _VALIDITYPERIOD = _descriptor.Descriptor( - name='ValidityPeriod', - full_name='agrirouter.feed.request.ValidityPeriod', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='sent_from', full_name='agrirouter.feed.request.ValidityPeriod.sent_from', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sent_to', full_name='agrirouter.feed.request.ValidityPeriod.sent_to', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=112, - serialized_end=220, + name='ValidityPeriod', + full_name='agrirouter.feed.request.ValidityPeriod', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='sent_from', full_name='agrirouter.feed.request.ValidityPeriod.sent_from', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sent_to', full_name='agrirouter.feed.request.ValidityPeriod.sent_to', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=112, + serialized_end=220, ) - _MESSAGEQUERY = _descriptor.Descriptor( - name='MessageQuery', - full_name='agrirouter.feed.request.MessageQuery', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='message_ids', full_name='agrirouter.feed.request.MessageQuery.message_ids', index=0, - number=1, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='senders', full_name='agrirouter.feed.request.MessageQuery.senders', index=1, - number=2, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='validity_period', full_name='agrirouter.feed.request.MessageQuery.validity_period', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=222, - serialized_end=340, + name='MessageQuery', + full_name='agrirouter.feed.request.MessageQuery', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='message_ids', full_name='agrirouter.feed.request.MessageQuery.message_ids', index=0, + number=1, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='senders', full_name='agrirouter.feed.request.MessageQuery.senders', index=1, + number=2, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='validity_period', full_name='agrirouter.feed.request.MessageQuery.validity_period', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=222, + serialized_end=340, ) - _MESSAGECONFIRM = _descriptor.Descriptor( - name='MessageConfirm', - full_name='agrirouter.feed.request.MessageConfirm', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='message_ids', full_name='agrirouter.feed.request.MessageConfirm.message_ids', index=0, - number=1, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=342, - serialized_end=379, + name='MessageConfirm', + full_name='agrirouter.feed.request.MessageConfirm', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='message_ids', full_name='agrirouter.feed.request.MessageConfirm.message_ids', index=0, + number=1, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=342, + serialized_end=379, ) - _MESSAGEDELETE = _descriptor.Descriptor( - name='MessageDelete', - full_name='agrirouter.feed.request.MessageDelete', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='message_ids', full_name='agrirouter.feed.request.MessageDelete.message_ids', index=0, - number=1, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='senders', full_name='agrirouter.feed.request.MessageDelete.senders', index=1, - number=2, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='validity_period', full_name='agrirouter.feed.request.MessageDelete.validity_period', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=381, - serialized_end=500, + name='MessageDelete', + full_name='agrirouter.feed.request.MessageDelete', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='message_ids', full_name='agrirouter.feed.request.MessageDelete.message_ids', index=0, + number=1, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='senders', full_name='agrirouter.feed.request.MessageDelete.senders', index=1, + number=2, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='validity_period', full_name='agrirouter.feed.request.MessageDelete.validity_period', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=381, + serialized_end=500, ) _VALIDITYPERIOD.fields_by_name['sent_from'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP @@ -200,32 +193,31 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR) ValidityPeriod = _reflection.GeneratedProtocolMessageType('ValidityPeriod', (_message.Message,), { - 'DESCRIPTOR' : _VALIDITYPERIOD, - '__module__' : 'messaging.request.payload.feed.feed_requests_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.request.ValidityPeriod) - }) + 'DESCRIPTOR': _VALIDITYPERIOD, + '__module__': 'messaging.request.payload.feed.feed_requests_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.request.ValidityPeriod) +}) _sym_db.RegisterMessage(ValidityPeriod) MessageQuery = _reflection.GeneratedProtocolMessageType('MessageQuery', (_message.Message,), { - 'DESCRIPTOR' : _MESSAGEQUERY, - '__module__' : 'messaging.request.payload.feed.feed_requests_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.request.MessageQuery) - }) + 'DESCRIPTOR': _MESSAGEQUERY, + '__module__': 'messaging.request.payload.feed.feed_requests_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.request.MessageQuery) +}) _sym_db.RegisterMessage(MessageQuery) MessageConfirm = _reflection.GeneratedProtocolMessageType('MessageConfirm', (_message.Message,), { - 'DESCRIPTOR' : _MESSAGECONFIRM, - '__module__' : 'messaging.request.payload.feed.feed_requests_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.request.MessageConfirm) - }) + 'DESCRIPTOR': _MESSAGECONFIRM, + '__module__': 'messaging.request.payload.feed.feed_requests_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.request.MessageConfirm) +}) _sym_db.RegisterMessage(MessageConfirm) MessageDelete = _reflection.GeneratedProtocolMessageType('MessageDelete', (_message.Message,), { - 'DESCRIPTOR' : _MESSAGEDELETE, - '__module__' : 'messaging.request.payload.feed.feed_requests_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.request.MessageDelete) - }) + 'DESCRIPTOR': _MESSAGEDELETE, + '__module__': 'messaging.request.payload.feed.feed_requests_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.request.MessageDelete) +}) _sym_db.RegisterMessage(MessageDelete) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/messaging/request/request_pb2.py b/agrirouter/generated/messaging/request/request_pb2.py index b193bf57..62c9adf6 100644 --- a/agrirouter/generated/messaging/request/request_pb2.py +++ b/agrirouter/generated/messaging/request/request_pb2.py @@ -6,178 +6,177 @@ 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 google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 from agrirouter.generated.commons import chunk_pb2 as commons_dot_chunk__pb2 from agrirouter.generated.commons import message_pb2 as commons_dot_message__pb2 - DESCRIPTOR = _descriptor.FileDescriptor( - name='messaging/request/request.proto', - package='agrirouter.request', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x1fmessaging/request/request.proto\x12\x12\x61grirouter.request\x1a\x19google/protobuf/any.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13\x63ommons/chunk.proto\x1a\x15\x63ommons/message.proto\"\xaf\x03\n\x0fRequestEnvelope\x12\x1e\n\x16\x61pplication_message_id\x18\x01 \x01(\t\x12\"\n\x1a\x61pplication_message_seq_no\x18\x02 \x01(\x03\x12\x1e\n\x16technical_message_type\x18\x03 \x01(\t\x12\x1b\n\x13team_set_context_id\x18\x04 \x01(\t\x12\x36\n\x04mode\x18\x05 \x01(\x0e\x32(.agrirouter.request.RequestEnvelope.Mode\x12\x12\n\nrecipients\x18\x06 \x03(\t\x12\x36\n\nchunk_info\x18\x07 \x01(\x0b\x32\".agrirouter.commons.ChunkComponent\x12-\n\ttimestamp\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\x08metadata\x18\t \x01(\x0b\x32\x1c.agrirouter.commons.Metadata\"8\n\x04Mode\x12\n\n\x06\x44IRECT\x10\x00\x12\x0b\n\x07PUBLISH\x10\x01\x12\x17\n\x13PUBLISH_WITH_DIRECT\x10\x02\">\n\x15RequestPayloadWrapper\x12%\n\x07\x64\x65tails\x18\x01 \x01(\x0b\x32\x14.google.protobuf.Anyb\x06proto3' - , - dependencies=[google_dot_protobuf_dot_any__pb2.DESCRIPTOR,google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,commons_dot_chunk__pb2.DESCRIPTOR,commons_dot_message__pb2.DESCRIPTOR,]) - - + name='messaging/request/request.proto', + package='agrirouter.request', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x1fmessaging/request/request.proto\x12\x12\x61grirouter.request\x1a\x19google/protobuf/any.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13\x63ommons/chunk.proto\x1a\x15\x63ommons/message.proto\"\xaf\x03\n\x0fRequestEnvelope\x12\x1e\n\x16\x61pplication_message_id\x18\x01 \x01(\t\x12\"\n\x1a\x61pplication_message_seq_no\x18\x02 \x01(\x03\x12\x1e\n\x16technical_message_type\x18\x03 \x01(\t\x12\x1b\n\x13team_set_context_id\x18\x04 \x01(\t\x12\x36\n\x04mode\x18\x05 \x01(\x0e\x32(.agrirouter.request.RequestEnvelope.Mode\x12\x12\n\nrecipients\x18\x06 \x03(\t\x12\x36\n\nchunk_info\x18\x07 \x01(\x0b\x32\".agrirouter.commons.ChunkComponent\x12-\n\ttimestamp\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\x08metadata\x18\t \x01(\x0b\x32\x1c.agrirouter.commons.Metadata\"8\n\x04Mode\x12\n\n\x06\x44IRECT\x10\x00\x12\x0b\n\x07PUBLISH\x10\x01\x12\x17\n\x13PUBLISH_WITH_DIRECT\x10\x02\">\n\x15RequestPayloadWrapper\x12%\n\x07\x64\x65tails\x18\x01 \x01(\x0b\x32\x14.google.protobuf.Anyb\x06proto3' + , + dependencies=[google_dot_protobuf_dot_any__pb2.DESCRIPTOR, google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, + commons_dot_chunk__pb2.DESCRIPTOR, commons_dot_message__pb2.DESCRIPTOR, ]) _REQUESTENVELOPE_MODE = _descriptor.EnumDescriptor( - name='Mode', - full_name='agrirouter.request.RequestEnvelope.Mode', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='DIRECT', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='PUBLISH', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='PUBLISH_WITH_DIRECT', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=535, - serialized_end=591, + name='Mode', + full_name='agrirouter.request.RequestEnvelope.Mode', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='DIRECT', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='PUBLISH', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='PUBLISH_WITH_DIRECT', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=535, + serialized_end=591, ) _sym_db.RegisterEnumDescriptor(_REQUESTENVELOPE_MODE) - _REQUESTENVELOPE = _descriptor.Descriptor( - name='RequestEnvelope', - full_name='agrirouter.request.RequestEnvelope', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='application_message_id', full_name='agrirouter.request.RequestEnvelope.application_message_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='application_message_seq_no', full_name='agrirouter.request.RequestEnvelope.application_message_seq_no', index=1, - number=2, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='technical_message_type', full_name='agrirouter.request.RequestEnvelope.technical_message_type', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='team_set_context_id', full_name='agrirouter.request.RequestEnvelope.team_set_context_id', index=3, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='mode', full_name='agrirouter.request.RequestEnvelope.mode', index=4, - number=5, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='recipients', full_name='agrirouter.request.RequestEnvelope.recipients', index=5, - number=6, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='chunk_info', full_name='agrirouter.request.RequestEnvelope.chunk_info', index=6, - number=7, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='timestamp', full_name='agrirouter.request.RequestEnvelope.timestamp', index=7, - number=8, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metadata', full_name='agrirouter.request.RequestEnvelope.metadata', index=8, - number=9, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _REQUESTENVELOPE_MODE, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=160, - serialized_end=591, + name='RequestEnvelope', + full_name='agrirouter.request.RequestEnvelope', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='application_message_id', full_name='agrirouter.request.RequestEnvelope.application_message_id', + index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='application_message_seq_no', + full_name='agrirouter.request.RequestEnvelope.application_message_seq_no', index=1, + number=2, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='technical_message_type', full_name='agrirouter.request.RequestEnvelope.technical_message_type', + index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='team_set_context_id', full_name='agrirouter.request.RequestEnvelope.team_set_context_id', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='mode', full_name='agrirouter.request.RequestEnvelope.mode', index=4, + number=5, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='recipients', full_name='agrirouter.request.RequestEnvelope.recipients', index=5, + number=6, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='chunk_info', full_name='agrirouter.request.RequestEnvelope.chunk_info', index=6, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='timestamp', full_name='agrirouter.request.RequestEnvelope.timestamp', index=7, + number=8, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='agrirouter.request.RequestEnvelope.metadata', index=8, + number=9, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _REQUESTENVELOPE_MODE, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=160, + serialized_end=591, ) - _REQUESTPAYLOADWRAPPER = _descriptor.Descriptor( - name='RequestPayloadWrapper', - full_name='agrirouter.request.RequestPayloadWrapper', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='details', full_name='agrirouter.request.RequestPayloadWrapper.details', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=593, - serialized_end=655, + name='RequestPayloadWrapper', + full_name='agrirouter.request.RequestPayloadWrapper', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='details', full_name='agrirouter.request.RequestPayloadWrapper.details', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=593, + serialized_end=655, ) _REQUESTENVELOPE.fields_by_name['mode'].enum_type = _REQUESTENVELOPE_MODE @@ -191,18 +190,17 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR) RequestEnvelope = _reflection.GeneratedProtocolMessageType('RequestEnvelope', (_message.Message,), { - 'DESCRIPTOR' : _REQUESTENVELOPE, - '__module__' : 'messaging.request.request_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.request.RequestEnvelope) - }) + 'DESCRIPTOR': _REQUESTENVELOPE, + '__module__': 'messaging.request.request_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.request.RequestEnvelope) +}) _sym_db.RegisterMessage(RequestEnvelope) RequestPayloadWrapper = _reflection.GeneratedProtocolMessageType('RequestPayloadWrapper', (_message.Message,), { - 'DESCRIPTOR' : _REQUESTPAYLOADWRAPPER, - '__module__' : 'messaging.request.request_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.request.RequestPayloadWrapper) - }) + 'DESCRIPTOR': _REQUESTPAYLOADWRAPPER, + '__module__': 'messaging.request.request_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.request.RequestPayloadWrapper) +}) _sym_db.RegisterMessage(RequestPayloadWrapper) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/messaging/response/payload/account/endpoints_pb2.py b/agrirouter/generated/messaging/response/payload/account/endpoints_pb2.py index d0f870b5..4b4ec2bd 100644 --- a/agrirouter/generated/messaging/response/payload/account/endpoints_pb2.py +++ b/agrirouter/generated/messaging/response/payload/account/endpoints_pb2.py @@ -6,189 +6,193 @@ 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='messaging/response/payload/account/endpoints.proto', - package='agrirouter.response.payload.account', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n2messaging/response/payload/account/endpoints.proto\x12#agrirouter.response.payload.account\"\x82\x04\n\x15ListEndpointsResponse\x12V\n\tendpoints\x18\x01 \x03(\x0b\x32\x43.agrirouter.response.payload.account.ListEndpointsResponse.Endpoint\x1a\x86\x01\n\x0bMessageType\x12\x1e\n\x16technical_message_type\x18\x01 \x01(\t\x12W\n\tdirection\x18\x02 \x01(\x0e\x32\x44.agrirouter.response.payload.account.ListEndpointsResponse.Direction\x1a\xd1\x01\n\x08\x45ndpoint\x12\x13\n\x0b\x65ndpoint_id\x18\x01 \x01(\t\x12\x15\n\rendpoint_name\x18\x02 \x01(\t\x12\x15\n\rendpoint_type\x18\x03 \x01(\t\x12\x0e\n\x06status\x18\x04 \x01(\t\x12]\n\rmessage_types\x18\x05 \x03(\x0b\x32\x46.agrirouter.response.payload.account.ListEndpointsResponse.MessageType\x12\x13\n\x0b\x65xternal_id\x18\x06 \x01(\t\"4\n\tDirection\x12\x08\n\x04SEND\x10\x00\x12\x0b\n\x07RECEIVE\x10\x01\x12\x10\n\x0cSEND_RECEIVE\x10\x02\x62\x06proto3' + name='messaging/response/payload/account/endpoints.proto', + package='agrirouter.response.payload.account', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n2messaging/response/payload/account/endpoints.proto\x12#agrirouter.response.payload.account\"\x82\x04\n\x15ListEndpointsResponse\x12V\n\tendpoints\x18\x01 \x03(\x0b\x32\x43.agrirouter.response.payload.account.ListEndpointsResponse.Endpoint\x1a\x86\x01\n\x0bMessageType\x12\x1e\n\x16technical_message_type\x18\x01 \x01(\t\x12W\n\tdirection\x18\x02 \x01(\x0e\x32\x44.agrirouter.response.payload.account.ListEndpointsResponse.Direction\x1a\xd1\x01\n\x08\x45ndpoint\x12\x13\n\x0b\x65ndpoint_id\x18\x01 \x01(\t\x12\x15\n\rendpoint_name\x18\x02 \x01(\t\x12\x15\n\rendpoint_type\x18\x03 \x01(\t\x12\x0e\n\x06status\x18\x04 \x01(\t\x12]\n\rmessage_types\x18\x05 \x03(\x0b\x32\x46.agrirouter.response.payload.account.ListEndpointsResponse.MessageType\x12\x13\n\x0b\x65xternal_id\x18\x06 \x01(\t\"4\n\tDirection\x12\x08\n\x04SEND\x10\x00\x12\x0b\n\x07RECEIVE\x10\x01\x12\x10\n\x0cSEND_RECEIVE\x10\x02\x62\x06proto3' ) - - _LISTENDPOINTSRESPONSE_DIRECTION = _descriptor.EnumDescriptor( - name='Direction', - full_name='agrirouter.response.payload.account.ListEndpointsResponse.Direction', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='SEND', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='RECEIVE', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEND_RECEIVE', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=554, - serialized_end=606, + name='Direction', + full_name='agrirouter.response.payload.account.ListEndpointsResponse.Direction', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='SEND', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RECEIVE', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SEND_RECEIVE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=554, + serialized_end=606, ) _sym_db.RegisterEnumDescriptor(_LISTENDPOINTSRESPONSE_DIRECTION) - _LISTENDPOINTSRESPONSE_MESSAGETYPE = _descriptor.Descriptor( - name='MessageType', - full_name='agrirouter.response.payload.account.ListEndpointsResponse.MessageType', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='technical_message_type', full_name='agrirouter.response.payload.account.ListEndpointsResponse.MessageType.technical_message_type', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='direction', full_name='agrirouter.response.payload.account.ListEndpointsResponse.MessageType.direction', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=206, - serialized_end=340, + name='MessageType', + full_name='agrirouter.response.payload.account.ListEndpointsResponse.MessageType', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='technical_message_type', + full_name='agrirouter.response.payload.account.ListEndpointsResponse.MessageType.technical_message_type', + index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='direction', + full_name='agrirouter.response.payload.account.ListEndpointsResponse.MessageType.direction', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=206, + serialized_end=340, ) _LISTENDPOINTSRESPONSE_ENDPOINT = _descriptor.Descriptor( - name='Endpoint', - full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='endpoint_id', full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.endpoint_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='endpoint_name', full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.endpoint_name', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='endpoint_type', full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.endpoint_type', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='status', full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.status', index=3, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='message_types', full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.message_types', index=4, - number=5, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='external_id', full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.external_id', index=5, - number=6, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=343, - serialized_end=552, + name='Endpoint', + full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='endpoint_id', + full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.endpoint_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='endpoint_name', + full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.endpoint_name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='endpoint_type', + full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.endpoint_type', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='status', full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.status', + index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='message_types', + full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.message_types', index=4, + number=5, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='external_id', + full_name='agrirouter.response.payload.account.ListEndpointsResponse.Endpoint.external_id', index=5, + number=6, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=343, + serialized_end=552, ) _LISTENDPOINTSRESPONSE = _descriptor.Descriptor( - name='ListEndpointsResponse', - full_name='agrirouter.response.payload.account.ListEndpointsResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='endpoints', full_name='agrirouter.response.payload.account.ListEndpointsResponse.endpoints', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_LISTENDPOINTSRESPONSE_MESSAGETYPE, _LISTENDPOINTSRESPONSE_ENDPOINT, ], - enum_types=[ - _LISTENDPOINTSRESPONSE_DIRECTION, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=92, - serialized_end=606, + name='ListEndpointsResponse', + full_name='agrirouter.response.payload.account.ListEndpointsResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='endpoints', full_name='agrirouter.response.payload.account.ListEndpointsResponse.endpoints', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_LISTENDPOINTSRESPONSE_MESSAGETYPE, _LISTENDPOINTSRESPONSE_ENDPOINT, ], + enum_types=[ + _LISTENDPOINTSRESPONSE_DIRECTION, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=92, + serialized_end=606, ) _LISTENDPOINTSRESPONSE_MESSAGETYPE.fields_by_name['direction'].enum_type = _LISTENDPOINTSRESPONSE_DIRECTION @@ -202,26 +206,25 @@ ListEndpointsResponse = _reflection.GeneratedProtocolMessageType('ListEndpointsResponse', (_message.Message,), { - 'MessageType' : _reflection.GeneratedProtocolMessageType('MessageType', (_message.Message,), { - 'DESCRIPTOR' : _LISTENDPOINTSRESPONSE_MESSAGETYPE, - '__module__' : 'messaging.response.payload.account.endpoints_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.response.payload.account.ListEndpointsResponse.MessageType) + 'MessageType': _reflection.GeneratedProtocolMessageType('MessageType', (_message.Message,), { + 'DESCRIPTOR': _LISTENDPOINTSRESPONSE_MESSAGETYPE, + '__module__': 'messaging.response.payload.account.endpoints_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.response.payload.account.ListEndpointsResponse.MessageType) }) - , + , - 'Endpoint' : _reflection.GeneratedProtocolMessageType('Endpoint', (_message.Message,), { - 'DESCRIPTOR' : _LISTENDPOINTSRESPONSE_ENDPOINT, - '__module__' : 'messaging.response.payload.account.endpoints_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.response.payload.account.ListEndpointsResponse.Endpoint) + 'Endpoint': _reflection.GeneratedProtocolMessageType('Endpoint', (_message.Message,), { + 'DESCRIPTOR': _LISTENDPOINTSRESPONSE_ENDPOINT, + '__module__': 'messaging.response.payload.account.endpoints_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.response.payload.account.ListEndpointsResponse.Endpoint) }) - , - 'DESCRIPTOR' : _LISTENDPOINTSRESPONSE, - '__module__' : 'messaging.response.payload.account.endpoints_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.response.payload.account.ListEndpointsResponse) - }) + , + 'DESCRIPTOR': _LISTENDPOINTSRESPONSE, + '__module__': 'messaging.response.payload.account.endpoints_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.response.payload.account.ListEndpointsResponse) +}) _sym_db.RegisterMessage(ListEndpointsResponse) _sym_db.RegisterMessage(ListEndpointsResponse.MessageType) _sym_db.RegisterMessage(ListEndpointsResponse.Endpoint) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/messaging/response/payload/endpoint/capability_pb2.py b/agrirouter/generated/messaging/response/payload/endpoint/capability_pb2.py index cea65312..8020270e 100644 --- a/agrirouter/generated/messaging/response/payload/endpoint/capability_pb2.py +++ b/agrirouter/generated/messaging/response/payload/endpoint/capability_pb2.py @@ -6,99 +6,97 @@ 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='messaging/response/payload/endpoint/capability.proto', - package='agrirouter.response.payload.endpoint', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n4messaging/response/payload/endpoint/capability.proto\x12$agrirouter.response.payload.endpoint\"\xc5\x01\n\x12\x43\x61pabilityResponse\x12\x1e\n\x16\x61pplication_message_id\x18\x01 \x01(\t\x12V\n\nrecipients\x18\x02 \x03(\x0b\x32\x42.agrirouter.response.payload.endpoint.CapabilityResponse.Recipient\x1a\x37\n\tRecipient\x12\n\n\x02id\x18\x01 \x01(\t\x12\x1e\n\x16technical_message_type\x18\x02 \x03(\tb\x06proto3' + name='messaging/response/payload/endpoint/capability.proto', + package='agrirouter.response.payload.endpoint', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n4messaging/response/payload/endpoint/capability.proto\x12$agrirouter.response.payload.endpoint\"\xc5\x01\n\x12\x43\x61pabilityResponse\x12\x1e\n\x16\x61pplication_message_id\x18\x01 \x01(\t\x12V\n\nrecipients\x18\x02 \x03(\x0b\x32\x42.agrirouter.response.payload.endpoint.CapabilityResponse.Recipient\x1a\x37\n\tRecipient\x12\n\n\x02id\x18\x01 \x01(\t\x12\x1e\n\x16technical_message_type\x18\x02 \x03(\tb\x06proto3' ) - - - _CAPABILITYRESPONSE_RECIPIENT = _descriptor.Descriptor( - name='Recipient', - full_name='agrirouter.response.payload.endpoint.CapabilityResponse.Recipient', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='id', full_name='agrirouter.response.payload.endpoint.CapabilityResponse.Recipient.id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='technical_message_type', full_name='agrirouter.response.payload.endpoint.CapabilityResponse.Recipient.technical_message_type', index=1, - number=2, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=237, - serialized_end=292, + name='Recipient', + full_name='agrirouter.response.payload.endpoint.CapabilityResponse.Recipient', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='agrirouter.response.payload.endpoint.CapabilityResponse.Recipient.id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='technical_message_type', + full_name='agrirouter.response.payload.endpoint.CapabilityResponse.Recipient.technical_message_type', + index=1, + number=2, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=237, + serialized_end=292, ) _CAPABILITYRESPONSE = _descriptor.Descriptor( - name='CapabilityResponse', - full_name='agrirouter.response.payload.endpoint.CapabilityResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='application_message_id', full_name='agrirouter.response.payload.endpoint.CapabilityResponse.application_message_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='recipients', full_name='agrirouter.response.payload.endpoint.CapabilityResponse.recipients', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_CAPABILITYRESPONSE_RECIPIENT, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=95, - serialized_end=292, + name='CapabilityResponse', + full_name='agrirouter.response.payload.endpoint.CapabilityResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='application_message_id', + full_name='agrirouter.response.payload.endpoint.CapabilityResponse.application_message_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='recipients', full_name='agrirouter.response.payload.endpoint.CapabilityResponse.recipients', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_CAPABILITYRESPONSE_RECIPIENT, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=95, + serialized_end=292, ) _CAPABILITYRESPONSE_RECIPIENT.containing_type = _CAPABILITYRESPONSE @@ -108,18 +106,17 @@ CapabilityResponse = _reflection.GeneratedProtocolMessageType('CapabilityResponse', (_message.Message,), { - 'Recipient' : _reflection.GeneratedProtocolMessageType('Recipient', (_message.Message,), { - 'DESCRIPTOR' : _CAPABILITYRESPONSE_RECIPIENT, - '__module__' : 'messaging.response.payload.endpoint.capability_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.response.payload.endpoint.CapabilityResponse.Recipient) + 'Recipient': _reflection.GeneratedProtocolMessageType('Recipient', (_message.Message,), { + 'DESCRIPTOR': _CAPABILITYRESPONSE_RECIPIENT, + '__module__': 'messaging.response.payload.endpoint.capability_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.response.payload.endpoint.CapabilityResponse.Recipient) }) - , - 'DESCRIPTOR' : _CAPABILITYRESPONSE, - '__module__' : 'messaging.response.payload.endpoint.capability_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.response.payload.endpoint.CapabilityResponse) - }) + , + 'DESCRIPTOR': _CAPABILITYRESPONSE, + '__module__': 'messaging.response.payload.endpoint.capability_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.response.payload.endpoint.CapabilityResponse) +}) _sym_db.RegisterMessage(CapabilityResponse) _sym_db.RegisterMessage(CapabilityResponse.Recipient) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/messaging/response/payload/feed/feed_response_pb2.py b/agrirouter/generated/messaging/response/payload/feed/feed_response_pb2.py index a193a2ee..eae3a144 100644 --- a/agrirouter/generated/messaging/response/payload/feed/feed_response_pb2.py +++ b/agrirouter/generated/messaging/response/payload/feed/feed_response_pb2.py @@ -6,598 +6,612 @@ 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 google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 from agrirouter.generated.commons import message_pb2 as commons_dot_message__pb2 from agrirouter.generated.commons import chunk_pb2 as commons_dot_chunk__pb2 - DESCRIPTOR = _descriptor.FileDescriptor( - name='messaging/response/payload/feed/feed-response.proto', - package='agrirouter.feed.response', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n3messaging/response/payload/feed/feed-response.proto\x12\x18\x61grirouter.feed.response\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19google/protobuf/any.proto\x1a\x15\x63ommons/message.proto\x1a\x13\x63ommons/chunk.proto\"%\n\x04Page\x12\x0e\n\x06number\x18\x01 \x01(\x05\x12\r\n\x05total\x18\x02 \x01(\x05\"N\n\x0cQueryMetrics\x12\x1f\n\x17total_messages_in_query\x18\x01 \x01(\x05\x12\x1d\n\x15max_count_restriction\x18\x02 \x01(\x05\"\xe8\x05\n\x13HeaderQueryResponse\x12=\n\rquery_metrics\x18\x01 \x01(\x0b\x32&.agrirouter.feed.response.QueryMetrics\x12,\n\x04page\x18\x02 \x01(\x0b\x32\x1e.agrirouter.feed.response.Page\x12:\n\x0e\x63hunk_contexts\x18\x03 \x03(\x0b\x32\".agrirouter.commons.ChunkComponent\x12@\n\x04\x66\x65\x65\x64\x18\x04 \x03(\x0b\x32\x32.agrirouter.feed.response.HeaderQueryResponse.Feed\x12\x1f\n\x13pending_message_ids\x18\x05 \x03(\tB\x02\x18\x01\x1a\xcd\x02\n\x06Header\x12\x12\n\nmessage_id\x18\x01 \x01(\t\x12\x1e\n\x16technical_message_type\x18\x02 \x01(\t\x12\x1b\n\x13team_set_context_id\x18\x03 \x01(\t\x12\x18\n\x10\x63hunk_context_id\x18\x04 \x01(\t\x12\x14\n\x0cpayload_size\x18\x05 \x01(\x03\x12\x32\n\x0esent_timestamp\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x17\n\x0fsequence_number\x18\x07 \x01(\x03\x12\x15\n\rcurrent_chunk\x18\x08 \x01(\x03\x12.\n\ncreated_at\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\x08metadata\x18\n \x01(\x0b\x32\x1c.agrirouter.commons.Metadata\x1au\n\x04\x46\x65\x65\x64\x12\x11\n\tsender_id\x18\x01 \x01(\t\x12\x13\n\x0breceiver_id\x18\x02 \x01(\t\x12\x45\n\x07headers\x18\x03 \x03(\x0b\x32\x34.agrirouter.feed.response.HeaderQueryResponse.Header\"\xd0\x05\n\x14MessageQueryResponse\x12=\n\rquery_metrics\x18\x01 \x01(\x0b\x32&.agrirouter.feed.response.QueryMetrics\x12,\n\x04page\x18\x02 \x01(\x0b\x32\x1e.agrirouter.feed.response.Page\x12L\n\x08messages\x18\x03 \x03(\x0b\x32:.agrirouter.feed.response.MessageQueryResponse.FeedMessage\x1a\xff\x02\n\x06Header\x12\x13\n\x0breceiver_id\x18\x01 \x01(\t\x12\x1e\n\x16technical_message_type\x18\x02 \x01(\t\x12\x1b\n\x13team_set_context_id\x18\x03 \x01(\t\x12\x39\n\rchunk_context\x18\x04 \x01(\x0b\x32\".agrirouter.commons.ChunkComponent\x12\x14\n\x0cpayload_size\x18\x05 \x01(\x03\x12\x32\n\x0esent_timestamp\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x17\n\x0fsequence_number\x18\x07 \x01(\x03\x12\x11\n\tsender_id\x18\x08 \x01(\t\x12.\n\ncreated_at\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nmessage_id\x18\n \x01(\t\x12.\n\x08metadata\x18\x0b \x01(\x0b\x32\x1c.agrirouter.commons.Metadata\x1a{\n\x0b\x46\x65\x65\x64Message\x12\x45\n\x06header\x18\x01 \x01(\x0b\x32\x35.agrirouter.feed.response.MessageQueryResponse.Header\x12%\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x14.google.protobuf.Any\"\x96\x03\n\x1a\x46\x61iledMessageQueryResponse\x12=\n\rquery_metrics\x18\x01 \x01(\x0b\x32&.agrirouter.feed.response.QueryMetrics\x12,\n\x04page\x18\x02 \x01(\x0b\x32\x1e.agrirouter.feed.response.Page\x12K\n\x06header\x18\x03 \x01(\x0b\x32;.agrirouter.feed.response.FailedMessageQueryResponse.Header\x12,\n\x07reasons\x18\x04 \x03(\x0b\x32\x1b.agrirouter.commons.Message\x1a\x8f\x01\n\x06Header\x12\x1e\n\x16technical_message_type\x18\x01 \x01(\t\x12\x1b\n\x13team_set_context_id\x18\x02 \x01(\t\x12\x14\n\x0cpayload_size\x18\x03 \x01(\x03\x12\x32\n\x0esent_timestamp\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestampb\x06proto3' - , - dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,google_dot_protobuf_dot_any__pb2.DESCRIPTOR,commons_dot_message__pb2.DESCRIPTOR,commons_dot_chunk__pb2.DESCRIPTOR,]) - - - + name='messaging/response/payload/feed/feed-response.proto', + package='agrirouter.feed.response', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n3messaging/response/payload/feed/feed-response.proto\x12\x18\x61grirouter.feed.response\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19google/protobuf/any.proto\x1a\x15\x63ommons/message.proto\x1a\x13\x63ommons/chunk.proto\"%\n\x04Page\x12\x0e\n\x06number\x18\x01 \x01(\x05\x12\r\n\x05total\x18\x02 \x01(\x05\"N\n\x0cQueryMetrics\x12\x1f\n\x17total_messages_in_query\x18\x01 \x01(\x05\x12\x1d\n\x15max_count_restriction\x18\x02 \x01(\x05\"\xe8\x05\n\x13HeaderQueryResponse\x12=\n\rquery_metrics\x18\x01 \x01(\x0b\x32&.agrirouter.feed.response.QueryMetrics\x12,\n\x04page\x18\x02 \x01(\x0b\x32\x1e.agrirouter.feed.response.Page\x12:\n\x0e\x63hunk_contexts\x18\x03 \x03(\x0b\x32\".agrirouter.commons.ChunkComponent\x12@\n\x04\x66\x65\x65\x64\x18\x04 \x03(\x0b\x32\x32.agrirouter.feed.response.HeaderQueryResponse.Feed\x12\x1f\n\x13pending_message_ids\x18\x05 \x03(\tB\x02\x18\x01\x1a\xcd\x02\n\x06Header\x12\x12\n\nmessage_id\x18\x01 \x01(\t\x12\x1e\n\x16technical_message_type\x18\x02 \x01(\t\x12\x1b\n\x13team_set_context_id\x18\x03 \x01(\t\x12\x18\n\x10\x63hunk_context_id\x18\x04 \x01(\t\x12\x14\n\x0cpayload_size\x18\x05 \x01(\x03\x12\x32\n\x0esent_timestamp\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x17\n\x0fsequence_number\x18\x07 \x01(\x03\x12\x15\n\rcurrent_chunk\x18\x08 \x01(\x03\x12.\n\ncreated_at\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\x08metadata\x18\n \x01(\x0b\x32\x1c.agrirouter.commons.Metadata\x1au\n\x04\x46\x65\x65\x64\x12\x11\n\tsender_id\x18\x01 \x01(\t\x12\x13\n\x0breceiver_id\x18\x02 \x01(\t\x12\x45\n\x07headers\x18\x03 \x03(\x0b\x32\x34.agrirouter.feed.response.HeaderQueryResponse.Header\"\xd0\x05\n\x14MessageQueryResponse\x12=\n\rquery_metrics\x18\x01 \x01(\x0b\x32&.agrirouter.feed.response.QueryMetrics\x12,\n\x04page\x18\x02 \x01(\x0b\x32\x1e.agrirouter.feed.response.Page\x12L\n\x08messages\x18\x03 \x03(\x0b\x32:.agrirouter.feed.response.MessageQueryResponse.FeedMessage\x1a\xff\x02\n\x06Header\x12\x13\n\x0breceiver_id\x18\x01 \x01(\t\x12\x1e\n\x16technical_message_type\x18\x02 \x01(\t\x12\x1b\n\x13team_set_context_id\x18\x03 \x01(\t\x12\x39\n\rchunk_context\x18\x04 \x01(\x0b\x32\".agrirouter.commons.ChunkComponent\x12\x14\n\x0cpayload_size\x18\x05 \x01(\x03\x12\x32\n\x0esent_timestamp\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x17\n\x0fsequence_number\x18\x07 \x01(\x03\x12\x11\n\tsender_id\x18\x08 \x01(\t\x12.\n\ncreated_at\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nmessage_id\x18\n \x01(\t\x12.\n\x08metadata\x18\x0b \x01(\x0b\x32\x1c.agrirouter.commons.Metadata\x1a{\n\x0b\x46\x65\x65\x64Message\x12\x45\n\x06header\x18\x01 \x01(\x0b\x32\x35.agrirouter.feed.response.MessageQueryResponse.Header\x12%\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x14.google.protobuf.Any\"\x96\x03\n\x1a\x46\x61iledMessageQueryResponse\x12=\n\rquery_metrics\x18\x01 \x01(\x0b\x32&.agrirouter.feed.response.QueryMetrics\x12,\n\x04page\x18\x02 \x01(\x0b\x32\x1e.agrirouter.feed.response.Page\x12K\n\x06header\x18\x03 \x01(\x0b\x32;.agrirouter.feed.response.FailedMessageQueryResponse.Header\x12,\n\x07reasons\x18\x04 \x03(\x0b\x32\x1b.agrirouter.commons.Message\x1a\x8f\x01\n\x06Header\x12\x1e\n\x16technical_message_type\x18\x01 \x01(\t\x12\x1b\n\x13team_set_context_id\x18\x02 \x01(\t\x12\x14\n\x0cpayload_size\x18\x03 \x01(\x03\x12\x32\n\x0esent_timestamp\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestampb\x06proto3' + , + dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, google_dot_protobuf_dot_any__pb2.DESCRIPTOR, + commons_dot_message__pb2.DESCRIPTOR, commons_dot_chunk__pb2.DESCRIPTOR, ]) _PAGE = _descriptor.Descriptor( - name='Page', - full_name='agrirouter.feed.response.Page', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='number', full_name='agrirouter.feed.response.Page.number', index=0, - number=1, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='total', full_name='agrirouter.feed.response.Page.total', index=1, - number=2, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=185, - serialized_end=222, + name='Page', + full_name='agrirouter.feed.response.Page', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='number', full_name='agrirouter.feed.response.Page.number', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='total', full_name='agrirouter.feed.response.Page.total', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=185, + serialized_end=222, ) - _QUERYMETRICS = _descriptor.Descriptor( - name='QueryMetrics', - full_name='agrirouter.feed.response.QueryMetrics', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='total_messages_in_query', full_name='agrirouter.feed.response.QueryMetrics.total_messages_in_query', index=0, - number=1, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_count_restriction', full_name='agrirouter.feed.response.QueryMetrics.max_count_restriction', index=1, - number=2, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=224, - serialized_end=302, + name='QueryMetrics', + full_name='agrirouter.feed.response.QueryMetrics', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='total_messages_in_query', full_name='agrirouter.feed.response.QueryMetrics.total_messages_in_query', + index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='max_count_restriction', full_name='agrirouter.feed.response.QueryMetrics.max_count_restriction', + index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=224, + serialized_end=302, ) - _HEADERQUERYRESPONSE_HEADER = _descriptor.Descriptor( - name='Header', - full_name='agrirouter.feed.response.HeaderQueryResponse.Header', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='message_id', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.message_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='technical_message_type', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.technical_message_type', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='team_set_context_id', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.team_set_context_id', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='chunk_context_id', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.chunk_context_id', index=3, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='payload_size', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.payload_size', index=4, - number=5, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sent_timestamp', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.sent_timestamp', index=5, - number=6, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sequence_number', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.sequence_number', index=6, - number=7, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='current_chunk', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.current_chunk', index=7, - number=8, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='created_at', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.created_at', index=8, - number=9, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metadata', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.metadata', index=9, - number=10, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=597, - serialized_end=930, + name='Header', + full_name='agrirouter.feed.response.HeaderQueryResponse.Header', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='message_id', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.message_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='technical_message_type', + full_name='agrirouter.feed.response.HeaderQueryResponse.Header.technical_message_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='team_set_context_id', + full_name='agrirouter.feed.response.HeaderQueryResponse.Header.team_set_context_id', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='chunk_context_id', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.chunk_context_id', + index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='payload_size', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.payload_size', index=4, + number=5, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sent_timestamp', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.sent_timestamp', + index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sequence_number', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.sequence_number', + index=6, + number=7, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='current_chunk', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.current_chunk', + index=7, + number=8, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='created_at', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.created_at', index=8, + number=9, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='agrirouter.feed.response.HeaderQueryResponse.Header.metadata', index=9, + number=10, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=597, + serialized_end=930, ) _HEADERQUERYRESPONSE_FEED = _descriptor.Descriptor( - name='Feed', - full_name='agrirouter.feed.response.HeaderQueryResponse.Feed', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='sender_id', full_name='agrirouter.feed.response.HeaderQueryResponse.Feed.sender_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='receiver_id', full_name='agrirouter.feed.response.HeaderQueryResponse.Feed.receiver_id', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='headers', full_name='agrirouter.feed.response.HeaderQueryResponse.Feed.headers', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=932, - serialized_end=1049, + name='Feed', + full_name='agrirouter.feed.response.HeaderQueryResponse.Feed', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='sender_id', full_name='agrirouter.feed.response.HeaderQueryResponse.Feed.sender_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='receiver_id', full_name='agrirouter.feed.response.HeaderQueryResponse.Feed.receiver_id', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='headers', full_name='agrirouter.feed.response.HeaderQueryResponse.Feed.headers', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=932, + serialized_end=1049, ) _HEADERQUERYRESPONSE = _descriptor.Descriptor( - name='HeaderQueryResponse', - full_name='agrirouter.feed.response.HeaderQueryResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='query_metrics', full_name='agrirouter.feed.response.HeaderQueryResponse.query_metrics', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='page', full_name='agrirouter.feed.response.HeaderQueryResponse.page', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='chunk_contexts', full_name='agrirouter.feed.response.HeaderQueryResponse.chunk_contexts', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='feed', full_name='agrirouter.feed.response.HeaderQueryResponse.feed', index=3, - number=4, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='pending_message_ids', full_name='agrirouter.feed.response.HeaderQueryResponse.pending_message_ids', index=4, - number=5, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=b'\030\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_HEADERQUERYRESPONSE_HEADER, _HEADERQUERYRESPONSE_FEED, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=305, - serialized_end=1049, + name='HeaderQueryResponse', + full_name='agrirouter.feed.response.HeaderQueryResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='query_metrics', full_name='agrirouter.feed.response.HeaderQueryResponse.query_metrics', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='page', full_name='agrirouter.feed.response.HeaderQueryResponse.page', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='chunk_contexts', full_name='agrirouter.feed.response.HeaderQueryResponse.chunk_contexts', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='feed', full_name='agrirouter.feed.response.HeaderQueryResponse.feed', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='pending_message_ids', full_name='agrirouter.feed.response.HeaderQueryResponse.pending_message_ids', + index=4, + number=5, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\030\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_HEADERQUERYRESPONSE_HEADER, _HEADERQUERYRESPONSE_FEED, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=305, + serialized_end=1049, ) - _MESSAGEQUERYRESPONSE_HEADER = _descriptor.Descriptor( - name='Header', - full_name='agrirouter.feed.response.MessageQueryResponse.Header', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='receiver_id', full_name='agrirouter.feed.response.MessageQueryResponse.Header.receiver_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='technical_message_type', full_name='agrirouter.feed.response.MessageQueryResponse.Header.technical_message_type', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='team_set_context_id', full_name='agrirouter.feed.response.MessageQueryResponse.Header.team_set_context_id', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='chunk_context', full_name='agrirouter.feed.response.MessageQueryResponse.Header.chunk_context', index=3, - number=4, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='payload_size', full_name='agrirouter.feed.response.MessageQueryResponse.Header.payload_size', index=4, - number=5, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sent_timestamp', full_name='agrirouter.feed.response.MessageQueryResponse.Header.sent_timestamp', index=5, - number=6, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sequence_number', full_name='agrirouter.feed.response.MessageQueryResponse.Header.sequence_number', index=6, - number=7, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sender_id', full_name='agrirouter.feed.response.MessageQueryResponse.Header.sender_id', index=7, - number=8, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='created_at', full_name='agrirouter.feed.response.MessageQueryResponse.Header.created_at', index=8, - number=9, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='message_id', full_name='agrirouter.feed.response.MessageQueryResponse.Header.message_id', index=9, - number=10, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metadata', full_name='agrirouter.feed.response.MessageQueryResponse.Header.metadata', index=10, - number=11, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1264, - serialized_end=1647, + name='Header', + full_name='agrirouter.feed.response.MessageQueryResponse.Header', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='receiver_id', full_name='agrirouter.feed.response.MessageQueryResponse.Header.receiver_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='technical_message_type', + full_name='agrirouter.feed.response.MessageQueryResponse.Header.technical_message_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='team_set_context_id', + full_name='agrirouter.feed.response.MessageQueryResponse.Header.team_set_context_id', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='chunk_context', full_name='agrirouter.feed.response.MessageQueryResponse.Header.chunk_context', + index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='payload_size', full_name='agrirouter.feed.response.MessageQueryResponse.Header.payload_size', index=4, + number=5, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sent_timestamp', full_name='agrirouter.feed.response.MessageQueryResponse.Header.sent_timestamp', + index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sequence_number', full_name='agrirouter.feed.response.MessageQueryResponse.Header.sequence_number', + index=6, + number=7, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sender_id', full_name='agrirouter.feed.response.MessageQueryResponse.Header.sender_id', index=7, + number=8, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='created_at', full_name='agrirouter.feed.response.MessageQueryResponse.Header.created_at', index=8, + number=9, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='message_id', full_name='agrirouter.feed.response.MessageQueryResponse.Header.message_id', index=9, + number=10, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='agrirouter.feed.response.MessageQueryResponse.Header.metadata', index=10, + number=11, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1264, + serialized_end=1647, ) _MESSAGEQUERYRESPONSE_FEEDMESSAGE = _descriptor.Descriptor( - name='FeedMessage', - full_name='agrirouter.feed.response.MessageQueryResponse.FeedMessage', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='header', full_name='agrirouter.feed.response.MessageQueryResponse.FeedMessage.header', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='content', full_name='agrirouter.feed.response.MessageQueryResponse.FeedMessage.content', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1649, - serialized_end=1772, + name='FeedMessage', + full_name='agrirouter.feed.response.MessageQueryResponse.FeedMessage', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='header', full_name='agrirouter.feed.response.MessageQueryResponse.FeedMessage.header', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='content', full_name='agrirouter.feed.response.MessageQueryResponse.FeedMessage.content', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1649, + serialized_end=1772, ) _MESSAGEQUERYRESPONSE = _descriptor.Descriptor( - name='MessageQueryResponse', - full_name='agrirouter.feed.response.MessageQueryResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='query_metrics', full_name='agrirouter.feed.response.MessageQueryResponse.query_metrics', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='page', full_name='agrirouter.feed.response.MessageQueryResponse.page', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='messages', full_name='agrirouter.feed.response.MessageQueryResponse.messages', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_MESSAGEQUERYRESPONSE_HEADER, _MESSAGEQUERYRESPONSE_FEEDMESSAGE, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1052, - serialized_end=1772, + name='MessageQueryResponse', + full_name='agrirouter.feed.response.MessageQueryResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='query_metrics', full_name='agrirouter.feed.response.MessageQueryResponse.query_metrics', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='page', full_name='agrirouter.feed.response.MessageQueryResponse.page', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='messages', full_name='agrirouter.feed.response.MessageQueryResponse.messages', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_MESSAGEQUERYRESPONSE_HEADER, _MESSAGEQUERYRESPONSE_FEEDMESSAGE, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1052, + serialized_end=1772, ) - _FAILEDMESSAGEQUERYRESPONSE_HEADER = _descriptor.Descriptor( - name='Header', - full_name='agrirouter.feed.response.FailedMessageQueryResponse.Header', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='technical_message_type', full_name='agrirouter.feed.response.FailedMessageQueryResponse.Header.technical_message_type', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='team_set_context_id', full_name='agrirouter.feed.response.FailedMessageQueryResponse.Header.team_set_context_id', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='payload_size', full_name='agrirouter.feed.response.FailedMessageQueryResponse.Header.payload_size', index=2, - number=3, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sent_timestamp', full_name='agrirouter.feed.response.FailedMessageQueryResponse.Header.sent_timestamp', index=3, - number=4, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=2038, - serialized_end=2181, + name='Header', + full_name='agrirouter.feed.response.FailedMessageQueryResponse.Header', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='technical_message_type', + full_name='agrirouter.feed.response.FailedMessageQueryResponse.Header.technical_message_type', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='team_set_context_id', + full_name='agrirouter.feed.response.FailedMessageQueryResponse.Header.team_set_context_id', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='payload_size', full_name='agrirouter.feed.response.FailedMessageQueryResponse.Header.payload_size', + index=2, + number=3, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sent_timestamp', + full_name='agrirouter.feed.response.FailedMessageQueryResponse.Header.sent_timestamp', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2038, + serialized_end=2181, ) _FAILEDMESSAGEQUERYRESPONSE = _descriptor.Descriptor( - name='FailedMessageQueryResponse', - full_name='agrirouter.feed.response.FailedMessageQueryResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='query_metrics', full_name='agrirouter.feed.response.FailedMessageQueryResponse.query_metrics', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='page', full_name='agrirouter.feed.response.FailedMessageQueryResponse.page', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='header', full_name='agrirouter.feed.response.FailedMessageQueryResponse.header', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='reasons', full_name='agrirouter.feed.response.FailedMessageQueryResponse.reasons', index=3, - number=4, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_FAILEDMESSAGEQUERYRESPONSE_HEADER, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1775, - serialized_end=2181, + name='FailedMessageQueryResponse', + full_name='agrirouter.feed.response.FailedMessageQueryResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='query_metrics', full_name='agrirouter.feed.response.FailedMessageQueryResponse.query_metrics', + index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='page', full_name='agrirouter.feed.response.FailedMessageQueryResponse.page', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='header', full_name='agrirouter.feed.response.FailedMessageQueryResponse.header', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='reasons', full_name='agrirouter.feed.response.FailedMessageQueryResponse.reasons', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_FAILEDMESSAGEQUERYRESPONSE_HEADER, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1775, + serialized_end=2181, ) -_HEADERQUERYRESPONSE_HEADER.fields_by_name['sent_timestamp'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_HEADERQUERYRESPONSE_HEADER.fields_by_name['created_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_HEADERQUERYRESPONSE_HEADER.fields_by_name[ + 'sent_timestamp'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_HEADERQUERYRESPONSE_HEADER.fields_by_name[ + 'created_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP _HEADERQUERYRESPONSE_HEADER.fields_by_name['metadata'].message_type = commons_dot_message__pb2._METADATA _HEADERQUERYRESPONSE_HEADER.containing_type = _HEADERQUERYRESPONSE _HEADERQUERYRESPONSE_FEED.fields_by_name['headers'].message_type = _HEADERQUERYRESPONSE_HEADER @@ -607,8 +621,10 @@ _HEADERQUERYRESPONSE.fields_by_name['chunk_contexts'].message_type = commons_dot_chunk__pb2._CHUNKCOMPONENT _HEADERQUERYRESPONSE.fields_by_name['feed'].message_type = _HEADERQUERYRESPONSE_FEED _MESSAGEQUERYRESPONSE_HEADER.fields_by_name['chunk_context'].message_type = commons_dot_chunk__pb2._CHUNKCOMPONENT -_MESSAGEQUERYRESPONSE_HEADER.fields_by_name['sent_timestamp'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_MESSAGEQUERYRESPONSE_HEADER.fields_by_name['created_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_MESSAGEQUERYRESPONSE_HEADER.fields_by_name[ + 'sent_timestamp'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_MESSAGEQUERYRESPONSE_HEADER.fields_by_name[ + 'created_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP _MESSAGEQUERYRESPONSE_HEADER.fields_by_name['metadata'].message_type = commons_dot_message__pb2._METADATA _MESSAGEQUERYRESPONSE_HEADER.containing_type = _MESSAGEQUERYRESPONSE _MESSAGEQUERYRESPONSE_FEEDMESSAGE.fields_by_name['header'].message_type = _MESSAGEQUERYRESPONSE_HEADER @@ -617,7 +633,8 @@ _MESSAGEQUERYRESPONSE.fields_by_name['query_metrics'].message_type = _QUERYMETRICS _MESSAGEQUERYRESPONSE.fields_by_name['page'].message_type = _PAGE _MESSAGEQUERYRESPONSE.fields_by_name['messages'].message_type = _MESSAGEQUERYRESPONSE_FEEDMESSAGE -_FAILEDMESSAGEQUERYRESPONSE_HEADER.fields_by_name['sent_timestamp'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_FAILEDMESSAGEQUERYRESPONSE_HEADER.fields_by_name[ + 'sent_timestamp'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP _FAILEDMESSAGEQUERYRESPONSE_HEADER.containing_type = _FAILEDMESSAGEQUERYRESPONSE _FAILEDMESSAGEQUERYRESPONSE.fields_by_name['query_metrics'].message_type = _QUERYMETRICS _FAILEDMESSAGEQUERYRESPONSE.fields_by_name['page'].message_type = _PAGE @@ -631,80 +648,81 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR) Page = _reflection.GeneratedProtocolMessageType('Page', (_message.Message,), { - 'DESCRIPTOR' : _PAGE, - '__module__' : 'messaging.response.payload.feed.feed_response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.response.Page) - }) + 'DESCRIPTOR': _PAGE, + '__module__': 'messaging.response.payload.feed.feed_response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.response.Page) +}) _sym_db.RegisterMessage(Page) QueryMetrics = _reflection.GeneratedProtocolMessageType('QueryMetrics', (_message.Message,), { - 'DESCRIPTOR' : _QUERYMETRICS, - '__module__' : 'messaging.response.payload.feed.feed_response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.response.QueryMetrics) - }) + 'DESCRIPTOR': _QUERYMETRICS, + '__module__': 'messaging.response.payload.feed.feed_response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.response.QueryMetrics) +}) _sym_db.RegisterMessage(QueryMetrics) HeaderQueryResponse = _reflection.GeneratedProtocolMessageType('HeaderQueryResponse', (_message.Message,), { - 'Header' : _reflection.GeneratedProtocolMessageType('Header', (_message.Message,), { - 'DESCRIPTOR' : _HEADERQUERYRESPONSE_HEADER, - '__module__' : 'messaging.response.payload.feed.feed_response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.response.HeaderQueryResponse.Header) + 'Header': _reflection.GeneratedProtocolMessageType('Header', (_message.Message,), { + 'DESCRIPTOR': _HEADERQUERYRESPONSE_HEADER, + '__module__': 'messaging.response.payload.feed.feed_response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.response.HeaderQueryResponse.Header) }) - , + , - 'Feed' : _reflection.GeneratedProtocolMessageType('Feed', (_message.Message,), { - 'DESCRIPTOR' : _HEADERQUERYRESPONSE_FEED, - '__module__' : 'messaging.response.payload.feed.feed_response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.response.HeaderQueryResponse.Feed) + 'Feed': _reflection.GeneratedProtocolMessageType('Feed', (_message.Message,), { + 'DESCRIPTOR': _HEADERQUERYRESPONSE_FEED, + '__module__': 'messaging.response.payload.feed.feed_response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.response.HeaderQueryResponse.Feed) }) - , - 'DESCRIPTOR' : _HEADERQUERYRESPONSE, - '__module__' : 'messaging.response.payload.feed.feed_response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.response.HeaderQueryResponse) - }) + , + 'DESCRIPTOR': _HEADERQUERYRESPONSE, + '__module__': 'messaging.response.payload.feed.feed_response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.response.HeaderQueryResponse) +}) _sym_db.RegisterMessage(HeaderQueryResponse) _sym_db.RegisterMessage(HeaderQueryResponse.Header) _sym_db.RegisterMessage(HeaderQueryResponse.Feed) MessageQueryResponse = _reflection.GeneratedProtocolMessageType('MessageQueryResponse', (_message.Message,), { - 'Header' : _reflection.GeneratedProtocolMessageType('Header', (_message.Message,), { - 'DESCRIPTOR' : _MESSAGEQUERYRESPONSE_HEADER, - '__module__' : 'messaging.response.payload.feed.feed_response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.response.MessageQueryResponse.Header) + 'Header': _reflection.GeneratedProtocolMessageType('Header', (_message.Message,), { + 'DESCRIPTOR': _MESSAGEQUERYRESPONSE_HEADER, + '__module__': 'messaging.response.payload.feed.feed_response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.response.MessageQueryResponse.Header) }) - , + , - 'FeedMessage' : _reflection.GeneratedProtocolMessageType('FeedMessage', (_message.Message,), { - 'DESCRIPTOR' : _MESSAGEQUERYRESPONSE_FEEDMESSAGE, - '__module__' : 'messaging.response.payload.feed.feed_response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.response.MessageQueryResponse.FeedMessage) + 'FeedMessage': _reflection.GeneratedProtocolMessageType('FeedMessage', (_message.Message,), { + 'DESCRIPTOR': _MESSAGEQUERYRESPONSE_FEEDMESSAGE, + '__module__': 'messaging.response.payload.feed.feed_response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.response.MessageQueryResponse.FeedMessage) }) - , - 'DESCRIPTOR' : _MESSAGEQUERYRESPONSE, - '__module__' : 'messaging.response.payload.feed.feed_response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.response.MessageQueryResponse) - }) + , + 'DESCRIPTOR': _MESSAGEQUERYRESPONSE, + '__module__': 'messaging.response.payload.feed.feed_response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.response.MessageQueryResponse) +}) _sym_db.RegisterMessage(MessageQueryResponse) _sym_db.RegisterMessage(MessageQueryResponse.Header) _sym_db.RegisterMessage(MessageQueryResponse.FeedMessage) -FailedMessageQueryResponse = _reflection.GeneratedProtocolMessageType('FailedMessageQueryResponse', (_message.Message,), { - - 'Header' : _reflection.GeneratedProtocolMessageType('Header', (_message.Message,), { - 'DESCRIPTOR' : _FAILEDMESSAGEQUERYRESPONSE_HEADER, - '__module__' : 'messaging.response.payload.feed.feed_response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.response.FailedMessageQueryResponse.Header) - }) - , - 'DESCRIPTOR' : _FAILEDMESSAGEQUERYRESPONSE, - '__module__' : 'messaging.response.payload.feed.feed_response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.response.FailedMessageQueryResponse) - }) +FailedMessageQueryResponse = _reflection.GeneratedProtocolMessageType('FailedMessageQueryResponse', (_message.Message,), + { + + 'Header': _reflection.GeneratedProtocolMessageType( + 'Header', (_message.Message,), { + 'DESCRIPTOR': _FAILEDMESSAGEQUERYRESPONSE_HEADER, + '__module__': 'messaging.response.payload.feed.feed_response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.response.FailedMessageQueryResponse.Header) + }) + , + 'DESCRIPTOR': _FAILEDMESSAGEQUERYRESPONSE, + '__module__': 'messaging.response.payload.feed.feed_response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.response.FailedMessageQueryResponse) + }) _sym_db.RegisterMessage(FailedMessageQueryResponse) _sym_db.RegisterMessage(FailedMessageQueryResponse.Header) - _HEADERQUERYRESPONSE.fields_by_name['pending_message_ids']._options = None # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/messaging/response/payload/feed/push_notification_pb2.py b/agrirouter/generated/messaging/response/payload/feed/push_notification_pb2.py index 2cc8a8f0..5b159ad9 100644 --- a/agrirouter/generated/messaging/response/payload/feed/push_notification_pb2.py +++ b/agrirouter/generated/messaging/response/payload/feed/push_notification_pb2.py @@ -6,202 +6,209 @@ 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 google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 from agrirouter.generated.commons import message_pb2 as commons_dot_message__pb2 from agrirouter.generated.commons import chunk_pb2 as commons_dot_chunk__pb2 - DESCRIPTOR = _descriptor.FileDescriptor( - name='messaging/response/payload/feed/push-notification.proto', - package='agrirouter.feed.push.notification', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n7messaging/response/payload/feed/push-notification.proto\x12!agrirouter.feed.push.notification\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19google/protobuf/any.proto\x1a\x15\x63ommons/message.proto\x1a\x13\x63ommons/chunk.proto\"\xea\x04\n\x10PushNotification\x12Q\n\x08messages\x18\x01 \x03(\x0b\x32?.agrirouter.feed.push.notification.PushNotification.FeedMessage\x1a\xff\x02\n\x06Header\x12\x13\n\x0breceiver_id\x18\x01 \x01(\t\x12\x1e\n\x16technical_message_type\x18\x02 \x01(\t\x12\x1b\n\x13team_set_context_id\x18\x03 \x01(\t\x12\x39\n\rchunk_context\x18\x04 \x01(\x0b\x32\".agrirouter.commons.ChunkComponent\x12\x14\n\x0cpayload_size\x18\x05 \x01(\x03\x12\x32\n\x0esent_timestamp\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x17\n\x0fsequence_number\x18\x07 \x01(\x03\x12\x11\n\tsender_id\x18\x08 \x01(\t\x12.\n\ncreated_at\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nmessage_id\x18\n \x01(\t\x12.\n\x08metadata\x18\x0b \x01(\x0b\x32\x1c.agrirouter.commons.Metadata\x1a\x80\x01\n\x0b\x46\x65\x65\x64Message\x12J\n\x06header\x18\x01 \x01(\x0b\x32:.agrirouter.feed.push.notification.PushNotification.Header\x12%\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x14.google.protobuf.Anyb\x06proto3' - , - dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,google_dot_protobuf_dot_any__pb2.DESCRIPTOR,commons_dot_message__pb2.DESCRIPTOR,commons_dot_chunk__pb2.DESCRIPTOR,]) - - - + name='messaging/response/payload/feed/push-notification.proto', + package='agrirouter.feed.push.notification', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n7messaging/response/payload/feed/push-notification.proto\x12!agrirouter.feed.push.notification\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19google/protobuf/any.proto\x1a\x15\x63ommons/message.proto\x1a\x13\x63ommons/chunk.proto\"\xea\x04\n\x10PushNotification\x12Q\n\x08messages\x18\x01 \x03(\x0b\x32?.agrirouter.feed.push.notification.PushNotification.FeedMessage\x1a\xff\x02\n\x06Header\x12\x13\n\x0breceiver_id\x18\x01 \x01(\t\x12\x1e\n\x16technical_message_type\x18\x02 \x01(\t\x12\x1b\n\x13team_set_context_id\x18\x03 \x01(\t\x12\x39\n\rchunk_context\x18\x04 \x01(\x0b\x32\".agrirouter.commons.ChunkComponent\x12\x14\n\x0cpayload_size\x18\x05 \x01(\x03\x12\x32\n\x0esent_timestamp\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x17\n\x0fsequence_number\x18\x07 \x01(\x03\x12\x11\n\tsender_id\x18\x08 \x01(\t\x12.\n\ncreated_at\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nmessage_id\x18\n \x01(\t\x12.\n\x08metadata\x18\x0b \x01(\x0b\x32\x1c.agrirouter.commons.Metadata\x1a\x80\x01\n\x0b\x46\x65\x65\x64Message\x12J\n\x06header\x18\x01 \x01(\x0b\x32:.agrirouter.feed.push.notification.PushNotification.Header\x12%\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x14.google.protobuf.Anyb\x06proto3' + , + dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, google_dot_protobuf_dot_any__pb2.DESCRIPTOR, + commons_dot_message__pb2.DESCRIPTOR, commons_dot_chunk__pb2.DESCRIPTOR, ]) _PUSHNOTIFICATION_HEADER = _descriptor.Descriptor( - name='Header', - full_name='agrirouter.feed.push.notification.PushNotification.Header', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='receiver_id', full_name='agrirouter.feed.push.notification.PushNotification.Header.receiver_id', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='technical_message_type', full_name='agrirouter.feed.push.notification.PushNotification.Header.technical_message_type', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='team_set_context_id', full_name='agrirouter.feed.push.notification.PushNotification.Header.team_set_context_id', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='chunk_context', full_name='agrirouter.feed.push.notification.PushNotification.Header.chunk_context', index=3, - number=4, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='payload_size', full_name='agrirouter.feed.push.notification.PushNotification.Header.payload_size', index=4, - number=5, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sent_timestamp', full_name='agrirouter.feed.push.notification.PushNotification.Header.sent_timestamp', index=5, - number=6, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sequence_number', full_name='agrirouter.feed.push.notification.PushNotification.Header.sequence_number', index=6, - number=7, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sender_id', full_name='agrirouter.feed.push.notification.PushNotification.Header.sender_id', index=7, - number=8, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='created_at', full_name='agrirouter.feed.push.notification.PushNotification.Header.created_at', index=8, - number=9, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='message_id', full_name='agrirouter.feed.push.notification.PushNotification.Header.message_id', index=9, - number=10, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metadata', full_name='agrirouter.feed.push.notification.PushNotification.Header.metadata', index=10, - number=11, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=303, - serialized_end=686, + name='Header', + full_name='agrirouter.feed.push.notification.PushNotification.Header', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='receiver_id', full_name='agrirouter.feed.push.notification.PushNotification.Header.receiver_id', + index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='technical_message_type', + full_name='agrirouter.feed.push.notification.PushNotification.Header.technical_message_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='team_set_context_id', + full_name='agrirouter.feed.push.notification.PushNotification.Header.team_set_context_id', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='chunk_context', full_name='agrirouter.feed.push.notification.PushNotification.Header.chunk_context', + index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='payload_size', full_name='agrirouter.feed.push.notification.PushNotification.Header.payload_size', + index=4, + number=5, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sent_timestamp', full_name='agrirouter.feed.push.notification.PushNotification.Header.sent_timestamp', + index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sequence_number', + full_name='agrirouter.feed.push.notification.PushNotification.Header.sequence_number', index=6, + number=7, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sender_id', full_name='agrirouter.feed.push.notification.PushNotification.Header.sender_id', index=7, + number=8, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='created_at', full_name='agrirouter.feed.push.notification.PushNotification.Header.created_at', + index=8, + number=9, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='message_id', full_name='agrirouter.feed.push.notification.PushNotification.Header.message_id', + index=9, + number=10, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='agrirouter.feed.push.notification.PushNotification.Header.metadata', index=10, + number=11, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=303, + serialized_end=686, ) _PUSHNOTIFICATION_FEEDMESSAGE = _descriptor.Descriptor( - name='FeedMessage', - full_name='agrirouter.feed.push.notification.PushNotification.FeedMessage', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='header', full_name='agrirouter.feed.push.notification.PushNotification.FeedMessage.header', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='content', full_name='agrirouter.feed.push.notification.PushNotification.FeedMessage.content', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=689, - serialized_end=817, + name='FeedMessage', + full_name='agrirouter.feed.push.notification.PushNotification.FeedMessage', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='header', full_name='agrirouter.feed.push.notification.PushNotification.FeedMessage.header', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='content', full_name='agrirouter.feed.push.notification.PushNotification.FeedMessage.content', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=689, + serialized_end=817, ) _PUSHNOTIFICATION = _descriptor.Descriptor( - name='PushNotification', - full_name='agrirouter.feed.push.notification.PushNotification', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='messages', full_name='agrirouter.feed.push.notification.PushNotification.messages', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_PUSHNOTIFICATION_HEADER, _PUSHNOTIFICATION_FEEDMESSAGE, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=199, - serialized_end=817, + name='PushNotification', + full_name='agrirouter.feed.push.notification.PushNotification', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='messages', full_name='agrirouter.feed.push.notification.PushNotification.messages', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_PUSHNOTIFICATION_HEADER, _PUSHNOTIFICATION_FEEDMESSAGE, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=199, + serialized_end=817, ) _PUSHNOTIFICATION_HEADER.fields_by_name['chunk_context'].message_type = commons_dot_chunk__pb2._CHUNKCOMPONENT -_PUSHNOTIFICATION_HEADER.fields_by_name['sent_timestamp'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_PUSHNOTIFICATION_HEADER.fields_by_name[ + 'sent_timestamp'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP _PUSHNOTIFICATION_HEADER.fields_by_name['created_at'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP _PUSHNOTIFICATION_HEADER.fields_by_name['metadata'].message_type = commons_dot_message__pb2._METADATA _PUSHNOTIFICATION_HEADER.containing_type = _PUSHNOTIFICATION @@ -214,26 +221,25 @@ PushNotification = _reflection.GeneratedProtocolMessageType('PushNotification', (_message.Message,), { - 'Header' : _reflection.GeneratedProtocolMessageType('Header', (_message.Message,), { - 'DESCRIPTOR' : _PUSHNOTIFICATION_HEADER, - '__module__' : 'messaging.response.payload.feed.push_notification_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.push.notification.PushNotification.Header) + 'Header': _reflection.GeneratedProtocolMessageType('Header', (_message.Message,), { + 'DESCRIPTOR': _PUSHNOTIFICATION_HEADER, + '__module__': 'messaging.response.payload.feed.push_notification_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.push.notification.PushNotification.Header) }) - , + , - 'FeedMessage' : _reflection.GeneratedProtocolMessageType('FeedMessage', (_message.Message,), { - 'DESCRIPTOR' : _PUSHNOTIFICATION_FEEDMESSAGE, - '__module__' : 'messaging.response.payload.feed.push_notification_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.push.notification.PushNotification.FeedMessage) + 'FeedMessage': _reflection.GeneratedProtocolMessageType('FeedMessage', (_message.Message,), { + 'DESCRIPTOR': _PUSHNOTIFICATION_FEEDMESSAGE, + '__module__': 'messaging.response.payload.feed.push_notification_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.push.notification.PushNotification.FeedMessage) }) - , - 'DESCRIPTOR' : _PUSHNOTIFICATION, - '__module__' : 'messaging.response.payload.feed.push_notification_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.feed.push.notification.PushNotification) - }) + , + 'DESCRIPTOR': _PUSHNOTIFICATION, + '__module__': 'messaging.response.payload.feed.push_notification_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.feed.push.notification.PushNotification) +}) _sym_db.RegisterMessage(PushNotification) _sym_db.RegisterMessage(PushNotification.Header) _sym_db.RegisterMessage(PushNotification.FeedMessage) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/messaging/response/response_pb2.py b/agrirouter/generated/messaging/response/response_pb2.py index 235e58b8..296703a6 100644 --- a/agrirouter/generated/messaging/response/response_pb2.py +++ b/agrirouter/generated/messaging/response/response_pb2.py @@ -6,183 +6,179 @@ 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 google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 - DESCRIPTOR = _descriptor.FileDescriptor( - name='messaging/response/response.proto', - package='agrirouter.response', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n!messaging/response/response.proto\x12\x13\x61grirouter.response\x1a\x19google/protobuf/any.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xcb\x03\n\x10ResponseEnvelope\x12\x15\n\rresponse_code\x18\x01 \x01(\x05\x12\x44\n\x04type\x18\x02 \x01(\x0e\x32\x36.agrirouter.response.ResponseEnvelope.ResponseBodyType\x12\x1e\n\x16\x61pplication_message_id\x18\x03 \x01(\t\x12\x12\n\nmessage_id\x18\x04 \x01(\t\x12-\n\ttimestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xf6\x01\n\x10ResponseBodyType\x12\x0c\n\x08MESSAGES\x10\x00\x12\x07\n\x03\x41\x43K\x10\x01\x12\x15\n\x11\x41\x43K_WITH_MESSAGES\x10\x02\x12\x14\n\x10\x41\x43K_WITH_FAILURE\x10\x03\x12\x1c\n\x18\x41\x43K_FOR_FEED_HEADER_LIST\x10\x06\x12\x18\n\x14\x41\x43K_FOR_FEED_MESSAGE\x10\x07\x12\x1f\n\x1b\x41\x43K_FOR_FEED_FAILED_MESSAGE\x10\x08\x12\x15\n\x11\x45NDPOINTS_LISTING\x10\n\x12\x17\n\x13\x43LOUD_REGISTRATIONS\x10\x0b\x12\x15\n\x11PUSH_NOTIFICATION\x10\x0c\"?\n\x16ResponsePayloadWrapper\x12%\n\x07\x64\x65tails\x18\x01 \x01(\x0b\x32\x14.google.protobuf.Anyb\x06proto3' - , - dependencies=[google_dot_protobuf_dot_any__pb2.DESCRIPTOR,google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) - - + name='messaging/response/response.proto', + package='agrirouter.response', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n!messaging/response/response.proto\x12\x13\x61grirouter.response\x1a\x19google/protobuf/any.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xcb\x03\n\x10ResponseEnvelope\x12\x15\n\rresponse_code\x18\x01 \x01(\x05\x12\x44\n\x04type\x18\x02 \x01(\x0e\x32\x36.agrirouter.response.ResponseEnvelope.ResponseBodyType\x12\x1e\n\x16\x61pplication_message_id\x18\x03 \x01(\t\x12\x12\n\nmessage_id\x18\x04 \x01(\t\x12-\n\ttimestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xf6\x01\n\x10ResponseBodyType\x12\x0c\n\x08MESSAGES\x10\x00\x12\x07\n\x03\x41\x43K\x10\x01\x12\x15\n\x11\x41\x43K_WITH_MESSAGES\x10\x02\x12\x14\n\x10\x41\x43K_WITH_FAILURE\x10\x03\x12\x1c\n\x18\x41\x43K_FOR_FEED_HEADER_LIST\x10\x06\x12\x18\n\x14\x41\x43K_FOR_FEED_MESSAGE\x10\x07\x12\x1f\n\x1b\x41\x43K_FOR_FEED_FAILED_MESSAGE\x10\x08\x12\x15\n\x11\x45NDPOINTS_LISTING\x10\n\x12\x17\n\x13\x43LOUD_REGISTRATIONS\x10\x0b\x12\x15\n\x11PUSH_NOTIFICATION\x10\x0c\"?\n\x16ResponsePayloadWrapper\x12%\n\x07\x64\x65tails\x18\x01 \x01(\x0b\x32\x14.google.protobuf.Anyb\x06proto3' + , + dependencies=[google_dot_protobuf_dot_any__pb2.DESCRIPTOR, google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, ]) _RESPONSEENVELOPE_RESPONSEBODYTYPE = _descriptor.EnumDescriptor( - name='ResponseBodyType', - full_name='agrirouter.response.ResponseEnvelope.ResponseBodyType', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='MESSAGES', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ACK', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ACK_WITH_MESSAGES', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ACK_WITH_FAILURE', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ACK_FOR_FEED_HEADER_LIST', index=4, number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ACK_FOR_FEED_MESSAGE', index=5, number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ACK_FOR_FEED_FAILED_MESSAGE', index=6, number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ENDPOINTS_LISTING', index=7, number=10, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='CLOUD_REGISTRATIONS', index=8, number=11, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='PUSH_NOTIFICATION', index=9, number=12, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=332, - serialized_end=578, + name='ResponseBodyType', + full_name='agrirouter.response.ResponseEnvelope.ResponseBodyType', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='MESSAGES', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ACK', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ACK_WITH_MESSAGES', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ACK_WITH_FAILURE', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ACK_FOR_FEED_HEADER_LIST', index=4, number=6, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ACK_FOR_FEED_MESSAGE', index=5, number=7, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ACK_FOR_FEED_FAILED_MESSAGE', index=6, number=8, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='ENDPOINTS_LISTING', index=7, number=10, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='CLOUD_REGISTRATIONS', index=8, number=11, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='PUSH_NOTIFICATION', index=9, number=12, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=332, + serialized_end=578, ) _sym_db.RegisterEnumDescriptor(_RESPONSEENVELOPE_RESPONSEBODYTYPE) - _RESPONSEENVELOPE = _descriptor.Descriptor( - name='ResponseEnvelope', - full_name='agrirouter.response.ResponseEnvelope', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='response_code', full_name='agrirouter.response.ResponseEnvelope.response_code', index=0, - number=1, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='type', full_name='agrirouter.response.ResponseEnvelope.type', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='application_message_id', full_name='agrirouter.response.ResponseEnvelope.application_message_id', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='message_id', full_name='agrirouter.response.ResponseEnvelope.message_id', index=3, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='timestamp', full_name='agrirouter.response.ResponseEnvelope.timestamp', index=4, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _RESPONSEENVELOPE_RESPONSEBODYTYPE, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=119, - serialized_end=578, + name='ResponseEnvelope', + full_name='agrirouter.response.ResponseEnvelope', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='response_code', full_name='agrirouter.response.ResponseEnvelope.response_code', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='type', full_name='agrirouter.response.ResponseEnvelope.type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='application_message_id', full_name='agrirouter.response.ResponseEnvelope.application_message_id', + index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='message_id', full_name='agrirouter.response.ResponseEnvelope.message_id', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='timestamp', full_name='agrirouter.response.ResponseEnvelope.timestamp', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _RESPONSEENVELOPE_RESPONSEBODYTYPE, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=119, + serialized_end=578, ) - _RESPONSEPAYLOADWRAPPER = _descriptor.Descriptor( - name='ResponsePayloadWrapper', - full_name='agrirouter.response.ResponsePayloadWrapper', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='details', full_name='agrirouter.response.ResponsePayloadWrapper.details', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=580, - serialized_end=643, + name='ResponsePayloadWrapper', + full_name='agrirouter.response.ResponsePayloadWrapper', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='details', full_name='agrirouter.response.ResponsePayloadWrapper.details', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=580, + serialized_end=643, ) _RESPONSEENVELOPE.fields_by_name['type'].enum_type = _RESPONSEENVELOPE_RESPONSEBODYTYPE @@ -194,18 +190,17 @@ _sym_db.RegisterFileDescriptor(DESCRIPTOR) ResponseEnvelope = _reflection.GeneratedProtocolMessageType('ResponseEnvelope', (_message.Message,), { - 'DESCRIPTOR' : _RESPONSEENVELOPE, - '__module__' : 'messaging.response.response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.response.ResponseEnvelope) - }) + 'DESCRIPTOR': _RESPONSEENVELOPE, + '__module__': 'messaging.response.response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.response.ResponseEnvelope) +}) _sym_db.RegisterMessage(ResponseEnvelope) ResponsePayloadWrapper = _reflection.GeneratedProtocolMessageType('ResponsePayloadWrapper', (_message.Message,), { - 'DESCRIPTOR' : _RESPONSEPAYLOADWRAPPER, - '__module__' : 'messaging.response.response_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.response.ResponsePayloadWrapper) - }) + 'DESCRIPTOR': _RESPONSEPAYLOADWRAPPER, + '__module__': 'messaging.response.response_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.response.ResponsePayloadWrapper) +}) _sym_db.RegisterMessage(ResponsePayloadWrapper) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/generated/settings/dh_settings_pb2.py b/agrirouter/generated/settings/dh_settings_pb2.py index c40238fc..d806d85b 100644 --- a/agrirouter/generated/settings/dh_settings_pb2.py +++ b/agrirouter/generated/settings/dh_settings_pb2.py @@ -6,72 +6,68 @@ 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='settings/dh-settings.proto', - package='agrirouter.message.settings', - syntax='proto3', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x1asettings/dh-settings.proto\x12\x1b\x61grirouter.message.settings\"R\n\x16\x44\x61taHubControlSettings\x12\x18\n\x10max_message_size\x18\x01 \x01(\x05\x12\x1e\n\x16max_messages_per_query\x18\x02 \x01(\x05\x62\x06proto3' + name='settings/dh-settings.proto', + package='agrirouter.message.settings', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x1asettings/dh-settings.proto\x12\x1b\x61grirouter.message.settings\"R\n\x16\x44\x61taHubControlSettings\x12\x18\n\x10max_message_size\x18\x01 \x01(\x05\x12\x1e\n\x16max_messages_per_query\x18\x02 \x01(\x05\x62\x06proto3' ) - - - _DATAHUBCONTROLSETTINGS = _descriptor.Descriptor( - name='DataHubControlSettings', - full_name='agrirouter.message.settings.DataHubControlSettings', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='max_message_size', full_name='agrirouter.message.settings.DataHubControlSettings.max_message_size', index=0, - number=1, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_messages_per_query', full_name='agrirouter.message.settings.DataHubControlSettings.max_messages_per_query', index=1, - number=2, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=59, - serialized_end=141, + name='DataHubControlSettings', + full_name='agrirouter.message.settings.DataHubControlSettings', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='max_message_size', full_name='agrirouter.message.settings.DataHubControlSettings.max_message_size', + index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='max_messages_per_query', + full_name='agrirouter.message.settings.DataHubControlSettings.max_messages_per_query', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=59, + serialized_end=141, ) DESCRIPTOR.message_types_by_name['DataHubControlSettings'] = _DATAHUBCONTROLSETTINGS _sym_db.RegisterFileDescriptor(DESCRIPTOR) DataHubControlSettings = _reflection.GeneratedProtocolMessageType('DataHubControlSettings', (_message.Message,), { - 'DESCRIPTOR' : _DATAHUBCONTROLSETTINGS, - '__module__' : 'settings.dh_settings_pb2' - # @@protoc_insertion_point(class_scope:agrirouter.message.settings.DataHubControlSettings) - }) + 'DESCRIPTOR': _DATAHUBCONTROLSETTINGS, + '__module__': 'settings.dh_settings_pb2' + # @@protoc_insertion_point(class_scope:agrirouter.message.settings.DataHubControlSettings) +}) _sym_db.RegisterMessage(DataHubControlSettings) - # @@protoc_insertion_point(module_scope) diff --git a/agrirouter/messaging/builders.py b/agrirouter/messaging/builders.py index d7815042..8358d701 100644 --- a/agrirouter/messaging/builders.py +++ b/agrirouter/messaging/builders.py @@ -18,14 +18,14 @@ def clear(self): def with_task_data(self): subscription_item = Subscription.MessageTypeSubscriptionItem( - technical_message_type=CapabilityType.ISO_11783_TASKDATA_ZIP.value + technical_message_type=CapabilityType.ISO_11783_TASK_DATA_ZIP.value ) self._subscription_items.append(subscription_item) return self def with_device_description(self, ddis: List[int] = None, position: bool = None): subscription_item = Subscription.MessageTypeSubscriptionItem( - technical_message_type=CapabilityType.ISO_11783_DEVICE_DESCRIPTION_PROTOBUF.value, + technical_message_type=CapabilityType.ISO_11783_DEVICE_DESCRIPTION.value, ddis=ddis, position=position ) @@ -34,7 +34,7 @@ def with_device_description(self, ddis: List[int] = None, position: bool = None) def with_time_log(self, ddis: List[int] = None, position: bool = None): subscription_item = Subscription.MessageTypeSubscriptionItem( - technical_message_type=CapabilityType.ISO_11783_TIMELOG_PROTOBUF.value, + technical_message_type=CapabilityType.ISO_11783_TIMELOG.value, ddis=ddis, position=position ) @@ -119,21 +119,21 @@ def clear(self): def with_task_data(self, direction: int): capability = CapabilitySpecification.Capability() capability.direction = direction - capability.technical_message_type = CapabilityType.ISO_11783_TASKDATA_ZIP.value + capability.technical_message_type = CapabilityType.ISO_11783_TASK_DATA_ZIP.value self._capabilities.append(capability) return self def with_device_description(self, direction: int): capability = CapabilitySpecification.Capability() capability.direction = direction - capability.technical_message_type = CapabilityType.ISO_11783_DEVICE_DESCRIPTION_PROTOBUF.value + capability.technical_message_type = CapabilityType.ISO_11783_DEVICE_DESCRIPTION.value self._capabilities.append(capability) return self def with_time_log(self, direction: int): capability = CapabilitySpecification.Capability() capability.direction = direction - capability.technical_message_type = CapabilityType.ISO_11783_TIMELOG_PROTOBUF.value + capability.technical_message_type = CapabilityType.ISO_11783_TIMELOG.value self._capabilities.append(capability) return self diff --git a/agrirouter/messaging/certification.py b/agrirouter/messaging/certification.py index c87afc83..d8f039f0 100644 --- a/agrirouter/messaging/certification.py +++ b/agrirouter/messaging/certification.py @@ -1,12 +1,10 @@ import os import tempfile +from agrirouter.onboarding.response import OnboardResponse -from agrirouter.onboarding.response import SoftwareOnboardingResponse - - -def create_certificate_file_from_pen(onboard_response: SoftwareOnboardingResponse): +def create_certificate_file_from_pen(onboard_response: OnboardResponse): dir_ = tempfile.mkdtemp() prefix = onboard_response.get_sensor_alternate_id() data = onboard_response.get_authentication().get_certificate() diff --git a/agrirouter/messaging/clients/http.py b/agrirouter/messaging/clients/http.py index cf1e400f..0cb4b215 100644 --- a/agrirouter/messaging/clients/http.py +++ b/agrirouter/messaging/clients/http.py @@ -5,17 +5,16 @@ from urllib.parse import urlparse from agrirouter.messaging.certification import create_certificate_file_from_pen -from agrirouter.onboarding.response import SoftwareOnboardingResponse +from agrirouter.onboarding.response import OnboardResponse class HttpClient: - headers = { "Content-Type": "application/json", "Accept": "application/json" } - def make_connection(self, certificate_file_path: str, uri: str, onboard_response: SoftwareOnboardingResponse): + def make_connection(self, certificate_file_path: str, uri: str, onboard_response: OnboardResponse): context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context.load_cert_chain( certfile=certificate_file_path, @@ -29,7 +28,7 @@ def make_connection(self, certificate_file_path: str, uri: str, onboard_response ) return connection - def send_measure(self, onboard_response: SoftwareOnboardingResponse, request_body=None): + def send_measure(self, onboard_response: OnboardResponse, request_body=None): return self.send( method="POST", uri=onboard_response.get_connection_criteria().get_measures(), @@ -37,7 +36,7 @@ def send_measure(self, onboard_response: SoftwareOnboardingResponse, request_bod request_body=request_body ) - def send_command(self, onboard_response: SoftwareOnboardingResponse, request_body=None): + def send_command(self, onboard_response: OnboardResponse, request_body=None): return self.send( method="GET", uri=onboard_response.get_connection_criteria().get_commands(), @@ -45,7 +44,7 @@ def send_command(self, onboard_response: SoftwareOnboardingResponse, request_bod request_body=request_body ) - def send(self, method: str, uri: str, onboard_response: SoftwareOnboardingResponse, request_body=None): + def send(self, method: str, uri: str, onboard_response: OnboardResponse, request_body=None): certificate_file_path = create_certificate_file_from_pen(onboard_response) try: connection = self.make_connection(certificate_file_path, uri, onboard_response) diff --git a/agrirouter/messaging/clients/mqtt.py b/agrirouter/messaging/clients/mqtt.py index 423897d0..c73d3f76 100644 --- a/agrirouter/messaging/clients/mqtt.py +++ b/agrirouter/messaging/clients/mqtt.py @@ -1,5 +1,6 @@ -import time +import logging import ssl +import time from typing import Any, List, Tuple import paho.mqtt.client as mqtt_client @@ -10,6 +11,7 @@ class MqttClient: + _log = logging.getLogger(__name__) def __init__(self, onboard_response, @@ -47,6 +49,7 @@ def __init__(self, self._mode = None def connect(self, host: str, port: str) -> None: + self._log.debug(f"Connecting client to MQTT broker at {host}:{port}") self.mqtt_client.connect( host=host, port=int(port) @@ -56,6 +59,7 @@ def connect(self, host: str, port: str) -> None: self._mode = SYNC def connect_async(self, host: str, port: str): + self._log.debug(f"Connecting async client to MQTT broker at {host}:{port}") self.mqtt_client.connect_async( host=host, port=int(port) @@ -68,6 +72,7 @@ def connect_async(self, host: str, port: str): time.sleep(1) def disconnect(self): + self._log.debug("Disconnecting client from MQTT broker") self.mqtt_client.loop_stop() self.mqtt_client.disconnect() @@ -81,6 +86,7 @@ def publish(self, topic, payload, qos=2) -> MQTTMessageInfo: :param qos: int representing the quality of service level to use. May be [0, 1, 2] :return: MQTTMessageInfo """ + self._log.debug(f"Publishing message on topic {topic} with payload {payload}") message_info = self.mqtt_client.publish( topic=topic, payload=payload, @@ -88,8 +94,9 @@ def publish(self, topic, payload, qos=2) -> MQTTMessageInfo: ) if self._mode == SYNC: self.mqtt_client.loop() - time.sleep(3) + time.sleep(3) # TODO: Check / Remove this sleep? self.mqtt_client.loop() + self._log.debug(f"Message published with message info: {message_info}") return message_info def subscribe(self, topics: List[Tuple[str, int]]) -> tuple: @@ -105,6 +112,7 @@ def subscribe(self, topics: List[Tuple[str, int]]) -> tuple: :return: tuple """ + self._log.debug(f"Subscribing to topics {topics}") result, mid = self.mqtt_client.subscribe(topics, qos=2) return result, mid @@ -119,6 +127,7 @@ def unsubscribe(self, topics: List[str]) -> tuple: :return: tuple """ + self._log.debug(f"Unsubscribing from topics {topics}") result, mid = self.mqtt_client.unsubscribe(topics) return result, mid diff --git a/agrirouter/messaging/decode.py b/agrirouter/messaging/decode.py index 3622aa5d..9f8b2258 100644 --- a/agrirouter/messaging/decode.py +++ b/agrirouter/messaging/decode.py @@ -1,4 +1,5 @@ import base64 +import logging from google.protobuf.any_pb2 import Any from google.protobuf.internal.decoder import _DecodeVarint @@ -9,12 +10,15 @@ MessageQueryResponse from agrirouter.generated.messaging.response.payload.feed.push_notification_pb2 import PushNotification from agrirouter.generated.messaging.response.response_pb2 import ResponseEnvelope, ResponsePayloadWrapper -from agrirouter.messaging.exceptions import DecodeMessageException +from agrirouter.api.exceptions import CanNotDecodeMessage from agrirouter.messaging.messages import DecodedMessage from agrirouter.utils.type_url import TypeUrl def read_properties_buffers_from_input_stream(input_stream) -> tuple: + """ + Read the properties from the input stream. + """ result = [] pos = 0 while pos < len(input_stream): @@ -29,20 +33,26 @@ def read_properties_buffers_from_input_stream(input_stream) -> tuple: def decode_response(message: bytes) -> DecodedMessage: + """ + Decode the response itself. + """ input_stream = base64.b64decode(message) response_envelope_buffer, response_payload_buffer = read_properties_buffers_from_input_stream(input_stream) - envelope = ResponseEnvelope() envelope.ParseFromString(response_envelope_buffer) payload = ResponsePayloadWrapper() payload.ParseFromString(response_payload_buffer) - message = DecodedMessage(envelope, payload) - return message def decode_details(details: Any): + """ + Decode the details of a response. + """ + _log = logging.getLogger(__name__) + _log.debug(f"Decoding details of type {details.type_url}.") + if details.type_url == TypeUrl.get_type_url(Messages): messages = Messages() messages.MergeFromString(details.value) @@ -60,8 +70,9 @@ def decode_details(details: Any): message_query_response.MergeFromString(details.value) return message_query_response elif details.type_url == TypeUrl.get_type_url(PushNotification): - pushnotification = PushNotification() - pushnotification.MergeFromString(details.value) - return pushnotification + push_notification = PushNotification() + push_notification.MergeFromString(details.value) + return push_notification else: - raise DecodeMessageException(f"Could not handle type {details.type_url} while decoding details.") + + raise CanNotDecodeMessage(f"Could not handle type {details.type_url} while decoding details.") diff --git a/agrirouter/messaging/encode.py b/agrirouter/messaging/encode.py index 0e1aa45d..34020ea3 100644 --- a/agrirouter/messaging/encode.py +++ b/agrirouter/messaging/encode.py @@ -1,16 +1,27 @@ import base64 +import logging +from typing import List from google.protobuf.any_pb2 import Any from google.protobuf.internal.encoder import _VarintBytes +from agrirouter.generated.commons.chunk_pb2 import ChunkComponent from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope, RequestPayloadWrapper - +from agrirouter.messaging.messages import MessageParameterTuple from agrirouter.messaging.parameters.service import MessageHeaderParameters, MessagePayloadParameters +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.onboarding.response import OnboardResponse from agrirouter.utils.utc_time_util import now_as_utc_timestamp from agrirouter.utils.uuid_util import new_uuid +MAX_LENGTH_FOR_RAW_MESSAGE_CONTENT = 767997 // 2 +log = logging.getLogger("com.dke.data.agrirouter.sdk.encode") + def write_proto_parts_to_buffer(parts: list, buffer: bytes = b""): + """ + Writing proto parts to buffer + """ for part in parts: part_size = part.ByteSize() buffer += _VarintBytes(part_size) @@ -20,21 +31,33 @@ def write_proto_parts_to_buffer(parts: list, buffer: bytes = b""): def encode_message(header_parameters: MessageHeaderParameters, payload_parameters: MessagePayloadParameters) -> str: + """ + Encoding message with the following arguments + :header_parameters - Message Header Parameters + :payload_parameters: Message Payload Parameters + Returns decoded data + """ request_envelope = encode_header(header_parameters) request_payload = encode_payload(payload_parameters) - raw_data = write_proto_parts_to_buffer([request_envelope, request_payload]) - return base64.b64encode(raw_data).decode() def encode_header(header_parameters: MessageHeaderParameters) -> RequestEnvelope: + """ + Encode header to RequestEnvelope protobuf + :header_parameters: Message Header Parameters + Returns RequestEnvelope with parameters set + """ request_envelope = RequestEnvelope() request_envelope.application_message_id = header_parameters.get_application_message_id() \ if header_parameters.get_application_message_id() else new_uuid() request_envelope.application_message_seq_no = header_parameters.get_application_message_seq_no() request_envelope.technical_message_type = header_parameters.get_technical_message_type() - request_envelope.mode = header_parameters.get_mode() + + request_envelope.mode = header_parameters.get_mode() \ + if header_parameters.get_mode() else RequestEnvelope.Mode.Value("DIRECT") + if header_parameters.get_team_set_context_id() is not None: request_envelope.team_set_context_id = header_parameters.get_team_set_context_id() request_envelope.timestamp.FromDatetime(now_as_utc_timestamp()) @@ -49,8 +72,99 @@ def encode_header(header_parameters: MessageHeaderParameters) -> RequestEnvelope def encode_payload(payload_parameters: MessagePayloadParameters) -> RequestPayloadWrapper: + """ + Encode header to RequestPayloadWrapper protobuf + :payload_parameters: Message Payload Parameters + Returns RequestPayloadWrapper with parameters set + """ any_proto_wrapper = Any() any_proto_wrapper.type_url = payload_parameters.get_type_url() any_proto_wrapper.value = payload_parameters.get_value() request_payload = RequestPayloadWrapper(details=any_proto_wrapper) return request_payload + + +def encode_chunks_message(message_parameter_tuple: List[MessageParameterTuple]) -> List: + """ + Encode chunks of messages + :message_parameter_tuple - Tuple of message parameters + Returns list of encoded chunked messages + """ + return [encode_message(_tuple.message_header_parameters, _tuple.message_payload_parameters) for _tuple in + message_parameter_tuple] + + +def chunk_and_base64encode_each_chunk(header_parameters: MessageHeaderParameters, + payload_parameters: MessagePayloadParameters, + onboarding_response: OnboardResponse) -> List[MessageParameterTuple]: + """ + Chunk and encode each chunk + :header_parameters - Message Header Parameters + :payload_parameters - Message Payload Parameters + :onboarding_response - Onboarding Response for endpoint ID + Returns list of message parameter tuples + """ + + whole_message = payload_parameters.get_value() + message_chunks = split_into_chunks(whole_message) + + if payload_parameters is None or header_parameters is None: + raise ValueError('The parameters cannot be NULL') + + if len(whole_message) <= MAX_LENGTH_FOR_RAW_MESSAGE_CONTENT: + log.info("Message is not chunked, because it is smaller than the maximum size of a chunk.") + return [MessageParameterTuple(message_header_parameters=header_parameters, + message_payload_parameters=payload_parameters)] + + log.info("Message is chunked, because it is bigger than the maximum size of a chunk.") + tuples = [] + chunk_context_id = new_uuid() + chunk_number = 1 + + for chunk in message_chunks: + chunk_message_id = new_uuid() + sequence_number_for_chunk = SequenceNumberService.next_seq_nr( + onboarding_response.get_sensor_alternate_id()) + + header_parameters_copy = MessageHeaderParameters() + header_parameters_copy.set_application_message_id(chunk_message_id) + header_parameters_copy.set_application_message_seq_no(sequence_number_for_chunk) + + chunk_info = ChunkComponent() + chunk_info.context_id = chunk_context_id + chunk_info.current = chunk_number + chunk_info.total = len(message_chunks) + chunk_info.total_size = len(whole_message) + header_parameters_copy.chunk_component = chunk_info + header_parameters_copy.technical_message_type = header_parameters.get_technical_message_type() + header_parameters_copy.mode = header_parameters.get_mode() + header_parameters_copy.recipients = header_parameters.get_recipients() + + payload_parameters_copy = MessagePayloadParameters(type_url='', + value='') + payload_parameters_copy.value = base64.b64encode(chunk) + payload_parameters_copy.type_url = payload_parameters.get_type_url() + + tuples.append(MessageParameterTuple(message_header_parameters=header_parameters_copy, + message_payload_parameters=payload_parameters_copy)) + chunk_number += 1 + + log.info("Message was chunked into %s chunks.", len(tuples)) + return tuples + + +def split_into_chunks(whole_message: str): + """ + Split the whole message into chunks + :whole_message - Message to split into chunks + Returns a list of chunks + """ + chunks = [] + remaining_bytes = whole_message + while len(remaining_bytes) > MAX_LENGTH_FOR_RAW_MESSAGE_CONTENT: + chunk = remaining_bytes[:MAX_LENGTH_FOR_RAW_MESSAGE_CONTENT] + chunks.append(chunk) + remaining_bytes = remaining_bytes[MAX_LENGTH_FOR_RAW_MESSAGE_CONTENT:] + if len(remaining_bytes) > 0: + chunks.append(remaining_bytes) + return chunks diff --git a/agrirouter/messaging/enums.py b/agrirouter/messaging/enums.py index 53265ec5..530729cf 100644 --- a/agrirouter/messaging/enums.py +++ b/agrirouter/messaging/enums.py @@ -1,7 +1,11 @@ -from agrirouter.auth.enums import BaseEnum +from agrirouter.api.enums import BaseEnum class TechnicalMessageType(BaseEnum): + """ + Technical message type. + """ + EMPTY = "" CAPABILITIES = "dke:capabilities" SUBSCRIPTION = "dke:subscription" @@ -16,9 +20,13 @@ class TechnicalMessageType(BaseEnum): class CapabilityType(BaseEnum): - ISO_11783_TASKDATA_ZIP = "iso:11783:-10:taskdata:zip" - ISO_11783_DEVICE_DESCRIPTION_PROTOBUF = "iso:11783:-10:device_description:protobuf" - ISO_11783_TIMELOG_PROTOBUF = "iso:11783:-10:time_log:protobuf" + """ + Type of the capability. + """ + + ISO_11783_TASK_DATA_ZIP = "iso:11783:-10:taskdata:zip" + ISO_11783_DEVICE_DESCRIPTION = "iso:11783:-10:device_description:protobuf" + ISO_11783_TIMELOG = "iso:11783:-10:time_log:protobuf" IMG_BMP = "img:bmp" IMG_JPEG = "img:jpeg" IMG_PNG = "img:png" @@ -28,3 +36,13 @@ class CapabilityType(BaseEnum): VID_MP4 = "vid:mp4" VID_WMV = "vid:wmv" GPS_INFO = "gps:info" + + +class CapabilityDirectionType(BaseEnum): + """ + Direction of the capability. + """ + + SEND = "SEND" + RECEIVE = "RECEIVE" + SEND_RECEIVE = "SEND_RECEIVE" diff --git a/agrirouter/messaging/exceptions.py b/agrirouter/messaging/exceptions.py deleted file mode 100644 index 2bc8b9a7..00000000 --- a/agrirouter/messaging/exceptions.py +++ /dev/null @@ -1,17 +0,0 @@ -from agrirouter.onboarding.exceptions import AgriRouuterBaseException - - -class TypeUrlNotFoundError(AgriRouuterBaseException): - _message = "Given type url not found" - - -class WrongFieldError(AgriRouuterBaseException): - _message = "Unknown field" - - -class DecodeMessageException(AgriRouuterBaseException): - _message = "Can't decode message" - - -class OutboxException(AgriRouuterBaseException): - _message = "Can't fetch outbox message" diff --git a/agrirouter/messaging/messages.py b/agrirouter/messaging/messages.py index 7db4e461..3615e5ef 100644 --- a/agrirouter/messaging/messages.py +++ b/agrirouter/messaging/messages.py @@ -1,7 +1,7 @@ import json from typing import Union, Dict -from agrirouter.messaging.exceptions import WrongFieldError +from agrirouter.api.exceptions import WrongField from agrirouter.utils.utc_time_util import now_as_utc_str @@ -57,7 +57,7 @@ def json_deserialize(self, data: Union[Dict[str, str], str]): if key == self.MESSAGE: self.message = value else: - raise WrongFieldError(f"Unknown field `{key}` for {self.__class__}") + raise WrongField(f"Unknown field `{key}` for {self.__class__}") def get_message(self) -> str: return self.message @@ -67,7 +67,6 @@ def set_message(self, message: str): class OutboxMessage: - CAPABILITY_ALTERNATE_ID = "capabilityAlternateId" SENSOR_ALTERNATE_ID = "sensorAlternateId" COMMAND = "command" @@ -93,7 +92,7 @@ def json_deserialize(self, data: Union[dict, str]): command.json_deserialize(value) self.command = command else: - raise WrongFieldError(f"Unknown field `{key}` for {self.__class__}") + raise WrongField(f"Unknown field `{key}` for {self.__class__}") def get_capability_alternate_id(self) -> str: return self.capability_alternate_id @@ -112,3 +111,13 @@ def get_command(self) -> Command: def set_command(self, command: Command) -> None: self.command = command + + +class MessageParameterTuple: + """ + Class used to form a tuple of header and payload parameters + """ + + def __init__(self, message_header_parameters, message_payload_parameters): + self.message_header_parameters = message_header_parameters + self.message_payload_parameters = message_payload_parameters diff --git a/agrirouter/messaging/parameters/dto.py b/agrirouter/messaging/parameters/dto.py index 17998bf0..71d4e1d8 100644 --- a/agrirouter/messaging/parameters/dto.py +++ b/agrirouter/messaging/parameters/dto.py @@ -1,8 +1,9 @@ from copy import deepcopy from typing import List +from agrirouter.generated.commons.chunk_pb2 import ChunkComponent from agrirouter.messaging.messages import EncodedMessage -from agrirouter.onboarding.response import BaseOnboardingResonse +from agrirouter.onboarding.response import BaseOnboardingResponse class Parameters: @@ -44,7 +45,7 @@ def __init__(self, application_message_seq_no: int, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse + onboarding_response: BaseOnboardingResponse ): super(MessageParameters, self).__init__( application_message_seq_no=application_message_seq_no, @@ -54,7 +55,7 @@ def __init__(self, self.onboarding_response = onboarding_response - def get_onboarding_response(self) -> BaseOnboardingResonse: + def get_onboarding_response(self) -> BaseOnboardingResponse: return self.onboarding_response @@ -62,13 +63,12 @@ class MessagingParameters(MessageParameters): def __init__(self, *, - application_message_seq_no: str = None, + application_message_seq_no: int = None, application_message_id: str = None, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse, + onboarding_response: BaseOnboardingResponse, encoded_messages=None ): - super(MessagingParameters, self).__init__( application_message_seq_no=application_message_seq_no, application_message_id=application_message_id, @@ -89,3 +89,129 @@ def append_encoded_messages(self, encoded_message: EncodedMessage): def extend_encoded_messages(self, encoded_messages: List[EncodedMessage]): self._encoded_messages.extend(encoded_messages) + + +class SendMessageParameters(MessageParameters): + """ + Parameters to send messages to the agrirouter + The class inherits from MessageParameters class + """ + + def __init__(self, + *, + onboarding_response: BaseOnboardingResponse, + technical_message_type: str, + recipients: list = None, + chunk_component=None, + base64_message_content: bytes, + type_url: str = None, + chunk_size: int = None, + application_message_id: str, + application_message_seq_no: int, + mode + ): + """ + onboarding_response: Onboarding response of the sender + technical_message_type: TechnicalMessageType class to be sent + recipients: List of recipients + chunk_components: Chunk Information + base64_message_content: Message content that is sent + type_url: Url needed for MessagePayloadParameters + chunk_size: Define the size of the chunks + application_message_id: The application message ID + application_message_seq_no: Sequence number while sending the messages + to the agrirouter with SequenceNumberService + """ + + super(SendMessageParameters, self).__init__(application_message_id=application_message_id, + application_message_seq_no=application_message_seq_no, + onboarding_response=onboarding_response) + + self._technical_message_type = technical_message_type + self._base64_message_content = base64_message_content + self._type_url = type_url + self._mode = mode + + if recipients: + self._recipients = recipients + + if chunk_component: + self._chunk_component = chunk_component + else: + self._chunk_component = None + + if chunk_size: + self._chunk_size = chunk_size + + def get_technical_message_type(self): + return self._technical_message_type + + def get_recipients(self) -> list: + return self._recipients + + def get_chunk_component(self) -> ChunkComponent: + return self._chunk_component + + def get_base64_message_content(self): + return self._base64_message_content + + def get_type_url(self) -> str: + return self._type_url + + def get_chunk_size(self) -> int: + return self._chunk_size + + def get_mode(self): + return self._mode + + +class ChunkedMessageParameters(MessageParameters): + """ + Parameters to send chunked messages to the agrirouter + The class inherits from MessageParameters class + """ + + def __init__(self, + *, + onboarding_response: BaseOnboardingResponse, + technical_message_type: str = None, + recipients: List = None, + application_message_id: str = None, + application_message_seq_no: int = None, + encoded_chunked_messages: List[str] = None, + ): + """ + onboarding_response: Onboarding response of the sender + technical_message_type: TechnicalMessageType class to be sent + recipients: List of recipients + application_message_id: The application message ID + application_message_seq_no: Sequence number while sending the messages + to the agrirouter with SequenceNumberService + encoded_chunked_messages: List of encoded chunked messages + """ + + super(ChunkedMessageParameters, self).__init__(application_message_id=application_message_id, + application_message_seq_no=application_message_seq_no, + onboarding_response=onboarding_response) + + self._technical_message_type = technical_message_type + self._recipients = recipients + self._encoded_chunked_messages = encoded_chunked_messages + + def get_technical_message_type(self): + return self._technical_message_type + + def set_technical_message_type(self, technical_message_type: str): + self._technical_message_type = technical_message_type + + def get_recipients(self) -> list: + return self._recipients + + def set_recipients(self, recipients: list): + self._recipients = recipients + + def get_encoded_chunked_messages(self) -> List[str]: + return self._encoded_chunked_messages + + def set_encoded_chunked_messages(self, encoded_chunked_messages: List[str]): + self._encoded_chunked_messages = encoded_chunked_messages diff --git a/agrirouter/messaging/parameters/service.py b/agrirouter/messaging/parameters/service.py index 64a63620..184ce1d2 100644 --- a/agrirouter/messaging/parameters/service.py +++ b/agrirouter/messaging/parameters/service.py @@ -7,7 +7,7 @@ from agrirouter.generated.messaging.request.payload.endpoint.subscription_pb2 import Subscription from agrirouter.generated.messaging.request.payload.feed.feed_requests_pb2 import ValidityPeriod from agrirouter.messaging.parameters.dto import MessageParameters, Parameters -from agrirouter.onboarding.response import BaseOnboardingResonse +from agrirouter.onboarding.response import BaseOnboardingResponse class MessageHeaderParameters(Parameters): @@ -58,7 +58,6 @@ def __init__(self, type_url: str, value: str, ): - self.type_url = type_url self.value = value @@ -77,7 +76,7 @@ def __init__(self, application_message_seq_no: int, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse + onboarding_response: BaseOnboardingResponse ): self.onboarding_requests = onboarding_requests if onboarding_requests else [] super(CloudOnboardParameters, self).__init__( @@ -108,7 +107,7 @@ def __init__(self, application_message_seq_no: int, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse + onboarding_response: BaseOnboardingResponse ): self.endpoints = endpoints if endpoints else [] super(CloudOffboardParameters, self).__init__( @@ -131,7 +130,7 @@ def extend_endpoints(self, endpoints: List[str]) -> None: self.endpoints.extend(endpoints) -class CapabilityParameters(MessageParameters): +class CapabilitiesParameters(MessageParameters): def __init__(self, *, @@ -142,13 +141,13 @@ def __init__(self, application_message_seq_no: int, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse + onboarding_response: BaseOnboardingResponse ): self.application_id = application_id self.certification_version_id = certification_version_id self.enable_push_notification = enable_push_notification self.capability_parameters = capability_parameters if capability_parameters else [] - super(CapabilityParameters, self).__init__( + super(CapabilitiesParameters, self).__init__( application_message_seq_no=application_message_seq_no, application_message_id=application_message_id, team_set_context_id=team_set_context_id, @@ -193,7 +192,7 @@ def __init__(self, application_message_seq_no: int, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse + onboarding_response: BaseOnboardingResponse ): self.message_ids = message_ids if message_ids else [] super(FeedConfirmParameters, self).__init__( @@ -225,7 +224,7 @@ def __init__(self, application_message_seq_no: int, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse, + onboarding_response: BaseOnboardingResponse, ): self.message_ids = message_ids if message_ids else [] self.senders = senders if senders else [] @@ -277,7 +276,7 @@ def __init__(self, application_message_seq_no: int, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse, + onboarding_response: BaseOnboardingResponse, ): self.technical_message_type = technical_message_type self.direction = direction @@ -317,7 +316,7 @@ def __init__(self, application_message_seq_no: int, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse, + onboarding_response: BaseOnboardingResponse, ): self.senders = senders self.message_ids = message_ids @@ -369,7 +368,7 @@ def __init__(self, application_message_seq_no: int, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse, + onboarding_response: BaseOnboardingResponse, ): self.senders = senders self.message_ids = message_ids @@ -418,7 +417,7 @@ def __init__(self, application_message_seq_no: int, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse, + onboarding_response: BaseOnboardingResponse, subscription_items: List[Subscription.MessageTypeSubscriptionItem] = None, ): self.subscription_items = subscription_items if subscription_items else [] @@ -451,7 +450,7 @@ def __init__(self, recipients: list, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse + onboarding_response: BaseOnboardingResponse ): self.image_encoded = image_encoded self.image_filename = image_filename @@ -495,7 +494,7 @@ def __init__(self, recipients: list, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse + onboarding_response: BaseOnboardingResponse ): self.task_encoded = task_encoded self.task_filename = task_filename @@ -516,16 +515,16 @@ def get_task_encoded(self): def get_task_filename(self): return self.task_filename - + def get_chunk_context_id(self): return self.chunk_context_id - + def get_chunk_current(self): return self.chunk_current - + def get_chunk_total(self): return self.chunk_total - + def get_chunk_total_size(self): return self.chunk_total_size @@ -537,16 +536,16 @@ def set_task_encoded(self, task_encoded): def set_task_filename(self, task_filename): self.task_filename = task_filename - + def set_chunk_context_id(self, chunk_context_id): self.chunk_context_id = chunk_context_id - + def set_chunk_current(self, chunk_current): self.chunk_current = chunk_current - + def set_chunk_total(self, chunk_total): self.chunk_total = chunk_total - + def set_chunk_total_size(self, chunk_total_size): self.chunk_total_size = chunk_total_size @@ -563,7 +562,7 @@ def __init__(self, recipients: list = None, application_message_id: str, team_set_context_id: str = None, - onboarding_response: BaseOnboardingResonse + onboarding_response: BaseOnboardingResponse ): self.recipients = recipients self.efdi = efdi diff --git a/agrirouter/messaging/result.py b/agrirouter/messaging/result.py index d08c7f4b..cf42f1c8 100644 --- a/agrirouter/messaging/result.py +++ b/agrirouter/messaging/result.py @@ -20,7 +20,6 @@ def __init__(self, status_code: int = None, messages: List[OutboxMessage] = None ): - self.status_code = status_code self.messages = messages if messages else [] diff --git a/agrirouter/messaging/services/commons.py b/agrirouter/messaging/services/commons.py index 8f8b4a00..2a86fe83 100644 --- a/agrirouter/messaging/services/commons.py +++ b/agrirouter/messaging/services/commons.py @@ -4,16 +4,17 @@ from agrirouter.messaging.clients.http import HttpClient from agrirouter.messaging.clients.mqtt import MqttClient from agrirouter.messaging.messages import Message +from agrirouter.messaging.parameters.service import MessageParameters from agrirouter.messaging.request import MessageRequest from agrirouter.messaging.result import MessagingResult -from agrirouter.onboarding.exceptions import BadMessagingResult -from agrirouter.onboarding.response import SoftwareOnboardingResponse +from agrirouter.api.exceptions import BadMessagingResult +from agrirouter.onboarding.response import OnboardResponse class AbstractMessagingClient(ABC): @staticmethod - def create_message_request(parameters) -> MessageRequest: + def create_message_request(parameters: MessageParameters) -> MessageRequest: messages = [] for encoded_message in parameters.get_encoded_messages(): message = Message(encoded_message) @@ -35,7 +36,7 @@ class HttpMessagingService(AbstractMessagingClient): def __init__(self): self.client = HttpClient() - def send(self, parameters) -> MessagingResult: + def send(self, parameters: MessageParameters) -> MessagingResult: request = self.create_message_request(parameters) response = self.client.send_measure(parameters.get_onboarding_response(), request) if response.status != 200: @@ -47,7 +48,7 @@ def send(self, parameters) -> MessagingResult: class MqttMessagingService(AbstractMessagingClient): def __init__(self, - onboarding_response: SoftwareOnboardingResponse, + onboarding_response: OnboardResponse, on_message_callback: callable = None, client_async: bool = True ): diff --git a/agrirouter/messaging/services/http/outbox.py b/agrirouter/messaging/services/http/fetch_message_service.py similarity index 73% rename from agrirouter/messaging/services/http/outbox.py rename to agrirouter/messaging/services/http/fetch_message_service.py index 7985f914..80db2f56 100644 --- a/agrirouter/messaging/services/http/outbox.py +++ b/agrirouter/messaging/services/http/fetch_message_service.py @@ -1,9 +1,9 @@ from agrirouter.messaging.clients.http import HttpClient -from agrirouter.messaging.exceptions import OutboxException +from agrirouter.api.exceptions import CanNotFetchOutboxMessage from agrirouter.messaging.result import OutboxResponse -class OutboxService: +class FetchMessageService: def __init__(self): self.client = HttpClient() @@ -16,6 +16,6 @@ def fetch(self, onboarding_response) -> OutboxResponse: response_body = response.read() outbox_response.json_deserialize(response_body) else: - raise OutboxException(f"Could not fetch messages from outbox. Status code was {response.status}") + raise CanNotFetchOutboxMessage(f"Could not fetch messages from outbox. Status code was {response.status}") return outbox_response diff --git a/agrirouter/messaging/services/messaging.py b/agrirouter/messaging/services/messaging.py index d714ebf7..bd4063eb 100644 --- a/agrirouter/messaging/services/messaging.py +++ b/agrirouter/messaging/services/messaging.py @@ -1,39 +1,52 @@ +import logging + +from agrirouter.generated.commons.chunk_pb2 import ChunkComponent +from agrirouter.generated.commons.message_pb2 import Metadata from agrirouter.generated.messaging.request.payload.account.endpoints_pb2 import ListEndpointsQuery +from agrirouter.generated.messaging.request.payload.efdi.efdi_pb2 import TimeLog, ISO11783_TaskData from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification from agrirouter.generated.messaging.request.payload.endpoint.subscription_pb2 import Subscription from agrirouter.generated.messaging.request.payload.feed.feed_requests_pb2 import MessageConfirm, MessageDelete, \ MessageQuery from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope -from agrirouter.generated.commons.message_pb2 import Metadata -from agrirouter.generated.commons.chunk_pb2 import ChunkComponent - -from agrirouter.generated.messaging.request.payload.efdi.efdi_pb2 import TimeLog, ISO11783_TaskData - from agrirouter.messaging.encode import encode_message from agrirouter.messaging.enums import TechnicalMessageType, CapabilityType from agrirouter.messaging.messages import EncodedMessage -from agrirouter.messaging.parameters.dto import MessagingParameters +from agrirouter.messaging.parameters.dto import MessagingParameters, SendMessageParameters, ChunkedMessageParameters from agrirouter.messaging.parameters.service import MessageHeaderParameters, MessagePayloadParameters, \ - CapabilityParameters, FeedConfirmParameters, FeedDeleteParameters, ListEndpointsParameters, \ - SubscriptionParameters, QueryHeaderParameters, QueryMessageParameters, ImageParameters, TaskParameters, EfdiParameters - + CapabilitiesParameters, FeedConfirmParameters, FeedDeleteParameters, ListEndpointsParameters, \ + SubscriptionParameters, QueryHeaderParameters, QueryMessageParameters, ImageParameters, TaskParameters, \ + EfdiParameters from agrirouter.utils.type_url import TypeUrl from agrirouter.utils.uuid_util import new_uuid class AbstractService: + """ + Abstract service class for all services. + """ + _log = logging.getLogger(__name__) def __init__(self, messaging_service): self.messaging_service = messaging_service def send(self, parameters): + """ + Send a message to the agrirouter. + :param parameters: Parameters for the message. + """ + self._log.debug("Sending message to the agrirouter.") messaging_parameters = MessagingParameters( onboarding_response=parameters.get_onboarding_response(), application_message_id=parameters.get_application_message_id(), application_message_seq_no=parameters.get_application_message_seq_no(), ) encoded_messages = self.encode(parameters) - messaging_parameters.set_encoded_messages([encoded_messages.get_content()]) + if type(encoded_messages.get_content()) == list: + messaging_parameters.set_encoded_messages(encoded_messages.get_content()) + else: + messaging_parameters.set_encoded_messages([encoded_messages.get_content()]) + return self.messaging_service.send(messaging_parameters) @staticmethod @@ -41,10 +54,17 @@ def encode(*args, **kwargs) -> EncodedMessage: ... -class CapabilityService(AbstractService): +class CapabilitiesService(AbstractService): + """ + Service for sending capabilities to the agrirouter. + """ @staticmethod - def encode(parameters: CapabilityParameters) -> EncodedMessage: + def encode(parameters: CapabilitiesParameters) -> EncodedMessage: + """ + Encode the parameters to a message. + :param parameters: Parameters for the message. + """ message_header_parameters = MessageHeaderParameters( application_message_id=parameters.get_application_message_id(), application_message_seq_no=parameters.get_application_message_seq_no(), @@ -202,9 +222,16 @@ def encode(parameters: QueryMessageParameters) -> EncodedMessage: class QueryHeaderService(AbstractService): + """ + Service to receive the headers of the messages + """ @staticmethod def encode(parameters: QueryHeaderParameters) -> EncodedMessage: + """ + Encode the parameters into a message + parameters: QueryHeaderParameters for the service + """ message_header_parameters = MessageHeaderParameters( application_message_id=parameters.get_application_message_id(), application_message_seq_no=parameters.get_application_message_seq_no(), @@ -234,9 +261,16 @@ def encode(parameters: QueryHeaderParameters) -> EncodedMessage: class SubscriptionService(AbstractService): + """ + Service for sending subscription messages to the agrirouter. + """ @staticmethod def encode(parameters: SubscriptionParameters) -> EncodedMessage: + """ + Encode the parameters into a subscription message. + parameters: Parameters for the subscription message. + """ message_header_parameters = MessageHeaderParameters( application_message_id=parameters.get_application_message_id(), application_message_seq_no=parameters.get_application_message_seq_no(), @@ -263,10 +297,62 @@ def encode(parameters: SubscriptionParameters) -> EncodedMessage: return encoded_message +class SendMessageService(AbstractService): + """ + Service for sending messages to the agrirouter + """ + + @staticmethod + def encode(parameters: SendMessageParameters) -> EncodedMessage: + """ + Encode the parameters into a message. + parameters: Parameters for the message service. + """ + message_header_parameters = MessageHeaderParameters( + technical_message_type=parameters.get_technical_message_type(), + mode=parameters.get_mode(), + team_set_context_id=parameters.get_team_set_context_id(), + application_message_seq_no=parameters.get_application_message_seq_no(), + recipients=parameters.get_recipients(), + chunk_component=parameters.get_chunk_component(), + application_message_id=parameters.get_application_message_id() + ) + + message_payload_parameters = MessagePayloadParameters( + type_url=parameters.get_type_url() or TechnicalMessageType.EMPTY.value, + value=parameters.get_base64_message_content(), + ) + + message_content = encode_message(message_header_parameters, message_payload_parameters) + + encoded_message = EncodedMessage( + id_=new_uuid(), + content=message_content + ) + + return encoded_message + + +class SendChunkedMessageService(AbstractService): + """ + Service for sending chunked messages to the agrirouter + """ + + @staticmethod + def encode(parameters: ChunkedMessageParameters): + """ + parameters: Chunked Message Parameters required + """ + encoded_message = EncodedMessage( + id_=new_uuid(), + content=parameters.get_encoded_chunked_messages(), + ) + return encoded_message + + class ImageService(AbstractService): @staticmethod def encode(parameters: ImageParameters) -> EncodedMessage: - metadata = Metadata() metadata.file_name = parameters.get_image_filename() @@ -277,7 +363,7 @@ def encode(parameters: ImageParameters) -> EncodedMessage: team_set_context_id=parameters.get_team_set_context_id(), mode=RequestEnvelope.Mode.Value("DIRECT"), technical_message_type=CapabilityType.IMG_JPEG.value, - metadata=metadata + metadata=metadata ) message_payload_parameters = MessagePayloadParameters( @@ -291,13 +377,12 @@ def encode(parameters: ImageParameters) -> EncodedMessage: content=message_content ) - return encoded_message + return encoded_message class TaskService(AbstractService): @staticmethod def encode(parameters: TaskParameters) -> EncodedMessage: - metadata = Metadata() metadata.file_name = parameters.get_task_filename() # Add ChunkComponent @@ -311,11 +396,11 @@ def encode(parameters: TaskParameters) -> EncodedMessage: application_message_id=parameters.get_application_message_id(), application_message_seq_no=parameters.get_application_message_seq_no(), recipients=parameters.get_recipients(), - chunk_component = chunkcomponent, + chunk_component=chunkcomponent, team_set_context_id=parameters.get_team_set_context_id(), mode=RequestEnvelope.Mode.Value("DIRECT"), - technical_message_type=CapabilityType.ISO_11783_TASKDATA_ZIP.value, - metadata=metadata + technical_message_type=CapabilityType.ISO_11783_TASK_DATA_ZIP.value, + metadata=metadata ) message_payload_parameters = MessagePayloadParameters( @@ -329,14 +414,14 @@ def encode(parameters: TaskParameters) -> EncodedMessage: content=message_content ) - return encoded_message + return encoded_message class EfdiTimelogService(AbstractService): @staticmethod def encode(parameters: EfdiParameters) -> EncodedMessage: - if parameters.get_efdi_filename() != None: + if parameters.get_efdi_filename() is not None: metadata = Metadata() metadata.file_name = parameters.get_efdi_filename() else: @@ -348,8 +433,8 @@ def encode(parameters: EfdiParameters) -> EncodedMessage: recipients=parameters.get_recipients(), team_set_context_id=parameters.get_team_set_context_id(), mode=RequestEnvelope.Mode.Value("DIRECT"), - technical_message_type=CapabilityType.ISO_11783_TIMELOG_PROTOBUF.value, - metadata = metadata + technical_message_type=CapabilityType.ISO_11783_TIMELOG.value, + metadata=metadata ) message_payload_parameters = MessagePayloadParameters( @@ -370,7 +455,7 @@ class EfdiTimelogPublishService(AbstractService): @staticmethod def encode(parameters: EfdiParameters) -> EncodedMessage: - if parameters.get_efdi_filename() != None: + if parameters.get_efdi_filename() is not None: metadata = Metadata() metadata.file_name = parameters.get_efdi_filename() else: @@ -381,8 +466,8 @@ def encode(parameters: EfdiParameters) -> EncodedMessage: application_message_seq_no=parameters.get_application_message_seq_no(), team_set_context_id=parameters.get_team_set_context_id(), mode=RequestEnvelope.Mode.Value("PUBLISH"), - technical_message_type=CapabilityType.ISO_11783_TIMELOG_PROTOBUF.value, - metadata = metadata + technical_message_type=CapabilityType.ISO_11783_TIMELOG.value, + metadata=metadata ) message_payload_parameters = MessagePayloadParameters( @@ -403,19 +488,19 @@ class EfdiDeviceDscService(AbstractService): @staticmethod def encode(parameters: EfdiParameters) -> EncodedMessage: - if parameters.get_efdi_filename() != None: + if parameters.get_efdi_filename() is not None: metadata = Metadata() metadata.file_name = parameters.get_efdi_filename() else: - metadata = None + metadata = None message_header_parameters = MessageHeaderParameters( application_message_id=parameters.get_application_message_id(), application_message_seq_no=parameters.get_application_message_seq_no(), team_set_context_id=parameters.get_team_set_context_id(), mode=RequestEnvelope.Mode.Value("PUBLISH"), - technical_message_type=CapabilityType.ISO_11783_DEVICE_DESCRIPTION_PROTOBUF.value, - metadata=metadata + technical_message_type=CapabilityType.ISO_11783_DEVICE_DESCRIPTION.value, + metadata=metadata ) message_payload_parameters = MessagePayloadParameters( diff --git a/agrirouter/messaging/services/sequence_number_service.py b/agrirouter/messaging/services/sequence_number_service.py new file mode 100644 index 00000000..30238f1a --- /dev/null +++ b/agrirouter/messaging/services/sequence_number_service.py @@ -0,0 +1,21 @@ +from typing import Dict + + +class SequenceNumberService: + """ + Service to generate sequence numbers while sending messages to the agrirouter. The sequence + number generation is based on the ID of the endpoint, therefore a sequence number can be used + multiple times for different endpoints. + """ + sequence_numbers_for_endpoints: Dict[str, int] = {} + + @staticmethod + def next_seq_nr(endpoint_id: str) -> int: + """ + Generate sequence number for the endpoint_id + params: endpoint_id + returns: 1 if 1st call, 1+n if nth call + """ + SequenceNumberService.sequence_numbers_for_endpoints[ + endpoint_id] = SequenceNumberService.sequence_numbers_for_endpoints.setdefault(endpoint_id, 0) + 1 + return SequenceNumberService.sequence_numbers_for_endpoints[endpoint_id] diff --git a/agrirouter/onboarding/dto.py b/agrirouter/onboarding/dto.py index 224f8b5c..a0c9e13e 100644 --- a/agrirouter/onboarding/dto.py +++ b/agrirouter/onboarding/dto.py @@ -1,7 +1,7 @@ import json from typing import Union -from agrirouter.messaging.exceptions import WrongFieldError +from agrirouter.api.exceptions import WrongField class ConnectionCriteria: @@ -54,7 +54,7 @@ def json_deserialize(self, data: Union[str, dict]) -> None: elif key == self.CLIENT_ID: self.client_id = value else: - raise WrongFieldError(f"Unknown field {key} for Connection Criteria class") + raise WrongField(f"Unknown field {key} for Connection Criteria class") def get_gateway_id(self) -> str: return self.gateway_id @@ -131,7 +131,7 @@ def json_deserialize(self, data: Union[str, dict]) -> None: elif key == self.CERTIFICATE: self.certificate = value else: - raise WrongFieldError(f"Unknown field {key} for Authentication class") + raise WrongField(f"Unknown field {key} for Authentication class") def get_type(self) -> str: return self.type @@ -196,7 +196,7 @@ def json_deserialize(self, data: Union[str, dict]) -> None: elif key == self.DETAILS: self.details = value else: - raise WrongFieldError(f"Unknown field {key} for ErrorResponse class") + raise WrongField(f"Unknown field {key} for ErrorResponse class") def get_code(self) -> str: return self.code diff --git a/agrirouter/onboarding/enums.py b/agrirouter/onboarding/enums.py index f25a34e9..5572621a 100644 --- a/agrirouter/onboarding/enums.py +++ b/agrirouter/onboarding/enums.py @@ -1,4 +1,4 @@ -from agrirouter.auth.enums import BaseEnum +from agrirouter.api.enums import BaseEnum class CertificateTypes(BaseEnum): @@ -6,6 +6,6 @@ class CertificateTypes(BaseEnum): P12 = "P12" -class GateWays(BaseEnum): +class Gateways(BaseEnum): MQTT = "2" - REST = "3" + HTTP = "3" diff --git a/agrirouter/onboarding/exceptions.py b/agrirouter/onboarding/exceptions.py deleted file mode 100644 index fb3b024a..00000000 --- a/agrirouter/onboarding/exceptions.py +++ /dev/null @@ -1,27 +0,0 @@ -class AgriRouuterBaseException(Exception): - _message = ... - - def __init__(self, message=None): - if not message: - message = self._message - self.message = message - - -class WrongCertificationType(AgriRouuterBaseException): - _message = "Wrong Certification type. Use onboarding.enums.CertificationTypes values instead." - - -class WrongGateWay(AgriRouuterBaseException): - _message = "Wrong Gate Way Id. Use onboarding.enums.GateWays values instead." - - -class RequestNotSigned(AgriRouuterBaseException): - _message = """ - Request does not contain signature header. Please sign the request with request.sign() method.\n - Details on: https://docs.my-agrirouter.com/agrirouter-interface-documentation/latest/ - integration/onboarding.html#signing-requests - """ - - -class BadMessagingResult(AgriRouuterBaseException): - _message = "Messaging Request failed" diff --git a/agrirouter/onboarding/headers.py b/agrirouter/onboarding/headers.py index 8806eb69..b09101c8 100644 --- a/agrirouter/onboarding/headers.py +++ b/agrirouter/onboarding/headers.py @@ -1,27 +1,42 @@ -from agrirouter.constants.media_types import ContentTypes +import logging + +from agrirouter.api.enums import ContentTypes, RequestHeaders +from agrirouter.api.exceptions import MissingRegistrationCode class SoftwareOnboardingHeader: def __init__(self, - reg_code, - application_id=None, - signature=None, + reg_code: str, + application_id: str = None, + signature: str = None, content_type=ContentTypes.APPLICATION_JSON.value ): - - self._set_params(reg_code, content_type) + self._set_params(reg_code, content_type, application_id, signature) def get_header(self) -> dict: return self.params def sign(self, signature: str): - self.params["X-Agrirouter-Signature"] = signature + self.params[RequestHeaders.X_AGRIROUTER_SIGNATURE.value] = signature - def _set_params(self, reg_code: str, content_type: str): + def _set_params(self, reg_code: str, content_type: str, application_id: str, signature: str = None): header = dict() - header["Authorization"] = f"Bearer {reg_code}" - header["Content-Type"] = content_type - #header["X-Agrirouter-ApplicationId"] = application_id - #header["X-Agrirouter-Signature"] = signature if signature else "" + + if reg_code: + header[RequestHeaders.AUTHORIZATION.value] = f"Bearer {reg_code}" + else: + raise MissingRegistrationCode("Registration code is required") + + if content_type: + header[RequestHeaders.CONTENT_TYPE.value] = content_type + else: + logging.warning("Content-Type not set, defaulting to application/json") + header[RequestHeaders.CONTENT_TYPE.value] = ContentTypes.APPLICATION_JSON.value + + if application_id: + header[RequestHeaders.X_AGRIROUTER_APPLICATION_ID.value] = application_id + + if signature: + header[RequestHeaders.X_AGRIROUTER_SIGNATURE.value] = signature if signature else "" self.params = header diff --git a/agrirouter/onboarding/onboarding.py b/agrirouter/onboarding/onboarding.py index 5e98436e..056d61d4 100644 --- a/agrirouter/onboarding/onboarding.py +++ b/agrirouter/onboarding/onboarding.py @@ -1,50 +1,78 @@ import requests +from agrirouter.api.exceptions import UnexpectedErrorDuringOnboarding, RequestNotSigned from agrirouter.environments.environmental_services import EnvironmentalService -#from agrirouter.onboarding.exceptions import RequestNotSigned from agrirouter.onboarding.headers import SoftwareOnboardingHeader -from agrirouter.onboarding.parameters import SoftwareOnboardingParameter -from agrirouter.onboarding.request import SoftwareOnboardingRequest +from agrirouter.onboarding.parameters import OnboardParameters +from agrirouter.onboarding.request import OnboardRequest from agrirouter.onboarding.request_body import SoftwareOnboardingBody -from agrirouter.onboarding.response import SoftwareVerifyOnboardingResponse, SoftwareOnboardingResponse +from agrirouter.onboarding.response import VerificationResponse, OnboardResponse -class SoftwareOnboarding(EnvironmentalService): +class SecuredOnboardingService(EnvironmentalService): - def __init__(self, *args, **kwargs): - #self._public_key = kwargs.pop("public_key") - #self._private_key = kwargs.pop("private_key") - super(SoftwareOnboarding, self).__init__(*args, **kwargs) + def __init__(self, env: str, public_key: str, private_key: str): + self._public_key = public_key + self._private_key = private_key + super(SecuredOnboardingService, self).__init__(env) - def _create_request(self, params: SoftwareOnboardingParameter, url: str) -> SoftwareOnboardingRequest: + @staticmethod + def _create_request(params: OnboardParameters) -> OnboardRequest: body_params = params.get_body_params() request_body = SoftwareOnboardingBody(**body_params) header_params = params.get_header_params() request_header = SoftwareOnboardingHeader(**header_params) - return SoftwareOnboardingRequest(header=request_header, body=request_body, url=url) - - def _perform_request(self, params: SoftwareOnboardingParameter, url: str) -> requests.Response: - request = self._create_request(params, url) - #request.sign(self._private_key, self._public_key) - #if request.is_signed: - # return requests.post( - # url=request.get_url(), - # data=request.get_body_content(), - # headers=request.get_header() - # ) - #raise RequestNotSigned - return requests.post(url=request.get_url(), data=request.get_body_content(), headers=request.get_header()) - - def verify(self, params: SoftwareOnboardingParameter) -> SoftwareVerifyOnboardingResponse: + return OnboardRequest(header=request_header, body=request_body) + + def _perform_request(self, params: OnboardParameters, url: str) -> requests.Response: + request = OnboardRequest.from_onboard_parameters(params) + request.sign(self._private_key, self._public_key) + if request.is_signed: + return requests.post( + url=url, + data=request.get_body_content(), + headers=request.get_header() + ) + raise RequestNotSigned("Request is not signed, cannot perform request.¶") + + def verify(self, params: OnboardParameters) -> VerificationResponse: url = self._environment.get_verify_onboard_request_url() http_response = self._perform_request(params=params, url=url) - return SoftwareVerifyOnboardingResponse(http_response) + return VerificationResponse(http_response) - def onboard(self, params: SoftwareOnboardingParameter) -> SoftwareOnboardingResponse: + def onboard(self, params: OnboardParameters) -> OnboardResponse: url = self._environment.get_onboard_url() http_response = self._perform_request(params=params, url=url) + if not http_response.ok: + raise UnexpectedErrorDuringOnboarding( + f"Onboarding returned HTTP status {http_response.status_code}. Message: {http_response.text}") + return OnboardResponse(http_response) + + +class OnboardingService(EnvironmentalService): + def __init__(self, *args, **kwargs): + super(OnboardingService, self).__init__(*args, **kwargs) + + @staticmethod + def _perform_request(params: OnboardParameters, url: str) -> requests.Response: + request = OnboardRequest.from_onboard_parameters(params) + + return requests.post( + url=url, + data=request.get_body_content(), + headers=request.get_header() + ) - return SoftwareOnboardingResponse(http_response) + def onboard(self, params: OnboardParameters) -> OnboardResponse: + """ + Onboard a device to the agrirouter. + """ + url = self._environment.get_onboard_url() + http_response = self._perform_request(params=params, url=url) + if not http_response.ok: + raise UnexpectedErrorDuringOnboarding( + f"Onboarding returned HTTP status {http_response.status_code}. Message: {http_response.text}") + return OnboardResponse(http_response) diff --git a/agrirouter/onboarding/parameters.py b/agrirouter/onboarding/parameters.py index 64a5e9bd..409fec2e 100644 --- a/agrirouter/onboarding/parameters.py +++ b/agrirouter/onboarding/parameters.py @@ -1,37 +1,34 @@ -from agrirouter.constants.media_types import ContentTypes +from agrirouter.api.enums import ContentTypes from agrirouter.onboarding.enums import CertificateTypes from agrirouter.utils.utc_time_util import now_as_utc_str -class SoftwareOnboardingParameter: +class OnboardParameters: def __init__(self, *, - id_, - application_id, - certification_version_id, - gateway_id, - time_zone=None, - reg_code, - utc_timestamp=None, - content_type=ContentTypes.APPLICATION_JSON.value, - certificate_type=CertificateTypes.PEM.value, + id_: object, + application_id: object, + certification_version_id: object, + gateway_id: object, + time_zone: object = None, + reg_code: object, + utc_timestamp: object = None, + certificate_type: object = CertificateTypes.PEM.value, ): - self.id_ = id_ self.application_id = application_id - self.content_type = content_type self.certification_version_id = certification_version_id self.gateway_id = str(gateway_id) self.certificate_type = certificate_type - #self.utc_timestamp = str(utc_timestamp) if utc_timestamp else now_as_utc_str() - #self.time_zone = str(time_zone) + self.utc_timestamp = str(utc_timestamp) if utc_timestamp else now_as_utc_str() + self.time_zone = str(time_zone) self.reg_code = reg_code def get_header_params(self): return { - "content_type": self.content_type, + "content_type": ContentTypes.APPLICATION_JSON.value, "reg_code": self.reg_code, - #"application_id": self.application_id, + "application_id": self.application_id, } def get_body_params(self): @@ -41,6 +38,6 @@ def get_body_params(self): "certification_version_id": self.certification_version_id, "gateway_id": self.gateway_id, "certificate_type": self.certificate_type, - #"utc_timestamp": self.utc_timestamp, - #"time_zone": self.time_zone, + "utc_timestamp": self.utc_timestamp, + "time_zone": self.time_zone, } diff --git a/agrirouter/onboarding/request.py b/agrirouter/onboarding/request.py index 507b675f..77ee8a75 100644 --- a/agrirouter/onboarding/request.py +++ b/agrirouter/onboarding/request.py @@ -1,16 +1,24 @@ +from agrirouter.api.enums import RequestHeaders from agrirouter.onboarding.headers import SoftwareOnboardingHeader +from agrirouter.onboarding.parameters import OnboardParameters from agrirouter.onboarding.request_body import SoftwareOnboardingBody -#from agrirouter.onboarding.signature import create_signature, verify_signature +from agrirouter.onboarding.signature import create_signature, verify_signature -class SoftwareOnboardingRequest: - def __init__(self, header: SoftwareOnboardingHeader, body: SoftwareOnboardingBody, url: str): +class OnboardRequest: + def __init__(self, header: SoftwareOnboardingHeader, body: SoftwareOnboardingBody): self.header = header self.body = body - self.url = url - def get_url(self): - return self.url + @classmethod + def from_onboard_parameters(cls, params: OnboardParameters) -> 'OnboardRequest': + body_params = params.get_body_params() + request_body = SoftwareOnboardingBody(**body_params) + + header_params = params.get_header_params() + request_header = SoftwareOnboardingHeader(**header_params) + + return cls(header=request_header, body=request_body) def get_data(self): return self.body.get_parameters() @@ -21,15 +29,15 @@ def get_header(self): def get_body_content(self): return self.body.json().replace("\n", "") -# def sign(self, private_key, public_key): -# body = self.get_body_content() -# signature = create_signature(body, private_key) -# verify_signature(body, bytes.fromhex(signature), public_key) -# self.header.sign(signature) - -# @property -# def is_signed(self): -# header_has_signature = self.get_header().get("X-Agrirouter-Signature", None) -# if header_has_signature: -# return True -# return False + def sign(self, private_key, public_key): + body = self.get_body_content() + signature = create_signature(body, private_key) + verify_signature(body, bytes.fromhex(signature), public_key) + self.header.sign(signature) + + @property + def is_signed(self): + header_has_signature = self.get_header().get(RequestHeaders.X_AGRIROUTER_SIGNATURE.value, None) + if header_has_signature: + return True + return False diff --git a/agrirouter/onboarding/request_body.py b/agrirouter/onboarding/request_body.py index 7130153d..e6c89c2d 100644 --- a/agrirouter/onboarding/request_body.py +++ b/agrirouter/onboarding/request_body.py @@ -1,8 +1,8 @@ import json from datetime import datetime -from agrirouter.onboarding.enums import CertificateTypes, GateWays -from agrirouter.onboarding.exceptions import WrongCertificationType, WrongGateWay +from agrirouter.api.exceptions import WrongCertificationType, WrongGateWayType +from agrirouter.onboarding.enums import CertificateTypes, Gateways class SoftwareOnboardingBody: @@ -20,7 +20,7 @@ def __init__(self, self._validate_certificate_type(certificate_type) self._validate_gateway_id(gateway_id) - #utc_timestamp = utc_timestamp if utc_timestamp else datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%fZ") + utc_timestamp = utc_timestamp if utc_timestamp else datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%fZ") self._set_params( id_, @@ -28,8 +28,8 @@ def __init__(self, certification_version_id, gateway_id, certificate_type, - #utc_timestamp, - #time_zone + utc_timestamp, + time_zone ) def get_parameters(self) -> dict: @@ -51,8 +51,8 @@ def _set_params(self, "certificationVersionId": certification_version_id, "gatewayId": gateway_id, "certificateType": certificate_type, - #"UTCTimestamp": utc_timestamp, - #"timeZone": time_zone, + "UTCTimestamp": utc_timestamp, + "timeZone": time_zone, } def json(self) -> str: @@ -65,5 +65,5 @@ def _validate_certificate_type(certificate_type: str) -> None: @staticmethod def _validate_gateway_id(gateway_id: str) -> None: - if gateway_id not in GateWays.values_list(): - raise WrongGateWay + if gateway_id not in Gateways.values_list(): + raise WrongGateWayType diff --git a/agrirouter/onboarding/response.py b/agrirouter/onboarding/response.py index db84bf0f..78b0f53c 100644 --- a/agrirouter/onboarding/response.py +++ b/agrirouter/onboarding/response.py @@ -3,14 +3,13 @@ from requests import Response -from agrirouter.messaging.exceptions import WrongFieldError +from agrirouter.api.exceptions import WrongField from agrirouter.onboarding.dto import ErrorResponse, ConnectionCriteria, Authentication -class BaseOnboardingResonse: +class BaseOnboardingResponse: def __init__(self, http_response: Response): - self._status_code = http_response.status_code self._text = http_response.text @@ -23,14 +22,14 @@ def text(self): return self._text -class SoftwareVerifyOnboardingResponse(BaseOnboardingResonse): +class VerificationResponse(BaseOnboardingResponse): """ Response from verify request used for Farming Software or Telemetry Platform before onboarding """ def __init__(self, http_response: Response = None): if http_response: - super(SoftwareVerifyOnboardingResponse, self).__init__(http_response) + super(VerificationResponse, self).__init__(http_response) response_body = http_response.json() else: self._text = None @@ -53,7 +52,7 @@ def set_account_id(self, account_id: str): self.account_id = account_id -class SoftwareOnboardingResponse(BaseOnboardingResonse): +class OnboardResponse(BaseOnboardingResponse): """ Response from onboarding request used for CU """ @@ -66,8 +65,8 @@ class SoftwareOnboardingResponse(BaseOnboardingResonse): ERROR = "error" def __init__(self, http_response: Response = None): - if http_response != None: - super(SoftwareOnboardingResponse, self).__init__(http_response) + if http_response is not None: + super(OnboardResponse, self).__init__(http_response) response_body = http_response.json() else: self._text = None @@ -165,7 +164,7 @@ def json_deserialize(self, data: Union[dict, str]): error_response.json_deserialize(value) self.error = error_response else: - raise WrongFieldError(f"Unknown field `{key}` for {self.__class__}") + raise WrongField(f"Unknown field `{key}` for {self.__class__}") def __str__(self): return str(self.json_serialize()) diff --git a/agrirouter/onboarding/signature.py b/agrirouter/onboarding/signature.py index 7926e5ad..ca84477b 100644 --- a/agrirouter/onboarding/signature.py +++ b/agrirouter/onboarding/signature.py @@ -1,7 +1,6 @@ -#from cryptography.hazmat.primitives.serialization import load_pem_public_key, load_pem_private_key -#from cryptography.hazmat.primitives import hashes -#from cryptography.hazmat.primitives.asymmetric import padding - +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.asymmetric import padding +from cryptography.hazmat.primitives.serialization import load_pem_public_key, load_pem_private_key SIGNATURE_ALGORITHM = "SHA256withRSA" @@ -10,23 +9,24 @@ def to_hex(sign: bytes): return sign.hex() -#def create_signature(request_body: str, private_key: str) -> str: -# private_key_bytes = bytearray(private_key.encode('utf-8')) -# private_key_data = load_pem_private_key(private_key_bytes, None) -# signature = private_key_data.sign( -# request_body.encode("utf-8"), -# padding.PKCS1v15(), -# hashes.SHA256() -# ) -# return to_hex(signature) - - -#def verify_signature(request_body: str, signature: bytes, public_key: str) -> None: -# public_key_bytes = bytearray(public_key.encode('utf-8')) -# public_key_data = load_pem_public_key(public_key_bytes) -# public_key_data.verify( -# signature, -# request_body.encode('utf-8'), -# padding.PKCS1v15(), -# hashes.SHA256() -# ) +def create_signature(request_body: str, private_key: str) -> str: + private_key_bytes = bytearray(private_key.encode('utf-8')) + private_key_data = load_pem_private_key(private_key_bytes, None) + signature = private_key_data.sign( + request_body.encode("utf-8"), + padding.PKCS1v15(), + hashes.SHA256() + ) + + return to_hex(signature) + + +def verify_signature(request_body: str, signature: bytes, public_key: str) -> None: + public_key_bytes = bytearray(public_key.encode('utf-8')) + public_key_data = load_pem_public_key(public_key_bytes) + public_key_data.verify( + signature, + request_body.encode('utf-8'), + padding.PKCS1v15(), + hashes.SHA256() + ) diff --git a/agrirouter/revoking/headers.py b/agrirouter/revoking/headers.py index 50652d5a..24e90226 100644 --- a/agrirouter/revoking/headers.py +++ b/agrirouter/revoking/headers.py @@ -1,4 +1,4 @@ -from agrirouter.constants.media_types import ContentTypes +from agrirouter.api.enums import ContentTypes class RevokingHeader: @@ -7,7 +7,6 @@ def __init__(self, signature=None, content_type=ContentTypes.APPLICATION_JSON.value ): - self._set_params(application_id, signature, content_type) def get_header(self) -> dict: diff --git a/agrirouter/revoking/parameters.py b/agrirouter/revoking/parameters.py index cf706b02..cb35f6d2 100644 --- a/agrirouter/revoking/parameters.py +++ b/agrirouter/revoking/parameters.py @@ -1,4 +1,4 @@ -from agrirouter.constants.media_types import ContentTypes +from agrirouter.api.enums import ContentTypes class RevokingParameter: @@ -11,7 +11,6 @@ def __init__(self, time_zone, content_type=ContentTypes.APPLICATION_JSON.value ): - self.application_id = application_id self.content_type = content_type self.account_id = account_id diff --git a/agrirouter/revoking/request.py b/agrirouter/revoking/request.py index 08e6fd26..1fea09e1 100644 --- a/agrirouter/revoking/request.py +++ b/agrirouter/revoking/request.py @@ -1,4 +1,4 @@ -#from agrirouter.onboarding.signature import create_signature +from agrirouter.onboarding.signature import create_signature from agrirouter.revoking.headers import RevokingHeader from agrirouter.revoking.request_body import RevokingBody @@ -21,14 +21,14 @@ def get_header(self): def get_body_content(self): return self.body.json().replace("\n", "") -# def sign(self, private_key): -# body = self.get_body_content() -# signature = create_signature(body, private_key) -# self.header.sign(signature) - -# @property -# def is_signed(self) -> bool: -# header_has_signature = self.get_header().get("X-Agrirouter-Signature", None) -# if header_has_signature: -# return True -# return False + def sign(self, private_key): + body = self.get_body_content() + signature = create_signature(body, private_key) + self.header.sign(signature) + + @property + def is_signed(self) -> bool: + header_has_signature = self.get_header().get("X-Agrirouter-Signature", None) + if header_has_signature: + return True + return False diff --git a/agrirouter/revoking/request_body.py b/agrirouter/revoking/request_body.py index 7bdea6e5..776a2c81 100644 --- a/agrirouter/revoking/request_body.py +++ b/agrirouter/revoking/request_body.py @@ -7,7 +7,6 @@ def __init__(self, endpoint_ids, utc_timestamp, time_zone): - self._set_params( account_id, endpoint_ids, @@ -24,7 +23,6 @@ def _set_params(self, utc_timestamp, time_zone ) -> None: - self.params = { "accountId": account_id, "endpointIds": endpoint_ids, diff --git a/agrirouter/revoking/revoking.py b/agrirouter/revoking/revoking.py index 3bac8ea6..469947b5 100644 --- a/agrirouter/revoking/revoking.py +++ b/agrirouter/revoking/revoking.py @@ -1,7 +1,7 @@ import requests from agrirouter.environments.environmental_services import EnvironmentalService -#from agrirouter.onboarding.exceptions import RequestNotSigned +from agrirouter.api.exceptions import RequestNotSigned from agrirouter.revoking.headers import RevokingHeader from agrirouter.revoking.parameters import RevokingParameter from agrirouter.revoking.request import RevokingRequest @@ -27,14 +27,15 @@ def _create_request(self, params: RevokingParameter, url: str) -> RevokingReques def _perform_request(self, params: RevokingParameter, url: str) -> requests.Response: request = self._create_request(params, url) -# request.sign(self._private_key) -# if request.is_signed: -# return requests.delete( -# url=request.get_url(), -# json=request.get_data(), -# headers=request.get_header() -# ) -# raise RequestNotSigned + + request.sign(self._private_key) + if request.is_signed: + return requests.delete( + url=request.get_url(), + json=request.get_data(), + headers=request.get_header() + ) + raise RequestNotSigned def revoke(self, params: RevokingParameter) -> RevokingResponse: url = self._environment.get_revoke_url() diff --git a/agrirouter/utils/type_url.py b/agrirouter/utils/type_url.py index 34dd7770..f6ffb5ec 100644 --- a/agrirouter/utils/type_url.py +++ b/agrirouter/utils/type_url.py @@ -9,11 +9,11 @@ from agrirouter.generated.messaging.response.payload.account.endpoints_pb2 import ListEndpointsResponse from agrirouter.generated.messaging.response.payload.feed.feed_response_pb2 import HeaderQueryResponse, \ MessageQueryResponse -from agrirouter.generated.messaging.response.payload.feed.push_notification_pb2 import PushNotification from agrirouter.generated.messaging.request.payload.efdi.efdi_pb2 import TimeLog, ISO11783_TaskData -from agrirouter.messaging.exceptions import TypeUrlNotFoundError +from agrirouter.generated.messaging.response.payload.feed.push_notification_pb2 import PushNotification +from agrirouter.api.exceptions import TypeUrlNotFound class TypeUrl: @@ -43,5 +43,5 @@ def get_type_url(cls, class_): @classmethod def get_command(cls, class_) -> str: if class_ not in cls.commands: - raise TypeUrlNotFoundError(f"The {class_} type url not found") + raise TypeUrlNotFound(f"The {class_} type url not found") return cls.prefix + class_.DESCRIPTOR.full_name diff --git a/agrirouter/utils/utc_time_util.py b/agrirouter/utils/utc_time_util.py index b87ca808..0c099bac 100644 --- a/agrirouter/utils/utc_time_util.py +++ b/agrirouter/utils/utc_time_util.py @@ -1,10 +1,74 @@ -from datetime import datetime +from datetime import datetime, timedelta +from google.protobuf.timestamp_pb2 import Timestamp -def now_as_utc_timestamp(): +from agrirouter.generated.messaging.request.payload.feed.feed_requests_pb2 import ValidityPeriod + + +def now_as_utc_timestamp() -> datetime: + """ + Returns current utc timestamp + """ return datetime.utcnow() -def now_as_utc_str(): +def now_as_utc_str() -> str: + """ + Returns current utc timestamp as a string + """ timestamp = datetime.utcnow() return timestamp.strftime("%Y-%m-%dT%H:%M:%S.%fZ") + + +def max_validity_period() -> ValidityPeriod: + """ + Returns time stamp from weeks before according to the Timestamp protobuf format + """ + return ValidityPeriod(sent_from=timestamp_before_number_of_weeks(4), sent_to=now_as_timestamp()) + + +def validity_period_for_seconds(seconds) -> ValidityPeriod: + """ + Returns validity period from seconds before according to the ValidityPeriod protobuf format + """ + return ValidityPeriod(sent_from=timestamp_before_number_of_seconds(seconds), sent_to=now_as_timestamp()) + + +def validity_period_for_weeks(weeks) -> ValidityPeriod: + """ + Returns validity period from seconds before according to the ValidityPeriod protobuf format + """ + return ValidityPeriod(sent_from=timestamp_before_number_of_weeks(weeks), sent_to=now_as_timestamp()) + + +def timestamp_before_number_of_weeks(weeks) -> Timestamp: + """ + Returns time stamp from weeks before according to the Timestamp protobuf format + """ + utc_timestamp_weeks_ago = datetime.now() - timedelta(weeks=weeks) + sent_from = Timestamp() + sent_from.seconds = int(utc_timestamp_weeks_ago.timestamp()) + sent_from.nanos = utc_timestamp_weeks_ago.microsecond * 1000 + return sent_from + + +def timestamp_before_number_of_seconds(seconds) -> Timestamp: + """ + Returns time stamp from seconds before according to the Timestamp protobuf format. + This is used to test the invalid validity period and is only used for testing purposes + """ + utc_timestamp_seconds_ago = datetime.now() - timedelta(seconds=seconds) + sent_from = Timestamp() + sent_from.seconds = int(utc_timestamp_seconds_ago.timestamp()) + sent_from.nanos = utc_timestamp_seconds_ago.microsecond * 1000 + return sent_from + + +def now_as_timestamp(): + """ + Returns current time stamp in google protobuf format + """ + sent_to = Timestamp() + sent_to.seconds = int(datetime.now().timestamp()) + sent_to.nanos = datetime.now().microsecond * 1000 + return sent_to diff --git a/agrirouter/utils/uuid_util.py b/agrirouter/utils/uuid_util.py index 8e500ead..c85999cf 100644 --- a/agrirouter/utils/uuid_util.py +++ b/agrirouter/utils/uuid_util.py @@ -2,4 +2,17 @@ def new_uuid(): + """ + + new_uuid() -> str + + Generates a new universally unique identifier (UUID) and returns it as a string representation. + + Returns: + str: A string representation of the generated UUID. + + Example: + >>> new_uuid() + 'c5616b83-733b-4500-8c7a-efbff81b226b' + """ return str(uuid.uuid4()) diff --git a/assets/images/agrirouter.svg b/assets/images/agrirouter.svg index c3d214b6..8e0b89ac 100755 --- a/assets/images/agrirouter.svg +++ b/assets/images/agrirouter.svg @@ -1,27 +1,30 @@ - + - + - - - + + - + - + - - - - + - - - - - diff --git a/conftest.py b/conftest.py index c36194f0..e6828444 100644 --- a/conftest.py +++ b/conftest.py @@ -1,13 +1,15 @@ import pytest -from tests.constants import public_key, private_key, auth_result_url + +from agrirouter.api.enums import Environments +from tests.common.constants import PUBLIC_KEY, PRIVATE_KEY, AUTH_RESULT_URL @pytest.fixture(scope="session") def authorization(): from agrirouter.auth.auth import Authorization - auth_client = Authorization("QA", public_key=public_key, private_key=private_key) - auth_response = auth_client.extract_auth_response(auth_result_url) + auth_client = Authorization(Environments.QA.value, public_key=PUBLIC_KEY, private_key=PRIVATE_KEY) + auth_response = auth_client.extract_auth_response(AUTH_RESULT_URL) auth_client.verify_auth_response(auth_response) auth_data = auth_response.get_auth_result() return auth_data diff --git a/example_script.py b/example_script.py index a71f16d1..374bd481 100644 --- a/example_script.py +++ b/example_script.py @@ -1,11 +1,10 @@ -from pprint import pprint +import time from google.protobuf.timestamp_pb2 import Timestamp from agrirouter.generated.messaging.request.payload.account.endpoints_pb2 import ListEndpointsQuery from agrirouter.generated.messaging.request.payload.feed.feed_requests_pb2 import ValidityPeriod -from agrirouter.onboarding.response import SoftwareOnboardingResponse -import time +from agrirouter.onboarding.response import OnboardResponse public_key = """-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzGt41/+kSOTlO1sJvLIN @@ -46,7 +45,6 @@ HjmgzBRxXFy5uph6Ue6dxyszaA== -----END PRIVATE KEY-----""" - onboarding_response_mqtt_data = { "deviceAlternateId": "2145df0e-3451-46cb-bf23-23191af66fce", "capabilityAlternateId": "523e4623-68d2-43d4-a0cc-e2ada2f68b5e", @@ -66,22 +64,19 @@ } } - - - import agrirouter as ar -from agrirouter.onboarding.enums import GateWays +from agrirouter.onboarding.enums import Gateways from agrirouter.messaging.enums import CapabilityType from agrirouter.generated.messaging.request.payload.endpoint.subscription_pb2 import Subscription from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification from agrirouter.messaging.services.commons import HttpMessagingService, MqttMessagingService from agrirouter import ListEndpointsParameters, ListEndpointsService, SubscriptionService, SubscriptionParameters, \ - QueryHeaderService, QueryHeaderParameters, CapabilityService, CapabilityParameters + QueryHeaderService, QueryHeaderParameters, CapabilitiesService, CapabilitiesParameters from agrirouter.utils.uuid_util import new_uuid +application_id = "8c947a45-c57d-42d2-affc-206e21d63a50" # # store here your application id. You can find it in AR UI +certification_version_id = "edd5d6b7-45bb-4471-898e-ff9c2a7bf56f" # # store here your certification version id. You can find it in AR UI -application_id = "8c947a45-c57d-42d2-affc-206e21d63a50" # # store here your application id. You can find it in AR UI -certification_version_id = "edd5d6b7-45bb-4471-898e-ff9c2a7bf56f" # # store here your certification version id. You can find it in AR UI def example_auth(): print("Authorization...\n") @@ -115,7 +110,6 @@ def example_auth(): def example_onboarding(gateway_id): - auth_data = example_auth() print("Onboarding...\n") @@ -123,11 +117,11 @@ def example_onboarding(gateway_id): id_ = "urn:myapp:snr00003234" # just unique time_zone = "+03:00" - onboarding_client = ar.SoftwareOnboarding("QA", public_key=public_key, private_key=private_key) - onboarding_parameters = ar.SoftwareOnboardingParameter(id_=id_, application_id=application_id, - certification_version_id=certification_version_id, - gateway_id=gateway_id, time_zone=time_zone, - reg_code=auth_data.get_decoded_token().regcode) + onboarding_client = ar.SecuredOnboardingService("QA", public_key=public_key, private_key=private_key) + onboarding_parameters = ar.OnboardParameters(id_=id_, application_id=application_id, + certification_version_id=certification_version_id, + gateway_id=gateway_id, time_zone=time_zone, + reg_code=auth_data.get_decoded_token().regcode) onboarding_verifying_response = onboarding_client.verify(onboarding_parameters) print(f"onboarding_verifying_response.status_code: {onboarding_verifying_response.status_code}") print(f"onboarding_verifying_response.text: {onboarding_verifying_response.text}") @@ -139,7 +133,7 @@ def example_onboarding(gateway_id): def example_list_endpoints_mqtt(onboarding_response_data, foo): - onboarding_response = SoftwareOnboardingResponse() + onboarding_response = OnboardResponse() onboarding_response.json_deserialize(onboarding_response_data) messaging_service = MqttMessagingService( @@ -148,7 +142,7 @@ def example_list_endpoints_mqtt(onboarding_response_data, foo): ) list_endpoint_parameters = ListEndpointsParameters( - technical_message_type=CapabilityType.ISO_11783_TASKDATA_ZIP.value, + technical_message_type=CapabilityType.ISO_11783_TASK_DATA_ZIP.value, direction=ListEndpointsQuery.Direction.Value("SEND_RECEIVE"), filtered=False, onboarding_response=onboarding_response, @@ -164,35 +158,37 @@ def example_list_endpoints_mqtt(onboarding_response_data, foo): while True: time.sleep(1) + def example_set_capabilities(onboarding_response_data, mqtt_message_callback): - onboarding_response = SoftwareOnboardingResponse() + onboarding_response = OnboardResponse() onboarding_response.json_deserialize(onboarding_response_data) messaging_service = MqttMessagingService( onboarding_response=onboarding_response, on_message_callback=mqtt_message_callback ) - capabilities_parameters = CapabilityParameters( + capabilities_parameters = CapabilitiesParameters( onboarding_response=onboarding_response, application_message_id=new_uuid(), application_message_seq_no=1, application_id=application_id, certification_version_id=certification_version_id, capability_parameters=[ - CapabilitySpecification.Capability(technical_message_type = CapabilityType.ISO_11783_TASKDATA_ZIP.value, direction = "SEND_RECEIVE") + CapabilitySpecification.Capability(technical_message_type=CapabilityType.ISO_11783_TASK_DATA_ZIP.value, + direction="SEND_RECEIVE") ], enable_push_notification=True, ) - capabilities_service = CapabilityService(messaging_service) + capabilities_service = CapabilitiesService(messaging_service) capabilities_service.send(capabilities_parameters) def example_list_endpoints_http(onboarding_response_data): - onboarding_response = SoftwareOnboardingResponse() + onboarding_response = OnboardResponse() onboarding_response.json_deserialize(onboarding_response_data) messaging_service = HttpMessagingService() list_endpoint_parameters = ListEndpointsParameters( - technical_message_type=CapabilityType.ISO_11783_TASKDATA_ZIP.value, + technical_message_type=CapabilityType.ISO_11783_TASK_DATA_ZIP.value, direction=2, filtered=False, onboarding_response=onboarding_response, @@ -208,12 +204,12 @@ def example_list_endpoints_http(onboarding_response_data): def example_subscription_http(onboarding_response_data): - onboarding_response = SoftwareOnboardingResponse() + onboarding_response = OnboardResponse() onboarding_response.json_deserialize(onboarding_response_data) messaging_service = HttpMessagingService() subscription_service = SubscriptionService(messaging_service) - tmt = CapabilityType.ISO_11783_TASKDATA_ZIP.value + tmt = CapabilityType.ISO_11783_TASK_DATA_ZIP.value subscription_item = Subscription.MessageTypeSubscriptionItem(technical_message_type=tmt) subscription_parameters = SubscriptionParameters( subscription_items=[subscription_item], @@ -229,12 +225,12 @@ def example_subscription_http(onboarding_response_data): def example_subscription_mqtt(onboarding_response_data, on_msg_callback): - onboarding_response = SoftwareOnboardingResponse() + onboarding_response = OnboardResponse() onboarding_response.json_deserialize(onboarding_response_data) messaging_service = MqttMessagingService(onboarding_response, on_message_callback=on_msg_callback) subscription_service = SubscriptionService(messaging_service) - tmt = CapabilityType.ISO_11783_TASKDATA_ZIP.value + tmt = CapabilityType.ISO_11783_TASK_DATA_ZIP.value subscription_item = Subscription.MessageTypeSubscriptionItem(technical_message_type=tmt) subscription_parameters = SubscriptionParameters( subscription_items=[subscription_item], @@ -252,7 +248,7 @@ def example_subscription_mqtt(onboarding_response_data, on_msg_callback): def example_query_header_message_http(onboarding_response_data): - onboarding_response = SoftwareOnboardingResponse() + onboarding_response = OnboardResponse() onboarding_response.json_deserialize(onboarding_response_data) messaging_service = HttpMessagingService() @@ -275,7 +271,7 @@ def example_query_header_message_http(onboarding_response_data): def example_query_header_message_mqtt(onboarding_response_data, on_msg_callback): - onboarding_response = SoftwareOnboardingResponse() + onboarding_response = OnboardResponse() onboarding_response.json_deserialize(onboarding_response_data) messaging_service = MqttMessagingService(onboarding_response, on_message_callback=on_msg_callback) @@ -300,7 +296,6 @@ def example_query_header_message_mqtt(onboarding_response_data, on_msg_callback) def on_message_callback(client, userdata, msg): - # Define here the way receiving messages will be processed from agrirouter.messaging.decode import decode_response @@ -323,7 +318,7 @@ def on_message_callback(client, userdata, msg): if __name__ == "__main__": - onboarding_response_mqtt = example_onboarding(GateWays.MQTT.value) + onboarding_response_mqtt = example_onboarding(Gateways.MQTT.value) example_set_capabilities(onboarding_response_mqtt.json_serialize(), on_message_callback) example_list_endpoints_mqtt(onboarding_response_mqtt.json_serialize(), on_message_callback) diff --git a/pyproject.toml b/pyproject.toml index 9787c3bd..ed799b39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,15 @@ +[project] +name = "agrirouter" +description = "agrirouter SDK" +version = "1.0.0b1" +dynamic = ["dependencies"] + [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" + +[tool.setuptools] +packages = ["agrirouter"] + +[tool.setuptools.dynamic] +dependencies = { file = ["requirements.txt"] } diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..cbc8bfb2 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +log_format = %(asctime)s %(levelname)s %(message)s +log_date_format = %Y-%m-%d %H:%M:%S +log_cli_level = DEBUG +log_cli = true \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index f0e68cf8..04e200bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,13 @@ -. pytest==6.2.5 black==21.9b0 flake8==3.9.2 pyflakes==2.3.1 +cryptography~=3.4.8 +setuptools~=68.0.0 +pycparser~=2.20 +idna~=3.2 +urllib3~=1.26.7 +certifi~=2023.7.22 +requests~=2.31.0 +paho-mqtt~=1.5.1 +protobuf~=3.18.0 diff --git a/setup.py b/setup.py index 55a2fce2..1e65ffa9 100644 --- a/setup.py +++ b/setup.py @@ -1,16 +1,17 @@ from setuptools import setup, find_packages setup( - name='roj-agrirouter-sdk-python', - version='1.0.7', - packages=find_packages(), + name='agrirouter', + version='1.0.0', + packages=find_packages(), include_package_data=True, python_requires=">= 3.6", - url='https://github.com/ROJ-ITALY/agrirouter-sdk-python', + url='https://github.com/DKE-Data/agrirouter-sdk-python', license='Apache-2.0', - author='Stefano Gurrieri', - author_email='stefano.gurrieri@vandewiele.com', - description="""Agrirouter SDK Python patched by ROJ for experimental test to run on App mobile""", + author='agrirouter', + author_email='info@dke-data.com', + description="""This project contains the API for the communication with the agrirouter. Everything you need for the + onboarding process, secure communication and much more.""", classifiers=[ 'Intended Audience :: Developers', 'Natural Language :: English', @@ -25,15 +26,18 @@ ], install_requires=[ 'certifi~=2021.5.30', + 'cffi~=1.14.6', 'charset-normalizer~=2.0.6', + 'cryptography~=3.4.8', 'idna~=3.2', + 'pycparser~=2.20', 'requests~=2.26.0', 'urllib3~=1.26.7', 'paho-mqtt~=1.5.1', 'protobuf~=3.18.0' ], project_urls={ - 'Documentation': 'https://github.com/ROJ-ITALY/agrirouter-sdk-python', - 'Source': 'https://github.com/ROJ-ITALY/agrirouter-sdk-python', + 'Documentation': 'https://github.com/DKE-Data/agrirouter-sdk-python', + 'Source': 'https://github.com/DKE-Data/agrirouter-sdk-python', }, ) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/common/__init__.py b/tests/common/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/constants.py b/tests/common/constants.py similarity index 95% rename from tests/constants.py rename to tests/common/constants.py index 3c785dd7..50601797 100644 --- a/tests/constants.py +++ b/tests/common/constants.py @@ -1,6 +1,10 @@ -application_id = "8c947a45-c57d-42d2-affc-206e21d63a50" -ENV = "QA" -auth_result_url = ( +from agrirouter.api.enums import Environments + +APPLICATION_ID = "8c947a45-c57d-42d2-affc-206e21d63a50" + +ENV = Environments.QA.value + +AUTH_RESULT_URL = ( "http://fuf.me/?state=46c81f94-d117-4658-9a38-a85692448219&token=eyJhY2NvdW50IjoiMGJhMjRlZWUtYzMwY" "i00N2U1LWJkYzktNzcwM2NmYjEzNmEwIiwicmVnY29kZSI6IjhlYWNiMTk4ZmMiLCJleHBpcmVzIjoiMjAyMS0wOS0yM1QxNj" "owODo0My44ODhaIn0%3D&signature=SUL9SQMWAfG4%2FEyT0rejkRfAyioxJIOs4sxI5wxeB8TkIiv0MR6YFKw1tPIkM4ll" @@ -8,7 +12,8 @@ "8xvDW7LjrN%2BMA9rzJZYb1toNf51O0eO4BDWL5L1oLvrKrqvaErKcIoRJtTVJ51awOWMARDkGZahcRdWrZbdGUbQwIyKJQu4" "vH8%2B4ytlyXPSWEYwKE2VFoAjhzWsKODdRRxDbNNLWsW8sxKamdXjSOC8inHUFsFNoxLbwZEnKROm2s3OfKGYuibXOpXw%3D%3D" ) -private_key = ( + +PRIVATE_KEY = ( "-----BEGIN PRIVATE KEY-----\n" "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC8WVUWBhEiQYvo\n" "DL9q/Z5LbIhqDtcdFYWBUV7A96AXJaNRA9J7m3a6es05S7pRynv9yT8i+bhz/qDf\n" @@ -39,7 +44,7 @@ "-----END PRIVATE KEY-----" ) -public_key = ( +PUBLIC_KEY = ( "-----BEGIN PUBLIC KEY-----\n" "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvFlVFgYRIkGL6Ay/av2e\n" "S2yIag7XHRWFgVFewPegFyWjUQPSe5t2unrNOUu6Ucp7/ck/Ivm4c/6g39fDDzmq\n" @@ -59,7 +64,7 @@ "vxXWtkng3yh+7WiZ/Y\nqwIDAQAB\n-----END PUBLIC KEY-----" ) -wrong_auth_result_url = ( +WRONG_AUTH_RESULT_URL = ( "http://fuf.me/?state=46c81f94-d117-4658-9a38-a85692448219&token=eyJhY2NvdW50IjoiMGJhMjRlZWUtYzMwY" "i00N2U1LWJkYzktNzcwM2NmYjEzNmEwIiwicmVnY29kZSI6IjhlYWNiMTk4ZmMiLCJleHBpcmVzIjoiMjAyMS0wOS0yM1QxNj" "owODo0My44ODhaIn0%3D&signature=SUL9SQMWAfG4%2FEyT0rejkRfAyioxJIOs4sxI5wxeB8TkIiv0MR6YFKw1tPIkM4ll" @@ -68,7 +73,7 @@ "vH8%2B4ytlyXPSWEYwKE2VFoAjhzWsKODdRRxDbNNLWsW8sxKamdXjSOC8inHUFsFNoxLbwZEnKROm2s3OfKGYuibXOpXw%3D%3C" ) -wrong_private_key = ( +WRONG_PRIVATE_KEY = ( "-----BEGIN PRIVATE KEY-----\n" "BIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC8WVUWBhEiQYvo\n" "DL9q/Z5LbIhqDtcdFYWBUV7A96AXJaNRA9J7m3a6es05S7pRynv9yT8i+bhz/qDf\n" @@ -99,7 +104,7 @@ "-----END PRIVATE KEY-----" ) -wrong_public_key = ( +WRONG_PUBLIC_KEY = ( "-----BEGIN PUBLIC KEY-----\n" "BIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvFlVFgYRIkGL6Ay/av2e\n" "S2yIag7XHRWFgVFewPegFyWjUQPSe5t2unrNOUu6Ucp7/ck/Ivm4c/6g39fDDzmq\n" @@ -112,7 +117,7 @@ ) # taken from auth_result_url -valid_response_signature = ( +VALID_RESPONSE_SIGNATURE = ( "SUL9SQMWAfG4%2FEyT0rejkRfAyioxJIOs4sxI5wxeB8TkIiv0MR6YFKw1tPIkM4ll" "uZKHEIgr5WvM3b3SvII9TtEbzZf995R8GIlNP6yyP51TF%2F4vZMbkMjq%2B2g1o0qw%2FyuDQcGz1RpOJWCuBOjMXu9quzGO" "8xvDW7LjrN%2BMA9rzJZYb1toNf51O0eO4BDWL5L1oLvrKrqvaErKcIoRJtTVJ51awOWMARDkGZahcRdWrZbdGUbQwIyKJQu4" @@ -120,7 +125,7 @@ ) # taken from auth_result_url -valid_response_token = ( +VALID_RESPONSE_TOKEN = ( "eyJhY2NvdW50IjoiMGJhMjRlZWUtYzMwYi00N2U1LWJkYzktNzcwM" "2NmYjEzNmEwIiwicmVnY29kZSI6IjhlYWNiMTk4ZmMiLCJleHBpcm" "VzIjoiMjAyMS0wOS0yM1QxNjowODo0My44ODhaIn0=" diff --git a/tests/common/data_provider.py b/tests/common/data_provider.py new file mode 100644 index 00000000..9c661d64 --- /dev/null +++ b/tests/common/data_provider.py @@ -0,0 +1,69 @@ +import base64 +import hashlib +import os + + +class DataProvider: + _CONTENT_DIR = r'../data/content' + + @staticmethod + def read_base64_encoded_image(): + """ + Read the image from the file system and return it as base64 encoded string. + """ + image_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), DataProvider._CONTENT_DIR, 'example.png') + with open(image_path, 'rb') as image_file: + img_data = image_file.read() + return base64.b64encode(img_data) + + @staticmethod + def read_base64_encoded_large_bmp(): + """ + Read the large bmp from the file system and return it as a raw string. + """ + large_bmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), DataProvider._CONTENT_DIR, + 'large_bmp.bmp') + with open(large_bmp_path, 'rb') as large_bmp_file: + large_bmp_data = large_bmp_file.read() + return large_bmp_data + + @staticmethod + def read_base64_encoded_small_shape(): + """ + Read the small shape from the file system and return it as base64 encoded string. + """ + small_shape_zip_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), DataProvider._CONTENT_DIR, + 'small_shape.zip') + with open(small_shape_zip_path, 'rb') as small_shape_zip_file: + small_shape_zip_data = small_shape_zip_file.read() + return base64.b64encode(small_shape_zip_data) + + @staticmethod + def read_base64_encoded_large_shape(): + """ + Read the large shape from the file system and return it as a raw string. + """ + large_shape_zip_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), DataProvider._CONTENT_DIR, + 'large_shape.zip') + with open(large_shape_zip_path, 'rb') as large_shape_zip_file: + large_shape_zip_data = large_shape_zip_file.read() + return large_shape_zip_data + + @staticmethod + def read_base64_encoded_small_task_data(): + """ + Read the small task data from the file system and return it as base64 encoded string. + """ + small_task_data_zip_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), DataProvider._CONTENT_DIR, + 'small_taskdata.zip') + with open(small_task_data_zip_path, 'rb') as small_task_data_zip_file: + small_task_data_zip_data = small_task_data_zip_file.read() + return base64.b64encode(small_task_data_zip_data) + + @staticmethod + def get_hash(_file_content): + """ + Get the hash of the content / text to compare the content. + """ + _encoded_text = str(_file_content).encode('utf-8') + return int(hashlib.sha512(_encoded_text).hexdigest(), 16) diff --git a/tests/common/onboarding.py b/tests/common/onboarding.py new file mode 100644 index 00000000..f5a483de --- /dev/null +++ b/tests/common/onboarding.py @@ -0,0 +1,34 @@ +from agrirouter import OnboardingService, OnboardParameters +from agrirouter.onboarding.response import OnboardResponse +from tests.data.applications import CommunicationUnit + + +def onboard_communication_unit(uuid: str, _environment, registration_code: str, + certification_type_definition: str = "PEM", + gateway_id: str = "2") -> OnboardResponse: + """ + Onboard a single endpoint (Communication Unit) and return the onboard response. + """ + onboarding_service = OnboardingService(env=_environment) + onboarding_parameters = OnboardParameters( + id_=uuid, + reg_code=registration_code, + certificate_type=certification_type_definition, + gateway_id=gateway_id, + application_id=CommunicationUnit.application_id, + certification_version_id=CommunicationUnit.certification_version_id, + time_zone="+01:00" + ) + + onboard_response = onboarding_service.onboard(onboarding_parameters) + + assert onboard_response.device_alternate_id != '' + assert onboard_response.sensor_alternate_id != '' + assert onboard_response.capability_alternate_id != '' + assert onboard_response.authentication.certificate != '' + assert onboard_response.authentication.secret != '' + assert onboard_response.authentication.type != '' + assert onboard_response.connection_criteria.commands != '' + assert onboard_response.connection_criteria.measures != '' + + return onboard_response diff --git a/tests/common/sleeper.py b/tests/common/sleeper.py new file mode 100644 index 00000000..53776c1b --- /dev/null +++ b/tests/common/sleeper.py @@ -0,0 +1,17 @@ +import time + + +class Sleeper: + """ Sleep for a given amount of time. """ + + @staticmethod + def process_the_command(seconds: int = 15): + """ Let the agrirouter process the command. To ensure clean message handling, + we need to set the sleep time to 15 seconds. """ + time.sleep(seconds) + + @staticmethod + def process_the_message(seconds: int = 30): + """ Let the agrirouter process and route the message. To ensure clean message handling, + we need to set the sleep time to 30 seconds. """ + time.sleep(seconds) diff --git a/tests/data/__init__.py b/tests/data/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/data/applications.py b/tests/data/applications.py new file mode 100644 index 00000000..90e6d929 --- /dev/null +++ b/tests/data/applications.py @@ -0,0 +1,4 @@ +class CommunicationUnit: + """ Identifier for a communication unit, used for the test cases. """ + application_id = "434989e2-b4be-4cfd-8e40-f5b89d83458d" + certification_version_id = "82037ed1-7cac-4aa5-b71e-d7f022628ea6" diff --git a/tests/data/content/example.png b/tests/data/content/example.png new file mode 100644 index 00000000..135cd2c5 Binary files /dev/null and b/tests/data/content/example.png differ diff --git a/tests/data/content/large_bmp.bmp b/tests/data/content/large_bmp.bmp new file mode 100644 index 00000000..b9c290b1 Binary files /dev/null and b/tests/data/content/large_bmp.bmp differ diff --git a/tests/data/content/large_shape.zip b/tests/data/content/large_shape.zip new file mode 100644 index 00000000..d4245b4a Binary files /dev/null and b/tests/data/content/large_shape.zip differ diff --git a/tests/data/content/small_shape.zip b/tests/data/content/small_shape.zip new file mode 100644 index 00000000..0b49bfbd Binary files /dev/null and b/tests/data/content/small_shape.zip differ diff --git a/tests/data/content/small_taskdata.zip b/tests/data/content/small_taskdata.zip new file mode 100644 index 00000000..f3d9da09 Binary files /dev/null and b/tests/data/content/small_taskdata.zip differ diff --git a/tests/data/identifier.py b/tests/data/identifier.py new file mode 100644 index 00000000..5f9b2d2e --- /dev/null +++ b/tests/data/identifier.py @@ -0,0 +1,53 @@ +class Identifier: + PATH = "path" + ID = "id" + + """ Identifier for the endpoints, used for the test cases. """ + + """ Identifier for the Http recipient endpoint with a PEM certificate. """ + HTTP_RECIPIENT_PEM = { + 'path': "Http/CommunicationUnit/PEM/Recipient", + 'id': "5c124b14-f309-11ed-a05b-0242ac120003" + } + + """ Identifier for the Http sender endpoint with a PEM certificate. """ + HTTP_SENDER_PEM = { + 'path': "Http/CommunicationUnit/PEM/Sender", + 'id': "a3fa610e-f30a-11ed-a05b-0242ac120003" + } + + """ Identifier for the MQTT recipient endpoint with a P12 certificate. """ + MQTT_RECIPIENT_P12 = { + 'path': "Mqtt/CommunicationUnit/P12/Recipient", + 'id': "dc1b27ce-c283-11ed-afa1-0242ac120002" + } + + """ Identifier for the MQTT sender endpoint with a P12 certificate. """ + MQTT_SENDER_P12 = { + 'path': "Mqtt/CommunicationUnit/P12/Sender", + 'id': "e6bf88f0-c283-11ed-afa1-0242ac120002" + } + + """ Identifier for the MQTT recipient endpoint with a PEM certificate. """ + MQTT_RECIPIENT_PEM = { + 'path': "Mqtt/CommunicationUnit/PEM/Recipient", + 'id': "d9786fbc-c888-11ed-afa1-0242ac120002" + } + + """ Identifier for the MQTT sender endpoint with a PEM certificate. """ + MQTT_SENDER_PEM = { + 'path': "Mqtt/CommunicationUnit/PEM/Sender", + 'id': "fe3ab36a-ddc7-11ed-b5ea-0242ac120002" + } + + """ Identifier for the MQTT message recipient endpoint with a PEM certificate. """ + MQTT_MESSAGES_RECIPIENT = { + 'path': "Mqtt/CommunicationUnit/Messages/Recipient", + 'id': "dde93925-b35d-4fac-9e83-a1d1ff0ff077" + } + + """ Identifier for the MQTT message sender endpoint with a PEM certificate. """ + MQTT_MESSAGES_SENDER = { + 'path': "Mqtt/CommunicationUnit/Messages/Sender", + 'id': "e3df3eb7-c6e2-45f2-9b95-eb5300cadc56" + } diff --git a/tests/data/onboard_response_integration_service.py b/tests/data/onboard_response_integration_service.py new file mode 100644 index 00000000..a4ad38c9 --- /dev/null +++ b/tests/data/onboard_response_integration_service.py @@ -0,0 +1,39 @@ +import json +import os + +import tests +from agrirouter.onboarding.response import OnboardResponse + + +def read_onboard_response(identifier: str) -> OnboardResponse: + """ + Read a recorded onboard response from the filesystem. + """ + path = _get_path_for_onboard_responses(identifier) + with open(path) as f: + contents = f.read() + onboard_response = OnboardResponse() + onboard_response.json_deserialize(contents) + return onboard_response + + +def save_onboard_response(identifier: str, onboard_response: OnboardResponse): + """ + Save a recorded onboard response to the filesystem. + """ + path = _get_path_for_onboard_responses(identifier) + os.makedirs(os.path.dirname(path), exist_ok=True) + data = json.dumps(onboard_response.json_serialize()) + with open(path, 'w') as f: + f.write(data) + + +def _get_path_for_onboard_responses(identifier: str) -> str: + """ + Get the path to a recorded onboard response. + """ + path = os.path.join( + os.path.dirname(tests.__file__), + f"data/onboarding_responses/{identifier}.json" + ) + return path diff --git a/tests/data/onboarding_responses/Http/CommunicationUnit/PEM/Recipient.json b/tests/data/onboarding_responses/Http/CommunicationUnit/PEM/Recipient.json new file mode 100644 index 00000000..48847bf6 --- /dev/null +++ b/tests/data/onboarding_responses/Http/CommunicationUnit/PEM/Recipient.json @@ -0,0 +1,18 @@ +{ + "deviceAlternateId": "443fb438-5b82-43d9-9214-2145e3ca665c", + "capabilityAlternateId": "3035ec70-dca1-4d71-a000-e79eb5891f81", + "sensorAlternateId": "c5c1e49e-21a2-4e4e-85bb-1b1bdda7db59", + "connectionCriteria": { + "gatewayId": "3", + "measures": "https://dke-qa.eu10.cp.iot.sap/iot/gateway/rest/measures/443fb438-5b82-43d9-9214-2145e3ca665c", + "commands": "https://dke-qa.eu10.cp.iot.sap/iot/gateway/rest/commands/443fb438-5b82-43d9-9214-2145e3ca665c", + "host": null, + "port": null, + "clientId": null + }, + "authentication": { + "type": "PEM", + "secret": "KiBxsdXls2DpT!jbdFCFB?RDx!BWgAuQEbo6", + "certificate": "-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE6zAdBgoqhkiG9w0BDAEDMA8ECFlR4TtXmNRYAgMCAAAEggTIU7Kg9q6t5kWS\nSHWXz0ddWtZ0M1dI0hXv9yVl+S/SgjuCSNKJQ6VFtavFIe3Y1hZTogZYVsQlSwJY\nkWl4m7DyxElMpa2dnzIh/VoYZfhnmWtTTWVbVN3126Nrbfv8KcipqXOdJfyby9N5\npBw05MOqGAwiglcZ2b2KDMMxhz6WVpf78Qp6omcIWhkCx+P+ZGujFl+Wu8t4s/qM\nNMOYF4NJysIateNPntDMbwstVkXMEKoPJ91Kic7Bk87vn/jy5DuPscg+W2AC4qqA\n6+qO3ska7cXe5TMyiZV+nyDoBT7BF+2Kh5CITvM6FpuhkIXYOSE5/yEoUdAorL7j\n2E6bmMDRJwOjIgNLFY6fyV9RiJdJyaNqk8hf8H+dj75KiuA1QkZTJ6U+E/8tzDuV\n9XDJdpx/jLV7N1+CS5hhD8HhjeTP0iTaZulpJAPBLzT7XE8nZtBWKlBzOCziDIOD\nUoAAL1N2zPBnjIru2FM3WRk+1Q4aDwQrir6szK4d5gjG0+tfvS1THFJCCXKqP5pp\nL/f7I4r+l4dXL4B4HEh0uEHeLesvnphcw6ZMvgER2T15clUw9in2C87FEYcrUhC+\n4VBnSr02fyyQ3RzgxU2YEXB3P+tuTuidYNI6NULnST3epOIoGiw7gNYq8xhdth/6\n1xWubms3Bn8+Oim+J38aTXiY4ipcGyTyerr+VBb6Q5keEzIlbO96WDKY4PxGbkVx\ndi2P0/okD0AVj/fchmtrT7PkfBPq3BRArqi9RUg3b2rU74i/dB2RpDoYwNEGE/bg\nHEb/3t54yAynBfs8dKyZ+Vkp5IFbcZhsEKhxgdPPyOtZsGyAp+1jdq1PI/QeXzAd\nLfskS7IMHv3cjiThZRxkB8n8grKgLSt90r2bPqQPofaYpI+2uTQvSLTCy79JjHn/\nR2NlPRY/mUmhCFsyZPGiDLqMuIjY12pPVfDkujwuML7aAqX4qEnOOhm7k5z5HK7M\nQKYKKRtVGZskKepJdQPkpVkOeUtYysc4R5VBTduuRT2u860CAFVLDzw8I4EXlviO\neYof4y+Vh9BpkXgp9xe8OjUUMep2g18cdfLw/2nBgw3Wa9LAzepnH+s9kFMbnpGZ\n+1hJBdrMHLPxVLf7g2B9C6I6YkxIjTmfr/9cWSHLu/f8F68bH+rkQLg14Se+lxC2\nYtodWwOxnJEwgOHc4X3+4kRC94tmpDx9BqiLCYd5dHscOzRCML6nrGxQ+PFZMeKb\nUVONvMyVUPO24e2PJNDkg0WZMgbw7WCT1gSgXDFjHCJPpztvZVP4W5+qQrXf192p\nYQ74hXHaMbdIANH64RV7Of9JkOKGt8YEUkQIOIMdxRZ3I5eZmbpC3SRewZG4xkBO\nb5/8OabIaK+/Jhwz4h3C137lINsK5utn4DFkX1/rRXytuW0q7JrK9biZEJdYiAKC\nSZqdXQeByqx+fD0eJVUll68LLSo7NjbKiEFdc/hHmjCfFDSr311/+uNGK3nrMLYP\nZ50ZQ/3/YjxoETo9svPLIPyO4qk6uBrqGWI/QUvxGg2jcK7q5vv6LvBTHENbY2QP\nli40Z4XF16+jdp9rdrWKDnbp2T5Y0g9F19GqakXRnWQMrq88Yf/ERO51cx0HIEs2\neXorgSb5FUqGYLk2IpKF\n-----END ENCRYPTED PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\nMIIFeTCCA2GgAwIBAgIQYiP6o8qATux42ueFRm5rGzANBgkqhkiG9w0BAQsFADCB\ngjELMAkGA1UEBhMCREUxFTATBgNVBAgMDExvd2VyIFNheG9ueTEfMB0GA1UECgwW\nREtFLURhdGEgR21iSCAmIENvLiBLRzETMBEGA1UEBwwKT3NuYWJydWVjazEmMCQG\nA1UEAwwdYWdyaXJvdXRlciBTQVAgSW9UIElzc3VpbmcgQ0EwHhcNMjMwODIyMTMy\nMTMyWhcNMzMwODE5MTQyMTMyWjCBoTELMAkGA1UEBhMCREUxHzAdBgNVBAoMFkRL\nRS1EYXRhIEdtYkggJiBDby4gS0cxcTBvBgNVBAMMaGRldmljZUFsdGVybmF0ZUlk\nOjQ0M2ZiNDM4LTViODItNDNkOS05MjE0LTIxNDVlM2NhNjY1Y3xnYXRld2F5SWQ6\nM3x0ZW5hbnRJZDoxOTAyMDAxNzg1fGluc3RhbmNlSWQ6ZGtlLXFhMIIBIjANBgkq\nhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjBxIpuJ6ov9awndhpOBsXa9AjonYE+qc\nNIk45d4YiqOaHjKHpQbck2tLNTcLx0A5ykZM2F9OYpINBN51JM58IQpbRHD3kftt\nBhQWoFvMX1/7FzFzVDg0VyWrk0faiwY8QLBQkGiEdmHA5/gNot/zvlZQOo4bu32J\n1FVU2umWOUgXOHQ5dds1Mr1HVyHCJwLXvyD1wjvarcQMKNuhHyh+Or2L7sJOy+Kk\n0tLtvbcRaMeqqVp4uD9Ykgrn2OhM57AJIaMOaff5CQG7YKVkaBjTxd31d4E6kX1X\nZnIrZWZAgJeBjk6807RGDADtKroWnLtz4HINWpAIG/qnRTcAztiN8wIDAQABo4HJ\nMIHGMAkGA1UdEwQCMAAwHwYDVR0jBBgwFoAUvSP8kswV4ZBl+2tcqhM/JQgxZPYw\nHQYDVR0OBBYEFD8uI/VSwSSR84c9i0smmLhYj2aEMA4GA1UdDwEB/wQEAwIFoDAd\nBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwSgYIKwYBBQUHAQEEPjA8MDoG\nCCsGAQUFBzABhi5odHRwOi8vb2NzcC5hY20tcGNhLmV1LWNlbnRyYWwtMS5hbWF6\nb25hd3MuY29tMA0GCSqGSIb3DQEBCwUAA4ICAQAHOubNwZ2WN5AqNg8VUmQPohdh\nwQS/Hy1dOzlDjV5AXr0h+fQGniuZ2M02t5y+XzI59DzRFm7xmPRqV1hWXIugOMuP\nUQmXsQ2ykrXk+dkejAKawJe0ceu3bF9IOYKLfQcREKoADHogT/mRI21D8uHQZjfv\n6Xut3QJdtYX9/Xa5RV5fVcj3v4XZqYZwE4irR1QojqYa90dCgiruVesXCeo0X1jt\nYVxquJzD+tsOm5KdfwTAH1hjoeV1gGSgjQkW3tIAcVlq+3sXb4AbYnKtJjPiUrlB\nkxLCRMPaUI1CpI7H1N8xjT/g4tMUZ/gTuKIhj5Hyf0TN2kRWsTaEccoHya34tSOs\nLPqyKlCuA9UNETjWEghOfmZQlPKwRQY5ZfenLfHEW35glmeldX1AmAdqGOuu0Vfa\nlsjZNvSLd5vr7HTjXbnn36xDqEmgDKgz68G4iOKpavyKvVElxqJ+HYn8xoJ4rrRr\nwlHioHhUNtbDIqXjuIhdquMQoXQV0ZKyLi3exjME9e90Bnmc0rFI3deoZOOa0PN5\ncnUjAJfAI+vQ6rxkDtzE+phr+X1NxI81Vk36aYh6CiIusGFPE4LB/7Wwpgq+EkZY\nhBdNM5XMEzvv4YY+/LWL0aG2zRqZ3pmrTzgnSo9rFE7tpMwCZltdbEW28V4sVoen\nUL8laoo0kqMLFdo/zw==\n-----END CERTIFICATE-----\n" + } +} \ No newline at end of file diff --git a/tests/data/onboarding_responses/Http/CommunicationUnit/PEM/Sender.json b/tests/data/onboarding_responses/Http/CommunicationUnit/PEM/Sender.json new file mode 100644 index 00000000..89e1b87e --- /dev/null +++ b/tests/data/onboarding_responses/Http/CommunicationUnit/PEM/Sender.json @@ -0,0 +1,18 @@ +{ + "deviceAlternateId": "f3f02912-a33a-434f-a7c2-f4634fcaa9e7", + "capabilityAlternateId": "3035ec70-dca1-4d71-a000-e79eb5891f81", + "sensorAlternateId": "9ab4f22b-e50b-406e-84e1-c20a9607ac22", + "connectionCriteria": { + "gatewayId": "3", + "measures": "https://dke-qa.eu10.cp.iot.sap/iot/gateway/rest/measures/f3f02912-a33a-434f-a7c2-f4634fcaa9e7", + "commands": "https://dke-qa.eu10.cp.iot.sap/iot/gateway/rest/commands/f3f02912-a33a-434f-a7c2-f4634fcaa9e7", + "host": null, + "port": null, + "clientId": null + }, + "authentication": { + "type": "PEM", + "secret": "bHvEEOsRW3bCjyE?pUKiId75MjkYD?j1zQmC", + "certificate": "-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE6zAdBgoqhkiG9w0BDAEDMA8ECCsXexHKNV/xAgMCAAAEggTI+lvzawi5edFI\n27I5Yz20RjcbJC8B8m4DXAS4cD45BVVERQY8hvJYOzCisUPub4GYEIlgSP082pwA\ndIoYnhiNui6+b1MCtM+SBHucgG0P6hklBhSiTaShja8RIn1j8KjVN/ZG/FEyoNth\ngnH8hIPJeKgedh/Qn0wapN755uFlG/vFMMVz7i2Oq+EFx40bnSaSG9ptT8jzG9O3\nv+phjaG6yQDkvKCiZ8NZqSh9l6WhcLJJ248NygZ5e32d78AzcG4gMc8f2zmYhAhs\nlDNjA00uiuOmacsC5MAx4hgYiqZGMUVXaDAGGNgFMoQJr9yV0wiuO+JhGghv4w4w\nZNyKDmWeVubHU2QZd4byHCCwnI/kq76WHQDwBj3G/S66YlONFOyTooVPMtvYUNTN\n4itB3cfvt8xFmvloxaJuyBaj9sU/DSQgt/uJ2egceAobLFbyPoziijQxWRzeXsGO\nsCBsctrb/9gwSurVBCIA2rqFzSKQztydTOZWLv7wSiCs586I5ncbgJc2us3Lg/Al\n9G8D/V3vW94oQ5P7JL3r1b0VICXUR3DouPsrOzwbQWvQrtqLxBqzTK3teOnKgbd6\n7i/YCcfAEehnh8Rcxp1cdowSwYXLf1IARJLMoZvXsG/3pHd+UklxoCI8WH0XsXo/\nVjZooVaxQK5wFQeNCf3kQGg3+pfBLDDgdtcmBbKWQYEymzK2P6wir45X6YeyAObC\naFMQwvGkGE933lpQBVVIeskKjt0jvtlpVcDf37wPZqaobvfL9kVUJaOPHtbZoMCk\n7QdYGDXas4/+NoPadVVtL7t3YY54RC3RYga7yKDa2BKPxf9Yuh2xxwr1Dw9PvU4M\nnaIKgfxQbuseoK5Irt9v0O2ogTrFJhhdmDDrX0Snwfgf1C77RmEtJkfY98DR7OV1\n+lUnVqNe1KLnWh2V30p+7KSU1LDNAxhguVNaYy3ITK2X5eTReEJOeU9vuh8mPG2k\nqFwTJz1qMRZzI+ZUUQX25VMR5jNDQUoBqXNAJV8xec4ZCnzdQGr4Tr6Q3yKq4Nac\n5JA8ZUzYPsvX0YF/0lNx4BUld9fLuJBzWp4U4GegiGb91UvW6eYB9rkLzNnVJptY\nPh3ZeZKfsr5BZ2KK8OON/9btZ+aa2yNh0bGHX/JcU0K1+1vSCq5I5R0KrwVOvJ3R\nI0dSLKE+c+3Sw7uDcxRwA+m475Ys+Ss2qrcG4HB5u5X1wM6AKP3OHB8Yd8jpa8A9\nG4gq4w7rEDgKWXPYw2Uqfr/ovWYe889dUjNZMffbRFLOGRo0MTbxko172Ok49uWi\npJxdQJrYwsEMopZE0IulsIiNuc2l3xeWGEN8oMWmd/1PVv8rtw7A7KXwWjpVTVfI\nPg0kvVxnj1AP5coLF4vUJytYhE6vE+Ff8uqh1LyDhVhF7+4gTMCNEhu26LSUdPE5\ncfnVQBqgZONvCi/A9keiJE15iSwRwfQzBAq0EGySe6qgjCrUZEs5ahJ9dLlCOP8s\nyciOXo+/WZH3RP8VhBHDc7XcXy+ElAyu1yudc0ifMKJpCM91kmxeV7Z7BpEHkwyk\nm3p4AW9rcI2fquJ/v8XIYRcUxZm3WdDSl7xS6UsodBp2HYFvB/fy0WPs3rg1pQUJ\nDNJqXxhkaq8j9O/0W0iQ\n-----END ENCRYPTED PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\nMIIFejCCA2KgAwIBAgIRAOhnRm+PpiAeTRkacXdcExQwDQYJKoZIhvcNAQELBQAw\ngYIxCzAJBgNVBAYTAkRFMRUwEwYDVQQIDAxMb3dlciBTYXhvbnkxHzAdBgNVBAoM\nFkRLRS1EYXRhIEdtYkggJiBDby4gS0cxEzARBgNVBAcMCk9zbmFicnVlY2sxJjAk\nBgNVBAMMHWFncmlyb3V0ZXIgU0FQIElvVCBJc3N1aW5nIENBMB4XDTIzMDgyMjEz\nMjQwNFoXDTMzMDgxOTE0MjQwNFowgaExCzAJBgNVBAYTAkRFMR8wHQYDVQQKDBZE\nS0UtRGF0YSBHbWJIICYgQ28uIEtHMXEwbwYDVQQDDGhkZXZpY2VBbHRlcm5hdGVJ\nZDpmM2YwMjkxMi1hMzNhLTQzNGYtYTdjMi1mNDYzNGZjYWE5ZTd8Z2F0ZXdheUlk\nOjN8dGVuYW50SWQ6MTkwMjAwMTc4NXxpbnN0YW5jZUlkOmRrZS1xYTCCASIwDQYJ\nKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJa9In7G211z2osio3Zh4V9BzGU4ItOV\nW2mORqTlRR3SnVc3Kn472SODPHCn9nbAd1HTZntInrgq88VUus4S7fBj5m+EL0FV\nnNXh2G43D3HsQAdzLnJhZgWN8sMO8xmX5i81ggDpbkJ3rxxMolBBPQFowtQyoKAb\nbS2X5dLq9anTyO5n/yDHkkpRatJdHESMRSf4yNE3y5sip/iMdjPMMR8L67jlO3dd\ns3g2NbnEN0ZEO3Mit+cgvsYIJOomZ4HwgGySjedZnmI+vdATA/gTRE0nIiZUnqPk\nNISZfrQ8/hz9v9pVAzXYStshyxWBn/WhsuxhhX2DIqQaWkQMAD1G/p0CAwEAAaOB\nyTCBxjAJBgNVHRMEAjAAMB8GA1UdIwQYMBaAFL0j/JLMFeGQZftrXKoTPyUIMWT2\nMB0GA1UdDgQWBBSESfqkwzPiycQpD5mnytOAOr3AgzAOBgNVHQ8BAf8EBAMCBaAw\nHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMEoGCCsGAQUFBwEBBD4wPDA6\nBggrBgEFBQcwAYYuaHR0cDovL29jc3AuYWNtLXBjYS5ldS1jZW50cmFsLTEuYW1h\nem9uYXdzLmNvbTANBgkqhkiG9w0BAQsFAAOCAgEAZgGCn20YcZhR7EURqxQIVR//\nrVP8Mmlbnv1KBElYT3iebcT8la08W+Z07YxxSGbHiwKTkHdscjgr8vBZVEqZB43n\nNCIB+cRz++/QlDxcAwp+rJYPvKwmRSPNTS/n/ZN7Jf0M91NOEA1WlsBeyRMCuZsr\nReRoFEAPGmVk5SBaE2vUdrY1bTYXN/HxczNOO+uH9N62ufOd0cYcb+mO4Vf5J+ZZ\nXKNEb7Vy3PP03KBzcBWbwXp2fHMku1NIx7gs1GPoscWeJpXe6hw+515mFlkC1BDQ\nbd5okou+U3eeWZ1EH37wuP1s46KLpPqwaK5zdtf0W+cunsZVviKaqsBvkARJOjtz\nOxdOxOnEzPiZY+MbvvnvDh7utUVd57dshOVnHFqilnlTBv9czL7BNhJSVxrJeAdh\nKk0N+GclwfS9Ss9ybrWA4gL9qDLNo7capqxEGmMDzQkMdsVNDRN9IFtmUzSkM4rd\nBH1wMrdfOCcMpd4Eehk1d1+Q7wGaEYPQdusalFUf5TMSawKJqmG4RukqNuful0dC\nVQhN8GZrdox4EGgow2agxmwhic66qfzAz3E2OV0NnwSqn4YXq3dTNZFmi+FvZREX\nxW9rXl8C0oW8Iv9gSudiDIYuOY9Ots7ifBbqgKUvZKiRRkrNwmZSYZo3BP7UIpp3\njIp8qndaH69Ry2ulSHE=\n-----END CERTIFICATE-----\n" + } +} \ No newline at end of file diff --git a/tests/data/onboarding_responses/Mqtt/CommunicationUnit/Messages/Recipient.json b/tests/data/onboarding_responses/Mqtt/CommunicationUnit/Messages/Recipient.json new file mode 100644 index 00000000..3f58b6f6 --- /dev/null +++ b/tests/data/onboarding_responses/Mqtt/CommunicationUnit/Messages/Recipient.json @@ -0,0 +1,18 @@ +{ + "deviceAlternateId": "a91d831d-d059-436a-811f-b004363f6277", + "capabilityAlternateId": "3035ec70-dca1-4d71-a000-e79eb5891f81", + "sensorAlternateId": "755bbb0e-781d-4738-9532-609771ddc378", + "connectionCriteria": { + "gatewayId": "2", + "measures": "measures/a91d831d-d059-436a-811f-b004363f6277", + "commands": "commands/a91d831d-d059-436a-811f-b004363f6277", + "host": "dke-qa.eu10.cp.iot.sap", + "port": 8883, + "clientId": "a91d831d-d059-436a-811f-b004363f6277" + }, + "authentication": { + "type": "PEM", + "secret": "5auBv6Dv8imwly1ZjJJ4UyU5Y9iNWquABZp!", + "certificate": "-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE6zAdBgoqhkiG9w0BDAEDMA8ECOBhIIC+Z0xGAgMCAAAEggTIPxp+4vV/bh9j\nKppg0rnzhVO4hREWul8pePtV6vpN8rDg8pfvUOg9EoRhLNSUouE30b2689U0IoOv\nOqDHlhGu7skntSG5ys+IHQJTaeKXH5lrtH4o6vXPA9FVncQUVEme38zd/CfFFrB/\n8RNbd9gjcigTD9Qo+y9ugcZNE2t8A3HkoGN5fwOk5AF40Z0LYM9y96Z0afOnQbX2\nCEEphvjCYZ3kwcR+O9KgIOEWRIS+UgEwshfuWDDCkfLd7zgvTDpw7AEUm1PPYTN1\ncrn16wUG22Tbfx5o1VUD+EQl9bdeSjLVPYLCTHWKuKPek0vo5iRt9ewUGuxiYxLN\n+/9LhN/Nljk+2ERJBTUmyVqPifY+hcxxG7ktLCvZzCI8MkwOLsZgZiHxekgNHHo2\nnWcoLiA4/LWfl2Tyske/L5WTwr3VuQUCW6b5awUMHx/SpLqn9zX4ygXFpPD1nOKx\nuzIEoi0QmHxfQ2XzKq06MHiW9ZSnAeB5p+UPIgbEtdNxuyFvaA7jqGaZWXzi6mqk\nph37hmZ0FV77LYhNFpDY7LDVEQO7khdiUjrxFrewvM+P7CkhnNPyD/WQrx7DyoHY\nazOWNQA1PZ5xW15TXmO3UsJqhqY/GJXoq30K18nSQm5+kfG0uhK0usss2+PTAuzE\niS+jvlVO002sVwhn3Zl3SeNf3Bv2eE39W4gqPvMgQi+4DV8Rz2N3nmm2i3C0JKat\n7YPNLMfqEGGK1B9dFq/5gFA098khygGUnBnsbTsNu84I+LzGUNfceZGUdoWRC5Av\nh3vbB0iXL8fS/vTc9W1HZjbBivn5N4HPEiuly+k/u3xKv4SpE1NYwoUdDAm7MmL2\nCtIsANgTAKFARrBaJVo31s+kTug3JP6gtiL0iNd9iw+w4alrSuIQLQ3yVOBB2tlw\nti+lXYI8bifCxaTOPAcL5SkIVhjJKDurSo9K6rADZNVPI8Qj/Ssh32V7Y7O62Ys+\nK+18Ks84uIH/R6UitAZMPub1vfIuEKg4tKuavOiU5rXAuMt/1GrNbx9Oy3ekkRYb\nmzYeiKoZukYTLLrX9fLCbSyHuvLpq4xY45ajleKRNVpRsVclFnpin6Vv+jngQO5m\n1GPqLfnvPFs0iJaQ2UD/3yMVlLCpkom5d292SawPI1k7C0qjUagAMkcY5i3ypmxC\nlzRS9w8L2sDAaNhGdsFGh1BK6Tbevyz32svef6n8HWPOeHKpm9LN/NS+HE2thrQk\nRja2k3seCQpIzMMX1aV1O81UdhyXZwH8djuvtOGsJ0f5Azl5TGIIYlsvopazGwK6\nkWLRyKXhzTyo82TF5NuuEz9yzYB29/eUa8KjaO3veygnWJ0wfaLp0bYHcvf5pFyu\nhltQPJjVIIfkEALS7Os+so5qMaeaHMvrm40jJg7QTjE5ZUz/JmixLbORKL9t4qRQ\n/dPTWcLdqgWPWyjYmLNzQt1aqQUWizS99nXCCkTHh3edccjd/pwIt6OupD3pbdFV\nnYlPIxvAWrucbhWboJrU6DE+0PXKyEm1yka89vMJ1Q8PtRJJVF2ejpC4l614qrQN\nQ3hcQiYYPQzQUR19f/GTHhCpPeT1YRhz4lnQqvln3UYvovqQd0jhmlKjSFkidpSd\nlBlvHcOncj3Hil2r/Qgi\n-----END ENCRYPTED PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\nMIIFejCCA2KgAwIBAgIRAIaB1GoIsh/MX0cK7Ii9TwgwDQYJKoZIhvcNAQELBQAw\ngYIxCzAJBgNVBAYTAkRFMRUwEwYDVQQIDAxMb3dlciBTYXhvbnkxHzAdBgNVBAoM\nFkRLRS1EYXRhIEdtYkggJiBDby4gS0cxEzARBgNVBAcMCk9zbmFicnVlY2sxJjAk\nBgNVBAMMHWFncmlyb3V0ZXIgU0FQIElvVCBJc3N1aW5nIENBMB4XDTIzMDgyMjE0\nMTAwN1oXDTMzMDgxOTE1MTAwN1owgaExCzAJBgNVBAYTAkRFMR8wHQYDVQQKDBZE\nS0UtRGF0YSBHbWJIICYgQ28uIEtHMXEwbwYDVQQDDGhkZXZpY2VBbHRlcm5hdGVJ\nZDphOTFkODMxZC1kMDU5LTQzNmEtODExZi1iMDA0MzYzZjYyNzd8Z2F0ZXdheUlk\nOjJ8dGVuYW50SWQ6MTkwMjAwMTc4NXxpbnN0YW5jZUlkOmRrZS1xYTCCASIwDQYJ\nKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKoNkoJn4Mr5LdqrFjyEKPD61EtTjstx\nWfsNCUDegt+1UdWCN53rtxmsxVqkQkKZa1PeL/t5KPYwFtFsI1mavM/7O2xynQ4P\nmV/le2IW6PXEzqDsRomiNqpQi5uao8J6o2/zEaQwsLoA7w4ZCTjVgkXw5j7FpSnt\nEPj3C6jnBxbnJsJV6AEsLFU3efBYpNdqpcQnPA8gDMPpDe7ypanr4/R2TE4NGAJt\nD0ZULuX81Go9SVsxJozRdqE9KZHJ0WNpszXY64UDU0WgjdW8ked3N5Kjo/yFEvh8\ntsRbuf2CPnfEYZwhheY62jiAbt89VjQRLkALdvbpXGKLaQcjzKyn/aECAwEAAaOB\nyTCBxjAJBgNVHRMEAjAAMB8GA1UdIwQYMBaAFL0j/JLMFeGQZftrXKoTPyUIMWT2\nMB0GA1UdDgQWBBQGSSAgllqJZW+63kbSEQbrTj+YEDAOBgNVHQ8BAf8EBAMCBaAw\nHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMEoGCCsGAQUFBwEBBD4wPDA6\nBggrBgEFBQcwAYYuaHR0cDovL29jc3AuYWNtLXBjYS5ldS1jZW50cmFsLTEuYW1h\nem9uYXdzLmNvbTANBgkqhkiG9w0BAQsFAAOCAgEAPUhIV1wa1vfkLN6RWQ1z38Tr\np3Yl2RdyOObKAJD495DAULAUT9CoF5m96EhSjpRcDgAMyeCQUbSmMY80JY4yJqyM\n/CXVw6ioCzaWrMdc1nVvBtNJKEO84GVxelh/lmJnPJsQW5RrmG5P0yMbLOzmutHI\n/1S0Gc3WVm4Rw4gwDvFb+4ZK/AsfNNR17oTP+ZKiosUpu7JGQkMI4xDFWLmb9jcx\nPkO4GN2HSflsMoXe9IAwVS3Pd/SXScoPdTX1OgIbzg5j85xi9X4MHDZM2HV6LzxR\nDGaDlLPmntbcPOWe6f68CBTt91uBT1ipQQklloI1JbP8JQ/oFYcHcKPlalRmpHjY\nGkOEnC1nQus7Kc00rD5oWmlq33LE156ITSExSPRGBvkSIBabTyKOonkkVfwcy6gN\nKPTvpj5n37bxo4D/wTO4UNxBuyf40jQCf3ZT5xDkmxAJeMl+ydu6RrOet0CHzu1e\navNuL31smrRhZ6Y8dLWaD1q60XOa5TbajUunTGJJQBn5Kxvs0U9UeS3lWjsibqoS\n/x77Cuq0eodQA03xO0y+HmPciY0tyrrD9ktyUDxMvYXaWky1QMFBprmWrzKi4EKE\nSn6fV4zBsty8KUCvMBrEd35lJtWGBSip6Z6TKa8nvtILi6JOXXIVlgaqErhAPklc\nVMR0ZRXsEtv3Q7lPeA0=\n-----END CERTIFICATE-----\n" + } +} \ No newline at end of file diff --git a/tests/data/onboarding_responses/Mqtt/CommunicationUnit/Messages/Sender.json b/tests/data/onboarding_responses/Mqtt/CommunicationUnit/Messages/Sender.json new file mode 100644 index 00000000..44ee502d --- /dev/null +++ b/tests/data/onboarding_responses/Mqtt/CommunicationUnit/Messages/Sender.json @@ -0,0 +1,18 @@ +{ + "deviceAlternateId": "4965de99-9417-4045-a27a-3e521176c1d3", + "capabilityAlternateId": "3035ec70-dca1-4d71-a000-e79eb5891f81", + "sensorAlternateId": "5c10a7d6-820e-4a14-b2e6-7aa5a496d040", + "connectionCriteria": { + "gatewayId": "2", + "measures": "measures/4965de99-9417-4045-a27a-3e521176c1d3", + "commands": "commands/4965de99-9417-4045-a27a-3e521176c1d3", + "host": "dke-qa.eu10.cp.iot.sap", + "port": 8883, + "clientId": "4965de99-9417-4045-a27a-3e521176c1d3" + }, + "authentication": { + "type": "PEM", + "secret": "DCZMSLO11RGjHX1QgFy?6eqY17PT2Oc4XP!T", + "certificate": "-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE6zAdBgoqhkiG9w0BDAEDMA8ECHOkPNxsC9yzAgMCAAAEggTIQBUf69kbgs+s\nN0OO+LVbXDpjHhoCdg6BPUBJJobz6jgSsRnZaftoBKKwG/egbFwfz414GxXMoyBr\nBuxm7FdcV1e0YTIuA1fnM5FdgmMJm5VGjeag5Yy2T1FPMp6D8bjrdxZ97l/Jf6MG\nae9UPoYweW8uWVv9XyLWmM37SyywrNan1Sjbq22kDto2TNtCkeoRBAJxilADt/fB\nJxtVnAeHLGBRL3NKJmiQ/rIxJk2By7Q1TufxO8R2nkrLuCOAmRr9CpivtNmXfPON\n+jWlYfNUlhJZzrMKRBnx1Ardi6Y2sja4Bysj4V6dKI80XvZb8gj6fQehKucxAn8l\nWLPLT4vOA2x6mfxXDkHublpzAlIqqh3KX3AtnGAO8gVK/IwdI2UBfe4DSVoC6swR\nZAwDoEaQLuYjomtavdfVGqLumwEWaXCoHABGo3Aj236OZ9awwWYVLGrRwUU5ZIXk\naNRNRsfx6LcuFWLZWc+CWHJS8R8X2HZF6/P6K0UvkfiVE+AeGJUqFb7HbxzbKNmw\no3i/ZDv8ksv8EbB1aVCpLvgs8Nv7JgcPJtks149zXr1k5gpWZH+zqT8xhVEC8SCN\neMFPyotNcfVgm9dM8YCSNpRHH2ysg+jJMRgtX3HQjSr/+8WOoogKVfqfxjI0pSVe\n+QS3PpN0CqtXUVtcy3QTYeTpqKxmdw/iqgNHdtegI8735ELy7R5n9yTIZcvpAXKq\nEzF0Kb/2nESYhrOD75XnDfMmpYJjMHaaGQEbtcpEGmKCS7JsnGXyQdDvP/FQpdZu\nPSQ6dDtMDva/WCmIHh2koc9VcG89bRRPa4ZSkPgOWPzB17OqPY0S11CsLltACFt9\nSvmHWs1MPh2Bxuh6GeySPoIPLu8L2cA45AaO75qIVwH8uryYO26VjOfjqqjjU4Fc\nLpO5VPktcE2VL9rxAQszJi4EMJUnjAG8wmMxU+mO/Xh0m3y/89NtYHyGqN6XJUdi\nDvzz/Vf6PvJ6aiSVGDYfZA7S+BYuEWctGRyHaT6lHdXa/GFt6SXIhi02WYIWPTQb\nSIUhIPvqqceqZ+8v4A58uD7fwiqvwMMgVosheOsEPa7EvkVjSx0I4JIXZacbMzCS\njsXksGhOEmazbXgxdk2HldPthZu7AJxGyxrIJ4+rRNGBDjrBhbUw3FNiX6/IMBg0\nRWSBYpsdrOd/7CteySl+dWeC3cD3FZyVOiAqCZ2rHP/MFImMlFOrcjOsEcI/S65O\nVazx5S8zH8XLN2DvYMXO8MdXD16TI3YszxwTFSJNDV7KgajnCth2KCbV6+oq+zAi\ndEhoiw95nOu1rClykDTqS36ieb7gK6OftuB+4TbrpRcOsTR2Hp4W4nuSAlntK+Ay\nIBo2sqMja602DzDrqX4CX5VZTGHpCWG8Yupxfrs4QFsGhwjUc79dLE8Q8Mo81CuW\nsznm6XhbrwMgB7dJZJjYFUyJZlKad2LsDmFab8Ls8Nb+6AczaVxRr+Mqos5LeC3K\nLqGzK9nRV8wA2YoRcLgm/JaUYx/polYFRUyf/29IFf3pZ1RkqcGt0zGSw5oW+CN2\nFmczMaRA4ZCIXvLfaZPIFBneYnFnlQxy3/yGesN2CF0s3foef8VA7Fgcl+40/gsE\n/m0kIm8pKSyoy7qTDTyR\n-----END ENCRYPTED PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\nMIIFejCCA2KgAwIBAgIRAKggF2Z/DQEutFRCjdwQUfswDQYJKoZIhvcNAQELBQAw\ngYIxCzAJBgNVBAYTAkRFMRUwEwYDVQQIDAxMb3dlciBTYXhvbnkxHzAdBgNVBAoM\nFkRLRS1EYXRhIEdtYkggJiBDby4gS0cxEzARBgNVBAcMCk9zbmFicnVlY2sxJjAk\nBgNVBAMMHWFncmlyb3V0ZXIgU0FQIElvVCBJc3N1aW5nIENBMB4XDTIzMDgyMjE0\nMDk0M1oXDTMzMDgxOTE1MDk0M1owgaExCzAJBgNVBAYTAkRFMR8wHQYDVQQKDBZE\nS0UtRGF0YSBHbWJIICYgQ28uIEtHMXEwbwYDVQQDDGhkZXZpY2VBbHRlcm5hdGVJ\nZDo0OTY1ZGU5OS05NDE3LTQwNDUtYTI3YS0zZTUyMTE3NmMxZDN8Z2F0ZXdheUlk\nOjJ8dGVuYW50SWQ6MTkwMjAwMTc4NXxpbnN0YW5jZUlkOmRrZS1xYTCCASIwDQYJ\nKoZIhvcNAQEBBQADggEPADCCAQoCggEBAIcj3UOpGd4Wjm3gobLZRNL16QRr9Qz3\nlAdB/WxiYTVPKsxlTmMUDvv0zyX1ehQgXObev+Gl7ZKfqOYSuRaJGRYZ45zD7jVN\nVQbrbXd9PA3uJWX1H/X/Ph4uhmuJqLX0tN8+cMUm07IIlTtXUGGA0ED9B2N8nQYl\nVgaTP485B6JwPGtkCo59dAtWX3o+WqEZ2kIkWFKRYETDsSDlBeOqQIQKOgJ2KGB0\nNWS+/dew6wKo3c2fFLm7FdYavWgdzg99Bzqc+hjEZFUYaHZdRJebrx1mbjkKSzu2\nAh6TJxhBOY2c3Mnfq2yQ0ODQ1yN0P0v3ierduiIEa+1gkvoEgJlonX8CAwEAAaOB\nyTCBxjAJBgNVHRMEAjAAMB8GA1UdIwQYMBaAFL0j/JLMFeGQZftrXKoTPyUIMWT2\nMB0GA1UdDgQWBBQ9Rr2t1RFYdormq88WYoXW9JjhoTAOBgNVHQ8BAf8EBAMCBaAw\nHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMEoGCCsGAQUFBwEBBD4wPDA6\nBggrBgEFBQcwAYYuaHR0cDovL29jc3AuYWNtLXBjYS5ldS1jZW50cmFsLTEuYW1h\nem9uYXdzLmNvbTANBgkqhkiG9w0BAQsFAAOCAgEAj31uapPjtYY4JR+ziXAQk5EU\nB9hqGQLj09xFLb0toqy+oEfpfZKZjsOB8qFO8fY0Yxa+9ehOhx793S13IY3tUFSK\n9r2m4yXpTDW6Y1upiO3K2BkTC9pLCd9KsMTnzoLpi/TOa2LqrR//VmvexlXYXBLr\n3VplMXrzRecTdCEnYxtcGBMWPu63ccVicYqXhd0MvP2QWETTRBc3d3s+oZQIIq6B\nt9lyiywjemo/CzRNqXugL3yXrJh/jkWVqmphHJhd3sHbi5Z2XtZB7T06Dd7UBh0J\nxWMhRJOVaitPuwIXT2IIfVg3qxSVbL8XzQoqUmCHYuqiXIYy3nnmBl6aaU5RejQc\nQPaIHTHZXICT30W95tB7TvgVYWWow6t3L+p3zNVhJP48KHYzSPTeKt7NRJKdaGqZ\nVncOpMEaearxshesIWm0qYDnufc6pokkRhZLWKogBkWI+/LeYbpk0rOZfXkrXa5a\nGl4sw/C8Exq5a0QfGA1KXYuFXDCmRhpAK/tHFBm00l8y0w/4fn6GG+TCUX9+rC+g\nh1qGsCFjIqpVb5TzTA5poYJzEkRhToQb8o7ombKXwOwxRlf/xUCpUr31uvmrmHLV\nv/b+2bEXqUkAKL5OuPo1FOOUgY/Ur+Y7qzhvvqlXyAFNFlGk//kErdquz1yDSbQG\nd+FlWb5vJbHcO9kwtkE=\n-----END CERTIFICATE-----\n" + } +} \ No newline at end of file diff --git a/tests/data/onboarding_responses/Mqtt/CommunicationUnit/PEM/Recipient.json b/tests/data/onboarding_responses/Mqtt/CommunicationUnit/PEM/Recipient.json new file mode 100644 index 00000000..d09706c4 --- /dev/null +++ b/tests/data/onboarding_responses/Mqtt/CommunicationUnit/PEM/Recipient.json @@ -0,0 +1,18 @@ +{ + "deviceAlternateId": "d184fdb2-c1e9-4dfc-b5e5-aae7c7aec169", + "capabilityAlternateId": "3035ec70-dca1-4d71-a000-e79eb5891f81", + "sensorAlternateId": "ed663b6f-ce1d-4b56-a4b9-e630b90f821e", + "connectionCriteria": { + "gatewayId": "2", + "measures": "measures/d184fdb2-c1e9-4dfc-b5e5-aae7c7aec169", + "commands": "commands/d184fdb2-c1e9-4dfc-b5e5-aae7c7aec169", + "host": "dke-qa.eu10.cp.iot.sap", + "port": 8883, + "clientId": "d184fdb2-c1e9-4dfc-b5e5-aae7c7aec169" + }, + "authentication": { + "type": "PEM", + "secret": "s5Ev?n5RFI#nSbVLitb?f1YGE?pm6?jk5Kli", + "certificate": "-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE6zAdBgoqhkiG9w0BDAEDMA8ECMlHTe5Qj2CqAgMCAAAEggTIJT9Xge3nayT8\n/95YEE8QYmErjOuKbbkLr9TA/oogE/6FQzy1AsH3gXVJi009VuvWxMCI/NE4u40s\n7IeNtSgU7BsV+ZIUCVzl9HgI1N6W9aAOCiDoYxnRg9urI/BTUhh3ls77O0/KH/7T\nHcNzMh93JpQnSxUyryTCmEurYpjXgd+MKU9u9iTP6ykbkVMs7qReTHjjaFss4FR7\n3K3WADoKq2JEisYZFBYqtrP8/fe51TfmIcY6QZ+lXWza/p+fP/ReYzo7C2IklX2I\n6sbDzaTzPzf5jS16xZ7LL5ha5jez65twBLXpW0fqyKwDxBkLXnSJ6aLXSTi8cTuL\nR6JDFsFnI/gBE7MjSrViKWRKhyHgt66wqiq0CUTuegxwdAQYVwli64dqL/wyuuqQ\nlM2HDDLPrVzkN6dWa62tSM68uygCl+Duk34DI0nAXi9b7nzh+rfVNI/w+yBfTdWN\nVQB0H270YI7yTHoKktRQ2fvHp9BHua1K2CmwZivsVk/z6V5O8OQ9MTAG0Tebkwm6\nu5cuLLFCvK0g0k6H6Idv4LVmMbnUUzxDli9Hseamp6JxmjoptQAaOCJSLXvbTjrl\nbTi/4fL03/vE6vxiGODZTxfOl/Xqr16Ec3yUtBHM4Jg4aNrfO6x8EQoWqMCoDcZ9\nmynbX4yl8d6nXYHR+HJNqI+ZXka/N4no/fEZ8n+zmuaiDukjPM6YCE4JdM6tIIa/\ngre2IQ/i4CV2NlS87BFqpbld5ZScS2gr26mRbXjdpbnoupTW31w+xwE8mEVZYnHy\n/a+7XTKMQOK4YZek1gKPO4fYBzWdAJhv+e9gObZYIFtrTNJuyQjU9e7rPXkqtqRT\nns55VjgWKb6LC7lLvc7tcwkoROT1Yl/SZn2tDOOkON3vPwjRTl8xpVwNP0nbllv1\nT6B4J3msbfiFzBT3G1Ri1HUNE0Wt1faAiuyrAcQ49oFeHeh9vyAJDNom6JD783on\nZp0AKQ68Rpl8KXszZeSFrZrbR/cQT3snx3qr5yTp8b0RYn6Sq02zrEJki+AQrMHe\nrrRgagkLnyrZZGXfdnDbBvLv6gd18pn6CUWb9BzUjEvgYiq7ORGcSp6Qi7yKn0ru\nXZlX5S0W7VCX5vYDeWikVhL7CxI3GcqmTrQJlvUNn1728H+6rcmhmyCqENub4REC\nyl4FtX4lvN7ScBpOzWExD1Xz2uMmklJVWYno/PSWdAcfRrmD88f0oLAfVLcq0Ndc\nFcBIN9HZjbNa/fGOtPBr8UMbQc7w2LI+WP5+6JvCcUY4iha9MNx3nMMzc9LTzc6R\nqNscOw+1Mye9xPjaHlr4hxG1VfctFuKzhEXt2skjl4Ay2j47vLk1X1Fk9Ns5Qus8\nV/cUwc2VZtRByPEACZ8lerZUv3uSi9bbQ36oM70kw7zGOZeMMARZgFvbcSg2QBGJ\nNK4011kG1ifUXY6h/euMAL5ijm9Ts8XhehJ1VvTpowW//a4bwxbSO4/DcfD9AVGz\nCS+dWnDuUd1H6xpdJu1uu0cAmcpfRwxg2Pf5a58PgBJT8No4oWQSq93x/s+J4M3H\nAwSquKBPPxfGwPsKIX2CdBj++9WCSRtLxq2EcoFpobsup2plAT9hr2dCkvAFBgIA\nOw71hneKk78j1YACY7Pk\n-----END ENCRYPTED PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\nMIIFeTCCA2GgAwIBAgIQKPmp/nBbNkE9ayVwwW+dbzANBgkqhkiG9w0BAQsFADCB\ngjELMAkGA1UEBhMCREUxFTATBgNVBAgMDExvd2VyIFNheG9ueTEfMB0GA1UECgwW\nREtFLURhdGEgR21iSCAmIENvLiBLRzETMBEGA1UEBwwKT3NuYWJydWVjazEmMCQG\nA1UEAwwdYWdyaXJvdXRlciBTQVAgSW9UIElzc3VpbmcgQ0EwHhcNMjMwODIyMTMz\nNzI1WhcNMzMwODE5MTQzNzI1WjCBoTELMAkGA1UEBhMCREUxHzAdBgNVBAoMFkRL\nRS1EYXRhIEdtYkggJiBDby4gS0cxcTBvBgNVBAMMaGRldmljZUFsdGVybmF0ZUlk\nOmQxODRmZGIyLWMxZTktNGRmYy1iNWU1LWFhZTdjN2FlYzE2OXxnYXRld2F5SWQ6\nMnx0ZW5hbnRJZDoxOTAyMDAxNzg1fGluc3RhbmNlSWQ6ZGtlLXFhMIIBIjANBgkq\nhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9uG8Sxlh+hRAEA996qdTCh05V5z9Pyw8\nc0+d0pu5WelQdOBhu4zBngckFGxfU8jrcTywrH+O1Hf3xND6aKuRHP6Y8okQ0whn\n09QlME8PoT90YYB42nDQKBX9lJICFf8nSgkkAhskXL0o/zSc6zXJG6DEEcMeY4jy\nBqMseowBVKZrkMXnRrIyxi/IDX4G7Gkxc6PyspnPDz1Gjlyma4KQ+w2Ep2/I8V/Q\n58971LyNtqvDxlu65CVN3QGRkCr5eb6YU7b3q9tnQ4sKT+sKyoYunnQaXm/IaB+2\nWsDkYWP0uVYKk4Ws+iB8Ypz/sKOSFsCTvTfado1tDj4PvpggrxpnmQIDAQABo4HJ\nMIHGMAkGA1UdEwQCMAAwHwYDVR0jBBgwFoAUvSP8kswV4ZBl+2tcqhM/JQgxZPYw\nHQYDVR0OBBYEFKhEDHt6Iy5eyxoQtFsxJs8EOvadMA4GA1UdDwEB/wQEAwIFoDAd\nBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwSgYIKwYBBQUHAQEEPjA8MDoG\nCCsGAQUFBzABhi5odHRwOi8vb2NzcC5hY20tcGNhLmV1LWNlbnRyYWwtMS5hbWF6\nb25hd3MuY29tMA0GCSqGSIb3DQEBCwUAA4ICAQBZGblQ34miRpn0SHnhF+TKjZai\nfYl+mWsHEsdW+oE+V6LUgBgCAwbFoAE6nyHUalqjiX8mbzN7KvWF7tv6x83/Baf5\nsfJ6YIRejj/E3FeBHmlg4jf70N7TIDwbmFmtdaUTOeFFVyEa35poFpOslU/qc7HO\nAyce+cW2djZ7UAJ2O4whPp6GCEj8hk2GU/wnV8hDExCi0iDZmwFskRjRmsvxdvQ+\nE3ujvIFZfzNMSTrcn3ihQitJ84RwSC3XJOPxnP6veVCx9bJ4pT0e0GaXRxfTednO\nkfVhxTV8KtVg2VYLtW+STbdWgolZEq2X0NeTieuw1j3nw1t1vq+waLvrYdG6ETNv\nZH9HVwD1lmH2l6zFhApdE5x/Ps6HBdpVGoGfa3LYgaOEpg6p0hCxqo2yFxn2ghHb\n/2Bmfjct2W1YzpR4baxki1jrLbPLhmhjjm1zqY8yW77qnCt+ns5OcGvvhZx3+Gd6\naKR/HgKw5da/ZveULDgeWUyvu34AUrNe5qosnlbqq6ZT4+JZw78MJ8BGI4O0zyvH\nAr2LGXdEKewNGjRiSs02YJanFm5k4Mq3fw3yI308nhvdoigpP0DFINAXRCN0I+Ed\n5NmO9L1h1ZOA5bXNCjxJENytTNwKiZYh4zXspZ63qJefs6URmMMScLMzZWCzs/i+\nhcraKclGL1v1D634Bg==\n-----END CERTIFICATE-----\n" + } +} \ No newline at end of file diff --git a/tests/data/onboarding_responses/Mqtt/CommunicationUnit/PEM/Sender.json b/tests/data/onboarding_responses/Mqtt/CommunicationUnit/PEM/Sender.json new file mode 100644 index 00000000..8f123b0c --- /dev/null +++ b/tests/data/onboarding_responses/Mqtt/CommunicationUnit/PEM/Sender.json @@ -0,0 +1,18 @@ +{ + "deviceAlternateId": "e9e8d4ef-6ec4-4a93-9d31-2b5542e7192c", + "capabilityAlternateId": "3035ec70-dca1-4d71-a000-e79eb5891f81", + "sensorAlternateId": "f86cc9a5-6b2b-45b9-a693-696e61d87889", + "connectionCriteria": { + "gatewayId": "2", + "measures": "measures/e9e8d4ef-6ec4-4a93-9d31-2b5542e7192c", + "commands": "commands/e9e8d4ef-6ec4-4a93-9d31-2b5542e7192c", + "host": "dke-qa.eu10.cp.iot.sap", + "port": 8883, + "clientId": "e9e8d4ef-6ec4-4a93-9d31-2b5542e7192c" + }, + "authentication": { + "type": "PEM", + "secret": "Jd#88ErkQB!!wAJjxDKs8XtYg4GcR5N0ZS2W", + "certificate": "-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE6zAdBgoqhkiG9w0BDAEDMA8ECFYISHDTzmpYAgMCAAAEggTIEdtQyR6/eFVR\nfkQGHCvbhAq12bkzWhaMm8yLTo1TqjTfD5uez+mVTU5tjYqc26jfa08uh7r5D+w3\nnEEQGmlYmNBZ29IZlMPGzS4ipvAKivb9yjl2jza4BDofs9aWoi4IyZYPEXIRxgpS\nR1Efgzw9fTTQOk9+jWgprtYHDMs05vB3R987e1BqK31w49ZLqcy7eQUy4z6lg+WT\n49isdeGy0u3HAi0QVZVGDRCMEmSvzma56ftvuKiYtCBBnOb409BVfFnw4Sdci/mq\nJKHTWGF3bcPnxo2fQWatMevRjyCSK006QQID0I55JHeR33JChFl8i+UvGr2h/3gR\n84CG3ahkkJbTQJyRewF9dGEZWM8pqtSSWM7CVlnKZny5yNSj+ffkK9Gj2ZaVTTZ5\nupxnQM5u/+H5C6Zq3ChNprYc2c3HKBLeNMLyfst3ESLSldbPmqnNdlFVVQyAzRF5\nwTStMYHURr0xVQhF2PlClSyDQBfAP/pK3BmqHgQLF7bXfC/d3W3JWuTK7Wj3C8we\niJkXgdIeHecRcesZ674lM6fdfj93cLN4uaUqkeq3xHf0ZW1/XvSWQm54eIjUVnCN\nqSAdbdqi6bZl6DHUxUxqiLJ4KFqcjAsWeakbroVb4XxBI65/2QSNNKTeuPaFYxZf\n76eEVFi2ZhAL1I1z38uHNI0pVKrovI9XzobLt9EXFEA8yNZXU0mIcAkHbM/4LQPI\nyB3yY/Y6qFZal3QT84Pmg51c+2oN2iqx4EPBdCg8SzOiIXQVTMLe85LE9ytOg7uk\nuM2eETcSiyJaNKlNns1PbpjO3r3g/Q/VLbHVDa75nTWoSGdSFBeckaZUcVfpAQt3\no2fjrwIk/4z9YLhvNZpwML4QI4sCtYGW08c0tQO0o7Q4/xy9unZhgsqUDrWcoek6\nHNpf6exDquWnA9FT8faaqFzrw37EZoTAPVtBAZ9keE8bxLMUMnGBwbttSP4vG54n\nndB+gN1kHkhplYkDO0UVqiVBSyIo5TQcTD8PxuX9W7LChL4jFsHZ6XLwM10iP9ts\nQyOUcVyEpgOm6FmaF/FpEmonD6IVsRJVLFfytQY2YVydAm7e5nAYddeXDr07vckc\nFrAd9cX27TDxQFRtpPgwcUMVDn3xxChuk6T+WbFXaxMvpk3XXJIV96/3HnkMlyws\n+HRAFGh5CueR9l/MHlSpjJGWml1yl/yJiF4tUpVWgyiQtpeHgYw9jU46gvMbD7yn\n3gWgihKc+IJtF3Z3iAb5MtTnQxMVXVqUG9Y/e76DV3SImee1cQpGozkKTJBj1U6r\nbebVEOk4aB4s7+EuSbE3Vp+ixDp+JpCcfBwuolzMPp26Ksh0j09z0hz6LMKp1GvS\nnBFDO0zfnuWW1Rj9tdl0hNKTTBnNzzYxTf7v06IN9wTcr6Wu9HZf7axzhBWdFq2w\nPsIYrkxBvZmBtJTSrkVZjXyIzmtNnFqM/ZE93p7xRFoJXwF7rWIxLqv0z9PgUMXj\nfJPIPUK/J+i3Qmmx1QOS2+tgaxM+DujmW6ajb5zaaabUoq2hoHe2QeabpkdXxdfX\nEaBkzD2l2QHmYUkm+3KB+ZSdLZC4clGSrnFzaJZZPZgRAbudHtivApB4icwM/Usp\nPynQ8jjAm8TgoBSfpIe0\n-----END ENCRYPTED PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\nMIIFejCCA2KgAwIBAgIRAIm0pKD7gyTIdz6dyYVT8ogwDQYJKoZIhvcNAQELBQAw\ngYIxCzAJBgNVBAYTAkRFMRUwEwYDVQQIDAxMb3dlciBTYXhvbnkxHzAdBgNVBAoM\nFkRLRS1EYXRhIEdtYkggJiBDby4gS0cxEzARBgNVBAcMCk9zbmFicnVlY2sxJjAk\nBgNVBAMMHWFncmlyb3V0ZXIgU0FQIElvVCBJc3N1aW5nIENBMB4XDTIzMDgyMjEz\nMzgxOVoXDTMzMDgxOTE0MzgxOVowgaExCzAJBgNVBAYTAkRFMR8wHQYDVQQKDBZE\nS0UtRGF0YSBHbWJIICYgQ28uIEtHMXEwbwYDVQQDDGhkZXZpY2VBbHRlcm5hdGVJ\nZDplOWU4ZDRlZi02ZWM0LTRhOTMtOWQzMS0yYjU1NDJlNzE5MmN8Z2F0ZXdheUlk\nOjJ8dGVuYW50SWQ6MTkwMjAwMTc4NXxpbnN0YW5jZUlkOmRrZS1xYTCCASIwDQYJ\nKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI+T0edAYBYhDuHOb1Hs2rG2kD84IWCZ\n1MVwZCXGAic5kBspAw1o4WLBOgQ2eyh7cRSzQO1nvNlqfqhqieFdDjo/dcyB9ycl\nRVMxsbgt4IHJtE4VAc0M66uF9dB0eu/MwrOlerGmIen3vN2WwK3mgN9V9Y1qf03o\nyY0tR/qxnni6174Rew1+0xOLliLcVd9y/KEY6txWvwdxqqLfLAd46qWiktcxaJzI\nrVcXkrFtQ1TmJco/3DAsI6L6JcExXPwBNOkuG/UP5CjwrpfF+bW06EPTHuuK788+\nB8VrlXep3zaU1zmgwqzx0tirEqzTYs849xRc1WcLOkGBHrVDTpUTmDMCAwEAAaOB\nyTCBxjAJBgNVHRMEAjAAMB8GA1UdIwQYMBaAFL0j/JLMFeGQZftrXKoTPyUIMWT2\nMB0GA1UdDgQWBBTTmtT+LxsndB6Q3EN1phiFSf3VUjAOBgNVHQ8BAf8EBAMCBaAw\nHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMEoGCCsGAQUFBwEBBD4wPDA6\nBggrBgEFBQcwAYYuaHR0cDovL29jc3AuYWNtLXBjYS5ldS1jZW50cmFsLTEuYW1h\nem9uYXdzLmNvbTANBgkqhkiG9w0BAQsFAAOCAgEAL1t8m/8yArIDLMzkXzkfjzgc\nCFikKjvPA6QB8KaOp0sRP5pB0cEKq20CPCYc9meZ1CLA0WslKfFtUgIBmMXRiAxy\nFIVTa+d44OKK6ACF/X3cBNhpdlPcmObKInmYLcbUM6T1E92uKn8V7VLGoWERvD2P\nAmzihWd8xRCRG1bsH7Q/+v4Voq8jmryNPl1TOk/emZtV/ytjfzGvMOYG6AKopafT\nUA3sBSGQTjmqYKHgI0SzERNWA6pdDqAiZgRa3fZ559yUM5ZIexkZWYExZGn8hIPA\n58e4X0ZvMJpxGX7yiQ+QKP+KsxuJEOdT+m0jqrvhDVrCaKd9AAvdb2bpUS9Rmvaa\nAC8ZF9YeYjtJZTmhWhpYRynZzGJCTBHPmQXquq5hI8by0QAfWOZAD1/yhkfDLhEz\nwJaDrD2Z+92F1MsRLzWE3JwvqyAUIGa0Qp9l4ef157+Fagrt3Y3uceqLY1E5fC7/\nfxqlMymeOR7kQJ+OgiB3RQVcUxk59e5yNK4YR1P0vQFMAgNvRbmynpEzNs3VxhRt\ns8zsCDy0XGOKHz+w2e8YpM4etO962HYDyl9IgsV+wF8+1v0WQ22S/S/gpcl2vHS/\nvj7ftQx/SJhYXDqYj0webK5B4NvG35hiWQrvVP7OqBfH2rcvPuicybnzNhvtH2b7\nCtIPvAi2l28zEskLkU0=\n-----END CERTIFICATE-----\n" + } +} \ No newline at end of file diff --git a/tests/data/onboarding_responses/test.json b/tests/data/onboarding_responses/test.json new file mode 100644 index 00000000..c61778f6 --- /dev/null +++ b/tests/data/onboarding_responses/test.json @@ -0,0 +1,18 @@ +{ + "deviceAlternateId": "fecd7325-96a0-427b-8483-0009de237710", + "capabilityAlternateId": "3035ec70-dca1-4d71-a000-e79eb5891f81", + "sensorAlternateId": "99190fdb-17e8-4983-875b-2199e41b8b8c", + "connectionCriteria": { + "gatewayId": "3", + "measures": "https://dke-qa.eu10.cp.iot.sap/iot/gateway/rest/measures/fecd7325-96a0-427b-8483-0009de237710", + "commands": "https://dke-qa.eu10.cp.iot.sap/iot/gateway/rest/commands/fecd7325-96a0-427b-8483-0009de237710", + "host": null, + "port": null, + "clientId": null + }, + "authentication": { + "type": "P12", + "secret": "Q?#zQyVR8m6JnXy4uQTwafNIThhixp0VYttY", + "certificate": "MIACAQMwgAYJKoZIhvcNAQcBoIAkgASCBAAwgDCABgkqhkiG9w0BBwGggCSABIIEADCCBRowggUWBgsqhkiG9w0BDAoBAqCCBO4wggTqMBwGCiqGSIb3DQEMAQMwDgQI0E/pmuijbm4CAgfQBIIEyGj5o0d8ULF2WQArG6vu2M4fmwt8UVCgQaGci+pxXn1bzxeBqYUKnOVBxsLx3cGz19eUjNzqbmhR1X3ionWjpHMforP04M2BFi+ILX4lvMQaodwhJtPOOwTkBxiFCecXQ+QDCUluPiQZUXmVglTHYVKff6OzZDchfbaxOFtnk/T3NRUX5c8sTdQLcC8zJ5nzuClZXKGP0RfimUCbmL8OfJ3BAl+OcDijCqLH2oveciGzc6sdT84L3w/Usw0LDBk1wg8shyN0IImIue/OH1MgBxx3Lj0QioAjTr2YvXnBzAJ16fwjYUHUfcQEG0qg55QX8NuwE3F3v1ujUiPFD+HduCWdDksYOFCaHIGFSjvKR0qmnEQC+itGRUV6gJrOWFxieRHnNKXLan3jUC6GCkxPALbsmT/L/67JOw5AgF1MYHV/LJRAfqFaNG87rTo9TqbDNSxwzrFSu6MyQY4nvbIRBAmALFwT9/FBuAm86jYHR/Ylyb8I83KXx5mlihydkO6YSA1FXkS4tVQfkYcJKTiSixqlhxP1w9OXVbuY7pZKrQ79av1/WmqR/rLtLulnFC5+mihk2eJSO6MpArXa+IBn2r8CPC72dKbY2I1aoY1Dft/H5UQfJBQXJRTcD+3jmUCtN00zgAGbhQT1jzU8NxG5HUdG/sw68r3i+i30UoC7WwY+14lQ8jMUbYfUsoovcCXyRh8dyBgvvfE/DPF+3t2QzHaTGBlW9I1VWw0qArnUGO7iKcYIghBZqO2OAEhK+SLfSPjlORlCNIB8GJNpmYMjmGdXaeYou/12tiPGoYIu5kw9/msV48H1yOe6eHof4BqMHHQo3NtIb4hWBN3QfE86FEMd0dkFG7EmD11OjXs9TdQy5Jc8PrdSKmbFvO/+IcJnG7sXS109XLExXA6ibG0OvpEVMBPm8hi/2SPHhroiI2+RRsi78lArBFzpTbrNYpYr4fntO14U+LcXijYrW2eSzYEt/eol33R025XgTNqsqqAcO07wAO7ikORPOeKBFy0NAlE8Zs90JgJg9e+nkCXVd0glFJcU+WHz3ZS9D8QQp8+mrqg2zR1TsuS95JJ2sEIRcxCojcO/2QEWKPOs36NUTNYSP23/J31SsdBc7i7l49cEALcwcy/QYInaD08ZScSctm/JoZ3+WicfjCszHOAdPUMdjJVjnY07pxmtUGBX2YiM7sHcEjNHD2VFZtyujommiAc+NpaUvy4+hgH7BfqAJMgVPCgRJHwfiGPtBIIEAKKF0z3ge4Rh3JDyc6yM24edgZQ7fojbBIIBHsXFady7tQRGkbCl6uFQYIeiEspPxm4Vi2TSdlrZ+G/AnkDapEVgImYP91AhU6XBGrPyMzGbSTIguKceaXwLjwX/co3fekah/ryrfp6A8uz2sUlsOEXYjhI2193moxuNA7hnasu7A/N7AND5SZV9j5AyQPzEdE4UZsWkWtEe+6DbDQ8jcNW6lwpc9ggBJ42p6jjH/vM6LQiT40RfRJJ+BTyyH/v4kIrMmHPsHFUDCpanXNfAGJAb6929uN8Lcbu9I7ohjekugHHbr7METH/12lWUEtrJRgn3xokEdJ+htLj2NA5cMO3bhjyqiZAdpjg/xe07lZZ5fp724KLiw1Sio3w5yP6t4A0tMRUwEwYJKoZIhvcNAQkVMQYEBAEAAAAAAAAAAAAwgAYJKoZIhvcNAQcGoIAwgAIBADCABgkqhkiG9w0BBwEwHAYKKoZIhvcNAQwBBjAOBAgGeviTXUkQZAICB9CggASCBLhVIhT1xJXBE9a7vZ7uYtSGtHE/5Icrq+LoRXUzV9zgz82vHbey6NrqlbRKsahaf2xwzsdntszKNIN1ZDhfoj1MUFtgSriTPipYj1CafSeKEcn31ntj4wL+YZWbFsMvtcWvQH3j3paLvcavv5+a4LZAhtd46jbZJEP6e09QAR6R+xD7ppic4L5I8RudRiFOgctjgMm9XbsxFFN6ieiJR1tHyFn8Boqj2ZGUZ/ixgZj78BrRcbw+yc84fdxwy8QUfw9yPIJxfQTPGeeweiHpfMVhzDQQlI7ZD18PR+dnsnBSeOrZKo/fXQeyl8Ye+fPFYhL6gIjaVLySxdxzKXtDnnI32brmX0KVBuVKml9mzbirXuBgBut3XMpFpKJT0xq1CIJU4Os+Vwm1S7dridcIZ+2ivJKz7ylOkMO/wZaa0tzfsvgRconUK4Z9bfz5hgXPWt/f1JDh0CEMvvb8FPd4qens+qduSAa/DTM5h8ss1wJGoXCFlSB5x9K6uO9TYFIQtCX6DVxocsd3zXcmhbCxamgFrMuAmaaQf7QdZ63cLKFT76vNwrKH96KlwRAd8+xaUUFaLvvVPL62K9M2EJq9HpFlQuJcJPwWsg5WZE38pk+GGlIlq6uOIJ/ltwM4TSIXScIcWrV7WR1ZB3OaJwbPvnYi7wwB+uVCQP9mmdpQdGOA90xI7IiAk+HAm1sP8e9/j+14XBVUqvSyLIc7vPl0kx1L6y60UiT0nLVPOWbpQJ7fekxTEpBsO1h09PCoGiPFJ5l7fDwlu8jiiJRUOIWtgAQ1hTFKJq7kawnxYvriQP9bPk1tja7lxGNgvRQNTC45MYh4QrBF1k6PPlPPYCMEggJIiNX8e3H/nJDBVwJuXMkk+FLeM8gvzpsrOu4Lnh0Mhfe1dsfiXg2FAdH/1lVVvtiVe6toRKnUBYwY3BI0rsQEGNru6g7b68TnNKNpfvphnIF/puUFyHJ31nCiKlfL4BO4kD5boHEwp+4+Byo0rw7dNMjscw8TM51gS+epOa+3n0YeGVPE1FZm3KSEgWrsC8Yz8Bj9Zua1uZvz8SIJ4Ja0x3Ok7GYxlPtUxRSqxbYoJo0PP3AEvxXJk5/9ORTEXtSnXw/nYX5VuTKLQU8OTw7g6x2eR9Py1LVDJYZtoGtcKyqfmNhChtWmHXFTtSYRs8w1Yk8uC0QRbdPz0ULJrv7ex18RPQNvGjR/BrN78wTUtIxntYBgUpxdiF0k9DM+cPa41JQSCi1YL68AnvGsyWG5rhdQfp3zTSN4/FG98i0DJt4UxoPIr0WGA6LeNzLdCtlvH6nTxrU/VZMSOfl3exxUljzYIa9gsQN/ULk6Mxi3quv/+JRPfunQ4escyjMdjWoD2R5vxTmDz8GdkafEffOm9FeFhSp6sJTqCG/O2zW8/cbdPgZ/eU3Ts4hSyGpBgJaNH3o1a6EYPFs8jG3K2iFnbMOWInelbbzabs7Z+8Hmm2RTOClaevgrtf1uhPfTeriQLITpqYF/DUt6FkOnJi1pv7cu08TB98EemHihoJKQ4tGOcnkNRHX/tzbdfDyXd0AqF4OW55M38CuoSHzWnDtIKFP8OxyIbxcdi8yUBsNqwwIhwlo/3eDLkuJxk4UAAAAAAAAAAAAAAAAAAAAAAAAwMTAhMAkGBSsOAwIaBQAEFPExoADdh9jWiG1wi1vRKWLvqCOTBAi02kZ3On9oWwICB9AAAA==" + } +} \ No newline at end of file diff --git a/tests/fixtures/__init__.py b/tests/fixtures/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/fixtures/update_http_onboard_responses.py b/tests/fixtures/update_http_onboard_responses.py new file mode 100644 index 00000000..0ce2c0e9 --- /dev/null +++ b/tests/fixtures/update_http_onboard_responses.py @@ -0,0 +1,111 @@ +import logging +import unittest + +import pytest +from applications import CommunicationUnit +from onboard_response_integration_service import save_onboard_response + +from agrirouter import CapabilitiesService, CapabilitiesParameters +from agrirouter.api.environments import QA +from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification +from agrirouter.messaging.enums import CapabilityType, CapabilityDirectionType +from agrirouter.messaging.services.commons import HttpMessagingService +from agrirouter.messaging.services.http.fetch_message_service import FetchMessageService +from agrirouter.onboarding.enums import CertificateTypes, Gateways +from agrirouter.onboarding.response import OnboardResponse +from agrirouter.utils.uuid_util import new_uuid +from tests.common.onboarding import onboard_communication_unit +from tests.common.sleeper import Sleeper +from tests.data.identifier import Identifier + + +class OnboardResponseUpdate(unittest.TestCase): + _log = logging.getLogger(__name__) + _environment = QA() + + @pytest.mark.skip(reason="Will fail unless the registration code is changed") + def test_update_http_cu_recipient(self): + onboard_response = onboard_communication_unit( + uuid=Identifier.HTTP_RECIPIENT_PEM[Identifier.ID], + _environment=QA(), + registration_code="CHANGE_ME", + certification_type_definition=str(CertificateTypes.PEM.value), + gateway_id=str(Gateways.HTTP.value) + ) + save_onboard_response(Identifier.HTTP_RECIPIENT_PEM[Identifier.PATH], onboard_response) + self._validate_connection(onboard_response) + self._enable_all_capabilities_via_http(onboard_response) + + @pytest.mark.skip(reason="Will fail unless the registration code is changed") + def test_update_http_cu_sender(self): + onboard_response = onboard_communication_unit( + uuid=Identifier.HTTP_SENDER_PEM[Identifier.ID], + _environment=QA(), + registration_code="CHANGE_ME", + certification_type_definition=str(CertificateTypes.PEM.value), + gateway_id=str(Gateways.HTTP.value) + ) + save_onboard_response(Identifier.HTTP_SENDER_PEM[Identifier.PATH], onboard_response) + self._validate_connection(onboard_response) + self._enable_all_capabilities_via_http(onboard_response) + + @staticmethod + def _validate_connection(onboard_response: OnboardResponse): + fetch_message_service = FetchMessageService() + fetch = fetch_message_service.fetch(onboard_response).get_messages() + assert len(fetch) == 0 + + @staticmethod + def _enable_all_capabilities_via_http(onboard_response: OnboardResponse): + messaging_service = HttpMessagingService() + capabilities_service = CapabilitiesService(messaging_service) + capabilities_parameters = CapabilitiesParameters( + onboarding_response=onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=1, + application_id=CommunicationUnit.application_id, + certification_version_id=CommunicationUnit.certification_version_id, + enable_push_notification=CapabilitySpecification.PushNotification.DISABLED, + capability_parameters=[] + ) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.ISO_11783_TASK_DATA_ZIP.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.ISO_11783_DEVICE_DESCRIPTION.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.ISO_11783_TIMELOG.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.IMG_BMP.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.IMG_JPEG.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.IMG_PNG.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.SHP_SHAPE_ZIP.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.DOC_PDF.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.VID_AVI.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.VID_MP4.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.VID_WMV.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.GPS_INFO.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_service.send(capabilities_parameters) + Sleeper.process_the_command() + fetch_message_service = FetchMessageService() + fetch = fetch_message_service.fetch(onboard_response).get_messages() + assert len(fetch) == 1 diff --git a/tests/fixtures/update_mqtt_onboard_responses.py b/tests/fixtures/update_mqtt_onboard_responses.py new file mode 100644 index 00000000..66be0512 --- /dev/null +++ b/tests/fixtures/update_mqtt_onboard_responses.py @@ -0,0 +1,118 @@ +import pytest + +from agrirouter import CapabilitiesParameters, CapabilitiesService +from agrirouter.api.environments import QA +from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification +from agrirouter.messaging.decode import decode_response +from agrirouter.messaging.enums import CapabilityType, CapabilityDirectionType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.onboarding.enums import CertificateTypes, Gateways +from agrirouter.utils.uuid_util import new_uuid +from tests.common.onboarding import onboard_communication_unit +from tests.common.sleeper import Sleeper +from tests.data.applications import CommunicationUnit +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import save_onboard_response + + +class TestSingleMqttEndpointWithPEMCertificate: + + @pytest.mark.skip(reason="Will fail unless the registration code is changed") + def test_update_recipient_with_pem(self): + """ Test the onboarding process for a single MQTT endpoint with a PEM certificate. """ + onboard_response = onboard_communication_unit( + uuid=Identifier.MQTT_RECIPIENT_PEM[Identifier.ID], + _environment=QA(), + registration_code="e53438a6b3", + certification_type_definition=str(CertificateTypes.PEM.value), + gateway_id=str(Gateways.MQTT.value) + ) + save_onboard_response(Identifier.MQTT_RECIPIENT_PEM[Identifier.PATH], onboard_response) + + @pytest.mark.skip(reason="Will fail unless the registration code is changed") + def test_update_sender_with_pem(self): + """ Test the onboarding process for a single MQTT endpoint with a PEM certificate. """ + onboard_response = onboard_communication_unit( + uuid=Identifier.MQTT_SENDER_PEM[Identifier.ID], + _environment=QA(), + registration_code="7ac0514114", + certification_type_definition=str(CertificateTypes.PEM.value), + gateway_id=str(Gateways.MQTT.value) + ) + save_onboard_response(Identifier.MQTT_SENDER_PEM[Identifier.PATH], onboard_response) + + @pytest.mark.skip(reason="Will fail unless the registration code is changed") + def test_update_messages_sender_with_pem(self): + sender_onboard_response = onboard_communication_unit( + uuid=Identifier.MQTT_MESSAGES_SENDER[Identifier.ID], + _environment=QA(), + registration_code="26b37bc999", + certification_type_definition=str(CertificateTypes.PEM.value), + gateway_id=str(Gateways.MQTT.value) + ) + save_onboard_response(Identifier.MQTT_MESSAGES_SENDER[Identifier.PATH], sender_onboard_response) + self._enable_capabilities(onboard_response=sender_onboard_response, callback=self._on_message_callback) + + @pytest.mark.skip(reason="Will fail unless the registration code is changed") + def test_update_messages_recipient_with_pem(self): + recipient_onboard_response = onboard_communication_unit( + uuid=Identifier.MQTT_MESSAGES_RECIPIENT[Identifier.ID], + _environment=QA(), + registration_code="4f4bac3b04", + certification_type_definition=str(CertificateTypes.PEM.value), + gateway_id=str(Gateways.MQTT.value) + ) + save_onboard_response(Identifier.MQTT_MESSAGES_RECIPIENT[Identifier.PATH], + recipient_onboard_response) + self._enable_capabilities(onboard_response=recipient_onboard_response, + callback=self._on_message_callback) + + @staticmethod + def _enable_capabilities(onboard_response, callback): + """ + Method to enable capabilities via mqtt + """ + messaging_service = MqttMessagingService( + onboarding_response=onboard_response, + on_message_callback=callback) + current_sequence_number = SequenceNumberService.next_seq_nr( + onboard_response.get_sensor_alternate_id()) + capabilities_parameters = CapabilitiesParameters( + onboarding_response=onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + application_id=CommunicationUnit.application_id, + certification_version_id=CommunicationUnit.certification_version_id, + enable_push_notification=CapabilitySpecification.PushNotification.ENABLED, + capability_parameters=[] + ) + + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.IMG_PNG.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.IMG_BMP.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.ISO_11783_TASK_DATA_ZIP.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + + capabilities_service = CapabilitiesService(messaging_service) + capabilities_service.send(capabilities_parameters) + Sleeper.process_the_command() + + @staticmethod + def _on_message_callback(msg): + """ + Callback to handle the incoming messages from the MQTT broker + """ + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + while not decoded_message: + Sleeper.process_the_command() + assert decoded_message.response_envelope.response_code == 201 diff --git a/tests/internal/__init__.py b/tests/internal/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/internal/auth_test/__init__.py b/tests/internal/auth_test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/auth_test/test_auth.py b/tests/internal/auth_test/test_auth.py similarity index 75% rename from tests/auth_test/test_auth.py rename to tests/internal/auth_test/test_auth.py index 20a23d77..9cd04e39 100644 --- a/tests/auth_test/test_auth.py +++ b/tests/internal/auth_test/test_auth.py @@ -1,18 +1,19 @@ """Tests agrirouter/auth/auth.py""" from agrirouter import AuthUrlParameter +from agrirouter.api.enums import Environments from agrirouter.auth.auth import Authorization -from tests.constants import ( - public_key, - private_key, - auth_result_url, +from tests.common.constants import ( + PUBLIC_KEY, + PRIVATE_KEY, + AUTH_RESULT_URL, ENV ) class TestAuthorization: def test_extract_query_params(self): - auth_client = Authorization(ENV, public_key=public_key, private_key=private_key) + auth_client = Authorization(ENV, public_key=PUBLIC_KEY, private_key=PRIVATE_KEY) test_uri = "key1=val1&key2=val2&key3=val3" params = auth_client._extract_query_params(test_uri) assert params == {"key1": "val1", "key2": "val2", "key3": "val3"} @@ -24,7 +25,7 @@ def test_get_auth_request_url(self): assert auth_params.state auth_client = Authorization( - "QA", public_key=public_key, private_key=private_key + Environments.QA.value, public_key=PUBLIC_KEY, private_key=PRIVATE_KEY ) check_url = "https://agrirouter-qa.cfapps.eu10.hana.ondemand.com/application/" \ @@ -33,7 +34,7 @@ def test_get_auth_request_url(self): assert check_url == result_url.split("state")[0] def test_extract_auth_response(self): - auth_client = Authorization(ENV, public_key=public_key, private_key=private_key) + auth_client = Authorization(ENV, public_key=PUBLIC_KEY, private_key=PRIVATE_KEY) state = "3770a15d-adf3-4900-a435-464978fe8054" token = "token" signature = "signature" @@ -49,8 +50,8 @@ def test_extract_auth_response(self): def test_get_auth_result(self): auth_client = Authorization( - "QA", public_key=public_key, private_key=private_key + Environments.QA.value, public_key=PUBLIC_KEY, private_key=PRIVATE_KEY ) - auth_response = auth_client.extract_auth_response(auth_result_url) + auth_response = auth_client.extract_auth_response(AUTH_RESULT_URL) auth_client.verify_auth_response(auth_response) assert auth_response.get_auth_result().get_decoded_token() diff --git a/tests/auth_test/test_auth_dto.py b/tests/internal/auth_test/test_auth_dto.py similarity index 94% rename from tests/auth_test/test_auth_dto.py rename to tests/internal/auth_test/test_auth_dto.py index 9497abbd..deb1f5b7 100644 --- a/tests/auth_test/test_auth_dto.py +++ b/tests/internal/auth_test/test_auth_dto.py @@ -1,8 +1,9 @@ """Tests agrirouter/auth/dto.py""" -from agrirouter.auth.dto import AuthorizationToken -from agrirouter.messaging.exceptions import WrongFieldError import pytest +from agrirouter.auth.dto import AuthorizationToken +from agrirouter.api.exceptions import WrongField + class TestAuthorizationToken: def test_json_deserialize_from_valid_dict(self): @@ -51,7 +52,7 @@ def test_json_deserialize_from_invalid_dict(self): expires = "01-01-2021" test_object = AuthorizationToken() - with pytest.raises(WrongFieldError): + with pytest.raises(WrongField): test_object.json_deserialize({"regcode": regcode, "expires": expires, "wrong_key": account}) def test_json_deserialize_from_valid_json(self): @@ -72,5 +73,5 @@ def test_json_deserialize_from_invalid_json(self): json_data = '{"account": "account", "regcode": "regcode", "wrong_key": "01-01-2021"}' test_object = AuthorizationToken() - with pytest.raises(WrongFieldError): + with pytest.raises(WrongField): assert test_object.json_deserialize(json_data) diff --git a/tests/auth_test/test_response.py b/tests/internal/auth_test/test_response.py similarity index 82% rename from tests/auth_test/test_response.py rename to tests/internal/auth_test/test_response.py index 7ad631b0..cb315a79 100644 --- a/tests/auth_test/test_response.py +++ b/tests/internal/auth_test/test_response.py @@ -5,12 +5,11 @@ import pytest from agrirouter.auth.response import AuthResponse -from tests.constants import valid_response_signature, valid_response_token, AR_PUBLIC_KEY +from tests.common.constants import VALID_RESPONSE_SIGNATURE, VALID_RESPONSE_TOKEN, AR_PUBLIC_KEY def test_decode_token(): - - decoded_token = AuthResponse.decode_token(valid_response_token) + decoded_token = AuthResponse.decode_token(VALID_RESPONSE_TOKEN) assert re.search(r"[\w]", decoded_token.regcode) assert re.search(r"[\w]", decoded_token.account) assert decoded_token.expires @@ -18,8 +17,8 @@ def test_decode_token(): def test_verify(authorization): state = "46c81f94-d117-4658-9a38-a85692448219" - token = valid_response_token - signature = valid_response_signature + token = VALID_RESPONSE_TOKEN + signature = VALID_RESPONSE_SIGNATURE auth_response = AuthResponse({"state": state, "signature": signature, @@ -37,8 +36,8 @@ def test_verify(authorization): def test_get_auth_result(authorization): state = "46c81f94-d117-4658-9a38-a85692448219" - token = valid_response_token - signature = valid_response_signature + token = VALID_RESPONSE_TOKEN + signature = VALID_RESPONSE_SIGNATURE auth_response = AuthResponse({"state": state, "signature": signature, diff --git a/tests/internal/enviroments_test/__init__.py b/tests/internal/enviroments_test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/enviroments_test/test_environmental_services.py b/tests/internal/enviroments_test/test_environmental_services.py similarity index 57% rename from tests/enviroments_test/test_environmental_services.py rename to tests/internal/enviroments_test/test_environmental_services.py index 0f8ffeb4..d88a0d77 100644 --- a/tests/enviroments_test/test_environmental_services.py +++ b/tests/internal/enviroments_test/test_environmental_services.py @@ -1,13 +1,15 @@ """Test agrirouter/environments/environmental_services.py""" import pytest -from agrirouter.environments.exceptions import InvalidEnvironmentSetup + +from agrirouter.api.enums import Environments +from agrirouter.api.exceptions import InvalidEnvironmentSetup from agrirouter.environments.environmental_services import EnvironmentalService -from tests.constants import ENV +from tests.common.constants import ENV def test_arclient_set_env(): assert EnvironmentalService(ENV)._set_env(ENV) is None - assert EnvironmentalService("Production")._set_env("Production") is None + assert EnvironmentalService(env=Environments.PRODUCTION.value)._set_env(Environments.PRODUCTION.value) is None with pytest.raises(InvalidEnvironmentSetup): assert EnvironmentalService("WRONG")._set_env("WRONG") diff --git a/tests/enviroments_test/test_environments.py b/tests/internal/enviroments_test/test_environments.py similarity index 82% rename from tests/enviroments_test/test_environments.py rename to tests/internal/enviroments_test/test_environments.py index 36bbde81..9f043108 100644 --- a/tests/enviroments_test/test_environments.py +++ b/tests/internal/enviroments_test/test_environments.py @@ -1,8 +1,8 @@ """Test agrirouter/environments/environments.py""" -from agrirouter.environments.environments import ProductionEnvironment as PE -from agrirouter.environments.environments import QAEnvironment as QAE -from tests.constants import application_id +from agrirouter.api.environments import Production as PE +from agrirouter.api.environments import QA as QAE +from tests.common.constants import APPLICATION_ID class TestPE: @@ -32,16 +32,18 @@ def test_get_revoke_url(self): assert PE().get_revoke_url() == rev_url def test_get_agrirouter_login_url(self): - login_url = PE._ENV_BASE_URL + PE._AGRIROUTER_LOGIN_URL + login_url = PE._ENV_BASE_URL + PE._LOGIN_URL assert PE().get_agrirouter_login_url() == login_url def test_get_secured_onboarding_authorization_url(self): redirect_uri = "www.my_redirect.com" response_type = "response_type" assert PE().get_secured_onboarding_authorization_url( - application_id, response_type, "state", redirect_uri - ) == "https://goto.my-agrirouter.com/application/{application_id}/authorize?response_type={response_type}&state={state}".format( # noqa - application_id=application_id, + APPLICATION_ID, response_type, "state", redirect_uri + ) == ("https://goto.my-agrirouter.com/application/{application_id}/" + "authorize?response_type={response_type}&state={state}").format( + # noqa + application_id=APPLICATION_ID, response_type=response_type, state="state") + f"&redirect_uri={redirect_uri}" @@ -53,7 +55,7 @@ def test_get_mqtt_server_url(self): ) def test_get_env_public_key(self): - assert PE().get_env_public_key() == PE.AR_PUBLIC_KEY + assert PE().get_env_public_key() == PE._AR_PUBLIC_KEY class TestQAE: @@ -83,16 +85,16 @@ def test_get_revoke_url(self): assert QAE().get_revoke_url() == rev_url def test_get_agrirouter_login_url(self): - login_url = QAE._ENV_BASE_URL + QAE._AGRIROUTER_LOGIN_URL + login_url = QAE._ENV_BASE_URL + QAE._LOGIN_URL assert QAE().get_agrirouter_login_url() == login_url def test_get_secured_onboarding_authorization_url(self): redirect_uri = "www.my_redirect.com" response_type = "response_type" assert QAE().get_secured_onboarding_authorization_url( - application_id, response_type, "state", redirect_uri + APPLICATION_ID, response_type, "state", redirect_uri ) == QAE._ENV_BASE_URL + QAE._SECURED_ONBOARDING_AUTHORIZATION_LINK_TEMPLATE.format( - application_id=application_id, + application_id=APPLICATION_ID, response_type=response_type, state="state") + f"&redirect_uri={redirect_uri}" @@ -102,4 +104,4 @@ def test_get_mqtt_server_url(self): ) == QAE._MQTT_URL_TEMPLATE.format(host="localhost", port="5000") def test_get_env_public_key(self): - assert QAE().get_env_public_key() == QAE.AR_PUBLIC_KEY + assert QAE().get_env_public_key() == QAE._AR_PUBLIC_KEY diff --git a/tests/internal/messaging_test/__init__.py b/tests/internal/messaging_test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/messaging_test/test_decode.py b/tests/internal/messaging_test/test_decode.py similarity index 97% rename from tests/messaging_test/test_decode.py rename to tests/internal/messaging_test/test_decode.py index 5385e285..78a2ea0c 100644 --- a/tests/messaging_test/test_decode.py +++ b/tests/internal/messaging_test/test_decode.py @@ -1,11 +1,10 @@ import json from agrirouter.generated.messaging.response.response_pb2 import ResponseEnvelope -from agrirouter.messaging.decode import decode_response from agrirouter.messaging.decode import decode_details +from agrirouter.messaging.decode import decode_response - -MESSAGING_RESULT = b'[{"sensorAlternateId":"185cd97b-ed0b-4e75-a6e2-6be1cdd38a06","capabilityAlternateId":"bbe9f361-b551-48d9-9fca-1b4dc768287c","command":{"message":"XwjIARAKGiQ5NWUzNWE0Zi1jNWM4LTQ1NDEtODE4OS03NmJlMzM0OTc0NDUiJDUzNzYyM2ZjLWY2NmYtNDc5Yi1hMmJhLWVjZjNlNWM3ZjhlMCoMCNTV5YsGEICI8LIDzQIKygIKTnR5cGVzLmFncmlyb3V0ZXIuY29tL2Fncmlyb3V0ZXIucmVzcG9uc2UucGF5bG9hZC5hY2NvdW50Lkxpc3RFbmRwb2ludHNSZXNwb25zZRL3AQp4CiRkNzA0YTQ0My05OWY3LTQ3YjQtYmU1NS1lMmZhMDk2ODllYmUSJFB5dGhvblNES19kZXYgLSAyMDIxLTEwLTI1LCAxMDo1MToxOBoLYXBwbGljYXRpb24iBmFjdGl2ZTIVdXJuOm15YXBwOnNucjAwMDAzMjM0CnsKJDE4NWNkOTdiLWVkMGItNGU3NS1hNmUyLTZiZTFjZGQzOGEwNhIkUHl0aG9uU0RLX2RldiAtIDIwMjEtMTAtMjEsIDIxOjQxOjI0GgthcHBsaWNhdGlvbiIGYWN0aXZlMhh1cm46bXlhcHA6c25yMDAwMDMyMzRzZGY="}}]' # noqa +MESSAGING_RESULT = b'[{"sensorAlternateId":"185cd97b-ed0b-4e75-a6e2-6be1cdd38a06","capabilityAlternateId":"bbe9f361-b551-48d9-9fca-1b4dc768287c","command":{"message":"XwjIARAKGiQ5NWUzNWE0Zi1jNWM4LTQ1NDEtODE4OS03NmJlMzM0OTc0NDUiJDUzNzYyM2ZjLWY2NmYtNDc5Yi1hMmJhLWVjZjNlNWM3ZjhlMCoMCNTV5YsGEICI8LIDzQIKygIKTnR5cGVzLmFncmlyb3V0ZXIuY29tL2Fncmlyb3V0ZXIucmVzcG9uc2UucGF5bG9hZC5hY2NvdW50Lkxpc3RFbmRwb2ludHNSZXNwb25zZRL3AQp4CiRkNzA0YTQ0My05OWY3LTQ3YjQtYmU1NS1lMmZhMDk2ODllYmUSJFB5dGhvblNES19kZXYgLSAyMDIxLTEwLTI1LCAxMDo1MToxOBoLYXBwbGljYXRpb24iBmFjdGl2ZTIVdXJuOm15YXBwOnNucjAwMDAzMjM0CnsKJDE4NWNkOTdiLWVkMGItNGU3NS1hNmUyLTZiZTFjZGQzOGEwNhIkUHl0aG9uU0RLX2RldiAtIDIwMjEtMTAtMjEsIDIxOjQxOjI0GgthcHBsaWNhdGlvbiIGYWN0aXZlMhh1cm46bXlhcHA6c25yMDAwMDMyMzRzZGY="}}]' # noqa def test_decode_response(): @@ -16,8 +15,8 @@ def test_decode_response(): assert message.response_payload.details - assert message.response_payload.details.type_url == "types.agrirouter.com/agrirouter.response.payload.account.ListEndpointsResponse" # noqa - assert message.response_payload.details.value == b'\nx\n$d704a443-99f7-47b4-be55-e2fa09689ebe\x12$PythonSDK_dev - 2021-10-25, 10:51:18\x1a\x0bapplication"\x06active2\x15urn:myapp:snr00003234\n{\n$185cd97b-ed0b-4e75-a6e2-6be1cdd38a06\x12$PythonSDK_dev - 2021-10-21, 21:41:24\x1a\x0bapplication"\x06active2\x18urn:myapp:snr00003234sdf' # noqa + assert message.response_payload.details.type_url == "types.agrirouter.com/agrirouter.response.payload.account.ListEndpointsResponse" # noqa + assert message.response_payload.details.value == b'\nx\n$d704a443-99f7-47b4-be55-e2fa09689ebe\x12$PythonSDK_dev - 2021-10-25, 10:51:18\x1a\x0bapplication"\x06active2\x15urn:myapp:snr00003234\n{\n$185cd97b-ed0b-4e75-a6e2-6be1cdd38a06\x12$PythonSDK_dev - 2021-10-21, 21:41:24\x1a\x0bapplication"\x06active2\x18urn:myapp:snr00003234sdf' # noqa assert message.response_envelope.response_code == 200 assert message.response_envelope.type == ResponseEnvelope.ResponseBodyType.Value("ENDPOINTS_LISTING") diff --git a/tests/messaging_test/test_encode.py b/tests/internal/messaging_test/test_encode.py similarity index 100% rename from tests/messaging_test/test_encode.py rename to tests/internal/messaging_test/test_encode.py diff --git a/tests/messaging_test/test_request.py b/tests/internal/messaging_test/test_request.py similarity index 100% rename from tests/messaging_test/test_request.py rename to tests/internal/messaging_test/test_request.py diff --git a/tests/internal/onboarding_test/__init__.py b/tests/internal/onboarding_test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/internal/onboarding_test/test_headers.py b/tests/internal/onboarding_test/test_headers.py new file mode 100644 index 00000000..c4665ca5 --- /dev/null +++ b/tests/internal/onboarding_test/test_headers.py @@ -0,0 +1,14 @@ +"""Test agrirouter/onboarding/headers.py""" +from agrirouter.api.enums import ContentTypes +from agrirouter.onboarding.headers import SoftwareOnboardingHeader + + +class TestSoftwareOnboardingHeader: + reg_code = "1AC2cs21W" + test_object = SoftwareOnboardingHeader(reg_code=reg_code, application_id=1) + test_object_1 = SoftwareOnboardingHeader(reg_code=reg_code, application_id=1, content_type="json") + + def test_get_header(self): + assert (self.test_object.get_header()["Authorization"] == "Bearer " + self.reg_code) + assert (self.test_object.get_header()["Content-Type"] == ContentTypes.APPLICATION_JSON.value) + assert self.test_object_1.get_header()["Content-Type"] == "json" diff --git a/tests/internal/onboarding_test/test_onboarding.py b/tests/internal/onboarding_test/test_onboarding.py new file mode 100644 index 00000000..a00e9db9 --- /dev/null +++ b/tests/internal/onboarding_test/test_onboarding.py @@ -0,0 +1,59 @@ +"""Test agrirouter/onboarding/onboarding.py""" + +import pytest + +from agrirouter.api.exceptions import WrongCertificationType, WrongGateWayType +from agrirouter.onboarding.enums import Gateways, CertificateTypes +from agrirouter.onboarding.onboarding import SecuredOnboardingService +from agrirouter.onboarding.parameters import OnboardParameters +from tests.common.constants import PUBLIC_KEY, PRIVATE_KEY, ENV, APPLICATION_ID + + +class TestSoftwareOnboarding: + def test__create_request(self): + params = OnboardParameters( + id_=1, + application_id=APPLICATION_ID, + certification_version_id="13", + gateway_id=Gateways.MQTT.value, + certificate_type=CertificateTypes.PEM.value, + utc_timestamp="+03:00", + time_zone="01-01-2021", + reg_code="8eloz190fd", + ) + service = SecuredOnboardingService( + env=ENV, public_key=PUBLIC_KEY, private_key=PRIVATE_KEY + ) + assert service._create_request(params) + + params = OnboardParameters( + id_=2, + application_id=APPLICATION_ID, + certification_version_id="13", + gateway_id=Gateways.MQTT.value, + certificate_type="wrong_certificate", + utc_timestamp="+03:00", + time_zone="01-01-2021", + reg_code="8eloz190fd", + ) + service = SecuredOnboardingService( + env=ENV, public_key=PUBLIC_KEY, private_key=PRIVATE_KEY + ) + with pytest.raises(WrongCertificationType): + assert service._create_request(params) + + params = OnboardParameters( + id_=3, + application_id=APPLICATION_ID, + certification_version_id="13", + gateway_id="wrong_gateway_id", + certificate_type=CertificateTypes.PEM.value, + utc_timestamp="+03:00", + time_zone="01-01-2021", + reg_code="8eloz190fd", + ) + service = SecuredOnboardingService( + env=ENV, public_key=PUBLIC_KEY, private_key=PRIVATE_KEY + ) + with pytest.raises(WrongGateWayType): + assert service._create_request(params) diff --git a/tests/onboarding_test/test_onboarding_dto.py b/tests/internal/onboarding_test/test_onboarding_dto.py similarity index 96% rename from tests/onboarding_test/test_onboarding_dto.py rename to tests/internal/onboarding_test/test_onboarding_dto.py index 2ddbdb74..ea725896 100644 --- a/tests/onboarding_test/test_onboarding_dto.py +++ b/tests/internal/onboarding_test/test_onboarding_dto.py @@ -1,8 +1,9 @@ """Tests agrirouter/onboarding/dto.py""" -from agrirouter.onboarding.dto import ConnectionCriteria, Authentication, ErrorResponse -from agrirouter.messaging.exceptions import WrongFieldError import pytest +from agrirouter.api.exceptions import WrongField +from agrirouter.onboarding.dto import ConnectionCriteria, Authentication, ErrorResponse + class TestConnectionCriteria: @@ -31,7 +32,7 @@ def test_json_deserialize_from_valid_dict(self): def test_json_deserialize_from_invalid_dict(self): test_object = ConnectionCriteria() - with pytest.raises(WrongFieldError): + with pytest.raises(WrongField): test_object.json_deserialize({"clientId": "1", "commands": "commands", "wrong_key": "localhost"}) def test_json_deserialize_from_valid_json(self): @@ -59,7 +60,7 @@ def test_json_deserialize_from_invalid_json(self): json_data = '{"client_id": "1", "commands": "commands", "wrong_key": "localhost"}' test_object = ConnectionCriteria() - with pytest.raises(WrongFieldError): + with pytest.raises(WrongField): assert test_object.json_deserialize(json_data) def test_json_serialize(self): @@ -126,7 +127,7 @@ def test_json_deserialize(self): assert test_object_2.secret == secret assert test_object_2.certificate is None - with pytest.raises(WrongFieldError): + with pytest.raises(WrongField): assert test_object_2.json_deserialize({"wrong_key": certificate}) def test_json_deserialize_from_valid_dict(self): @@ -169,7 +170,7 @@ def test_json_deserialize_from_valid_dict(self): def test_json_deserialize_from_invalid_dict(self): test_object = Authentication() - with pytest.raises(WrongFieldError): + with pytest.raises(WrongField): test_object.json_deserialize({"type": "type", "secret": "secret", "wrong_key": "certificate"}) def test_json_deserialize_from_valid_json(self): @@ -191,7 +192,7 @@ def test_json_deserialize_from_invalid_json(self): json_data = '{"type": "type", "secret": "secret", "wrong_key": "certificate"}' test_object = ConnectionCriteria() - with pytest.raises(WrongFieldError): + with pytest.raises(WrongField): assert test_object.json_deserialize(json_data) def test_json_serialize(self): @@ -235,7 +236,7 @@ def test_json_deserialize_from_invalid_dict(self): data = {"code": "401", "message": "message", "wrong_field": "target"} test_object = ErrorResponse() - with pytest.raises(WrongFieldError): + with pytest.raises(WrongField): assert test_object.json_deserialize(data) def test_json_deserialize_from_valid_json(self): @@ -258,7 +259,7 @@ def test_json_deserialize_from_invalid_json(self): json_data = '{"code": "401", "message": "message", "wrong_field": "target"}' test_object = ErrorResponse() - with pytest.raises(WrongFieldError): + with pytest.raises(WrongField): assert test_object.json_deserialize(json_data) def test_json_serialize(self): diff --git a/tests/internal/onboarding_test/test_request_onboarding.py b/tests/internal/onboarding_test/test_request_onboarding.py new file mode 100644 index 00000000..d62f26a3 --- /dev/null +++ b/tests/internal/onboarding_test/test_request_onboarding.py @@ -0,0 +1,36 @@ +"""Test agrirouter/onboarding/request.py""" + +from agrirouter import OnboardParameters, SecuredOnboardingService +from agrirouter.onboarding.enums import Gateways, CertificateTypes +from tests.common.constants import APPLICATION_ID, PUBLIC_KEY, PRIVATE_KEY, ENV + + +class TestBaseOnboardingRequest: + reg_code = "8eloz190fd" + certification_version_id = "13" + utc_timestamp = "+03:00" + time_zone = "01-01-2021" + url = "localhost" + params = OnboardParameters( + id_=1, + application_id=APPLICATION_ID, + certification_version_id=certification_version_id, + gateway_id=Gateways.MQTT.value, + certificate_type=CertificateTypes.PEM.value, + utc_timestamp=utc_timestamp, + time_zone=time_zone, + reg_code=reg_code, + ) + onboarding = SecuredOnboardingService( + env=ENV, public_key=PUBLIC_KEY, private_key=PRIVATE_KEY + ) + request = onboarding._create_request(params) + + def test_get_data(self): + assert self.request.get_data()["applicationId"] == APPLICATION_ID + assert (self.request.get_data()["certificateType"] == CertificateTypes.PEM.value) + assert (self.request.get_data()["certificateType"] == CertificateTypes.PEM.value) + + def test_get_header(self): + assert (self.request.get_header()["Authorization"] == "Bearer " + self.reg_code) + assert (self.request.get_header()["X-Agrirouter-ApplicationId"] == APPLICATION_ID) diff --git a/tests/onboarding_test/test_signature.py b/tests/internal/onboarding_test/test_signature.py similarity index 68% rename from tests/onboarding_test/test_signature.py rename to tests/internal/onboarding_test/test_signature.py index a6761baa..f1bbde01 100644 --- a/tests/onboarding_test/test_signature.py +++ b/tests/internal/onboarding_test/test_signature.py @@ -1,20 +1,19 @@ """Test agrirouter/onboarding/signature.py""" import pytest - from cryptography.exceptions import InvalidSignature from agrirouter.onboarding.signature import create_signature, verify_signature -from tests.constants import private_key, public_key +from tests.common.constants import PRIVATE_KEY, PUBLIC_KEY def test_create_signature_ok(): signature = create_signature( - "REQUEST CONTENT", private_key) + "REQUEST CONTENT", PRIVATE_KEY) raised = False try: verify_signature( - "REQUEST CONTENT", bytes.fromhex(signature), public_key) + "REQUEST CONTENT", bytes.fromhex(signature), PUBLIC_KEY) except InvalidSignature: raised = True assert not raised @@ -23,4 +22,4 @@ def test_create_signature_ok(): def test_verify_signature_fail(): with pytest.raises(InvalidSignature): verify_signature( - "REQUEST CONTENT", b"wrong_signature", public_key) + "REQUEST CONTENT", b"wrong_signature", PUBLIC_KEY) diff --git a/tests/internal/test_revoking/__init__.py b/tests/internal/test_revoking/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_revoking/test_parameters.py b/tests/internal/test_revoking/test_parameters.py similarity index 90% rename from tests/test_revoking/test_parameters.py rename to tests/internal/test_revoking/test_parameters.py index 2c1c737e..5417e280 100644 --- a/tests/test_revoking/test_parameters.py +++ b/tests/internal/test_revoking/test_parameters.py @@ -1,7 +1,7 @@ """Test agrirouter/revoking/parameters.py""" from agrirouter import RevokingParameter -from tests.constants import application_id +from tests.common.constants import APPLICATION_ID class TestRevokingParameter: @@ -11,7 +11,7 @@ class TestRevokingParameter: time_zone = "+03:00" utc_timestamp = "01-01-2021" test_object = RevokingParameter( - application_id=application_id, + application_id=APPLICATION_ID, content_type=content_type, account_id=account_id, endpoint_ids=endpoint_ids, @@ -20,7 +20,7 @@ class TestRevokingParameter: ) def test_get_header_params(self): - assert self.test_object.get_header_params()["application_id"] == application_id + assert self.test_object.get_header_params()["application_id"] == APPLICATION_ID assert self.test_object.get_header_params()["content_type"] == self.content_type def test_get_body_params(self): diff --git a/tests/onboarding_test/test_headers.py b/tests/onboarding_test/test_headers.py deleted file mode 100644 index 2c161f88..00000000 --- a/tests/onboarding_test/test_headers.py +++ /dev/null @@ -1,21 +0,0 @@ -"""Test agrirouter/onboarding/headers.py""" -from agrirouter.constants.media_types import ContentTypes -from agrirouter.onboarding.headers import SoftwareOnboardingHeader - - -class TestSoftwareOnboardingHeader: - reg_code = "1AC2cs21W" - test_object = SoftwareOnboardingHeader(reg_code=reg_code, application_id=1) - test_object_1 = SoftwareOnboardingHeader( - reg_code=reg_code, application_id=1, content_type="json" - ) - - def test_get_header(self): - assert ( - self.test_object.get_header()["Authorization"] == "Bearer " + self.reg_code - ) - assert ( - self.test_object.get_header()["Content-Type"] == ContentTypes.APPLICATION_JSON.value - ) - - assert self.test_object_1.get_header()["Content-Type"] == "json" diff --git a/tests/onboarding_test/test_onboarding.py b/tests/onboarding_test/test_onboarding.py deleted file mode 100644 index d14e8b15..00000000 --- a/tests/onboarding_test/test_onboarding.py +++ /dev/null @@ -1,61 +0,0 @@ -"""Test agrirouter/onboarding/onboarding.py""" - -from agrirouter.onboarding.exceptions import WrongCertificationType, WrongGateWay -from agrirouter.onboarding.onboarding import SoftwareOnboarding -from agrirouter.onboarding.parameters import SoftwareOnboardingParameter -from agrirouter.onboarding.enums import GateWays, CertificateTypes -from tests.constants import public_key, private_key, ENV, application_id -import pytest - - -class TestSoftwareOnboarding: - def test__create_request(self): - params = SoftwareOnboardingParameter( - id_=1, - application_id=application_id, - content_type="json", - certification_version_id="13", - gateway_id=GateWays.MQTT.value, - certificate_type=CertificateTypes.PEM.value, - utc_timestamp="+03:00", - time_zone="01-01-2021", - reg_code="8eloz190fd", - ) - onboarding = SoftwareOnboarding( - public_key=public_key, private_key=private_key, env=ENV - ) - assert onboarding._create_request(params, "localhost") - - params = SoftwareOnboardingParameter( - id_=2, - application_id=application_id, - content_type="json", - certification_version_id="13", - gateway_id=GateWays.MQTT.value, - certificate_type="wrong_certificate", - utc_timestamp="+03:00", - time_zone="01-01-2021", - reg_code="8eloz190fd", - ) - onboarding = SoftwareOnboarding( - public_key=public_key, private_key=private_key, env=ENV - ) - with pytest.raises(WrongCertificationType): - assert onboarding._create_request(params, "localhost") - - params = SoftwareOnboardingParameter( - id_=3, - application_id=application_id, - content_type="content_type", - certification_version_id="13", - gateway_id="wrong_gateway_id", - certificate_type=CertificateTypes.PEM.value, - utc_timestamp="+03:00", - time_zone="01-01-2021", - reg_code="8eloz190fd", - ) - onboarding = SoftwareOnboarding( - public_key=public_key, private_key=private_key, env=ENV - ) - with pytest.raises(WrongGateWay): - assert onboarding._create_request(params, "localhost") diff --git a/tests/onboarding_test/test_request_onboarding.py b/tests/onboarding_test/test_request_onboarding.py deleted file mode 100644 index df39ecd8..00000000 --- a/tests/onboarding_test/test_request_onboarding.py +++ /dev/null @@ -1,50 +0,0 @@ -"""Test agrirouter/onboarding/request.py""" - -from agrirouter import SoftwareOnboardingParameter, SoftwareOnboarding -from agrirouter.onboarding.enums import GateWays, CertificateTypes -from tests.constants import application_id, public_key, private_key, ENV - - -class TestBaseOnboardingRequest: - reg_code = "8eloz190fd" - content_type = "json" - certification_version_id = "13" - utc_timestamp = "+03:00" - time_zone = "01-01-2021" - url = "localhost" - params = SoftwareOnboardingParameter( - id_=1, - application_id=application_id, - content_type=content_type, - certification_version_id=certification_version_id, - gateway_id=GateWays.MQTT.value, - certificate_type=CertificateTypes.PEM.value, - utc_timestamp=utc_timestamp, - time_zone=time_zone, - reg_code=reg_code, - ) - onboarding = SoftwareOnboarding( - public_key=public_key, private_key=private_key, env=ENV - ) - test_object = onboarding._create_request(params, url) - - def test_get_url(self): - assert self.test_object.get_url() == self.url - - def test_get_data(self): - assert self.test_object.get_data()["applicationId"] == application_id - assert ( - self.test_object.get_data()["certificateType"] == CertificateTypes.PEM.value - ) - assert ( - self.test_object.get_data()["certificateType"] == CertificateTypes.PEM.value - ) - - def test_get_header(self): - assert ( - self.test_object.get_header()["Authorization"] == "Bearer " + self.reg_code - ) - assert self.test_object.get_header()["Content-Type"] == self.content_type - assert ( - self.test_object.get_header()["X-Agrirouter-ApplicationId"] == application_id - ) diff --git a/tests/service/__init__.py b/tests/service/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/service/messaging/__init__.py b/tests/service/messaging/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/service/messaging/mqtt/__init__.py b/tests/service/messaging/mqtt/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/service/messaging/mqtt/test_capability_service.py b/tests/service/messaging/mqtt/test_capability_service.py new file mode 100644 index 00000000..b62c5d27 --- /dev/null +++ b/tests/service/messaging/mqtt/test_capability_service.py @@ -0,0 +1,100 @@ +import logging +import unittest + +import pytest + +from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification +from agrirouter.messaging.decode import decode_response, decode_details +from agrirouter.messaging.enums import CapabilityDirectionType +from agrirouter.messaging.enums import CapabilityType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.parameters.service import CapabilitiesParameters +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.messaging import CapabilitiesService +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.utils.uuid_util import new_uuid +from tests.common.sleeper import Sleeper +from tests.data.applications import CommunicationUnit +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import read_onboard_response + + +class TestMqttCapabilitiesService(unittest.TestCase): + _onboard_response = None + _messaging_service = None + _log = logging.getLogger(__name__) + _callback_processed = False + + @pytest.fixture(autouse=True) + def fixture(self): + self._onboard_response = read_onboard_response(Identifier.MQTT_RECIPIENT_PEM[Identifier.PATH]) + self._messaging_service = MqttMessagingService(onboarding_response=self._onboard_response, + on_message_callback=self._message_callback()) + + yield + + self._messaging_service.client.disconnect() + + def test_when_sending_capabilities_for_recipient_with_direction_send_receive_then_the_server_should_accept_them( + self): + """ + Load onboard response from 'Mqtt/CommunicationUnit/PEM/Recipient' and send with 'SEND_RECEIVE' direction + """ + self._send_capabilities(onboard_response=self._onboard_response, + direction=CapabilityDirectionType.SEND_RECEIVE.value) + + def test_when_sending_capabilities_for_recipient_with_direction_receive_then_the_server_should_accept_them(self): + """ + Load onboard response from 'Mqtt/CommunicationUnit/PEM/Recipient' and send with 'RECEIVE' direction + """ + self._send_capabilities(onboard_response=self._onboard_response, + direction=CapabilityDirectionType.RECEIVE.value) + + def test_when_sending_capabilities_for_recipient_with_direction_send_then_the_server_should_accept_them(self): + """ + Load onboard response from 'Mqtt/CommunicationUnit/PEM/Recipient' and send with 'SEND' direction + """ + self._send_capabilities(onboard_response=self._onboard_response, + direction=CapabilityDirectionType.SEND.value) + + def _message_callback(self): + def _inner_function(client, userdata, msg): + """ + Callback to handle the incoming messages from the MQTT broker + """ + self._log.info("Received message after sending capabilities: " + str(msg.payload)) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.response_code != 201: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error("Message details: " + str(decoded_details)) + assert decoded_message.response_envelope.response_code == 201 + self._callback_processed = True + + return _inner_function + + def _send_capabilities(self, onboard_response, direction): + current_sequence_number = SequenceNumberService.next_seq_nr( + onboard_response.get_sensor_alternate_id()) + capabilities_parameters = CapabilitiesParameters( + onboarding_response=onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + application_id=CommunicationUnit.application_id, + certification_version_id=CommunicationUnit.certification_version_id, + enable_push_notification=CapabilitySpecification.PushNotification.DISABLED, + capability_parameters=[] + ) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.ISO_11783_TASK_DATA_ZIP.value, + direction=direction)) + capabilities_service = CapabilitiesService(self._messaging_service) + capabilities_service.send(capabilities_parameters) + Sleeper.process_the_command() + + if not self._callback_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_processed) + self._callback_processed = False diff --git a/tests/service/messaging/mqtt/test_feed_confirm_service.py b/tests/service/messaging/mqtt/test_feed_confirm_service.py new file mode 100644 index 00000000..33563c6d --- /dev/null +++ b/tests/service/messaging/mqtt/test_feed_confirm_service.py @@ -0,0 +1,286 @@ +import logging +import unittest + +import pytest + +from agrirouter import FeedConfirmService, FeedDeleteService, FeedDeleteParameters, \ + FeedConfirmParameters +from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope +from agrirouter.messaging.decode import decode_response, decode_details +from agrirouter.messaging.enums import CapabilityType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.parameters.dto import SendMessageParameters +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.messaging import SendMessageService +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.onboarding.response import OnboardResponse +from agrirouter.utils.uuid_util import new_uuid +from tests.common.data_provider import DataProvider +from tests.common.sleeper import Sleeper +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import read_onboard_response + + +class TestFeedConfirmService(unittest.TestCase): + """ + The setup (enabling capabilities and routing) between sender and recipient has been done prior to running this test + """ + _recipient_onboard_response = None + _sender_onboard_response = None + _messaging_service_for_sender = None + _messaging_service_for_recipient = None + _received_messages = None + + _callback_for_feed_confirm_service_processed = False + _log = logging.getLogger(__name__) + + @pytest.fixture(autouse=True) + def fixture(self): + # Setup + self._recipient_onboard_response = read_onboard_response(Identifier.MQTT_MESSAGES_RECIPIENT[Identifier.PATH]) + self._sender_onboard_response = read_onboard_response(Identifier.MQTT_MESSAGES_SENDER[Identifier.PATH]) + + self.send_message_before_the_test_run() + + if self._messaging_service_for_sender: + self._messaging_service_for_sender.client.disconnect() + if self._messaging_service_for_recipient: + self._messaging_service_for_recipient.client.disconnect() + + # Run the test + yield + + if self._messaging_service_for_sender: + self._messaging_service_for_sender.client.disconnect() + if self._messaging_service_for_recipient: + self._messaging_service_for_recipient.client.disconnect() + + # Tear Down + self._log.info("Deleting received messages from the feed to have a clean state: %s", + self._received_messages) + self._delete_messages_after_test_run(onboard_response=self._recipient_onboard_response) + + def send_message_before_the_test_run(self): + """ + Send a valid message content to a single recipient after enabling IMG_PNG capability with + sender and recipient. Open Connection between Recipient and agrirouter is required. The setup between the + sender and the recipient has been done before running the test. + """ + self._log.info("Sending a message before the test run") + + self._messaging_service_for_sender = MqttMessagingService( + onboarding_response=self._sender_onboard_response, + on_message_callback=self._non_checking_callback()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._callback_to_set_the_received_message_ids()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._sender_onboard_response.get_sensor_alternate_id()) + + send_message_parameters = SendMessageParameters( + onboarding_response=self._sender_onboard_response, + technical_message_type=CapabilityType.IMG_PNG.value, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + recipients=[self._recipient_onboard_response.get_sensor_alternate_id()], + base64_message_content=DataProvider.read_base64_encoded_image(), + mode=RequestEnvelope.Mode.Value("DIRECT")) + + send_message_service = SendMessageService(messaging_service=self._messaging_service_for_sender) + send_message_service.send(send_message_parameters) + Sleeper.process_the_message() + + self._messaging_service_for_sender.client.disconnect() + self._messaging_service_for_recipient.client.disconnect() + + def _delete_messages_after_test_run(self, onboard_response: OnboardResponse): + """ + Delete the messages after the test run. + """ + self._log.info("Deleting all existing messages after the test run.") + + self._messaging_service_for_recipient = MqttMessagingService(onboard_response, self._callback_for_feed_delete()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + senders=[self._sender_onboard_response.get_sensor_alternate_id()] + ) + + delete_message_service = FeedDeleteService(self._messaging_service_for_recipient) + delete_message_service.send(delete_message_parameters) + + Sleeper.process_the_command() + self._messaging_service_for_recipient.client.disconnect() + + def test_feed_confirm_service_for_valid_message_id_should_return_the_message_for_this_message_id(self): + """ + Testing feed confirm service when the message id is specified + """ + self._log.info("Testing feed confirm service with specific message id") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._feed_confirm_service_callback()) + + feed_confirm_parameters = FeedConfirmParameters(message_ids=[self._received_messages.header.message_id], + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response) + + feed_confirm_service = FeedConfirmService(self._messaging_service_for_recipient) + feed_confirm_service.send(feed_confirm_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_confirm_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_confirm_service_processed) + self._callback_for_feed_confirm_service_processed = False + + def test_feed_confirm_service_for_incorrect_message_id_should_return_an_empty_message(self): + """ + Testing feed confirm service when incorrect message id is specified + """ + self._log.info("Testing feed confirm service with specific message id") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + feed_confirm_parameters = FeedConfirmParameters(message_ids=[new_uuid()], + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response) + + feed_confirm_service = FeedConfirmService(self._messaging_service_for_recipient) + feed_confirm_service.send(feed_confirm_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_confirm_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_confirm_service_processed) + self._callback_for_feed_confirm_service_processed = False + + def test_feed_confirm_service_for_multiple_invalid_message_ids_should_return_empty_messages(self): + """ + Testing feed confirm service when incorrect message id is specified + """ + self._log.info("Testing feed confirm service with specific message id") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + feed_confirm_parameters = FeedConfirmParameters(message_ids=[new_uuid(), new_uuid()], + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response) + + feed_confirm_service = FeedConfirmService(self._messaging_service_for_recipient) + feed_confirm_service.send(feed_confirm_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_confirm_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_confirm_service_processed) + self._callback_for_feed_confirm_service_processed = False + + def _non_checking_callback(self): + def _inner_function(client, userdata, msg): + """ + Non checking callback to ensure that the message is processed. + """ + self._log.info( + "Received message for the non checking callback, " + "skipping message and continue to the tests afterwards: " + str(msg.payload)) + + return _inner_function + + def _callback_to_set_the_received_message_ids(self): + def _inner_function(client, userdata, msg): + """ + Callback to set the received message ids + """ + self._log.info("Received message for recipient from the agrirouter: %s", + msg.payload.decode()) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.type != 12: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error( + f"Received wrong message from the agrirouter: {str(decoded_details)}") + push_notification = decode_details(decoded_message.response_payload.details) + assert decoded_message.response_envelope.response_code == 200 + self._received_messages = push_notification.messages[0] + + return _inner_function + + def _callback_for_feed_delete(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode Feed Delete Service + """ + self._log.info("Received message after deleting messages: " + str(msg.payload)) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + delete_details = decode_details(decoded_message.response_payload.details) + self._log.info("Details for the message removal: " + str(delete_details)) + assert decoded_message.response_envelope.response_code == 201 + + return _inner_function + + def _feed_confirm_service_callback(self): + def _inner_function(client, userdata, msg): + """ + Callback function for feed confirm service + """ + self._log.info("Callback for checking if the feed confirm messages are received.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + feed_confirm_details = decode_details(decoded_message.response_payload.details) + self._log.info(f"Feed Confirm Service Details: {feed_confirm_details}") + assert decoded_message.response_envelope.response_code == 200 + assert all( + self._received_messages.header.message_id in feed_confirm_details.messages[idx].args['messageId'] for + idx in range(len(feed_confirm_details.messages))) + self._callback_for_feed_confirm_service_processed = True + + return _inner_function + + def _empty_result_in_response_callback(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode query header service response when incorrect ids are passed as arguments + """ + self._log.info("Callback for checking if no messages are received.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + feed_confirm_details_for_empty_messages = decode_details(decoded_message.response_payload.details) + self._log.info(f"Feed confirm details for empty messages: {feed_confirm_details_for_empty_messages}") + assert decoded_message.response_envelope.response_code == 200 + for _message in feed_confirm_details_for_empty_messages.messages: + assert _message.message_code == "VAL_000205" + assert self._received_messages.header.message_id != _message.args['messageId'] + + self._callback_for_feed_confirm_service_processed = True + + return _inner_function diff --git a/tests/service/messaging/mqtt/test_feed_delete_service.py b/tests/service/messaging/mqtt/test_feed_delete_service.py new file mode 100644 index 00000000..c28fe646 --- /dev/null +++ b/tests/service/messaging/mqtt/test_feed_delete_service.py @@ -0,0 +1,361 @@ +import logging +import unittest + +import pytest + +from agrirouter import FeedDeleteService, FeedDeleteParameters +from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope +from agrirouter.messaging.decode import decode_response, decode_details +from agrirouter.messaging.enums import CapabilityType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.messaging import SendMessageService, SendMessageParameters +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.utils.utc_time_util import max_validity_period, validity_period_for_seconds +from agrirouter.utils.uuid_util import new_uuid +from tests.common.data_provider import DataProvider +from tests.common.sleeper import Sleeper +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import read_onboard_response + + +class TestFeedDeleteService(unittest.TestCase): + """ + The setup (enabling capabilities and routing) between sender and recipient has been done prior to running this test + """ + _recipient_onboard_response = None + _sender_onboard_response = None + _messaging_service_for_sender = None + _messaging_service_for_recipient = None + _received_messages = None + + _callback_for_feed_delete_service_processed = False + _log = logging.getLogger(__name__) + + @pytest.fixture(autouse=True) + def fixture(self): + # Setup + self._recipient_onboard_response = read_onboard_response(Identifier.MQTT_MESSAGES_RECIPIENT[Identifier.PATH]) + self._sender_onboard_response = read_onboard_response(Identifier.MQTT_MESSAGES_SENDER[Identifier.PATH]) + + self.send_message_before_the_test_run() + + if self._messaging_service_for_sender: + self._messaging_service_for_sender.client.disconnect() + if self._messaging_service_for_recipient: + self._messaging_service_for_recipient.client.disconnect() + + # Run the test + yield + + # Tear down + if self._messaging_service_for_sender: + self._messaging_service_for_sender.client.disconnect() + if self._messaging_service_for_recipient: + self._messaging_service_for_recipient.client.disconnect() + + def send_message_before_the_test_run(self): + """ + Send a valid message content to a single recipient after enabling IMG_PNG capability with + sender and recipient. Open Connection between Recipient and agrirouter is required. The setup between the + sender and the recipient has been done before running the test. + """ + self._log.info("Sending a message before the test run") + + self._messaging_service_for_sender = MqttMessagingService( + onboarding_response=self._sender_onboard_response, + on_message_callback=self._non_checking_callback()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._callback_to_set_the_received_message_ids()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._sender_onboard_response.get_sensor_alternate_id()) + + send_message_parameters = SendMessageParameters( + onboarding_response=self._sender_onboard_response, + technical_message_type=CapabilityType.IMG_PNG.value, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + recipients=[self._recipient_onboard_response.get_sensor_alternate_id()], + base64_message_content=DataProvider.read_base64_encoded_image(), + mode=RequestEnvelope.Mode.Value("DIRECT")) + + send_message_service = SendMessageService(messaging_service=self._messaging_service_for_sender) + send_message_service.send(send_message_parameters) + Sleeper.process_the_message() + + self._messaging_service_for_sender.client.disconnect() + self._messaging_service_for_recipient.client.disconnect() + + def test_delete_messages_for_specified_sender_id_should_delete_the_message_from_the_feed_of_an_endpoint(self): + """ + Delete the messages for specified sender id + """ + self._log.info("Testing feed delete service for specific sender id") + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._callback_for_feed_delete_service()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=self._recipient_onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + senders=[self._sender_onboard_response.get_sensor_alternate_id()] + ) + + delete_message_service = FeedDeleteService(self._messaging_service_for_recipient) + delete_message_service.send(delete_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_delete_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + self.assertTrue(self._callback_for_feed_delete_service_processed) + self._callback_for_feed_delete_service_processed = False + + def test_delete_messages_for_specified_message_id_should_delete_the_message_from_the_feed_of_an_endpoint(self): + """ + Delete the messages for specified sender id + """ + self._log.info("Testing feed delete service for specific message id.") + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._callback_for_feed_delete_service()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=self._recipient_onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + message_ids=[self._received_messages.header.message_id] + ) + + delete_message_service = FeedDeleteService(self._messaging_service_for_recipient) + delete_message_service.send(delete_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_delete_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + self.assertTrue(self._callback_for_feed_delete_service_processed) + self._callback_for_feed_delete_service_processed = False + + def test_delete_messages_for_given_validity_period_should_delete_the_messages_from_the_feed_of_an_endpoint(self): + """ + Delete the messages for specified sender id + """ + self._log.info("Testing feed delete service for given validity period.") + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._callback_for_feed_delete_service()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=self._recipient_onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + validity_period=max_validity_period() + ) + + delete_message_service = FeedDeleteService(self._messaging_service_for_recipient) + delete_message_service.send(delete_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_delete_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + self.assertTrue(self._callback_for_feed_delete_service_processed) + self._callback_for_feed_delete_service_processed = False + + def test_delete_messages_for_incorrect_message_id_should_return_empty_message(self): + """ + Delete the messages for specified sender id + """ + self._log.info("Testing feed delete service for incorrect message id.") + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=self._recipient_onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + message_ids=[new_uuid()] + ) + + delete_message_service = FeedDeleteService(self._messaging_service_for_recipient) + delete_message_service.send(delete_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_delete_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + self.assertTrue(self._callback_for_feed_delete_service_processed) + self._callback_for_feed_delete_service_processed = False + + def test_delete_messages_for_incorrect_sender_id_should_return_empty_message(self): + """ + Delete the messages for specified sender id + """ + self._log.info("Testing feed delete service for incorrect sender id.") + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=self._recipient_onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + senders=[new_uuid()] + ) + + delete_message_service = FeedDeleteService(self._messaging_service_for_recipient) + delete_message_service.send(delete_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_delete_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + self.assertTrue(self._callback_for_feed_delete_service_processed) + self._callback_for_feed_delete_service_processed = False + + def test_delete_messages_for_invalid_validity_period_should_return_empty_message(self): + """ + Delete the messages for specified sender id + """ + self._log.info("Testing feed delete service for invalid validity period.") + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=self._recipient_onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + validity_period=validity_period_for_seconds(5) + ) + + delete_message_service = FeedDeleteService(self._messaging_service_for_recipient) + delete_message_service.send(delete_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_delete_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + self.assertTrue(self._callback_for_feed_delete_service_processed) + self._callback_for_feed_delete_service_processed = False + + def test_delete_messages_for_incomplete_attributes_should_return_in_an_error(self): + """ + Delete the messages for specified sender id + """ + self._log.info("Testing feed delete service for incomplete attributes.") + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=self._recipient_onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + validity_period=validity_period_for_seconds(5) + ) + + delete_message_service = FeedDeleteService(self._messaging_service_for_recipient) + delete_message_service.send(delete_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_delete_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + self.assertTrue(self._callback_for_feed_delete_service_processed) + self._callback_for_feed_delete_service_processed = False + + def _non_checking_callback(self): + def _inner_function(client, userdata, msg): + """ + Non checking callback to ensure that the message is processed. + """ + self._log.info( + "Received message for the non checking callback, " + "skipping message and continue to the tests afterwards: " + str(msg.payload)) + + return _inner_function + + def _callback_to_set_the_received_message_ids(self): + def _inner_function(client, userdata, msg): + """ + Callback to set the received message ids + """ + self._log.info("Received message for recipient from the agrirouter: %s", + msg.payload.decode()) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.type != 12: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error( + f"Received wrong message from the agrirouter: {str(decoded_details)}") + push_notification = decode_details(decoded_message.response_payload.details) + assert decoded_message.response_envelope.response_code == 200 + self._received_messages = push_notification.messages[0] + + return _inner_function + + def _callback_for_feed_delete_service(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode Feed Delete Service + """ + self._log.info("Received message after deleting messages: " + str(msg.payload)) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + feed_delete_details = decode_details(decoded_message.response_payload.details) + self._log.info("Details for the message removal: " + str(feed_delete_details)) + message_ids_in_feed = [_message.args['messageId'] for _message in feed_delete_details.messages] + assert decoded_message.response_envelope.response_code == 201 + assert self._received_messages.header.message_id in message_ids_in_feed + self._callback_for_feed_delete_service_processed = True + + return _inner_function + + def _empty_result_in_response_callback(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode query header service response when incorrect ids are passed as arguments + """ + self._log.info("Callback for checking if no messages are received.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + feed_delete_service_for_empty_result = decode_details(decoded_message.response_payload.details) + self._log.info(f"Feed delete details: {feed_delete_service_for_empty_result}") + assert decoded_message.response_envelope.response_code == 204 + assert feed_delete_service_for_empty_result.messages[0].message_code == "VAL_000208" + assert feed_delete_service_for_empty_result.messages[0].message == ("Feed does not contain " + "any data to be deleted.") + self._callback_for_feed_delete_service_processed = True + + return _inner_function diff --git a/tests/service/messaging/mqtt/test_list_endpoints_service.py b/tests/service/messaging/mqtt/test_list_endpoints_service.py new file mode 100644 index 00000000..a443a446 --- /dev/null +++ b/tests/service/messaging/mqtt/test_list_endpoints_service.py @@ -0,0 +1,186 @@ +import logging +import unittest + +import pytest + +from agrirouter import ListEndpointsService, ListEndpointsParameters +from agrirouter.messaging.decode import decode_response, decode_details +from agrirouter.messaging.enums import CapabilityType, CapabilityDirectionType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.utils.uuid_util import new_uuid +from tests.common.sleeper import Sleeper +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import read_onboard_response + + +class TestListEndpointsService(unittest.TestCase): + """ + The setup (enabling capabilities and routing) between sender and recipient has been done prior to running this test + """ + _recipient_onboard_response = None + _messaging_service_for_recipient = None + + _callback_for_list_endpoints_service_processed = False + _log = logging.getLogger(__name__) + + @pytest.fixture(autouse=True) + def fixture(self): + # Setup + self._recipient_onboard_response = read_onboard_response(Identifier.MQTT_MESSAGES_RECIPIENT[Identifier.PATH]) + self._sender_onboard_response = read_onboard_response(Identifier.MQTT_MESSAGES_SENDER[Identifier.PATH]) + + # Run the test + yield + + # Tear down + if not self._messaging_service_for_recipient: + self._messaging_service_for_recipient.client.disconnect() + + def test_list_endpoints_service_with_unfiltered_endpoints_list_should_return_the_endpoints(self): + """ + Testing list endpoints service + """ + self._log.info("Starting test for list endpoints service to return unfiltered list of endpoints") + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._list_endpoints_service_callback()) + + list_endpoints_parameters = ListEndpointsParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + filtered=True, + technical_message_type=CapabilityType.IMG_PNG.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value + ) + + list_endpoints_service = ListEndpointsService(self._messaging_service_for_recipient) + list_endpoints_service.send(list_endpoints_parameters) + Sleeper.process_the_command() + + if not self._callback_for_list_endpoints_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + self.assertTrue(self._callback_for_list_endpoints_service_processed) + self._callback_for_list_endpoints_service_processed = False + + self._messaging_service_for_recipient.client.disconnect() + + def test_list_endpoints_service_with_filtered_endpoints_list_should_return_the_endpoints(self): + """ + Testing list endpoints service + """ + self._log.info("Starting test for list endpoints service to return filtered list of endpoints") + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._list_endpoints_service_callback()) + + list_endpoints_parameters = ListEndpointsParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + filtered=True, + technical_message_type=CapabilityType.IMG_PNG.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value + ) + + list_endpoints_service = ListEndpointsService(self._messaging_service_for_recipient) + list_endpoints_service.send(list_endpoints_parameters) + Sleeper.process_the_command() + + if not self._callback_for_list_endpoints_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + self.assertTrue(self._callback_for_list_endpoints_service_processed) + self._callback_for_list_endpoints_service_processed = False + + self._messaging_service_for_recipient.client.disconnect() + + def test_list_endpoints_without_filters_should_return_all_the_available_endpoints_with_all_possible_message_types( + self): + """ + Testing list endpoints service + """ + self._log.info("Starting test for list endpoints service to return all endpoints") + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._list_endpoints_service_for_all_endpoints_callback()) + + list_endpoints_parameters = ListEndpointsParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + ) + + list_endpoints_service = ListEndpointsService(self._messaging_service_for_recipient) + list_endpoints_service.send(list_endpoints_parameters) + Sleeper.process_the_command() + + if not self._callback_for_list_endpoints_service_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + self.assertTrue(self._callback_for_list_endpoints_service_processed) + self._callback_for_list_endpoints_service_processed = False + + self._messaging_service_for_recipient.client.disconnect() + + def _list_endpoints_service_for_all_endpoints_callback(self): + + def _inner_function(client, userdata, msg): + self._log.info("Callback for checking if messages are received.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + list_endpoints_service_details = decode_details(decoded_message.response_payload.details) + self._log.info(f"List endpoints service details: {list_endpoints_service_details}") + assert decoded_message.response_envelope.response_code == 200 + for _endpoint in list_endpoints_service_details.endpoints: + assert _endpoint.endpoint_id is not None + assert _endpoint.endpoint_name is not None + assert _endpoint.endpoint_type is not None + assert _endpoint.status is not None + if _endpoint.endpoint_id == self._sender_onboard_response.get_sensor_alternate_id(): + expected_message_types = [ + CapabilityType.IMG_BMP.value, + CapabilityType.IMG_PNG.value, + CapabilityType.ISO_11783_TASK_DATA_ZIP.value, + CapabilityType.IMG_JPEG.value + ] + actual_message_types = [msg_type.technical_message_type for msg_type in _endpoint.message_types] + assert actual_message_types == expected_message_types + + self._callback_for_list_endpoints_service_processed = True + + return _inner_function + + def _list_endpoints_service_callback(self): + + def _inner_function(client, userdata, msg): + self._log.info("Callback for checking if messages are received.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + list_endpoints_service_details = decode_details(decoded_message.response_payload.details) + self._log.info(f"List endpoints service details: {list_endpoints_service_details}") + assert decoded_message.response_envelope.response_code == 200 + for _endpoint in list_endpoints_service_details.endpoints: + assert _endpoint.endpoint_id is not None + assert _endpoint.endpoint_name is not None + assert _endpoint.endpoint_type is not None + assert _endpoint.status is not None + if _endpoint.endpoint_id == self._sender_onboard_response.get_sensor_alternate_id(): + expected_message_types = CapabilityType.IMG_PNG.value + actual_message_types = [msg_type.technical_message_type for msg_type in _endpoint.message_types] + assert actual_message_types[0] == expected_message_types + + self._callback_for_list_endpoints_service_processed = True + + return _inner_function diff --git a/tests/service/messaging/mqtt/test_publish_message_service.py b/tests/service/messaging/mqtt/test_publish_message_service.py new file mode 100644 index 00000000..a8113260 --- /dev/null +++ b/tests/service/messaging/mqtt/test_publish_message_service.py @@ -0,0 +1,177 @@ +import logging +import unittest + +import pytest + +from agrirouter import FeedDeleteParameters +from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope +from agrirouter.messaging.decode import decode_response, decode_details +from agrirouter.messaging.enums import CapabilityType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.messaging import SendMessageService, SendMessageParameters, FeedDeleteService +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.onboarding.response import OnboardResponse +from agrirouter.utils.uuid_util import new_uuid +from tests.common.data_provider import DataProvider +from tests.common.sleeper import Sleeper +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import read_onboard_response + + +class TestSendDirectMessageService(unittest.TestCase): + """ + Test to publish the message to a recipient + The existing sender and recipient PEM onboard responses are read using OnboardIntegrationService + """ + _sender = read_onboard_response(Identifier.MQTT_MESSAGES_SENDER[Identifier.PATH]) + _recipient = read_onboard_response(Identifier.MQTT_MESSAGES_RECIPIENT[Identifier.PATH]) + + _messaging_service_for_sender = None + _messaging_service_for_recipient = None + + _callback_for_sender_processed = False + _callback_for_recipient_processed = False + + _log = logging.getLogger(__name__) + _received_messages = None + + @pytest.fixture(autouse=True) + def fixture(self): + # Setup + self._messaging_service_for_sender = MqttMessagingService( + onboarding_response=self._sender, + on_message_callback=self._callback_for_sender()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient, + on_message_callback=self._callback_for_recipient()) + + # Run the test + yield + + # Tear down + self._messaging_service_for_sender.client.disconnect() + self._messaging_service_for_recipient.client.disconnect() + + self._log.info("Deleting received messages from the feed to have a clean state: %s", + self._received_messages) + self.delete_all_messages_within_the_feed(onboard_response=self._recipient) + + def test_given_valid_message_content_when_sending_message_to_single_recipient_then_the_message_should_be_delivered( + self): + """ + Test for publishing the valid message content to a single recipient after enabling IMG_PNG capability with + sender and recipient Open Connection between Recipient and agrirouter is required. The setup between the + sender and the recipient are done before running the test. + """ + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._sender.get_sensor_alternate_id()) + + send_message_parameters = SendMessageParameters( + onboarding_response=self._sender, + technical_message_type=CapabilityType.IMG_PNG.value, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + base64_message_content=DataProvider.read_base64_encoded_image(), + mode=RequestEnvelope.Mode.Value("PUBLISH")) + + send_message_service = SendMessageService(messaging_service=self._messaging_service_for_sender) + send_message_service.send(send_message_parameters) + Sleeper.process_the_message() + + if not self._callback_for_sender_processed: + self._log.error( + "Either the callback for the sender was not processed in time or there was an error during the checks.") + + if not self._callback_for_recipient_processed: + self._log.error( + "Either the callback for the recipient was not processed " + "in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_sender_processed) + self.assertTrue(self._callback_for_recipient_processed) + + def _callback_for_sender(self): + def _inner_function(client, userdata, msg): + """ + Callback to handle the incoming messages from the MQTT broker + """ + self._log.info("Received message for sender from the agrirouter: %s", + msg.payload.decode()) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.type != 1: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error( + f"Received wrong message from the agrirouter: {str(decoded_details)}") + assert decoded_message.response_envelope.response_code == 201 + self._callback_for_sender_processed = True + + return _inner_function + + def _callback_for_recipient(self): + def _inner_function(client, userdata, msg): + """ + Callback to handle the incoming messages from the MQTT broker + """ + self._log.info("Received message for recipient from the agrirouter: %s", + msg.payload.decode()) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.type != 12: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error( + f"Received wrong message from the agrirouter: {str(decoded_details)}") + push_notification = decode_details(decoded_message.response_payload.details) + assert decoded_message.response_envelope.response_code == 200 + assert DataProvider.get_hash( + push_notification.messages[0].content.value) == DataProvider.get_hash( + DataProvider.read_base64_encoded_image()) + + self._callback_for_recipient_processed = True + + return _inner_function + + def delete_all_messages_within_the_feed(self, onboard_response: OnboardResponse): + """ + Delete all messages within the feed. + """ + logging.getLogger(__name__).info( + f"Delete all messages within the feed for endpoint '{self._recipient.get_sensor_alternate_id()}'.") + messaging_service = MqttMessagingService( + onboarding_response=onboard_response, + on_message_callback=self._callback_for_feed_delete()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + senders=[self._sender.get_sensor_alternate_id()] + ) + + feed_delete_service = FeedDeleteService(messaging_service) + feed_delete_service.send(delete_message_parameters) + + Sleeper.process_the_command() + + def _callback_for_feed_delete(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode Feed Delete Service + """ + self._log.info("Received message after deleting messages: " + str(msg.payload)) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + delete_details = decode_details(decoded_message.response_payload.details) + self._log.info("Details for the message removal: " + str(delete_details)) + assert decoded_message.response_envelope.response_code == 201 + + return _inner_function diff --git a/tests/service/messaging/mqtt/test_query_header_service.py b/tests/service/messaging/mqtt/test_query_header_service.py new file mode 100644 index 00000000..085dbda7 --- /dev/null +++ b/tests/service/messaging/mqtt/test_query_header_service.py @@ -0,0 +1,454 @@ +import logging +import unittest +from typing import Optional + +import pytest + +from agrirouter import QueryHeaderService, QueryHeaderParameters, FeedDeleteService, FeedDeleteParameters +from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope +from agrirouter.messaging.decode import decode_response, decode_details +from agrirouter.messaging.enums import CapabilityType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.messaging import SendMessageService, SendMessageParameters +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.onboarding.response import OnboardResponse +from agrirouter.utils.utc_time_util import max_validity_period, validity_period_for_seconds +from agrirouter.utils.uuid_util import new_uuid +from tests.common.data_provider import DataProvider +from tests.common.sleeper import Sleeper +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import read_onboard_response + + +class TestQueryHeaderService(unittest.TestCase): + """ + The setup (enabling capabilities and routing) between sender and recipient has been done prior to running this test + """ + _recipient_onboard_response = None + _sender_onboard_response = None + _messaging_service_for_sender = None + _messaging_service_for_recipient = None + _received_messages = None + + _callback_for_feed_header_query_processed = False + _log = logging.getLogger(__name__) + + @pytest.fixture(autouse=True) + def fixture(self): + # Setup + self._log.debug("Setup for the test case.") + self._recipient_onboard_response = read_onboard_response(Identifier.MQTT_MESSAGES_RECIPIENT[Identifier.PATH]) + self._sender_onboard_response = read_onboard_response(Identifier.MQTT_MESSAGES_SENDER[Identifier.PATH]) + + self.send_message_before_the_test_run() + + if self._messaging_service_for_sender: + self._messaging_service_for_sender.client.disconnect() + if self._messaging_service_for_recipient: + self._messaging_service_for_recipient.client.disconnect() + + # Run the test + yield + + # Tear down + self._log.debug("Tear down.") + if self._messaging_service_for_sender: + self._messaging_service_for_sender.client.disconnect() + if self._messaging_service_for_recipient: + self._messaging_service_for_recipient.client.disconnect() + + self._log.info("Deleting received messages from the feed to have a clean state: %s", + self._received_messages) + self._delete_messages_after_test_run(onboard_response=self._recipient_onboard_response) + + def send_message_before_the_test_run(self): + """ + Send a valid message content to a single recipient after enabling IMG_PNG capability with + sender and recipient. Open Connection between Recipient and agrirouter is required. The setup between the + sender and the recipient has been done before running the test. + """ + self._log.info("Sending a message before the test run") + + self._messaging_service_for_sender = MqttMessagingService( + onboarding_response=self._sender_onboard_response, + on_message_callback=self._non_checking_callback()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._callback_to_set_the_received_message_ids()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._sender_onboard_response.get_sensor_alternate_id()) + + send_message_parameters = SendMessageParameters( + onboarding_response=self._sender_onboard_response, + technical_message_type=CapabilityType.IMG_PNG.value, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + recipients=[self._recipient_onboard_response.get_sensor_alternate_id()], + base64_message_content=DataProvider.read_base64_encoded_image(), + mode=RequestEnvelope.Mode.Value("DIRECT")) + + send_message_service = SendMessageService(messaging_service=self._messaging_service_for_sender) + send_message_service.send(send_message_parameters) + Sleeper.process_the_message() + + self._messaging_service_for_sender.client.disconnect() + self._messaging_service_for_recipient.client.disconnect() + + def _non_checking_callback(self): + def _inner_function(client, userdata, msg): + """ + Non checking callback to ensure that the message is processed. + """ + self._log.info("Received message for the non checking callback, " + "skipping message and continue to the tests afterwards: " + str(msg.payload)) + + return _inner_function + + def _callback_to_set_the_received_message_ids(self): + def _inner_function(client, userdata, msg): + """ + Callback to set the received message ids + """ + self._log.info("Received message for recipient from the agrirouter: %s", + msg.payload.decode()) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.type != 12: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error( + f"Received wrong message from the agrirouter: {str(decoded_details)}") + push_notification = decode_details(decoded_message.response_payload.details) + self._received_messages = push_notification.messages[0].header.message_id + assert decoded_message.response_envelope.response_code == 200 + assert push_notification.messages[0] is not None + + self._received_messages = push_notification.messages[0] + + return _inner_function + + def _delete_messages_after_test_run(self, onboard_response: OnboardResponse): + """ + Delete the messages after the test run. + """ + self._log.info("Deleting all existing messages after the test run.") + + self._messaging_service_for_recipient = MqttMessagingService(onboard_response, self._callback_for_feed_delete()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + senders=[self._sender_onboard_response.get_sensor_alternate_id()] + ) + + delete_message_service = FeedDeleteService(self._messaging_service_for_recipient) + delete_message_service.send(delete_message_parameters) + + Sleeper.process_the_command() + self._messaging_service_for_recipient.client.disconnect() + + def test_header_query_service_when_validity_period_is_specified_should_return_messages_within_the_validity_period( + self): + """ + Testing query header service when the validity period is specified + """ + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + query_header_parameters = QueryHeaderParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + validity_period=max_validity_period(), + ) + + self.assertIsNotNone(self._received_messages) + received_message_ids = [self._received_messages.header.message_id] + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._on_query_header_service_callback(received_message_ids)) + + query_header_service = QueryHeaderService(self._messaging_service_for_recipient) + query_header_service.send(query_header_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_header_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_header_query_processed) + self._callback_for_feed_header_query_processed = False + + def test_header_query_service_when_senders_is_specified_should_return_the_header_for_this_sender_id(self): + """ + Testing query header service when the sender endpoint id is specified + """ + self._log.info("Testing header query service with specific sender id") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._on_query_header_service_callback(None)) + + query_header_parameters = QueryHeaderParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + senders=[ + self._sender_onboard_response.get_sensor_alternate_id()], + ) + + query_header_service = QueryHeaderService(self._messaging_service_for_recipient) + query_header_service.send(query_header_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_header_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_header_query_processed) + self._callback_for_feed_header_query_processed = False + + def test_header_query_service_for_specific_message_ids_should_return_the_messages_for_this_specific_message_ids( + self): + """ + Testing query header service when specific message id is specified + """ + self._log.info("Testing header query service with specific message id") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self.assertIsNotNone(self._received_messages) + message_for_message_ids = [self._received_messages.header.message_id] + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._on_query_header_service_callback(message_for_message_ids)) + + query_header_parameters = QueryHeaderParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + message_ids=message_for_message_ids, + ) + + query_header_service = QueryHeaderService(self._messaging_service_for_recipient) + query_header_service.send(query_header_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_header_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_header_query_processed) + self._callback_for_feed_header_query_processed = False + + def test_header_query_service_for_incomplete_attributes_should_return_in_an_error(self): + """ + Testing query header service when incomplete attributes are passed + """ + self._log.info("Testing header query service with incomplete attributes") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._incomplete_attributes_callback()) + + query_header_parameters = QueryHeaderParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + ) + + query_header_service = QueryHeaderService(self._messaging_service_for_recipient) + query_header_service.send(query_header_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_header_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_header_query_processed) + self._callback_for_feed_header_query_processed = False + + def test_header_query_service_for_incorrect_message_ids_should_return_empty_message(self): + """ + Testing query header service when incorrect message ids are specified + """ + self._log.info("Testing header query service with incorrect message ids") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + query_header_parameters = QueryHeaderParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + message_ids=[new_uuid()], + ) + + query_header_service = QueryHeaderService(self._messaging_service_for_recipient) + query_header_service.send(query_header_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_header_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_header_query_processed) + self._callback_for_feed_header_query_processed = False + + def test_header_query_service_for_incorrect_sender_id_should_return_empty_message(self): + """ + Testing query header service when incorrect sender id is specified + """ + self._log.info("Testing header query service with incorrect sender id") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + query_header_parameters = QueryHeaderParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + senders=[new_uuid()], + ) + + query_header_service = QueryHeaderService(self._messaging_service_for_recipient) + query_header_service.send(query_header_parameters) + Sleeper.process_the_command(60) + + if not self._callback_for_feed_header_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_header_query_processed) + self._callback_for_feed_header_query_processed = False + + def test_header_query_service_for_incorrect_validity_period_should_return_empty_message(self): + """ + Testing query header service when incorrect validity period is specified + """ + self._log.info("Testing header query service with incorrect validity period") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + _messaging_service = MqttMessagingService(onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + query_header_parameters = QueryHeaderParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + validity_period=validity_period_for_seconds(5), + ) + + query_header_service = QueryHeaderService(_messaging_service) + query_header_service.send(query_header_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_header_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_header_query_processed) + self._callback_for_feed_header_query_processed = False + + def _callback_for_feed_delete(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode Feed Delete Service + """ + self._log.info("Received message after deleting messages: " + str(msg.payload)) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + delete_details = decode_details(decoded_message.response_payload.details) + self._log.info("Details for the message removal: " + str(delete_details)) + assert decoded_message.response_envelope.response_code == 201 + + return _inner_function + + def _incomplete_attributes_callback(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode query header service response when the attributes are incomplete + """ + self._log.info("Callback for checking if no messages are received.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + details = decode_details(decoded_message.response_payload.details) + + assert decoded_message.response_envelope.response_code == 400 + assert decoded_message.response_envelope.type == 3 + assert details.messages[0].message_code == "VAL_000017" + assert (details.messages[0].message == "Query does not contain any filtering " + "criteria: messageIds, senders or validityPeriod. Information " + "required to process message is missing or malformed.") + self._callback_for_feed_header_query_processed = True + + return _inner_function + + def _empty_result_in_response_callback(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode query header service response when incorrect ids are passed as arguments + """ + self._log.info("Callback for checking if no messages are received.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + assert decoded_message.response_envelope.response_code == 204 + self._callback_for_feed_header_query_processed = True + + return _inner_function + + def _callback_for_recipient(self): + def _inner_function(client, userdata, msg): + """ + Callback to handle the incoming messages from the MQTT broker + """ + self._log.info("Received message for recipient from the agrirouter: %s", + msg.payload.decode()) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.type != 12: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error( + f"Received wrong message from the agrirouter: {str(decoded_details)}") + push_notification = decode_details(decoded_message.response_payload.details) + assert decoded_message.response_envelope.response_code == 200 + assert DataProvider.get_hash( + push_notification.messages[0].content.value) == DataProvider.get_hash( + DataProvider.read_base64_encoded_image()) + self._received_messages = push_notification.messages[0] + + return _inner_function + + def _on_query_header_service_callback(self, message_ids: Optional[list]): + def _inner_function(client, userdata, msg): + """ + Callback function for query header service + """ + self._log.info("Callback for checking if the query header messages are received.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + query_header_details = decode_details(decoded_message.response_payload.details) + self._log.info(f"Query Header Service Details: {query_header_details}") + assert decoded_message.response_envelope.type == 6 + if query_header_details.feed: + self._log.info(f"Checking headers for the following message ids: {message_ids}") + header_query_message_ids = [query_header_details.feed[0].headers[idx].message_id for idx in + range(len(query_header_details.feed[0].headers))] + if message_ids: + for msg_id in message_ids: + assert msg_id in header_query_message_ids + else: + assert self._received_messages.header.message_id in header_query_message_ids + self._callback_for_feed_header_query_processed = True + + return _inner_function diff --git a/tests/service/messaging/mqtt/test_query_message_service.py b/tests/service/messaging/mqtt/test_query_message_service.py new file mode 100644 index 00000000..5bc1c6f2 --- /dev/null +++ b/tests/service/messaging/mqtt/test_query_message_service.py @@ -0,0 +1,382 @@ +import logging +import unittest +from typing import Optional + +import pytest + +from agrirouter import QueryMessagesService, QueryMessageParameters, FeedDeleteService, FeedDeleteParameters +from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope +from agrirouter.messaging.decode import decode_response, decode_details +from agrirouter.messaging.enums import CapabilityType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.messaging import SendMessageService, SendMessageParameters +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.onboarding.response import OnboardResponse +from agrirouter.utils.utc_time_util import max_validity_period, validity_period_for_seconds +from agrirouter.utils.uuid_util import new_uuid +from tests.common.data_provider import DataProvider +from tests.common.sleeper import Sleeper +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import read_onboard_response + + +class TestQueryMessageServiceForSingleMessage(unittest.TestCase): + """ + The setup (enabling capabilities and routing) between sender and recipient has been done prior to running this test + """ + _recipient_onboard_response = None + _sender_onboard_response = None + _messaging_service_for_sender = None + _messaging_service_for_recipient = None + _received_messages = None + + _callback_for_feed_message_query_processed = False + _log = logging.getLogger(__name__) + + @pytest.fixture(autouse=True) + def fixture(self): + # Setup + self._log.info("Setup.") + self._recipient_onboard_response = read_onboard_response(Identifier.MQTT_MESSAGES_RECIPIENT[Identifier.PATH]) + self._sender_onboard_response = read_onboard_response(Identifier.MQTT_MESSAGES_SENDER[Identifier.PATH]) + + self.send_message_before_the_test_run() + + if self._messaging_service_for_sender: + self._messaging_service_for_sender.client.disconnect() + if self._messaging_service_for_recipient: + self._messaging_service_for_recipient.client.disconnect() + + # Run the test + yield + + if self._messaging_service_for_sender: + self._messaging_service_for_sender.client.disconnect() + if self._messaging_service_for_recipient: + self._messaging_service_for_recipient.client.disconnect() + + # Tear down + self._log.info("Tear down") + self._log.info("Deleting received messages from the feed to have a clean state: %s", + self._received_messages) + self._delete_messages_after_test_run(onboard_response=self._recipient_onboard_response) + + def send_message_before_the_test_run(self): + """ + Send a valid message content to a single recipient after enabling IMG_PNG capability with + sender and recipient. Open Connection between Recipient and agrirouter is required. The setup between the + sender and the recipient has been done before running the test. + """ + self._log.info("Sending a message before the test run") + + self._messaging_service_for_sender = MqttMessagingService( + onboarding_response=self._sender_onboard_response, + on_message_callback=self._non_checking_callback()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._callback_to_set_the_received_message_ids()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._sender_onboard_response.get_sensor_alternate_id()) + + send_message_parameters = SendMessageParameters( + onboarding_response=self._sender_onboard_response, + technical_message_type=CapabilityType.IMG_PNG.value, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + recipients=[self._recipient_onboard_response.get_sensor_alternate_id()], + base64_message_content=DataProvider.read_base64_encoded_image(), + mode=RequestEnvelope.Mode.Value("DIRECT")) + + send_message_service = SendMessageService(messaging_service=self._messaging_service_for_sender) + send_message_service.send(send_message_parameters) + Sleeper.process_the_message() + + self._messaging_service_for_sender.client.disconnect() + self._messaging_service_for_recipient.client.disconnect() + + def _delete_messages_after_test_run(self, onboard_response: OnboardResponse): + """ + Delete the messages after the test run. + """ + self._log.info("Deleting all existing messages after the test run.") + + self._messaging_service_for_recipient = MqttMessagingService(onboard_response, self._callback_for_feed_delete()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + senders=[self._sender_onboard_response.get_sensor_alternate_id()] + ) + + delete_message_service = FeedDeleteService(self._messaging_service_for_recipient) + delete_message_service.send(delete_message_parameters) + + Sleeper.process_the_command() + self._messaging_service_for_recipient.client.disconnect() + + def test_message_query_service_when_validity_period_is_specified_should_return_the_message_for_this_validity_period( + self): + """ + Testing query message service when the validation period is specified + """ + self._log.info("Testing message query service with specific sender id") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._on_query_message_service_callback([self._received_messages.header.message_id])) + + query_message_parameters = QueryMessageParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + validity_period=max_validity_period(), + ) + + query_message_service = QueryMessagesService(self._messaging_service_for_recipient) + query_message_service.send(query_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_message_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_message_query_processed) + self._callback_for_feed_message_query_processed = False + + def test_message_query_service_when_sender_is_specified_should_return_the_message_for_this_sender_id(self): + """ + Testing query message service when the sender endpoint id is specified + """ + self._log.info("Testing message query service with specific sender id") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._on_query_message_service_callback(None)) + + query_message_parameters = QueryMessageParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + senders=[ + self._sender_onboard_response.get_sensor_alternate_id()], + ) + + query_message_service = QueryMessagesService(self._messaging_service_for_recipient) + query_message_service.send(query_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_message_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_message_query_processed) + self._callback_for_feed_message_query_processed = False + + def test_message_query_service_when_message_id_is_specified_should_return_the_message_for_this_message_id(self): + """ + Testing query message service when the message id is specified + """ + self._log.info("Testing message query service with specific sender id") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._on_query_message_service_callback([self._received_messages.header.message_id])) + + query_message_parameters = QueryMessageParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + message_ids=[ + self._received_messages.header.message_id], + ) + + query_message_service = QueryMessagesService(self._messaging_service_for_recipient) + query_message_service.send(query_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_message_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_message_query_processed) + self._callback_for_feed_message_query_processed = False + + def test_query_message_service_for_incorrect_message_ids_should_return_empty_message(self): + """ + Testing query message service when incorrect message ids are specified + """ + self._log.info("Testing query message service with incorrect message ids") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + query_message_parameters = QueryMessageParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + message_ids=[new_uuid()], + ) + + query_message_service = QueryMessagesService(self._messaging_service_for_recipient) + query_message_service.send(query_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_message_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_message_query_processed) + self._callback_for_feed_message_query_processed = False + + def test_query_message_service_for_incorrect_sender_ids_should_return_empty_message(self): + """ + Testing query message service when incorrect sender id is specified + """ + self._log.info("Testing query message service with incorrect message ids") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + query_message_parameters = QueryMessageParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + senders=[new_uuid()], + ) + + query_message_service = QueryMessagesService(self._messaging_service_for_recipient) + query_message_service.send(query_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_message_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_message_query_processed) + self._callback_for_feed_message_query_processed = False + + def test_query_message_service_for_incorrect_validity_period_should_return_empty_message(self): + """ + Testing query message service when incorrect message ids are specified + """ + self._log.info("Testing query message service with invalid validation period") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient_onboard_response.get_sensor_alternate_id()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient_onboard_response, + on_message_callback=self._empty_result_in_response_callback()) + + query_message_parameters = QueryMessageParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient_onboard_response, + validity_period=validity_period_for_seconds(seconds=5), + ) + + query_message_service = QueryMessagesService(self._messaging_service_for_recipient) + query_message_service.send(query_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_feed_message_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_feed_message_query_processed) + self._callback_for_feed_message_query_processed = False + + def _non_checking_callback(self): + def _inner_function(client, userdata, msg): + """ + Non checking callback to ensure that the message is processed. + """ + self._log.info("Received message for the non checking callback, " + "skipping message and continue to the tests afterwards: " + str(msg.payload)) + + return _inner_function + + def _callback_to_set_the_received_message_ids(self): + def _inner_function(client, userdata, msg): + """ + Callback to set the received message ids + """ + self._log.info("Received message for recipient from the agrirouter: %s", + msg.payload.decode()) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.type != 12: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error( + f"Received wrong message from the agrirouter: {str(decoded_details)}") + push_notification = decode_details(decoded_message.response_payload.details) + assert decoded_message.response_envelope.response_code == 200 + self._received_messages = push_notification.messages[0] + + return _inner_function + + def _callback_for_feed_delete(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode Feed Delete Service + """ + self._log.info("Received message after deleting messages: " + str(msg.payload)) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + delete_details = decode_details(decoded_message.response_payload.details) + self._log.info("Details for the message removal: " + str(delete_details)) + assert decoded_message.response_envelope.response_code == 201 + + return _inner_function + + def _on_query_message_service_callback(self, message_ids: Optional[list]): + def _inner_function(client, userdata, msg): + """ + Callback function for query message service + """ + self._log.info("Callback for checking if the content from query messages are received.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + query_message_details = decode_details(decoded_message.response_payload.details) + self._log.info(f"Query Message Service Details: {query_message_details}") + assert decoded_message.response_envelope.type == 7 + message_query_message_ids = [query_message_details.messages[idx].header.message_id for idx in + range(len(query_message_details.messages))] + if message_ids: + for _msg_idx, _msg_id in enumerate(message_ids): + if _msg_id in message_query_message_ids: + assert DataProvider.get_hash( + query_message_details.messages[_msg_idx].content.value) == DataProvider.get_hash( + self._received_messages.content.value) + else: + for _idx, _message in enumerate(query_message_details.messages): + if self._received_messages.header.message_id == _message.header.message_id: + assert DataProvider.get_hash(_message.content.value) == DataProvider.get_hash( + self._received_messages.content.value) + + self._callback_for_feed_message_query_processed = True + + return _inner_function + + def _empty_result_in_response_callback(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode query header service response when incorrect ids are passed as arguments + """ + self._log.info("Callback for checking if no messages are received.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + assert decoded_message.response_envelope.response_code == 204 + self._callback_for_feed_message_query_processed = True + + return _inner_function diff --git a/tests/service/messaging/mqtt/test_send_and_receive_chunked_messages_from_the_feed.py b/tests/service/messaging/mqtt/test_send_and_receive_chunked_messages_from_the_feed.py new file mode 100644 index 00000000..6e740d85 --- /dev/null +++ b/tests/service/messaging/mqtt/test_send_and_receive_chunked_messages_from_the_feed.py @@ -0,0 +1,246 @@ +import logging +import unittest +from typing import Optional + +import pytest + +from agrirouter import FeedDeleteService, FeedDeleteParameters, MessageHeaderParameters, MessagePayloadParameters, \ + SendChunkedMessageService, QueryHeaderService, QueryHeaderParameters +from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope +from agrirouter.messaging.decode import decode_response, decode_details +from agrirouter.messaging.encode import chunk_and_base64encode_each_chunk, encode_chunks_message +from agrirouter.messaging.enums import CapabilityType, TechnicalMessageType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.parameters.dto import ChunkedMessageParameters +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.onboarding.response import OnboardResponse +from agrirouter.utils.uuid_util import new_uuid +from tests.common.data_provider import DataProvider +from tests.common.sleeper import Sleeper +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import read_onboard_response + + +class TestSendAndReceiveChunkedMessages(unittest.TestCase): + _recipient = None + _sender = None + _messaging_service_for_sender = None + _messaging_service_for_recipient = None + _callback_for_chunking_feed_header_query_processed = False + + _received_messages = [] + + _chunked_message_to_verify = [] + _MAX_CHUNK_SIZE = 1024000 + + _log = logging.getLogger(__name__) + + @pytest.fixture(autouse=True) + def fixture(self): + # Setup + self._log.debug("Setup for the test case.") + self._recipient = read_onboard_response(Identifier.MQTT_MESSAGES_RECIPIENT[Identifier.PATH]) + self._sender = read_onboard_response(Identifier.MQTT_MESSAGES_SENDER[Identifier.PATH]) + + self._send_direct_chunked_message() + + # Run the test + yield + + # Tear down + self._log.debug("Tear down.") + if self._messaging_service_for_sender is not None: + self._messaging_service_for_sender.client.disconnect() + if self._messaging_service_for_recipient is not None: + self._messaging_service_for_recipient.client.disconnect() + + self._log.info("Deleting received messages from the feed to have a clean state: %s", + self._received_messages) + self._delete_messages_after_test_run(onboard_response=self._recipient) + + def _delete_messages_after_test_run(self, onboard_response: OnboardResponse): + """ + Delete the messages after the test run. + """ + self._log.info("Deleting all existing messages after the test run.") + + self._feed_delete_messaging_service = MqttMessagingService(onboarding_response=onboard_response, + on_message_callback=self._callback_for_feed_delete()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + senders=[self._sender.get_sensor_alternate_id()] + ) + + delete_message_service = FeedDeleteService(self._feed_delete_messaging_service) + delete_message_service.send(delete_message_parameters) + + Sleeper.process_the_command() + self._feed_delete_messaging_service.client.disconnect() + + def _send_direct_chunked_message(self): + """ + Test sending direct chunked messages with the push notifications enabled. + The setup between recipient and sender, like, enabling capabilities and routing has been done prior to running + this test + """ + self._log.info("Testing send message service with the specified recipient") + + self._messaging_service_for_sender = MqttMessagingService( + onboarding_response=self._sender, + on_message_callback=self._non_checking_callback()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient, + on_message_callback=self._callback_to_set_the_received_message_ids()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient.get_sensor_alternate_id()) + + message_header_parameters = MessageHeaderParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + technical_message_type=CapabilityType.IMG_BMP.value, + recipients=[ + self._recipient.get_sensor_alternate_id()], + mode=RequestEnvelope.Mode.Value("DIRECT")) + + message_payload_parameters = MessagePayloadParameters(type_url=TechnicalMessageType.EMPTY.value, + value=DataProvider.read_base64_encoded_large_bmp()) + + message_parameter_tuples = chunk_and_base64encode_each_chunk(header_parameters=message_header_parameters, + payload_parameters=message_payload_parameters, + onboarding_response=self._sender) + + for _tuple in message_parameter_tuples: + self._chunked_message_to_verify.append(_tuple.message_payload_parameters.get_value()) + assert len(_tuple.message_payload_parameters.get_value()) <= self._MAX_CHUNK_SIZE + + encoded_chunked_messages = encode_chunks_message(message_parameter_tuple=message_parameter_tuples) + + chunk_message_parameters = ChunkedMessageParameters( + onboarding_response=self._sender, + technical_message_type=CapabilityType.IMG_BMP.value, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + recipients=[self._recipient.get_sensor_alternate_id()], + encoded_chunked_messages=encoded_chunked_messages) + + send_chunked_message_service = SendChunkedMessageService(messaging_service=self._messaging_service_for_sender) + send_chunked_message_service.send(chunk_message_parameters) + Sleeper.process_the_message() + + self._messaging_service_for_sender.client.disconnect() + self._messaging_service_for_recipient.client.disconnect() + + def test_receive_chunked_msgs_from_feed_when_sender_id_is_specified_should_return_the_header_for_this_sender_id( + self): + """ + Testing query header service when the validity period is specified + """ + self._log.info("Testing header query service with specific sender id") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient.get_sensor_alternate_id()) + + self._messaging_service_for_specified_sender_id = MqttMessagingService( + onboarding_response=self._recipient, + on_message_callback=self._on_query_header_service_callback(self._received_messages)) + + query_header_parameters = QueryHeaderParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + onboarding_response=self._recipient, + senders=[ + self._sender.get_sensor_alternate_id()], + ) + + query_header_service = QueryHeaderService( + self._messaging_service_for_specified_sender_id) + query_header_service.send(query_header_parameters) + Sleeper.process_the_command() + + if not self._callback_for_chunking_feed_header_query_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_chunking_feed_header_query_processed) + self._callback_for_feed_header_query_processed = False + self._messaging_service_for_specified_sender_id.client.disconnect() + + def _non_checking_callback(self): + def _inner_function(client, userdata, msg): + """ + Non checking callback to ensure that the message is processed. + """ + self._log.info( + "Received message for the non checking callback, " + "skipping message and continue to the tests afterwards: " + str(msg.payload)) + + return _inner_function + + def _callback_to_set_the_received_message_ids(self): + def _inner_function(client, userdata, msg): + """ + Callback to handle the incoming messages from the MQTT broker + """ + self._log.info("Received message for recipient from the agrirouter: %s", + msg.payload.decode()) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.type != 12: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error( + f"Received wrong message from the agrirouter: {str(decoded_details)}") + push_notification = decode_details(decoded_message.response_payload.details) + current_chunked_message = push_notification.messages[0].content.value + self._received_messages.append(push_notification.messages[0].header.message_id) + assert decoded_message.response_envelope.response_code == 200 + assert DataProvider.get_hash(current_chunked_message) == DataProvider.get_hash( + self._chunked_message_to_verify[0]) + self._chunked_message_to_verify.pop(0) + self._callback_for_chunking_feed_header_query_processed = True + + return _inner_function + + def _callback_for_feed_delete(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode Feed Delete Service + """ + self._log.info("Received message after deleting messages: " + str(msg.payload)) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + delete_details = decode_details(decoded_message.response_payload.details) + self._log.info("Details for the message removal: " + str(delete_details)) + assert decoded_message.response_envelope.response_code == 201 + + return _inner_function + + def _on_query_header_service_callback(self, message_ids: Optional[list]): + def _inner_function(client, userdata, msg): + """ + Callback function for query header service + """ + self._log.info("Callback for checking if the query header messages are received.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + query_header_details = decode_details(decoded_message.response_payload.details) + self._log.info(f"Query Header Service Details: {query_header_details}") + assert decoded_message.response_envelope.type == 6 + if query_header_details.feed: + self._log.info(f"Checking headers for the following message ids: {message_ids}") + header_query_message_ids = [query_header_details.feed[0].headers[idx].message_id for idx in + range(len(query_header_details.feed[0].headers))] + if message_ids: + assert all(msg_id in header_query_message_ids for msg_id in message_ids) + else: + assert self._received_messages[0].header.message_id in header_query_message_ids + self._callback_for_feed_header_query_processed = True + + return _inner_function diff --git a/tests/service/messaging/mqtt/test_send_chunked_messages_and_receive_with_push_notifications.py b/tests/service/messaging/mqtt/test_send_chunked_messages_and_receive_with_push_notifications.py new file mode 100644 index 00000000..dafd1fd2 --- /dev/null +++ b/tests/service/messaging/mqtt/test_send_chunked_messages_and_receive_with_push_notifications.py @@ -0,0 +1,191 @@ +import logging +import unittest + +import pytest + +from agrirouter import FeedDeleteService, FeedDeleteParameters, MessageHeaderParameters, MessagePayloadParameters, \ + SendChunkedMessageService +from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope +from agrirouter.messaging.decode import decode_response, decode_details +from agrirouter.messaging.encode import chunk_and_base64encode_each_chunk, encode_chunks_message +from agrirouter.messaging.enums import CapabilityType, TechnicalMessageType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.parameters.dto import ChunkedMessageParameters +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.onboarding.response import OnboardResponse +from agrirouter.utils.uuid_util import new_uuid +from tests.common.data_provider import DataProvider +from tests.common.sleeper import Sleeper +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import read_onboard_response + + +class TestSendAndReceiveChunkedMessages(unittest.TestCase): + _recipient = None + _sender = None + _messaging_service_for_sender = None + _messaging_service_for_recipient = None + _received_messages = None + _callback_for_chunking_message_processed = False + + _chunked_message_to_verify = [] + _MAX_CHUNK_SIZE = 1024000 + + _log = logging.getLogger(__name__) + + @pytest.fixture(autouse=True) + def fixture(self): + # Setup + self._log.debug("Setup for the test case.") + self._recipient = read_onboard_response(Identifier.MQTT_MESSAGES_RECIPIENT[Identifier.PATH]) + self._sender = read_onboard_response(Identifier.MQTT_MESSAGES_SENDER[Identifier.PATH]) + + # Run the test + yield + + # Tear down + self._log.debug("Tear down.") + if self._messaging_service_for_sender is not None: + self._messaging_service_for_sender.client.disconnect() + if self._messaging_service_for_recipient is not None: + self._messaging_service_for_recipient.client.disconnect() + + self._log.info("Deleting received messages from the feed to have a clean state: %s", + self._received_messages) + self._delete_messages_after_test_run(onboard_response=self._recipient) + + def _delete_messages_after_test_run(self, onboard_response: OnboardResponse): + """ + Delete the messages after the test run. + """ + self._log.info("Deleting all existing messages after the test run.") + + self._feed_delete_messaging_service = MqttMessagingService(onboarding_response=onboard_response, + on_message_callback=self._callback_for_feed_delete()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + senders=[self._sender.get_sensor_alternate_id()] + ) + + delete_message_service = FeedDeleteService(self._feed_delete_messaging_service) + delete_message_service.send(delete_message_parameters) + + Sleeper.process_the_command() + self._feed_delete_messaging_service.client.disconnect() + + def test_send_direct_chunked_message_with_valid_recipient_should_return_the_valid_chunked_message_content(self): + """ + Test sending direct chunked messages with the push notifications enabled. + The setup between recipient and sender, like, enabling capabilities and routing has been done prior to running + this test + """ + self._log.info("Testing send message service with the specified recipient") + + self._messaging_service_for_sender = MqttMessagingService( + onboarding_response=self._sender, + on_message_callback=self._non_checking_callback()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient, + on_message_callback=self._callback_to_set_the_received_message_ids()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._recipient.get_sensor_alternate_id()) + + message_header_parameters = MessageHeaderParameters(application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + technical_message_type=CapabilityType.IMG_BMP.value, + recipients=[ + self._recipient.get_sensor_alternate_id()], + mode=RequestEnvelope.Mode.Value("DIRECT")) + + message_payload_parameters = MessagePayloadParameters(type_url=TechnicalMessageType.EMPTY.value, + value=DataProvider.read_base64_encoded_large_bmp()) + + message_parameter_tuples = chunk_and_base64encode_each_chunk(header_parameters=message_header_parameters, + payload_parameters=message_payload_parameters, + onboarding_response=self._sender) + + for _tuple in message_parameter_tuples: + self._chunked_message_to_verify.append(_tuple.message_payload_parameters.get_value()) + assert len(_tuple.message_payload_parameters.get_value()) <= self._MAX_CHUNK_SIZE + + encoded_chunked_messages = encode_chunks_message(message_parameter_tuple=message_parameter_tuples) + + if not len(encoded_chunked_messages) == 10: + self._log.error("Number of chunks not as expected. Check the data being chunked. ") + + chunk_message_parameters = ChunkedMessageParameters( + onboarding_response=self._sender, + technical_message_type=CapabilityType.IMG_BMP.value, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + recipients=[self._recipient.get_sensor_alternate_id()], + encoded_chunked_messages=encoded_chunked_messages) + + send_chunked_message_service = SendChunkedMessageService(messaging_service=self._messaging_service_for_sender) + send_chunked_message_service.send(chunk_message_parameters) + Sleeper.process_the_command() + + if not self._callback_for_chunking_message_processed: + self._log.error("Either the callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_chunking_message_processed) + self._callback_for_chunking_message_processed = False + + def _non_checking_callback(self): + def _inner_function(client, userdata, msg): + """ + Non checking callback to ensure that the message is processed. + """ + self._log.info( + "Received message for the non checking callback, " + "skipping message and continue to the tests afterwards: " + str(msg.payload)) + + return _inner_function + + def _callback_to_set_the_received_message_ids(self): + def _inner_function(client, userdata, msg): + """ + Callback to handle the incoming messages from the MQTT broker + """ + self._log.info("Received message for recipient from the agrirouter: %s", + msg.payload.decode()) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.type != 12: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error( + f"Received wrong message from the agrirouter: {str(decoded_details)}") + push_notification = decode_details(decoded_message.response_payload.details) + current_chunked_message = push_notification.messages[0].content.value + assert decoded_message.response_envelope.response_code == 200 + assert DataProvider.get_hash(current_chunked_message) == DataProvider.get_hash( + self._chunked_message_to_verify[0]) + self._chunked_message_to_verify.pop(0) + self._callback_for_chunking_message_processed = True + + return _inner_function + + def _callback_for_feed_delete(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode Feed Delete Service + """ + self._log.info("Received message after deleting messages: " + str(msg.payload)) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + delete_details = decode_details(decoded_message.response_payload.details) + self._log.info("Details for the message removal: " + str(delete_details)) + assert decoded_message.response_envelope.response_code == 201 + + return _inner_function diff --git a/tests/service/messaging/mqtt/test_send_direct_message_service.py b/tests/service/messaging/mqtt/test_send_direct_message_service.py new file mode 100644 index 00000000..5920a9f1 --- /dev/null +++ b/tests/service/messaging/mqtt/test_send_direct_message_service.py @@ -0,0 +1,179 @@ +import logging +import unittest + +import pytest + +from agrirouter import FeedDeleteParameters +from agrirouter.generated.messaging.request.request_pb2 import RequestEnvelope +from agrirouter.messaging.decode import decode_response, decode_details +from agrirouter.messaging.enums import CapabilityType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.messaging import SendMessageService, SendMessageParameters, FeedDeleteService +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.onboarding.response import OnboardResponse +from agrirouter.utils.uuid_util import new_uuid +from tests.common.data_provider import DataProvider +from tests.common.sleeper import Sleeper +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import read_onboard_response + + +class TestSendDirectMessageService(unittest.TestCase): + """ + Test to send the message to a recipient + The existing sender and recipient PEM onboard responses are read using OnboardIntegrationService + """ + _sender = read_onboard_response(Identifier.MQTT_MESSAGES_SENDER[Identifier.PATH]) + _recipient = read_onboard_response(Identifier.MQTT_MESSAGES_RECIPIENT[Identifier.PATH]) + + _messaging_service_for_sender = None + _messaging_service_for_recipient = None + + _callback_for_sender_processed = False + _callback_for_recipient_processed = False + + _log = logging.getLogger(__name__) + _received_messages = None + + @pytest.fixture(autouse=True) + def fixture(self): + # Setup + self._messaging_service_for_sender = MqttMessagingService( + onboarding_response=self._sender, + on_message_callback=self._callback_for_sender()) + + self._messaging_service_for_recipient = MqttMessagingService( + onboarding_response=self._recipient, + on_message_callback=self._callback_for_recipient()) + + # Run the test + yield + + # Tear down + self._messaging_service_for_sender.client.disconnect() + self._messaging_service_for_recipient.client.disconnect() + + self._log.info("Deleting received messages from the feed to have a clean state: %s", + self._received_messages) + self.delete_all_messages_within_the_feed(onboard_response=self._recipient) + + def test_given_valid_message_content_when_sending_message_to_single_recipient_then_the_message_should_be_delivered( + self): + """ + Test for sending the valid message content to a single recipient after enabling IMG_PNG capability with + sender and recipient Open Connection between Recipient and agrirouter is required. The setup between the + sender and the recipient are done before running the test. + """ + + current_sequence_number = SequenceNumberService.next_seq_nr( + self._sender.get_sensor_alternate_id()) + + send_message_parameters = SendMessageParameters( + onboarding_response=self._sender, + technical_message_type=CapabilityType.IMG_PNG.value, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + recipients=[self._recipient.get_sensor_alternate_id()], + base64_message_content=DataProvider.read_base64_encoded_image(), + mode=RequestEnvelope.Mode.Value("DIRECT")) + + send_message_service = SendMessageService(messaging_service=self._messaging_service_for_sender) + send_message_service.send(send_message_parameters) + Sleeper.process_the_message() + + if not self._callback_for_sender_processed: + self._log.error( + "Either the callback for the sender was not processed " + "in time or there was an error during the checks.") + + if not self._callback_for_recipient_processed: + self._log.error( + "Either the callback for the recipient was not processed " + "in time or there was an error during the checks.") + + self.assertTrue(self._callback_for_sender_processed) + self.assertTrue(self._callback_for_recipient_processed) + + def _callback_for_sender(self): + def _inner_function(client, userdata, msg): + """ + Callback to handle the incoming messages from the MQTT broker + """ + self._log.info("Received message for sender from the agrirouter: %s", + msg.payload.decode()) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.type != 1: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error( + f"Received wrong message from the agrirouter: {str(decoded_details)}") + assert decoded_message.response_envelope.response_code == 201 + self._callback_for_sender_processed = True + + return _inner_function + + def _callback_for_recipient(self): + def _inner_function(client, userdata, msg): + """ + Callback to handle the incoming messages from the MQTT broker + """ + self._log.info("Received message for recipient from the agrirouter: %s", + msg.payload.decode()) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.type != 12: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error( + f"Received wrong message from the agrirouter: {str(decoded_details)}") + push_notification = decode_details(decoded_message.response_payload.details) + assert decoded_message.response_envelope.response_code == 200 + assert DataProvider.get_hash( + push_notification.messages[0].content.value) == DataProvider.get_hash( + DataProvider.read_base64_encoded_image()) + + self._callback_for_recipient_processed = True + + return _inner_function + + def delete_all_messages_within_the_feed(self, onboard_response: OnboardResponse): + """ + Delete all messages within the feed. + """ + logging.getLogger(__name__).info( + f"Delete all messages within the feed for endpoint '{self._recipient.get_sensor_alternate_id()}'.") + messaging_service = MqttMessagingService( + onboarding_response=onboard_response, + on_message_callback=self._callback_for_feed_delete()) + + current_sequence_number = SequenceNumberService.next_seq_nr( + onboard_response.get_sensor_alternate_id()) + + delete_message_parameters = FeedDeleteParameters( + onboarding_response=onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + senders=[self._sender.get_sensor_alternate_id()] + ) + + feed_delete_service = FeedDeleteService(messaging_service) + feed_delete_service.send(delete_message_parameters) + + Sleeper.process_the_command() + + def _callback_for_feed_delete(self): + def _inner_function(client, userdata, msg): + """ + Callback to decode Feed Delete Service + """ + self._log.info("Received message after deleting messages: " + str(msg.payload)) + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + delete_details = decode_details(decoded_message.response_payload.details) + self._log.info("Details for the message removal: " + str(delete_details)) + assert decoded_message.response_envelope.response_code == 201 + + return _inner_function diff --git a/tests/service/messaging/mqtt/test_subscription_service.py b/tests/service/messaging/mqtt/test_subscription_service.py new file mode 100644 index 00000000..7852871d --- /dev/null +++ b/tests/service/messaging/mqtt/test_subscription_service.py @@ -0,0 +1,135 @@ +import logging +import unittest + +import pytest + +from agrirouter.generated.messaging.request.payload.endpoint.capabilities_pb2 import CapabilitySpecification +from agrirouter.generated.messaging.request.payload.endpoint.subscription_pb2 import Subscription +from agrirouter.messaging.decode import decode_response, decode_details +from agrirouter.messaging.enums import CapabilityType, CapabilityDirectionType +from agrirouter.messaging.messages import OutboxMessage +from agrirouter.messaging.parameters.service import SubscriptionParameters, CapabilitiesParameters +from agrirouter.messaging.services.commons import MqttMessagingService +from agrirouter.messaging.services.messaging import SubscriptionService, CapabilitiesService +from agrirouter.messaging.services.sequence_number_service import SequenceNumberService +from agrirouter.utils.uuid_util import new_uuid +from tests.common.sleeper import Sleeper +from tests.data.applications import CommunicationUnit +from tests.data.identifier import Identifier +from tests.data.onboard_response_integration_service import read_onboard_response + + +class TestSubscriptionService(unittest.TestCase): + _messaging_service = None + _onboard_response = None + _log = logging.getLogger(__name__) + _callback_processed = False + + @pytest.fixture(autouse=True) + def fixture(self): + # Before each test + self._onboard_response = read_onboard_response(Identifier.MQTT_RECIPIENT_PEM[Identifier.PATH]) + self._send_capabilities() + self._messaging_service = MqttMessagingService(onboarding_response=self._onboard_response, + on_message_callback=self._send_subscription_callback()) + + def _send_capabilities(self): + """ + Send capabilities to the AR with the given messaging service. + """ + self._log.info("Updating capabilities for the test case to ensure a clean state.") + messaging_service = MqttMessagingService(onboarding_response=self._onboard_response, + on_message_callback=self._send_capabilities_callback()) + current_sequence_number = SequenceNumberService.next_seq_nr( + self._onboard_response.get_sensor_alternate_id()) + capabilities_parameters = CapabilitiesParameters( + onboarding_response=self._onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + application_id=CommunicationUnit.application_id, + certification_version_id=CommunicationUnit.certification_version_id, + enable_push_notification=CapabilitySpecification.PushNotification.DISABLED, + capability_parameters=[] + ) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.ISO_11783_TASK_DATA_ZIP.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.IMG_PNG.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.IMG_BMP.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_parameters.capability_parameters.append( + CapabilitySpecification.Capability(technical_message_type=CapabilityType.IMG_JPEG.value, + direction=CapabilityDirectionType.SEND_RECEIVE.value)) + capabilities_service = CapabilitiesService(messaging_service) + capabilities_service.send(capabilities_parameters) + Sleeper.process_the_command() + self.assertTrue(self._callback_processed) + self._callback_processed = False + messaging_service.client.disconnect() + + def _send_capabilities_callback(self): + def _inner_function(client, userdata, msg): + """ + Callback to handle the incoming messages from the MQTT broker + """ + self._log.info( + "Received message from MQTT broker after sending the capabilities, checking the result.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.response_code != 201: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error("Message could not be processed. Response code: " + str( + decoded_message.response_envelope.response_code)) + self._log.error("Message details: " + str(decoded_details)) + assert decoded_message.response_envelope.response_code == 201 + self._callback_processed = True + + return _inner_function + + def test_when_sending_subscriptions_for_pem_recipient_then_the_server_should_accept_them(self): + """ + Sending subscriptions via mqtt with the existing onboard response and callback as arguments + """ + self._log.info("Sending subscriptions via mqtt with the existing onboard response and callback as arguments.") + current_sequence_number = SequenceNumberService.next_seq_nr( + self._onboard_response.get_sensor_alternate_id()) + subscription_service = SubscriptionService(self._messaging_service) + technical_msg_type = CapabilityType.IMG_PNG.value + subscription_item = Subscription.MessageTypeSubscriptionItem(technical_message_type=technical_msg_type) + subscription_parameters = SubscriptionParameters( + subscription_items=[subscription_item], + onboarding_response=self._onboard_response, + application_message_id=new_uuid(), + application_message_seq_no=current_sequence_number, + ) + subscription_service.send(subscription_parameters) + Sleeper.process_the_command() + + if not self._callback_processed: + self._log.error( + "Either the subscription callback was not processed in time or there was an error during the checks.") + + self.assertTrue(self._callback_processed) + self._callback_processed = False + + def _send_subscription_callback(self): + def _inner_function(client, userdata, msg): + """ + Callback to handle the incoming messages from the MQTT broker + """ + self._log.info( + "Received message from MQTT broker after sending the subscriptions, checking the result.") + outbox_message = OutboxMessage() + outbox_message.json_deserialize(msg.payload.decode().replace("'", '"')) + decoded_message = decode_response(outbox_message.command.message.encode()) + if decoded_message.response_envelope.response_code != 201: + decoded_details = decode_details(decoded_message.response_payload.details) + self._log.error("Message details: " + str(decoded_details)) + assert decoded_message.response_envelope.response_code == 201 + self._callback_processed = True + + return _inner_function diff --git a/tests/sleeper.py b/tests/sleeper.py deleted file mode 100644 index 9d4179ac..00000000 --- a/tests/sleeper.py +++ /dev/null @@ -1,5 +0,0 @@ -import time - - -def let_agrirouter_process_the_message(seconds: int = 3): - time.sleep(seconds)