mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 19:28:00 +00:00
lf_json_autogen.py: now has help text for port section
Signed-off-by: Jed Reynolds <jed@candelatech.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
||||
Generated by LANforge JsonApiPythonGenerator, Fri Sep 10 14:38:00 PDT 2021
|
||||
Generated by LANforge JsonApiPythonGenerator, Fri Sep 10 16:52:09 PDT 2021
|
||||
- - WORK IN PROGRESS - -
|
||||
The API this library provides is actively being changed.
|
||||
This file expects to live in py-json/LANforge directory.
|
||||
@@ -1104,80 +1104,108 @@ class LFJsonGet(LFCliBase):
|
||||
|
||||
The record returned will have these members:
|
||||
{
|
||||
'4way time (us)': # -
|
||||
'activity': # -
|
||||
'alias': # -
|
||||
'anqp time (us)': # -
|
||||
'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 (us)': # -
|
||||
'device': # -
|
||||
'dhcp (ms)': # -
|
||||
'down': # -
|
||||
'entity id': # -
|
||||
'gateway ip': # -
|
||||
'ip': # -
|
||||
'ipv6 address': # -
|
||||
'ipv6 gateway': # -
|
||||
'key/phrase': # -
|
||||
'login-fail': # -
|
||||
'login-ok': # -
|
||||
'logout-fail': # -
|
||||
'logout-ok': # -
|
||||
'mac': # -
|
||||
'mask': # -
|
||||
'misc': # -
|
||||
'mode': # -
|
||||
'mtu': # -
|
||||
'no cx (us)': # -
|
||||
'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 %': # -
|
||||
'tx-rate': # -
|
||||
'wifi retries': # -
|
||||
'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.
|
||||
}
|
||||
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
|
||||
|
||||
@@ -2389,9 +2417,13 @@ class LFJsonPost(LFCliBase):
|
||||
@staticmethod
|
||||
def set_flags(flag_class: IntFlag, starting_value: int, flag_names=None):
|
||||
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
||||
Example Usage:
|
||||
value = LFJsonPost.add_flags(SetPortMumble, 0, flag_names=['bridge', 'dhcp'])
|
||||
print('value now: '+value)
|
||||
: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")
|
||||
@@ -2402,12 +2434,16 @@ class LFJsonPost(LFCliBase):
|
||||
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))
|
||||
selected_flags.extend([flag_class[member].value for member in flag_class.__members__ if member == flag])
|
||||
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 has no member:[%s]" % (flag_class.__class__.__name__, flag))
|
||||
selected_flags.extend([member.value for member in flag_class if member == flag])
|
||||
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:
|
||||
@@ -2419,16 +2455,21 @@ class LFJsonPost(LFCliBase):
|
||||
print('f_name is str %s' % f_name)
|
||||
else:
|
||||
print('f_name is %s' % type(flag_names))
|
||||
if flag_names not in flag_class.__members__:
|
||||
raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag_names))
|
||||
return flag_class.valueof(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):
|
||||
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
||||
Example Usage:
|
||||
value = LFJsonPost.clear_flags(SetPortMumble, 0, flag_names=['bridge', 'dhcp'])
|
||||
print('value now: '+value)
|
||||
: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")
|
||||
@@ -2444,17 +2485,19 @@ class LFJsonPost(LFCliBase):
|
||||
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)
|
||||
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 has no member:[%s]" % (flag_class.__class__.__name__, flag_names))
|
||||
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 has no member:[%s]" % (flag_class.__class__.__name__, flag_names))
|
||||
raise ValueError("%s lacks member:[%s]" %
|
||||
(flag_class.__class__.__name__, flag_names))
|
||||
unselected_val = starting_value
|
||||
unselected_val &= ~flag_names.value
|
||||
return unselected_val
|
||||
|
||||
Reference in New Issue
Block a user