Skip to content

Accounting

API reference for diameter.message.commands.accounting.

This module contains Accounting Request and Answer messages, implementing AVPs documented in rfc6733.

Accounting

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

Bases: DefinedMessage

An Accounting 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 Accounting.find_avps search method.

Examples:

AVPs accessible either as instance attributes or by searching:

>>> msg = Message.from_bytes(b"...")
>>> msg.session_id
dra1.mvno.net;2323;546
>>> msg.find_avps((AVP_SESSION_ID, 0))
['dra1.mvno.net;2323;546']

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

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

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

>>> msg = AccountingRequest()
>>> msg.session_id = "dra1.mvno.net;2323;546"

Other, custom AVPs can be appended to the message using the Accounting.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.

AccountingAnswer

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

Bases: Accounting

An Accounting-Answer message.

accounting_realtime_required instance-attribute

accounting_realtime_required: int

accounting_record_number instance-attribute

accounting_record_number: int

accounting_record_type instance-attribute

accounting_record_type: int

accounting_sub_session_id instance-attribute

accounting_sub_session_id: int

acct_application_id instance-attribute

acct_application_id: int

acct_interim_interval instance-attribute

acct_interim_interval: int

acct_multi_session_id instance-attribute

acct_multi_session_id: str

acct_session_id instance-attribute

acct_session_id: bytes

error_message instance-attribute

error_message: str

error_reporting_host instance-attribute

error_reporting_host: bytes

event_timestamp instance-attribute

event_timestamp: datetime

failed_avp instance-attribute

failed_avp: FailedAvp

nas_identifier instance-attribute

nas_identifier: str

nas_ip_address instance-attribute

nas_ip_address: bytes

nas_ipv6_address instance-attribute

nas_ipv6_address: bytes

nas_port instance-attribute

nas_port: int

nas_port_id instance-attribute

nas_port_id: str

nas_port_type instance-attribute

nas_port_type: int

origin_aaa_protocol instance-attribute

origin_aaa_protocol: int

origin_host instance-attribute

origin_host: bytes

origin_realm instance-attribute

origin_realm: bytes

origin_state_id instance-attribute

origin_state_id: int

proxy_info instance-attribute

proxy_info: list[ProxyInfo]

result_code instance-attribute

result_code: int

service_type instance-attribute

service_type: int

session_id instance-attribute

session_id: str

state_class instance-attribute

state_class: list[bytes]

termination_cause instance-attribute

termination_cause: bytes

user_name instance-attribute

user_name: str

vendor_specific_application_id instance-attribute

vendor_specific_application_id: VendorSpecificApplicationId

AccountingRequest

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

Bases: Accounting

An Accounting-Request message.

accounting_auth_method instance-attribute

accounting_auth_method: int

accounting_input_octets instance-attribute

accounting_input_octets: int

accounting_input_packets instance-attribute

accounting_input_packets: int

accounting_output_octets instance-attribute

accounting_output_octets: int

accounting_output_packets instance-attribute

accounting_output_packets: int

accounting_realtime_required instance-attribute

accounting_realtime_required: int

accounting_record_number instance-attribute

accounting_record_number: int

accounting_record_type instance-attribute

accounting_record_type: int

accounting_sub_session_id instance-attribute

accounting_sub_session_id: int

acct_application_id instance-attribute

acct_application_id: int

acct_authentic instance-attribute

acct_authentic: int

acct_interim_interval instance-attribute

acct_interim_interval: int
acct_link_count: int

acct_multi_session_id instance-attribute

acct_multi_session_id: str

acct_session_id instance-attribute

acct_session_id: bytes

acct_session_time instance-attribute

acct_session_time: int

acct_tunnel_connection instance-attribute

acct_tunnel_connection: bytes

acct_tunnel_packets_lost instance-attribute

acct_tunnel_packets_lost: int

application_server_information instance-attribute

application_server_information: list[ApplicationServerInformation]

authorised_qos instance-attribute

authorised_qos: str

authorization_lifetime instance-attribute

authorization_lifetime: int

bearer_service instance-attribute

bearer_service: bytes

callback_id instance-attribute

callback_id: str

callback_number instance-attribute

callback_number: str

called_party_address instance-attribute

called_party_address: str

