devices.models ============== .. py:module:: devices.models .. autoapi-nested-parse:: This modules contains all models specific to the device abstractions. Module Contents --------------- .. py:class:: DeviceModel(*args, **kwargs) Bases: :py:obj:`util.db.CustomDeleteActionModel` The DeviceModel. .. py:attribute:: common_name .. py:attribute:: serial_number .. py:attribute:: ip_address .. py:attribute:: opc_server_port .. py:attribute:: domain .. py:attribute:: onboarding_config .. py:attribute:: no_onboarding_config .. py:class:: DeviceType(*args, **kwds) Bases: :py:obj:`django.db.models.IntegerChoices` Enum for device type. .. py:attribute:: GENERIC_DEVICE .. py:attribute:: OPC_UA_GDS .. py:attribute:: OPC_UA_GDS_PUSH .. py:attribute:: device_type .. py:attribute:: created_at .. py:attribute:: opc_gds_push_enable_periodic_update .. py:attribute:: opc_gds_push_renewal_interval .. py:attribute:: opc_gds_push_last_update_scheduled_at .. py:method:: pre_delete() Delete all issued credentials for this device before deleting the device itself. .. py:property:: est_username :type: str Gets the EST username. .. py:method:: clean() Validation before saving the model. .. py:method:: schedule_next_gds_push_update() Schedule the next periodic GDS Push server certificate and trustlist update using Django-Q2. Creates a one-off scheduled task in Django-Q2 that will execute at the calculated time based on the configured renewal interval. Does nothing when periodic updates are disabled or the device is not of type OPC UA GDS Push. .. py:class:: RemoteDeviceCredentialDownloadModel(*args, **kwargs) Bases: :py:obj:`django.db.models.Model` Model to associate a credential model with an OTP and token for unauthenticated remoted download. .. py:attribute:: BROWSER_MAX_OTP_ATTEMPTS :value: 3 .. py:attribute:: TOKEN_VALIDITY .. py:attribute:: issued_credential_model .. py:attribute:: otp .. py:attribute:: device .. py:attribute:: attempts .. py:attribute:: download_token .. py:attribute:: token_created_at .. py:class:: Meta Bases: :py:obj:`django_stubs_ext.db.models.TypedModelMeta` Meta class configuration. .. py:method:: save(*args, **kwargs) Generates a new random OTP on initial save of the model. .. py:method:: get_otp_display() Return the OTP in the format 'credential_id.otp' for display within the admin view. :returns: The str to display. .. py:method:: check_otp(otp) Check if the provided OTP matches the stored OTP. :param otp: The OTP to check. :returns: True if the OTP is valid, False otherwise. .. py:method:: check_token(token) Check if the provided token matches the stored token and whether it is still valid. :param token: The token to check. :returns: True if the token is valid, false otherwise.