mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
13336 lines
662 KiB
Python
13336 lines
662 KiB
Python
#!/usr/bin/env python3
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Generated by LANforge JsonApiPythonGenerator, Mon Sep 13 15:28:41 PDT 2021
|
|
- - WORK IN PROGRESS - -
|
|
The API this library provides is actively being changed.
|
|
This file expects to live in py-json/LANforge directory.
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
import sys
|
|
import os
|
|
import importlib
|
|
from enum import Enum
|
|
from enum import IntFlag
|
|
|
|
if sys.version_info[0] != 3:
|
|
print("This script requires Python 3")
|
|
exit()
|
|
|
|
|
|
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../../")))
|
|
|
|
lfcli_base = importlib.import_module("py-json.LANforge.lfcli_base")
|
|
LFCliBase = lfcli_base.LFCliBase
|
|
|
|
|
|
class LFJsonGet(LFCliBase):
|
|
def __init__(self, lfclient_host='localhost',
|
|
lfclient_port=8080,
|
|
debug_=False,
|
|
_exit_on_error=False,
|
|
_exit_on_fail=False,
|
|
_proxy_str=None,
|
|
_capture_signal_list=()):
|
|
super().__init__(_lfjson_host=lfclient_host,
|
|
_lfjson_port=lfclient_port,
|
|
_debug=debug_,
|
|
_exit_on_error=_exit_on_error,
|
|
_exit_on_fail=_exit_on_fail,
|
|
_proxy_str=_proxy_str,
|
|
_capture_signal_list=_capture_signal_list)
|
|
|
|
@staticmethod
|
|
def extract_values(response: dict = None,
|
|
singular_key: str = None,
|
|
plural_key: str = None) -> list:
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Extract fields from this response using the expected keys:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
if (singular_key is None) or (plural_key is None) or (not singular_key) or (not plural_key):
|
|
raise ValueError("extract_values wants non-empty response, singular_key and plural_key")
|
|
if (singular_key in response) and (not response[singular_key]):
|
|
return []
|
|
elif (singular_key in response) and (type(response[singular_key]) is dict):
|
|
return [response[singular_key]]
|
|
elif (plural_key in response) and (not response[plural_key]):
|
|
return []
|
|
else:
|
|
return response[plural_key]
|
|
|
|
# TODO: rename me to make_port_eid_url
|
|
@staticmethod
|
|
def make_eid_url(eid_list=()):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Convert a list of EIDs into a URL:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
if not len(eid_list):
|
|
return "/list"
|
|
url = "/"
|
|
if isinstance(eid_list, str):
|
|
return url + eid_list.replace('.', '/')
|
|
|
|
# The first in a series has to define the resource number,
|
|
# but the remainder of a series has to match that resource number
|
|
for i in range(0, len(eid_list)):
|
|
eid = eid_list[i]
|
|
if i == 0:
|
|
url += eid.replace('.', '/')
|
|
elif eid.find('.') > 0:
|
|
url += ',' + eid.split('.')[-1]
|
|
else:
|
|
url += ','+eid
|
|
|
|
return url
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <ATTENUATOR> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/attenuator/
|
|
/attenuator/$shelf_id
|
|
/attenuator/$shelf_id/$resource_id
|
|
/attenuator/$shelf_id/$resource_id/$port_id
|
|
/attenuators/
|
|
/attenuators/$shelf_id
|
|
/attenuators/$shelf_id/$resource_id
|
|
/attenuators/$shelf_id/$resource_id/$port_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
entity+id, module+1, module+2, module+3, module+4, module+5, module+6, module+7,
|
|
module+8, name, script, state, temperature
|
|
Example URL: /attenuator?fields=entity+id,module+1
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_attenuator(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'entity id': # Entity ID
|
|
'module 1': # Reported attenuator dB settings.
|
|
'module 2': # Reported attenuator dB settings.
|
|
'module 3': # Reported attenuator dB settings.
|
|
'module 4': # Reported attenuator dB settings.
|
|
'module 5': # Reported attenuator dB settings.
|
|
'module 6': # Reported attenuator dB settings.
|
|
'module 7': # Reported attenuator dB settings.
|
|
'module 8': # Reported attenuator dB settings.
|
|
'name': # Attenuator module identifier (shelf . resource . serial-num).
|
|
'script': # Attenuator script state.
|
|
'state': # Attenuator state.
|
|
'temperature': # Temperature in degres Farenheight reported in Attenuator unit.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_attenuator(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/attenuator"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="attenuator",
|
|
plural_key="attenuators")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CHAMBER> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/chamber/
|
|
/chamber/$chamber_name
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
chamber, chamber+connections, chamber+resources, chamber+type, duts, entity+id,
|
|
flags, hide, isolation, marked, open, reported+rotation+%28deg%29, reported+rpm,
|
|
reported+tilt+%28deg%29, resource, rotation+%28deg%29, rpm, smas, tilt+%28deg%29, turntable,
|
|
turntable+type, virtual
|
|
Example URL: /chamber?fields=chamber,chamber+connections
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_chamber(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'chamber': # -
|
|
'chamber connections': # -
|
|
'chamber resources': # -
|
|
'chamber type': # -
|
|
'duts': # -
|
|
'entity id': # -
|
|
'flags': # -
|
|
'hide': # -
|
|
'isolation': # -
|
|
'marked': # -
|
|
'open': # -
|
|
'reported rotation (deg)': # -
|
|
'reported rpm ': # -
|
|
'reported tilt (deg)': # -
|
|
'resource': # -
|
|
'rotation (deg)': # -
|
|
'rpm': # -
|
|
'smas': # -
|
|
'tilt (deg)': # -
|
|
'turntable': # -
|
|
'turntable type': # -
|
|
'virtual': # -
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_chamber(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/chamber"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="chamber",
|
|
plural_key="chambers")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CONTROL> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/control/$command
|
|
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_control(eid_list=['1.234', '1.344'],
|
|
debug_=True)
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_control(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/control"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="",
|
|
plural_key="")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CX> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/cx/
|
|
/cx/$cx_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
avg+rtt, bps+rx+a, bps+rx+b, drop+pkts+a, drop+pkts+b, eid, endpoints+%28a%C2%A0%E2%86%94%C2%A0b%29,
|
|
entity+id, name, pkt+rx+a, pkt+rx+b, rpt+timer, rx+drop+%25+a, rx+drop+%25+b,
|
|
state, type
|
|
Example URL: /cx?fields=avg+rtt,bps+rx+a
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_cx(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'avg rtt': # Average Round-Trip-Time (latency) for this connection (ms).
|
|
'bps rx a': # Endpoint A's real receive rate (bps).
|
|
'bps rx b': # Endpoint B's real receive rate (bps).
|
|
'drop pkts a': # The number of packets Endpoint B sent minus the number Endpoint A
|
|
# received.This number is not 100% correct as long as packets are in
|
|
# flight.After a Quiesce of the test, the number should be perfectly
|
|
# accurate.
|
|
'drop pkts b': # The number of packets Endpoint A sent minus the number Endpoint B
|
|
# received.This number is not 100% correct as long as packets are in
|
|
# flight.After a Quiesce of the test, the number should be perfectly
|
|
# accurate.
|
|
'eid': # Cross Connect's Name.
|
|
'endpoints (a ↔ b)': # Endpoints that make up this Cross Connect.
|
|
'entity id': # Cross Connect's Name.
|
|
'name': # Cross Connect's Name.
|
|
'pkt rx a': # Endpoint A's Packets Recieved.
|
|
'pkt rx b': # Endpoint B's Packets Recieved.
|
|
'rpt timer': # Cross Connect's Report Timer (milliseconds).This is how often the GUI
|
|
# will ask for updates from the LANforge processes.If the GUI is sluggish,
|
|
# increasing the report timers may help.
|
|
'rx drop % a': # Endpoint A percentage packet loss.Calculated using the number of PDUs
|
|
# Endpoint B sent minus the number Endpoint A received.This number is not
|
|
# 100% correct as long as packets are in flight.After a Quiesce of the
|
|
# test, the number should be perfectly accurate.
|
|
'rx drop % b': # Endpoint B percentage packet loss.Calculated using the number of PDUs
|
|
# Endpoint A sent minus the number Endpoint B received.This number is not
|
|
# 100% correct as long as packets are in flight.After a Quiesce of the
|
|
# test, the number should be perfectly accurate.
|
|
'state': # Current State of the connection.UninitializedHas not yet been
|
|
# started/stopped.InitializingBeing set up.StartingStarting the
|
|
# test.RunningTest is actively running.StoppedTest has been
|
|
# stopped.QuiesceTest will gracefully stop soon.HW-BYPASSTest is in
|
|
# hardware-bypass mode (WanLinks only)FTM_WAITTest wants to run, but is
|
|
# phantom, probably due to non-existent interface or resource.WAITINGWill
|
|
# restart as soon as resources are available.PHANTOMTest is stopped, and
|
|
# is phantom, probably due to non-existent interface or resource.
|
|
'type': # Cross-Connect type.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_cx(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/cx"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="",
|
|
plural_key="")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <DUT> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/dut/
|
|
/dut/$name
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
api+version, bssid-1, bssid-2, bssid-3, bssid-4, bssid-5, bssid-6, bssid-7,
|
|
bssid-8, dut, eap-id, entity+id, hw+info, image+file, lan, mgt+ip, model+number,
|
|
notes, num+ant+radio+1, num+ant+radio+2, num+ant+radio+3, password-1, password-2,
|
|
password-3, password-4, password-5, password-6, password-7, password-8, serial+number,
|
|
serial+port, ssid-1, ssid-2, ssid-3, ssid-4, ssid-5, ssid-6, ssid-7, ssid-8,
|
|
sw+info, wan
|
|
Example URL: /dut?fields=api+version,bssid-1
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_dut(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'api version': # API Version
|
|
'bssid-1': # WiFi BSSID for DUT.
|
|
'bssid-2': # WiFi BSSID for DUT.
|
|
'bssid-3': # WiFi BSSID for DUT.
|
|
'bssid-4': # WiFi BSSID for DUT.
|
|
'bssid-5': # WiFi BSSID for DUT.
|
|
'bssid-6': # WiFi BSSID for DUT.
|
|
'bssid-7': # WiFi BSSID for DUT.
|
|
'bssid-8': # WiFi BSSID for DUT.
|
|
'dut': # Devices Under Test
|
|
'eap-id': # EAP Identifier, only used when one of the EAP options are selected.
|
|
'entity id': # Entity ID
|
|
'hw info': # DUT Hardware Info
|
|
'image file': # Image file name. Relative paths assume directory /home/lanforge. Fully
|
|
# qualified pathnames begin with a slash (eg
|
|
# /usr/lib/share/icons/icon.png).File format should be PNG, JPG or BMP.
|
|
'lan': # IP/Mask for LAN port (192.168.2.1/24).
|
|
'mgt ip': # DUT Management IP address.
|
|
'model number': # DUT model number or product name
|
|
'notes': # Notes
|
|
'num ant radio 1': # Antenna count for DUT radio(s).
|
|
'num ant radio 2': # Antenna count for DUT radio(s).
|
|
'num ant radio 3': # Antenna count for DUT radio(s).
|
|
'password-1': # WiFi Password needed to connect to DUT.
|
|
'password-2': # WiFi Password needed to connect to DUT.
|
|
'password-3': # WiFi Password needed to connect to DUT.
|
|
'password-4': # WiFi Password needed to connect to DUT.
|
|
'password-5': # WiFi Password needed to connect to DUT.
|
|
'password-6': # WiFi Password needed to connect to DUT.
|
|
'password-7': # WiFi Password needed to connect to DUT.
|
|
'password-8': # WiFi Password needed to connect to DUT.
|
|
'serial number': # DUT Identifier (serial-number, or similar)
|
|
'serial port': # Resource and name of LANforge serial port that connects to this DUT.
|
|
# (1.1.ttyS0). Does not need to belong to lan_port or wan_port resource.
|
|
'ssid-1': # WiFi SSID advertised by DUT.
|
|
'ssid-2': # WiFi SSID advertised by DUT.
|
|
'ssid-3': # WiFi SSID advertised by DUT.
|
|
'ssid-4': # WiFi SSID advertised by DUT.
|
|
'ssid-5': # WiFi SSID advertised by DUT.
|
|
'ssid-6': # WiFi SSID advertised by DUT.
|
|
'ssid-7': # WiFi SSID advertised by DUT.
|
|
'ssid-8': # WiFi SSID advertised by DUT.
|
|
'sw info': # DUT Software Info
|
|
'wan': # IP/Mask for WAN port (192.168.3.2/24).
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_dut(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/dut"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="dut",
|
|
plural_key="duts")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <ENDP> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/endp/
|
|
/endp/$endp_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
1st+rx, a%2Fb, bursty, crc+fail, cwnd, cx+active, cx+estab, cx+estab%2Fs, cx+to,
|
|
delay, destination+addr, dropped, dup+pkts, eid, elapsed, entity+id, jitter,
|
|
max+pdu, max+rate, min+pdu, min+rate, mng, name, ooo+pkts, pattern, pdu%2Fs+rx,
|
|
pdu%2Fs+tx, pps+rx+ll, pps+tx+ll, rcv+buf, replays, run, rx+ber, rx+bytes,
|
|
rx+drop+%25, rx+dup+%25, rx+ooo+%25, rx+pdus, rx+pkts+ll, rx+rate, rx+rate+%281%C2%A0min%29,
|
|
rx+rate+%28last%29, rx+rate+ll, rx+wrong+dev, script, send+buf, source+addr,
|
|
tcp+mss, tcp+rtx, tx+bytes, tx+pdus, tx+pkts+ll, tx+rate, tx+rate+%281%C2%A0min%29,
|
|
tx+rate+%28last%29, tx+rate+ll # hidden columns:
|
|
drop-count-5m, latency-5m, rt-latency-5m, rx-silence-5m
|
|
Example URL: /endp?fields=1st+rx,a%2Fb
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_endp(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'1st rx': # Miliseconds between starting the endpoint and receiving the first
|
|
# packet.Note that LANforge UDP connections (not including multicast) will
|
|
# wait 20msbefore sending first frame to make sure receiver has adequate
|
|
# time to start.
|
|
'a/b': # Display side (A or B) for the endpoint.
|
|
'bursty': # Is the transmit rate bursty or not?
|
|
'crc fail': # Total packets received with a bad payload CRC.
|
|
'cwnd': # Sender's TCP Current Window Size. In units of Maximum Segment Size.
|
|
'cx active': # Total number of active connections for this endpoint.
|
|
'cx estab': # Total times the connection between the endpoints has been established.
|
|
'cx estab/s': # Connections established per second, averaged over the last 30 seconds.
|
|
'cx to': # Number of TCP connection attemtps timed out by LANforge.
|
|
'delay': # Average latency in milliseconds for packets received by this endpoint.
|
|
'destination addr': # Destination Address (MAC, ip/port, VoIP destination).
|
|
'dropped': # Total dropped packets, as identified by gaps in packet sequence numbers.
|
|
'dup pkts': # Total duplicate packets received. Only an estimate, but never less than
|
|
# this value.
|
|
'eid': # Entity ID
|
|
'elapsed': # Amount of time (seconds) this endpoint has been running (or ran.)
|
|
'entity id': # Entity ID
|
|
'jitter': # Exponential decaying average jitter calculated per RFC3393(old_jitter *
|
|
# 15/16 + new_jitter * 1/16)
|
|
'max pdu': # The maximum write size.For Ethernet protocols, this is the entire
|
|
# Ethernet frame. For UDP, it is the UDP payload size, and for TCP, it
|
|
# just means the maximum amount of data that is written per socket
|
|
# write.In all cases, the packets on the wire will not exceed theport's
|
|
# MTU + Ethernet-Header-Size (typically 1514 for Ethernet)
|
|
'max rate': # Maximum desired transmit rate, in bits per second (bps).
|
|
'min pdu': # The minimum write size.For Ethernet protocols, this is the entire
|
|
# Ethernet frame. For UDP, it is the UDP payload size, and for TCP, it
|
|
# just means the maximum amount of data that is written per socket
|
|
# write.In all cases, the packets on the wire will not exceed theport's
|
|
# MTU + Ethernet-Header-Size (typically 1514 for Ethernet)
|
|
'min rate': # Minimum desired transmit rate, in bits per second (bps).
|
|
'mng': # Is the Endpoint managed or not?
|
|
'name': # Endpoint's Name.
|
|
'ooo pkts': # Total out of order packets received. Only an estimate, but never less
|
|
# than this value.
|
|
'pattern': # Pattern of bytes this endpoint transmits.
|
|
'pdu/s rx': # Received PDU per second.This counts the protocol reads, such as UDP
|
|
# PDUs.
|
|
'pdu/s tx': # Transmitted PDU per second.This counts the protocol writes, such as UDP
|
|
# PDUs.
|
|
'pps rx ll': # Estimated total received packets per second (on the wire).For TCP, this
|
|
# is an estimate.UDP and Ethernet protocols should be quite accurate on
|
|
# normal networks.
|
|
'pps tx ll': # Estimated total transmitted packets per second (on the wire).For TCP,
|
|
# this is an estimate.UDP and Ethernet protocols should be quite accurate
|
|
# on normal networks.
|
|
'rcv buf': # Configured/Actual values for receiving buffer size (bytes).
|
|
'replays': # Total number of files replayed.
|
|
'run': # Is the Endpoint is Running or not.
|
|
'rx ber': # Received bit-errors. These are only calculated in the LANforge payload
|
|
# portion starting 28 bytes into the UDP or TCP payload. In addition, the
|
|
# bit-errors are only checked when LANforge CRCis enabled and detected to
|
|
# be invalid. If the 28-byte header is corrupted, LANforge will not
|
|
# detectit, and may also give false positives for other packet errors.
|
|
# Bit-Errors are only calculated forcertain payload patterns: Increasing,
|
|
# Decreasing, Zeros, Ones, and the PRBS patterns.
|
|
'rx bytes': # Total received bytes count.
|
|
'rx drop %': # Percentage of packets that should have been received by Endpoint, but
|
|
# were not, as calculated by the Cross-Connect.
|
|
'rx dup %': # Percentage of duplicate packets, as detected by sequence numbers.
|
|
'rx ooo %': # Percentage of packets received out of order, as detected by sequence
|
|
# numbers.
|
|
'rx pdus': # Total received PDU count.This counts the protocol reads, such as UDP
|
|
# PDUs (aka goodput).
|
|
'rx pkts ll': # Estimated total received packet count (on the wire).For TCP, this is an
|
|
# estimate.UDP and Ethernet protocols should be quite accurate on normal
|
|
# networks.
|
|
'rx rate': # Real receive rate (bps) for this run.This includes only the protocol
|
|
# payload (goodput).
|
|
'rx rate (1 min)': # Real receive rate (bps) over the last minute.This includes only the
|
|
# protocol payload (goodput).
|
|
'rx rate (last)': # Real receive rate (bps) over the last report interval.This includes only
|
|
# the protocol payload (goodput).
|
|
'rx rate ll': # Estimated low-level receive rate (bps) over the last minute.This
|
|
# includes any Ethernet, IP, TCP, UDP or similar headers.
|
|
'rx wrong dev': # Total packets received on the wrong device (port).
|
|
'script': # Endpoint script state.
|
|
'send buf': # Configured/Actual values for sending buffer size (bytes).
|
|
'source addr': #
|
|
'tcp mss': # Sender's TCP-MSS (max segment size) setting.This cooresponds to the
|
|
# TCP_MAXSEGS socket option,and TCP-MSS plus 54 is the maximum packet size
|
|
# on the wirefor Ethernet frames.This is a good option to efficiently
|
|
# limit TCP packet size.
|
|
'tcp rtx': # Total packets retransmitted by the TCP stack for this connection.These
|
|
# were likely dropped or corrupted in transit.
|
|
'tx bytes': # Total transmitted bytes count.
|
|
'tx pdus': # Total transmitted PDU count.This counts the protocol writes, such as UDP
|
|
# PDUs (aka goodput).
|
|
'tx pkts ll': # Estimated total transmitted packet count (on the wire).For TCP, this is
|
|
# an estimate.UDP and Ethernet protocols should be quite accurate on
|
|
# normal networks.
|
|
'tx rate': # Real transmit rate (bps) for this run.This includes only the protocol
|
|
# payload (goodput).
|
|
'tx rate (1 min)': # Real transmit rate (bps) over the last minute.This includes only the
|
|
# protocol payload (goodput).
|
|
'tx rate (last)': # Real transmit rate (bps) over the last report interval.This includes
|
|
# only the protocol payload (goodput).
|
|
'tx rate ll': # Estimated low-level transmit rate (bps) over the last minute.This
|
|
# includes any Ethernet, IP, TCP, UDP or similar headers.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_endp(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/endp"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="endpoint",
|
|
plural_key="endpoint")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <EVENTS> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/events/
|
|
/events/$event_id
|
|
/events/before/$event_id
|
|
/events/between/$start_event_id/$end_event_id
|
|
/events/last/$event_count
|
|
/events/since/$event_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
eid, entity+id, event, event+description, id, name, priority, time-stamp,
|
|
type
|
|
Example URL: /events?fields=eid,entity+id
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_events(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'eid': # Time at which this event was created.This uses the clock on the source
|
|
# machine.
|
|
'entity id': # Entity IdentifierExact format depends on the
|
|
# type.(shelf.resource.port.endpoint.extra)
|
|
'event': # Event Type
|
|
'event description': # Text description for this event.
|
|
'id': # Unique ID for this event.
|
|
'name': # Name of the entity associated with this event.
|
|
'priority': # Event priority.
|
|
'time-stamp': # Time at which this event was created.This uses the clock on the source
|
|
# machine.
|
|
'type': # Entity type.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_events(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/events"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="alert",
|
|
plural_key="alerts")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <FILEIO> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/fileio/
|
|
/fileio/$endp_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
buf-rd, buf-wr, bytes-rd, bytes-wr, crc+fail, eid, entity+id, files+%23, files-read,
|
|
files-wr, io+fail, max-file-sz, max-rd-bps, max-rw-sz, max-wr-bps, min-file-sz,
|
|
min-rd-bps, min-rw-sz, min-wr-bps, name, read-bps, rpt+timer, rx-bps-20s,
|
|
status, tx-bps-20s, type, write-bps
|
|
Example URL: /fileio?fields=buf-rd,buf-wr
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_fileio(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'buf-rd': # Buffer reads. When doing CRC, it takes two reads per 'packet', because
|
|
# we first read the header, then the payload. Non-CRC reads ignore the
|
|
# header.
|
|
'buf-wr': # Buffer writes.
|
|
'bytes-rd': # Bytes read.
|
|
'bytes-wr': # Bytes written.
|
|
'crc fail': # 32-bit CRC Errors detected upon READ.
|
|
'eid': # Entity ID
|
|
'entity id': # Entity ID
|
|
'files #': # Number of files to write.
|
|
'files-read': # Files read.
|
|
'files-wr': # Files written.
|
|
'io fail': # Amount of time in miliseconds this test has been experiencing IO
|
|
# failures.
|
|
'max-file-sz': # Maximum configured file size (bytes).
|
|
'max-rd-bps': # Maximum configured read rate (bps).
|
|
'max-rw-sz': # Maximum configured size for each call to read(2) or write(2) (bytes).
|
|
'max-wr-bps': # Maximum configured write rate (bps).
|
|
'min-file-sz': # Minimum configured file size (bytes).
|
|
'min-rd-bps': # Minimum configured read rate (bps).
|
|
'min-rw-sz': # Minimum configured size for each call to read(2) or write(2) (bytes).
|
|
'min-wr-bps': # Minimum configured write rate (bps).
|
|
'name': # File Endpoint's Name.
|
|
'read-bps': # File read rate for this endpoint over the duration of the test.
|
|
'rpt timer': # Report Timer (milliseconds).This is how often the GUI will ask for
|
|
# updates from the LANforge processes.If the GUI is sluggish, increasing
|
|
# the report timers may help.
|
|
'rx-bps-20s': # File read rate for this endpoint over the last 20 seconds.
|
|
'status': # Current State of the connection.UninitializedHas not yet been
|
|
# started/stopped.InitializingBeing set up.StartingStarting the
|
|
# test.RunningTest is actively running.StoppedTest has been
|
|
# stopped.QuiesceTest will gracefully stop soon.HW-BYPASSTest is in
|
|
# hardware-bypass mode (WanLinks only)FTM_WAITTest wants to run, but is
|
|
# phantom, probably due to non-existent interface or resource.WAITINGWill
|
|
# restart as soon as resources are available.PHANTOMTest is stopped, and
|
|
# is phantom, probably due to non-existent interface or resource.
|
|
'tx-bps-20s': # File write rate for this endpoint over the last 20 seconds.
|
|
'type': # The specific type of this File Endpoint.
|
|
'write-bps': # File write rate for this endpoint over the duration of the test.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_fileio(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/fileio"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="endpoint",
|
|
plural_key="endpoint")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <GENERIC> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/generic/
|
|
/generic/$endp_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
bps+rx, bps+tx, command, dropped, eid, elapsed, entity+id, last+results,
|
|
name, pdu%2Fs+rx, pdu%2Fs+tx, rpt+timer, rpt%23, rx+bytes, rx+pkts, status, tx+bytes,
|
|
tx+pkts, type
|
|
Example URL: /generic?fields=bps+rx,bps+tx
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_generic(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'bps rx': # Receive rate reported by this endpoint.
|
|
'bps tx': # Transmit rate reported by this endpoint.
|
|
'command': # The command that this endpoint executes.
|
|
'dropped': # Dropped PDUs reported by this endpoint.
|
|
'eid': # Entity ID
|
|
'elapsed': # Amount of time (seconds) this endpoint has been running (or ran.)
|
|
'entity id': # Entity ID
|
|
'last results': # Latest output from the Generic Endpoint.
|
|
'name': # Endpoint's Name.
|
|
'pdu/s rx': # Received packets-per-second reported by this endpoint.
|
|
'pdu/s tx': # Transmitted packets-per-second reported by this endpoint.
|
|
'rpt timer': # Report Timer (milliseconds).This is how often the GUI will ask for
|
|
# updates from the LANforge processes.If the GUI is sluggish, increasing
|
|
# the report timers may help.
|
|
'rpt#': # The N_th report that we have received. (Some cmds will produce only one
|
|
# report, others will produce continuous reports.)
|
|
'rx bytes': # Received bytes reported by this endpoint.
|
|
'rx pkts': # Received PDUs reported by this endpoint.
|
|
'status': # Current State of the connection.UninitializedHas not yet been
|
|
# started/stopped.InitializingBeing set up.StartingStarting the
|
|
# test.RunningTest is actively running.StoppedTest has been
|
|
# stopped.QuiesceTest will gracefully stop soon.HW-BYPASSTest is in
|
|
# hardware-bypass mode (WanLinks only)FTM_WAITTest wants to run, but is
|
|
# phantom, probably due to non-existent interface or resource.WAITINGWill
|
|
# restart as soon as resources are available.PHANTOMTest is stopped, and
|
|
# is phantom, probably due to non-existent interface or resource.
|
|
'tx bytes': # Transmitted bytes reported by this endpoint.
|
|
'tx pkts': # Transmitted PDUs reported by this endpoint.
|
|
'type': # The specific type of this Generic Endpoint.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_generic(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/generic"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="endpoint",
|
|
plural_key="endpoints")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <GUI-CLI> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/gui-cli/
|
|
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_gui_cli(eid_list=['1.234', '1.344'],
|
|
debug_=True)
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_gui_cli(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/gui-cli"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="",
|
|
plural_key="")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <LAYER4> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/layer4/
|
|
/layer4/$endp_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
%21conn, acc.+denied, bad-proto, bad-url, bytes-rd, bytes-wr, dns-avg, dns-max,
|
|
dns-min, eid, elapsed, entity+id, fb-avg, fb-max, fb-min, ftp-host, ftp-port,
|
|
ftp-stor, http-p, http-r, http-t, login-denied, name, nf+%284xx%29, other-err,
|
|
read, redir, rpt+timer, rslv-h, rslv-p, rx+rate, rx+rate+%281%C2%A0min%29, status,
|
|
timeout, total-err, total-urls, tx+rate, tx+rate+%281%C2%A0min%29, type, uc-avg,
|
|
uc-max, uc-min, urls%2Fs, write # hidden columns:
|
|
rpt-time
|
|
Example URL: /layer4?fields=%21conn,acc.+denied
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_layer4(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'!conn': # Could not establish connection.
|
|
'acc. denied': # Access Access Denied Error.This could be password, user-name,
|
|
# file-permissions or other error.
|
|
'bad-proto': # Bad protocol.
|
|
'bad-url': # Bad URL format.
|
|
'bytes-rd': # Bytes read.
|
|
'bytes-wr': # Bytes written.
|
|
'dns-avg': # Average time in milliseconds to complete resolving the DNS lookupfor the
|
|
# last 100 requests.
|
|
'dns-max': # Maximum time in milliseconds to complete resolving the DNS lookupfor
|
|
# requests made in the last 30 seconds.
|
|
'dns-min': # Minimum time in milliseconds to complete resolving the DNS lookupfor
|
|
# requests made in the last 30 seconds.
|
|
'eid': # EID
|
|
'elapsed': # Amount of time (seconds) this endpoint has been running (or ran.)
|
|
'entity id': # Entity ID
|
|
'fb-avg': # Average time in milliseconds for receiving the first byte of the URLfor
|
|
# the last 100 requests.
|
|
'fb-max': # Maximum time in milliseconds for receiving the first byte of the URLfor
|
|
# requests made in the last 30 seconds.
|
|
'fb-min': # Minimum time in milliseconds for receiving the first byte of the URLfor
|
|
# requests made in the last 30 seconds.
|
|
'ftp-host': # FTP HOST Error
|
|
'ftp-port': # FTP PORT Error.
|
|
'ftp-stor': # FTP STOR Error.
|
|
'http-p': # HTTP Post error.
|
|
'http-r': # HTTP RANGE error.
|
|
'http-t': # HTTP PORT Error.
|
|
'login-denied': # Login attempt was denied.Probable cause is user-name or password errors.
|
|
'name': # Endpoint's Name.
|
|
'nf (4xx)': # File not found.For HTTP, an HTTP 4XX error was returned. This is only
|
|
# counted when the endpoint has 'Enable 4XX' selected.Includes 403
|
|
# permission denied and 404 not found errors.For other protocols, it
|
|
# should be returned any time a file is not found.
|
|
'other-err': # Error not otherwise specified. The actual error code may be found
|
|
# inl4helper logs. Contact support if you see these errors:we would like
|
|
# to account for all possible errors.
|
|
'read': # Error attempting to read file or URL.
|
|
'redir': # Noticed redirect loop!
|
|
'rpt timer': # Cross Connect's Report Timer (milliseconds).This is how often the GUI
|
|
# will ask for updates from the LANforge processes.If the GUI is sluggish,
|
|
# increasing the report timers may help.
|
|
'rslv-h': # Couldn't resolve host.
|
|
'rslv-p': # Couldn't resolve Proxy.
|
|
'rx rate': # Payload receive rate (bps).
|
|
'rx rate (1 min)': # Payload receive rate over the last minute (bps).
|
|
'status': # Current State of the connection.UninitializedHas not yet been
|
|
# started/stopped.InitializingBeing set up.StartingStarting the
|
|
# test.RunningTest is actively running.StoppedTest has been
|
|
# stopped.QuiesceTest will gracefully stop soon.HW-BYPASSTest is in
|
|
# hardware-bypass mode (WanLinks only)FTM_WAITTest wants to run, but is
|
|
# phantom, probably due to non-existent interface or resource.WAITINGWill
|
|
# restart as soon as resources are available.PHANTOMTest is stopped, and
|
|
# is phantom, probably due to non-existent interface or resource.
|
|
'timeout': # Operation timed out.
|
|
'total-err': # Total Errors.
|
|
'total-urls': # URLs processed.
|
|
'tx rate': # Payload transmit rate (bps).
|
|
'tx rate (1 min)': # Payload transmit rate over the last minute (bps).
|
|
'type': # The specific type of this Layer 4-7 Endpoint.
|
|
'uc-avg': # Average time in milliseconds to complete processing of the URLfor the
|
|
# last 100 requests.
|
|
'uc-max': # Maximum time in milliseconds to complete processing of the URLfor
|
|
# requests made in the last 30 seconds.
|
|
'uc-min': # Minimum time in milliseconds to complete processing of the URLfor
|
|
# requests made in the last 30 seconds.
|
|
'urls/s': # URLs processed per second over the last minute.
|
|
'write': # Error attempting to write file or URL.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_layer4(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/layer4"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="endpoint",
|
|
plural_key="endpoint")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <PORT> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/port/
|
|
/port/$shelf_id
|
|
/port/$shelf_id/$resource_id
|
|
/port/$shelf_id/$resource_id/$port_id
|
|
/portprobe/
|
|
/portprobe/$shelf_id/$resource_id/$port_id
|
|
/ports/
|
|
/ports/$shelf_id
|
|
/ports/$shelf_id/$resource_id
|
|
/ports/$shelf_id/$resource_id/$port_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
4way+time+%28us%29, activity, alias, anqp+time+%28us%29, ap, beacon, bps+rx, bps+rx+ll,
|
|
bps+tx, bps+tx+ll, bytes+rx+ll, bytes+tx+ll, channel, collisions, connections,
|
|
crypt, cx+ago, cx+time+%28us%29, device, dhcp+%28ms%29, down, entity+id, gateway+ip,
|
|
ip, ipv6+address, ipv6+gateway, key%2Fphrase, login-fail, login-ok, logout-fail,
|
|
logout-ok, mac, mask, misc, mode, mtu, no+cx+%28us%29, noise, parent+dev, phantom,
|
|
port, port+type, pps+rx, pps+tx, qlen, reset, retry+failed, rx+bytes, rx+crc,
|
|
rx+drop, rx+errors, rx+fifo, rx+frame, rx+length, rx+miss, rx+over, rx+pkts,
|
|
rx-rate, sec, signal, ssid, status, time-stamp, tx+abort, tx+bytes, tx+crr,
|
|
tx+errors, tx+fifo, tx+hb, tx+pkts, tx+wind, tx-failed+%25, tx-rate, wifi+retries,
|
|
# hidden columns:
|
|
beacon_rx_signal, port_cur_flags_h, port_cur_flags_l, port_supported_flags_h,
|
|
port_supported_flags_l, resource, rx_multicast, tx_dropped
|
|
Example URL: /port?fields=4way+time+%28us%29,activity
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_port(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'4way time (us)': # TIme (in micro-seconds) it took to complete the last WiFi 4-way
|
|
# authentication.
|
|
'activity': # Percent of the channel that is utilized over the last minute.This
|
|
# includes locally generated traffic as well as anyother systems active on
|
|
# this channel.This is a per-radio value.
|
|
'alias': # User-specified alias for this Port.
|
|
'anqp time (us)': # Time (in micro-seconds) it took to complete the last WiFi ANQP
|
|
# request/response session.
|
|
'ap': # BSSID of AP for connected stations.
|
|
'beacon': # Number of Wireless beacons from Cell or AP that have been missed.
|
|
'bps rx': # Average bits per second received for the last 30 seconds.
|
|
'bps rx ll': # Bits per second received, including low-level framing (Ethernet Only).
|
|
'bps tx': # Average bits per second transmitted for the last 30 seconds.
|
|
'bps tx ll': # Bits per second transmitted, including low-level framing (Ethernet
|
|
# Only).
|
|
'bytes rx ll': # Bytes received, including low-level framing (Ethernet Only).
|
|
'bytes tx ll': # Bytes transmitted, including low-level framing (Ethernet Only).
|
|
'channel': # Channel at the device is currently on, if known.
|
|
'collisions': # Total number of collisions reported by this Interface.For WiFi devices,
|
|
# this is number of re-transmit attempts.
|
|
'connections': # Number of wireless connections completed.
|
|
'crypt': # Number of Wireless packets dropped due to inability to decrypt.
|
|
'cx ago': # How long ago was the last WiFi connection attempt started?This relates
|
|
# only to the network interface, not any higher level protocol traffic
|
|
# upon it.
|
|
'cx time (us)': # Time (in micro-seconds) it took to complete the last WiFi connection to
|
|
# the AP.
|
|
'device': # Ethernet device name, as seen by the kernel.
|
|
'dhcp (ms)': # Time (in miliseconds) it took to acquire DHCP lease,or to time out while
|
|
# trying to acquire lease.
|
|
'down': # The interface is configured DOWN. It must be configured UP to be in
|
|
# active use.
|
|
'entity id': # Entity ID
|
|
'gateway ip': # Default Router/Gateway IP for the Interface.
|
|
'ip': # IP Address of the Interface.
|
|
'ipv6 address': # IPv6 Address for this interface. If global-scope address exists, it
|
|
# will be displayed,otherwise link-local will be displayed.
|
|
'ipv6 gateway': # IPv6 default gateway.
|
|
'key/phrase': # WEP Key or WPA Phrase (if enabled).
|
|
'login-fail': # The 'ifup-post' script reported failure. This is usually used for WiFi
|
|
# portallogins, but may be customized by the user for other needs.
|
|
'login-ok': # The 'ifup-post' script reported OK. This is usually used for WiFi
|
|
# portallogins, but may be customized by the user for other needs.
|
|
'logout-fail': # The 'ifup-post --logout' script reported failure. This is usually used
|
|
# for WiFi portallogouts, but may be customized by the user for other
|
|
# needs.
|
|
'logout-ok': # The 'ifup-post --logout' script reported OK. This is usually used for
|
|
# WiFi portallogouts, but may be customized by the user for other needs.
|
|
'mac': # Ethernet MAC address of the Interface.
|
|
'mask': # IP Mask of the Interface.
|
|
'misc': # Number of Wireless packets dropped on receive due to unspecified
|
|
# reasons.
|
|
'mode': # Wireless radio mode (802.11a/b/g).
|
|
'mtu': # MTU (Maximum Transmit Unit) size, in bytes.
|
|
'no cx (us)': # How long was the WiFi disconnect duration for the last disconnection?
|
|
'noise': # Wireless noise level.
|
|
'parent dev': # Parent device or port of this port. Blank if this device is not a child
|
|
# of another device or port.
|
|
'phantom': # Is the port PHANTOM (no hardware found) or not.
|
|
'port': # Entity ID
|
|
'port type': # Ports can be Ethernet, Radio, vAP, vSTA, Redirect, or Bridges
|
|
'pps rx': # Average packets per second received for the last 30 seconds.
|
|
'pps tx': # Average packets per second transmitted for the last 30 seconds.
|
|
'qlen': # "Transmit Queue Length for this Interface.
|
|
'reset': # Current Reset-State.
|
|
'retry failed': # Number of Wireless packets that the interface failed to send due to
|
|
# excessive retries.
|
|
'rx bytes': # Total number of bytes received by this Interface.
|
|
'rx crc': # Total number of packets dropped because of a bad CRC/FCS.
|
|
'rx drop': # Total number of dropped packets on recieve. Usually means driver/kernel
|
|
# is being over-worked.
|
|
'rx errors': # Total number of all types of Receive Errors.
|
|
'rx fifo': # Total number of packets dropped because driver/kernel queues are full.
|
|
'rx frame': # Total number of packets dropped because of framing errors at the
|
|
# physical layer.
|
|
'rx length': # Total number of packets dropped because their length was invalid.
|
|
'rx miss': # Total number of packets dropped because of a missed interrupt.
|
|
'rx over': # Total number of packets dropped because of framing errors at the
|
|
# physical layer.
|
|
'rx pkts': # Total number of packets received by this Interface.
|
|
'rx-rate': # Reported network device RX link speed.
|
|
'sec': # Number of secondary IP addresses configured or detected.
|
|
'signal': # Wireless signal strength (RSSI).
|
|
'ssid': # WiFi SSID identifier.Use [BLANK] for empty SSID, which means use any
|
|
# available SSID when associating.
|
|
'status': # Wireless link status.
|
|
'time-stamp': # Time-Stamp
|
|
'tx abort': # Total packets dropped on transmit because of driver abort.
|
|
'tx bytes': # Total number of bytes sent by this Interface.
|
|
'tx crr': # Total packets dropped on transmit because of carrier error.
|
|
'tx errors': # Total number of all types of Transmit Errors.
|
|
'tx fifo': # Total packets dropped on transmit because outgoing queue was full.
|
|
'tx hb': # Total packets dropped on transmit because of transceiver heartbeat
|
|
# errors.
|
|
'tx pkts': # Total number of packets sent by this Interface.
|
|
'tx wind': # Total number dropped on transmit because of Out-of-Window collision.
|
|
'tx-failed %': # Percentage of transmitted Wireless packets that were not ACKed.They
|
|
# might have succeeded on retry.
|
|
'tx-rate': # Reported network device TX link speed.
|
|
'wifi retries': # Number of Wireless packets that the wifi radio retried.One packet may be
|
|
# tried multiple times and each try would be counted in this stat.Not all
|
|
# radios can properly report this statistic.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_port(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/port"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="interface",
|
|
plural_key="interfaces")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <PROBE> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/probe/
|
|
/probe/$shelf_id/$resource_id/$port_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
entity+id, probe+results
|
|
Example URL: /probe?fields=entity+id,probe+results
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_probe(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['probe results'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'entity id': # Entity ID
|
|
'probe results': # Probe the low level information about the port.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_probe(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/probe"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="probe-results",
|
|
plural_key="probe-results")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <QUIT> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/quit
|
|
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_quit(eid_list=['1.234', '1.344'],
|
|
debug_=True)
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_quit(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/quit"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="",
|
|
plural_key="")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <RADIOSTATUS> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/radiostatus/
|
|
/radiostatus/$eid
|
|
/radiostatus/$shelf_id/$resource_id/$port_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
_links, antenna, ap, capabilities, channel, country, driver, entity+id, firmware+version,
|
|
frag, frequency, max_sta, max_vap, max_vifs, monitors_down, monitors_up,
|
|
phantom, port, resource, rts, stations_down, stations_up, tx-power, vaps_down,
|
|
vaps_up, verbose+debug
|
|
Example URL: /radiostatus?fields=_links,antenna
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_radiostatus(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['firmware version'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'_links': # -
|
|
'antenna': # -
|
|
'ap': # -
|
|
'capabilities': # -
|
|
'channel': # -
|
|
'country': # -
|
|
'driver': # -
|
|
'entity id': # -
|
|
'firmware version': # -
|
|
'frag': # -
|
|
'frequency': # -
|
|
'max_sta': # -
|
|
'max_vap': # -
|
|
'max_vifs': # -
|
|
'monitors_down': # -
|
|
'monitors_up': # -
|
|
'phantom': # -
|
|
'port': # -
|
|
'resource': # -
|
|
'rts': # -
|
|
'stations_down': # -
|
|
'stations_up': # -
|
|
'tx-power': # -
|
|
'vaps_down': # -
|
|
'vaps_up': # -
|
|
'verbose debug': # -
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_radiostatus(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/radiostatus"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="radio",
|
|
plural_key="radios")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <RESOURCE> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/resource/
|
|
/resource/$shelf_id
|
|
/resource/$shelf_id/$resource_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
bps-rx-3s, bps-tx-3s, cli-port, cpu, ctrl-ip, ctrl-port, eid, entity+id,
|
|
free+mem, free+swap, gps, hostname, hw+version, load, max+if-up, max+staged,
|
|
mem, phantom, ports, rx+bytes, shelf, sta+up, sw+version, swap, tx+bytes,
|
|
# hidden columns:
|
|
timestamp
|
|
Example URL: /resource?fields=bps-rx-3s,bps-tx-3s
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_resource(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'bps-rx-3s': # Rate in bits-per-second that the manager issending management data to
|
|
# the resource, averaged over the last 3 seconds.This is TCP payload data,
|
|
# and does not count the IP and Ethernet overhead.
|
|
'bps-tx-3s': # Rate in bits-per-second that the manager isreceiving management data
|
|
# from the resource, averaged over the last 3 seconds.This is TCP payload
|
|
# data, and does not count the IP and Ethernet overhead.
|
|
'cli-port': # Text (telnet) interface IP Port.
|
|
'cpu': # CPU information for the machine.
|
|
'ctrl-ip': # IP Address of the Control Interface.
|
|
'ctrl-port': # Binary interface IP Port.
|
|
'eid': # Resource EID (Shelf.Resource).
|
|
'entity id': # Entity ID
|
|
'free mem': # Free Memory (Kbytes) in the machine. If this is too low, performance
|
|
# will be degraded.
|
|
'free swap': # Free Swap (Kbytes) in the machine. If this is too low, performance will
|
|
# be degraded.
|
|
'gps': # GPS Info for this machine, if GPS is attached.
|
|
'hostname': # The name for this resource, as reported by the resource.
|
|
'hw version': # Hardware version on the machine.
|
|
'load': # Unix process load..
|
|
'max if-up': # Max number of interface-config scripts try to run at once.
|
|
'max staged': # Max number of interfaces the system will try to bringup at once.
|
|
'mem': # Total memory (Kbytes) on the machine.
|
|
'phantom': # Is the resource PHANTOM (undiscovered) or not.
|
|
'ports': # All real and phantom ports on this machine.
|
|
'rx bytes': # Total management TCP payload bytes received from the manager process by
|
|
# this resource.
|
|
'shelf': # Number of shelf that this resource belongs to.
|
|
'sta up': # Max number of stations to bring up per radio per 0.25s tick.
|
|
'sw version': # LANforge Software version running on the machine.
|
|
'swap': # Total swap space (Kbytes) on the machine.
|
|
'tx bytes': # Total management TCP payload bytes sent from this resource to the
|
|
# manager process.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_resource(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/resource"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="resource",
|
|
plural_key="resources")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <SCAN> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/scan-results/
|
|
/scan-results/$shelf_id/$resource_id/$port_id
|
|
/scan-results/$shelf_id/$resource_id/$port_id/$bssid
|
|
/scan/
|
|
/scan/$shelf_id/$resource_id/$port_id
|
|
/scan/$shelf_id/$resource_id/$port_id/$bssid
|
|
/scanresults/
|
|
/scanresults/$shelf_id/$resource_id/$port_id
|
|
/scanresults/$shelf_id/$resource_id/$port_id/$bssid
|
|
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_scan(eid_list=['1.234', '1.344'],
|
|
debug_=True)
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_scan(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/scan"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="scan-results",
|
|
plural_key="scan-results")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <STATIONS> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/stations/
|
|
/stations/$mac
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
ap, auth-for, capabilities, entity+id, idle, roam-duration, rx+bytes, rx+pkts,
|
|
rx+rate, signal, station+bssid, tx+bytes, tx+pkts, tx+rate, tx+retries, tx-failed,
|
|
|
|
Example URL: /stations?fields=ap,auth-for
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_stations(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'ap': # The Port that owns this station.
|
|
'auth-for': # Duration in seconds this station has been authenticated.
|
|
'capabilities': # Station's negotiated capabilities.
|
|
'entity id': # Entity ID
|
|
'idle': # Miliseconds since this station last received a frame from the peer.
|
|
'roam-duration': # The difference between the authenticate-time on the new APand the last
|
|
# frame received on old AP, in milliseconds.It is not always possible to
|
|
# compute this accurately,especially if traffic is not flowing during the
|
|
# roam.
|
|
'rx bytes': # RX Byte counter for this station.
|
|
'rx pkts': # RX Packets counter for this station.
|
|
'rx rate': # Station last received encoding rate.
|
|
'signal': # Station signal quality.
|
|
'station bssid': # Station's MAC address (BSSID).
|
|
'tx bytes': # TX Byte counter for this station.
|
|
'tx pkts': # TX Packets counter for this station.
|
|
'tx rate': # Station transmit encoding rate.
|
|
'tx retries': # TX Retries counter for this station.This counts retries at the driver
|
|
# level.Retries made by the WiFi hardware and/or firmware is not counted.
|
|
'tx-failed': # TX Failed counter for this station.This counts TX failures at the driver
|
|
# level.The hardware and/or firmware may have made several failed attempts
|
|
# that are not included in this counter.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_stations(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/stations"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="station",
|
|
plural_key="stations")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <STATUS-MSG> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/status-msg/
|
|
/status-msg/$session
|
|
/status-msg/$session/$id
|
|
/status-msg/$session/$id/ws-msg,...
|
|
/status-msg/$session/all
|
|
/status-msg/$session/this
|
|
/status-msg/sessions
|
|
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_status_msg(eid_list=['1.234', '1.344'],
|
|
debug_=True)
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_status_msg(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/status-msg"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="sessions/messages",
|
|
plural_key="sessions/messages")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <TEST-GROUP> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/test-group/
|
|
/test-group/$id
|
|
/test-groups/
|
|
/test-groups/$id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
cross+connects, entity+id, name, run, script
|
|
Example URL: /test-group?fields=cross+connects,entity+id
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_test_group(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'cross connects': # List of Test Manager's Cross-Connects.
|
|
'entity id': # Entity ID
|
|
'name': # Test Group's Name.
|
|
'run': # Is Test Group running or not.
|
|
'script': # Endpoint script state.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_test_group(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/test-group"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="groups",
|
|
plural_key="groups")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <TEXT> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/text/
|
|
/text/$group
|
|
/text/$group/$class
|
|
/text/$group/$class/$key
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
eid, name, text, type
|
|
Example URL: /text?fields=eid,name
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_text(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['text'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'eid': # -
|
|
'name': # -
|
|
'text': # -
|
|
'type': # -
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_text(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/text"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="record",
|
|
plural_key="records")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <VOIP> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/voip-endp/
|
|
/voip-endp/$endp_id
|
|
/voip-ep/
|
|
/voip-ep/$endp_id
|
|
/voip/
|
|
/voip/$cx_id
|
|
/voip_endp/
|
|
/voip_endp/$endp_id
|
|
/voip_ep/
|
|
/voip_ep/$endp_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
bps+rx+a, bps+rx+b, delay+a+%E2%86%90+b, delay+a+%E2%86%92+b, eid, endpoints+%28a%C2%A0%E2%86%94%C2%A0b%29,
|
|
entity+id, jitter+a+%E2%86%90+b, jitter+a+%E2%86%92+b, name, pkt+tx+a%C2%A0%E2%86%90%C2%A0b,
|
|
pkt+tx+a%C2%A0%E2%86%92%C2%A0b, rpt+timer, rx+drop+%25+a, rx+drop+%25+b, state,
|
|
type
|
|
Example URL: /voip?fields=bps+rx+a,bps+rx+b
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_voip(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'bps rx a': # Endpoint B's real transmit rate (bps).Measured at the CX Type layer.
|
|
'bps rx b': # Endpoint A's real transmit rate (bps).Measured at the CX Type layer.
|
|
'delay a ← b': # Average Latency in milliseconds for traffic from Endpoint B to Endpoint
|
|
# A
|
|
'delay a → b': # Average Latency in milliseconds for traffic from Endpoint A to Endpoint
|
|
# B
|
|
'eid': # Entity ID
|
|
'endpoints (a ↔ b)': # Endpoints that make up this Cross Connect.
|
|
'entity id': # Entity ID
|
|
'jitter a ← b': # Average Jitter in milliseconds for traffic from Endpoint B to Endpoint A
|
|
'jitter a → b': # Average Jitter in milliseconds for traffic from Endpoint A to Endpoint B
|
|
'name': # Cross Connect's Name.
|
|
'pkt tx a ← b': # Endpoint B's Packets Transmitted.
|
|
'pkt tx a → b': # Endpoint A's Packets Transmitted.
|
|
'rpt timer': # Cross Connect's Report Timer (milliseconds).This is how often the GUI
|
|
# will ask for updates from the LANforge processes.If the GUI is sluggish,
|
|
# increasing the report timers may help.
|
|
'rx drop % a': # Endpoint A percentage packet loss.Calculated using the number of PDUs
|
|
# Endpoint B sent minus the number Endpoint A received.This number is not
|
|
# 100% correct as long as packets are in flight.After a Quiesce of the
|
|
# test, the number should be perfectly accurate.
|
|
'rx drop % b': # Endpoint B percentage packet loss.Calculated using the number of PDUs
|
|
# Endpoint A sent minus the number Endpoint B received.This number is not
|
|
# 100% correct as long as packets are in flight.After a Quiesce of the
|
|
# test, the number should be perfectly accurate.
|
|
'state': # Current State of the connection.UninitializedHas not yet been
|
|
# started/stopped.InitializingBeing set up.StartingStarting the
|
|
# test.RunningTest is actively running.StoppedTest has been
|
|
# stopped.QuiesceTest will gracefully stop soon.HW-BYPASSTest is in
|
|
# hardware-bypass mode (WanLinks only)FTM_WAITTest wants to run, but is
|
|
# phantom, probably due to non-existent interface or resource.WAITINGWill
|
|
# restart as soon as resources are available.PHANTOMTest is stopped, and
|
|
# is phantom, probably due to non-existent interface or resource.
|
|
'type': # Cross-Connect type.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_voip(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/voip"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="connection",
|
|
plural_key="connections")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <VOIP-ENDP> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/voip-endp/
|
|
/voip-endp/$endp_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
calls+answered, calls+attempted, calls+completed, calls+failed, cf+404, cf+408,
|
|
cf+busy, cf+canceled, delay, destination+addr, dropped, dup+pkts, eid, elapsed,
|
|
entity+id, jb+cur, jb+over, jb+silence, jb+under, jitter, mng, name, ooo+pkts,
|
|
pesq, pesq+bklg, pesq%23, reg+state, rst, rtp+rtt, run, rx+bytes, rx+pkts,
|
|
source+addr, state, tx+bytes, tx+pkts, vad+pkts
|
|
Example URL: /voip-endp?fields=calls+answered,calls+attempted
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_voip_endp(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'calls answered': # Number of calls that where the remote answered
|
|
'calls attempted': # Number of calls that have been attempted
|
|
'calls completed': # Number of calls that have been successfully completed
|
|
'calls failed': # Number of calls that did not succeed for any reason.
|
|
'cf 404': # Number of calls failed for '404': callee not found.
|
|
'cf 408': # Number of calls failed for '408': callee did not answer.
|
|
'cf busy': # Number of calls failed because callee is busy.
|
|
'cf canceled': # Number of calls failed because they were canceled.
|
|
'delay': # Average latency in milliseconds for packets received by this endpoint.
|
|
'destination addr': # Destination Address (MAC, ip/port, VoIP destination).
|
|
'dropped': # Total dropped packets, as identified by gaps in RTP sequence numbers
|
|
# (pre jitter buffer).
|
|
'dup pkts': # Total duplicate packets, as identified by RTP sequence numbers (pre
|
|
# jitter buffer).
|
|
'eid': # Entity ID
|
|
'elapsed': # Amount of time (seconds) this endpoint has been running (or ran.)
|
|
'entity id': # Entity ID
|
|
'jb cur': # Current number of packets in the jitter buffer waiting to be played /
|
|
# Jitter Buffer Size.
|
|
'jb over': # Total times the jitter buffer was given more packets than it could hold.
|
|
'jb silence': # Silence is played when there is no valid voice packet, due to drop, or
|
|
# reorder/jitter/latency out of range of the jitter buffer.
|
|
'jb under': # Total times the reader asked for a packet to play but the jitter buffer
|
|
# was empty.
|
|
'jitter': # Average interpacket variation, calculated per RFC 1889 A.8.
|
|
'mng': # Is the Endpoint managed or not?
|
|
'name': # Endpoint's Name.
|
|
'ooo pkts': # Total out-of-order packets, as identified by RTP sequence numbers (pre
|
|
# jitter buffer).
|
|
'pesq': # PESQ Report score for the PESQ report number (PESQ#).
|
|
'pesq bklg': # PESQ server call processing backlog.
|
|
'pesq#': # The pesq-report-number to which the PESQ value cooresponds.
|
|
'reg state': # Current State of the Endpoint.
|
|
'rst': # How many times has the endpoint been restarted due to abnormal
|
|
# termination.
|
|
'rtp rtt': # Round trip latency as reported by RTCP
|
|
'run': # Is the Endpoint is Running or not.
|
|
'rx bytes': # Total received bytes count.
|
|
'rx pkts': # Total received packet count.
|
|
'source addr': # Source Address (MAC, ip/port, VoIP source).
|
|
'state': # Phone registration state
|
|
'tx bytes': # Total transmitted bytes count.
|
|
'tx pkts': # Total transmitted packet count.
|
|
'vad pkts': # Total VAD (Silence Suppression) packets suppressed before transmit.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_voip_endp(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/voip-endp"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="endpoint",
|
|
plural_key="endpoints")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <VR> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/vr-cx/
|
|
/vr-cx/$shelf_id/$resource_id/$port_id
|
|
/vr/
|
|
/vr/$shelf_id/$resource_id
|
|
/vrcx/
|
|
/vrcx/$shelf_id/$resource_id/$port_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
active+ipv6+router, bgp+4byte+as, bgp+damping, bgp+peers, cluster+id, collision+domain+id,
|
|
confederation+id, damping+half+life, damping+max+suppress, damping+reuse,
|
|
damping+suppress, entity+id, height, ipv6+radv, is+bgp+reflector, local+as,
|
|
multicast+routing, name, netsmith-state, notes, pad, ripv2, router+connections,
|
|
router+id, router+id, use+confederation, use+existing+cfg, use+ospf, use+rip+dft+route,
|
|
using+bgp, using+olsr, width, x, xorp+sha, y
|
|
Example URL: /vr?fields=active+ipv6+router,bgp+4byte+as
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_vr(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['netsmith-state'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'active ipv6 router': # -
|
|
'bgp 4byte as': # -
|
|
'bgp damping': # lc_key > lc_col_name-
|
|
'bgp peers': # -
|
|
'cluster id': # -
|
|
'collision domain id': # -
|
|
'confederation id': # -
|
|
'damping half life': # -
|
|
'damping max suppress': # -
|
|
'damping reuse': # -
|
|
'damping suppress': # -
|
|
'entity id': # Entity ID
|
|
'height': # -
|
|
'ipv6 radv': # -
|
|
'is bgp reflector': # -
|
|
'local as': # -
|
|
'multicast routing': # -
|
|
'name': # Name
|
|
'netsmith-state': # -
|
|
'notes': # -
|
|
'pad': # -
|
|
'ripv2': # -
|
|
'router connections': # -
|
|
'router id': # -
|
|
'router id': # -
|
|
'use confederation ': # -
|
|
'use existing cfg': # -
|
|
'use ospf': # -
|
|
'use rip dft route': # -
|
|
'using bgp': # -
|
|
'using olsr': # -
|
|
'width': # -
|
|
'x': # -
|
|
'xorp sha': # -
|
|
'y': # -
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_vr(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/vr"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="virtual-routers",
|
|
plural_key="virtual-routers")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <VRCX> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/vrcx/
|
|
/vrcx/$shelf_id/$resource_id/$port_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
entity+id, height, interface+cost, local-a, local-b, netsmith-state, remote-a,
|
|
remote-b, resource, rip+metric, vrrp+id, vrrp+interval, vrrp+ip, vrrp+ip-prefix,
|
|
vrrp+priority, wan+link, width, x, y
|
|
Example URL: /vrcx?fields=entity+id,height
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_vrcx(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['netsmith-state'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'entity id': # -
|
|
'height': # -
|
|
'interface cost': # -
|
|
'local-a': # -
|
|
'local-b': # -
|
|
'netsmith-state': # -
|
|
'remote-a': # -
|
|
'remote-b': # -
|
|
'resource': # -
|
|
'rip metric': # -
|
|
'vrrp id': # -
|
|
'vrrp interval': # -
|
|
'vrrp ip': # -
|
|
'vrrp ip-prefix': # -
|
|
'vrrp priority': # -
|
|
'wan link': # -
|
|
'width': # -
|
|
'x': # -
|
|
'y': # -
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_vrcx(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/vrcx"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="router-connections",
|
|
plural_key="router-connections")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <WL> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/wl-endp/
|
|
/wl-endp/$wl_ep_id
|
|
/wl-ep/
|
|
/wl-ep/$wl_ep_id
|
|
/wl/
|
|
/wl/$wl_id
|
|
/wl_endp/
|
|
/wl_endp/$wl_ep_id
|
|
/wl_ep/
|
|
/wl_ep/$wl_ep_id
|
|
/wlendp/$wl_ep_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
bps+rx+a, bps+rx+b, eid, endpoints+%28a%C2%A0%E2%86%94%C2%A0b%29, entity+id, k-m,
|
|
name, pkt+tx+a%C2%A0%E2%86%90%C2%A0b, pkt+tx+a%C2%A0%E2%86%92%C2%A0b, rpt+timer,
|
|
state
|
|
Example URL: /wl?fields=bps+rx+a,bps+rx+b
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_wl(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['entity id'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'bps rx a': # Endpoint B's Max transmit rate (bps).
|
|
'bps rx b': # Endpoint A's Max transmit rate (bps).
|
|
'eid': # Entity ID
|
|
'endpoints (a ↔ b)': # Endpoints that make up this WanLink.
|
|
'entity id': # Entity ID
|
|
'k-m': # Whether the WanLink is Kernel-Mode or not.
|
|
'name': # WanLink's Name.
|
|
'pkt tx a ← b': # Packets received on endpoint B and transmitted out endpoint A.
|
|
'pkt tx a → b': # Packets received on endpoint A and transmitted out endpoint B.
|
|
'rpt timer': # Cross Connect's Report Timer (milliseconds).This is how often the GUI
|
|
# will ask for updates from the LANforge processes.If the GUI is sluggish,
|
|
# increasing the report timers may help.
|
|
'state': # Current State of the connection.UninitializedHas not yet been
|
|
# started/stopped.InitializingBeing set up.StartingStarting the
|
|
# test.RunningTest is actively running.StoppedTest has been
|
|
# stopped.QuiesceTest will gracefully stop soon.HW-BYPASSTest is in
|
|
# hardware-bypass mode (WanLinks only)FTM_WAITTest wants to run, but is
|
|
# phantom, probably due to non-existent interface or resource.WAITINGWill
|
|
# restart as soon as resources are available.PHANTOMTest is stopped, and
|
|
# is phantom, probably due to non-existent interface or resource.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_wl(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/wl"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="",
|
|
plural_key="")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <WL-ENDP> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/wl-endp/
|
|
/wl-endp/$wl_ep_id
|
|
|
|
When requesting specific column names, they need to be URL encoded:
|
|
buffer, corrupt+1, corrupt+2, corrupt+3, corrupt+4, corrupt+5, corrupt+6,
|
|
delay, dropfreq+%25, dropped, dup+pkts, dupfreq+%25, eid, elapsed, extrabuf,
|
|
failed-late, jitfreq+%25, max+rate, maxjitter, maxlate, name, ooo+pkts, qdisc,
|
|
reordfrq+%25, run, rx+bytes, rx+pkts, script, serdelay, tx+bytes, tx+drop+%25,
|
|
tx+pkts, tx+rate, tx-failed, wps
|
|
Example URL: /wl-endp?fields=buffer,corrupt+1
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_wl_endp(eid_list=['1.234', '1.344'],
|
|
requested_col_names=['eid'],
|
|
debug_=True)
|
|
|
|
The record returned will have these members:
|
|
{
|
|
'buffer': # Maximum size of receive buffer, in bytes.This is the sum of the amount
|
|
# needed for the transit buffers (delay * bandwidth)plus the WanLink
|
|
# "Backlog Buffer:" queue size which handles bursts.
|
|
'corrupt 1': # Counters for how many times this corruption has been applied.
|
|
'corrupt 2': # Counters for how many times this corruption has been applied.
|
|
'corrupt 3': # Counters for how many times this corruption has been applied.
|
|
'corrupt 4': # Counters for how many times this corruption has been applied.
|
|
'corrupt 5': # Counters for how many times this corruption has been applied.
|
|
'corrupt 6': # Counters for how many times this corruption has been applied.
|
|
'delay': # Base induced latency on received packets, in microseconds.
|
|
'dropfreq %': # Frequency out of 1,000,000 to drop a received packet.Select a preset
|
|
# value or enter your own.
|
|
'dropped': # Total dropped packets on receive.This does not include the tx-failed
|
|
# counters.
|
|
'dup pkts': # Total duplicate packets generated.
|
|
'dupfreq %': # Frequency out of 1,000,000 to duplicate a received packet.Select a
|
|
# preset value or enter your own.
|
|
'eid': # Entity ID
|
|
'elapsed': # Amount of time (seconds) this endpoint has been running (or ran.)
|
|
'extrabuf': # Size of "Backlog Buffer:" setting in WanLink configuration in bytes.
|
|
'failed-late': # Total amount of received packets that could not be transmitted out the
|
|
# peer becausethe emulator was overloaded and could not transmit within
|
|
# the specified 'lateness'
|
|
'jitfreq %': # Frequency out of 1,000,000 that packets should have jitter applied to
|
|
# them.Select a preset value or enter your own.
|
|
'max rate': # Max transmit rate (bps) for this Endpoint.
|
|
'maxjitter': # Maximum additional delay, in microseconds. See Jitter-Frequency as
|
|
# well.
|
|
'maxlate': # The maximum lateness in milliseconds allowed before packets will be
|
|
# dropped on transmit.If lateness is configured to be automatic, this
|
|
# variable will change based onconfigured bandwidth and backlog buffer,
|
|
# but will not go below 10ms.
|
|
'name': # Endpoint's Name.
|
|
'ooo pkts': # Total out of order packets generated.
|
|
'qdisc': # Queueing discipline (FIFO, WRR, etc).
|
|
'reordfrq %': # Frequency out of 1,000,000 to re-order a received packet.Select a preset
|
|
# value or enter your own.
|
|
'run': # Is the Endpoint is Running or not.
|
|
'rx bytes': # Total received bytes count.
|
|
'rx pkts': # Total received packet count.
|
|
'script': # Endpoint script state.
|
|
'serdelay': # Additional serialization delay for a 1514 byte packet at the configured
|
|
# speed (microseconds).
|
|
'tx bytes': # Total transmitted bytes count.
|
|
'tx drop %': # Packet drop percentage over the last 1 minute.
|
|
'tx pkts': # Packets received on the peer interface and transmitted out this
|
|
# endpoint's interface.
|
|
'tx rate': # The average speed over the last 30 seconds at which we are
|
|
# transmittingout the peer interface.This can be thought of as the actual
|
|
# transfer rate for packets entering the interfaceassociated with this
|
|
# Endpoint.
|
|
'tx-failed': # Total amount of received packets that could not be transmitted out the
|
|
# peer.This includes any tx-failed-late packets.
|
|
'wps': # Enable/Disable showing of WanPaths for individual endpoints.
|
|
}
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_wl_endp(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/wl-endp"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="endpoint",
|
|
plural_key="endpoint")
|
|
#
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <WS-MSG> type requests
|
|
|
|
If you need to call the URL directly,
|
|
request one of these URLs:
|
|
/ws-msg/
|
|
/ws-msg/$sessionid
|
|
|
|
|
|
Example py-json call (it knows the URL):
|
|
record = LFJsonGet.get_ws_msg(eid_list=['1.234', '1.344'],
|
|
debug_=True)
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
def get_ws_msg(self,
|
|
eid_list=None,
|
|
requested_col_names=(),
|
|
debug_=False):
|
|
debug_ |= self.debug
|
|
url = "/ws-msg"
|
|
if (eid_list is None) or (len(eid_list) < 1):
|
|
raise ValueError("no entity id in request")
|
|
trimmed_fields = []
|
|
if isinstance(requested_col_names, str):
|
|
if not requested_col_names.strip():
|
|
raise ValueError("column name cannot be blank")
|
|
trimmed_fields.append(requested_col_names.strip())
|
|
if isinstance(requested_col_names, list):
|
|
for field in requested_col_names:
|
|
if not field.strip():
|
|
raise ValueError("column names cannot be blank")
|
|
field = field.strip()
|
|
if field.find(" ") > -1:
|
|
raise ValueError("field should be URL encoded: [%s]" % field)
|
|
trimmed_fields.append(field)
|
|
url += self.make_eid_url(eid_list=eid_list)
|
|
|
|
if len(trimmed_fields) > 0:
|
|
url += "?fields=%s" % (",".join(trimmed_fields))
|
|
|
|
response = self.json_get(url, debug_=debug_)
|
|
if response is None:
|
|
return None
|
|
return self.extract_values(response=response,
|
|
singular_key="",
|
|
plural_key="")
|
|
#
|
|
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
|
|
These are POST requests
|
|
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
|
|
class LFJsonPost(LFCliBase):
|
|
def __init__(self, lfclient_host='localhost',
|
|
lfclient_port=8080,
|
|
debug_=False,
|
|
_exit_on_error=False,
|
|
_exit_on_fail=False,
|
|
_proxy_str=None,
|
|
_capture_signal_list=()):
|
|
super().__init__(_lfjson_host=lfclient_host,
|
|
_lfjson_port=lfclient_port,
|
|
_debug=debug_,
|
|
_exit_on_error=_exit_on_error,
|
|
_exit_on_fail=_exit_on_fail,
|
|
_proxy_str=_proxy_str,
|
|
_capture_signal_list=_capture_signal_list)
|
|
|
|
@staticmethod
|
|
def set_flags(flag_class: IntFlag, starting_value: int, flag_names=None):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
:param flag_class: flag class, a subclass of IntFlag
|
|
:param starting_value: integer flag value to OR values into
|
|
:param flag_names: list of flag names to convert to integers to OR onto starting_value
|
|
|
|
Example Usage:
|
|
value = LFJsonPost.add_flags(SetPortMumble, 0, flag_names=['bridge', 'dhcp'])
|
|
print('value now: '+value)
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
if starting_value is None:
|
|
raise ValueError("starting_value should be an integer greater or equal than zero, not None")
|
|
if not flag_names:
|
|
raise ValueError("flag_names should be a name or a list of names, not None")
|
|
if type(flag_names) is list:
|
|
selected_flags = []
|
|
for flag in flag_names:
|
|
if isinstance(flag, str):
|
|
if flag not in flag_class.__members__:
|
|
raise ValueError("%s lacks member:[%s]" %
|
|
(flag_class.__class__.__name__, flag))
|
|
selected_flags.extend([flag_class[member].value
|
|
for member in flag_class.__members__ if member == flag])
|
|
if isinstance(flag, IntFlag):
|
|
if flag not in flag_class:
|
|
raise ValueError("%s lacks member:[%s]" %
|
|
(flag_class.__class__.__name__, flag))
|
|
selected_flags.extend([member.value
|
|
for member in flag_class.__members___ if member == flag])
|
|
selected_flags.append(starting_value)
|
|
result_flags = 0
|
|
for i in selected_flags:
|
|
result_flags |= i
|
|
return result_flags
|
|
f_name = None
|
|
if type(flag_names) is str:
|
|
f_name = flag_names
|
|
print('f_name is str %s' % f_name)
|
|
else:
|
|
print('f_name is %s' % type(flag_names))
|
|
if f_name not in flag_class.__members__:
|
|
raise ValueError("%s lacks member:[%s]" %
|
|
(flag_class.__class__.__name__, f_name))
|
|
return flag_class.valueof(f_name)
|
|
|
|
@staticmethod
|
|
def clear_flags(flag_class: IntFlag, starting_value: int, flag_names=None):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
:param flag_class: flag class, a subclass of IntFlag
|
|
:param starting_value: integer flag value to OR values into
|
|
:param flag_names: list of flag names to convert to integers to OR onto starting_value
|
|
|
|
Example Usage:
|
|
value = LFJsonPost.clear_flags(SetPortMumble, 0, flag_names=['bridge', 'dhcp'])
|
|
print('value now: '+value)
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
if starting_value is None:
|
|
raise ValueError("starting_value should be an integer greater than zero and not None")
|
|
if not flag_names:
|
|
raise ValueError("flag_names should be a name or a list of names, not None")
|
|
unselected_val = None
|
|
if type(flag_names) is list:
|
|
unselected_val = starting_value
|
|
for flag in flag_names:
|
|
if isinstance(flag, str):
|
|
if flag not in flag_class.__members__:
|
|
raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag))
|
|
if isinstance(flag, IntFlag):
|
|
if flag not in flag_class:
|
|
raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag))
|
|
unselected_val &= ~flag.value
|
|
# print("unselected b[%s]" % (hex(unselected_val)))
|
|
return unselected_val
|
|
if isinstance(flag_names, str):
|
|
if flag_names not in flag_class.__members__:
|
|
raise ValueError("%s lacks member:[%s]" %
|
|
(flag_class.__class__.__name__, flag_names))
|
|
unselected_val = starting_value
|
|
unselected_val &= ~flag_class.valueof(flag_names)
|
|
if isinstance(flag_names, IntFlag):
|
|
if flag_names not in flag_class:
|
|
raise ValueError("%s lacks member:[%s]" %
|
|
(flag_class.__class__.__name__, flag_names))
|
|
unselected_val = starting_value
|
|
unselected_val &= ~flag_names.value
|
|
return unselected_val
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_ARM_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_arm_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_arm_endp(self,
|
|
alias=None, # Name of endpoint.
|
|
cpu_id=None, # Preferred CPU ID on which this endpoint should run.
|
|
mx_pkt_sz=None, # Maximum packet size, including all Ethernet headers.
|
|
pkt_sz=None, # Minimum packet size, including all Ethernet headers.
|
|
port=None, # Port number.
|
|
pps=None, # Packets per second to generate.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf name/id.
|
|
tos=None, # The Type of Service, can be HEX. See set_endp_tos for details.
|
|
p_type=None, # Endpoint Type : arm_udp
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_arm_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if cpu_id is not None:
|
|
data["cpu_id"] = cpu_id
|
|
if mx_pkt_sz is not None:
|
|
data["mx_pkt_sz"] = mx_pkt_sz
|
|
if pkt_sz is not None:
|
|
data["pkt_sz"] = pkt_sz
|
|
if port is not None:
|
|
data["port"] = port
|
|
if pps is not None:
|
|
data["pps"] = pps
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if tos is not None:
|
|
data["tos"] = tos
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_arm_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_BGP_PEER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_bgp_peer
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddBgpPeerFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddBgpPeerFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
ENABLE_PEER = 0x1 # Set this to zero if you don't want this peer enabled.
|
|
PEER_CLIENT = 0x2 # Sets corresponding Xorp flag in BGP Peer section.
|
|
PEER_CONFED_MEMBER = 0x4 # Sets corresponding Xorp flag in BGP Peer section.
|
|
PEER_UNICAST_V4 = 0x8 # Sets corresponding Xorp flag in BGP Peer section.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddBgpPeerFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_add_bgp_peer(self,
|
|
p_as=None, # BGP Peer Autonomous System number, 0-65535
|
|
delay_open_time=None, # BGP Peer delay open time.
|
|
flags=None, # Virtual router BGP Peer flags, see above for definitions.
|
|
holdtime=None, # BGP Peer hold-time.
|
|
local_dev=None, # BGP Peer Local interface.
|
|
nexthop=None, # BGP Peer Nexthop, IPv4 Address.
|
|
nexthop6=None, # BGP Peer IPv6 Nexthop address.
|
|
peer_id=None, # BGP Peer Identifier: IPv4 Address
|
|
peer_index=None, # Peer index in this virtual router (0-7).
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf name/id.
|
|
vr_id=None, # Name of virtual router.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_bgp_peer(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if p_as is not None:
|
|
data["as"] = p_as
|
|
if delay_open_time is not None:
|
|
data["delay_open_time"] = delay_open_time
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if holdtime is not None:
|
|
data["holdtime"] = holdtime
|
|
if local_dev is not None:
|
|
data["local_dev"] = local_dev
|
|
if nexthop is not None:
|
|
data["nexthop"] = nexthop
|
|
if nexthop6 is not None:
|
|
data["nexthop6"] = nexthop6
|
|
if peer_id is not None:
|
|
data["peer_id"] = peer_id
|
|
if peer_index is not None:
|
|
data["peer_index"] = peer_index
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if vr_id is not None:
|
|
data["vr_id"] = vr_id
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_bgp_peer",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_BOND> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_bond
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_bond(self,
|
|
network_devs=None, # Comma-separated list of network devices: eth1,eth2,eth3...
|
|
port=None, # Name of the bond device.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_bond(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if network_devs is not None:
|
|
data["network_devs"] = network_devs
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_bond",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_BR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_br
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddBrBrFlags(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
none = 0 # no features
|
|
stp_enabled = 1 # Enable Spanning Tree Protocol (STP)
|
|
|
|
def post_add_br(self,
|
|
br_aging_time=None, # MAC aging time, in seconds, 32-bit number.
|
|
br_flags=None, # Bridge flags, see above.
|
|
br_forwarding_delay=None, # How long to wait until the bridge will start forwarding packets.
|
|
br_hello_time=None, # How often does the bridge send out STP hello packets.
|
|
br_max_age=None, # How long until STP considers a non-responsive bridge dead.
|
|
br_priority=None, # Bridge priority, 16-bit number.
|
|
network_devs=None, # Comma-separated list of network devices: eth1,eth2,eth3...
|
|
port=None, # Name of the bridge device.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_br(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if br_aging_time is not None:
|
|
data["br_aging_time"] = br_aging_time
|
|
if br_flags is not None:
|
|
data["br_flags"] = br_flags
|
|
if br_forwarding_delay is not None:
|
|
data["br_forwarding_delay"] = br_forwarding_delay
|
|
if br_hello_time is not None:
|
|
data["br_hello_time"] = br_hello_time
|
|
if br_max_age is not None:
|
|
data["br_max_age"] = br_max_age
|
|
if br_priority is not None:
|
|
data["br_priority"] = br_priority
|
|
if network_devs is not None:
|
|
data["network_devs"] = network_devs
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_br",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_CD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_cd
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddCdFlags(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
ERR = 2 # Set to kernel mode.
|
|
RUNNING = 1 # Set to running state.
|
|
|
|
def post_add_cd(self,
|
|
alias=None, # Name of Collision Domain.
|
|
bps=None, # Maximum speed at which this collision domain can run.
|
|
flags=None, # See above. Leave blank or use 'NA' for no default values.
|
|
report_timer=None, # How often to report stats.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf name/id.
|
|
state=None, # RUNNING or STOPPED (default is RUNNING). Use this to start/stop.
|
|
p_type=None, # CD Type: WIFI, WISER_SURFACE, WISER_SURFACE_AIR, WISER_AIR_AIR,
|
|
# WISER_NCW
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_cd(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if bps is not None:
|
|
data["bps"] = bps
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if report_timer is not None:
|
|
data["report_timer"] = report_timer
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if state is not None:
|
|
data["state"] = state
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_cd",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_CD_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_cd_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_cd_endp(self,
|
|
cd=None, # Name of Collision Domain.
|
|
endp=None, # Endpoint name/id.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_cd_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cd is not None:
|
|
data["cd"] = cd
|
|
if endp is not None:
|
|
data["endp"] = endp
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_cd_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_CD_VR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_cd_vr
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_cd_vr(self,
|
|
cd=None, # Name of Collision Domain.
|
|
vr=None, # Virtual-Router name/ID.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_cd_vr(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cd is not None:
|
|
data["cd"] = cd
|
|
if vr is not None:
|
|
data["vr"] = vr
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_cd_vr",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_CHAMBER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_chamber
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddChamberChamberFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddChamberChamberFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
OPEN = 0x4 # (3) Door is open, no real isolation right now.
|
|
PHANTOM = 0x1 # (1) Chamber is not actually here right now.
|
|
VIRTUAL = 0x2 # (2) No real chamber, open-air grouping of equipment.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddChamberChamberFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_add_chamber(self,
|
|
chamber_type=None, # Chamber type, see above. Use 1 for Medium if uncertain.
|
|
dut_name1=None, # Name of first DUT in this chamber or NA
|
|
dut_name2=None, # Name of second DUT in this chamber or NA
|
|
dut_name3=None, # Name of third DUT in this chamber or NA
|
|
dut_name4=None, # Name of fourth DUT in this chamber or NA
|
|
flags=None, # Flag field for Chamber, see above.
|
|
flags_mask=None, # Mask of what flags to pay attention to, or NA for all.
|
|
height=None, # Height to be used when drawn in the LANforge-GUI.
|
|
isolation=None, # Estimated isolation in db for this chamber.
|
|
lanforge1=None, # EID of first LANforge Resource in this chamber or NA
|
|
lanforge2=None, # EID of second LANforge Resource in this chamber or NA
|
|
lanforge3=None, # EID of third LANforge Resource in this chamber or NA
|
|
lanforge4=None, # EID of fourth LANforge Resource in this chamber or NA
|
|
name=None, # Name of Chamber, unique identifier.
|
|
resource=None, # LANforge Resource ID for controlling turn-table via serial
|
|
# protocol.
|
|
sma_count=None, # Number of SMA connectors on this chamber, default is 16.
|
|
turntable_type=None, # Turn-Table type: see above.
|
|
width=None, # Width to be used when drawn in the LANforge-GUI.
|
|
x=None, # X coordinate to be used when drawn in the LANforge-GUI.
|
|
y=None, # Y coordinate to be used when drawn in the LANforge-GUI.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_chamber(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if chamber_type is not None:
|
|
data["chamber_type"] = chamber_type
|
|
if dut_name1 is not None:
|
|
data["dut_name1"] = dut_name1
|
|
if dut_name2 is not None:
|
|
data["dut_name2"] = dut_name2
|
|
if dut_name3 is not None:
|
|
data["dut_name3"] = dut_name3
|
|
if dut_name4 is not None:
|
|
data["dut_name4"] = dut_name4
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if flags_mask is not None:
|
|
data["flags_mask"] = flags_mask
|
|
if height is not None:
|
|
data["height"] = height
|
|
if isolation is not None:
|
|
data["isolation"] = isolation
|
|
if lanforge1 is not None:
|
|
data["lanforge1"] = lanforge1
|
|
if lanforge2 is not None:
|
|
data["lanforge2"] = lanforge2
|
|
if lanforge3 is not None:
|
|
data["lanforge3"] = lanforge3
|
|
if lanforge4 is not None:
|
|
data["lanforge4"] = lanforge4
|
|
if name is not None:
|
|
data["name"] = name
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if sma_count is not None:
|
|
data["sma_count"] = sma_count
|
|
if turntable_type is not None:
|
|
data["turntable_type"] = turntable_type
|
|
if width is not None:
|
|
data["width"] = width
|
|
if x is not None:
|
|
data["x"] = x
|
|
if y is not None:
|
|
data["y"] = y
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_chamber",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_CHAMBER_CX> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_chamber_cx
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddChamberCxChamberCxFlags(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
CONNECTED = 1 # (1) Connected to something. If flag is not set, connection is open to the air
|
|
# +(maybe with antenna)
|
|
TERMINATED = 2 # (2) Connection is terminated, signal shall not pass!
|
|
|
|
def post_add_chamber_cx(self,
|
|
a_id=None, # EidAntenna in string format for A side connection.
|
|
atten_id=None, # EID for the Attenuator module if one is inline on this
|
|
# connection.
|
|
b_id=None, # EidAntenna in string format for B side connection.
|
|
connection_idx=None, # Connection index, currently up to 32 connections supported
|
|
# (0-31)
|
|
flags=None, # Flag field for Chamber Connection, see above.
|
|
flags_mask=None, # Mask of what flags to pay attention to, or NA for all.
|
|
internal=None, # Internal (1) or not (0): Internal connections are no longer
|
|
# supported.
|
|
min_atten=None, # Specify minimum attenuation in 10ths of a db. Distance logic
|
|
# will not set atten below this.
|
|
name=None, # Name of Chamber, unique identifier.
|
|
zrssi2=None, # Specify 2.4Ghz zero-attenuation RSSI in 10ths of a db.
|
|
# Distance logic will consider this in its calculations.
|
|
zrssi5=None, # Specify 5Ghz zero-attenuation RSSI in 10ths of a db. Distance
|
|
# logic will consider this in its calculations.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_chamber_cx(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if a_id is not None:
|
|
data["a_id"] = a_id
|
|
if atten_id is not None:
|
|
data["atten_id"] = atten_id
|
|
if b_id is not None:
|
|
data["b_id"] = b_id
|
|
if connection_idx is not None:
|
|
data["connection_idx"] = connection_idx
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if flags_mask is not None:
|
|
data["flags_mask"] = flags_mask
|
|
if internal is not None:
|
|
data["internal"] = internal
|
|
if min_atten is not None:
|
|
data["min_atten"] = min_atten
|
|
if name is not None:
|
|
data["name"] = name
|
|
if zrssi2 is not None:
|
|
data["zrssi2"] = zrssi2
|
|
if zrssi5 is not None:
|
|
data["zrssi5"] = zrssi5
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_chamber_cx",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_CHAMBER_PATH> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_chamber_path
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_chamber_path(self,
|
|
chamber=None, # Chamber Name.
|
|
content=None, # [BLANK] will erase all content, any other text will be appended
|
|
# to existing text. <tt escapearg='false'>Unescaped Value</tt>
|
|
path=None, # Path Name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_chamber_path(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if chamber is not None:
|
|
data["chamber"] = chamber
|
|
if content is not None:
|
|
data["content"] = content
|
|
if path is not None:
|
|
data["path"] = path
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_chamber_path",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_CHANNEL_GROUP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_channel_group
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddChannelGroupTypes(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
clear = "clear" # Channel(s) are bundled into a single span. No conversion or
|
|
e_m = "e&m" # Channel(s) are signalled using E&M signalling (specific
|
|
fcshdlc = "fcshdlc" # The zapdel driver performs HDLC encoding and decoding on the
|
|
fxogs = "fxogs" # Channel(s) are signalled using FXO Groundstart protocol.
|
|
fxoks = "fxoks" # Channel(s) are signalled using FXO Koolstart protocol.
|
|
fxols = "fxols" # Channel(s) are signalled using FXO Loopstart protocol.
|
|
fxsgs = "fxsgs" # Channel(s) are signalled using FXS Groundstart protocol.
|
|
fxsks = "fxsks" # Channel(s) are signalled using FXS Koolstart protocol.
|
|
fxsls = "fxsls" # Channel(s) are signalled using FXS Loopstart protocol.
|
|
indclear = "indclear" # Like 'clear' except all channels are treated individually and
|
|
nethdlc = "nethdlc" # The zaptel driver bundles the channels together into an
|
|
rawhdlc = "rawhdlc" # The zaptel driver performs HDLC encoding and decoding on the
|
|
unused = "unused" # No signalling is performed, each channel in the list remains idle
|
|
|
|
def post_add_channel_group(self,
|
|
alias=None, # Name for this Channel Group.
|
|
channels=None, # List of channels to add to this group.
|
|
idle_flag=None, # Idle flag (byte) for this channel group, for instance: 0x7e
|
|
mtu=None, # MTU (and MRU) for this channel group. Must be a multiple of
|
|
# the number of channels if configuring a T1 WanLink.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf name/id.
|
|
span_num=None, # The span number. First span is 1, second is 2...
|
|
p_type=None, # The channel-type. Use 'clear' for PPP links.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_channel_group(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if channels is not None:
|
|
data["channels"] = channels
|
|
if idle_flag is not None:
|
|
data["idle_flag"] = idle_flag
|
|
if mtu is not None:
|
|
data["mtu"] = mtu
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if span_num is not None:
|
|
data["span_num"] = span_num
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_channel_group",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_CX> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_cx
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_cx(self,
|
|
alias=None, # Name of the Cross Connect to create.
|
|
rx_endp=None, # Name of Receiving endpoint.
|
|
test_mgr=None, # Name of test-manager to create the CX on.
|
|
tx_endp=None, # Name of Transmitting endpoint.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_cx(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if rx_endp is not None:
|
|
data["rx_endp"] = rx_endp
|
|
if test_mgr is not None:
|
|
data["test_mgr"] = test_mgr
|
|
if tx_endp is not None:
|
|
data["tx_endp"] = tx_endp
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_cx",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_DUT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_dut
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddDutDutFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddDutDutFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
p_11r = 0x200 # Use .11r connection logic on all ssids, deprecated, see add_dut_ssid.
|
|
AP_MODE = 0x2 # (2) DUT acts as AP.
|
|
DHCPD_LAN = 0x40 # Provides DHCP server on LAN port
|
|
DHCPD_WAN = 0x80 # Provides DHCP server on WAN port
|
|
EAP_PEAP = 0x800 # Use EAP-PEAP connection logic on all ssids, deprecated, see add_dut_ssid.
|
|
EAP_TTLS = 0x400 # Use EAP-TTLS connection logic on all ssids, deprecated, see add_dut_ssid.
|
|
INACTIVE = 0x4 # (3) Ignore this in ChamberView, etc
|
|
NOT_DHCPCD = 0x1000 # Station/edge device that is NOT using DHCP.
|
|
STA_MODE = 0x1 # (1) DUT acts as Station.
|
|
WEP = 0x8 # Use WEP encryption on all ssids, deprecated, see add_dut_ssid.
|
|
WPA = 0x10 # Use WPA encryption on all ssids, deprecated, see add_dut_ssid.
|
|
WPA2 = 0x20 # Use WPA2 encryption on all ssids, deprecated, see add_dut_ssid.
|
|
WPA3 = 0x100 # Use WPA3 encryption on all ssids, deprecated, see add_dut_extras.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddDutDutFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_add_dut(self,
|
|
antenna_count1=None, # Antenna count for first radio.
|
|
antenna_count2=None, # Antenna count for second radio.
|
|
antenna_count3=None, # Antenna count for third radio.
|
|
api_id=None, # DUT API Identifier (none specified yet)
|
|
bssid1=None, # BSSID for first radio.
|
|
bssid2=None, # BSSID for second radio.
|
|
bssid3=None, # BSSID for third radio.
|
|
eap_id=None, # EAP Identifier, for EAP-PEAP.
|
|
flags=None, # Flag field for DUT, see above.
|
|
flags_mask=None, # Optional mask to specify what DUT flags are being set.
|
|
hw_version=None, # DUT Hardware Version information
|
|
img_file=None, # File-Name for image to represent DUT.
|
|
lan_port=None, # IP/Mask for LAN port
|
|
mgt_ip=None, # Management IP Address to access DUT
|
|
model_num=None, # DUT Model information
|
|
name=None, # Name of DUT, cannot contain '.'
|
|
passwd1=None, # WiFi Password that can be used to connect to DUT
|
|
passwd2=None, # WiFi Password that can be used to connect to DUT
|
|
passwd3=None, # WiFi Password that can be used to connect to DUT
|
|
serial_num=None, # DUT Identifier (serial-number, etc)
|
|
serial_port=None, # Resource and Serial port name on LANforge that connects to DUT
|
|
# (1.2.ttyS0). Serial port does not need to be on resource holding
|
|
# wan_port or lan_port
|
|
ssid1=None, # WiFi SSID that can be used to connect to DUT
|
|
ssid2=None, # WiFi SSID that can be used to connect to DUT
|
|
ssid3=None, # WiFi SSID that can be used to connect to DUT
|
|
sw_version=None, # DUT Software Version information
|
|
top_left_x=None, # X Location for Chamber View.
|
|
top_left_y=None, # X Location for Chamber View.
|
|
wan_port=None, # IP/Mask for WAN port
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_dut(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if antenna_count1 is not None:
|
|
data["antenna_count1"] = antenna_count1
|
|
if antenna_count2 is not None:
|
|
data["antenna_count2"] = antenna_count2
|
|
if antenna_count3 is not None:
|
|
data["antenna_count3"] = antenna_count3
|
|
if api_id is not None:
|
|
data["api_id"] = api_id
|
|
if bssid1 is not None:
|
|
data["bssid1"] = bssid1
|
|
if bssid2 is not None:
|
|
data["bssid2"] = bssid2
|
|
if bssid3 is not None:
|
|
data["bssid3"] = bssid3
|
|
if eap_id is not None:
|
|
data["eap_id"] = eap_id
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if flags_mask is not None:
|
|
data["flags_mask"] = flags_mask
|
|
if hw_version is not None:
|
|
data["hw_version"] = hw_version
|
|
if img_file is not None:
|
|
data["img_file"] = img_file
|
|
if lan_port is not None:
|
|
data["lan_port"] = lan_port
|
|
if mgt_ip is not None:
|
|
data["mgt_ip"] = mgt_ip
|
|
if model_num is not None:
|
|
data["model_num"] = model_num
|
|
if name is not None:
|
|
data["name"] = name
|
|
if passwd1 is not None:
|
|
data["passwd1"] = passwd1
|
|
if passwd2 is not None:
|
|
data["passwd2"] = passwd2
|
|
if passwd3 is not None:
|
|
data["passwd3"] = passwd3
|
|
if serial_num is not None:
|
|
data["serial_num"] = serial_num
|
|
if serial_port is not None:
|
|
data["serial_port"] = serial_port
|
|
if ssid1 is not None:
|
|
data["ssid1"] = ssid1
|
|
if ssid2 is not None:
|
|
data["ssid2"] = ssid2
|
|
if ssid3 is not None:
|
|
data["ssid3"] = ssid3
|
|
if sw_version is not None:
|
|
data["sw_version"] = sw_version
|
|
if top_left_x is not None:
|
|
data["top_left_x"] = top_left_x
|
|
if top_left_y is not None:
|
|
data["top_left_y"] = top_left_y
|
|
if wan_port is not None:
|
|
data["wan_port"] = wan_port
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_dut",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_DUT_NOTES> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_dut_notes
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_dut_notes(self,
|
|
dut=None, # DUT Name.
|
|
text=None, # [BLANK] will erase all, any other text will be appended to existing
|
|
# text. <tt escapearg='false'>Unescaped Value</tt>
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_dut_notes(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if dut is not None:
|
|
data["dut"] = dut
|
|
if text is not None:
|
|
data["text"] = text
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_dut_notes",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_DUT_SSID> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_dut_ssid
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddDutSsidDutFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddDutSsidDutFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
p_11r = 0x200 # Use .11r connection logic
|
|
EAP_PEAP = 0x800 # Use EAP-PEAP connection logic
|
|
EAP_TTLS = 0x400 # Use EAP-TTLS connection logic
|
|
WEP = 0x8 # Use WEP encryption
|
|
WPA = 0x10 # Use WPA encryption
|
|
WPA2 = 0x20 # Use WPA2 encryption
|
|
WPA3 = 0x100 # Use WPA3 encryption
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddDutSsidDutFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_add_dut_ssid(self,
|
|
bssid=None, # BSSID for cooresponding SSID.
|
|
name=None, # Name of DUT, cannot contain '.'
|
|
passwd=None, # WiFi Password that can be used to connect to DUT
|
|
ssid=None, # WiFi SSID that can be used to connect to DUT
|
|
ssid_flags=None, # SSID flags, see above.
|
|
ssid_flags_mask=None, # SSID flags mask
|
|
ssid_idx=None, # Index of the SSID. Zero-based indexing: (0 - 7)
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_dut_ssid(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if bssid is not None:
|
|
data["bssid"] = bssid
|
|
if name is not None:
|
|
data["name"] = name
|
|
if passwd is not None:
|
|
data["passwd"] = passwd
|
|
if ssid is not None:
|
|
data["ssid"] = ssid
|
|
if ssid_flags is not None:
|
|
data["ssid_flags"] = ssid_flags
|
|
if ssid_flags_mask is not None:
|
|
data["ssid_flags_mask"] = ssid_flags_mask
|
|
if ssid_idx is not None:
|
|
data["ssid_idx"] = ssid_idx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_dut_ssid",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddEndpPayloadPattern(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
PRBS_11_8_10 = "PRBS_11_8_10" # PRBS (see above)
|
|
PRBS_15_0_14 = "PRBS_15_0_14" # PRBS (see above)
|
|
PRBS_4_0_3 = "PRBS_4_0_3" # Use linear feedback shift register to generate pseudo random sequence.
|
|
PRBS_7_0_6 = "PRBS_7_0_6" # PRBS (see above)
|
|
custom = "custom" # Enter your own payload with the set_endp_payload cmd.
|
|
decreasing = "decreasing" # bytes start at FF and decrease, wrapping if needed
|
|
increasing = "increasing" # bytes start at 00 and increase, wrapping if needed
|
|
ones = "ones" # payload is all ones (FF)
|
|
random = "random" # generate a new random payload each time sent
|
|
random_fixed = "random_fixed" # means generate one random payload, and send it over and over again.
|
|
zeros = "zeros" # payload is all zeros (00)
|
|
|
|
class AddEndpType(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
custom_ether = "custom_ether" # LF frames with custom options, use with playback
|
|
custom_mc_udp = "custom_mc_udp" # LF Multicast UDP IPv4
|
|
custom_tcp = "custom_tcp" # LF TCP IPv4 frame with custom options
|
|
custom_udp = "custom_udp" # LF UDP IPv4 frame with custom options
|
|
lf = "lf" # LF protocol
|
|
lf_sctp = "lf_sctp" # SCTP IPv4 protocol
|
|
lf_sctp6 = "lf_sctp6" # SCTP IPv6 protocol
|
|
lf_tcp = "lf_tcp" # TCP IPv4 connection
|
|
lf_tcp6 = "lf_tcp6" # TCP IPv6 connection
|
|
lf_udp = "lf_udp" # UDP IPv4 connection
|
|
lf_udp6 = "lf_udp6" # UDP IPv6 connection
|
|
mc_udp = "mc_udp" # LF Multicast IPv4
|
|
|
|
def post_add_endp(self,
|
|
alias=None, # Name of endpoint.
|
|
ip_port=None, # IP Port: IP port for layer three endpoints. Use -1 to let the
|
|
# LANforge server automatically configure the ip_port. Layer 2
|
|
# endpoints will ignore
|
|
is_pkt_sz_random=None, # Yes means use random sized packets, anything else means NO.
|
|
is_rate_bursty=None, # Yes means bursty, anything else means NO.
|
|
max_pkt=None, # Maximum packet size, including all headers. 0 means 'same', -1
|
|
# means AUTO (5.3.2+)
|
|
max_rate=None, # Maximum transmit rate (bps), used if in bursty mode.
|
|
min_pkt=None, # Minimum packet size, including all headers. -1 means AUTO
|
|
# (5.3.2+)
|
|
min_rate=None, # Minimum transmit rate (bps), or only rate if not bursty.
|
|
multi_conn=None, # If > 0, will create separate process with this many connections
|
|
# per endpoint. See AUTO_HELPER flag
|
|
payload_pattern=None, # Payload pattern, see above.
|
|
port=None, # Port/Interface name or number.
|
|
resource=None, # Resource number.
|
|
send_bad_crc_per_million=None, # If NIC supports it, will randomly send X per million packets
|
|
# with bad ethernet Frame Check Sum.
|
|
shelf=None, # Shelf name/id.
|
|
ttl=None, # Time-to-live, used by UDP Multicast Endpoints only.
|
|
p_type=None, # Endpoint Type: See above.
|
|
use_checksum=None, # Yes means checksum the payload, anything else means NO.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if ip_port is not None:
|
|
data["ip_port"] = ip_port
|
|
if is_pkt_sz_random is not None:
|
|
data["is_pkt_sz_random"] = is_pkt_sz_random
|
|
if is_rate_bursty is not None:
|
|
data["is_rate_bursty"] = is_rate_bursty
|
|
if max_pkt is not None:
|
|
data["max_pkt"] = max_pkt
|
|
if max_rate is not None:
|
|
data["max_rate"] = max_rate
|
|
if min_pkt is not None:
|
|
data["min_pkt"] = min_pkt
|
|
if min_rate is not None:
|
|
data["min_rate"] = min_rate
|
|
if multi_conn is not None:
|
|
data["multi_conn"] = multi_conn
|
|
if payload_pattern is not None:
|
|
data["payload_pattern"] = payload_pattern
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if send_bad_crc_per_million is not None:
|
|
data["send_bad_crc_per_million"] = send_bad_crc_per_million
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if ttl is not None:
|
|
data["ttl"] = ttl
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if use_checksum is not None:
|
|
data["use_checksum"] = use_checksum
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_EVENT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_event
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_event(self,
|
|
details=None, # Event text description. Cannot include double-quote characters.
|
|
event_id=None, # Numeric ID for the event to modify, or 'new' if creating a new one.
|
|
name=None, # Event entity name.
|
|
priority=None, # See set_event_priority for available priorities.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_event(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if details is not None:
|
|
data["details"] = details
|
|
if event_id is not None:
|
|
data["event_id"] = event_id
|
|
if name is not None:
|
|
data["name"] = name
|
|
if priority is not None:
|
|
data["priority"] = priority
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_event",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_FILE_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_file_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddFileEndpFioFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddFileEndpFioFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
AUTO_MOUNT = 0x2 # (2) Attempt to mount with the provided information if not already mounted.
|
|
AUTO_UNMOUNT = 0x4 # (4) Attempt to un-mount when stopping test.
|
|
CHECK_MOUNT = 0x1 # (1) Attempt to verify NFS and SMB mounts match the configured values.
|
|
O_APPEND = 0x200 # (512) Open files for writing with O_APPEND instead
|
|
O_DIRECT = 0x8 # (8) Open file with O_DIRECT flag, disables caching. Must use block-size
|
|
# +read/write calls.
|
|
O_LARGEFILE = 0x20 # (32) Open files with O_LARGEFILE. This allows greater than 2GB files on
|
|
# +32-bit systems.
|
|
UNLINK_BW = 0x10 # (16) Unlink file before writing. This works around issues with CIFS for some
|
|
# +file-servers.
|
|
UNMOUNT_FORCE = 0x40 # (64) Use -f flag when calling umount
|
|
UNMOUNT_LAZY = 0x80 # (128) Use -l flag when calling umount
|
|
USE_FSTATFS = 0x100 # (256) Use fstatfs system call to verify file-system type when opening files.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddFileEndpFioFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class AddFileEndpPayloadPattern(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
PRBS_11_8_10 = "PRBS_11_8_10" # PRBS (see above)
|
|
PRBS_15_0_14 = "PRBS_15_0_14" # PRBS (see above)
|
|
PRBS_4_0_3 = "PRBS_4_0_3" # Use linear feedback shift register to generate pseudo random sequence.
|
|
PRBS_7_0_6 = "PRBS_7_0_6" # PRBS (see above)
|
|
custom = "custom" # Enter your own payload with the set_endp_payload cmd.
|
|
decreasing = "decreasing" # bytes start at FF and decrease, wrapping if needed.
|
|
increasing = "increasing" # bytes start at 00 and increase, wrapping if needed.
|
|
ones = "ones" # Payload is all ones (FF).
|
|
random = "random" # generate a new random payload each time sent.
|
|
random_fixed = "random_fixed" # Means generate one random payload, and send it over
|
|
zeros = "zeros" # Payload is all zeros (00).
|
|
|
|
def post_add_file_endp(self,
|
|
alias=None, # Name of endpoint.
|
|
directory=None, # The directory to read/write in. Absolute path suggested.
|
|
fio_flags=None, # File-IO flags, see above for details.
|
|
max_read_rate=None, # Maximum read rate, bits-per-second.
|
|
max_write_rate=None, # Maximum write rate, bits-per-second.
|
|
min_read_rate=None, # Minimum read rate, bits-per-second.
|
|
min_write_rate=None, # Minimum write rate, bits-per-second.
|
|
mount_dir=None, # Directory to mount/unmount (if blank, will use 'directory').
|
|
mount_options=None, # Optional mount options, passed to the mount command. 'NONE'
|
|
# clears.
|
|
payload_pattern=None, # Payload pattern, see above.
|
|
port=None, # Port number.
|
|
prefix=None, # The prefix of the file(s) to read/write.
|
|
resource=None, # Resource number.
|
|
retry_timer=None, # Number of miliseconds to retry errored IO calls before giving
|
|
# up.
|
|
server_mount=None, # The server to mount, ex: 192.168.100.5/exports/test1
|
|
shelf=None, # Shelf name/id.
|
|
p_type=None, # Endpoint Type : fe_generic, fe_nfs, fe_nfs4, fe_cifs, fe_iscsi,
|
|
# fe_cifs/ip6, fe_nfs/ip6, fe_nfs4/ip6, fe_smb2, fe_smb2/ip6
|
|
# fe_smb21 fe_smb21/ip6 fe_smb30 fe_smb30/ip6
|
|
volume=None, # iSCSI volume to mount
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_file_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if directory is not None:
|
|
data["directory"] = directory
|
|
if fio_flags is not None:
|
|
data["fio_flags"] = fio_flags
|
|
if max_read_rate is not None:
|
|
data["max_read_rate"] = max_read_rate
|
|
if max_write_rate is not None:
|
|
data["max_write_rate"] = max_write_rate
|
|
if min_read_rate is not None:
|
|
data["min_read_rate"] = min_read_rate
|
|
if min_write_rate is not None:
|
|
data["min_write_rate"] = min_write_rate
|
|
if mount_dir is not None:
|
|
data["mount_dir"] = mount_dir
|
|
if mount_options is not None:
|
|
data["mount_options"] = mount_options
|
|
if payload_pattern is not None:
|
|
data["payload_pattern"] = payload_pattern
|
|
if port is not None:
|
|
data["port"] = port
|
|
if prefix is not None:
|
|
data["prefix"] = prefix
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if retry_timer is not None:
|
|
data["retry_timer"] = retry_timer
|
|
if server_mount is not None:
|
|
data["server_mount"] = server_mount
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if volume is not None:
|
|
data["volume"] = volume
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_file_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_GEN_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_gen_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_gen_endp(self,
|
|
alias=None, # Name of endpoint.
|
|
port=None, # Port number.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf name/id.
|
|
p_type=None, # Endpoint Type : gen_generic
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_gen_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_gen_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_GRE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_gre
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_gre(self,
|
|
local_lower_ip=None, # The local lower-level IP to use.
|
|
port=None, # Name of the GRE to create, suggested to start with 'gre'
|
|
remote_lower_ip=None, # The remote lower-level IP to use.
|
|
report_timer=None, # Report timer for this port, leave blank or use NA for defaults.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_gre(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if local_lower_ip is not None:
|
|
data["local_lower_ip"] = local_lower_ip
|
|
if port is not None:
|
|
data["port"] = port
|
|
if remote_lower_ip is not None:
|
|
data["remote_lower_ip"] = remote_lower_ip
|
|
if report_timer is not None:
|
|
data["report_timer"] = report_timer
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_gre",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_GROUP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_group
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddGroupFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddGroupFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
group_total_rates = 0x4 # Set rates as total for group.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddGroupFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_add_group(self,
|
|
flags=None, # Flags for this group, see above.
|
|
flags_mask=None, # Mask for flags that we care about, use 0xFFFFFFFF or leave blank for
|
|
# all.
|
|
name=None, # The name of the test group. Must be unique across all groups.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_group(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if flags_mask is not None:
|
|
data["flags_mask"] = flags_mask
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_group",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_L4_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_l4_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddL4EndpHttpAuthType(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddL4EndpHttpAuthType0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
BASIC = 0x1 # Basic authentication
|
|
DIGEST = 0x2 # Digest (MD5) authentication
|
|
GSSNEGOTIATE = 0x4 # GSS authentication
|
|
NTLM = 0x8 # NTLM authentication
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddL4EndpHttpAuthType has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class AddL4EndpProxyAuthType(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddL4EndpProxyAuthType0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
BASIC = 0x1 # 1 Basic authentication
|
|
BIND_DNS = 0x200 # 512 Make DNS requests go out endpoints Port.
|
|
DIGEST = 0x2 # 2 Digest (MD5) authentication
|
|
DISABLE_EPSV = 0x1000 # 4096 Disable FTP EPSV option
|
|
DISABLE_PASV = 0x800 # 2048 Disable FTP PASV option (will use PORT command)
|
|
GSSNEGOTIATE = 0x4 # 4 GSS authentication
|
|
INCLUDE_HEADERS = 0x100 # 256 especially for IMAP
|
|
NTLM = 0x8 # 8 NTLM authentication
|
|
USE_DEFLATE_COMPRESSION = 0x80 # 128 Use deflate compression
|
|
USE_GZIP_COMPRESSION = 0x40 # 64 Use gzip compression
|
|
USE_IPV6 = 0x400 # 1024 Resolve URL is IPv6. Will use IPv4 if not selected.
|
|
USE_PROXY_CACHE = 0x20 # 32 Use proxy cache
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddL4EndpProxyAuthType has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class AddL4EndpType(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddL4EndpType0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
l4_generic = 0x0 # Layer 4 type
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddL4EndpType has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_add_l4_endp(self,
|
|
alias=None, # Name of endpoint.
|
|
block_size=None, # TFTP Block size, in bytes.
|
|
dns_cache_timeout=None, # In seconds, how long to cache DNS lookups. 0 means no caching at
|
|
# all.
|
|
http_auth_type=None, # Bit-field for allowable http-authenticate methods.
|
|
ip_addr=None, # Local IP address, for binding to specific secondary IP.
|
|
max_speed=None, # In bits-per-second, can rate limit upload or download speed of
|
|
# the URL contents. 0 means infinite.
|
|
port=None, # Port number.
|
|
proxy_auth_type=None, # Bit-field for allowable proxy-authenticate methods.
|
|
proxy_port=None, # HTTP Proxy port if you are using a proxy.
|
|
proxy_server=None, # The name of our proxy server if using one.
|
|
proxy_userpwd=None, # The user-name and password for proxy authentication, format:
|
|
# <tt>user:passwd</tt>.
|
|
quiesce_after=None, # Quiesce test after this many URLs have been processed.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf name/id.
|
|
smtp_from=None, # SMTP From address.
|
|
ssl_cert_fname=None, # Name of SSL Certs file.
|
|
timeout=None, # How long to wait for a connection, in milliseconds
|
|
p_type=None, # Endpoint Type : <tt>l4_generic</tt>
|
|
url=None, # The URL, see syntax above. Can also be a local file.
|
|
url_rate=None, # How often should we process the URL(s), per 10
|
|
# minutes.<ul><li>600: 1/s<li>1200: 2/s<li>1800: 3/s<li>2400:
|
|
# 4/s</ul>
|
|
user_agent=None, # User-Agent string. Leave blank for default. Also SMTP-TO:
|
|
# <a@b.com><c@d.com>...<q@x.com>
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_l4_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if block_size is not None:
|
|
data["block_size"] = block_size
|
|
if dns_cache_timeout is not None:
|
|
data["dns_cache_timeout"] = dns_cache_timeout
|
|
if http_auth_type is not None:
|
|
data["http_auth_type"] = http_auth_type
|
|
if ip_addr is not None:
|
|
data["ip_addr"] = ip_addr
|
|
if max_speed is not None:
|
|
data["max_speed"] = max_speed
|
|
if port is not None:
|
|
data["port"] = port
|
|
if proxy_auth_type is not None:
|
|
data["proxy_auth_type"] = proxy_auth_type
|
|
if proxy_port is not None:
|
|
data["proxy_port"] = proxy_port
|
|
if proxy_server is not None:
|
|
data["proxy_server"] = proxy_server
|
|
if proxy_userpwd is not None:
|
|
data["proxy_userpwd"] = proxy_userpwd
|
|
if quiesce_after is not None:
|
|
data["quiesce_after"] = quiesce_after
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if smtp_from is not None:
|
|
data["smtp_from"] = smtp_from
|
|
if ssl_cert_fname is not None:
|
|
data["ssl_cert_fname"] = ssl_cert_fname
|
|
if timeout is not None:
|
|
data["timeout"] = timeout
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if url is not None:
|
|
data["url"] = url
|
|
if url_rate is not None:
|
|
data["url_rate"] = url_rate
|
|
if user_agent is not None:
|
|
data["user_agent"] = user_agent
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_l4_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_MONITOR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_monitor
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddMonitorFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddMonitorFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
disable_ht40 = 0x800 # Disable HT-40 even if hardware and AP support it.
|
|
disable_ht80 = 0x8000000 # Disable HT80 (for AC chipset NICs only)
|
|
ht160_enable = 0x100000000 # Enable HT160 mode.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddMonitorFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_add_monitor(self,
|
|
aid=None, # AID, may be used when sniffing on /AX radios.
|
|
ap_name=None, # Name for this Monitor interface, for example: moni0
|
|
bssid=None, # BSSID to use when sniffing on /AX radios, optional.
|
|
flags=None, # Flags for this monitor interface.
|
|
flags_mask=None, # Flags mask for this monitor interface.
|
|
radio=None, # Name of the physical radio interface, for example: wiphy0
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_monitor(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aid is not None:
|
|
data["aid"] = aid
|
|
if ap_name is not None:
|
|
data["ap_name"] = ap_name
|
|
if bssid is not None:
|
|
data["bssid"] = bssid
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if flags_mask is not None:
|
|
data["flags_mask"] = flags_mask
|
|
if radio is not None:
|
|
data["radio"] = radio
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_monitor",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_MVLAN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_mvlan
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_mvlan(self,
|
|
flags=None, # 0x1: Create admin-down.
|
|
index=None, # Optional: The index of the VLAN, (the <b>4</b> in <tt>eth0#4</tt>)
|
|
mac=None, # The MAC address, can also use parent-pattern in 5.3.8 and higher:
|
|
# <tt>xx:xx:xx:*:*:xx</tt>
|
|
old_name=None, # The temporary name, used for configuring un-discovered hardware.
|
|
port=None, # Port number of an existing Ethernet interface.
|
|
report_timer=None, # Report timer for this port, leave blank or use NA for defaults.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_mvlan(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if index is not None:
|
|
data["index"] = index
|
|
if mac is not None:
|
|
data["mac"] = mac
|
|
if old_name is not None:
|
|
data["old_name"] = old_name
|
|
if port is not None:
|
|
data["port"] = port
|
|
if report_timer is not None:
|
|
data["report_timer"] = report_timer
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_mvlan",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_PPP_LINK> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_ppp_link
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_ppp_link(self,
|
|
auth=None, # YES if you want to authenticate. Default is NO.
|
|
channel_groups=None, # List of channel groups, see above.
|
|
debug=None, # YES for debug, otherwise debugging for the ppp connection is
|
|
# off.
|
|
down_time_max_ms=None, # Maximum length of downtime (ms) for PPP link between runs, or
|
|
# 0 for the link to be always up.
|
|
down_time_min_ms=None, # Minimum length of downtime (ms) for PPP link between runs, or
|
|
# 0 for the link to be always up.
|
|
dst_ip=None, # Destination IP address for this PPP connection.
|
|
extra_args=None, # Extra arguments to be passed directly to the pppd server.
|
|
holdoff=None, # Seconds between attempt to bring link back up if it dies,
|
|
# suggest 1.
|
|
lcp_echo_failure=None, # LCP echo failures before we determine links is dead, suggest
|
|
# 5.
|
|
lcp_echo_interval=None, # Seconds between LCP echos, suggest 1.
|
|
mlppp_descriptor=None, # A unique key for use with multi-link PPP connections.
|
|
persist=None, # YES if you want to persist the connection. This is suggested.
|
|
pppoe_transport_port=None, # Port number (or name) for underlying PPPoE transport.
|
|
resource=None, # Resource (machine) number.
|
|
run_time_max_ms=None, # Maximum uptime (ms) for PPP link during an experiment, or 0
|
|
# for the link to be always up.
|
|
run_time_min_ms=None, # Minimum uptime (ms) for PPP link during an experiment, or 0
|
|
# for the link to be always up.
|
|
shelf=None, # Shelf name/id.
|
|
src_ip=None, # Source IP address for this PPP connection.
|
|
transport_type=None, # What sort of transport this ppp link uses.
|
|
tty_transport_device=None, # TTY device for PPP links associated with TTYs.
|
|
unit=None, # Unit number for the PPP link. ie, the 7 in ppp7.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_ppp_link(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if auth is not None:
|
|
data["auth"] = auth
|
|
if channel_groups is not None:
|
|
data["channel_groups"] = channel_groups
|
|
if debug is not None:
|
|
data["debug"] = debug
|
|
if down_time_max_ms is not None:
|
|
data["down_time_max_ms"] = down_time_max_ms
|
|
if down_time_min_ms is not None:
|
|
data["down_time_min_ms"] = down_time_min_ms
|
|
if dst_ip is not None:
|
|
data["dst_ip"] = dst_ip
|
|
if extra_args is not None:
|
|
data["extra_args"] = extra_args
|
|
if holdoff is not None:
|
|
data["holdoff"] = holdoff
|
|
if lcp_echo_failure is not None:
|
|
data["lcp_echo_failure"] = lcp_echo_failure
|
|
if lcp_echo_interval is not None:
|
|
data["lcp_echo_interval"] = lcp_echo_interval
|
|
if mlppp_descriptor is not None:
|
|
data["mlppp_descriptor"] = mlppp_descriptor
|
|
if persist is not None:
|
|
data["persist"] = persist
|
|
if pppoe_transport_port is not None:
|
|
data["pppoe_transport_port"] = pppoe_transport_port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if run_time_max_ms is not None:
|
|
data["run_time_max_ms"] = run_time_max_ms
|
|
if run_time_min_ms is not None:
|
|
data["run_time_min_ms"] = run_time_min_ms
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if src_ip is not None:
|
|
data["src_ip"] = src_ip
|
|
if transport_type is not None:
|
|
data["transport_type"] = transport_type
|
|
if tty_transport_device is not None:
|
|
data["tty_transport_device"] = tty_transport_device
|
|
if unit is not None:
|
|
data["unit"] = unit
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_ppp_link",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_PROFILE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_profile
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddProfileProfileFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddProfileProfileFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
p_11r = 0x40 # Use 802.11r roaming setup.
|
|
BSS_TRANS = 0x400 # Enable BSS Transition logic
|
|
DHCP_SERVER = 0x1 # This should provide DHCP server.
|
|
EAP_PEAP = 0x200 # Enable EAP-PEAP
|
|
EAP_TTLS = 0x80 # Use 802.1x EAP-TTLS
|
|
NAT = 0x100 # Enable NAT if this object is in a virtual router
|
|
SKIP_DHCP_ROAM = 0x10 # Ask station to not re-do DHCP on roam.
|
|
WEP = 0x2 # Use WEP encryption
|
|
WPA = 0x4 # Use WPA encryption
|
|
WPA2 = 0x8 # Use WPA2 encryption
|
|
WPA3 = 0x20 # Use WPA3 encryption
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddProfileProfileFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class AddProfileWifiMode(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
p_802_11a = "802.11a" # 802.11a
|
|
AUTO = "AUTO" # 802.11g
|
|
aAX = "aAX" # 802.11a-AX (6E disables /n and /ac)
|
|
abg = "abg" # 802.11abg
|
|
abgn = "abgn" # 802.11abgn
|
|
abgnAC = "abgnAC" # 802.11abgn-AC
|
|
abgnAX = "abgnAX" # 802.11abgn-AX
|
|
an = "an" # 802.11an
|
|
anAC = "anAC" # 802.11an-AC
|
|
anAX = "anAX" # 802.11an-AX
|
|
as_is = "as_is" # Make no changes to current configuration
|
|
b = "b" # 802.11b
|
|
bg = "bg" # 802.11bg
|
|
bgn = "bgn" # 802.11bgn
|
|
bgnAC = "bgnAC" # 802.11bgn-AC
|
|
bgnAX = "bgnAX" # 802.11bgn-AX
|
|
bond = "bond" # Bonded pair of Ethernet ports.
|
|
bridged_ap = "bridged_ap" # AP device in bridged mode. The EIDs may specify radio and bridged port.
|
|
client = "client" # Client-side non-WiFi device (Ethernet port, for instance).
|
|
g = "g" # 802.11g
|
|
mobile_sta = "mobile_sta" # Mobile station device. Expects to connect to DUT AP(s) and upstream
|
|
# +LANforge.
|
|
monitor = "monitor" # Monitor device/sniffer. The EIDs may specify which radios to use.
|
|
peer = "peer" # Edge device, client or server (Ethernet port, for instance).
|
|
rdd = "rdd" # Pair of redirect devices, typically associated with VR to act as traffic
|
|
# +endpoint
|
|
routed_ap = "routed_ap" # AP in routed mode. The EIDs may specify radio and upstream port.
|
|
sta = "sta" # Station device, most likely non mobile. The EIDs may specify radio(s) to
|
|
# +use.
|
|
uplink = "uplink" # Uplink towards rest of network (can go in virtual router and do NAT)
|
|
upstream = "upstream" # Upstream server device. The EIDs may specify which ports to use.
|
|
vlan = "vlan" # 802.1q VLAN. Specify VID with the 'freq' option.
|
|
|
|
def post_add_profile(self,
|
|
alias_prefix=None, # Port alias prefix, aka hostname prefix.
|
|
antenna=None, # Antenna count for this profile.
|
|
bandwidth=None, # 0 (auto), 20, 40, 80 or 160
|
|
eap_id=None, # EAP Identifier
|
|
flags_mask=None, # Specify what flags to set.
|
|
freq=None, # WiFi frequency to be used, 0 means default.
|
|
instance_count=None, # Number of devices (stations, vdevs, etc)
|
|
mac_pattern=None, # Optional MAC-Address pattern, for instance: xx:xx:xx:*:*:xx
|
|
name=None, # Profile Name.
|
|
passwd=None, # WiFi Password to be used (AP Mode), [BLANK] means no password.
|
|
profile_flags=None, # Flags for this profile, see above.
|
|
profile_type=None, # Profile type: See above.
|
|
ssid=None, # WiFi SSID to be used, [BLANK] means any.
|
|
vid=None, # Vlan-ID (only valid for vlan profiles).
|
|
wifi_mode=None, # WiFi Mode for this profile.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_profile(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias_prefix is not None:
|
|
data["alias_prefix"] = alias_prefix
|
|
if antenna is not None:
|
|
data["antenna"] = antenna
|
|
if bandwidth is not None:
|
|
data["bandwidth"] = bandwidth
|
|
if eap_id is not None:
|
|
data["eap_id"] = eap_id
|
|
if flags_mask is not None:
|
|
data["flags_mask"] = flags_mask
|
|
if freq is not None:
|
|
data["freq"] = freq
|
|
if instance_count is not None:
|
|
data["instance_count"] = instance_count
|
|
if mac_pattern is not None:
|
|
data["mac_pattern"] = mac_pattern
|
|
if name is not None:
|
|
data["name"] = name
|
|
if passwd is not None:
|
|
data["passwd"] = passwd
|
|
if profile_flags is not None:
|
|
data["profile_flags"] = profile_flags
|
|
if profile_type is not None:
|
|
data["profile_type"] = profile_type
|
|
if ssid is not None:
|
|
data["ssid"] = ssid
|
|
if vid is not None:
|
|
data["vid"] = vid
|
|
if wifi_mode is not None:
|
|
data["wifi_mode"] = wifi_mode
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_profile",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_PROFILE_NOTES> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_profile_notes
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_profile_notes(self,
|
|
dut=None, # Profile Name.
|
|
text=None, # [BLANK] will erase all, any other text will be appended to
|
|
# existing text. <tt escapearg='false'>Unescaped Value</tt>
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_profile_notes(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if dut is not None:
|
|
data["dut"] = dut
|
|
if text is not None:
|
|
data["text"] = text
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_profile_notes",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_RDD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_rdd
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_rdd(self,
|
|
peer_ifname=None, # The peer (other) RedirectDevice in this pair.
|
|
port=None, # Name of the Redirect Device to create.
|
|
report_timer=None, # Report timer for this port, leave blank or use NA for defaults.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_rdd(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if peer_ifname is not None:
|
|
data["peer_ifname"] = peer_ifname
|
|
if port is not None:
|
|
data["port"] = port
|
|
if report_timer is not None:
|
|
data["report_timer"] = report_timer
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_rdd",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_SEC_IP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_sec_ip
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_sec_ip(self,
|
|
ip_list=None, # IP1/prefix,IP2/prefix,...IPZ/prefix.
|
|
port=None, # Name of network device (Port) to which these IPs will be added.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_sec_ip(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if ip_list is not None:
|
|
data["ip_list"] = ip_list
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_sec_ip",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_STA> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_sta
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddStaFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddStaFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
p_80211r_pmska_cache = 0x4000000 # Enable oportunistic PMSKA caching for WPA2 (Related to
|
|
# +802.11r).
|
|
p_80211u_additional = 0x100000 # AP requires additional step for access (802.11u Interworking)
|
|
p_80211u_auto = 0x40000 # Enable 802.11u (Interworking) Auto-internetworking feature.
|
|
# +Always enabled currently.
|
|
p_80211u_e911 = 0x200000 # AP claims emergency services reachable (802.11u Interworking)
|
|
p_80211u_e911_unauth = 0x400000 # AP provides Unauthenticated emergency services (802.11u
|
|
# +Interworking)
|
|
p_80211u_enable = 0x20000 # Enable 802.11u (Interworking) feature.
|
|
p_80211u_gw = 0x80000 # AP Provides access to internet (802.11u Interworking)
|
|
p_8021x_radius = 0x2000000 # Use 802.1x (RADIUS for AP).
|
|
create_admin_down = 0x1000000000 # Station should be created admin-down.
|
|
custom_conf = 0x20 # Use Custom wpa_supplicant config file.
|
|
disable_ofdma = 0x200000000000 # Disable OFDMA mode
|
|
disable_twt = 0x100000000000 # Disable TWT mode
|
|
disable_fast_reauth = 0x200000000 # Disable fast_reauth option for virtual stations.
|
|
disable_gdaf = 0x1000000 # AP: Disable DGAF (used by HotSpot 2.0).
|
|
disable_ht80 = 0x8000000 # Disable HT80 (for AC chipset NICs only)
|
|
disable_roam = 0x80000000 # Disable automatic station roaming based on scan results.
|
|
disable_sgi = 0x4000 # Disable SGI (Short Guard Interval).
|
|
hs20_enable = 0x800000 # Enable Hotspot 2.0 (HS20) feature. Requires WPA-2.
|
|
ht160_enable = 0x100000000 # Enable HT160 mode.
|
|
ht40_disable = 0x800 # Disable HT-40 even if hardware and AP support it.
|
|
ibss_mode = 0x20000000 # Station should be in IBSS mode.
|
|
lf_sta_migrate = 0x8000 # OK-To-Migrate (Allow station migration between LANforge
|
|
# +radios)
|
|
mesh_mode = 0x400000000 # Station should be in MESH mode.
|
|
no_supp_op_class_ie = 0x4000000000 # Do not include supported-oper-class-IE in assoc requests. May
|
|
# +work around AP bugs.
|
|
osen_enable = 0x40000000 # Enable OSEN protocol (OSU Server-only Authentication)
|
|
passive_scan = 0x2000 # Use passive scanning (don't send probe requests).
|
|
power_save_enable = 0x800000000 # Station should enable power-save. May not work in all
|
|
# +drivers/configurations.
|
|
scan_ssid = 0x1000 # Enable SCAN-SSID flag in wpa_supplicant.
|
|
txo_enable = 0x8000000000 # Enable/disable tx-offloads, typically managed by set_wifi_txo
|
|
# +command
|
|
use_bss_transition = 0x80000000000 # Enable BSS transition.
|
|
use_wpa3 = 0x10000000000 # Enable WPA-3 (SAE Personal) mode.
|
|
verbose = 0x10000 # Verbose-Debug: Increase debug info in wpa-supplicant and
|
|
# +hostapd logs.
|
|
wds_mode = 0x2000000000 # WDS station (sort of like a lame mesh), not supported on
|
|
# +ath10k
|
|
wep_enable = 0x200 # Use wpa_supplicant configured for WEP encryption.
|
|
wpa2_enable = 0x400 # Use wpa_supplicant configured for WPA2 encryption.
|
|
wpa_enable = 0x10 # Enable WPA
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddStaFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class AddStaMode(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
p_802_11a = 1 # 802.11a
|
|
AUTO = 0 # 802.11g
|
|
aAX = 15 # 802.11a-AX (6E disables /n and /ac)
|
|
abg = 4 # 802.11abg
|
|
abgn = 5 # 802.11abgn
|
|
abgnAC = 8 # 802.11abgn-AC
|
|
abgnAX = 12 # 802.11abgn-AX
|
|
an = 10 # 802.11an
|
|
anAC = 9 # 802.11an-AC
|
|
anAX = 14 # 802.11an-AX
|
|
b = 2 # 802.11b
|
|
bg = 7 # 802.11bg
|
|
bgn = 6 # 802.11bgn
|
|
bgnAC = 11 # 802.11bgn-AC
|
|
bgnAX = 13 # 802.11bgn-AX
|
|
g = 3 # 802.11g
|
|
|
|
class AddStaRate(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
p_a_g = "/a/g" # 6 Mbps, 9 Mbps, 12 Mbps, 18 Mbps, 24 Mbps, 36 Mbps, 48 Mbps, 54 Mbps
|
|
p_b = "/b" # 1Mbps, 2Mbps, 5.5 Mbps, 11 Mbps
|
|
DEFAULT = "DEFAULT" # Use maximum available speed
|
|
MCS0_76 = "MCS0-76" # /n rates
|
|
p_bitmap_ = "[bitmap]" # <b>'0xff 00 ...'</b> to directly specify the MCS bitmap.
|
|
|
|
def post_add_sta(self,
|
|
ampdu_density=None, # 0-7, or 0xFF to not set.
|
|
ampdu_factor=None, # 0-3, or 0xFF to not set.
|
|
ap=None, # The Access Point BSSID this Virtual STA should be associated with
|
|
# (example: <tt>00:11:22:33:4:55</tt>, or <tt>DEFAULT</tt> for any).
|
|
flags=None, # Flags for this interface (see above.)
|
|
flags_mask=None, # If set, only these flags will be considered.
|
|
ieee80211w=None, # Management Frame Protection: 0: disabled, 1: optional, 2: Required.
|
|
key=None, # Encryption key (WEP, WPA, WPA2, WPA3, etc) for this Virtual STA.
|
|
# Prepend with 0x for ascii-hex input.
|
|
mac=None, # The MAC address, can also use parent-pattern in 5.3.8 and higher:
|
|
# <tt>xx:xx:xx:*:*:xx</tt>
|
|
max_amsdu=None, # 1 == enabled, 0 == disabled, 0xFF == do not set.
|
|
mode=None, # WiFi mode: <ul><li>0: AUTO, <li>1: 802.11a</li> <li>2: b</li> <li>3:
|
|
# g</li> <li>4: abg</li> <li>5: abgn</li> <li>6: bgn</li> <li>7: bg</li>
|
|
# <li>8: abgnAC</li> <li>9 anAC</li> <li>10 an</li><li>11
|
|
# bgnAC</li><li>12 abgnAX</li><li>13 bgnAX</li><li>14 anAX</li><li>15
|
|
# aAX</li></ul>
|
|
nickname=None, # Nickname for this Virtual STA. (No longer used)
|
|
radio=None, # Name of the physical radio interface, for example: wiphy0
|
|
rate=None, # Max rate, see help above.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
ssid=None, # SSID for this Virtual STA. Use [BLANK] for empty SSID. Start with
|
|
# <tt>0x</tt> for HEX interpretation.
|
|
sta_br_ip=None, # IP Address for station bridging. Set to 0.0.0.0 to use MAC bridging.
|
|
sta_name=None, # Name for this Virtual STA, for example: sta0
|
|
wpa_cfg_file=None, # WPA Supplicant config file.
|
|
x_coord=None, # Floating point number.
|
|
y_coord=None, # Floating point number.
|
|
z_coord=None, # Floating point number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_sta(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if ampdu_density is not None:
|
|
data["ampdu_density"] = ampdu_density
|
|
if ampdu_factor is not None:
|
|
data["ampdu_factor"] = ampdu_factor
|
|
if ap is not None:
|
|
data["ap"] = ap
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if flags_mask is not None:
|
|
data["flags_mask"] = flags_mask
|
|
if ieee80211w is not None:
|
|
data["ieee80211w"] = ieee80211w
|
|
if key is not None:
|
|
data["key"] = key
|
|
if mac is not None:
|
|
data["mac"] = mac
|
|
if max_amsdu is not None:
|
|
data["max_amsdu"] = max_amsdu
|
|
if mode is not None:
|
|
data["mode"] = mode
|
|
if nickname is not None:
|
|
data["nickname"] = nickname
|
|
if radio is not None:
|
|
data["radio"] = radio
|
|
if rate is not None:
|
|
data["rate"] = rate
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if ssid is not None:
|
|
data["ssid"] = ssid
|
|
if sta_br_ip is not None:
|
|
data["sta_br_ip"] = sta_br_ip
|
|
if sta_name is not None:
|
|
data["sta_name"] = sta_name
|
|
if wpa_cfg_file is not None:
|
|
data["wpa_cfg_file"] = wpa_cfg_file
|
|
if x_coord is not None:
|
|
data["x_coord"] = x_coord
|
|
if y_coord is not None:
|
|
data["y_coord"] = y_coord
|
|
if z_coord is not None:
|
|
data["z_coord"] = z_coord
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_sta",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_T1_SPAN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_t1_span
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddT1SpanBuildout(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
p_15db = 6 # -15db (CSU)
|
|
p_22_5db = 7 # -22.5db (CSU)
|
|
p_7_5db = 5 # -7.5db (CSU)
|
|
p_0db = 8 # 0db (CSU)
|
|
p_133_ft = 0 # 1-133 feet
|
|
p_266_ft = 1 # 122-266 feet
|
|
p_399_ft = 2 # 266-399 feet
|
|
p_533_ft = 3 # 399-533 feet
|
|
p_655_ft = 4 # 533-655 feet
|
|
|
|
def post_add_t1_span(self,
|
|
buildout=None, # Buildout, Integer, see above.
|
|
coding=None, # Coding: T1: ami or b8zs. E1: ami or hdb3
|
|
cpu_id=None, # CPU identifier (A, B, etc) for multiport Sangoma resources.
|
|
first_channel=None, # The first DS0 channel for this span.
|
|
framing=None, # Framing: T1: esf or d4. E1: cas or ccs.
|
|
mtu=None, # MTU for this span (used by in-band management, if at all).
|
|
pci_bus=None, # PCI Bus number, needed for Sangoma resources.
|
|
pci_slot=None, # PCI slot number, needed for Sangoma resources.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf name/id.
|
|
span_num=None, # The span number. First span is 1, second is 2...
|
|
timing=None, # Timing: 0 == do not use, 1 == primary, 2 == secondary..
|
|
p_type=None, # Currently supported types are: Sangoma_T1, Sangoma_E1, Digium_T1
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_t1_span(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if buildout is not None:
|
|
data["buildout"] = buildout
|
|
if coding is not None:
|
|
data["coding"] = coding
|
|
if cpu_id is not None:
|
|
data["cpu_id"] = cpu_id
|
|
if first_channel is not None:
|
|
data["first_channel"] = first_channel
|
|
if framing is not None:
|
|
data["framing"] = framing
|
|
if mtu is not None:
|
|
data["mtu"] = mtu
|
|
if pci_bus is not None:
|
|
data["pci_bus"] = pci_bus
|
|
if pci_slot is not None:
|
|
data["pci_slot"] = pci_slot
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if span_num is not None:
|
|
data["span_num"] = span_num
|
|
if timing is not None:
|
|
data["timing"] = timing
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_t1_span",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_TEXT_BLOB> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_text_blob
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_text_blob(self,
|
|
name=None, # Text name, for instance '2-AP-test-case'
|
|
text=None, # [BLANK] will erase all, any other text will be appended to existing
|
|
# text. <tt escapearg='false'>Unescaped Value</tt>
|
|
p_type=None, # Text type identifier stream, for instance 'cv-connectivity'
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_text_blob(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if text is not None:
|
|
data["text"] = text
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_text_blob",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_TGCX> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_tgcx
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_tgcx(self,
|
|
cxname=None, # The name of the CX.
|
|
tgname=None, # The name of the test group.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_tgcx(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cxname is not None:
|
|
data["cxname"] = cxname
|
|
if tgname is not None:
|
|
data["tgname"] = tgname
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_tgcx",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_THRESHOLD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_threshold
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddThresholdThreshId(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
Delete_Marked = -3 # Delete any marked.
|
|
Mark_All = -2 # Mark all
|
|
|
|
class AddThresholdThreshType(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
NO_RX_SINCE = 6 # Have not received any bytes/packets in specified time.
|
|
RX_BPS_RATE_OOR_1m = 5 # rx-bps over last 1 minute is out of range.
|
|
RX_BPS_RATE_OOR_30S = 3 # rx-bps over last 30 seconds is out of range.
|
|
RX_BPS_RATE_OOR_3S = 1 # rx-bps over last 3 seconds is out of range.
|
|
TT_RX_DROP_OOR = 8 # RX Drop percentage is out of range (per-million).
|
|
TT_RX_LAT_OOR = 7 # Latency running-average out of range.
|
|
TX_BPS_RATE_OOR_1m = 4 # tx-bps over last 1 minute is out of range.
|
|
TX_BPS_RATE_OOR_30S = 2 # tx-bps over last 30 seconds is out of range.
|
|
TX_BPS_RATE_OOR_3S = 0 # tx-bps over last 3 seconds is out of range.
|
|
|
|
def post_add_threshold(self,
|
|
endp=None, # Endpoint name or ID.
|
|
thresh_id=None, # Threshold ID. If adding new threshold, use -1, otherwise use
|
|
# correct ID.
|
|
thresh_max=None, # Maximum acceptable value for this threshold.
|
|
thresh_min=None, # Minimum acceptable value for this threshold.
|
|
thresh_type=None, # Threshold type, integer, (see above).
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_threshold(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp is not None:
|
|
data["endp"] = endp
|
|
if thresh_id is not None:
|
|
data["thresh_id"] = thresh_id
|
|
if thresh_max is not None:
|
|
data["thresh_max"] = thresh_max
|
|
if thresh_min is not None:
|
|
data["thresh_min"] = thresh_min
|
|
if thresh_type is not None:
|
|
data["thresh_type"] = thresh_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_threshold",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_TM> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_tm
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_tm(self,
|
|
name=None, # The name of the test manager. Must be unique across test managers.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_tm(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_tm",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_TRAFFIC_PROFILE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_traffic_profile
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddTrafficProfileTrafficProfileFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddTrafficProfileTrafficProfileFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
BI_DIRECTIONAL = 0x2 # Should we do bi-directional traffic?
|
|
IPERF_UDP = 0x4 # If Iperf, should use UDP. If not set, then will use TCP.
|
|
UP = 0x1 # Upload direction (this not set means download)
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddTrafficProfileTrafficProfileFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class AddTrafficProfileWifiMode(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
Iperf3_Client = "Iperf3-Client" # iperf3 client
|
|
Iperf3_Server = "Iperf3-Server" # iperf3 server
|
|
as_is = "as_is" # Make no changes to current configuration
|
|
http = "http" # Not yet implemented
|
|
https = "https" # Not yet implemented
|
|
tcp = "tcp" #
|
|
udp = "udp" #
|
|
|
|
def post_add_traffic_profile(self,
|
|
instance_count=None, # Number of connections per device
|
|
max_pdu=None, # Minimum PDU size
|
|
max_speed=None, # Opposite-Direction Speed in bps.
|
|
min_pdu=None, # Minimum PDU size
|
|
min_speed=None, # Opposite-Direction Speed in bps.
|
|
name=None, # Profile Name.
|
|
tos=None, # IP Type-of-Service
|
|
traffic_profile_flags=None, # Flags for this profile, none defined at this point.
|
|
traffic_profile_flags_mask=None, # Specify what flags to set.
|
|
p_type=None, # Profile type: See above..
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_traffic_profile(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if instance_count is not None:
|
|
data["instance_count"] = instance_count
|
|
if max_pdu is not None:
|
|
data["max_pdu"] = max_pdu
|
|
if max_speed is not None:
|
|
data["max_speed"] = max_speed
|
|
if min_pdu is not None:
|
|
data["min_pdu"] = min_pdu
|
|
if min_speed is not None:
|
|
data["min_speed"] = min_speed
|
|
if name is not None:
|
|
data["name"] = name
|
|
if tos is not None:
|
|
data["tos"] = tos
|
|
if traffic_profile_flags is not None:
|
|
data["traffic_profile_flags"] = traffic_profile_flags
|
|
if traffic_profile_flags_mask is not None:
|
|
data["traffic_profile_flags_mask"] = traffic_profile_flags_mask
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_traffic_profile",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_TRAFFIC_PROFILE_NOTES> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_traffic_profile_notes
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_traffic_profile_notes(self,
|
|
dut=None, # Profile Name.
|
|
text=None, # [BLANK] will erase all, any other text will be appended
|
|
# to existing text. <tt escapearg='false'>Unescaped
|
|
# Value</tt>
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_traffic_profile_notes(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if dut is not None:
|
|
data["dut"] = dut
|
|
if text is not None:
|
|
data["text"] = text
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_traffic_profile_notes",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_VAP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_vap
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddVapFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddVapFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
p_80211h_enable = 0x10000000 # Enable 802.11h (needed for running on DFS channels) Requires
|
|
# +802.11d.
|
|
p_80211r_pmska_cache = 0x4000000 # Enable oportunistic PMSKA caching for WPA2 (Related to
|
|
# +802.11r).
|
|
p_80211u_additional = 0x100000 # AP requires additional step for access (802.11u Interworking)
|
|
p_80211u_auto = 0x40000 # Enable 802.11u (Interworking) Auto-internetworking feature.
|
|
# +Always enabled currently.
|
|
p_80211u_e911 = 0x200000 # AP claims emergency services reachable (802.11u Interworking)
|
|
p_80211u_e911_unauth = 0x400000 # AP provides Unauthenticated emergency services (802.11u
|
|
# +Interworking)
|
|
p_80211u_enable = 0x20000 # Enable 802.11u (Interworking) feature.
|
|
p_80211u_gw = 0x80000 # AP Provides access to internet (802.11u Interworking)
|
|
p_8021x_radius = 0x2000000 # Use 802.1x (RADIUS for AP).
|
|
create_admin_down = 0x1000000000 # Station should be created admin-down.
|
|
disable_dgaf = 0x1000000 # AP Disable DGAF (used by HotSpot 2.0).
|
|
disable_ht40 = 0x800 # Disable HT-40 (will use HT-20 if available).
|
|
disable_ht80 = 0x8000000 # Disable HT80 (for AC chipset NICs only)
|
|
enable_80211d = 0x40 # Enable 802.11D to broadcast country-code & channels in
|
|
# +VAPs
|
|
enable_wpa = 0x10 # Enable WPA
|
|
hostapd_config = 0x20 # Use Custom hostapd config file.
|
|
hs20_enable = 0x800000 # Enable Hotspot 2.0 (HS20) feature. Requires WPA-2.
|
|
ht160_enable = 0x100000000 # Enable HT160 mode.
|
|
osen_enable = 0x40000000 # Enable OSEN protocol (OSU Server-only Authentication)
|
|
pri_sec_ch_enable = 0x100 # Enable Primary/Secondary channel switch.
|
|
short_preamble = 0x80 # Allow short-preamble
|
|
use_bss_load = 0x20000000000 # Enable BSS Load IE in Beacons and Probe Responses (.11e).
|
|
use_bss_transition = 0x80000000000 # Enable BSS transition.
|
|
use_rrm_report = 0x40000000000 # Enable Radio measurements IE in beacon and probe responses.
|
|
use_wpa3 = 0x10000000000 # Enable WPA-3 (SAE Personal) mode.
|
|
verbose = 0x10000 # Verbose-Debug: Increase debug info in wpa-supplicant and
|
|
# +hostapd logs.
|
|
wep_enable = 0x200 # Enable WEP Encryption
|
|
wpa2_enable = 0x400 # Enable WPA2 Encryption
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddVapFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class AddVapMode(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
p_802_11a = 1 # 802.11a
|
|
AUTO = 0 # 802.11g
|
|
aAX = 15 # 802.11a-AX (6E disables /n and /ac)
|
|
abg = 4 # 802.11abg
|
|
abgn = 5 # 802.11abgn
|
|
abgnAC = 8 # 802.11abgn-AC
|
|
abgnAX = 12 # 802.11abgn-AX
|
|
an = 10 # 802.11an
|
|
anAC = 9 # 802.11an-AC
|
|
anAX = 14 # 802.11an-AX
|
|
b = 2 # 802.11b
|
|
bg = 7 # 802.11bg
|
|
bgn = 6 # 802.11bgn
|
|
bgnAC = 11 # 802.11bgn-AC
|
|
bgnAX = 13 # 802.11bgn-AX
|
|
g = 3 # 802.11g
|
|
|
|
def post_add_vap(self,
|
|
ap_name=None, # Name for this Virtual AP, for example: vap0
|
|
beacon=None, # The beacon interval, in 1kus (1.024 ms), default 100, range: 15..65535
|
|
custom_cfg=None, # Custom hostapd config file, if you want to craft your own config.
|
|
dtim_period=None, # DTIM period, range 1..255. Default 2.
|
|
flags=None, # Flags for this interface (see above.)
|
|
flags_mask=None, # If set, only these flags will be considered.
|
|
frag_thresh=None, # UN-USED, Was Fragmentation threshold, which is now set with
|
|
# set_wifi_radio, use NA
|
|
ieee80211w=None, # Management Frame Protection: 0: disabled, 1: optional, 2: Required.
|
|
key=None, # Encryption key for this Virtual AP. Prepend with 0x for ascii-hex
|
|
# representation.
|
|
mac=None, # The MAC address, can also use parent-pattern in 5.3.8 and higher:
|
|
# <tt>xx:xx:xx:*:*:xx</tt>
|
|
max_sta=None, # Maximum number of Stations allowed to join this AP (1..2007)
|
|
mode=None, # WiFi mode: see table
|
|
radio=None, # Name of the physical radio interface, for example: wiphy0
|
|
rate=None, # Max rate, see help for add_vsta
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
ssid=None, # SSID for this Virtual AP.
|
|
x_coord=None, # Floating point number.
|
|
y_coord=None, # Floating point number.
|
|
z_coord=None, # Floating point number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_vap(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if ap_name is not None:
|
|
data["ap_name"] = ap_name
|
|
if beacon is not None:
|
|
data["beacon"] = beacon
|
|
if custom_cfg is not None:
|
|
data["custom_cfg"] = custom_cfg
|
|
if dtim_period is not None:
|
|
data["dtim_period"] = dtim_period
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if flags_mask is not None:
|
|
data["flags_mask"] = flags_mask
|
|
if frag_thresh is not None:
|
|
data["frag_thresh"] = frag_thresh
|
|
if ieee80211w is not None:
|
|
data["ieee80211w"] = ieee80211w
|
|
if key is not None:
|
|
data["key"] = key
|
|
if mac is not None:
|
|
data["mac"] = mac
|
|
if max_sta is not None:
|
|
data["max_sta"] = max_sta
|
|
if mode is not None:
|
|
data["mode"] = mode
|
|
if radio is not None:
|
|
data["radio"] = radio
|
|
if rate is not None:
|
|
data["rate"] = rate
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if ssid is not None:
|
|
data["ssid"] = ssid
|
|
if x_coord is not None:
|
|
data["x_coord"] = x_coord
|
|
if y_coord is not None:
|
|
data["y_coord"] = y_coord
|
|
if z_coord is not None:
|
|
data["z_coord"] = z_coord
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_vap",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_VENUE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_venue
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddVenueFreq24(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddVenueFreq240, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
ALL = 0xffff # ALL
|
|
Ch_1 = 0x1 # Channel 1
|
|
Ch_2 = 0x2 # Channel 2
|
|
Ch_3 = 0x4 # Channel 3
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddVenueFreq24 has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class AddVenueFreq5(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddVenueFreq50, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
Ch_100 = 0x800 # Channel 100 5500
|
|
Ch_104 = 0x1000 # Channel 104 5520
|
|
Ch_108 = 0x2000 # Channel 108 5540
|
|
Ch_112 = 0x4000 # Channel 112 5560
|
|
Ch_116 = 0x8000 # Channel 116 5580
|
|
Ch_120 = 0x10000 # Channel 120 5600
|
|
Ch_124 = 0x20000 # Channel 124 5620
|
|
Ch_128 = 0x40000 # Channel 128 5640
|
|
Ch_132 = 0x80000 # Channel 132 5660
|
|
Ch_136 = 0x100000 # Channel 136 5680
|
|
Ch_140 = 0x200000 # Channel 140 5700
|
|
Ch_149 = 0x400000 # Channel 149 5745
|
|
Ch_153 = 0x800000 # Channel 153 5765
|
|
Ch_157 = 0x1000000 # Channel 157 5785
|
|
Ch_161 = 0x2000000 # Channel 161 5805
|
|
Ch_165 = 0x4000000 # Channel 165 5825
|
|
Ch_36 = 0x1 # Channel 36 5180
|
|
Ch_38 = 0x2 # Channel 38 5190
|
|
Ch_40 = 0x4 # Channel 40 5200
|
|
Ch_42 = 0x8 # Channel 42 5210
|
|
Ch_44 = 0x10 # Channel 44 5220
|
|
Ch_46 = 0x20 # Channel 46 5230
|
|
Ch_48 = 0x40 # Channel 48 5240
|
|
Ch_52 = 0x80 # Channel 52 5260
|
|
Ch_56 = 0x100 # Channel 56 5280
|
|
Ch_60 = 0x200 # Channel 60 5300
|
|
Ch_64 = 0x400 # Channel 64 5320
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddVenueFreq5 has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_add_venue(self,
|
|
description=None, # User-supplied description, ie: <tt>Big City Ball Park</tt>;
|
|
# 47-characters max.
|
|
freq_24=None, # Frequency list for 2.4Ghz band, see above.
|
|
freq_5=None, # Frequency list for 5Ghz band, see above.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
venu_id=None, # Number to uniquely identify this venue on this resource.
|
|
x1=None, # Floating point coordinate for lower-left corner.
|
|
x2=None, # Floating point coordinate for upper-right corner.
|
|
y1=None, # Floating point coordinate for lower-left corner.
|
|
y2=None, # Floating point coordinate for upper-right corner.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_venue(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if description is not None:
|
|
data["description"] = description
|
|
if freq_24 is not None:
|
|
data["freq_24"] = freq_24
|
|
if freq_5 is not None:
|
|
data["freq_5"] = freq_5
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if venu_id is not None:
|
|
data["venu_id"] = venu_id
|
|
if x1 is not None:
|
|
data["x1"] = x1
|
|
if x2 is not None:
|
|
data["x2"] = x2
|
|
if y1 is not None:
|
|
data["y1"] = y1
|
|
if y2 is not None:
|
|
data["y2"] = y2
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_venue",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_VLAN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_vlan
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_vlan(self,
|
|
old_name=None, # The temporary name, used for configuring un-discovered hardware.
|
|
port=None, # Port number of an existing Ethernet interface.
|
|
report_timer=None, # Report timer for this port, leave blank or use NA for defaults.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
vid=None, # The VLAN-ID for this 802.1Q VLAN interface.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_vlan(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if old_name is not None:
|
|
data["old_name"] = old_name
|
|
if port is not None:
|
|
data["port"] = port
|
|
if report_timer is not None:
|
|
data["report_timer"] = report_timer
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if vid is not None:
|
|
data["vid"] = vid
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_vlan",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_VOIP_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_voip_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_voip_endp(self,
|
|
alias=None, # Name of endpoint.
|
|
auth_user_name=None, # Use this field for authentication user name. AUTO or blank mean
|
|
# use phone number.
|
|
display_name=None, # User-Name to be displayed. Use AUTO to display phone number.
|
|
gateway_port=None, # IP Port for SIP gateway (defaults to 5060).
|
|
ip_addr=None, # Use this IP for local IP address. Useful when there are
|
|
# multiple IPs on a port.
|
|
peer_phone_num=None, # Use AUTO to use phone number of peer endpoint, otherwise
|
|
# specify a number: user[@host[:port]]
|
|
phone_num=None, # Phone number for Endpoint
|
|
port=None, # Port number or name.
|
|
proxy_passwd=None, # Password to be used when registering with proxy/gateway.
|
|
resource=None, # Resource number.
|
|
rtp_port=None, # RTP port to use for send and receive.
|
|
rx_sound_file=None, # File name to save received PCM data to. Will be in WAV format,
|
|
# or AUTO
|
|
shelf=None, # Shelf name/id.
|
|
sip_gateway=None, # SIP Gateway/Proxy Name, this is who to register with, or AUTO
|
|
tx_sound_file=None, # File name containing the sound sample we will be playing.
|
|
vad_max_timer=None, # How often should we force a packet, even if VAD is on.
|
|
vad_timer=None, # How much silence (milliseconds) before VAD is enabled.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_voip_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if auth_user_name is not None:
|
|
data["auth_user_name"] = auth_user_name
|
|
if display_name is not None:
|
|
data["display_name"] = display_name
|
|
if gateway_port is not None:
|
|
data["gateway_port"] = gateway_port
|
|
if ip_addr is not None:
|
|
data["ip_addr"] = ip_addr
|
|
if peer_phone_num is not None:
|
|
data["peer_phone_num"] = peer_phone_num
|
|
if phone_num is not None:
|
|
data["phone_num"] = phone_num
|
|
if port is not None:
|
|
data["port"] = port
|
|
if proxy_passwd is not None:
|
|
data["proxy_passwd"] = proxy_passwd
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if rtp_port is not None:
|
|
data["rtp_port"] = rtp_port
|
|
if rx_sound_file is not None:
|
|
data["rx_sound_file"] = rx_sound_file
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if sip_gateway is not None:
|
|
data["sip_gateway"] = sip_gateway
|
|
if tx_sound_file is not None:
|
|
data["tx_sound_file"] = tx_sound_file
|
|
if vad_max_timer is not None:
|
|
data["vad_max_timer"] = vad_max_timer
|
|
if vad_timer is not None:
|
|
data["vad_timer"] = vad_timer
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_voip_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_VR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_vr
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddVrFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddVrFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
p_4BYTE_AS_NUMBER = 0x40 # Sets corresponding Xorp flag.
|
|
BGP_CONFED = 0x100 # Configure BGP in a confederation.
|
|
BGP_DAMPING = 0x200 # Enable BGP damping section in Xorp configuration file.
|
|
ENABLE_BGP = 0x20 # Set this to zero if you don't want BGP on this VR.
|
|
RIP_ACCEPT_DR = 0x800 # Tell RIP to accept default-routes.
|
|
ROUTE_REFLECTOR = 0x80 # Act as BGP Route Reflector.
|
|
USE_IPV6 = 0x10 # Enable IPv6 OSPF routing for this virtual router.
|
|
USE_IPV6_RADVD = 0x8 # Enable IPv6 RADV Daemon for interfaces in this virtual router.
|
|
USE_RIP = 0x400 # Enable RIP routing protocol in Xorp.
|
|
USE_XORP_MCAST = 0x2 # Enable Xorp Multicast routing (requires OSPF to be enabled currently)
|
|
USE_XORP_OLSR = 0x1000 # Enable OLSR routing protocol in Xorp.
|
|
USE_XORP_OSPF = 0x1 # Enable Xorp router daemon with OSPF (IPv4) protocol
|
|
USE_XORP_SHA = 0x4 # Enable Telcordia's Xorp SHA option (requires OSPF to be enabled)
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddVrFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_add_vr(self,
|
|
alias=None, # Name of virtual router.
|
|
flags=None, # Virtual router flags, see above for definitions.
|
|
height=None, # Height to be used when drawn in the LANforge-GUI.
|
|
notes=None, # Notes for this Virtual Router. Put in quotes if the notes include
|
|
# white-space.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf name/id.
|
|
vr_id=None, # Leave blank, use NA or 0xFFFF unless you are certain of the value you
|
|
# want to enter.
|
|
width=None, # Width to be used when drawn in the LANforge-GUI.
|
|
x=None, # X coordinate to be used when drawn in the LANforge-GUI.
|
|
y=None, # Y coordinate to be used when drawn in the LANforge-GUI.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_vr(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if height is not None:
|
|
data["height"] = height
|
|
if notes is not None:
|
|
data["notes"] = notes
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if vr_id is not None:
|
|
data["vr_id"] = vr_id
|
|
if width is not None:
|
|
data["width"] = width
|
|
if x is not None:
|
|
data["x"] = x
|
|
if y is not None:
|
|
data["y"] = y
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_vr",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_VR_BGP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_vr_bgp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddVrBgpFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddVrBgpFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
p_4BYTE_AS_NUMBER = 0x40 # Sets corresponding Xorp flag.
|
|
BGP_CONFED = 0x100 # Configure BGP in a confederation.
|
|
BGP_DAMPING = 0x200 # Enable BGP damping section in Xorp configuration file.
|
|
ENABLE_BGP = 0x20 # Set this to zero if you don't want BGP on this VR.
|
|
ROUTE_REFLECTOR = 0x80 # Act as BGP Route Reflector.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddVrBgpFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_add_vr_bgp(self,
|
|
bgp_id=None, # BGP Identifier: IPv4 Address
|
|
cluster_id=None, # Cluster ID, IPv4 Address. Use NA if not clustering.
|
|
confed_id=None, # Confederation ID 1-65535. Use NA if not in a confederation.
|
|
flags=None, # Virtual router BGP flags, see above for definitions.
|
|
half_life=None, # Halflife in minutes for damping configuration.
|
|
local_as=None, # BGP Autonomous System number, 1-65535
|
|
max_suppress=None, # Maximum hold down time in minutes for damping configuration.
|
|
resource=None, # Resource number.
|
|
reuse=None, # Route flag damping reuse threshold, in minutes.
|
|
shelf=None, # Shelf name/id.
|
|
suppress=None, # Route flag damping cutoff threshold, in minutes.
|
|
vr_id=None, # Name of virtual router.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_vr_bgp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if bgp_id is not None:
|
|
data["bgp_id"] = bgp_id
|
|
if cluster_id is not None:
|
|
data["cluster_id"] = cluster_id
|
|
if confed_id is not None:
|
|
data["confed_id"] = confed_id
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if half_life is not None:
|
|
data["half_life"] = half_life
|
|
if local_as is not None:
|
|
data["local_as"] = local_as
|
|
if max_suppress is not None:
|
|
data["max_suppress"] = max_suppress
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if reuse is not None:
|
|
data["reuse"] = reuse
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if suppress is not None:
|
|
data["suppress"] = suppress
|
|
if vr_id is not None:
|
|
data["vr_id"] = vr_id
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_vr_bgp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_VRCX> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_vrcx
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddVrcxFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(AddVrcxFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
custom_dhcpd = 0x400 # Use custom DHCP config file
|
|
dhcpd_enabled = 0x200 # Serve IPv4 DHCP on this interface
|
|
ipv6_enabled = 0x2000 # Serve IPv6 DHCP on this interface
|
|
nat_enabled = 0x100 # This connection will NAT outgoing packets
|
|
subnet_0 = 0x1 # Specify subnet 0
|
|
subnet_1 = 0x2 # Specify subnet 1
|
|
subnet_2 = 0x4 # Specify subnet 2
|
|
subnet_3 = 0x8 # Specify subnet 3
|
|
subnet_4 = 0x10 # Specify subnet 4
|
|
subnet_5 = 0x20 # Specify subnet 5
|
|
subnet_6 = 0x40 # Specify subnet 6
|
|
subnet_7 = 0x80 # Specify subnet 7
|
|
use_multicast = 0x800 # Use this interface for multicast and-rp
|
|
use_vrrp = 0x1000 # Use this interface for VRRP
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("AddVrcxFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_add_vrcx(self,
|
|
dhcp_dns=None, # IP Address of DNS server.
|
|
dhcp_dns6=None, # IPv6 Address of DNS server.
|
|
dhcp_domain=None, # DHCP Domain name to serve.
|
|
dhcp_lease_time=None, # DHCP Lease time (in seconds)
|
|
dhcp_max=None, # Minimum IP address range to serve.
|
|
dhcp_max6=None, # Minimum IPv6 address to serve.
|
|
dhcp_min=None, # Minimum IP address range to serve.
|
|
dhcp_min6=None, # Minimum IPv6 address to serve.
|
|
flags=None, # Flags, specify if subnets 0-7 are in use, see above for others.
|
|
height=None, # Height to be used when drawn in the LANforge-GUI.
|
|
interface_cost=None, # If using OSPF, this sets the cost for this link (1-65535).
|
|
local_dev=None, # Name of port A, the local network device pair.
|
|
local_dev_b=None, # Name of port B for the local redirect device pair.
|
|
nexthop=None, # The next-hop to use when routing packets out this interface.
|
|
ospf_area=None, # If using OSPF, this sets the OSPF area for this interface. Default
|
|
# is 0.0.0.0.
|
|
remote_dev=None, # Name the remote network device.
|
|
remote_dev_b=None, # Name of port B for the remote network device.
|
|
resource=None, # Resource number.
|
|
rip_metric=None, # If using RIP, this determines the RIP metric (cost), (1-15, 15 is
|
|
# infinite).
|
|
shelf=None, # Shelf name/id.
|
|
subnets=None, # Subnets associated with this link, format: 1.1.1.1/24,1.1.2.1/16...
|
|
vr_name=None, # Virtual Router this endpoint belongs to. Use 'FREE_LIST' to add a
|
|
# stand-alone endpoint.
|
|
vrrp_id=None, # VRRP id, must be unique in this virtual router (1-255)
|
|
vrrp_interval=None, # VRRP broadcast message interval, in seconds (1-255)
|
|
vrrp_ip=None, # VRRP IPv4 address..ignored if not flagged for VRRP.
|
|
vrrp_ip_prefix=None, # Number of bits in subnet mask, ie 24 for 255.255.255.0
|
|
vrrp_priority=None, # VRRP Priority (1-255, higher is more priority.)
|
|
wanlink=None, # The name of the WanLink that connects the two B ports.
|
|
width=None, # Width to be used when drawn in the LANforge-GUI.
|
|
x=None, # X coordinate to be used when drawn in the LANforge-GUI.
|
|
y=None, # Y coordinate to be used when drawn in the LANforge-GUI.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_vrcx(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if dhcp_dns is not None:
|
|
data["dhcp_dns"] = dhcp_dns
|
|
if dhcp_dns6 is not None:
|
|
data["dhcp_dns6"] = dhcp_dns6
|
|
if dhcp_domain is not None:
|
|
data["dhcp_domain"] = dhcp_domain
|
|
if dhcp_lease_time is not None:
|
|
data["dhcp_lease_time"] = dhcp_lease_time
|
|
if dhcp_max is not None:
|
|
data["dhcp_max"] = dhcp_max
|
|
if dhcp_max6 is not None:
|
|
data["dhcp_max6"] = dhcp_max6
|
|
if dhcp_min is not None:
|
|
data["dhcp_min"] = dhcp_min
|
|
if dhcp_min6 is not None:
|
|
data["dhcp_min6"] = dhcp_min6
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if height is not None:
|
|
data["height"] = height
|
|
if interface_cost is not None:
|
|
data["interface_cost"] = interface_cost
|
|
if local_dev is not None:
|
|
data["local_dev"] = local_dev
|
|
if local_dev_b is not None:
|
|
data["local_dev_b"] = local_dev_b
|
|
if nexthop is not None:
|
|
data["nexthop"] = nexthop
|
|
if ospf_area is not None:
|
|
data["ospf_area"] = ospf_area
|
|
if remote_dev is not None:
|
|
data["remote_dev"] = remote_dev
|
|
if remote_dev_b is not None:
|
|
data["remote_dev_b"] = remote_dev_b
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if rip_metric is not None:
|
|
data["rip_metric"] = rip_metric
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if subnets is not None:
|
|
data["subnets"] = subnets
|
|
if vr_name is not None:
|
|
data["vr_name"] = vr_name
|
|
if vrrp_id is not None:
|
|
data["vrrp_id"] = vrrp_id
|
|
if vrrp_interval is not None:
|
|
data["vrrp_interval"] = vrrp_interval
|
|
if vrrp_ip is not None:
|
|
data["vrrp_ip"] = vrrp_ip
|
|
if vrrp_ip_prefix is not None:
|
|
data["vrrp_ip_prefix"] = vrrp_ip_prefix
|
|
if vrrp_priority is not None:
|
|
data["vrrp_priority"] = vrrp_priority
|
|
if wanlink is not None:
|
|
data["wanlink"] = wanlink
|
|
if width is not None:
|
|
data["width"] = width
|
|
if x is not None:
|
|
data["x"] = x
|
|
if y is not None:
|
|
data["y"] = y
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_vrcx",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_VRCX2> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_vrcx2
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_add_vrcx2(self,
|
|
local_dev=None, # Name of port A for the connection.
|
|
nexthop6=None, # The IPv6 next-hop to use when routing packets out this interface.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf name/id.
|
|
subnets6=None, # IPv6 Subnets associated with this link, format:
|
|
# aaaa:bbbb::0/64,cccc:dddd:eeee::0/64...
|
|
vr_name=None, # Virtual Router this endpoint belongs to. Use 'FREE_LIST' to add a
|
|
# stand-alone endpoint.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_vrcx2(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if local_dev is not None:
|
|
data["local_dev"] = local_dev
|
|
if nexthop6 is not None:
|
|
data["nexthop6"] = nexthop6
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if subnets6 is not None:
|
|
data["subnets6"] = subnets6
|
|
if vr_name is not None:
|
|
data["vr_name"] = vr_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_vrcx2",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADD_WL_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#add_wl_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class AddWlEndpWleFlags(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
SHOW_WP = 1 # Show WanPaths in wanlink endpoint table in GUI
|
|
|
|
def post_add_wl_endp(self,
|
|
alias=None, # Name of WanPath.
|
|
cpu_id=None, # The CPU/thread that this process should run on (kernel-mode
|
|
# only).
|
|
description=None, # Description for this endpoint, put in single quotes if it
|
|
# contains spaces.
|
|
dest_ip=None, # Selection filter: Destination IP.
|
|
dest_ip_mask=None, # Selection filter: Destination IP MASK.
|
|
drop_every_xth_pkt=None, # YES to periodically drop every Xth pkt, NO to drop packets
|
|
# randomly.
|
|
drop_freq=None, # How often, out of 1,000,000 packets, should we purposefully
|
|
# drop a packet.
|
|
dup_every_xth_pkt=None, # YES to periodically duplicate every Xth pkt, NO to duplicate
|
|
# packets randomly.
|
|
dup_freq=None, # How often, out of 1,000,000 packets, should we purposefully
|
|
# duplicate a packet.
|
|
extra_buffer=None, # The extra amount of bytes to buffer before dropping pkts, in
|
|
# units of 1024, use -1 for AUTO.
|
|
ignore_bandwidth=None, # Should we ignore the bandwidth settings from the playback
|
|
# file? YES, NO, or NA.
|
|
ignore_dup=None, # Should we ignore the Duplicate Packet settings from the
|
|
# playback file? YES, NO, or NA.
|
|
ignore_latency=None, # Should we ignore the latency settings from the playback file?
|
|
# YES, NO, or NA.
|
|
ignore_loss=None, # Should we ignore the packet-loss settings from the playback
|
|
# file? YES, NO, or NA.
|
|
jitter_freq=None, # How often, out of 1,000,000 packets, should we apply random
|
|
# jitter.
|
|
latency=None, # The base latency added to all packets, in milliseconds (or add
|
|
# 'us' suffix for microseconds)
|
|
max_drop_amt=None, # Maximum amount of packets to drop in a row. Default is 1.
|
|
max_jitter=None, # The maximum jitter, in milliseconds (or add 'us' suffix for
|
|
# microseconds)
|
|
max_lateness=None, # Maximum amount of un-intentional delay before pkt is dropped.
|
|
# Default is AUTO
|
|
max_rate=None, # Maximum transmit rate (bps) for this WanLink.
|
|
max_reorder_amt=None, # Maximum amount of packets by which to reorder, Default is 10.
|
|
min_drop_amt=None, # Minimum amount of packets to drop in a row. Default is 1.
|
|
min_reorder_amt=None, # Minimum amount of packets by which to reorder, Default is 1.
|
|
playback_capture=None, # ON or OFF, should we play back a WAN capture file?
|
|
playback_capture_file=None, # Name of the WAN capture file to play back.
|
|
playback_loop=None, # Should we loop the playback file, YES or NO or NA.
|
|
port=None, # Port number.
|
|
reorder_every_xth_pkt=None, # YES to periodically reorder every Xth pkt, NO to reorder
|
|
# packets randomly.
|
|
reorder_freq=None, # How often, out of 1,000,000 packets, should we make a packet
|
|
# out of order.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf name/id.
|
|
source_ip=None, # Selection filter: Source IP.
|
|
source_ip_mask=None, # Selection filter: Source IP MASK.
|
|
speed=None, # The maximum speed this WanLink will accept (bps).
|
|
test_mgr=None, # The name of the Test-Manager this WanPath is to use. Leave
|
|
# blank for no restrictions.
|
|
wanlink=None, # Name of WanLink to which we are adding this WanPath.
|
|
wle_flags=None, # WanLink Endpoint specific flags, see above.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_add_wl_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if cpu_id is not None:
|
|
data["cpu_id"] = cpu_id
|
|
if description is not None:
|
|
data["description"] = description
|
|
if dest_ip is not None:
|
|
data["dest_ip"] = dest_ip
|
|
if dest_ip_mask is not None:
|
|
data["dest_ip_mask"] = dest_ip_mask
|
|
if drop_every_xth_pkt is not None:
|
|
data["drop_every_xth_pkt"] = drop_every_xth_pkt
|
|
if drop_freq is not None:
|
|
data["drop_freq"] = drop_freq
|
|
if dup_every_xth_pkt is not None:
|
|
data["dup_every_xth_pkt"] = dup_every_xth_pkt
|
|
if dup_freq is not None:
|
|
data["dup_freq"] = dup_freq
|
|
if extra_buffer is not None:
|
|
data["extra_buffer"] = extra_buffer
|
|
if ignore_bandwidth is not None:
|
|
data["ignore_bandwidth"] = ignore_bandwidth
|
|
if ignore_dup is not None:
|
|
data["ignore_dup"] = ignore_dup
|
|
if ignore_latency is not None:
|
|
data["ignore_latency"] = ignore_latency
|
|
if ignore_loss is not None:
|
|
data["ignore_loss"] = ignore_loss
|
|
if jitter_freq is not None:
|
|
data["jitter_freq"] = jitter_freq
|
|
if latency is not None:
|
|
data["latency"] = latency
|
|
if max_drop_amt is not None:
|
|
data["max_drop_amt"] = max_drop_amt
|
|
if max_jitter is not None:
|
|
data["max_jitter"] = max_jitter
|
|
if max_lateness is not None:
|
|
data["max_lateness"] = max_lateness
|
|
if max_rate is not None:
|
|
data["max_rate"] = max_rate
|
|
if max_reorder_amt is not None:
|
|
data["max_reorder_amt"] = max_reorder_amt
|
|
if min_drop_amt is not None:
|
|
data["min_drop_amt"] = min_drop_amt
|
|
if min_reorder_amt is not None:
|
|
data["min_reorder_amt"] = min_reorder_amt
|
|
if playback_capture is not None:
|
|
data["playback_capture"] = playback_capture
|
|
if playback_capture_file is not None:
|
|
data["playback_capture_file"] = playback_capture_file
|
|
if playback_loop is not None:
|
|
data["playback_loop"] = playback_loop
|
|
if port is not None:
|
|
data["port"] = port
|
|
if reorder_every_xth_pkt is not None:
|
|
data["reorder_every_xth_pkt"] = reorder_every_xth_pkt
|
|
if reorder_freq is not None:
|
|
data["reorder_freq"] = reorder_freq
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if source_ip is not None:
|
|
data["source_ip"] = source_ip
|
|
if source_ip_mask is not None:
|
|
data["source_ip_mask"] = source_ip_mask
|
|
if speed is not None:
|
|
data["speed"] = speed
|
|
if test_mgr is not None:
|
|
data["test_mgr"] = test_mgr
|
|
if wanlink is not None:
|
|
data["wanlink"] = wanlink
|
|
if wle_flags is not None:
|
|
data["wle_flags"] = wle_flags
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/add_wl_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/ADMIN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#admin
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_admin(self,
|
|
arg1=None, # Argument 1: xorp-port | scan-rslts-file | iface-name | iface-eid |
|
|
# rfgen-message | id
|
|
arg2=None, # Argument 2: scan key | message | angle | dest-radio
|
|
arg3=None, # Argument 3: noprobe | migrate-sta-mac-pattern
|
|
arg5=None, # Argument 4: table-speed
|
|
cmd=None, # Admin command:
|
|
# resync_clock|write_xorp_cfg|scan_complete|ifup_post_complete|flush_complete|req_migrate|rfgen|chamber|clean_logs
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_admin(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if arg1 is not None:
|
|
data["arg1"] = arg1
|
|
if arg2 is not None:
|
|
data["arg2"] = arg2
|
|
if arg3 is not None:
|
|
data["arg3"] = arg3
|
|
if arg5 is not None:
|
|
data["arg5"] = arg5
|
|
if cmd is not None:
|
|
data["cmd"] = cmd
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/admin",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/APPLY_VR_CFG> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#apply_vr_cfg
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_apply_vr_cfg(self,
|
|
resource=None, # The number of the resource in question, or 'ALL'.
|
|
shelf=None, # The number of the shelf in question, or 'ALL'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_apply_vr_cfg(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/apply_vr_cfg",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/BLINK_ATTENUATOR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#blink_attenuator
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_blink_attenuator(self,
|
|
resource=None, # Resource number.
|
|
serno=None, # Serial number for requested Attenuator, or 'all'.
|
|
shelf=None, # Shelf number, usually 1.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_blink_attenuator(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if serno is not None:
|
|
data["serno"] = serno
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/blink_attenuator",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/C_SHOW_PORTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#c_show_ports
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class CShowPortsProbeFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(CShowPortsProbeFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
BRIDGE = 0x8 # 8 include bridges
|
|
EASY_IP_INFO = 0x10 # 16 Everything but gateway information, which is expensive to probe.
|
|
ETHTOOL = 0x4 # 4 include ethtool results
|
|
GW = 0x20 # 32 include gateway information
|
|
GW_FORCE_REFRESH = 0x40 # 64 Force GW (re)probe. Otherwise, cached values *might* be used.
|
|
MII = 0x2 # 2 include MII
|
|
WIFI = 0x1 # 1 include wifi stations
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("CShowPortsProbeFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_c_show_ports(self,
|
|
port=None, # Port number, or 'all'.
|
|
probe_flags=None, # See above, add them together for multiple probings. Leave blank if
|
|
# you want stats only.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_c_show_ports(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if port is not None:
|
|
data["port"] = port
|
|
if probe_flags is not None:
|
|
data["probe_flags"] = probe_flags
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/c_show_ports",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/CANCEL_VR_CFG> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#cancel_vr_cfg
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_cancel_vr_cfg(self,
|
|
resource=None, # The number of the resource in question, or 'ALL'.
|
|
shelf=None, # The number of the shelf in question, or 'ALL'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_cancel_vr_cfg(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/cancel_vr_cfg",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/CLEAR_CD_COUNTERS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#clear_cd_counters
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_clear_cd_counters(self,
|
|
cd_name=None, # Name of Collision Domain, or 'all'. Null argument is same as
|
|
# 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_clear_cd_counters(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cd_name is not None:
|
|
data["cd_name"] = cd_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/clear_cd_counters",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/CLEAR_CX_COUNTERS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#clear_cx_counters
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_clear_cx_counters(self,
|
|
cx_name=None, # Name of Cross Connect, or 'all'. Null argument is same as
|
|
# 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_clear_cx_counters(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cx_name is not None:
|
|
data["cx_name"] = cx_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/clear_cx_counters",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/CLEAR_ENDP_COUNTERS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#clear_endp_counters
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_clear_endp_counters(self,
|
|
endp_name=None, # Name of Endpoint, or 'all'. Null argument is same as
|
|
# 'all'.
|
|
incr_seqno=None, # Enter 'YES' if you want the target to increment the
|
|
# cfg-seq-no.
|
|
just_latency=None, # Enter 'YES' if you only want to clear latency counters,
|
|
# and see above for RXGAP.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_clear_endp_counters(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp_name is not None:
|
|
data["endp_name"] = endp_name
|
|
if incr_seqno is not None:
|
|
data["incr_seqno"] = incr_seqno
|
|
if just_latency is not None:
|
|
data["just_latency"] = just_latency
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/clear_endp_counters",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/CLEAR_GROUP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#clear_group
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_clear_group(self,
|
|
name=None, # The name of the test group.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_clear_group(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/clear_group",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/CLEAR_PORT_COUNTERS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#clear_port_counters
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class ClearPortCountersExtra(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
dhcp4_lease = "dhcp4_lease" # Remove dhcp lease files for IPv4 DHCP
|
|
dhcp6_lease = "dhcp6_lease" # Remove dhcp lease files for IPv6 DHCP
|
|
dhcp_leases = "dhcp_leases" # Remove dhcp lease files for IPv4 and IPv6 DHCP
|
|
|
|
def post_clear_port_counters(self,
|
|
extra=None, # Clear something else instead: dhcp4_lease | dhcp6_lease |
|
|
# dhcp_leases
|
|
port=None, # The number of the port in question, or 'ALL'.
|
|
resource=None, # The number of the resource in question, or 'ALL'.
|
|
shelf=None, # The number of the shelf in question, or 'ALL'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_clear_port_counters(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if extra is not None:
|
|
data["extra"] = extra
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/clear_port_counters",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/CLEAR_RESOURCE_COUNTERS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#clear_resource_counters
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_clear_resource_counters(self,
|
|
resource=None, # The number of the resource in question, or 'ALL'.
|
|
shelf=None, # The number of the shelf in question, or 'ALL'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_clear_resource_counters(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/clear_resource_counters",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/CLEAR_WP_COUNTERS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#clear_wp_counters
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_clear_wp_counters(self,
|
|
endp_name=None, # Name of WanLink Endpoint.
|
|
wp_name=None, # Name of WanPath to clear.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_clear_wp_counters(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp_name is not None:
|
|
data["endp_name"] = endp_name
|
|
if wp_name is not None:
|
|
data["wp_name"] = wp_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/clear_wp_counters",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/CREATE_CLIENT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#create_client
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_create_client(self,
|
|
name=None, # A single name with no white-spaces (15 characters or less)
|
|
password=None, # Can be blank or 'NA' if no password is set, otherwise must be the
|
|
# password. Use IGNORE for no change.
|
|
super_user=None, # 1 If you want this user to have Administrative powers, 0 or blank
|
|
# otherwise.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_create_client(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if password is not None:
|
|
data["password"] = password
|
|
if super_user is not None:
|
|
data["super_user"] = super_user
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/create_client",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/DIAG> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#diag
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_diag(self,
|
|
arg1=None, # Optional: Endpoint name to diag.
|
|
p_type=None, # Default (blank) is everything, options: alerts, license, counters, fds,
|
|
# clients, endpoints, shelf, iobuffer.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_diag(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if arg1 is not None:
|
|
data["arg1"] = arg1
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/diag",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/DISCOVER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#discover
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_discover(self,
|
|
disconnect=None, # Set to 'disconnect' to force disconnect to remote resource process.
|
|
resource=None, # Resource ID. Use if discovering Attenuators.
|
|
shelf=None, # Shelf-ID, only used if discovering Attenuators.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_discover(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if disconnect is not None:
|
|
data["disconnect"] = disconnect
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/discover",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/DO_PESQ> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#do_pesq
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_do_pesq(self,
|
|
endp_name=None, # Name of Endpoint.
|
|
result_file_name=None, # The name of the file received by the endpoint.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_do_pesq(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp_name is not None:
|
|
data["endp_name"] = endp_name
|
|
if result_file_name is not None:
|
|
data["result_file_name"] = result_file_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/do_pesq",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/FILE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#file
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_file(self,
|
|
card=None, # Card ID
|
|
cmd=None, # Only 'Download' supported for now, 'Upload' reserved for future use.
|
|
filename=None, # File to transfer.
|
|
shelf=None, # Shelf ID
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_file(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if card is not None:
|
|
data["card"] = card
|
|
if cmd is not None:
|
|
data["cmd"] = cmd
|
|
if filename is not None:
|
|
data["filename"] = filename
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/file",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/FLASH_ATTENUATOR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#flash_attenuator
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_flash_attenuator(self,
|
|
filename=None, # File to use when uploading to attenuator.
|
|
resource=None, # Resource number.
|
|
serno=None, # Serial number for requested Attenuator, or 'all'.
|
|
shelf=None, # Shelf number, usually 1.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_flash_attenuator(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if filename is not None:
|
|
data["filename"] = filename
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if serno is not None:
|
|
data["serno"] = serno
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/flash_attenuator",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETAVGLATENCY> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#getavglatency
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_getavglatency(self,
|
|
aorb=None, # For AtoB, enter 'B', for BtoA, enter 'A'.
|
|
cx=None, # Cross-connect or Test-Group name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_getavglatency(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/getavglatency",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETINRXBPS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#getinrxbps
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_getinrxbps(self,
|
|
aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
|
|
cx=None, # Cross-connect or Test-Group name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_getinrxbps(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/getinrxbps",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETINRXRATE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#getinrxrate
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_getinrxrate(self,
|
|
aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
|
|
cx=None, # Cross-connect or Test-Group name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_getinrxrate(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/getinrxrate",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETINTXRATE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#getintxrate
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_getintxrate(self,
|
|
aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
|
|
cx=None, # Cross-connect or Test-Group name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_getintxrate(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/getintxrate",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETIPADD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#getipadd
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_getipadd(self,
|
|
aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
|
|
cx=None, # Cross-connect name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_getipadd(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/getipadd",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETMAC> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#getmac
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_getmac(self,
|
|
aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
|
|
cx=None, # Cross-connect name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_getmac(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/getmac",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETMASK> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#getmask
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_getmask(self,
|
|
aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
|
|
cx=None, # Cross-connect name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_getmask(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/getmask",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETPKTDROPS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#getpktdrops
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_getpktdrops(self,
|
|
aorb=None, # For AtoB, enter 'B', for BtoA, enter 'A'.
|
|
cx=None, # Cross-connect or Test-Group name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_getpktdrops(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/getpktdrops",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETRXENDPERRPKTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#getrxendperrpkts
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_getrxendperrpkts(self,
|
|
aorb=None, # For AtoB, enter 'B', for BtoA, enter 'A'.
|
|
cx=None, # Cross-connect or Test-Group name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_getrxendperrpkts(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/getrxendperrpkts",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETRXPKTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#getrxpkts
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_getrxpkts(self,
|
|
aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
|
|
cx=None, # Cross-connect or Test-Group name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_getrxpkts(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/getrxpkts",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETRXPORTERRPKTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#getrxporterrpkts
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_getrxporterrpkts(self,
|
|
aorb=None, # For AtoB, enter 'B', for BtoA, enter 'A'.
|
|
cx=None, # Cross-connect name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_getrxporterrpkts(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/getrxporterrpkts",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GETTXPKTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#gettxpkts
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_gettxpkts(self,
|
|
aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
|
|
cx=None, # Cross-connect or Test-Group name
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_gettxpkts(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if aorb is not None:
|
|
data["aorb"] = aorb
|
|
if cx is not None:
|
|
data["cx"] = cx
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/gettxpkts",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/GOSSIP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#gossip
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_gossip(self,
|
|
message=None, # Message to show to others currently logged on. <tt
|
|
# escapearg='false'>Unescaped Value</tt>
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_gossip(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if message is not None:
|
|
data["message"] = message
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/gossip",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/HELP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#help
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_help(self,
|
|
command=None, # The command to get help for. Can be 'all', or blank.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_help(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if command is not None:
|
|
data["command"] = command
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/help",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/INIT_WISER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#init_wiser
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_init_wiser(self,
|
|
file_name=None, # The WISER file name for the desired emulation, or 'NA' for empty
|
|
# string.
|
|
node_count=None, # The number of WISER nodes for the desired emulation, or 'NA' for
|
|
# empty string.
|
|
resource=None, # The number of the resource in question.
|
|
shelf=None, # The number of the shelf in question.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_init_wiser(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if file_name is not None:
|
|
data["file_name"] = file_name
|
|
if node_count is not None:
|
|
data["node_count"] = node_count
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/init_wiser",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/LICENSES> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#licenses
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_licenses(self,
|
|
popup=None, # If 'popup', then cause a GUI popup msg, otherwise, just show text.
|
|
show_file=None, # If 'yes', then show the license file, not the parsed license
|
|
# information.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_licenses(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if popup is not None:
|
|
data["popup"] = popup
|
|
if show_file is not None:
|
|
data["show_file"] = show_file
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/licenses",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/LOAD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#load
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_load(self,
|
|
action=None, # Should be 'append' or 'overwrite'.
|
|
clean_chambers=None, # If yes, then Chambers will be cleaned up when overwrite is selected,
|
|
# otherwise they will be kept.
|
|
clean_dut=None, # If yes, then DUT will be cleaned up when overwrite is selected,
|
|
# otherwise they will be kept.
|
|
clean_profiles=None, # If yes, then clean all profiles when overwrite is selected, otherwise
|
|
# they will be kept.
|
|
name=None, # The name of the database to load. (DFLT is the default)
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_load(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if action is not None:
|
|
data["action"] = action
|
|
if clean_chambers is not None:
|
|
data["clean_chambers"] = clean_chambers
|
|
if clean_dut is not None:
|
|
data["clean_dut"] = clean_dut
|
|
if clean_profiles is not None:
|
|
data["clean_profiles"] = clean_profiles
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/load",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/LOG_LEVEL> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#log_level
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class LogLevelLevel(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(LogLevelLevel0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
ALL = 0xffffffff # Log everything
|
|
CUST1 = 0x10000 # Cust-1, latency info (65536)
|
|
DB = 0x80 # Database related logging (128)
|
|
DBG = 0x20 # debug (32)
|
|
DBG2 = 0x1000 # very verbose logging (4096)
|
|
DIS = 0x1 # disasters (1)
|
|
ERR = 0x2 # errors (2)
|
|
INF = 0x8 # info (8)
|
|
LIO = 0x2000 # IO logging (8192)
|
|
LL_PROF = 0x8000 # Profiling information (32768)
|
|
OUT1 = 0x4000 # Some std-out logging (16384)
|
|
PARSE = 0x800 # PARSE specific (2048)
|
|
SCRIPT = 0x400 # Scripting specific stuff (1024)
|
|
SEC = 0x40 # log security violations (64)
|
|
TRC = 0x10 # function trace (16)
|
|
WRN = 0x4 # warnings (4)
|
|
XMT = 0x100 # Output going to clients (256)
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("LogLevelLevel has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_log_level(self,
|
|
level=None, # Integer corresponding to the logging flags.
|
|
target=None, # Options: 'gnu' | [file-endp-name].
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_log_level(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if level is not None:
|
|
data["level"] = level
|
|
if target is not None:
|
|
data["target"] = target
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/log_level",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/LOG_MSG> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#log_msg
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_log_msg(self,
|
|
message=None, # Message to log. <tt escapearg='false'>Unescaped Value</tt>
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_log_msg(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if message is not None:
|
|
data["message"] = message
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/log_msg",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/LOGIN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#login
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_login(self,
|
|
name=None, # A single name with no white-spaces (15 characters or less)
|
|
password=None, # Can be blank or 'NA' if no password is set, otherwise must be the
|
|
# password.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_login(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if password is not None:
|
|
data["password"] = password
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/login",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/MOTD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#motd
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_motd(self,
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_motd(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
response = self.json_post("/cli-json/motd",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/NC_SHOW_CD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#nc_show_cd
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_nc_show_cd(self,
|
|
collision_domain=None, # Name of the Collision Domain, or 'all'.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_nc_show_cd(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if collision_domain is not None:
|
|
data["collision_domain"] = collision_domain
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/nc_show_cd",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/NC_SHOW_CHANNEL_GROUPS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#nc_show_channel_groups
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_nc_show_channel_groups(self,
|
|
channel_name=None, # Name of the channel, or 'all'.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_nc_show_channel_groups(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if channel_name is not None:
|
|
data["channel_name"] = channel_name
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/nc_show_channel_groups",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/NC_SHOW_ENDPOINTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#nc_show_endpoints
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_nc_show_endpoints(self,
|
|
endpoint=None, # Name of endpoint, or 'all'.
|
|
extra=None, # See above.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_nc_show_endpoints(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endpoint is not None:
|
|
data["endpoint"] = endpoint
|
|
if extra is not None:
|
|
data["extra"] = extra
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/nc_show_endpoints",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/NC_SHOW_PESQ> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#nc_show_pesq
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_nc_show_pesq(self,
|
|
endpoint=None, # Name of endpoint, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_nc_show_pesq(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endpoint is not None:
|
|
data["endpoint"] = endpoint
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/nc_show_pesq",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/NC_SHOW_PORTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#nc_show_ports
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class NcShowPortsProbeFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(NcShowPortsProbeFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
BRIDGE = 0x8 # 8 include bridges
|
|
EASY_IP_INFO = 0x10 # 16 Everything but gateway information, which is expensive to probe.
|
|
ETHTOOL = 0x4 # 4 include ethtool results
|
|
GW = 0x20 # 32 include gateway information
|
|
GW_FORCE_REFRESH = 0x40 # 64 Force GW (re)probe. Otherwise, cached values *might* be used.
|
|
MII = 0x2 # 2 include MII
|
|
WIFI = 0x1 # 1 include wifi stations
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("NcShowPortsProbeFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_nc_show_ports(self,
|
|
port=None, # Port number, or 'all'.
|
|
probe_flags=None, # See above, add them together for multiple probings. Leave blank
|
|
# if you want stats only.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_nc_show_ports(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if port is not None:
|
|
data["port"] = port
|
|
if probe_flags is not None:
|
|
data["probe_flags"] = probe_flags
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/nc_show_ports",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/NC_SHOW_PPP_LINKS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#nc_show_ppp_links
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_nc_show_ppp_links(self,
|
|
link_num=None, # Ppp-Link number of the span, or 'all'.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_nc_show_ppp_links(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if link_num is not None:
|
|
data["link_num"] = link_num
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/nc_show_ppp_links",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/NC_SHOW_SPANS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#nc_show_spans
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_nc_show_spans(self,
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
span_number=None, # Span-Number of the span, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_nc_show_spans(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if span_number is not None:
|
|
data["span_number"] = span_number
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/nc_show_spans",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/NC_SHOW_VR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#nc_show_vr
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_nc_show_vr(self,
|
|
resource=None, # Resource number, or 'all'.
|
|
router=None, # Name of the Virtual Router, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_nc_show_vr(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if router is not None:
|
|
data["router"] = router
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/nc_show_vr",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/NC_SHOW_VRCX> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#nc_show_vrcx
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_nc_show_vrcx(self,
|
|
cx_name=None, # Name of the Virtual Router Connection, or 'all'.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_nc_show_vrcx(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cx_name is not None:
|
|
data["cx_name"] = cx_name
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/nc_show_vrcx",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/NOTIFY_DHCP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#notify_dhcp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_notify_dhcp(self,
|
|
cmd=None, # set/down/timeout/info: What does DHCP want us to do?
|
|
netmask=None, # New subnet mask.
|
|
new_dns=None, # New DNS server(s) for use by this interface.
|
|
new_ip=None, # New IP address.
|
|
new_ip6=None, # New Global IPv6 address: ipv6/prefix
|
|
new_mtu=None, # New MTU.
|
|
new_router=None, # One or more default routers. LANforge will only use the first one.
|
|
port=None, # Interface name.
|
|
reason=None, # DHCP reason, informational mostly.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_notify_dhcp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cmd is not None:
|
|
data["cmd"] = cmd
|
|
if netmask is not None:
|
|
data["netmask"] = netmask
|
|
if new_dns is not None:
|
|
data["new_dns"] = new_dns
|
|
if new_ip is not None:
|
|
data["new_ip"] = new_ip
|
|
if new_ip6 is not None:
|
|
data["new_ip6"] = new_ip6
|
|
if new_mtu is not None:
|
|
data["new_mtu"] = new_mtu
|
|
if new_router is not None:
|
|
data["new_router"] = new_router
|
|
if port is not None:
|
|
data["port"] = port
|
|
if reason is not None:
|
|
data["reason"] = reason
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/notify_dhcp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/PORT_RESET_COMPLETED> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#port_reset_completed
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_port_reset_completed(self,
|
|
extra=None, # IP for SECIP, blank for others.
|
|
port=None, # The port in question.
|
|
p_type=None, # SUNOS, NORMAL, or SECIP..let us know what kind of reset
|
|
# completed.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_port_reset_completed(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if extra is not None:
|
|
data["extra"] = extra
|
|
if port is not None:
|
|
data["port"] = port
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/port_reset_completed",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/PROBE_PORT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#probe_port
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_probe_port(self,
|
|
key=None, # Unique identifier for this request. Usually left blank.<br/>
|
|
port=None, # Port number or name
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_probe_port(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if key is not None:
|
|
data["key"] = key
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/probe_port",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/PROBE_PORTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#probe_ports
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_probe_ports(self,
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_probe_ports(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/probe_ports",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/QUIESCE_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#quiesce_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_quiesce_endp(self,
|
|
endp_name=None, # Name of the endpoint, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_quiesce_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp_name is not None:
|
|
data["endp_name"] = endp_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/quiesce_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/QUIESCE_GROUP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#quiesce_group
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_quiesce_group(self,
|
|
name=None, # The name of the test group, or 'all'
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_quiesce_group(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/quiesce_group",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/QUIT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#quit
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_quit(self,
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_quit(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
response = self.json_post("/cli-json/quit",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/REBOOT_OS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#reboot_os
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_reboot_os(self,
|
|
resource=None, # Resource number, or ALL.
|
|
shelf=None, # Shelf number, or ALL.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_reboot_os(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/reboot_os",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/REPORT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#report
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_report(self,
|
|
reporting_on=None, # Should we globally enable/disable reporting. (YES, NO or NA)
|
|
rpt_dir=None, # Directory in which reports should be saved.
|
|
save_endps=None, # Should we save endpoint reports or not. (YES, NO or NA)
|
|
save_ports=None, # Should we save Port reports or not. (YES, NO or NA)
|
|
save_resource=None, # Should we save Resource reports or not. (YES, NO or NA)
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_report(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if reporting_on is not None:
|
|
data["reporting_on"] = reporting_on
|
|
if rpt_dir is not None:
|
|
data["rpt_dir"] = rpt_dir
|
|
if save_endps is not None:
|
|
data["save_endps"] = save_endps
|
|
if save_ports is not None:
|
|
data["save_ports"] = save_ports
|
|
if save_resource is not None:
|
|
data["save_resource"] = save_resource
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/report",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RESET_PORT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#reset_port
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class ResetPortPreIfdown(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
P_IN = "P-IN" # Only call the portal login (do not reset drivers/supplicant/dhcp)
|
|
P_OUT = "P-OUT" # Only call the portal logout (do not reset drivers/supplicant/dhcp)
|
|
YES = "YES" # (include logout) Call portal-bot.pl ... <b>--logout</b> before going down.
|
|
|
|
def post_reset_port(self,
|
|
port=None, # Port number to reset, or ALL.
|
|
pre_ifdown=None, # See above. Leave blank or use NA if unsure.
|
|
reset_ospf=None, # If set to 'NO' or 'NA', then OSPF will not be updated. Otherwise, it
|
|
# will be updated.
|
|
resource=None, # Resource number, or ALL.
|
|
shelf=None, # Shelf number, or ALL.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_reset_port(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if port is not None:
|
|
data["port"] = port
|
|
if pre_ifdown is not None:
|
|
data["pre_ifdown"] = pre_ifdown
|
|
if reset_ospf is not None:
|
|
data["reset_ospf"] = reset_ospf
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/reset_port",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RESET_SERIAL_SPAN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#reset_serial_span
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_reset_serial_span(self,
|
|
resource=None, # Resource (machine) number.
|
|
shelf=None, # Shelf number
|
|
span=None, # Serial-Span number to reset.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_reset_serial_span(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if span is not None:
|
|
data["span"] = span
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/reset_serial_span",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_ATTENUATOR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_attenuator
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_attenuator(self,
|
|
resource=None, # Resource number
|
|
serno=None, # Serial number for requested Attenuator.
|
|
shelf=None, # Shelf number, usually 1
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_attenuator(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if serno is not None:
|
|
data["serno"] = serno
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_attenuator",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_CD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_cd
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_cd(self,
|
|
cd=None, # Name of Collision Domain.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_cd(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cd is not None:
|
|
data["cd"] = cd
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_cd",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_CD_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_cd_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_cd_endp(self,
|
|
cd=None, # Name of Collision Domain.
|
|
endp=None, # Endpoint name/id.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_cd_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cd is not None:
|
|
data["cd"] = cd
|
|
if endp is not None:
|
|
data["endp"] = endp
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_cd_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_CD_VR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_cd_vr
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_cd_vr(self,
|
|
cd=None, # Name of Collision Domain.
|
|
endp=None, # Virtual-Router name/id.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_cd_vr(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cd is not None:
|
|
data["cd"] = cd
|
|
if endp is not None:
|
|
data["endp"] = endp
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_cd_vr",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_CHAMBER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_chamber
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_chamber(self,
|
|
chamber=None, # Chamber name, or 'ALL'
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_chamber(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if chamber is not None:
|
|
data["chamber"] = chamber
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_chamber",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_CHAMBER_PATH> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_chamber_path
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_chamber_path(self,
|
|
chamber=None, # Chamber Name.
|
|
path=None, # Path Name, use 'ALL' to delete all paths.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_chamber_path(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if chamber is not None:
|
|
data["chamber"] = chamber
|
|
if path is not None:
|
|
data["path"] = path
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_chamber_path",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_CHANNEL_GROUP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_channel_group
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_channel_group(self,
|
|
channel_name=None, # Name of the channel, or 'all'.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_channel_group(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if channel_name is not None:
|
|
data["channel_name"] = channel_name
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_channel_group",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_CLIENT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_client
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_client(self,
|
|
client_name=None, # Name of the client profile you wish to remove.
|
|
client_password=None, # Client password. Not required if we are super-user.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_client(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if client_name is not None:
|
|
data["client_name"] = client_name
|
|
if client_password is not None:
|
|
data["client_password"] = client_password
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_client",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_CX> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_cx
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_cx(self,
|
|
cx_name=None, # Name of the cross-connect, or 'all'.
|
|
test_mgr=None, # Name of test-mgr, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_cx(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cx_name is not None:
|
|
data["cx_name"] = cx_name
|
|
if test_mgr is not None:
|
|
data["test_mgr"] = test_mgr
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_cx",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_DB> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_db
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_db(self,
|
|
db_name=None, # Name of the database to delete.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_db(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if db_name is not None:
|
|
data["db_name"] = db_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_db",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_DUT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_dut
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_dut(self,
|
|
shelf=None, # DUT name, or 'ALL'
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_dut(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_dut",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_endp(self,
|
|
endp_name=None, # Name of the endpoint, or 'YES_ALL'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp_name is not None:
|
|
data["endp_name"] = endp_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_EVENT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_event
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_event(self,
|
|
event_id=None, # Numeric event-id, or 'all'
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_event(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if event_id is not None:
|
|
data["event_id"] = event_id
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_event",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_GROUP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_group
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_group(self,
|
|
name=None, # The name of the test group.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_group(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_group",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_PPP_LINK> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_ppp_link
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_ppp_link(self,
|
|
resource=None, # Resource number that holds this PppLink.
|
|
shelf=None, # Name/id of the shelf.
|
|
unit_num=None, # Unit-Number for the PppLink to be deleted.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_ppp_link(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if unit_num is not None:
|
|
data["unit_num"] = unit_num
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_ppp_link",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_PROFILE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_profile
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_profile(self,
|
|
name=None, # Profile name, or 'ALL'
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_profile(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_profile",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_RESOURCE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_resource
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_resource(self,
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_resource(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_resource",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_RFGEN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_rfgen
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_rfgen(self,
|
|
resource=None, # Resource number
|
|
shelf=None, # Shelf number, usually 1
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_rfgen(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_rfgen",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_SEC_IP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_sec_ip
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_sec_ip(self,
|
|
ip_list=None, # IP1/prefix,IP2/prefix,...IPZ/prefix, or ALL
|
|
port=None, # Name of network device (Port) from which these IPs will be removed.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_sec_ip(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if ip_list is not None:
|
|
data["ip_list"] = ip_list
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_sec_ip",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_SPAN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_span
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_span(self,
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
span_num=None, # Span-Number of the channel, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_span(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if span_num is not None:
|
|
data["span_num"] = span_num
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_span",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_TEST_MGR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_test_mgr
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_test_mgr(self,
|
|
test_mgr=None, # Name of the test manager to be removed.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_test_mgr(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if test_mgr is not None:
|
|
data["test_mgr"] = test_mgr
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_test_mgr",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_TEXT_BLOB> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_text_blob
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_text_blob(self,
|
|
name=None, # Text Blob Name, or 'ALL'
|
|
p_type=None, # Text Blob type, or 'ALL'
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_text_blob(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_text_blob",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_TGCX> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_tgcx
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_tgcx(self,
|
|
cxname=None, # The name of the CX.
|
|
tgname=None, # The name of the test group.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_tgcx(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cxname is not None:
|
|
data["cxname"] = cxname
|
|
if tgname is not None:
|
|
data["tgname"] = tgname
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_tgcx",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_THRESHOLD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_threshold
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_threshold(self,
|
|
endp=None, # Endpoint name or ID.
|
|
thresh_id=None, # Threshold ID to remove. Use 'all' to remove all.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_threshold(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp is not None:
|
|
data["endp"] = endp
|
|
if thresh_id is not None:
|
|
data["thresh_id"] = thresh_id
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_threshold",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_TRAFFIC_PROFILE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_traffic_profile
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_traffic_profile(self,
|
|
name=None, # Profile name, or 'ALL'
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_traffic_profile(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_traffic_profile",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_VENUE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_venue
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_venue(self,
|
|
resource=None, # Resource number, or 'ALL'
|
|
shelf=None, # Shelf number.
|
|
venu_id=None, # Number to uniquely identify this venue on this resource, or 'ALL'
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_venue(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if venu_id is not None:
|
|
data["venu_id"] = venu_id
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_venue",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_VLAN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_vlan
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_vlan(self,
|
|
port=None, # Port number or name of the virtual interface.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_vlan(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_vlan",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_VR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_vr
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_vr(self,
|
|
resource=None, # Resource number, or 'all'.
|
|
router_name=None, # Virtual Router name, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_vr(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if router_name is not None:
|
|
data["router_name"] = router_name
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_vr",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_VRCX> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_vrcx
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_vrcx(self,
|
|
connection_name=None, # Virtual Router Connection name, or 'all'.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
vr_id=None, # If not removing from the free-list, then supply the virtual-router
|
|
# name/ID here. Leave blank or use NA for free-list.
|
|
vrcx_only=None, # If we should NOT delete underlying auto-created objects, enter
|
|
# 'vrcx_only' here, otherwise leave blank or use NA.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_vrcx(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if connection_name is not None:
|
|
data["connection_name"] = connection_name
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if vr_id is not None:
|
|
data["vr_id"] = vr_id
|
|
if vrcx_only is not None:
|
|
data["vrcx_only"] = vrcx_only
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_vrcx",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RM_WANPATH> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rm_wanpath
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rm_wanpath(self,
|
|
endp_name=None, # Name of the endpoint.
|
|
wp_name=None, # Name of the wanpath.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rm_wanpath(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp_name is not None:
|
|
data["endp_name"] = endp_name
|
|
if wp_name is not None:
|
|
data["wp_name"] = wp_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rm_wanpath",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/RPT_SCRIPT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#rpt_script
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_rpt_script(self,
|
|
endp=None, # Endpoint name or ID.
|
|
flags=None, # See above for description of the defined flags.
|
|
group_action=None, # All or Sequential.
|
|
loop_count=None, # How many times to loop before stopping (0 is infinite).
|
|
name=None, # Script name.
|
|
private=None, # Private encoding for the particular script.
|
|
p_type=None, # One of: NONE, Script2544, ScriptHunt, ScriptWL
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_rpt_script(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp is not None:
|
|
data["endp"] = endp
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if group_action is not None:
|
|
data["group_action"] = group_action
|
|
if loop_count is not None:
|
|
data["loop_count"] = loop_count
|
|
if name is not None:
|
|
data["name"] = name
|
|
if private is not None:
|
|
data["private"] = private
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/rpt_script",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SCAN_WIFI> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#scan_wifi
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class ScanWifiExtra(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
NA = "NA" # (or left blank) the system does a full scan
|
|
dump = "dump" # then only cached values are returned
|
|
trigger_freq__freq_ = "trigger freq [freq]" # scan exactly those frequencies
|
|
|
|
def post_scan_wifi(self,
|
|
extra=None, # Extra arguments to the scan script, see above.
|
|
key=None, # Unique identifier for this request. Usually left blank.
|
|
port=None, # Port number or name of the virtual interface.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_scan_wifi(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if extra is not None:
|
|
data["extra"] = extra
|
|
if key is not None:
|
|
data["key"] = key
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/scan_wifi",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ARM_INFO> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_arm_info
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetArmInfoArmFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetArmInfoArmFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
random_payload = 0x10000 # Use random payload sizes instead of linear increase
|
|
rel_tstamp = 0x400 # Use Relative Timestamps. This will increase performance
|
|
slow_start = 0x2000 # Use slow-start logic. This ramps up
|
|
udp_checksum = 0x4000 # Use UDP Checksums.
|
|
use_gw_mac = 0x1000 # Use default gateway's MAC for destination MAC.
|
|
use_tcp = 0x8000 # Use TCP instead of UDP protocol. (Note this is NOT stateful TCP!)
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetArmInfoArmFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_set_arm_info(self,
|
|
arm_flags=None, # Armageddon-related flags, see above for details.
|
|
burst=None, # Burst amount, can significantly improve throughput with some
|
|
# modern drivers, similar to 'multi_pkts', and uses the 'xmit_more'
|
|
# linux skb option.
|
|
dst_mac=None, # The destination MAC address.
|
|
dst_mac_count=None, # How many destination MACs to iterate through.
|
|
ip_dst_max=None, # Maximum destination IP address to use.
|
|
ip_dst_min=None, # Minimum destination IP address to use.
|
|
ip_src_max=None, # Maximum source IP address to use.
|
|
ip_src_min=None, # Minimum source IP address to use.
|
|
max_pkt_size=None, # Maximum packet size, including all Ethernet headers (but not
|
|
# CRC).
|
|
min_pkt_size=None, # Minimum packet size, including all Ethernet headers (but not
|
|
# CRC).
|
|
multi_pkts=None, # The number of identical packets to send before creating a new
|
|
# one.
|
|
name=None, # Name of the Endpoint we are setting.
|
|
pkts_to_send=None, # The number of packets to send. Set to zero for infinite.
|
|
src_mac=None, # The source MAC address.
|
|
src_mac_count=None, # How many source MACs to iterate through.
|
|
udp_dst_max=None, # Minimum destination UDP port.
|
|
udp_dst_min=None, # Minimum destination UDP port.
|
|
udp_src_max=None, # Maximum source UDP port.
|
|
udp_src_min=None, # Minimum source UDP port.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_arm_info(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if arm_flags is not None:
|
|
data["arm_flags"] = arm_flags
|
|
if burst is not None:
|
|
data["burst"] = burst
|
|
if dst_mac is not None:
|
|
data["dst_mac"] = dst_mac
|
|
if dst_mac_count is not None:
|
|
data["dst_mac_count"] = dst_mac_count
|
|
if ip_dst_max is not None:
|
|
data["ip_dst_max"] = ip_dst_max
|
|
if ip_dst_min is not None:
|
|
data["ip_dst_min"] = ip_dst_min
|
|
if ip_src_max is not None:
|
|
data["ip_src_max"] = ip_src_max
|
|
if ip_src_min is not None:
|
|
data["ip_src_min"] = ip_src_min
|
|
if max_pkt_size is not None:
|
|
data["max_pkt_size"] = max_pkt_size
|
|
if min_pkt_size is not None:
|
|
data["min_pkt_size"] = min_pkt_size
|
|
if multi_pkts is not None:
|
|
data["multi_pkts"] = multi_pkts
|
|
if name is not None:
|
|
data["name"] = name
|
|
if pkts_to_send is not None:
|
|
data["pkts_to_send"] = pkts_to_send
|
|
if src_mac is not None:
|
|
data["src_mac"] = src_mac
|
|
if src_mac_count is not None:
|
|
data["src_mac_count"] = src_mac_count
|
|
if udp_dst_max is not None:
|
|
data["udp_dst_max"] = udp_dst_max
|
|
if udp_dst_min is not None:
|
|
data["udp_dst_min"] = udp_dst_min
|
|
if udp_src_max is not None:
|
|
data["udp_src_max"] = udp_src_max
|
|
if udp_src_min is not None:
|
|
data["udp_src_min"] = udp_src_min
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_arm_info",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ATTENUATOR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_attenuator
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_attenuator(self,
|
|
atten_idx=None, # Attenuator index, or 'all'.
|
|
mode=None, # 0 == normal attenuator, 1 == pulse mode (API Tech 4205A
|
|
# modules directly connected via USB only)
|
|
pulse_count=None, # Number of pulses (0-255)
|
|
pulse_interval_ms=None, # Time between pulses, in mili-seconds (0-60000).
|
|
pulse_time_ms=None, # Time interval between pulse groups in miliseconds (1-60000)
|
|
pulse_width_us5=None, # Pulse width in units of 1/2 micro second. So, if you want
|
|
# 1.5us, use value 3 (0-60000)
|
|
resource=None, # Resource number.
|
|
serno=None, # Serial number for requested Attenuator, or 'all'.
|
|
shelf=None, # Shelf number, usually 1.
|
|
val=None, # Requested attenution in 1/10ths of dB (ddB).
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_attenuator(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if atten_idx is not None:
|
|
data["atten_idx"] = atten_idx
|
|
if mode is not None:
|
|
data["mode"] = mode
|
|
if pulse_count is not None:
|
|
data["pulse_count"] = pulse_count
|
|
if pulse_interval_ms is not None:
|
|
data["pulse_interval_ms"] = pulse_interval_ms
|
|
if pulse_time_ms is not None:
|
|
data["pulse_time_ms"] = pulse_time_ms
|
|
if pulse_width_us5 is not None:
|
|
data["pulse_width_us5"] = pulse_width_us5
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if serno is not None:
|
|
data["serno"] = serno
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if val is not None:
|
|
data["val"] = val
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_attenuator",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_CHAMBER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_chamber
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_chamber(self,
|
|
chamber=None, # Chamber name
|
|
cur_rotation=None, # Primarily used to store the last known rotation for turntables
|
|
# that do not report absolute position. Use NA or leave blank if
|
|
# unsure.
|
|
position=None, # Absolute position in degrees.
|
|
speed_rpm=None, # Speed in rpm (floating point number is accepted
|
|
tilt=None, # Absolute tilt in degrees.
|
|
turntable=None, # Turn-table address, for instance: 192.168.1.22:3001
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_chamber(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if chamber is not None:
|
|
data["chamber"] = chamber
|
|
if cur_rotation is not None:
|
|
data["cur_rotation"] = cur_rotation
|
|
if position is not None:
|
|
data["position"] = position
|
|
if speed_rpm is not None:
|
|
data["speed_rpm"] = speed_rpm
|
|
if tilt is not None:
|
|
data["tilt"] = tilt
|
|
if turntable is not None:
|
|
data["turntable"] = turntable
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_chamber",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_CX_REPORT_TIMER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_cx_report_timer
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_cx_report_timer(self,
|
|
cx_name=None, # Name of cross-connect, or 'all'.
|
|
cxonly=None, # If you want to set the timer for ONLY the CX, and not
|
|
milliseconds=None, # Report timer length in milliseconds.
|
|
test_mgr=None, # Name of the test manager, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_cx_report_timer(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cx_name is not None:
|
|
data["cx_name"] = cx_name
|
|
if cxonly is not None:
|
|
data["cxonly"] = cxonly
|
|
if milliseconds is not None:
|
|
data["milliseconds"] = milliseconds
|
|
if test_mgr is not None:
|
|
data["test_mgr"] = test_mgr
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_cx_report_timer",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_CX_STATE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_cx_state
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetCxStateCxState(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
DELETED = "DELETED" # Deletes the CX(s).
|
|
QUIESCE = "QUIESCE" # Stop transmitting and gracefully stop cross-connect.
|
|
RUNNING = "RUNNING" # Sets the CX(s) in the running state.
|
|
STOPPED = "STOPPED" # Sets the CX(s) in the stopped state.
|
|
SWITCH = "SWITCH" # Sets the CX(s) in the running state, stopping any conflicting tests.
|
|
|
|
def post_set_cx_state(self,
|
|
cx_name=None, # Name of the cross-connect, or 'all'.
|
|
cx_state=None, # One of: RUNNING, SWITCH, QUIESCE, STOPPED, or DELETED.
|
|
test_mgr=None, # Name of the test-manager, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_cx_state(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cx_name is not None:
|
|
data["cx_name"] = cx_name
|
|
if cx_state is not None:
|
|
data["cx_state"] = cx_state
|
|
if test_mgr is not None:
|
|
data["test_mgr"] = test_mgr
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_cx_state",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ENDP_ADDR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_endp_addr
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_endp_addr(self,
|
|
ip=None, # The IP Address. Used for TCP/IP and UDP/IP protocols.
|
|
mac=None, # The MAC address. Only needed for LANforge protocol Endpoints.
|
|
max_port=None, # The Maximum IP Port. Used for TCP/IP and UDP/IP protocols.
|
|
min_port=None, # The Minimum IP Port. Used for TCP/IP and UDP/IP protocols.
|
|
name=None, # The name of the endpoint we are configuring.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_endp_addr(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if ip is not None:
|
|
data["ip"] = ip
|
|
if mac is not None:
|
|
data["mac"] = mac
|
|
if max_port is not None:
|
|
data["max_port"] = max_port
|
|
if min_port is not None:
|
|
data["min_port"] = min_port
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_endp_addr",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ENDP_DETAILS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_endp_details
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_endp_details(self,
|
|
conn_timeout=None, # For TCP, the max time in miliseconds to wait for connection
|
|
# to establish.
|
|
dst_mac=None, # Destination MAC address, used for custom Ethernet replays.
|
|
max_conn_timer=None, # The maximum duration (in ms) this connection should run
|
|
# before re-establishing.
|
|
max_ip_port=None, # The maximum IP Port value. (The value for min ip port is
|
|
# set through the add_endp/ip_port parameter.) If greater
|
|
# than min, each connection will use a random value between
|
|
# min and max.
|
|
max_reconn_pause=None, # The maximum time between re-connects, in ms.
|
|
mcast_src_ip=None, # Multicast source address (used in SSM mode, multicast
|
|
# endpoints only)
|
|
mcast_src_port=None, # Multicast source address (used in SSM mode, multicast
|
|
# endpoints only)
|
|
min_conn_timer=None, # The minimum duration (in ms) this connection should run
|
|
# before re-establishing.
|
|
min_reconn_pause=None, # The minimum time between re-connects, in ms.
|
|
name=None, # The name of the endpoint we are configuring.
|
|
pkts_to_send=None, # Number of packets to send before stopping. 0 means
|
|
# infinite.
|
|
rcvbuf_size=None, # The receive buffer (window) size. Zero for AUTO
|
|
sndbuf_size=None, # The sending buffer (window) size. Zero for AUTO
|
|
tcp_delack_segs=None, # NA: No longer supported.
|
|
tcp_max_delack=None, # NA: No longer supported.
|
|
tcp_min_delack=None, # NA: No longer supported.
|
|
tcp_mss=None, # TCP Maximum Segment Size, affects packet size on the wire
|
|
# (88 - 32767).
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_endp_details(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if conn_timeout is not None:
|
|
data["conn_timeout"] = conn_timeout
|
|
if dst_mac is not None:
|
|
data["dst_mac"] = dst_mac
|
|
if max_conn_timer is not None:
|
|
data["max_conn_timer"] = max_conn_timer
|
|
if max_ip_port is not None:
|
|
data["max_ip_port"] = max_ip_port
|
|
if max_reconn_pause is not None:
|
|
data["max_reconn_pause"] = max_reconn_pause
|
|
if mcast_src_ip is not None:
|
|
data["mcast_src_ip"] = mcast_src_ip
|
|
if mcast_src_port is not None:
|
|
data["mcast_src_port"] = mcast_src_port
|
|
if min_conn_timer is not None:
|
|
data["min_conn_timer"] = min_conn_timer
|
|
if min_reconn_pause is not None:
|
|
data["min_reconn_pause"] = min_reconn_pause
|
|
if name is not None:
|
|
data["name"] = name
|
|
if pkts_to_send is not None:
|
|
data["pkts_to_send"] = pkts_to_send
|
|
if rcvbuf_size is not None:
|
|
data["rcvbuf_size"] = rcvbuf_size
|
|
if sndbuf_size is not None:
|
|
data["sndbuf_size"] = sndbuf_size
|
|
if tcp_delack_segs is not None:
|
|
data["tcp_delack_segs"] = tcp_delack_segs
|
|
if tcp_max_delack is not None:
|
|
data["tcp_max_delack"] = tcp_max_delack
|
|
if tcp_min_delack is not None:
|
|
data["tcp_min_delack"] = tcp_min_delack
|
|
if tcp_mss is not None:
|
|
data["tcp_mss"] = tcp_mss
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_endp_details",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ENDP_FILE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_endp_file
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_endp_file(self,
|
|
file=None, # The file name to read the playback packets from.
|
|
name=None, # The name of the endpoint we are configuring.
|
|
playback=None, # Should we playback the capture or not? ON or OFF.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_endp_file(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if file is not None:
|
|
data["file"] = file
|
|
if name is not None:
|
|
data["name"] = name
|
|
if playback is not None:
|
|
data["playback"] = playback
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_endp_file",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ENDP_FLAG> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_endp_flag
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetEndpFlagFlag(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
AutoHelper = "AutoHelper" # Automatically run on helper process
|
|
ClearPortOnStart = "ClearPortOnStart" # clear stats on start
|
|
DoChecksum = "DoChecksum" # Enable checksumming
|
|
EnableConcurrentSrcIP = "EnableConcurrentSrcIP" # Concurrent source IPs?
|
|
EnableLinearSrcIP = "EnableLinearSrcIP" # linearized source IPs
|
|
EnableLinearSrcIPPort = "EnableLinearSrcIPPort" # linearized IP ports
|
|
EnableRndSrcIP = "EnableRndSrcIP" # randomize source IP
|
|
KernelMode = "KernelMode" # Enable kernel mode
|
|
QuiesceAfterDuration = "QuiesceAfterDuration" # quiesce after time period
|
|
QuiesceAfterRange = "QuiesceAfterRange" # quiesce after range of bytes
|
|
Unmanaged = "Unmanaged" # Set endpoint unmanaged
|
|
UseAutoNAT = "UseAutoNAT" # NAT friendly behavior
|
|
|
|
def post_set_endp_flag(self,
|
|
flag=None, # The name of the flag.
|
|
name=None, # The name of the endpoint we are configuring.
|
|
val=None, # Either 1 (for on), or 0 (for off).
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_endp_flag(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if flag is not None:
|
|
data["flag"] = flag
|
|
if name is not None:
|
|
data["name"] = name
|
|
if val is not None:
|
|
data["val"] = val
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_endp_flag",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ENDP_PAYLOAD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_endp_payload
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetEndpPayloadPayloadType(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
PRBS_11_8_10 = "PRBS_11_8_10" # PRBS (see above)
|
|
PRBS_15_0_14 = "PRBS_15_0_14" # PRBS (see above)
|
|
PRBS_4_0_3 = "PRBS_4_0_3" # Use linear feedback shift register to generate pseudo random sequence.
|
|
PRBS_7_0_6 = "PRBS_7_0_6" # PRBS (see above)
|
|
custom = "custom" # Enter your own payload with the set_endp_payload
|
|
decreasing = "decreasing" # bytes start at FF and decrease, wrapping if needed.
|
|
increasing = "increasing" # bytes start at 00 and increase, wrapping if needed.
|
|
ones = "ones" # Payload is all ones (FF).
|
|
random = "random" # generate a new random payload each time sent.
|
|
random_fixed = "random_fixed" # means generate one random payload, and send it over and over again.
|
|
zeros = "zeros" # Payload is all zeros (00).
|
|
|
|
def post_set_endp_payload(self,
|
|
name=None, # The name of the endpoint we are configuring.
|
|
payload=None, # For custom payloads, enter the payload in hex, up to 2048
|
|
# bytes. <tt escapearg='false'>Unescaped Value</tt>
|
|
payload_type=None, # The payload type. See help for add_endp.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_endp_payload(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if payload is not None:
|
|
data["payload"] = payload
|
|
if payload_type is not None:
|
|
data["payload_type"] = payload_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_endp_payload",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ENDP_PLD_BOUNDS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_endp_pld_bounds
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_endp_pld_bounds(self,
|
|
is_random=None, # YES if random, anything else for NO.
|
|
max_pld_size=None, # The maximum payload size, in bytes.
|
|
min_pld_size=None, # The minimum payload size, in bytes.
|
|
name=None, # The name of the endpoint we are configuring.
|
|
use_checksum=None, # YES if use checksum on payload, anything else for NO.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_endp_pld_bounds(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if is_random is not None:
|
|
data["is_random"] = is_random
|
|
if max_pld_size is not None:
|
|
data["max_pld_size"] = max_pld_size
|
|
if min_pld_size is not None:
|
|
data["min_pld_size"] = min_pld_size
|
|
if name is not None:
|
|
data["name"] = name
|
|
if use_checksum is not None:
|
|
data["use_checksum"] = use_checksum
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_endp_pld_bounds",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ENDP_PROXY> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_endp_proxy
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_endp_proxy(self,
|
|
enabled=None, # YES or NO to enable or disable proxying.
|
|
endp_name=None, # Name of endpoint.
|
|
proxy_ip=None, # Proxy IP Address.
|
|
proxy_ip_port=None, # Proxy IP Port.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_endp_proxy(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if enabled is not None:
|
|
data["enabled"] = enabled
|
|
if endp_name is not None:
|
|
data["endp_name"] = endp_name
|
|
if proxy_ip is not None:
|
|
data["proxy_ip"] = proxy_ip
|
|
if proxy_ip_port is not None:
|
|
data["proxy_ip_port"] = proxy_ip_port
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_endp_proxy",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ENDP_QUIESCE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_endp_quiesce
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_endp_quiesce(self,
|
|
name=None, # The name of the endpoint we are configuring.
|
|
quiesce=None, # The number of seconds to quiesce this endpoint when told to
|
|
# quiesce.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_endp_quiesce(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if quiesce is not None:
|
|
data["quiesce"] = quiesce
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_endp_quiesce",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ENDP_REPORT_TIMER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_endp_report_timer
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_endp_report_timer(self,
|
|
endp_name=None, # Name of endpoint.
|
|
milliseconds=None, # Report timer length in milliseconds.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_endp_report_timer(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp_name is not None:
|
|
data["endp_name"] = endp_name
|
|
if milliseconds is not None:
|
|
data["milliseconds"] = milliseconds
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_endp_report_timer",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ENDP_TOS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_endp_tos
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetEndpTosTos(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
LOWCOST = "LOWCOST" #
|
|
LOWDELAY = "LOWDELAY" #
|
|
RELIABILITY = "RELIABILITY" #
|
|
THROUGHPUT = "THROUGHPUT" #
|
|
|
|
def post_set_endp_tos(self,
|
|
name=None, # The name of the endpoint we are configuring.
|
|
priority=None, # The socket priority, can be any positive number.
|
|
tos=None, # The Type of Service, can be HEX, see above.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_endp_tos(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if priority is not None:
|
|
data["priority"] = priority
|
|
if tos is not None:
|
|
data["tos"] = tos
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_endp_tos",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_ENDP_TX_BOUNDS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_endp_tx_bounds
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_endp_tx_bounds(self,
|
|
is_bursty=None, # YES if bursty, anything else for NO.
|
|
max_tx_rate=None, # The maximum transmit rate, in bits per second (bps).
|
|
min_tx_rate=None, # The minimum transmit rate, in bits per second (bps).
|
|
name=None, # The name of the endpoint we are configuring.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_endp_tx_bounds(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if is_bursty is not None:
|
|
data["is_bursty"] = is_bursty
|
|
if max_tx_rate is not None:
|
|
data["max_tx_rate"] = max_tx_rate
|
|
if min_tx_rate is not None:
|
|
data["min_tx_rate"] = min_tx_rate
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_endp_tx_bounds",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_EVENT_INTEREST> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_event_interest
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetEventInterestEiFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetEventInterestEiFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
CLEAR = 0x0 # will clear interest
|
|
SET = 0x1 # set interest flag
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetEventInterestEiFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class SetEventInterestEvents1(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetEventInterestEvents10, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
BAD_TOS = 0x400000 # Endpoint has bad ToS values configured.
|
|
Bad_MAC = 0x100000 # Invalid MAC address configured.
|
|
Cleared = 0x2000 # Counters were cleared for some entity.
|
|
Connect = 0x100 # WiFi interface connected to AP.
|
|
Custom = 0x4 # Custom event (generated by USER in GUI or CLI).
|
|
DHCP_Fail = 0x8000 # DHCP Failed, maybe out of leases?
|
|
DHCP_Timeout = 0x10000 # Timed out talking to DHCP server.
|
|
DHCP4_Error = 0x20000 # DHCP gave out duplicated IP address.
|
|
DHCP6_Error = 0x40000 # DHCPv6 gave out duplicated IPv6 address.
|
|
Disconnect = 0x80 # WiFi interface disconnected from AP.
|
|
Endp_Started = 0x40 # Endpoint was started.
|
|
Endp_Stopped = 0x20 # Endpoint stopped for some reason.
|
|
Link_Down = 0x1 # Notify when Interface Link goes DOWN.
|
|
Link_Errors = 0x4000 # Port shows low-level link errors.
|
|
Link_Up = 0x2 # Notify when Interface Link goes UP.
|
|
Login = 0x400 # CLI/GUI user connected to LANforge.
|
|
Logout = 0x200 # CLI/GUI user disconnected from LANforge.
|
|
Migrated = 0x200000 # Port (station network interface) migrated.
|
|
NO_RX_SINCE = 0x800000 # Endpoint threshold alert.
|
|
NO_RX_SINCE_CLEARED = 0x1000000 # Endpoint threshold alert cleared.
|
|
RX_BPS_OOR_1M = 0x20000000 # Endpoint threshold alert.
|
|
RX_BPS_OOR_1M_CLEARED = 0x40000000 # Endpoint threshold alert cleared.
|
|
RX_BPS_OOR_30S = 0x8000000 # Endpoint threshold alert.
|
|
RX_BPS_OOR_30S_CLEARED = 0x10000000 # Endpoint threshold alert cleared.
|
|
RX_BPS_OOR_3S = 0x2000000 # Endpoint threshold alert.
|
|
RX_BPS_OOR_3S_CLEARED = 0x4000000 # Endpoint threshold alert cleared.
|
|
Resource_Down = 0x8 # Resource has crashed, rebooted, etc.
|
|
Resource_Up = 0x10 # Resource has connected to manager.
|
|
Start_Reports = 0x1000 # Start saving report data files (CSV).
|
|
Stop_Reports = 0x800 # Stop saving report data files (CSV).
|
|
TX_BPS_OOR_3S = 0x80000000 # Endpoint threshold alert.
|
|
WiFi_Config = 0x80000 # WiFi Configuration Error.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetEventInterestEvents1 has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class SetEventInterestEvents2(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetEventInterestEvents20, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
FW_CRASH = 0x800 # Firmware for entity has crashed.
|
|
FW_FAIL = 0x1000 # Firmware failed powerup, may require reboot.
|
|
IFDOWN_FAIL = 0x8000 # IFDOWN-PRE Script (ifup --logout) returned error code.
|
|
IFDOWN_OK = 0x10000 # IFDOWN-PRE Script (ifup --logout) completed successfully.
|
|
IFUP_FAIL = 0x2000 # IFUP-POST Script returned error code.
|
|
IFUP_OK = 0x4000 # IFUP-POST Script completed successfully.
|
|
RX_DROP_OOR_1M = 0x200 # Endpoint threshold alert.
|
|
RX_DROP_OOR_1M_CLEARED = 0x400 # Endpoint threshold alert cleared.
|
|
RX_DROP_OOR_3S = 0x80 # Endpoint threshold alert.
|
|
RX_DROP_OOR_3S_CLEARED = 0x100 # Endpoint threshold alert cleared.
|
|
RX_LAT_OOR = 0x20 # Endpoint threshold alert.
|
|
RX_LAT_OOR_CLEARED = 0x40 # Endpoint threshold alert cleared.
|
|
TX_BPS_OOR_1M = 0x8 # Endpoint threshold alert.
|
|
TX_BPS_OOR_1M_CLEARED = 0x10 # Endpoint threshold alert cleared.
|
|
TX_BPS_OOR_30S = 0x2 # Endpoint threshold alert.
|
|
TX_BPS_OOR_30S_CLEARED = 0x4 # Endpoint threshold alert cleared.
|
|
TX_BPS_OOR_3S_CLEARED = 0x1 # Endpoint threshold alert cleared.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetEventInterestEvents2 has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_set_event_interest(self,
|
|
ei_flags=None, # Event Interest flags, see above.
|
|
event_cnt=None, # Maximum number of events to store.
|
|
events1=None, # See description for possible values.
|
|
events2=None, # See description for possible values.
|
|
events3=None, # See description for possible values.
|
|
events4=None, # See description for possible values.
|
|
var1=None, # Currently un-used.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_event_interest(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if ei_flags is not None:
|
|
data["ei_flags"] = ei_flags
|
|
if event_cnt is not None:
|
|
data["event_cnt"] = event_cnt
|
|
if events1 is not None:
|
|
data["events1"] = events1
|
|
if events2 is not None:
|
|
data["events2"] = events2
|
|
if events3 is not None:
|
|
data["events3"] = events3
|
|
if events4 is not None:
|
|
data["events4"] = events4
|
|
if var1 is not None:
|
|
data["var1"] = var1
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_event_interest",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_EVENT_PRIORITY> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_event_priority
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetEventPriorityEvent(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
Bad_MAC = 20 # Invalid MAC address configured.
|
|
Cleared = 13 # Counters were cleared for some entity.
|
|
Connect = 8 # WiFi interface connected to AP.
|
|
Custom = 2 # Custom event (generated by USER in GUI or CLI).
|
|
DHCP_Fail = 15 # DHCP Failed, maybe out of leases?
|
|
DHCP_Timeout = 16 # Timed out talking to DHCP server.
|
|
DHCP4_Error = 17 # DHCP gave out duplicated IP address.
|
|
DHCP6_Error = 18 # DHCPv6 gave out duplicated IPv6 address.
|
|
Disconnect = 7 # WiFi interface disconnected from AP.
|
|
Endp_Started = 6 # Endpoint was started.
|
|
Endp_Stopped = 5 # Endpoint stopped for some reason.
|
|
Link_Down = 0 # Notify when Interface Link goes UP.
|
|
Link_Errors = 14 # Port shows low-level link errors.
|
|
Link_Up = 1 # Notify when Interface Link goes DOWN.
|
|
Login = 10 # CLI/GUI user connected to LANforge.
|
|
Logout = 9 # CLI/GUI user disconnected from LANforge.
|
|
Migrated = 21 # Port (station network interface) migrated.
|
|
Resource_Down = 3 # Resource has crashed, rebooted, etc.
|
|
Resource_Up = 4 # Resource has connected to manager.
|
|
Start_Reports = 12 # Start saving report data files (CSV).
|
|
Stop_Reports = 11 # Stop saving report data files (CSV).
|
|
WiFi_Config = 19 # WiFi Configuration Error.
|
|
|
|
class SetEventPriorityPriority(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
AUTO = "AUTO" # Let event creator decide the priority.
|
|
CRITICAL = "CRITICAL" #
|
|
DEBUG = "DEBUG" #
|
|
FATAL = "FATAL" #
|
|
INFO = "INFO" #
|
|
WARNING = "WARNING" #
|
|
|
|
def post_set_event_priority(self,
|
|
event=None, # Number or name for the event, see above.
|
|
priority=None, # Number or name for the priority.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_event_priority(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if event is not None:
|
|
data["event"] = event
|
|
if priority is not None:
|
|
data["priority"] = priority
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_event_priority",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_FE_INFO> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_fe_info
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_fe_info(self,
|
|
directory=None, # The directory to read/write in. Absolute path suggested.
|
|
io_direction=None, # Should we be reading or writing: options: read, write
|
|
max_file_size=None, # The maximum file size, in bytes.
|
|
max_rw_sz=None, # Maximum read/write size, in bytes.
|
|
min_file_size=None, # The minimum file size, in bytes.
|
|
min_rw_sz=None, # Minimum read/write size, in bytes.
|
|
name=None, # The name of the file endpoint we are configuring.
|
|
num_files=None, # Number of files to create when writing.
|
|
prefix=None, # The prefix of the file(s) to read/write.
|
|
quiesce_after_files=None, # If non-zero, quiesce test after this many files have been
|
|
# read/written.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_fe_info(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if directory is not None:
|
|
data["directory"] = directory
|
|
if io_direction is not None:
|
|
data["io_direction"] = io_direction
|
|
if max_file_size is not None:
|
|
data["max_file_size"] = max_file_size
|
|
if max_rw_sz is not None:
|
|
data["max_rw_sz"] = max_rw_sz
|
|
if min_file_size is not None:
|
|
data["min_file_size"] = min_file_size
|
|
if min_rw_sz is not None:
|
|
data["min_rw_sz"] = min_rw_sz
|
|
if name is not None:
|
|
data["name"] = name
|
|
if num_files is not None:
|
|
data["num_files"] = num_files
|
|
if prefix is not None:
|
|
data["prefix"] = prefix
|
|
if quiesce_after_files is not None:
|
|
data["quiesce_after_files"] = quiesce_after_files
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_fe_info",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_FLAG> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_flag
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetFlagFlag(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
brief = "brief" # Request more abbreviated output to various commands.
|
|
prompt_newlines = "prompt_newlines" # Add a newline after every prompt. Can help with scripts
|
|
push_all_rpts = "push_all_rpts" # If enabled, server will send port, endpoint, and other
|
|
push_endp_rpts = "push_endp_rpts" # If enabled, server will send endpoint reports without
|
|
request_keyed_text = "request_keyed_text" # Normally most keyed-text events are only sent to the GUI
|
|
stream_events = "stream_events" # Normally the CLI will not show Events (as seen in the
|
|
# +Event
|
|
|
|
def post_set_flag(self,
|
|
client=None, # Specify the user, if it is not the current user. Requires admin
|
|
# privileges.
|
|
flag=None, # The name of the flag.
|
|
val=None, # Either 1 (for on), or 0 (for off).
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_flag(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if client is not None:
|
|
data["client"] = client
|
|
if flag is not None:
|
|
data["flag"] = flag
|
|
if val is not None:
|
|
data["val"] = val
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_flag",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_GEN_CMD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_gen_cmd
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_gen_cmd(self,
|
|
command=None, # The rest of the command line arguments. <tt
|
|
# escapearg='false'>Unescaped Value</tt>
|
|
name=None, # The name of the file endpoint we are configuring.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_gen_cmd(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if command is not None:
|
|
data["command"] = command
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_gen_cmd",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_GPS_INFO> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_gps_info
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_gps_info(self,
|
|
altitude=None, # Altitude, assumes units are Meters.
|
|
ew=None, # East or west (Longitude).
|
|
lattitude=None, # The lattitude, as read from a GPS device.
|
|
longitude=None, # The longitude, as ready from a GPS device.
|
|
ns=None, # North or South (Latitude).
|
|
resource=None, # Resource number for the port to be modified.
|
|
shelf=None, # Shelf number for the port to be modified, or SELF.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_gps_info(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if altitude is not None:
|
|
data["altitude"] = altitude
|
|
if ew is not None:
|
|
data["ew"] = ew
|
|
if lattitude is not None:
|
|
data["lattitude"] = lattitude
|
|
if longitude is not None:
|
|
data["longitude"] = longitude
|
|
if ns is not None:
|
|
data["ns"] = ns
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_gps_info",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_IFUP_SCRIPT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_ifup_script
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_ifup_script(self,
|
|
flags=None, # Currently un-defined, use NA
|
|
port=None, # WiFi interface name or number.
|
|
post_ifup_script=None, # Script name with optional args, will run after interface
|
|
# comes up and gets IP. <tt escapearg='false'>Unescaped
|
|
# Value</tt>
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_ifup_script(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if port is not None:
|
|
data["port"] = port
|
|
if post_ifup_script is not None:
|
|
data["post_ifup_script"] = post_ifup_script
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_ifup_script",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_LICENSE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_license
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_license(self,
|
|
licenses=None, # License keys all appended into a single line. <tt
|
|
# escapearg='false'>Unescaped Value</tt>
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_license(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if licenses is not None:
|
|
data["licenses"] = licenses
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_license",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_MC_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_mc_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_mc_endp(self,
|
|
mcast_dest_port=None, # Multicast destination IP Port, for example: 55000
|
|
mcast_group=None, # Multicast group IP, ie: 224.1.1.2 IPv6 supported as well.
|
|
name=None, # The name of the endpoint we are configuring.
|
|
rcv_mcast=None, # Should we attempt to receive? Values: Yes or No
|
|
ttl=None, # Time to live for the multicast packets generated.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_mc_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if mcast_dest_port is not None:
|
|
data["mcast_dest_port"] = mcast_dest_port
|
|
if mcast_group is not None:
|
|
data["mcast_group"] = mcast_group
|
|
if name is not None:
|
|
data["name"] = name
|
|
if rcv_mcast is not None:
|
|
data["rcv_mcast"] = rcv_mcast
|
|
if ttl is not None:
|
|
data["ttl"] = ttl
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_mc_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_PASSWORD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_password
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_password(self,
|
|
client=None, # Specify the client. If left blank, will use current client.
|
|
new_password=None, # New password, or 'NA' for blank password.
|
|
old_password=None, # Old password, or 'NA' for blank password.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_password(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if client is not None:
|
|
data["client"] = client
|
|
if new_password is not None:
|
|
data["new_password"] = new_password
|
|
if old_password is not None:
|
|
data["old_password"] = old_password
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_password",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_POLL_MODE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_poll_mode
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_poll_mode(self,
|
|
mode=None, # 'polling' or 'push'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_poll_mode(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if mode is not None:
|
|
data["mode"] = mode
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_poll_mode",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_PORT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_port
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetPortCmdFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetPortCmdFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
abort_if_scripts = 0x400 # Forceably abort all ifup/down scripts on this Port.
|
|
force_MII_probe = 0x4 # Force MII probe
|
|
from_dhcp = 0x200 # Settings come from DHCP client.
|
|
from_user = 0x80 # from_user (Required to change Mgt Port config
|
|
new_gw_probe = 0x20 # Force new GW probe
|
|
new_gw_probe_dev = 0x40 # Force new GW probe for ONLY this interface
|
|
no_hw_probe = 0x8 # Don't probe hardware
|
|
probe_wifi = 0x10 # Probe WIFI
|
|
reset_transceiver = 0x1 # Reset transciever
|
|
restart_link_neg = 0x2 # Restart link negotiation
|
|
skip_port_bounce = 0x100 # skip-port-bounce (Don't ifdown/up
|
|
use_pre_ifdown = 0x800 # Call pre-ifdown script before bringing interface down.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetPortCmdFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class SetPortCurrentFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetPortCurrentFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
adv_100bt_fd = 0x800000 # advert-100bt-FD
|
|
adv_100bt_hd = 0x400000 # advert-100bt-HD
|
|
adv_10bt_fd = 0x200000 # advert-10bt-FD
|
|
adv_10bt_hd = 0x100000 # advert-10bt-HD
|
|
adv_10g_fd = 0x800000000 # advert-10G-FD
|
|
adv_2_5g_fd = 0x400000000 # advert-2.5G-FD
|
|
adv_5g_fd = 0x400000000000000 # Advertise 5Gbps link speed.
|
|
adv_flow_ctl = 0x8000000 # advert-flow-control
|
|
auto_neg = 0x100 # auto-negotiate
|
|
aux_mgt = 0x800000000000 # Enable Auxillary-Management flag for this port.
|
|
fixed_100bt_fd = 0x10 # Fixed-100bt-FD
|
|
fixed_100bt_hd = 0x8 # Fixed-100bt-HD
|
|
fixed_10bt_fd = 0x4 # Fixed-10bt-FD
|
|
fixed_10bt_hd = 0x2 # Fixed-10bt-HD (half duplex)
|
|
ftp_enabled = 0x400000000000 # Enable FTP (vsftpd) service for this port.
|
|
gro_enabled = 0x4000000000 # GRO-Enabled
|
|
gso_enabled = 0x10000000000 # GSO-Enabled
|
|
http_enabled = 0x200000000000 # Enable HTTP (nginx) service for this port.
|
|
if_down = 0x1 # Interface Down
|
|
ignore_dhcp = 0x2000000000000 # Don't set DHCP acquired IP on interface,
|
|
ipsec_client = 0x40000000000000 # Enable client IPSEC xfrm on this port.
|
|
ipsec_concentrator = 0x80000000000000 # Enable concentrator (upstream) IPSEC xfrm on this port.
|
|
lro_enabled = 0x2000000000 # LRO-Enabled
|
|
no_dhcp_rel = 0x80000000000 # No-DHCP-Release
|
|
no_dhcp_restart = 0x1000000000000 # Disable restart of DHCP on link connect (ie, wifi).
|
|
no_ifup_post = 0x4000000000000 # Skip ifup-post script if we can detect that we
|
|
promisc = 0x10000000 # PROMISC
|
|
radius_enabled = 0x20000000000000 # Enable RADIUS service (using hostapd as radius server)
|
|
rxfcs = 0x40000000000 # RXFCS
|
|
service_dns = 0x100000000000000 # Enable DNS (dnsmasq) service on this port.
|
|
staged_ifup = 0x100000000000 # Staged-IFUP
|
|
tso_enabled = 0x1000000000 # TSO-Enabled
|
|
ufo_enabled = 0x8000000000 # UFO-Enabled
|
|
use_dhcp = 0x80000000 # USE-DHCP
|
|
use_dhcpv6 = 0x20000000000 # USE-DHCPv6
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetPortCurrentFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class SetPortDhcpClientId(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
NA = "NA" # Do not change from current value.
|
|
NONE = "NONE" # Do not use dhcp client ID.
|
|
p_string_ = "[string]" # Use the string for the client ID.
|
|
p__DEVNAME = "__DEVNAME" # Use the interface's name as the client ID.
|
|
p__MAC = "__MAC" # Use interface's MAC address for the client ID.
|
|
|
|
class SetPortDhcpHostname(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
NA = "NA" # Do not change from current value.
|
|
NONE = "NONE" # Do not use dhcp Hostname
|
|
p_string_ = "[string]" # Use the string for the Hostname.
|
|
p__ALIAS__ = "__ALIAS__" # Use alias if set, or EID behaviour if alias is not set..
|
|
p__EID__ = "__EID__" # Use hostname 'CT-[resource-id].[port-name]'
|
|
|
|
class SetPortDhcpVendorId(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
NA = "NA" # Do not change from current value.
|
|
NONE = "NONE" # Do not use dhcp vendor ID
|
|
p_string_ = "[string]" # Use the string for the vendor ID.
|
|
|
|
class SetPortFlags2(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetPortFlags20, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
bypass_disconnect = 0x200 # Logically disconnect the cable (link-down)
|
|
bypass_enabled = 0x10 # Enable Bypass Device
|
|
bypass_power_down = 0x80 # Should bypass be on when we shutdown or loose power?
|
|
bypass_power_on = 0x100 # Should bypass be on when we first power up?
|
|
supports_bypass = 0x2 # Support Bypass Devices
|
|
use_stp = 0x1 # Use Spanning Tree Protocol
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetPortFlags2 has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class SetPortInterest(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetPortInterest0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
alias = 0x1000 # Port alias
|
|
aux_mgt = 0x20000000 # Enable/disable Auxillary-Management for a port
|
|
bridge = 0x10000 # BRIDGE
|
|
bypass = 0x40000 # Bypass
|
|
command_flags = 0x1 # apply command flags
|
|
cpu_mask = 0x100000 # CPU Mask, useful for pinning process to CPU core
|
|
current_flags = 0x2 # apply current flags
|
|
dhcp = 0x4000 # including client-id.
|
|
dhcp_rls = 0x4000000 # DHCP release
|
|
dhcpv6 = 0x1000000 # Use DHCPv6
|
|
gen_offload = 0x80000 # Generic offload flags, everything but LRO
|
|
ifdown = 0x800000 # Down interface
|
|
interal_use_1 = 0x800 # (INTERNAL USE)
|
|
ip_Mask = 0x8 # IP mask
|
|
ip_address = 0x4 # IP address
|
|
ip_gateway = 0x10 # IP gateway
|
|
ipv6_addrs = 0x20000 # IPv6 Address
|
|
link_speed = 0x80 # Link speed
|
|
lro_offload = 0x200000 # LRO (Must be disabled when used in Wanlink,
|
|
mac_address = 0x20 # MAC address
|
|
mtu = 0x100 # MTU
|
|
no_apply_dhcp = 0x80000000 # Enable/disable NO-APPLY-DHCP flag for a port
|
|
no_dhcp_conn = 0x40000000 # Enable/disable NO-DHCP-ON-CONNECT flag for a port
|
|
promisc_mode = 0x400 # PROMISC mode
|
|
rpt_timer = 0x8000 # Report Timer
|
|
rx_all = 0x2000 # Rx-ALL
|
|
rxfcs = 0x2000000 # RXFCS
|
|
skip_ifup_roam = 0x100000000 # Enable/disable SKIP-IFUP-ON-ROAM flag for a port
|
|
sta_br_id = 0x400000 # WiFi Bridge identifier. 0 means no bridging.
|
|
supported_flags = 0x40 # apply supported flags
|
|
svc_ftpd = 0x10000000 # Enable/disable FTP Service for a port
|
|
svc_httpd = 0x8000000 # Enable/disable HTTP Service for a port
|
|
tx_queue_length = 0x200 # TX Queue Length
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetPortInterest has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_set_port(self,
|
|
alias=None, # A user-defined name for this interface. Can be BLANK or NA.
|
|
br_aging_time=None, # MAC aging time, in seconds, 32-bit number (or peer IP for GRE).
|
|
br_forwarding_delay=None, # How long to wait until the bridge will start forwarding packets.
|
|
br_hello_time=None, # How often does the bridge send out STP hello packets.
|
|
br_max_age=None, # How long until STP considers a non-responsive bridge dead.
|
|
br_port_cost=None, # STP Port cost for a port (this applies only to NON-BRIDGE
|
|
# interfaces).
|
|
br_port_priority=None, # STP Port priority for a port (this applies only to NON-BRIDGE
|
|
# interfaces).
|
|
br_priority=None, # Bridge priority, 16-bit number.
|
|
bypass_wdt=None, # Watch Dog Timer (in seconds) for this port. Zero (0) to disable.
|
|
cmd_flags=None, # Command Flags: See above, or NA.
|
|
cpu_mask=None, # CPU Mask for CPUs that should service this interface. Zero is
|
|
# don't set (let OS make the decision). This value will be applied
|
|
# to the proper /proc/irq/[irq-num]/smp_affinity file by the
|
|
# pin_irq.pl script.
|
|
current_flags=None, # See above, or NA.
|
|
current_flags_msk=None, # This sets 'interest' for flags 'Enable RADIUS service' and higher.
|
|
# See above, or NA.
|
|
dhcp_client_id=None, # Optional string of up to 63 bytes in length to be passed to the
|
|
# dhclient process. See above.
|
|
dhcp_hostname=None, # Optional string of up to 63 bytes in length to be passed to the
|
|
# dhclient process. Option 12, see above.
|
|
dhcp_vendor_id=None, # Optional string of up to 63 bytes in length to be passed to the
|
|
# dhclient process. See above.
|
|
dns_servers=None, # DNS servers for use by traffic on this port, comma-separated list,
|
|
# BLANK means zero-length string.
|
|
flags2=None, # Bridge & other flags, see above.
|
|
gateway=None, # IP address of the gateway device - used for IP routing, or NA.
|
|
interest=None, # Which things are we really interested in setting. Can over-ride
|
|
# defaults based on the other arguments.
|
|
ip_addr=None, # IP address for the port, or NA.
|
|
ipsec_concentrator=None, # IP Address of IPSec concentrator.
|
|
ipsec_local_id=None, # Local Identifier for this IPSec tunnel.
|
|
ipsec_passwd=None, # Password for IPSec, for pubkey, use: pubkey:[pem-file-name], for
|
|
# instance: pubkey:station.pem
|
|
ipsec_remote_id=None, # Remote Identifier for this IPSec tunnel.
|
|
ipv6_addr_global=None, # Global scoped IPv6 address.
|
|
ipv6_addr_link=None, # Link scoped IPv6 address.
|
|
ipv6_dflt_gw=None, # IPv6 default gateway.
|
|
mac=None, # MAC address to set this port to, or leave blank to not set it, or
|
|
# NA.
|
|
mtu=None, # Maximum Transmit Unit (MTU) for this interface. Can be blank or
|
|
# NA.
|
|
netmask=None, # Netmask which this port should use, or NA.
|
|
port=None, # Port number for the port to be modified.
|
|
report_timer=None, # How often, in milliseconds, should we poll stats on this
|
|
# interface?
|
|
resource=None, # Resource number for the port to be modified.
|
|
shelf=None, # Shelf number for the port to be modified.
|
|
sta_br_id=None, # WiFi STAtion bridge ID. Zero means none.
|
|
tx_queue_len=None, # Transmit Queue Length for this interface. Can be blank or NA.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_port(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if br_aging_time is not None:
|
|
data["br_aging_time"] = br_aging_time
|
|
if br_forwarding_delay is not None:
|
|
data["br_forwarding_delay"] = br_forwarding_delay
|
|
if br_hello_time is not None:
|
|
data["br_hello_time"] = br_hello_time
|
|
if br_max_age is not None:
|
|
data["br_max_age"] = br_max_age
|
|
if br_port_cost is not None:
|
|
data["br_port_cost"] = br_port_cost
|
|
if br_port_priority is not None:
|
|
data["br_port_priority"] = br_port_priority
|
|
if br_priority is not None:
|
|
data["br_priority"] = br_priority
|
|
if bypass_wdt is not None:
|
|
data["bypass_wdt"] = bypass_wdt
|
|
if cmd_flags is not None:
|
|
data["cmd_flags"] = cmd_flags
|
|
if cpu_mask is not None:
|
|
data["cpu_mask"] = cpu_mask
|
|
if current_flags is not None:
|
|
data["current_flags"] = current_flags
|
|
if current_flags_msk is not None:
|
|
data["current_flags_msk"] = current_flags_msk
|
|
if dhcp_client_id is not None:
|
|
data["dhcp_client_id"] = dhcp_client_id
|
|
if dhcp_hostname is not None:
|
|
data["dhcp_hostname"] = dhcp_hostname
|
|
if dhcp_vendor_id is not None:
|
|
data["dhcp_vendor_id"] = dhcp_vendor_id
|
|
if dns_servers is not None:
|
|
data["dns_servers"] = dns_servers
|
|
if flags2 is not None:
|
|
data["flags2"] = flags2
|
|
if gateway is not None:
|
|
data["gateway"] = gateway
|
|
if interest is not None:
|
|
data["interest"] = interest
|
|
if ip_addr is not None:
|
|
data["ip_addr"] = ip_addr
|
|
if ipsec_concentrator is not None:
|
|
data["ipsec_concentrator"] = ipsec_concentrator
|
|
if ipsec_local_id is not None:
|
|
data["ipsec_local_id"] = ipsec_local_id
|
|
if ipsec_passwd is not None:
|
|
data["ipsec_passwd"] = ipsec_passwd
|
|
if ipsec_remote_id is not None:
|
|
data["ipsec_remote_id"] = ipsec_remote_id
|
|
if ipv6_addr_global is not None:
|
|
data["ipv6_addr_global"] = ipv6_addr_global
|
|
if ipv6_addr_link is not None:
|
|
data["ipv6_addr_link"] = ipv6_addr_link
|
|
if ipv6_dflt_gw is not None:
|
|
data["ipv6_dflt_gw"] = ipv6_dflt_gw
|
|
if mac is not None:
|
|
data["mac"] = mac
|
|
if mtu is not None:
|
|
data["mtu"] = mtu
|
|
if netmask is not None:
|
|
data["netmask"] = netmask
|
|
if port is not None:
|
|
data["port"] = port
|
|
if report_timer is not None:
|
|
data["report_timer"] = report_timer
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if sta_br_id is not None:
|
|
data["sta_br_id"] = sta_br_id
|
|
if tx_queue_len is not None:
|
|
data["tx_queue_len"] = tx_queue_len
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_port",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_PORT_ALIAS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_port_alias
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_port_alias(self,
|
|
alias=None, # New alias to assign to this virtual interface.
|
|
port=None, # Physical Port identifier that owns the virtual interface.
|
|
resource=None, # Resource number for the port to be modified.
|
|
shelf=None, # Shelf number for the port to be modified.
|
|
vport=None, # Virtual port identifier. MAC for MAC-VLANs, VLAN-ID for 802.1Q
|
|
# vlans.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_port_alias(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if alias is not None:
|
|
data["alias"] = alias
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if vport is not None:
|
|
data["vport"] = vport
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_port_alias",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_PPP_LINK_STATE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_ppp_link_state
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_ppp_link_state(self,
|
|
link=None, # Unit Number of the PPP Link, or 'all'.
|
|
ppp_state=None, # One of: RUNNING, STOPPED, or DELETED.
|
|
resource=None, # Number of the Resource, or 'all'.
|
|
shelf=None, # Name of the Shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_ppp_link_state(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if link is not None:
|
|
data["link"] = link
|
|
if ppp_state is not None:
|
|
data["ppp_state"] = ppp_state
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_ppp_link_state",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_RESOURCE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_resource
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetResourceResourceFlags(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
skip_load_db_on_start = 1 # Should we skip loading the DB on start?
|
|
|
|
def post_set_resource(self,
|
|
device_profiles=None, # List of profiles, see above
|
|
max_helper_count=None, # Maximum number of helper traffic generation processes. 0 means
|
|
# CPU-core-count (AUTO).
|
|
max_staged_bringup=None, # Maximum amount of interfaces attempting to come up at once.
|
|
# Default is 50
|
|
max_station_bringup=None, # Maximum amount of stations to bring up per radio per tick.
|
|
# Default is 12.
|
|
max_trying_ifup=None, # Maximum amount of interfaces running the network config 'ifup'
|
|
# logic. Default is 15
|
|
resource=None, # Number of the Resource, or <tt>all</tt>.
|
|
resource_flags=None, # System wide flags, often requires a reboot for changes to take
|
|
# effect.
|
|
resource_flags_mask=None, # What flags to change. If unset, default is all.
|
|
shelf=None, # Name of the Shelf, or <tt>all</tt>.
|
|
top_left_x=None, # X Location for Chamber View.
|
|
top_left_y=None, # X Location for Chamber View.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_resource(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if device_profiles is not None:
|
|
data["device_profiles"] = device_profiles
|
|
if max_helper_count is not None:
|
|
data["max_helper_count"] = max_helper_count
|
|
if max_staged_bringup is not None:
|
|
data["max_staged_bringup"] = max_staged_bringup
|
|
if max_station_bringup is not None:
|
|
data["max_station_bringup"] = max_station_bringup
|
|
if max_trying_ifup is not None:
|
|
data["max_trying_ifup"] = max_trying_ifup
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if resource_flags is not None:
|
|
data["resource_flags"] = resource_flags
|
|
if resource_flags_mask is not None:
|
|
data["resource_flags_mask"] = resource_flags_mask
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if top_left_x is not None:
|
|
data["top_left_x"] = top_left_x
|
|
if top_left_y is not None:
|
|
data["top_left_y"] = top_left_y
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_resource",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_RFGEN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_rfgen
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetRfgenRfgenFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetRfgenRfgenFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
one_burst = 0x8 # Run for about 1 second and stop. Uses 5-sec sweep time for single pulse train.
|
|
running = 0x2 # Should we start the RF Generator or not?
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetRfgenRfgenFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_set_rfgen(self,
|
|
bb_gain=None, # RX Gain, 0 - 62 in 2dB steps
|
|
freq_khz=None, # Center frequency in Khz
|
|
gain=None, # Main TX/RX Amp, 0 or 14 (dB), default is 14
|
|
p_id=None, # RF Generator ID, not used at this time, enter 'NA' or 0.
|
|
if_gain=None, # Fine-tune TX/RX Gain, 0 - 40 dB
|
|
pulse_count=None, # Number of pulses (0-255)
|
|
pulse_interval_us=None, # Time between pulses, in micro-seconds.
|
|
pulse_width_us=None, # Requested pulse width, units are in micro-seconds.
|
|
resource=None, # Resource number.
|
|
rfgen_flags=None, # RF Generator flags, see above.
|
|
rfgen_flags_mask=None, # Mask of what flags to set, see above.
|
|
shelf=None, # Shelf number, usually 1.
|
|
sweep_time_ms=None, # Time interval between pulse groups in miliseconds
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_rfgen(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if bb_gain is not None:
|
|
data["bb_gain"] = bb_gain
|
|
if freq_khz is not None:
|
|
data["freq_khz"] = freq_khz
|
|
if gain is not None:
|
|
data["gain"] = gain
|
|
if p_id is not None:
|
|
data["id"] = p_id
|
|
if if_gain is not None:
|
|
data["if_gain"] = if_gain
|
|
if pulse_count is not None:
|
|
data["pulse_count"] = pulse_count
|
|
if pulse_interval_us is not None:
|
|
data["pulse_interval_us"] = pulse_interval_us
|
|
if pulse_width_us is not None:
|
|
data["pulse_width_us"] = pulse_width_us
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if rfgen_flags is not None:
|
|
data["rfgen_flags"] = rfgen_flags
|
|
if rfgen_flags_mask is not None:
|
|
data["rfgen_flags_mask"] = rfgen_flags_mask
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if sweep_time_ms is not None:
|
|
data["sweep_time_ms"] = sweep_time_ms
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_rfgen",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_SCRIPT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_script
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetScriptFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetScriptFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
SCR_COMPLETED = 0x80 # Set automatically by LANforge.
|
|
SCR_HIDE_CONSTRAINTS = 0x2000 # Hide constraints messages.
|
|
SCR_HIDE_CSV = 0x20 # Don't print the CSV data in the report.
|
|
SCR_HIDE_HUNT = 0x800 # Hide the individual hunt steps..just show results.
|
|
SCR_HIDE_ITER_DETAILS = 0x8 # Hide iteration detail reports.
|
|
SCR_HIDE_LAT = 0x1000 # Hide latency distribution reports.
|
|
SCR_HIDE_LEGEND = 0x10 # Don't print the legend in the report.
|
|
SCR_LOOP = 0x100 # Loop script until manually stopped.
|
|
SCR_NO_KEYED_RPT = 0x2 # Script should NOT send reports to the CLI/GUI.
|
|
SCR_RUN_ON_MGR = 0x40 # Set automatically by LANforge.
|
|
SCR_SHOW_ATTENUATION = 0x4000 # Show attenuation packet stats.
|
|
SCR_SHOW_DUPS = 0x200 # Report duplicate packets.
|
|
SCR_SHOW_GOLDEN_3P = 0x20000 # Add 'golden' third-party AP graph for comparison (where available).
|
|
SCR_SHOW_GOLDEN_LF = 0x10000 # Add 'golden' LANforge graph for comparison (where available).
|
|
SCR_SHOW_OOO = 0x400 # Report out-of-order packets.
|
|
SCR_STOPPED = 0x1 # Script should NOT have any affect on the endpoint.
|
|
SCR_SYMMETRIC = 0x4 # This script should apply settings to the peer endpoing as well.
|
|
SCR_USE_MSS = 0x8000 # When setting packet size, set TCP MSS instead if endpoint supports
|
|
# +that.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetScriptFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class SetScriptType(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
NONE = "NONE" # Delete any existing script.
|
|
Script2544 = "Script2544" # For RFC 2544 type testing.
|
|
ScriptAtten = "ScriptAtten" # For Attenuators only.
|
|
ScriptHunt = "ScriptHunt" # Hunt for maximum speed with constraints.
|
|
ScriptWL = "ScriptWL" # For iterating through WanLink settings
|
|
|
|
def post_set_script(self,
|
|
endp=None, # Endpoint, Test Group or Attenuator name or ID.
|
|
flags=None, # See above for description of the defined flags.
|
|
group_action=None, # How to handle group script operations: ALL, Sequential
|
|
loop_count=None, # How many times to loop before stopping (0 is infinite).
|
|
name=None, # Script name.
|
|
private=None, # Private encoding for the particular script.
|
|
p_type=None, # One of: NONE, Script2544, ScriptHunt, ScriptWL, ScriptAtten
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_script(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp is not None:
|
|
data["endp"] = endp
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if group_action is not None:
|
|
data["group_action"] = group_action
|
|
if loop_count is not None:
|
|
data["loop_count"] = loop_count
|
|
if name is not None:
|
|
data["name"] = name
|
|
if private is not None:
|
|
data["private"] = private
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_script",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_SEC_IP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_sec_ip
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_sec_ip(self,
|
|
ip_list=None, # IP1/prefix,IP2/prefix,...IPZ/prefix.
|
|
port=None, # Name of network device (Port) to which these IPs will be added.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_sec_ip(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if ip_list is not None:
|
|
data["ip_list"] = ip_list
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_sec_ip",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_VOIP_INFO> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_voip_info
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_voip_info(self,
|
|
codec=None, # Codec to use for the voice stream, supported values: G711U,
|
|
# G711A, SPEEX, g726-16, g726-24, g726-32, g726-40, g729a.
|
|
first_call_delay=None, # How long to wait before making first call, in seconds.
|
|
jitter_buffer_sz=None, # The size of the jitter buffer in packets. Default value is 8.
|
|
local_sip_port=None, # Local SIP UDP port. Default is min-rtp-port + 2.
|
|
loop_call_count=None, # How many calls to make, zero means infinite.
|
|
loop_wavefile_count=None, # How many times to play the wave file, zero means infinite.
|
|
max_call_duration=None, # How long should the call be, in seconds.
|
|
max_inter_call_gap=None, # Maximum time to wait between calls, in seconds.
|
|
messaging_protocol=None, # Messaging protocol, supported values: SIP.
|
|
min_call_duration=None, # How long should the call be, in seconds.
|
|
min_inter_call_gap=None, # Minimum time to wait between calls, in seconds.
|
|
name=None, # The name of the endpoint we are configuring.
|
|
pesq_server_ip=None, # LANforge PESQ server IP address.
|
|
pesq_server_passwd=None, # LANforge PESQ server password. Default is to use no
|
|
# authentication (blank entry).
|
|
pesq_server_port=None, # LANforge PESQ server port, default is 3998.
|
|
reg_expire_timer=None, # SIP Registration expire timer, in seconds.
|
|
ringing_timer=None, # How long (milliseconds) to wait in the ringing state before
|
|
# flagging call as no-answer.
|
|
sound_dev=None, # Which sound device should we play sound to. (see
|
|
# set_endp_flags).
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_voip_info(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if codec is not None:
|
|
data["codec"] = codec
|
|
if first_call_delay is not None:
|
|
data["first_call_delay"] = first_call_delay
|
|
if jitter_buffer_sz is not None:
|
|
data["jitter_buffer_sz"] = jitter_buffer_sz
|
|
if local_sip_port is not None:
|
|
data["local_sip_port"] = local_sip_port
|
|
if loop_call_count is not None:
|
|
data["loop_call_count"] = loop_call_count
|
|
if loop_wavefile_count is not None:
|
|
data["loop_wavefile_count"] = loop_wavefile_count
|
|
if max_call_duration is not None:
|
|
data["max_call_duration"] = max_call_duration
|
|
if max_inter_call_gap is not None:
|
|
data["max_inter_call_gap"] = max_inter_call_gap
|
|
if messaging_protocol is not None:
|
|
data["messaging_protocol"] = messaging_protocol
|
|
if min_call_duration is not None:
|
|
data["min_call_duration"] = min_call_duration
|
|
if min_inter_call_gap is not None:
|
|
data["min_inter_call_gap"] = min_inter_call_gap
|
|
if name is not None:
|
|
data["name"] = name
|
|
if pesq_server_ip is not None:
|
|
data["pesq_server_ip"] = pesq_server_ip
|
|
if pesq_server_passwd is not None:
|
|
data["pesq_server_passwd"] = pesq_server_passwd
|
|
if pesq_server_port is not None:
|
|
data["pesq_server_port"] = pesq_server_port
|
|
if reg_expire_timer is not None:
|
|
data["reg_expire_timer"] = reg_expire_timer
|
|
if ringing_timer is not None:
|
|
data["ringing_timer"] = ringing_timer
|
|
if sound_dev is not None:
|
|
data["sound_dev"] = sound_dev
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_voip_info",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_VRCX_COST> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_vrcx_cost
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_vrcx_cost(self,
|
|
interface_cost=None, # If using OSPF, this sets the cost for this link (1-65535).
|
|
local_dev=None, # Name of port A for the local redirect device pair.
|
|
local_dev_b=None, # Name of port B for the local redirect device pair.
|
|
remote_dev=None, # Name of port B for the remote redirect device pair.
|
|
remote_dev_b=None, # Name of port B for the remote redirect device pair.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf name/id.
|
|
vr_name=None, # Virtual Router this endpoint belongs to. Use 'FREE_LIST' to add
|
|
# a stand-alone endpoint.
|
|
wanlink=None, # The name of the WanLink that connects the two B ports.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_vrcx_cost(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if interface_cost is not None:
|
|
data["interface_cost"] = interface_cost
|
|
if local_dev is not None:
|
|
data["local_dev"] = local_dev
|
|
if local_dev_b is not None:
|
|
data["local_dev_b"] = local_dev_b
|
|
if remote_dev is not None:
|
|
data["remote_dev"] = remote_dev
|
|
if remote_dev_b is not None:
|
|
data["remote_dev_b"] = remote_dev_b
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if vr_name is not None:
|
|
data["vr_name"] = vr_name
|
|
if wanlink is not None:
|
|
data["wanlink"] = wanlink
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_vrcx_cost",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WANLINK_INFO> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wanlink_info
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_wanlink_info(self,
|
|
drop_freq=None, # How often, out of 1,000,000 packets, should we
|
|
# purposefully drop a packet.
|
|
dup_freq=None, # How often, out of 1,000,000 packets, should we
|
|
# purposefully duplicate a packet.
|
|
extra_buffer=None, # The extra amount of bytes to buffer before dropping pkts,
|
|
# in units of 1024. Use -1 for AUTO.
|
|
jitter_freq=None, # How often, out of 1,000,000 packets, should we apply
|
|
# jitter.
|
|
latency=None, # The base latency added to all packets, in milliseconds
|
|
# (or add 'us' suffix for microseconds
|
|
max_drop_amt=None, # Maximum amount of packets to drop in a row. Default is 1.
|
|
max_jitter=None, # The maximum jitter, in milliseconds (or ad 'us' suffix
|
|
# for microseconds)
|
|
max_lateness=None, # Maximum amount of un-intentional delay before pkt is
|
|
# dropped. Default is AUTO
|
|
max_reorder_amt=None, # Maximum amount of packets by which to reorder, Default is
|
|
# 10.
|
|
min_drop_amt=None, # Minimum amount of packets to drop in a row. Default is 1.
|
|
min_reorder_amt=None, # Minimum amount of packets by which to reorder, Default is
|
|
# 1.
|
|
name=None, # The name of the endpoint we are configuring.
|
|
playback_capture_file=None, # Name of the WAN capture file to play back.
|
|
reorder_freq=None, # How often, out of 1,000,000 packets, should we make a
|
|
# packet out of order.
|
|
speed=None, # The maximum speed of traffic this endpoint will accept
|
|
# (bps).
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wanlink_info(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if drop_freq is not None:
|
|
data["drop_freq"] = drop_freq
|
|
if dup_freq is not None:
|
|
data["dup_freq"] = dup_freq
|
|
if extra_buffer is not None:
|
|
data["extra_buffer"] = extra_buffer
|
|
if jitter_freq is not None:
|
|
data["jitter_freq"] = jitter_freq
|
|
if latency is not None:
|
|
data["latency"] = latency
|
|
if max_drop_amt is not None:
|
|
data["max_drop_amt"] = max_drop_amt
|
|
if max_jitter is not None:
|
|
data["max_jitter"] = max_jitter
|
|
if max_lateness is not None:
|
|
data["max_lateness"] = max_lateness
|
|
if max_reorder_amt is not None:
|
|
data["max_reorder_amt"] = max_reorder_amt
|
|
if min_drop_amt is not None:
|
|
data["min_drop_amt"] = min_drop_amt
|
|
if min_reorder_amt is not None:
|
|
data["min_reorder_amt"] = min_reorder_amt
|
|
if name is not None:
|
|
data["name"] = name
|
|
if playback_capture_file is not None:
|
|
data["playback_capture_file"] = playback_capture_file
|
|
if reorder_freq is not None:
|
|
data["reorder_freq"] = reorder_freq
|
|
if speed is not None:
|
|
data["speed"] = speed
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wanlink_info",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WANLINK_PCAP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wanlink_pcap
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_wanlink_pcap(self,
|
|
capture=None, # Should we capture or not? ON or OFF.
|
|
directory=None, # The directory name in which packet capture files will be
|
|
# written.
|
|
name=None, # The name of the endpoint we are configuring.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wanlink_pcap(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if capture is not None:
|
|
data["capture"] = capture
|
|
if directory is not None:
|
|
data["directory"] = directory
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wanlink_pcap",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WANPATH_CORRUPTION> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wanpath_corruption
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetWanpathCorruptionFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetWanpathCorruptionFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
BIT_FLIP = 0x4 # Flip a random bit in a byte.
|
|
BIT_TRANSPOSE = 0x8 # Transpose two side-by-side bits in a byte.
|
|
DO_CHAIN_ON_HIT = 0x10 # Do next corruption if this corruption is applied.
|
|
OVERWRITE_FIXED = 0x2 # Write a fixed value to a byte.
|
|
OVERWRITE_RANDOM = 0x1 # Write a random value to a byte.
|
|
RECALC_CSUMS = 0x20 # Attempt to re-calculate UDP and TCP checksums.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetWanpathCorruptionFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_set_wanpath_corruption(self,
|
|
byte=None, # The byte to use for OVERWRITE_FIXED (or NA).
|
|
flags=None, # The flags for this corruption.
|
|
index=None, # The corruption to modify (0-5).
|
|
max_offset=None, # The maximum offset from start of Ethernet packet for the
|
|
# byte to be modified.
|
|
min_offset=None, # The minimum offset from start of Ethernet packet for the
|
|
# byte to be modified.
|
|
name=None, # WanLink name
|
|
path=None, # WanPath name
|
|
rate=None, # Specifies how often, per million, this corruption should
|
|
# be applied.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wanpath_corruption(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if byte is not None:
|
|
data["byte"] = byte
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if index is not None:
|
|
data["index"] = index
|
|
if max_offset is not None:
|
|
data["max_offset"] = max_offset
|
|
if min_offset is not None:
|
|
data["min_offset"] = min_offset
|
|
if name is not None:
|
|
data["name"] = name
|
|
if path is not None:
|
|
data["path"] = path
|
|
if rate is not None:
|
|
data["rate"] = rate
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wanpath_corruption",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WANPATH_FILTER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wanpath_filter
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_wanpath_filter(self,
|
|
defer_flush=None, # Enter 'YES' if you do NOT want this flushed to the remote.
|
|
dst_filter=None, # The destination MAC or IP/Mask, 'NA' for PCAP.
|
|
filter_type=None, # The filter type, one of: MAC, IP, PCAP.
|
|
passive=None, # Enter 'YES' if you do NOT want to use this filter currently.
|
|
reverse=None, # If you want the logic reversed, use 'ON', otherwise set to
|
|
# 'OFF'
|
|
src_filter=None, # The source MAC or IP/Mask. For PCAP, this is the only
|
|
# filter.
|
|
wl_name=None, # The name of the WanLink endpoint we are configuring.
|
|
wp_name=None, # The name of the WanPath we are configuring.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wanpath_filter(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if defer_flush is not None:
|
|
data["defer_flush"] = defer_flush
|
|
if dst_filter is not None:
|
|
data["dst_filter"] = dst_filter
|
|
if filter_type is not None:
|
|
data["filter_type"] = filter_type
|
|
if passive is not None:
|
|
data["passive"] = passive
|
|
if reverse is not None:
|
|
data["reverse"] = reverse
|
|
if src_filter is not None:
|
|
data["src_filter"] = src_filter
|
|
if wl_name is not None:
|
|
data["wl_name"] = wl_name
|
|
if wp_name is not None:
|
|
data["wp_name"] = wp_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wanpath_filter",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WANPATH_RUNNING> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wanpath_running
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetWanpathRunningRunning(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
AS_PARENT = "AS_PARENT" # then it will be started and stopped as the parent WanLink is.
|
|
RUNNING = "RUNNING" # then it will be running at all times
|
|
STOPPED = "STOPPED" # then it will not be running at any time.
|
|
|
|
def post_set_wanpath_running(self,
|
|
running=None, # The state, one of: AS_PARENT, RUNNING, STOPPED.
|
|
wl_name=None, # The name of the WanLink endpoint we are configuring.
|
|
wp_name=None, # The name of the WanPath we are configuring.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wanpath_running(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if running is not None:
|
|
data["running"] = running
|
|
if wl_name is not None:
|
|
data["wl_name"] = wl_name
|
|
if wp_name is not None:
|
|
data["wp_name"] = wp_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wanpath_running",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WIFI_CORRUPTIONS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wifi_corruptions
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetWifiCorruptionsCorruptFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetWifiCorruptionsCorruptFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
MSG_TYPE_DEAUTH = 0x2 # de-authentication message
|
|
MSG_TYPE_EAPOL = 0x1 # Any EAPOL message
|
|
MSG_TYPE_EAPOL_1_OF_2 = 0x40 # EAPOL message 1/2
|
|
MSG_TYPE_EAPOL_1_OF_4 = 0x4 # EAPOL message 1/4
|
|
MSG_TYPE_EAPOL_2_OF_2 = 0x80 # EAPOL message 2/2
|
|
MSG_TYPE_EAPOL_2_OF_4 = 0x8 # EAPOL message 2/4
|
|
MSG_TYPE_EAPOL_3_OF_4 = 0x10 # EAPOL message 3/4
|
|
MSG_TYPE_EAPOL_4_OF_4 = 0x20 # EAPOL message 4/4
|
|
MSG_TYPE_EAPOL_ASSOC = 0x200 # EAP Association
|
|
MSG_TYPE_EAPOL_KEY_REQ = 0x100 # EAP Key Request (not sure if this works properly)
|
|
MST_TYPE_EAPOL_ID_REQ = 0x400 # EAP Identity request
|
|
MST_TYPE_EAPOL_ID_RESP = 0x800 # EAP Identity response
|
|
MST_TYPE_EAPOL_OTHER_REQ = 0x1000 # EAP Requests that do not match other things.
|
|
MST_TYPE_EAPOL_OTHER_RESP = 0x2000 # EAP Responses that do not match other things.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetWifiCorruptionsCorruptFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_set_wifi_corruptions(self,
|
|
corrupt_flags=None, # Specify packet types to corrupt (see flags above).
|
|
corrupt_per_mil=None, # Per-million: Station to randomly corrupt selected
|
|
# message types by this amount.
|
|
delay_flags=None, # Specify packet types to delay (see flags above).
|
|
delay_max=None, # miliseconds: Station to randomly delay processing
|
|
# received messages, max time
|
|
delay_min=None, # miliseconds: Station to randomly delay processing
|
|
# received messages, min time
|
|
dup_flags=None, # Specify packet types to duplicate (see flags above).
|
|
dup_per_65535=None, # Percentage, represented as x per 65535 of packets we
|
|
# should duplicate.
|
|
ignore_flags=None, # Specify packet types to ignore (see flags above).
|
|
ignore_per_mil=None, # Per-million: Station to randomly ignore selected message
|
|
# types by this amount.
|
|
port=None, # WiFi interface name or number.
|
|
req_flush=None, # Set to 1 if you wish to flush changes to kernel now.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wifi_corruptions(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if corrupt_flags is not None:
|
|
data["corrupt_flags"] = corrupt_flags
|
|
if corrupt_per_mil is not None:
|
|
data["corrupt_per_mil"] = corrupt_per_mil
|
|
if delay_flags is not None:
|
|
data["delay_flags"] = delay_flags
|
|
if delay_max is not None:
|
|
data["delay_max"] = delay_max
|
|
if delay_min is not None:
|
|
data["delay_min"] = delay_min
|
|
if dup_flags is not None:
|
|
data["dup_flags"] = dup_flags
|
|
if dup_per_65535 is not None:
|
|
data["dup_per_65535"] = dup_per_65535
|
|
if ignore_flags is not None:
|
|
data["ignore_flags"] = ignore_flags
|
|
if ignore_per_mil is not None:
|
|
data["ignore_per_mil"] = ignore_per_mil
|
|
if port is not None:
|
|
data["port"] = port
|
|
if req_flush is not None:
|
|
data["req_flush"] = req_flush
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wifi_corruptions",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WIFI_CUSTOM> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wifi_custom
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_wifi_custom(self,
|
|
port=None, # WiFi interface name or number.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
text=None, # [BLANK] will erase all, any other text will be appended to
|
|
# existing text. <tt escapearg='false'>Unescaped Value</tt>
|
|
p_type=None, # NA for now, may specify specific locations later.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wifi_custom(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if text is not None:
|
|
data["text"] = text
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wifi_custom",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WIFI_EXTRA> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wifi_extra
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_wifi_extra(self,
|
|
anonymous_identity=None, # Anonymous identity string for EAP.
|
|
anqp_3gpp_cell_net=None, # 802.11u 3GCPP Cellular Network Info, VAP only.
|
|
ca_cert=None, # CA-CERT file name.
|
|
client_cert=None, # 802.11u Client cert file: /etc/wpa_supplicant/ca.pem
|
|
domain=None, # 802.11u domain: mytelco.com
|
|
eap=None, # EAP method: MD5, MSCHAPV2, OTP, GTC, TLS, PEAP, TTLS.
|
|
group=None, # Group cyphers: CCMP, TKIP, WEP104, WEP40, or combination.
|
|
hessid=None, # 802.11u HESSID (MAC address format) (or peer for WDS
|
|
# stations).
|
|
identity=None, # EAP Identity string.
|
|
imsi=None, # 802.11u IMSI: 310026-000000000
|
|
ipaddr_type_avail=None, # 802.11u network type available, integer, VAP only.
|
|
key=None, # WEP key0. This should be entered in ascii-hex. Use this only
|
|
# for WEP.
|
|
key_mgmt=None, # Key management: WPA-PSK, WPA-EAP, IEEE8021X, NONE,
|
|
# WPA-PSK-SHA256, WPA-EAP-SHA256 or combo.
|
|
milenage=None, # 802.11u milenage:
|
|
# 90dca4eda45b53cf0f12d7c9c3bc6a89:cb9cccc4b9258e6dca4760379fb82
|
|
network_auth_type=None, # 802.11u network authentication type, VAP only.
|
|
network_type=None, # 802.11u network type, integer, VAP only.
|
|
pac_file=None, # EAP-FAST PAC-File name. (For AP, this field is the RADIUS
|
|
# secret password)
|
|
pairwise=None, # Pairwise ciphers: CCMP, TKIP, NONE, or combination.
|
|
password=None, # EAP Password string.
|
|
phase1=None, # Outer-authentication, ie TLS tunnel parameters.
|
|
phase2=None, # Inner authentication with TLS tunnel.
|
|
pin=None, # EAP-SIM pin string. (For AP, this field is HS20 Operating
|
|
# Class)
|
|
pk_passwd=None, # EAP private key password. (For AP, this field is HS20
|
|
# connection capability)
|
|
port=None, # WiFi interface name or number.
|
|
private_key=None, # EAP private key certificate file name. (For AP, this field
|
|
# is HS20 WAN Metrics)
|
|
psk=None, # WPA(2) pre-shared key. If unsure, use this field for any
|
|
# password entry. Prepend with 0x for ascii-hex
|
|
# representation.
|
|
realm=None, # 802.11u realm: mytelco.com
|
|
resource=None, # Resource number.
|
|
roaming_consortium=None, # 802.11u roaming consortium: 223344 (15 characters max)
|
|
shelf=None, # Shelf number.
|
|
venue_group=None, # 802.11u Venue Group, integer. VAP only.
|
|
venue_type=None, # 802.11u Venue Type, integer. VAP only.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wifi_extra(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if anonymous_identity is not None:
|
|
data["anonymous_identity"] = anonymous_identity
|
|
if anqp_3gpp_cell_net is not None:
|
|
data["anqp_3gpp_cell_net"] = anqp_3gpp_cell_net
|
|
if ca_cert is not None:
|
|
data["ca_cert"] = ca_cert
|
|
if client_cert is not None:
|
|
data["client_cert"] = client_cert
|
|
if domain is not None:
|
|
data["domain"] = domain
|
|
if eap is not None:
|
|
data["eap"] = eap
|
|
if group is not None:
|
|
data["group"] = group
|
|
if hessid is not None:
|
|
data["hessid"] = hessid
|
|
if identity is not None:
|
|
data["identity"] = identity
|
|
if imsi is not None:
|
|
data["imsi"] = imsi
|
|
if ipaddr_type_avail is not None:
|
|
data["ipaddr_type_avail"] = ipaddr_type_avail
|
|
if key is not None:
|
|
data["key"] = key
|
|
if key_mgmt is not None:
|
|
data["key_mgmt"] = key_mgmt
|
|
if milenage is not None:
|
|
data["milenage"] = milenage
|
|
if network_auth_type is not None:
|
|
data["network_auth_type"] = network_auth_type
|
|
if network_type is not None:
|
|
data["network_type"] = network_type
|
|
if pac_file is not None:
|
|
data["pac_file"] = pac_file
|
|
if pairwise is not None:
|
|
data["pairwise"] = pairwise
|
|
if password is not None:
|
|
data["password"] = password
|
|
if phase1 is not None:
|
|
data["phase1"] = phase1
|
|
if phase2 is not None:
|
|
data["phase2"] = phase2
|
|
if pin is not None:
|
|
data["pin"] = pin
|
|
if pk_passwd is not None:
|
|
data["pk_passwd"] = pk_passwd
|
|
if port is not None:
|
|
data["port"] = port
|
|
if private_key is not None:
|
|
data["private_key"] = private_key
|
|
if psk is not None:
|
|
data["psk"] = psk
|
|
if realm is not None:
|
|
data["realm"] = realm
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if roaming_consortium is not None:
|
|
data["roaming_consortium"] = roaming_consortium
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if venue_group is not None:
|
|
data["venue_group"] = venue_group
|
|
if venue_type is not None:
|
|
data["venue_type"] = venue_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wifi_extra",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WIFI_EXTRA2> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wifi_extra2
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_wifi_extra2(self,
|
|
corrupt_gtk_rekey_mic=None, # Per-million: AP corrupts GTK Rekey MIC.
|
|
freq_24=None, # Frequency list for 2.4Ghz band, see above.
|
|
freq_5=None, # Frequency list for 5Ghz band, see above.
|
|
ignore_assoc=None, # Per-million: AP ignore assoc request percentage.
|
|
ignore_auth=None, # Per-million: AP ignore auth request percentage.
|
|
ignore_probe=None, # Per-million: AP ignore probe percentage.
|
|
ignore_reassoc=None, # Per-million: AP ignore re-assoc request percentage.
|
|
ocsp=None, # OCSP settings: 0=disabled, 1=try, but to not require
|
|
# response, 2=require valid OCSP stapling response.
|
|
port=None, # WiFi interface name or number.
|
|
post_ifup_script=None, # Script name with optional args, will run after interface
|
|
# comes up and gets IP.
|
|
radius_ip=None, # RADIUS server IP Address (AP Only)
|
|
radius_port=None, # RADIUS server IP Port (AP Only)
|
|
req_flush=None, # Set to 1 if you wish to flush changes to kernel now.
|
|
resource=None, # Resource number.
|
|
sae_pwe=None, # Set SAE-PWE, 0 == hunting-and-pecking, 1 ==
|
|
# hash-to-element, 2 allow both.
|
|
shelf=None, # Shelf number.
|
|
venue_id=None, # Venue-ID for this wifi device. VAP in same venue will
|
|
# share neigh reports as appropriate.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wifi_extra2(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if corrupt_gtk_rekey_mic is not None:
|
|
data["corrupt_gtk_rekey_mic"] = corrupt_gtk_rekey_mic
|
|
if freq_24 is not None:
|
|
data["freq_24"] = freq_24
|
|
if freq_5 is not None:
|
|
data["freq_5"] = freq_5
|
|
if ignore_assoc is not None:
|
|
data["ignore_assoc"] = ignore_assoc
|
|
if ignore_auth is not None:
|
|
data["ignore_auth"] = ignore_auth
|
|
if ignore_probe is not None:
|
|
data["ignore_probe"] = ignore_probe
|
|
if ignore_reassoc is not None:
|
|
data["ignore_reassoc"] = ignore_reassoc
|
|
if ocsp is not None:
|
|
data["ocsp"] = ocsp
|
|
if port is not None:
|
|
data["port"] = port
|
|
if post_ifup_script is not None:
|
|
data["post_ifup_script"] = post_ifup_script
|
|
if radius_ip is not None:
|
|
data["radius_ip"] = radius_ip
|
|
if radius_port is not None:
|
|
data["radius_port"] = radius_port
|
|
if req_flush is not None:
|
|
data["req_flush"] = req_flush
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if sae_pwe is not None:
|
|
data["sae_pwe"] = sae_pwe
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if venue_id is not None:
|
|
data["venue_id"] = venue_id
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wifi_extra2",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WIFI_RADIO> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wifi_radio
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetWifiRadioFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetWifiRadioFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
ct_sta_mode = 0x40000 # Enable CT-STA mode if radio supports it. Efficiently replaces sw-crypt in
|
|
# +some firmware.
|
|
firmware_cfg = 0x80000 # Apply firmware config.
|
|
hw_sim = 0x1 # Create hw-sim virtual radio if radio does not already exist.
|
|
ignore_radar = 0x100000 # Ignore RADAR events reported by firmware.
|
|
no_scan_share = 0x40 # Disable sharing scan results.
|
|
no_sw_crypt = 0x20000 # Disable software-crypt for this radio. Disables some virtual-station
|
|
# +features.
|
|
use_syslog = 0x20000000 # Put supplicant logs in syslog instead of a file.
|
|
verbose = 0x10000 # Verbose-Debug: Increase debug info in wpa-supplicant and hostapd logs.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetWifiRadioFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
class SetWifiRadioMode(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
p_802_11a = 1 # 802.11a
|
|
AUTO = 0 # 802.11g
|
|
aAX = 15 # 802.11a-AX (6E disables /n and /ac)
|
|
abg = 4 # 802.11abg
|
|
abgn = 5 # 802.11abgn
|
|
abgnAC = 8 # 802.11abgn-AC
|
|
abgnAX = 12 # 802.11abgn-AX
|
|
an = 10 # 802.11an
|
|
anAC = 9 # 802.11an-AC
|
|
anAX = 14 # 802.11an-AX
|
|
b = 2 # 802.11b
|
|
bg = 7 # 802.11bg
|
|
bgn = 6 # 802.11bgn
|
|
bgnAC = 11 # 802.11bgn-AC
|
|
bgnAX = 13 # 802.11bgn-AX
|
|
g = 3 # 802.11g
|
|
|
|
def post_set_wifi_radio(self,
|
|
active_peer_count=None, # Number of locally-cached peer objects for this radio.
|
|
ampdu_factor=None, # ax200/ax210 only, currently. Requires module reload. OS
|
|
# Default: 0xFF
|
|
antenna=None, # Antenna configuration: 0 Diversity/All, 1 Fixed-A (1x1), 4
|
|
# AB (2x2), 7 ABC (3x3), 8 ABCD (4x4), 9 8x8
|
|
channel=None, # Channel number for this radio device. Frequency takes
|
|
# precedence if both are set to non-default values.
|
|
# <tt>0xFFFF, AUTO or DEFAULT</tt> means ANY.
|
|
const_tx=None, # RF Pattern Generator , encoded as a single 32-bit integer.
|
|
# See above.
|
|
country=None, # Country number for this radio device.
|
|
flags=None, # Flags for this interface (see above.)
|
|
flags_mask=None, # If set, only these flags will be considered.
|
|
frag_thresh=None, # Fragmentation Threshold (256 - 2346, 2346 == disabled).
|
|
frequency=None, # Frequency for this radio. <tt>0xFFFF, AUTO or DEFAULT</tt>
|
|
# means ANY.
|
|
fwname=None, # Firmware name (for example: firmware-5.bin)
|
|
fwver=None, # Firmware API version (for example, 5 if firmware is based on
|
|
# firmware-5.bin
|
|
mac=None, # Used to identify when name cannot be trusted (2.6.34+
|
|
# kernels).
|
|
max_amsdu=None, # Maximum number of frames per AMSDU that may be transmitted.
|
|
# See above.
|
|
mode=None, # WiFi mode, see table
|
|
peer_count=None, # Number of peer objects for this radio.
|
|
pref_ap=None, # Preferred AP BSSID for all station vdevs on this radio.
|
|
pulse2_interval_us=None, # Pause between pattern burst for RF noise generator.
|
|
pulse_interval=None, # RF Pattern generator: interval between pulses in usecs.
|
|
pulse_width=None, # RF Pattern generator: pulse width in usecs.
|
|
radio=None, # Name of the physical radio interface, for example: wiphy0
|
|
rate=None, # No longer used, specify the rate on the virtual station(s)
|
|
# instead.
|
|
rate_ctrl_count=None, # Number of rate-ctrl objects for this radio.
|
|
resource=None, # Resource number.
|
|
rts=None, # The RTS Threshold for this radio (off, or 1-2347).
|
|
shelf=None, # Shelf number.
|
|
skid_limit=None, # Firmware hash-table Skid Limit for this radio.
|
|
stations_count=None, # Number of stations supported by this radio.
|
|
tids_count=None, # TIDs count for this radio.
|
|
tx_pulses=None, # Number of pattern pulses per burst for RF noise generator.
|
|
txdesc_count=None, # Transmit descriptor count for this radio.
|
|
txpower=None, # The transmit power setting for this radio. (AUTO for system
|
|
# defaults)
|
|
vdev_count=None, # Configure radio vdev count.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wifi_radio(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if active_peer_count is not None:
|
|
data["active_peer_count"] = active_peer_count
|
|
if ampdu_factor is not None:
|
|
data["ampdu_factor"] = ampdu_factor
|
|
if antenna is not None:
|
|
data["antenna"] = antenna
|
|
if channel is not None:
|
|
data["channel"] = channel
|
|
if const_tx is not None:
|
|
data["const_tx"] = const_tx
|
|
if country is not None:
|
|
data["country"] = country
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if flags_mask is not None:
|
|
data["flags_mask"] = flags_mask
|
|
if frag_thresh is not None:
|
|
data["frag_thresh"] = frag_thresh
|
|
if frequency is not None:
|
|
data["frequency"] = frequency
|
|
if fwname is not None:
|
|
data["fwname"] = fwname
|
|
if fwver is not None:
|
|
data["fwver"] = fwver
|
|
if mac is not None:
|
|
data["mac"] = mac
|
|
if max_amsdu is not None:
|
|
data["max_amsdu"] = max_amsdu
|
|
if mode is not None:
|
|
data["mode"] = mode
|
|
if peer_count is not None:
|
|
data["peer_count"] = peer_count
|
|
if pref_ap is not None:
|
|
data["pref_ap"] = pref_ap
|
|
if pulse2_interval_us is not None:
|
|
data["pulse2_interval_us"] = pulse2_interval_us
|
|
if pulse_interval is not None:
|
|
data["pulse_interval"] = pulse_interval
|
|
if pulse_width is not None:
|
|
data["pulse_width"] = pulse_width
|
|
if radio is not None:
|
|
data["radio"] = radio
|
|
if rate is not None:
|
|
data["rate"] = rate
|
|
if rate_ctrl_count is not None:
|
|
data["rate_ctrl_count"] = rate_ctrl_count
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if rts is not None:
|
|
data["rts"] = rts
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if skid_limit is not None:
|
|
data["skid_limit"] = skid_limit
|
|
if stations_count is not None:
|
|
data["stations_count"] = stations_count
|
|
if tids_count is not None:
|
|
data["tids_count"] = tids_count
|
|
if tx_pulses is not None:
|
|
data["tx_pulses"] = tx_pulses
|
|
if txdesc_count is not None:
|
|
data["txdesc_count"] = txdesc_count
|
|
if txpower is not None:
|
|
data["txpower"] = txpower
|
|
if vdev_count is not None:
|
|
data["vdev_count"] = vdev_count
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wifi_radio",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WIFI_TXO> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wifi_txo
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_set_wifi_txo(self,
|
|
port=None, # WiFi interface name or number.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
txo_bw=None, # Configure bandwidth: 0 == 20, 1 == 40, 2 == 80, 3 == 160, 4 ==
|
|
# 80+80.
|
|
txo_enable=None, # Set to 1 if you wish to enable transmit override, 0 to disable.
|
|
txo_mcs=None, # Configure the MCS (0-3 for CCK, 0-7 for OFDM, 0-7 for HT, 0-9 for
|
|
# VHT, 0-11 for HE
|
|
txo_nss=None, # Configure number of spatial streams (0 == nss1, 1 == nss2, ...).
|
|
txo_pream=None, # Select rate preamble: 0 == OFDM, 1 == CCK, 2 == HT, 3 == VHT, 4 ==
|
|
# HE_SU.
|
|
txo_retries=None, # Configure number of retries. 0 or 1 means no retries).
|
|
txo_sgi=None, # Should rates be sent with short-guard-interval or not?
|
|
txo_txpower=None, # Configure TX power in db. Use 255 for system defaults.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wifi_txo(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if txo_bw is not None:
|
|
data["txo_bw"] = txo_bw
|
|
if txo_enable is not None:
|
|
data["txo_enable"] = txo_enable
|
|
if txo_mcs is not None:
|
|
data["txo_mcs"] = txo_mcs
|
|
if txo_nss is not None:
|
|
data["txo_nss"] = txo_nss
|
|
if txo_pream is not None:
|
|
data["txo_pream"] = txo_pream
|
|
if txo_retries is not None:
|
|
data["txo_retries"] = txo_retries
|
|
if txo_sgi is not None:
|
|
data["txo_sgi"] = txo_sgi
|
|
if txo_txpower is not None:
|
|
data["txo_txpower"] = txo_txpower
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wifi_txo",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WL_CORRUPTION> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wl_corruption
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetWlCorruptionFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SetWlCorruptionFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
BIT_FLIP = 0x4 # Flip a random bit in a byte.
|
|
BIT_TRANSPOSE = 0x8 # Transpose two side-by-side bits in a byte.
|
|
DO_CHAIN_ON_HIT = 0x10 # Do next corruption if this corruption is applied.
|
|
OVERWRITE_FIXED = 0x2 # Write a fixed value to a byte.
|
|
OVERWRITE_RANDOM = 0x1 # Write a random value to a byte.
|
|
RECALC_CSUMS = 0x20 # Attempt to re-calculate UDP and TCP checksums.
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SetWlCorruptionFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_set_wl_corruption(self,
|
|
byte=None, # The byte to use for OVERWRITE_FIXED (or NA).
|
|
flags=None, # The flags for this corruption.
|
|
index=None, # The corruption to modify (0-5).
|
|
max_offset=None, # The maximum offset from start of Ethernet packet for the byte
|
|
# to be modified.
|
|
min_offset=None, # The minimum offset from start of Ethernet packet for the byte
|
|
# to be modified.
|
|
name=None, # WanLink name
|
|
rate=None, # Specifies how often, per million, this corruption should be
|
|
# applied.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wl_corruption(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if byte is not None:
|
|
data["byte"] = byte
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if index is not None:
|
|
data["index"] = index
|
|
if max_offset is not None:
|
|
data["max_offset"] = max_offset
|
|
if min_offset is not None:
|
|
data["min_offset"] = min_offset
|
|
if name is not None:
|
|
data["name"] = name
|
|
if rate is not None:
|
|
data["rate"] = rate
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wl_corruption",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SET_WL_QDISC> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#set_wl_qdisc
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SetWlQdiscQdisc(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
FIFO = "FIFO" # is the default queuing discipline, no arguments
|
|
WRR__queue_queue_____ = "WRR,[queue,queue,...]" # Weighted Round Robbin is also available
|
|
|
|
def post_set_wl_qdisc(self,
|
|
name=None, # WanLink name
|
|
qdisc=None, # FIFO, WRR,a,b,c,d,e,f,g etc
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_set_wl_qdisc(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if qdisc is not None:
|
|
data["qdisc"] = qdisc
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/set_wl_qdisc",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_ALERTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_alerts
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class ShowAlertsType(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
All = "All" #
|
|
CX = "CX" #
|
|
Card = "Card" #
|
|
Channel_Group = "Channel_Group" #
|
|
CollisionDomain = "CollisionDomain" #
|
|
Endp = "Endp" #
|
|
PESQ = "PESQ" #
|
|
PPP_Link = "PPP_Link" #
|
|
Port = "Port" #
|
|
Shelf = "Shelf" #
|
|
Span = "Span" #
|
|
Test_Mgr = "Test_Mgr" #
|
|
|
|
def post_show_alerts(self,
|
|
card=None, # Alert resource filter.
|
|
endp=None, # Alert endpoint filter.
|
|
extra=None, # Extra filter, currently ignored.
|
|
port=None, # Alert port filter (can be port name or number).
|
|
shelf=None, # Alert shelf filter.
|
|
p_type=None, # Alert type filter.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_alerts(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if card is not None:
|
|
data["card"] = card
|
|
if endp is not None:
|
|
data["endp"] = endp
|
|
if extra is not None:
|
|
data["extra"] = extra
|
|
if port is not None:
|
|
data["port"] = port
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_alerts",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_ATTENUATORS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_attenuators
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_attenuators(self,
|
|
resource=None, # Resource number, or 'all'.
|
|
serno=None, # Serial number for requested Attenuator, or 'all'.
|
|
shelf=None, # Shelf number or alias, can be 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_attenuators(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if serno is not None:
|
|
data["serno"] = serno
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_attenuators",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_CD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_cd
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_cd(self,
|
|
collision_domain=None, # Name of the Collision Domain, or 'all'.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_cd(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if collision_domain is not None:
|
|
data["collision_domain"] = collision_domain
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_cd",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_CHAMBER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_chamber
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_chamber(self,
|
|
name=None, # Chamber Name or 'ALL'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_chamber(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_chamber",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_CHANNEL_GROUPS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_channel_groups
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_channel_groups(self,
|
|
channel_name=None, # Name of the channel, or 'all'.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_channel_groups(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if channel_name is not None:
|
|
data["channel_name"] = channel_name
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_channel_groups",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_CLIENTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_clients
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_clients(self,
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_clients(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
response = self.json_post("/cli-json/show_clients",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_CX> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_cx
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_cx(self,
|
|
cross_connect=None, # Specify cross-connect to act on, or 'all'.
|
|
test_mgr=None, # Specify test-mgr to act on, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_cx(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cross_connect is not None:
|
|
data["cross_connect"] = cross_connect
|
|
if test_mgr is not None:
|
|
data["test_mgr"] = test_mgr
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_cx",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_CXE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_cxe
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_cxe(self,
|
|
cross_connect=None, # Specify cross-connect to show, or 'all'.
|
|
test_mgr=None, # Specify test-mgr to use, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_cxe(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cross_connect is not None:
|
|
data["cross_connect"] = cross_connect
|
|
if test_mgr is not None:
|
|
data["test_mgr"] = test_mgr
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_cxe",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_DBS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_dbs
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_dbs(self,
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_dbs(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
response = self.json_post("/cli-json/show_dbs",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_DUT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_dut
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_dut(self,
|
|
name=None, # DUT Name or 'ALL'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_dut(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_dut",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_ENDP_PAYLOAD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_endp_payload
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_endp_payload(self,
|
|
max_bytes=None, # The max number of payload bytes to print out, default is 128.
|
|
name=None, # The name of the endpoint we are configuring.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_endp_payload(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if max_bytes is not None:
|
|
data["max_bytes"] = max_bytes
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_endp_payload",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_ENDPOINTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_endpoints
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_endpoints(self,
|
|
endpoint=None, # Name of endpoint, or 'all'.
|
|
extra=None, # See above.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_endpoints(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endpoint is not None:
|
|
data["endpoint"] = endpoint
|
|
if extra is not None:
|
|
data["extra"] = extra
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_endpoints",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_ERR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_err
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_err(self,
|
|
message=None, # Message to show to others currently logged on. <tt
|
|
# escapearg='false'>Unescaped Value</tt>
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_err(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if message is not None:
|
|
data["message"] = message
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_err",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_EVENT_INTEREST> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_event_interest
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_event_interest(self,
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_event_interest(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
response = self.json_post("/cli-json/show_event_interest",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_EVENTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_events
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class ShowEventsType(Enum):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
All = "All" #
|
|
CX = "CX" #
|
|
Card = "Card" #
|
|
Channel_Group = "Channel_Group" #
|
|
CollisionDomain = "CollisionDomain" #
|
|
Endp = "Endp" #
|
|
PESQ = "PESQ" #
|
|
PPP_Link = "PPP_Link" #
|
|
Port = "Port" #
|
|
Shelf = "Shelf" #
|
|
Span = "Span" #
|
|
Test_Mgr = "Test_Mgr" #
|
|
|
|
def post_show_events(self,
|
|
card=None, # Event resource filter.
|
|
endp=None, # Event endpoint filter.
|
|
extra=None, # Extra filter, currently ignored.
|
|
port=None, # Event port filter (can be port name or number).
|
|
shelf=None, # Event shelf filter.
|
|
p_type=None, # Event type filter.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_events(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if card is not None:
|
|
data["card"] = card
|
|
if endp is not None:
|
|
data["endp"] = endp
|
|
if extra is not None:
|
|
data["extra"] = extra
|
|
if port is not None:
|
|
data["port"] = port
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_events",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_FILES> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_files
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_files(self,
|
|
dir_flags=None, # Determines format of listing, see above.
|
|
directory=None, # The sub-directory in which to list.
|
|
p_filter=None, # An optional filter, as used by the 'ls' command.
|
|
key=None, # A special key, can be used for scripting.
|
|
resource=None, # The machine to search in.
|
|
shelf=None, # The virtual shelf to search in. Use 0 for manager machine.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_files(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if dir_flags is not None:
|
|
data["dir_flags"] = dir_flags
|
|
if directory is not None:
|
|
data["directory"] = directory
|
|
if p_filter is not None:
|
|
data["filter"] = p_filter
|
|
if key is not None:
|
|
data["key"] = key
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_files",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_GROUP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_group
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_group(self,
|
|
group=None, # Can be name of test group. Use 'all' or leave blank for all groups.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_group(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if group is not None:
|
|
data["group"] = group
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_group",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_PESQ> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_pesq
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_pesq(self,
|
|
endpoint=None, # Name of endpoint, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_pesq(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endpoint is not None:
|
|
data["endpoint"] = endpoint
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_pesq",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_PORTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_ports
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_ports(self,
|
|
port=None, # Port number, or 'all'.
|
|
probe_flags=None, # See above, add them together for multiple probings. Leave blank if
|
|
# you want stats only.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_ports(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if port is not None:
|
|
data["port"] = port
|
|
if probe_flags is not None:
|
|
data["probe_flags"] = probe_flags
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_ports",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_PPP_LINKS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_ppp_links
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_ppp_links(self,
|
|
link_num=None, # Ppp-Link number of the span, or 'all'.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_ppp_links(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if link_num is not None:
|
|
data["link_num"] = link_num
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_ppp_links",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_PROFILE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_profile
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_profile(self,
|
|
name=None, # Profile Name or 'ALL'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_profile(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_profile",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_RESOURCES> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_resources
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_resources(self,
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Shelf number or alias, can be 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_resources(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_resources",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_RFGEN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_rfgen
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_rfgen(self,
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Shelf number or alias, can be 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_rfgen(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_rfgen",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_RT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_rt
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_rt(self,
|
|
key=None, # Unique identifier for this request. Usually left blank.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
virtual_router=None, # Name of the virtual router.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_rt(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if key is not None:
|
|
data["key"] = key
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if virtual_router is not None:
|
|
data["virtual_router"] = virtual_router
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_rt",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_SCRIPT_RESULTS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_script_results
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_script_results(self,
|
|
endpoint=None, # Name of endpoint, test-group, or 'all'.
|
|
key=None, # Optional 'key' to be used in keyed-text message result.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_script_results(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endpoint is not None:
|
|
data["endpoint"] = endpoint
|
|
if key is not None:
|
|
data["key"] = key
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_script_results",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_SPANS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_spans
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_spans(self,
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
span_number=None, # Span-Number of the span, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_spans(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if span_number is not None:
|
|
data["span_number"] = span_number
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_spans",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_TEXT_BLOB> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_text_blob
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_text_blob(self,
|
|
brief=None, # Set to 'brief' for a brief listing of all text blobs.
|
|
name=None, # Text Blob Name or 'ALL'.
|
|
p_type=None, # Text Blob type or 'ALL'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_text_blob(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if brief is not None:
|
|
data["brief"] = brief
|
|
if name is not None:
|
|
data["name"] = name
|
|
if p_type is not None:
|
|
data["type"] = p_type
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_text_blob",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_TM> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_tm
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_tm(self,
|
|
test_mgr=None, # Can be name of test manager, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_tm(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if test_mgr is not None:
|
|
data["test_mgr"] = test_mgr
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_tm",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_TRAFFIC_PROFILE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_traffic_profile
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_traffic_profile(self,
|
|
name=None, # Profile Name or 'ALL'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_traffic_profile(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_traffic_profile",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_VENUE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_venue
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_venue(self,
|
|
resource=None, # Resource number, or 'ALL'
|
|
shelf=None, # Shelf number.
|
|
venu_id=None, # Number to uniquely identify this venue on this resource, or 'ALL'
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_venue(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if venu_id is not None:
|
|
data["venu_id"] = venu_id
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_venue",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_VR> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_vr
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_vr(self,
|
|
resource=None, # Resource number, or 'all'.
|
|
router=None, # Name of the Virtual Router, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_vr(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if router is not None:
|
|
data["router"] = router
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_vr",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_VRCX> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_vrcx
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_vrcx(self,
|
|
cx_name=None, # Name of the Virtual Router Connection, or 'all'.
|
|
resource=None, # Resource number, or 'all'.
|
|
shelf=None, # Name/id of the shelf, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_vrcx(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cx_name is not None:
|
|
data["cx_name"] = cx_name
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_vrcx",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHOW_WANPATHS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#show_wanpaths
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_show_wanpaths(self,
|
|
endpoint=None, # Name of endpoint, or 'all'.
|
|
wanpath=None, # Name of wanpath, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_show_wanpaths(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endpoint is not None:
|
|
data["endpoint"] = endpoint
|
|
if wanpath is not None:
|
|
data["wanpath"] = wanpath
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/show_wanpaths",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHUTDOWN> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#shutdown
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_shutdown(self,
|
|
chdir=None, # Directory to cd to before dying. Only useful when using gprof to debug,
|
|
# or 'NA' to ignore.
|
|
really=None, # Must be 'YES' for command to really work.
|
|
serverctl=None, # Enter 'YES' to do a ./serverctl.bash restart to restart all LANforge
|
|
# processes.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_shutdown(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if chdir is not None:
|
|
data["chdir"] = chdir
|
|
if really is not None:
|
|
data["really"] = really
|
|
if serverctl is not None:
|
|
data["serverctl"] = serverctl
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/shutdown",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHUTDOWN_OS> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#shutdown_os
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_shutdown_os(self,
|
|
resource=None, # Resource number, or ALL.
|
|
shelf=None, # Shelf number, or ALL.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_shutdown_os(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/shutdown_os",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SHUTDOWN_RESOURCE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#shutdown_resource
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_shutdown_resource(self,
|
|
resource=None, # Resource number, or ALL.
|
|
shelf=None, # Shelf number, or ALL.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_shutdown_resource(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/shutdown_resource",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/SNIFF_PORT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#sniff_port
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
class SniffPortFlags(IntFlag):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
This class is stateless. It can do binary flag math, returning the integer value.
|
|
Example Usage:
|
|
int:flag_val = 0
|
|
flag_val = LFPost.set_flags(SniffPortFlags0, flag_names=['bridge', 'dhcp'])
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
|
|
DUMPCAP = 0x2 # Use command-line dumpcap, more efficient than tshark
|
|
MATE_TERMINAL = 0x4 # Launch tshark/dumpcap in mate-terminal
|
|
MATE_XTERM = 0x8 # Launch tshark/dumpcap in xterm
|
|
TSHARK = 0x1 # Use command-line tshark instead of wireshark
|
|
|
|
# use to get in value of flag
|
|
@classmethod
|
|
def valueof(cls, name=None):
|
|
if name is None:
|
|
return name
|
|
if name not in cls.__members__:
|
|
raise ValueError("SniffPortFlags has no member:[%s]" % name)
|
|
return (cls[member].value for member in cls.__members__ if member == name)
|
|
|
|
def post_sniff_port(self,
|
|
display=None, # The DISPLAY option, for example: 192.168.1.5:0.0. Will guess if left
|
|
# blank.
|
|
duration=None, # Duration for doing a capture (in seconds). Default is 5 minutes for
|
|
# dumpcap/tshark, and forever for wireshark
|
|
flags=None, # Flags that control how the sniffing is done.
|
|
outfile=None, # Optional file location for saving a capture.
|
|
port=None, # The port we are trying to run the packet sniffer on.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_sniff_port(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if display is not None:
|
|
data["display"] = display
|
|
if duration is not None:
|
|
data["duration"] = duration
|
|
if flags is not None:
|
|
data["flags"] = flags
|
|
if outfile is not None:
|
|
data["outfile"] = outfile
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/sniff_port",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/START_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#start_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_start_endp(self,
|
|
endp_name=None, # Name of the cross-connect, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_start_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp_name is not None:
|
|
data["endp_name"] = endp_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/start_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/START_GROUP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#start_group
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_start_group(self,
|
|
name=None, # The name of the test group.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_start_group(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/start_group",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/START_PPP_LINK> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#start_ppp_link
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_start_ppp_link(self,
|
|
resource=None, # Resource number that holds this PppLink.
|
|
shelf=None, # Name/id of the shelf.
|
|
unit_num=None, # Unit-Number for the PppLink to be started.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_start_ppp_link(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if unit_num is not None:
|
|
data["unit_num"] = unit_num
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/start_ppp_link",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/STOP_ENDP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#stop_endp
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_stop_endp(self,
|
|
endp_name=None, # Name of the endpoint, or 'all'.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_stop_endp(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if endp_name is not None:
|
|
data["endp_name"] = endp_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/stop_endp",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/STOP_GROUP> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#stop_group
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_stop_group(self,
|
|
name=None, # The name of the test group, or 'all'
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_stop_group(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if name is not None:
|
|
data["name"] = name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/stop_group",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/STOP_PPP_LINK> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#stop_ppp_link
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_stop_ppp_link(self,
|
|
resource=None, # Resource number that holds this PppLink.
|
|
shelf=None, # Name/id of the shelf.
|
|
unit_num=None, # Unit-Number for the PppLink to be stopped.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_stop_ppp_link(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if unit_num is not None:
|
|
data["unit_num"] = unit_num
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/stop_ppp_link",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/TAIL> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#tail
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_tail(self,
|
|
cmd=None, # Command: start, stop, results
|
|
key=None, # File-name that we should be tailing.
|
|
message=None, # The contents to display (for results only) <tt escapearg='false'>Unescaped
|
|
# Value</tt>
|
|
resource=None, # Resource that holds the file.
|
|
shelf=None, # Shelf that holds the resource that holds the file.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_tail(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if cmd is not None:
|
|
data["cmd"] = cmd
|
|
if key is not None:
|
|
data["key"] = key
|
|
if message is not None:
|
|
data["message"] = message
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/tail",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/TM_REGISTER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#tm_register
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_tm_register(self,
|
|
client_name=None, # Name of client to be registered. (dflt is current client)
|
|
test_mgr=None, # Name of test manager (can be all.)
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_tm_register(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if client_name is not None:
|
|
data["client_name"] = client_name
|
|
if test_mgr is not None:
|
|
data["test_mgr"] = test_mgr
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/tm_register",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/TM_UNREGISTER> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#tm_unregister
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_tm_unregister(self,
|
|
client_name=None, # Name of client to be un-registered. (dflt is current client)
|
|
test_mgr=None, # Name of test manager (can be all.)
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_tm_unregister(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if client_name is not None:
|
|
data["client_name"] = client_name
|
|
if test_mgr is not None:
|
|
data["test_mgr"] = test_mgr
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/tm_unregister",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/VERSION> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#version
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_version(self,
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_version(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
response = self.json_post("/cli-json/version",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/WHO> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#who
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_who(self,
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_who(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
response = self.json_post("/cli-json/who",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/WIFI_CLI_CMD> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#wifi_cli_cmd
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_wifi_cli_cmd(self,
|
|
port=None, # Name of the WiFi station or AP interface to which this command
|
|
# will be directed.
|
|
resource=None, # Resource number.
|
|
shelf=None, # Shelf number.
|
|
wpa_cli_cmd=None, # Command to pass to wpa_cli or hostap_cli. This must be
|
|
# single-quoted.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_wifi_cli_cmd(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if port is not None:
|
|
data["port"] = port
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if wpa_cli_cmd is not None:
|
|
data["wpa_cli_cmd"] = wpa_cli_cmd
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/wifi_cli_cmd",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/WIFI_EVENT> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#wifi_event
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_wifi_event(self,
|
|
device=None, # Interface or PHY in most cases.
|
|
event=None, # What happened.
|
|
msg=None, # Entire event in human readable form.
|
|
status=None, # Status on what happened.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_wifi_event(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if device is not None:
|
|
data["device"] = device
|
|
if event is not None:
|
|
data["event"] = event
|
|
if msg is not None:
|
|
data["msg"] = msg
|
|
if status is not None:
|
|
data["status"] = status
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/wifi_event",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/WISER_RESET> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#wiser_reset
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_wiser_reset(self,
|
|
resource=None, # Resource number, or ALL.
|
|
shelf=None, # Shelf number, or ALL.
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_wiser_reset(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if resource is not None:
|
|
data["resource"] = resource
|
|
if shelf is not None:
|
|
data["shelf"] = shelf
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/wiser_reset",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|
|
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Notes for <CLI-JSON/WRITE> type requests
|
|
|
|
https://www.candelatech.com/lfcli_ug.php#write
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
def post_write(self,
|
|
db_name=None, # The name the backup shall be saved as (blank means dflt)
|
|
debug_=False):
|
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
|
Example Usage:
|
|
result = post_write(param=value ...)
|
|
pprint.pprint( result )
|
|
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
|
debug_ |= self.debug
|
|
data = {}
|
|
if db_name is not None:
|
|
data["db_name"] = db_name
|
|
if len(data) < 1:
|
|
raise ValueError(__name__+": no parameters to submit")
|
|
response = self.json_post("/cli-json/write",
|
|
data,
|
|
debug_=debug_)
|
|
return response
|
|
#
|