Skip to content

Capabilities Exchange

API reference for diameter.message.commands.capabilities_exchange.

This module contains Capabilities-Exchange Request and Answer messages, implementing AVPs documented in rfc6733.

CapabilitiesExchange

CapabilitiesExchange(
    header: MessageHeader = None, avps: list[Avp] = None
)

Bases: DefinedMessage

A Capabilities-Exchange message.

This message class lists message attributes based on the current RFC6733 as python properties, acessible as instance attributes. AVPs not listed in the base protocol can be retrieved using the CapabilitiesExchange.find_avps search method.

Examples:

AVPs accessible either as instance attributes or by searching:

>>> msg = Message.from_bytes(b"...")
>>> msg.origin_realm
b'mvno.net'
>>> msg.find_avps((AVP_ORIGIN_REALM, 0))
[b'mvno.net']

When diameter message is decoded using Message.from_bytes, it returns either an instance of CapabilitiesExchangeRequest or CapabilitiesExchangeAnswer automatically:

>>> msg = Message.from_bytes(b"...")
>>> assert msg.header.is_request is True
>>> assert isinstance(msg, CapabilitiesExchangeRequest)

When creating a new message, the CapabilitiesExchangeRequest or CapabilitiesExchangeAnswer class should be instantiated directly, and values for AVPs set as class attributes:

>>> msg = CapabilitiesExchangeRequest()
>>> msg.origin_realm = b"mvno.net"

Other, custom AVPs can be appended to the message using the CapabilitiesExchange.append_avp method, or by overwriting the avp attribute entirely. Regardless of the custom AVPs set, the mandatory values listed in RFC6733 must be set, however they can be set as None, if they are not to be used.

Warning

Every AVP documented for the subclasses of this command can be accessed as an instance attribute, even if the original network-received message did not contain that specific AVP. Such AVPs will be returned with the value None when accessed.

Every other AVP not mentioned here, and not present in a network-received message will raise an AttributeError when being accessed; their presence should be validated with hasattr before accessing.

CapabilitiesExchangeAnswer

CapabilitiesExchangeAnswer(
    header: MessageHeader = None, avps: list[Avp] = None
)

Bases: CapabilitiesExchange

A Capabilities-Exchange-Answer message.

acct_application_id instance-attribute

acct_application_id: list[int]

auth_application_id instance-attribute

auth_application_id: list[int]

error_message instance-attribute

error_message: str

failed_avp instance-attribute

failed_avp: FailedAvp

firmware_revision instance-attribute

firmware_revision: int

host_ip_address instance-attribute

host_ip_address: list[str]

inband_security_id instance-attribute

inband_security_id: list[int]

origin_host instance-attribute

origin_host: bytes

origin_realm instance-attribute

origin_realm: bytes

origin_state_id instance-attribute

origin_state_id: int

product_name instance-attribute

product_name: str

result_code instance-attribute

result_code: int

supported_vendor_id instance-attribute

supported_vendor_id: list[int]

vendor_id instance-attribute

vendor_id: int

vendor_specific_application_id instance-attribute

vendor_specific_application_id: list[VendorSpecificApplicationId]

CapabilitiesExchangeRequest

CapabilitiesExchangeRequest(
    header: MessageHeader = None, avps: list[Avp] = None
)

Bases: CapabilitiesExchange

A Capabilities-Exchange-Request message.

acct_application_id instance-attribute

acct_application_id: list[int]

auth_application_id instance-attribute

auth_application_id: list[int]

firmware_revision instance-attribute

firmware_revision: int

host_ip_address instance-attribute

host_ip_address: list[str]

inband_security_id instance-attribute

inband_security_id: list[int]

origin_host instance-attribute

origin_host: bytes

origin_realm instance-attribute

origin_realm: bytes

origin_state_id instance-attribute

origin_state_id: int

product_name instance-attribute

product_name: str

supported_vendor_id instance-attribute

supported_vendor_id: list[int]

vendor_id instance-attribute

vendor_id: int

vendor_specific_application_id instance-attribute

vendor_specific_application_id: list[VendorSpecificApplicationId]