Documentation for PythonAPI
22.40.00py2

packetlogic2.pldb.sysdiag

This module contains functionality for accessing System Diagnostics

Do NOT import this module directly. The PLConnection object should be used, e.g:

>>> import packetlogic2
>>> pl = packetlogic2.connect("192.168.1.25", "admin", "password")
>>> ht = pl.SysDiag()

Classes defined here:

  • SysDiagZone - Information about a System Diagnostiscs Zone

SysDiag

Undocumented!
Inherits from: Resource
Methods:
close(self)
Immediately disconnects the resource
commit(self, message='PythonAPI commit')
Store the current transaction to the database
log_clear(self)
Clear the system diagnostics log
list of SysDiagLogEntry log_list(self, only_new=False, min_id=0)
Lists system diagnostics log entries
log_post(self, severity, title, body)
Post a new entry to the System Diagnostics log
list of SysDiagMallocUsageEntry malloc_usage_list(self)
Lists system diagnostics malloc usage entries
ping(self, string='')
Send a command to server to test if it is up
tuple of (str, int) protocol(self, protocol, strict=False)
Translate protocol name OR number to tuple with name AND number
dict of str:int and int:str protocols_dict(self)
Returns a dictionary with name:nr and nr:name items for IP protocols
rollback(self)
Abort the current transaction and discard the data
services_cmd(self, services=[], props=[])
Send services to pldbd
list of str services_list(self)
List all services
list of str services_prop_list(self)
List all properties
wait_for_commit(self, pinginterval=60)
Wait for new data to be committed on resource
list of str xfb_flags_list(self)
List all XFB (Transfer Behaviour) flags, that can be used in FlagObjects
zone_create(self, oid, name, functional_area='Undefined')
dict of SysDiagZone zone_list(self)
Lists all available system diagnostics zones
zone_system_name_set(self, systemid, systemname)
Sets the systemid and system-name used for updating zone values Must be
zone_version(self)
Properties:
commitid The CommitID associated with this session

close(self)

Immediately disconnects the resource.

After this method has been called this object becomes useless.

It may be used to force a disconnect when the garbage collector can't be trusted to do a timely disconnect.

commit(self, message='PythonAPI commit')

Store the current transaction to the database.

When you do this PacketLogic will reload the ruleset. This will take a lot of CPU resources from the system, try to do this in batches.

Observe that if you don't commit the changes you've made, no other resource (including the client) will see your changes.

Parameters:
  • message (str) - Message recorded in the commit log. Ignored in v12.1 and earlier.
  • message parameter is ignored in v12.1 firmware and earlier.

log_clear(self)

Clear the system diagnostics log.

log_list(self, only_new=False, min_id=0)

Lists system diagnostics log entries.

Returns:
Parameters:
  • only_new (bool) - Only return entries with the is_new flag set.
  • min_id (int) - Only return entries with a id > min_id

log_post(self, severity, title, body)

Post a new entry to the System Diagnostics log.

Parameters:
  • severity (int) - Event severity. (SYSDIAG_LOG_SEVERITY_INFO, SYSDIAG_LOG_SEVERITY_WARNING or SYSDIAG_LOG_SEVERITY_CRITICAL)
  • title (str) - Event title.
  • body (str) - Event body.

malloc_usage_list(self)

Lists system diagnostics malloc usage entries.

Returns:

ping(self, string='')

Send a command to server to test if it is up.

protocol(self, protocol, strict=False)

Translate protocol name OR number to tuple with name AND number. Can be used to e.g translate numerical protocol in connlog.search() result to protocol name.

An unknown protocol will be translated to e.g '#7' or -1, unless strict is set to True, in which case ValueError is raised for unknown protocols.

Returns:
  • Tuple with name and nr of specified protocol.
  • tuple of (str, int)
Parameters:
  • protocol (int, str or a ProtocolObject Item) - Name or number of an IP protocol
  • strict (bool) - If True, ValueError is raised for an unknown protocol, if False (default), an unknown protocol translates to number -1 or name '#7' (where 7 is the supplied unknown protocol number).

protocols_dict(self)

Returns a dictionary with name:nr and nr:name items for IP protocols. Can be used to e.g translate numerical protocol in connlog.search() result to protocol name.

Returns:
  • Dict with name:nr and nr:name items for IP protocols.
  • dict of str:int and int:str

rollback(self)

Abort the current transaction and discard the data.

This will also automatically happen if your connection drops or that you exit the program without commit.

Exceptions raised:
  • resource.PLDBError - If the rollback command failed.

services_cmd(self, services=[], props=[])

Send services to pldbd

