Dynamic data services Python API

Table: Dynamic data services functions in the alc.dyn module describes the functions available in the SR OS alc.dyn Python module to create dynamic data services.

Table: Dynamic data services functions in the alc.dyn module
alc.dyn functions Description

dyn.action (dictionary)

Executes the setup, modify or teardown function that is found with a lookup in the specified dictionary using the function-key present in the script parameters. The script-parameters can be obtained from RADIUS in the Alc-Dyn-Serv-Script-Params VSA or can be configured in the local authentication database. The action (setup, modify or teardown) is determined from the Alc-Dyn-Script-Action VSA.

Returns: None (no value)

dictionary - Python dictionary with format:

dictionary = {function-key-1 : (setup-function-1, modify-function-1|None, revert-function-1|None, teardown-function-1), …, function-key-n : (setup-function-n, modify-function-n|None, revert-function-n|None, teardown-function-n) }

where:

  • setup-function-n: name of the function invoked when Alc-Dyn-Serv-Script-Action=setup

  • modify-function-n: name of the function invoked when Alc-Dyn-Serv-Script-Action=modify. The modify function is optional. When not specified, the keyword ‟None” should be used in the dictionary.

  • revert-function-n: name of the function invoked when modify script execution failed. This function must undo all changes from the modify function. The revert function is optional. When not specified, the keyword ‟None” should be used in the dictionary.

  • teardown-function-n: name of the function invoked when Alc-Dyn-Serv-Script-Action=teardown

dyn.add_cli (string)

Executes the specified CLI commands to create the dynamic data service

Returns: None (no value)

string - CLI commands. The string can span multiple lines in the script when enclosed in three double quotes (""").

dyn.get_circuit-id()

Returns a string containing the control channel circuit-id (DHCP relay agent option 82 or PPP tags)

dyn.get_remote-id()

Returns a string containing the control channel remote-id (DHCP relay agent option 82 or PPP tags)

dyn.get_sap()

Returns a string containing the dynamic data service sap-id: the value of the Alc-DynServ-SAP-ID VSA. A wildcard hash (#) in the VSA value is replaced with the corresponding control channel or data trigger port or vlan-id field.

dyn.reference (function-key, reference-id, dictionary)

Create a dynamic reference to another function in the script. Typically used to create n:1 relations between dynamic data services, such as multiple SAPs in a VPLS service or multiple services for the same customer.

Dynamic referencing is only allowed in setup functions. Corresponding teardown functions automatically dereference.

Returns a dictionary provided by the setup script matching the function-key:

function-key is the key in the action dictionary (see dyn.action) to find the corresponding setup or teardown functions.

reference-id is the unique reference ID string that identifies the dynamic reference (for example, all SAPs from a VPLS service would have the same reference id).

dictionary is a Python dictionary containing parameters for use in the setup or teardown function, such as to generate CLI output.

dyn.select_free_id (type)

Returns a string representing a free identifier of the specified type.

type is identifier type that is returned:

  • service-id” obtains a free service ID in the configured dynamic-services service-range

  • ip-filter-id” generates a new ip-filter identifier

  • ipv6-filter-id” generates a new ipv6-filter identifier

  • mac-filter-id” generates a new mac-filter identifier

The corresponding filters are shown in the system as ‟_tmnx_dyn_<number>”