devices.formsΒΆ

Forms exclusively used in the device application.

AttributesΒΆ

ClassesΒΆ

CredentialDownloadForm

Form to download a credential.

BaseCredentialForm

Base form for issuing credentials.

BaseServerCredentialForm

Base form for issuing server credentials.

IssueDomainCredentialForm

Form to issue a new domain credential.

IssueTlsClientCredentialForm

Form to issue a new TLS client credential.

IssueTlsServerCredentialForm

Form to issue a new TLS server credential.

ApplicationUriFormMixin

Adds a application_uri field to the form.

IssueOpcUaClientCredentialForm

Form to issue a new OPC UA client credential.

IssueOpcUaServerCredentialForm

Form to issue a new OPC UA server credential.

IssueOpcUaGdsPushDomainCredentialForm

Form to issue a new OPC UA GDS Push domain credential.

BrowserLoginForm

Form for the browser login via OTP for remote credential download.

RevokeIssuedCredentialForm

Form to revoke a specific issued credential.

RevokeDevicesForm

Form to revoke a issued credentials associated with a specific device.

DeleteDevicesForm

Form to delete the requested devices.

NoOnboardingCreateForm

Form for device or OPC UA GDS object creation without onboarding.

OnboardingCreateForm

Form for device or OPC UA GDS object creation with onboarding.

OpcUaGdsPushCreateForm

Form for OPC UA GDS Push device creation with onboarding.

ClmDeviceModelOnboardingForm

CLM Device Model form for devices that use onboarding.

ClmDeviceModelOpcUaGdsPushOnboardingForm

CLM Device Model form for OPC UA GDS Push devices that use onboarding.

ClmDeviceModelNoOnboardingForm

CLM Device Model form for devices that do not use onboarding.

OpcUaGdsPushTruststoreAssociationForm

Form for associating a truststore with an OPC UA GDS Push device's onboarding configuration.

FunctionsΒΆ

_get_secret([number_of_symbols])

Generates a secret with the number of symbols provided.

Module ContentsΒΆ

devices.forms.PASSWORD_MIN_LENGTH = 12[source]ΒΆ
devices.forms.OTP_SPLIT_PARTS = 2[source]ΒΆ
devices.forms.ONBOARDING_PROTOCOLS_ALLOWED_FOR_FORMS[source]ΒΆ
devices.forms._get_secret(number_of_symbols=16)[source]ΒΆ

Generates a secret with the number of symbols provided.

Parameters:

number_of_symbols (int) – Number of symbols of the generated secret. Defaults to 16.

Returns:

The generated secret.

Return type:

str

class devices.forms.CredentialDownloadForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: django.forms.Form

Form to download a credential.

password[source]ΒΆ
static get_suggested_password(length=16)[source]ΒΆ

Generates a secure suggested password.

Parameters:

length (int) – Length of the password to generate. Defaults to 16.

Returns:

A secure random password string.

Return type:

str

clean()[source]ΒΆ

Checks if the passwords match and if the password is long enough.

Return type:

dict[str, Any]

class devices.forms.BaseCredentialForm(*args, device, **kwargs)[source]ΒΆ

Bases: django.forms.Form

Base form for issuing credentials.

Parameters:
common_name[source]ΒΆ
pseudonym[source]ΒΆ
domain_component[source]ΒΆ
serial_number[source]ΒΆ
validity[source]ΒΆ
device[source]ΒΆ
clean_common_name()[source]ΒΆ

Checks the common name.

Return type:

str

clean_validity()[source]ΒΆ

Checks the validity.

Return type:

int

class devices.forms.BaseServerCredentialForm(*args, device, **kwargs)[source]ΒΆ

Bases: BaseCredentialForm

Base form for issuing server credentials.

Parameters:
ipv4_addresses[source]ΒΆ
ipv6_addresses[source]ΒΆ
domain_names[source]ΒΆ
clean_ipv4_addresses()[source]ΒΆ

Checks the IPv4 addresses.

Return type:

list[ipaddress.IPv4Address]

clean_ipv6_addresses()[source]ΒΆ

Checks the IPv6 addresses.

Return type:

list[ipaddress.IPv6Address]

clean_domain_names()[source]ΒΆ

Checks the domain names.

Return type:

list[str]

clean()[source]ΒΆ

Ensures at least one SAN entry is set.

Return type:

dict[str, Any]

class devices.forms.IssueDomainCredentialForm(*args, device, **kwargs)[source]ΒΆ