Sets stringtable for services and properties. Do NOT use this unless you know exactly what you are doing.

Parameters:
  • services (list of str) - List of services
  • props (list of str) - List of service properties

services_list(self)

List all services

Returns:
  • List of services
  • list of str

services_prop_list(self)

List all properties.

Returns:
  • List of service properties
  • list of str

wait_for_commit(self, pinginterval=60)

Wait for new data to be committed on resource.

This method returns as soon as the server signals that another client has committed new data to the resource. It also periodically tests the connection to the server. If connection is broken (or any other error happens) an exception is raised.

Parameters:
  • pinginterval (int) - Interval used to check if connection still is alive.

xfb_flags_list(self)

List all XFB (Transfer Behaviour) flags, that can be used in FlagObjects.

Returns:
  • List of XFB flags
  • list of str

zone_list(self)

Lists all available system diagnostics zones

Returns:

zone_system_name_set(self, systemid, systemname)

Sets the systemid and system-name used for updating zone values Must be called before using SysDiagZone.update_values()

zone_version(self)

Undocumented!

commitid

The CommitID associated with this session. (14.0 or newer only)

SysDiagLogEntry

Information about a System Diagnostiscs Log Entry

Returned in a list by SysDiag.log_list.

Methods:
Ungrouped ack(self)
Clears this entry's is_new flag
Properties:
body Event details
id ID number of the event
is_new Status of the event
severity Event severity
system Name of the system that generated the event
systemid System ID of the system that generated the event
title Title of the event
tstamp Timestamp of the event

ack(self)

Clears this entry's is_new flag.

body

Event details

id

ID number of the event

is_new

Status of the event

severity

Event severity

system

Name of the system that generated the event

systemid

System ID of the system that generated the event

title

Title of the event

tstamp

Timestamp of the event

SysDiagMallocUsageEntry

Information about a System Diagnostiscs Malloc Usage Entry

Returned in a list by SysDiag.log_list.

Methods:
Ungrouped fetch(self)
Clears this entry's is_new flag
Properties:
names List of malloc names
systemname Name of the system
zonename Name of the zone

fetch(self)

Clears this entry's is_new flag.

names

List of malloc names

systemname

Name of the system

zonename

Name of the zone

SysDiagZone

Information about a System Diagnostiscs Zone

Returned in a list by SysDiag.zone_list.

Methods:
Ungrouped enum_name_add(self, valueid, enumvalue, enumname)
Adds a enum entry for specified value
get_string_value(self, idx, level)
Get string value of a specified level and id
get_string_values(self)
Get string values of this zone
refresh(self)
Refreshes all top-level values for this zone
refresh_string_values(self)
Refreshes all string values for this zone
register(self)
Register a new zone with PLDB
send(self, elapsed)
Update zone values
string_value_add(self, valueidx, level, value)
Adds a string value for specified value
string_values_send(self)
Send added string values for this zone
sublevel_add(self, levelname)
Create a new sublevel under this zone
value_definition_add(self, id, name, type, flags=0)
Adds a new value definition to the zone, this should be done before
Properties:
functional_area Functional area of the zone
name Name of the zone
num_values Number of value definitions in the zone
oid Zone OID
valuedefs Dict of value definitions

enum_name_add(self, valueid, enumvalue, enumname)

Adds a enum entry for specified value.

get_string_value(self, idx, level)

Get string value of a specified level and id.

Returns:
  • str string value belongs to specified level and id.
Parameters:
  • idx (int) - Id of specified sysdiag value.
  • level (str) - Path of specificed sysdiag value (MAC Address/000BBBCC231/Channel 1:2:1 - e10k0 for example).

get_string_values(self)

Get string values of this zone.

Returns:
  • Dict containing StringValue objects with (idx, level) tuple as the key.

refresh(self)

Refreshes all top-level values for this zone

refresh_string_values(self)

Refreshes all string values for this zone.

register(self)

Register a new zone with PLDB

send(self, elapsed)

Update zone values

Parameters:
  • elapsed (int) - Time in ms since last update

string_value_add(self, valueidx, level, value)

Adds a string value for specified value.

string_values_send(self)

Send added string values for this zone.

sublevel_add(self, levelname)

Create a new sublevel under this zone.

Returns:
  • SysDiagZone.SubLevelZone object that can be used to set values on this sublevel

value_definition_add(self, id, name, type, flags=0)

Adds a new value definition to the zone, this should be done before registering the zone with PLDB

functional_area

Functional area of the zone

name

Name of the zone

num_values

Number of value definitions in the zone

oid

Zone OID

valuedefs

Dict of value definitions