called_station_id instance-attribute

called_station_id: str

calling_party_address instance-attribute

calling_party_address: str

calling_station_id instance-attribute

calling_station_id: str

cause instance-attribute

cause: Cause

connection_info instance-attribute

connection_info: list[str]

destination_host instance-attribute

destination_host: bytes

destination_realm instance-attribute

destination_realm: bytes

event_timestamp instance-attribute

event_timestamp: datetime

event_type instance-attribute

event_type: EventType

filter_id instance-attribute

filter_id: list[str]
framed_appletalk_link: int

framed_appletalk_network instance-attribute

framed_appletalk_network: list[int]

framed_appletalk_zone instance-attribute

framed_appletalk_zone: bytes

framed_compression instance-attribute

framed_compression: list[int]

framed_interface_id instance-attribute

framed_interface_id: int

framed_ip_address instance-attribute

framed_ip_address: bytes

framed_ipv6_pool instance-attribute

framed_ipv6_pool: bytes

framed_ipv6_prefix instance-attribute

framed_ipv6_prefix: list[bytes]

framed_ipv6_route instance-attribute

framed_ipv6_route: list[str]

framed_ipx_network instance-attribute

framed_ipx_network: int

framed_mtu instance-attribute

framed_mtu: int

framed_pool instance-attribute

framed_pool: bytes

framed_protocol instance-attribute

framed_protocol: int

framed_route instance-attribute

framed_route: list[str]

framed_routing instance-attribute

framed_routing: int

ggsn_address instance-attribute

ggsn_address: str

idle_timeout instance-attribute

idle_timeout: int

ims_charging_identifier instance-attribute

ims_charging_identifier: str

inter_operator_identifier instance-attribute

inter_operator_identifier: list[InterOperatorIdentifier]

login_ip_host instance-attribute

login_ip_host: list[str]

login_ipv6_host instance-attribute

login_ipv6_host: list[bytes]

login_lat_group instance-attribute

login_lat_group: bytes

login_lat_node instance-attribute

login_lat_node: bytes

login_lat_port instance-attribute

login_lat_port: str

login_lat_service instance-attribute

login_lat_service: bytes

login_service instance-attribute

login_service: int

login_tcp_port instance-attribute

login_tcp_port: int

nas_filter_rule instance-attribute

nas_filter_rule: list[bytes]

nas_identifier instance-attribute

nas_identifier: str

nas_ip_address instance-attribute

nas_ip_address: bytes

nas_ipv6_address instance-attribute

nas_ipv6_address: bytes

nas_port instance-attribute

nas_port: int

nas_port_id instance-attribute

nas_port_id: str

nas_port_type instance-attribute

nas_port_type: int

origin_aaa_protocol instance-attribute

origin_aaa_protocol: int

origin_host instance-attribute

origin_host: bytes

origin_realm instance-attribute

origin_realm: bytes

origin_state_id instance-attribute

origin_state_id: int

originating_line_info instance-attribute

originating_line_info: bytes

port_limit instance-attribute

port_limit: int

proxy_info instance-attribute

proxy_info: list[ProxyInfo]

qos_filter_rule instance-attribute

qos_filter_rule: list[bytes]

role_of_node instance-attribute

role_of_node: int

route_record instance-attribute

route_record: list[bytes]

sdp_media_component instance-attribute

sdp_media_component: list[SdpMediaComponent]

sdp_session_description instance-attribute

sdp_session_description: list[str]

served_party_ip_address instance-attribute

served_party_ip_address: str

server_capabilities instance-attribute

server_capabilities: ServerCapabilities

service_id instance-attribute

service_id: str

service_type instance-attribute

service_type: int

session_id instance-attribute

session_id: str

session_timeout instance-attribute

session_timeout: int

state_class instance-attribute

state_class: list[bytes]

termination_cause instance-attribute

termination_cause: bytes

time_stamps instance-attribute

time_stamps: TimeStamps

trunk_group_id instance-attribute

trunk_group_id: TrunkGroupId

tunneling instance-attribute

tunneling: list[Tunneling]

user_name instance-attribute

user_name: str

user_session_id instance-attribute

user_session_id: str

vendor_specific_application_id instance-attribute

vendor_specific_application_id: VendorSpecificApplicationId