Peter Carter
and 1 contributors

NAME

Net::TL1UDP - Transaction Language 1 (TL-1) UDP Interface

SYNOPSIS

use Net::TL1UDP;

if (node_login('172.29.84.168', 'MYUSER', 'MYPASSWORD')) { print tl1_cmd('RTRV-EQPT::ALL'); print retrieve_sid; logoff; }

DESCRIPTION

Net::TL1UDP provides subroutines that communicate directly to a TL-1 device using UDP. Most TL-1 modules open a telnet session to a TL-1 gateway and use it to communicate with the device. This module communicates directly with the device.

Net::TL1UDP has been used to communicate with the Alcatel 7300, the Alcatel 7330, and the Alcatel 7342.

node_login ('DEVICE[:PORT]', 'USERNAME', 'PASSWORD')

Subroutine to log into the device. The subroutine is using the following TL-1 command: ACT-USER::(USERNAME):::(PASSWORD). The default UDP port number is 13001 but can be changed by providing it, preceded by a colon, after the device's IP address or hostname.

If a "logged on" message is received, the subroutine returns a "1"; otherwise, it returns a "0".

tl1_cmd ('TL-1_COMMAND')

Sends a TL-1 command to the device. The result will be an ASCII string containing the response to the command or a "0" (if the command times out or if the login subroutine was not executed).

tl1_cmdf ('TL-1_COMMAND')

Sends a TL-1 command to the device. The result will be a formatted ASCII string containing the response to the command or a "0" (if the command times out or if the login subroutine was not executed).

If the command is successful (COMPLD), it strips off any response data that is NOT encapsulated in double quotation marks and removes the quotation marks as well (returning the "real" data from the response). If the response did not contain anything encapsulated in double quotation marks, it will simply return "COMPLD".

If the command is unsuccessful (DENY), it will return the complete unformatted response.

debug_file ('path_to/debug_file')

Creates a debug file that contains the TL-1 commands and responses.

close_debug

Closes the debug file. If this function is not called, the debug file will be closed (automatically) when the script finishes.

retrieve_sid

Returns the System ID (SID) of the device if it can be determined.

retrieve_ctag

Returns the current correlation tag (ctag) used by the module.

command_timeout ([TIMEOUT_SECS])

Returns the current command timeout (in seconds). Optionally, if TIMEOUT_SECS is provided, the timeout value can be changed.

The default timeout is 60 seconds.

e.g. - command_timeout (120)

timeout_counter ([NUMBER])

Returns the current number of commands that timed out (no response within the command timeout period). Optionally, if NUMBER is provided, the counter value can be changed (e.g. - reset to 0).

e.g. - timeout_counter ()

inhibit_messages ([01])

By default, TL1UDP inhibits all autonomous messages (INH-MSG-ALL) when you log into the device. If you want to allow autonomous messages, set inhibit_messages(0) or send the "ALW-MSG-ALL::ALL" command. To inhibit messages again, set inhibit_messages(1) or send the "INH-MSG-ALL::ALL" command.

NOTE: Allowing autonomous messages could affect responses to your commands.

Since TL1UDP uses a semicolon on a line by itself to determine the end of a response, a long response that is interrupted by an autonomous message (which also contains a semicolon on a line by itself) may cause the response to be terminated prematurely.

sarb_retry_limit ([NUMBER])

Returns the current (maximum) number of command retries that will be performed due to a "Status, All Resources Busy" (SARB) response. Optionally, if NUMBER is provided, the maximum value can be changed.

The default number of retries is 0.

e.g. - sarb_retry_limit ()

sarb_retry_delay ([DELAY_SECS])

Returns the current delay, in seconds, between command retries that will be performed due to a "Status, All Resources Busy" (SARB) response. Optionally, if DELAY_SECS is provided, the delay can be changed.

If the "sarb_retry_limit" is 0, this parameter is ignored.

The default delay is 0 seconds.

e.g. - sarb_retry_limit ()

logoff

Sends a logoff command to the device

AUTHOR

Peter Carter <pelmerc@gmail.com>

COPYRIGHT

Copyright (c) 2013-2018 Peter Carter. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.