Bases: BaseCredentialForm

Form to issue a new domain credential.

Parameters:
class devices.forms.IssueTlsClientCredentialForm(*args, device, **kwargs)[source]ΒΆ

Bases: BaseCredentialForm

Form to issue a new TLS client credential.

Parameters:
class devices.forms.IssueTlsServerCredentialForm(*args, device, **kwargs)[source]ΒΆ

Bases: BaseServerCredentialForm

Form to issue a new TLS server credential.

Parameters:
class devices.forms.ApplicationUriFormMixin(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: django.forms.Form

Adds a application_uri field to the form.

application_uri[source]ΒΆ
clean_application_uri()[source]ΒΆ

Checks if the application uri was set properly.

Returns:

The application uri.

Return type:

str

class devices.forms.IssueOpcUaClientCredentialForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: ApplicationUriFormMixin, BaseCredentialForm

Form to issue a new OPC UA client credential.

class devices.forms.IssueOpcUaServerCredentialForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: ApplicationUriFormMixin, BaseServerCredentialForm

Form to issue a new OPC UA server credential.

class devices.forms.IssueOpcUaGdsPushDomainCredentialForm(*args, device, **kwargs)[source]ΒΆ

Bases: ApplicationUriFormMixin, BaseCredentialForm

Form to issue a new OPC UA GDS Push domain credential.

Parameters:
class devices.forms.BrowserLoginForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: django.forms.Form

Form for the browser login via OTP for remote credential download.

otp[source]ΒΆ
clean()[source]ΒΆ

Cleans the form data, extracting the credential ID and OTP.

Return type:

dict[str, Any]

class devices.forms.RevokeIssuedCredentialForm[source]ΒΆ

Bases: django.forms.ModelForm[pki.models.certificate.RevokedCertificateModel]

Form to revoke a specific issued credential.

class Meta[source]ΒΆ

Meta class configuration.

model[source]ΒΆ
fields = ('revocation_reason',)[source]ΒΆ
class devices.forms.RevokeDevicesForm[source]ΒΆ

Bases: django.forms.ModelForm[pki.models.certificate.RevokedCertificateModel]

Form to revoke a issued credentials associated with a specific device.

class Meta[source]ΒΆ

Meta class configuration.

model[source]ΒΆ
fields = ('revocation_reason',)[source]ΒΆ
pks[source]ΒΆ
class devices.forms.DeleteDevicesForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: django.forms.Form

Form to delete the requested devices.

pks[source]ΒΆ
class devices.forms.NoOnboardingCreateForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

Form for device or OPC UA GDS object creation without onboarding.

Parameters:
  • args (Any)

  • kwargs (Any)

common_name[source]ΒΆ
serial_number[source]ΒΆ
domain_queryset: django.db.models.query.QuerySet[pki.models.domain.DomainModel][source]ΒΆ
domain[source]ΒΆ
no_onboarding_pki_protocols[source]ΒΆ
helper[source]ΒΆ
clean_common_name()[source]ΒΆ

Validates the device name, i.e. checks if it is unique.

Parameters:

common_name – The desired name of the new device.

Returns:

The device name if it passed the checks.

Return type:

str

save(device_type)[source]ΒΆ

Stores the form as devie model object in the db.

Parameters:

device_type (devices.models.DeviceModel.DeviceType) – The device type to set. Defaults to None.

Returns:

_description_

Return type:

devices.models.DeviceModel

class devices.forms.OnboardingCreateForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

Form for device or OPC UA GDS object creation with onboarding.

Parameters:
  • args (Any)

  • kwargs (Any)

common_name[source]ΒΆ
serial_number[source]ΒΆ
domain_queryset: django.db.models.query.QuerySet[pki.models.domain.DomainModel][source]ΒΆ
domain[source]ΒΆ
onboarding_protocol[source]ΒΆ
onboarding_pki_protocols[source]ΒΆ
helper[source]ΒΆ
clean_common_name()[source]ΒΆ

Validates the device name, i.e. checks if it is unique.

Parameters:

common_name – The desired name of the new device.

Returns:

The device name if it passed the checks.

Return type:

str

save(device_type)[source]ΒΆ

Stores the form as device model object in the db.

Parameters:

device_type (devices.models.DeviceModel.DeviceType) – The device type to set. Defaults to None.

Returns:

_description_

Return type:

devices.models.DeviceModel

class devices.forms.OpcUaGdsPushCreateForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

Form for OPC UA GDS Push device creation with onboarding.

Parameters:
  • args (Any)

  • kwargs (Any)

common_name[source]ΒΆ
serial_number[source]ΒΆ
domain_queryset: django.db.models.query.QuerySet[pki.models.domain.DomainModel][source]ΒΆ
domain[source]ΒΆ
ip_address[source]ΒΆ
opc_server_port[source]ΒΆ
opc_user[source]ΒΆ
opc_password[source]ΒΆ
helper[source]ΒΆ
clean_common_name()[source]ΒΆ

Validates the device name, i.e. checks if it is unique.

Parameters:

common_name – The desired name of the new device.

Returns:

The device name if it passed the checks.

Return type:

str

save(device_type)[source]ΒΆ

Stores the form as device model object in the db.

Parameters:

device_type (devices.models.DeviceModel.DeviceType) – The device type to set.

Returns:

The created DeviceModel.

Return type:

devices.models.DeviceModel

class devices.forms.ClmDeviceModelOnboardingForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

CLM Device Model form for devices that use onboarding.

Parameters:
  • args (Any)

  • kwargs (Any)

common_name[source]ΒΆ
serial_number[source]ΒΆ
domain_queryset: django.db.models.query.QuerySet[pki.models.domain.DomainModel][source]ΒΆ
domain[source]ΒΆ
onboarding_protocol[source]ΒΆ
onboarding_status[source]ΒΆ
pki_protocol_cmp[source]ΒΆ
pki_protocol_est[source]ΒΆ
instance: devices.models.DeviceModel[source]ΒΆ
helper[source]ΒΆ
clean_common_name()[source]ΒΆ

Validates the device name, i.e. checks if it is unique.

Returns:

The device name if it passed the checks.

Return type:

str

save(onboarding_protocol)[source]ΒΆ

Saves the changes to DB.

Parameters:

onboarding_protocol (onboarding.models.OnboardingProtocol)

Return type:

None

class devices.forms.ClmDeviceModelOpcUaGdsPushOnboardingForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

CLM Device Model form for OPC UA GDS Push devices that use onboarding.

Parameters:
  • args (Any)

  • kwargs (Any)

common_name[source]ΒΆ
serial_number[source]ΒΆ
domain_queryset: django.db.models.query.QuerySet[pki.models.domain.DomainModel][source]ΒΆ
domain[source]ΒΆ
ip_address[source]ΒΆ
opc_server_port[source]ΒΆ
opc_user[source]ΒΆ
opc_password[source]ΒΆ
truststore_queryset: django.db.models.query.QuerySet[pki.models.truststore.TruststoreModel][source]ΒΆ
opc_trust_store[source]ΒΆ
onboarding_protocol[source]ΒΆ
onboarding_status[source]ΒΆ
pki_protocol_opc_gds_push[source]ΒΆ
instance: devices.models.DeviceModel[source]ΒΆ
helper[source]ΒΆ
save()[source]ΒΆ

Saves the changes to DB.

Return type:

None

class devices.forms.ClmDeviceModelNoOnboardingForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

CLM Device Model form for devices that do not use onboarding.

Parameters:
  • args (Any)

  • kwargs (Any)

common_name[source]ΒΆ
serial_number[source]ΒΆ
domain_queryset: django.db.models.query.QuerySet[pki.models.domain.DomainModel][source]ΒΆ
domain[source]ΒΆ
pki_protocol_cmp[source]ΒΆ
pki_protocol_est[source]ΒΆ
pki_protocol_manual[source]ΒΆ
instance: devices.models.DeviceModel[source]ΒΆ
helper[source]ΒΆ
clean_common_name()[source]ΒΆ

Validates the device name, i.e. checks if it is unique.

Returns:

The device name if it passed the checks.

Return type:

str

save()[source]ΒΆ

Saves the changes to DB.

Return type:

None

class devices.forms.OpcUaGdsPushTruststoreAssociationForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

Form for associating a truststore with an OPC UA GDS Push device’s onboarding configuration.

Parameters:
  • args (Any)

  • kwargs (Any)

truststore_queryset: django.db.models.query.QuerySet[pki.models.truststore.TruststoreModel][source]ΒΆ
opc_trust_store[source]ΒΆ
instance: devices.models.DeviceModel[source]ΒΆ
helper[source]ΒΆ
save()[source]ΒΆ

Saves the truststore association to the device’s onboarding config.

Return type:

None