diff --git a/py-json/LANforge/lf_json_autogen.py b/py-json/LANforge/lf_json_autogen.py
index a1e415f0..97949b5a 100644
--- a/py-json/LANforge/lf_json_autogen.py
+++ b/py-json/LANforge/lf_json_autogen.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Generated by LANforge JsonApiPythonGenerator, Wed Aug 11 14:29:40 PDT 2021
+ Generated by LANforge JsonApiPythonGenerator, Fri Aug 13 11:56:15 PDT 2021
- - WORK IN PROGRESS - -
The API this library provides is actively being changed.
This file expects to live in py-json/LANforge directory.
@@ -2265,16 +2265,16 @@ class LFJsonPost(LFCliBase):
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.
+ 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
+ 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:
@@ -2283,16 +2283,16 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "cpu_id" : cpu_id,
- "mx_pkt_sz" : mx_pkt_sz,
- "pkt_sz" : pkt_sz,
- "port" : port,
- "pps" : pps,
- "resource" : resource,
- "shelf" : shelf,
- "tos" : tos,
- "type" : p_type,
+ "alias": alias,
+ "cpu_id": cpu_id,
+ "mx_pkt_sz": mx_pkt_sz,
+ "pkt_sz": pkt_sz,
+ "port": port,
+ "pps": pps,
+ "resource": resource,
+ "shelf": shelf,
+ "tos": tos,
+ "type": p_type,
}
response = self.json_post("/cli-json/add_arm_endp",
data,
@@ -2308,75 +2308,62 @@ class LFJsonPost(LFCliBase):
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 = AddBgpPeerFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddBgpPeerFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddBgpPeerFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddBgpPeerFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddBgpPeerFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddBgpPeerFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddBgpPeerFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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:
@@ -2385,18 +2372,18 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "as" : p_as,
- "delay_open_time" : delay_open_time,
- "flags" : flags,
- "holdtime" : holdtime,
- "local_dev" : local_dev,
- "nexthop" : nexthop,
- "nexthop6" : nexthop6,
- "peer_id" : peer_id,
- "peer_index" : peer_index,
- "resource" : resource,
- "shelf" : shelf,
- "vr_id" : vr_id,
+ "as": p_as,
+ "delay_open_time": delay_open_time,
+ "flags": flags,
+ "holdtime": holdtime,
+ "local_dev": local_dev,
+ "nexthop": nexthop,
+ "nexthop6": nexthop6,
+ "peer_id": peer_id,
+ "peer_index": peer_index,
+ "resource": resource,
+ "shelf": shelf,
+ "vr_id": vr_id,
}
response = self.json_post("/cli-json/add_bgp_peer",
data,
@@ -2410,10 +2397,10 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -2422,10 +2409,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "network_devs" : network_devs,
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
+ "network_devs": network_devs,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/add_bond",
data,
@@ -2445,20 +2432,20 @@ class LFJsonPost(LFCliBase):
AddBrBrFlags.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddBrBrFlags.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- none = 0 # no features
- stp_enabled = 1 # Enable Spanning Tree Protocol (STP)
+ 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.
+ 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:
@@ -2467,16 +2454,16 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "br_aging_time" : br_aging_time,
- "br_flags" : br_flags,
- "br_forwarding_delay" : br_forwarding_delay,
- "br_hello_time" : br_hello_time,
- "br_max_age" : br_max_age,
- "br_priority" : br_priority,
- "network_devs" : network_devs,
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
+ "br_aging_time": br_aging_time,
+ "br_flags": br_flags,
+ "br_forwarding_delay": br_forwarding_delay,
+ "br_hello_time": br_hello_time,
+ "br_max_age": br_max_age,
+ "br_priority": br_priority,
+ "network_devs": network_devs,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/add_br",
data,
@@ -2496,18 +2483,19 @@ class LFJsonPost(LFCliBase):
AddCdFlags.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddCdFlags.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- ERR = 2 # Set to kernel mode.
- RUNNING = 1 # Set to running state.
+ 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
+ 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:
@@ -2516,14 +2504,14 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "bps" : bps,
- "flags" : flags,
- "report_timer" : report_timer,
- "resource" : resource,
- "shelf" : shelf,
- "state" : state,
- "type" : p_type,
+ "alias": alias,
+ "bps": bps,
+ "flags": flags,
+ "report_timer": report_timer,
+ "resource": resource,
+ "shelf": shelf,
+ "state": state,
+ "type": p_type,
}
response = self.json_post("/cli-json/add_cd",
data,
@@ -2537,8 +2525,8 @@ class LFJsonPost(LFCliBase):
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.
+ cd=None, # Name of Collision Domain.
+ endp=None, # Endpoint name/id.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -2547,8 +2535,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cd" : cd,
- "endp" : endp,
+ "cd": cd,
+ "endp": endp,
}
response = self.json_post("/cli-json/add_cd_endp",
data,
@@ -2562,9 +2550,8 @@ class LFJsonPost(LFCliBase):
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.
-
+ cd=None, # Name of Collision Domain.
+ vr=None, # Virtual-Router name/ID.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -2573,8 +2560,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cd" : cd,
- "vr" : vr,
+ "cd": cd,
+ "vr": vr,
}
response = self.json_post("/cli-json/add_cd_vr",
data,
@@ -2590,82 +2577,70 @@ class LFJsonPost(LFCliBase):
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 = AddChamberChamberFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddChamberChamberFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddChamberChamberFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddChamberChamberFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddChamberChamberFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddChamberChamberFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddChamberChamberFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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:
@@ -2674,26 +2649,26 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "chamber_type" : chamber_type,
- "dut_name1" : dut_name1,
- "dut_name2" : dut_name2,
- "dut_name3" : dut_name3,
- "dut_name4" : dut_name4,
- "flags" : flags,
- "flags_mask" : flags_mask,
- "height" : height,
- "isolation" : isolation,
- "lanforge1" : lanforge1,
- "lanforge2" : lanforge2,
- "lanforge3" : lanforge3,
- "lanforge4" : lanforge4,
- "name" : name,
- "resource" : resource,
- "sma_count" : sma_count,
- "turntable_type" : turntable_type,
- "width" : width,
- "x" : x,
- "y" : y,
+ "chamber_type": chamber_type,
+ "dut_name1": dut_name1,
+ "dut_name2": dut_name2,
+ "dut_name3": dut_name3,
+ "dut_name4": dut_name4,
+ "flags": flags,
+ "flags_mask": flags_mask,
+ "height": height,
+ "isolation": isolation,
+ "lanforge1": lanforge1,
+ "lanforge2": lanforge2,
+ "lanforge3": lanforge3,
+ "lanforge4": lanforge4,
+ "name": name,
+ "resource": resource,
+ "sma_count": sma_count,
+ "turntable_type": turntable_type,
+ "width": width,
+ "x": x,
+ "y": y,
}
response = self.json_post("/cli-json/add_chamber",
data,
@@ -2713,21 +2688,28 @@ class LFJsonPost(LFCliBase):
AddChamberCxChamberCxFlags.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddChamberCxChamberCxFlags.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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!
+ 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.
+ 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:
@@ -2736,17 +2718,17 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "a_id" : a_id,
- "atten_id" : atten_id,
- "b_id" : b_id,
- "connection_idx" : connection_idx,
- "flags" : flags,
- "flags_mask" : flags_mask,
- "internal" : internal,
- "min_atten" : min_atten,
- "name" : name,
- "zrssi2" : zrssi2,
- "zrssi5" : zrssi5,
+ "a_id": a_id,
+ "atten_id": atten_id,
+ "b_id": b_id,
+ "connection_idx": connection_idx,
+ "flags": flags,
+ "flags_mask": flags_mask,
+ "internal": internal,
+ "min_atten": min_atten,
+ "name": name,
+ "zrssi2": zrssi2,
+ "zrssi5": zrssi5,
}
response = self.json_post("/cli-json/add_chamber_cx",
data,
@@ -2760,9 +2742,10 @@ class LFJsonPost(LFCliBase):
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. Unescaped Value
- path=None, # Path Name
+ chamber=None, # Chamber Name.
+ content=None, # [BLANK] will erase all content, any other text will be appended
+ # to existing text. Unescaped Value
+ path=None, # Path Name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -2771,9 +2754,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "chamber" : chamber,
- "content" : content,
- "path" : path,
+ "chamber": chamber,
+ "content": content,
+ "path": path,
}
response = self.json_post("/cli-json/add_chamber_path",
data,
@@ -2793,29 +2776,30 @@ class LFJsonPost(LFCliBase):
AddChannelGroupTypes.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddChannelGroupTypes.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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
+ 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.
+ 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.
+ 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.
+ 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.
+ p_type=None, # The channel-type. Use 'clear' for PPP links.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -2824,14 +2808,14 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "channels" : channels,
- "idle_flag" : idle_flag,
- "mtu" : mtu,
- "resource" : resource,
- "shelf" : shelf,
- "span_num" : span_num,
- "type" : p_type,
+ "alias": alias,
+ "channels": channels,
+ "idle_flag": idle_flag,
+ "mtu": mtu,
+ "resource": resource,
+ "shelf": shelf,
+ "span_num": span_num,
+ "type": p_type,
}
response = self.json_post("/cli-json/add_channel_group",
data,
@@ -2845,9 +2829,9 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#add_cx
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_add_cx(self,
- alias=None, # Name of the Cross Connect to create.
+ 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.
+ test_mgr=None, # Name of test-manager to create the CX on.
tx_endp=None, # Name of Transmitting endpoint.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -2857,10 +2841,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "rx_endp" : rx_endp,
- "test_mgr" : test_mgr,
- "tx_endp" : tx_endp,
+ "alias": alias,
+ "rx_endp": rx_endp,
+ "test_mgr": test_mgr,
+ "tx_endp": tx_endp,
}
response = self.json_post("/cli-json/add_cx",
data,
@@ -2876,100 +2860,89 @@ class LFJsonPost(LFCliBase):
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 = AddDutDutFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddDutDutFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddDutDutFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddDutDutFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddDutDutFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddDutDutFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddDutDutFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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
+ 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:
@@ -2978,34 +2951,34 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "antenna_count1" : antenna_count1,
- "antenna_count2" : antenna_count2,
- "antenna_count3" : antenna_count3,
- "api_id" : api_id,
- "bssid1" : bssid1,
- "bssid2" : bssid2,
- "bssid3" : bssid3,
- "eap_id" : eap_id,
- "flags" : flags,
- "flags_mask" : flags_mask,
- "hw_version" : hw_version,
- "img_file" : img_file,
- "lan_port" : lan_port,
- "mgt_ip" : mgt_ip,
- "model_num" : model_num,
- "name" : name,
- "passwd1" : passwd1,
- "passwd2" : passwd2,
- "passwd3" : passwd3,
- "serial_num" : serial_num,
- "serial_port" : serial_port,
- "ssid1" : ssid1,
- "ssid2" : ssid2,
- "ssid3" : ssid3,
- "sw_version" : sw_version,
- "top_left_x" : top_left_x,
- "top_left_y" : top_left_y,
- "wan_port" : wan_port,
+ "antenna_count1": antenna_count1,
+ "antenna_count2": antenna_count2,
+ "antenna_count3": antenna_count3,
+ "api_id": api_id,
+ "bssid1": bssid1,
+ "bssid2": bssid2,
+ "bssid3": bssid3,
+ "eap_id": eap_id,
+ "flags": flags,
+ "flags_mask": flags_mask,
+ "hw_version": hw_version,
+ "img_file": img_file,
+ "lan_port": lan_port,
+ "mgt_ip": mgt_ip,
+ "model_num": model_num,
+ "name": name,
+ "passwd1": passwd1,
+ "passwd2": passwd2,
+ "passwd3": passwd3,
+ "serial_num": serial_num,
+ "serial_port": serial_port,
+ "ssid1": ssid1,
+ "ssid2": ssid2,
+ "ssid3": ssid3,
+ "sw_version": sw_version,
+ "top_left_x": top_left_x,
+ "top_left_y": top_left_y,
+ "wan_port": wan_port,
}
response = self.json_post("/cli-json/add_dut",
data,
@@ -3020,7 +2993,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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. Unescaped Value
+ text=None, # [BLANK] will erase all, any other text will be appended to existing
+ # text. Unescaped Value
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -3029,8 +3003,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "dut" : dut,
- "text" : text,
+ "dut": dut,
+ "text": text,
}
response = self.json_post("/cli-json/add_dut_notes",
data,
@@ -3046,73 +3020,60 @@ class LFJsonPost(LFCliBase):
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 = AddDutSsidDutFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddDutSsidDutFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddDutSsidDutFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddDutSsidDutFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddDutSsidDutFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddDutSsidDutFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddDutSsidDutFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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)
+ 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:
@@ -3121,13 +3082,13 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "bssid" : bssid,
- "name" : name,
- "passwd" : passwd,
- "ssid" : ssid,
- "ssid_flags" : ssid_flags,
- "ssid_flags_mask" : ssid_flags_mask,
- "ssid_idx" : ssid_idx,
+ "bssid": bssid,
+ "name": name,
+ "passwd": passwd,
+ "ssid": ssid,
+ "ssid_flags": ssid_flags,
+ "ssid_flags_mask": ssid_flags_mask,
+ "ssid_idx": ssid_idx,
}
response = self.json_post("/cli-json/add_dut_ssid",
data,
@@ -3147,17 +3108,17 @@ class LFJsonPost(LFCliBase):
AddEndpPayloadPattern.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddEndpPayloadPattern.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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)
+ 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -3165,37 +3126,43 @@ class LFJsonPost(LFCliBase):
AddEndpType.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddEndpType.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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
+ 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.
+ 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:
@@ -3204,23 +3171,23 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "ip_port" : ip_port,
- "is_pkt_sz_random" : is_pkt_sz_random,
- "is_rate_bursty" : is_rate_bursty,
- "max_pkt" : max_pkt,
- "max_rate" : max_rate,
- "min_pkt" : min_pkt,
- "min_rate" : min_rate,
- "multi_conn" : multi_conn,
- "payload_pattern" : payload_pattern,
- "port" : port,
- "resource" : resource,
- "send_bad_crc_per_million" : send_bad_crc_per_million,
- "shelf" : shelf,
- "ttl" : ttl,
- "type" : p_type,
- "use_checksum" : use_checksum,
+ "alias": alias,
+ "ip_port": ip_port,
+ "is_pkt_sz_random": is_pkt_sz_random,
+ "is_rate_bursty": is_rate_bursty,
+ "max_pkt": max_pkt,
+ "max_rate": max_rate,
+ "min_pkt": min_pkt,
+ "min_rate": min_rate,
+ "multi_conn": multi_conn,
+ "payload_pattern": payload_pattern,
+ "port": port,
+ "resource": resource,
+ "send_bad_crc_per_million": send_bad_crc_per_million,
+ "shelf": shelf,
+ "ttl": ttl,
+ "type": p_type,
+ "use_checksum": use_checksum,
}
response = self.json_post("/cli-json/add_endp",
data,
@@ -3235,9 +3202,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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.
+ 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:
@@ -3246,10 +3213,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "details" : details,
- "event_id" : event_id,
- "name" : name,
- "priority" : priority,
+ "details": details,
+ "event_id": event_id,
+ "name": name,
+ "priority": priority,
}
response = self.json_post("/cli-json/add_event",
data,
@@ -3265,67 +3232,57 @@ class LFJsonPost(LFCliBase):
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 = AddFileEndpFioFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddFileEndpFioFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddFileEndpFioFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddFileEndpFioFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddFileEndpFioFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddFileEndpFioFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddFileEndpFioFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -3333,37 +3290,41 @@ class LFJsonPost(LFCliBase):
AddFileEndpPayloadPattern.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddFileEndpPayloadPattern.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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).
+ 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.
+ 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_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
+ 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:
@@ -3372,24 +3333,24 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "directory" : directory,
- "fio_flags" : fio_flags,
- "max_read_rate" : max_read_rate,
- "max_write_rate" : max_write_rate,
- "min_read_rate" : min_read_rate,
- "min_write_rate" : min_write_rate,
- "mount_dir" : mount_dir,
- "mount_options" : mount_options,
- "payload_pattern" : payload_pattern,
- "port" : port,
- "prefix" : prefix,
- "resource" : resource,
- "retry_timer" : retry_timer,
- "server_mount" : server_mount,
- "shelf" : shelf,
- "type" : p_type,
- "volume" : volume,
+ "alias": alias,
+ "directory": directory,
+ "fio_flags": fio_flags,
+ "max_read_rate": max_read_rate,
+ "max_write_rate": max_write_rate,
+ "min_read_rate": min_read_rate,
+ "min_write_rate": min_write_rate,
+ "mount_dir": mount_dir,
+ "mount_options": mount_options,
+ "payload_pattern": payload_pattern,
+ "port": port,
+ "prefix": prefix,
+ "resource": resource,
+ "retry_timer": retry_timer,
+ "server_mount": server_mount,
+ "shelf": shelf,
+ "type": p_type,
+ "volume": volume,
}
response = self.json_post("/cli-json/add_file_endp",
data,
@@ -3403,11 +3364,11 @@ class LFJsonPost(LFCliBase):
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
+ 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:
@@ -3416,11 +3377,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
- "type" : p_type,
+ "alias": alias,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
+ "type": p_type,
}
response = self.json_post("/cli-json/add_gen_endp",
data,
@@ -3435,11 +3396,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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.
+ 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:
@@ -3448,12 +3409,12 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "local_lower_ip" : local_lower_ip,
- "port" : port,
- "remote_lower_ip" : remote_lower_ip,
- "report_timer" : report_timer,
- "resource" : resource,
- "shelf" : shelf,
+ "local_lower_ip": local_lower_ip,
+ "port": port,
+ "remote_lower_ip": remote_lower_ip,
+ "report_timer": report_timer,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/add_gre",
data,
@@ -3469,63 +3430,51 @@ class LFJsonPost(LFCliBase):
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 = AddGroupFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- group_total_rates = 0x4 # Set rates as total for group.
+ group_total_rates = 0x4 # Set rates as total for group.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddGroupFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddGroupFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddGroupFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddGroupFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddGroupFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddGroupFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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:
@@ -3534,9 +3483,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "flags" : flags,
- "flags_mask" : flags_mask,
- "name" : name,
+ "flags": flags,
+ "flags_mask": flags_mask,
+ "name": name,
}
response = self.json_post("/cli-json/add_group",
data,
@@ -3552,205 +3501,172 @@ class LFJsonPost(LFCliBase):
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 = AddL4EndpHttpAuthType.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- BASIC = 0x1 # Basic authentication
- DIGEST = 0x2 # Digest (MD5) authentication
- GSSNEGOTIATE = 0x4 # GSS authentication
- NTLM = 0x8 # NTLM authentication
+ BASIC = 0x1 # Basic authentication
+ DIGEST = 0x2 # Digest (MD5) authentication
+ GSSNEGOTIATE = 0x4 # GSS authentication
+ NTLM = 0x8 # NTLM authentication
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddL4EndpHttpAuthType.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddL4EndpHttpAuthType.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddL4EndpHttpAuthType has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddL4EndpHttpAuthType has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddL4EndpHttpAuthType.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddL4EndpHttpAuthType.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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 = AddL4EndpProxyAuthType.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddL4EndpProxyAuthType.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddL4EndpProxyAuthType.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddL4EndpProxyAuthType has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddL4EndpProxyAuthType has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddL4EndpProxyAuthType.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddL4EndpProxyAuthType.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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 = AddL4EndpType.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- l4_generic = 0x0 # Layer 4 type
+ l4_generic = 0x0 # Layer 4 type
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddL4EndpType.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddL4EndpType.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddL4EndpType has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddL4EndpType has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddL4EndpType.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddL4EndpType.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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: user:passwd.
- 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 : l4_generic
- 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.
- 600: 1/s
- 1200: 2/s
- 1800: 3/s
- 2400: 4/s
- user_agent=None, # User-Agent string. Leave blank for default. Also SMTP-TO: <a@b.com><c@d.com>...<q@x.com>
+ 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:
+ # user:passwd.
+ 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 : l4_generic
+ 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.- 600: 1/s
- 1200: 2/s
- 1800: 3/s
- 2400:
+ # 4/s
+ 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:
@@ -3759,27 +3675,27 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "block_size" : block_size,
- "dns_cache_timeout" : dns_cache_timeout,
- "http_auth_type" : http_auth_type,
- "ip_addr" : ip_addr,
- "max_speed" : max_speed,
- "port" : port,
- "proxy_auth_type" : proxy_auth_type,
- "proxy_port" : proxy_port,
- "proxy_server" : proxy_server,
- "proxy_userpwd" : proxy_userpwd,
- "quiesce_after" : quiesce_after,
- "resource" : resource,
- "shelf" : shelf,
- "smtp_from" : smtp_from,
- "ssl_cert_fname" : ssl_cert_fname,
- "timeout" : timeout,
- "type" : p_type,
- "url" : url,
- "url_rate" : url_rate,
- "user_agent" : user_agent,
+ "alias": alias,
+ "block_size": block_size,
+ "dns_cache_timeout": dns_cache_timeout,
+ "http_auth_type": http_auth_type,
+ "ip_addr": ip_addr,
+ "max_speed": max_speed,
+ "port": port,
+ "proxy_auth_type": proxy_auth_type,
+ "proxy_port": proxy_port,
+ "proxy_server": proxy_server,
+ "proxy_userpwd": proxy_userpwd,
+ "quiesce_after": quiesce_after,
+ "resource": resource,
+ "shelf": shelf,
+ "smtp_from": smtp_from,
+ "ssl_cert_fname": ssl_cert_fname,
+ "timeout": timeout,
+ "type": p_type,
+ "url": url,
+ "url_rate": url_rate,
+ "user_agent": user_agent,
}
response = self.json_post("/cli-json/add_l4_endp",
data,
@@ -3795,70 +3711,57 @@ class LFJsonPost(LFCliBase):
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 = AddMonitorFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddMonitorFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddMonitorFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddMonitorFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddMonitorFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddMonitorFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddMonitorFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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:
@@ -3867,14 +3770,14 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aid" : aid,
- "ap_name" : ap_name,
- "bssid" : bssid,
- "flags" : flags,
- "flags_mask" : flags_mask,
- "radio" : radio,
- "resource" : resource,
- "shelf" : shelf,
+ "aid": aid,
+ "ap_name": ap_name,
+ "bssid": bssid,
+ "flags": flags,
+ "flags_mask": flags_mask,
+ "radio": radio,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/add_monitor",
data,
@@ -3888,14 +3791,15 @@ class LFJsonPost(LFCliBase):
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 4 in eth0#4)
- mac=None, # The MAC address, can also use parent-pattern in 5.3.8 and higher: xx:xx:xx:*:*:xx
- 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.
+ flags=None, # 0x1: Create admin-down.
+ index=None, # Optional: The index of the VLAN, (the 4 in eth0#4)
+ mac=None, # The MAC address, can also use parent-pattern in 5.3.8 and higher:
+ # xx:xx:xx:*:*:xx
+ 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:
@@ -3904,14 +3808,14 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "flags" : flags,
- "index" : index,
- "mac" : mac,
- "old_name" : old_name,
- "port" : port,
- "report_timer" : report_timer,
- "resource" : resource,
- "shelf" : shelf,
+ "flags": flags,
+ "index": index,
+ "mac": mac,
+ "old_name": old_name,
+ "port": port,
+ "report_timer": report_timer,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/add_mvlan",
data,
@@ -3925,27 +3829,34 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -3954,27 +3865,27 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "auth" : auth,
- "channel_groups" : channel_groups,
- "debug" : debug,
- "down_time_max_ms" : down_time_max_ms,
- "down_time_min_ms" : down_time_min_ms,
- "dst_ip" : dst_ip,
- "extra_args" : extra_args,
- "holdoff" : holdoff,
- "lcp_echo_failure" : lcp_echo_failure,
- "lcp_echo_interval" : lcp_echo_interval,
- "mlppp_descriptor" : mlppp_descriptor,
- "persist" : persist,
- "pppoe_transport_port" : pppoe_transport_port,
- "resource" : resource,
- "run_time_max_ms" : run_time_max_ms,
- "run_time_min_ms" : run_time_min_ms,
- "shelf" : shelf,
- "src_ip" : src_ip,
- "transport_type" : transport_type,
- "tty_transport_device" : tty_transport_device,
- "unit" : unit,
+ "auth": auth,
+ "channel_groups": channel_groups,
+ "debug": debug,
+ "down_time_max_ms": down_time_max_ms,
+ "down_time_min_ms": down_time_min_ms,
+ "dst_ip": dst_ip,
+ "extra_args": extra_args,
+ "holdoff": holdoff,
+ "lcp_echo_failure": lcp_echo_failure,
+ "lcp_echo_interval": lcp_echo_interval,
+ "mlppp_descriptor": mlppp_descriptor,
+ "persist": persist,
+ "pppoe_transport_port": pppoe_transport_port,
+ "resource": resource,
+ "run_time_max_ms": run_time_max_ms,
+ "run_time_min_ms": run_time_min_ms,
+ "shelf": shelf,
+ "src_ip": src_ip,
+ "transport_type": transport_type,
+ "tty_transport_device": tty_transport_device,
+ "unit": unit,
}
response = self.json_post("/cli-json/add_ppp_link",
data,
@@ -3990,68 +3901,55 @@ class LFJsonPost(LFCliBase):
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 = AddProfileProfileFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddProfileProfileFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddProfileProfileFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddProfileProfileFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddProfileProfileFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddProfileProfileFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddProfileProfileFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -4059,52 +3957,55 @@ class LFJsonPost(LFCliBase):
AddProfileWifiMode.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddProfileWifiMode.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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.
+ 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.
+ 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.
+ 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:
@@ -4113,21 +4014,21 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias_prefix" : alias_prefix,
- "antenna" : antenna,
- "bandwidth" : bandwidth,
- "eap_id" : eap_id,
- "flags_mask" : flags_mask,
- "freq" : freq,
- "instance_count" : instance_count,
- "mac_pattern" : mac_pattern,
- "name" : name,
- "passwd" : passwd,
- "profile_flags" : profile_flags,
- "profile_type" : profile_type,
- "ssid" : ssid,
- "vid" : vid,
- "wifi_mode" : wifi_mode,
+ "alias_prefix": alias_prefix,
+ "antenna": antenna,
+ "bandwidth": bandwidth,
+ "eap_id": eap_id,
+ "flags_mask": flags_mask,
+ "freq": freq,
+ "instance_count": instance_count,
+ "mac_pattern": mac_pattern,
+ "name": name,
+ "passwd": passwd,
+ "profile_flags": profile_flags,
+ "profile_type": profile_type,
+ "ssid": ssid,
+ "vid": vid,
+ "wifi_mode": wifi_mode,
}
response = self.json_post("/cli-json/add_profile",
data,
@@ -4142,7 +4043,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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. Unescaped Value
+ text=None, # [BLANK] will erase all, any other text will be appended to
+ # existing text. Unescaped Value
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -4151,8 +4053,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "dut" : dut,
- "text" : text,
+ "dut": dut,
+ "text": text,
}
response = self.json_post("/cli-json/add_profile_notes",
data,
@@ -4167,10 +4069,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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.
+ 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:
@@ -4179,11 +4081,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "peer_ifname" : peer_ifname,
- "port" : port,
- "report_timer" : report_timer,
- "resource" : resource,
- "shelf" : shelf,
+ "peer_ifname": peer_ifname,
+ "port": port,
+ "report_timer": report_timer,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/add_rdd",
data,
@@ -4198,9 +4100,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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.
+ 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:
@@ -4209,10 +4111,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "ip_list" : ip_list,
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
+ "ip_list": ip_list,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/add_sec_ip",
data,
@@ -4228,92 +4130,88 @@ class LFJsonPost(LFCliBase):
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 = AddStaFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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_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
+ 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_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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddStaFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddStaFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddStaFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddStaFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddStaFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddStaFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -4321,22 +4219,22 @@ class LFJsonPost(LFCliBase):
AddStaMode.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddStaMode.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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
+ 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -4344,35 +4242,43 @@ class LFJsonPost(LFCliBase):
AddStaRate.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddStaRate.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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]" # '0xff 00 ...' to directly specify the MCS bitmap.
+ 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]" # '0xff 00 ...' to directly specify the MCS bitmap.
def post_add_sta(self,
- ampdu_density=None, # 0-7, or 0xFF to not set.
+ 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: 00:11:22:33:4:55, or DEFAULT 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: xx:xx:xx:*:*:xx
- max_amsdu=None, # 1 == enabled, 0 == disabled, 0xFF == do not set.
- mode=None, # WiFi mode: - 0: AUTO,
- 1: 802.11a
- 2: b
- 3: g
- 4: abg
- 5: abgn
- 6: bgn
- 7: bg
- 8: abgnAC
- 9 anAC
- 10 an
- 11 bgnAC
- 12 abgnAX
- 13 bgnAX
- 14 anAX
- 15 aAX
- 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 0x 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
+ ap=None, # The Access Point BSSID this Virtual STA should be associated with
+ # (example: 00:11:22:33:4:55, or DEFAULT 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:
+ # xx:xx:xx:*:*:xx
+ max_amsdu=None, # 1 == enabled, 0 == disabled, 0xFF == do not set.
+ mode=None, # WiFi mode: - 0: AUTO,
- 1: 802.11a
- 2: b
- 3:
+ # g
- 4: abg
- 5: abgn
- 6: bgn
- 7: bg
+ # - 8: abgnAC
- 9 anAC
- 10 an
- 11
+ # bgnAC
- 12 abgnAX
- 13 bgnAX
- 14 anAX
- 15
+ # aAX
+ 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
+ # 0x 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.
+ x_coord=None, # Floating point number.
+ y_coord=None, # Floating point number.
+ z_coord=None, # Floating point number.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -4381,28 +4287,28 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "ampdu_density" : ampdu_density,
- "ampdu_factor" : ampdu_factor,
- "ap" : ap,
- "flags" : flags,
- "flags_mask" : flags_mask,
- "ieee80211w" : ieee80211w,
- "key" : key,
- "mac" : mac,
- "max_amsdu" : max_amsdu,
- "mode" : mode,
- "nickname" : nickname,
- "radio" : radio,
- "rate" : rate,
- "resource" : resource,
- "shelf" : shelf,
- "ssid" : ssid,
- "sta_br_ip" : sta_br_ip,
- "sta_name" : sta_name,
- "wpa_cfg_file" : wpa_cfg_file,
- "x_coord" : x_coord,
- "y_coord" : y_coord,
- "z_coord" : z_coord,
+ "ampdu_density": ampdu_density,
+ "ampdu_factor": ampdu_factor,
+ "ap": ap,
+ "flags": flags,
+ "flags_mask": flags_mask,
+ "ieee80211w": ieee80211w,
+ "key": key,
+ "mac": mac,
+ "max_amsdu": max_amsdu,
+ "mode": mode,
+ "nickname": nickname,
+ "radio": radio,
+ "rate": rate,
+ "resource": resource,
+ "shelf": shelf,
+ "ssid": ssid,
+ "sta_br_ip": sta_br_ip,
+ "sta_name": sta_name,
+ "wpa_cfg_file": wpa_cfg_file,
+ "x_coord": x_coord,
+ "y_coord": y_coord,
+ "z_coord": z_coord,
}
response = self.json_post("/cli-json/add_sta",
data,
@@ -4422,30 +4328,30 @@ class LFJsonPost(LFCliBase):
AddT1SpanBuildout.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddT1SpanBuildout.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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
+ 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
+ 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:
@@ -4454,19 +4360,19 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "buildout" : buildout,
- "coding" : coding,
- "cpu_id" : cpu_id,
- "first_channel" : first_channel,
- "framing" : framing,
- "mtu" : mtu,
- "pci_bus" : pci_bus,
- "pci_slot" : pci_slot,
- "resource" : resource,
- "shelf" : shelf,
- "span_num" : span_num,
- "timing" : timing,
- "type" : p_type,
+ "buildout": buildout,
+ "coding": coding,
+ "cpu_id": cpu_id,
+ "first_channel": first_channel,
+ "framing": framing,
+ "mtu": mtu,
+ "pci_bus": pci_bus,
+ "pci_slot": pci_slot,
+ "resource": resource,
+ "shelf": shelf,
+ "span_num": span_num,
+ "timing": timing,
+ "type": p_type,
}
response = self.json_post("/cli-json/add_t1_span",
data,
@@ -4480,9 +4386,10 @@ class LFJsonPost(LFCliBase):
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. Unescaped Value
- p_type=None, # Text type identifier stream, for instance 'cv-connectivity'
+ 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. Unescaped Value
+ p_type=None, # Text type identifier stream, for instance 'cv-connectivity'
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -4491,9 +4398,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
- "text" : text,
- "type" : p_type,
+ "name": name,
+ "text": text,
+ "type": p_type,
}
response = self.json_post("/cli-json/add_text_blob",
data,
@@ -4507,8 +4414,8 @@ class LFJsonPost(LFCliBase):
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.
+ cxname=None, # The name of the CX.
+ tgname=None, # The name of the test group.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -4517,8 +4424,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cxname" : cxname,
- "tgname" : tgname,
+ "cxname": cxname,
+ "tgname": tgname,
}
response = self.json_post("/cli-json/add_tgcx",
data,
@@ -4538,8 +4445,8 @@ class LFJsonPost(LFCliBase):
AddThresholdThreshId.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddThresholdThreshId.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- Delete_Marked = -3 # Delete any marked.
- Mark_All = -2 # Mark all
+ Delete_Marked = -3 # Delete any marked.
+ Mark_All = -2 # Mark all
class AddThresholdThreshType(Enum):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -4547,22 +4454,23 @@ class LFJsonPost(LFCliBase):
AddThresholdThreshType.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddThresholdThreshType.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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.
+ 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.
+ 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).
+ thresh_type=None, # Threshold type, integer, (see above).
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -4571,11 +4479,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp" : endp,
- "thresh_id" : thresh_id,
- "thresh_max" : thresh_max,
- "thresh_min" : thresh_min,
- "thresh_type" : thresh_type,
+ "endp": endp,
+ "thresh_id": thresh_id,
+ "thresh_max": thresh_max,
+ "thresh_min": thresh_min,
+ "thresh_type": thresh_type,
}
response = self.json_post("/cli-json/add_threshold",
data,
@@ -4589,7 +4497,7 @@ class LFJsonPost(LFCliBase):
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.
+ name=None, # The name of the test manager. Must be unique across test managers.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -4598,7 +4506,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/add_tm",
data,
@@ -4614,60 +4522,47 @@ class LFJsonPost(LFCliBase):
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 = AddTrafficProfileTrafficProfileFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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)
+ 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)
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddTrafficProfileTrafficProfileFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddTrafficProfileTrafficProfileFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddTrafficProfileTrafficProfileFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddTrafficProfileTrafficProfileFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddTrafficProfileTrafficProfileFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddTrafficProfileTrafficProfileFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -4675,25 +4570,25 @@ class LFJsonPost(LFCliBase):
AddTrafficProfileWifiMode.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddTrafficProfileWifiMode.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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"
+ 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..
+ 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:
@@ -4702,16 +4597,16 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "instance_count" : instance_count,
- "max_pdu" : max_pdu,
- "max_speed" : max_speed,
- "min_pdu" : min_pdu,
- "min_speed" : min_speed,
- "name" : name,
- "tos" : tos,
- "traffic_profile_flags" : traffic_profile_flags,
- "traffic_profile_flags_mask" : traffic_profile_flags_mask,
- "type" : p_type,
+ "instance_count": instance_count,
+ "max_pdu": max_pdu,
+ "max_speed": max_speed,
+ "min_pdu": min_pdu,
+ "min_speed": min_speed,
+ "name": name,
+ "tos": tos,
+ "traffic_profile_flags": traffic_profile_flags,
+ "traffic_profile_flags_mask": traffic_profile_flags_mask,
+ "type": p_type,
}
response = self.json_post("/cli-json/add_traffic_profile",
data,
@@ -4726,7 +4621,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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. Unescaped Value
+ text=None, # [BLANK] will erase all, any other text will be appended
+ # to existing text. Unescaped
+ # Value
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -4735,8 +4632,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "dut" : dut,
- "text" : text,
+ "dut": dut,
+ "text": text,
}
response = self.json_post("/cli-json/add_traffic_profile_notes",
data,
@@ -4752,85 +4649,78 @@ class LFJsonPost(LFCliBase):
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 = AddVapFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddVapFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddVapFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddVapFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddVapFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddVapFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddVapFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -4838,44 +4728,47 @@ class LFJsonPost(LFCliBase):
AddVapMode.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddVapMode.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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
+ 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
+ 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.)
+ 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
+ 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: xx:xx:xx:*:*:xx
- 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.
+ 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:
+ # xx:xx:xx:*:*:xx
+ 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:
@@ -4884,26 +4777,26 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "ap_name" : ap_name,
- "beacon" : beacon,
- "custom_cfg" : custom_cfg,
- "dtim_period" : dtim_period,
- "flags" : flags,
- "flags_mask" : flags_mask,
- "frag_thresh" : frag_thresh,
- "ieee80211w" : ieee80211w,
- "key" : key,
- "mac" : mac,
- "max_sta" : max_sta,
- "mode" : mode,
- "radio" : radio,
- "rate" : rate,
- "resource" : resource,
- "shelf" : shelf,
- "ssid" : ssid,
- "x_coord" : x_coord,
- "y_coord" : y_coord,
- "z_coord" : z_coord,
+ "ap_name": ap_name,
+ "beacon": beacon,
+ "custom_cfg": custom_cfg,
+ "dtim_period": dtim_period,
+ "flags": flags,
+ "flags_mask": flags_mask,
+ "frag_thresh": frag_thresh,
+ "ieee80211w": ieee80211w,
+ "key": key,
+ "mac": mac,
+ "max_sta": max_sta,
+ "mode": mode,
+ "radio": radio,
+ "rate": rate,
+ "resource": resource,
+ "shelf": shelf,
+ "ssid": ssid,
+ "x_coord": x_coord,
+ "y_coord": y_coord,
+ "z_coord": z_coord,
}
response = self.json_post("/cli-json/add_vap",
data,
@@ -4919,154 +4812,129 @@ class LFJsonPost(LFCliBase):
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 = AddVenueFreq24.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- ALL = 0xffff # ALL
- Ch_1 = 0x1 # Channel 1
- Ch_2 = 0x2 # Channel 2
- Ch_3 = 0x4 # Channel 3
+ ALL = 0xffff # ALL
+ Ch_1 = 0x1 # Channel 1
+ Ch_2 = 0x2 # Channel 2
+ Ch_3 = 0x4 # Channel 3
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddVenueFreq24.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddVenueFreq24.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddVenueFreq24 has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddVenueFreq24 has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddVenueFreq24.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddVenueFreq24.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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 = AddVenueFreq5.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddVenueFreq5.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddVenueFreq5.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddVenueFreq5 has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddVenueFreq5 has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddVenueFreq5.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddVenueFreq5.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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: Big City Ball Park; 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.
+ description=None, # User-supplied description, ie: Big City Ball Park;
+ # 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:
@@ -5075,16 +4943,16 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "description" : description,
- "freq_24" : freq_24,
- "freq_5" : freq_5,
- "resource" : resource,
- "shelf" : shelf,
- "venu_id" : venu_id,
- "x1" : x1,
- "x2" : x2,
- "y1" : y1,
- "y2" : y2,
+ "description": description,
+ "freq_24": freq_24,
+ "freq_5": freq_5,
+ "resource": resource,
+ "shelf": shelf,
+ "venu_id": venu_id,
+ "x1": x1,
+ "x2": x2,
+ "y1": y1,
+ "y2": y2,
}
response = self.json_post("/cli-json/add_venue",
data,
@@ -5098,12 +4966,12 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -5112,12 +4980,12 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "old_name" : old_name,
- "port" : port,
- "report_timer" : report_timer,
- "resource" : resource,
- "shelf" : shelf,
- "vid" : vid,
+ "old_name": old_name,
+ "port": port,
+ "report_timer": report_timer,
+ "resource": resource,
+ "shelf": shelf,
+ "vid": vid,
}
response = self.json_post("/cli-json/add_vlan",
data,
@@ -5131,23 +4999,27 @@ class LFJsonPost(LFCliBase):
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
+ 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.
+ vad_timer=None, # How much silence (milliseconds) before VAD is enabled.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -5156,23 +5028,23 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "auth_user_name" : auth_user_name,
- "display_name" : display_name,
- "gateway_port" : gateway_port,
- "ip_addr" : ip_addr,
- "peer_phone_num" : peer_phone_num,
- "phone_num" : phone_num,
- "port" : port,
- "proxy_passwd" : proxy_passwd,
- "resource" : resource,
- "rtp_port" : rtp_port,
- "rx_sound_file" : rx_sound_file,
- "shelf" : shelf,
- "sip_gateway" : sip_gateway,
- "tx_sound_file" : tx_sound_file,
- "vad_max_timer" : vad_max_timer,
- "vad_timer" : vad_timer,
+ "alias": alias,
+ "auth_user_name": auth_user_name,
+ "display_name": display_name,
+ "gateway_port": gateway_port,
+ "ip_addr": ip_addr,
+ "peer_phone_num": peer_phone_num,
+ "phone_num": phone_num,
+ "port": port,
+ "proxy_passwd": proxy_passwd,
+ "resource": resource,
+ "rtp_port": rtp_port,
+ "rx_sound_file": rx_sound_file,
+ "shelf": shelf,
+ "sip_gateway": sip_gateway,
+ "tx_sound_file": tx_sound_file,
+ "vad_max_timer": vad_max_timer,
+ "vad_timer": vad_timer,
}
response = self.json_post("/cli-json/add_voip_endp",
data,
@@ -5188,82 +5060,71 @@ class LFJsonPost(LFCliBase):
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 = AddVrFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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)
+ 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)
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddVrFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddVrFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddVrFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddVrFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddVrFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddVrFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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:
@@ -5272,16 +5133,16 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "flags" : flags,
- "height" : height,
- "notes" : notes,
- "resource" : resource,
- "shelf" : shelf,
- "vr_id" : vr_id,
- "width" : width,
- "x" : x,
- "y" : y,
+ "alias": alias,
+ "flags": flags,
+ "height": height,
+ "notes": notes,
+ "resource": resource,
+ "shelf": shelf,
+ "vr_id": vr_id,
+ "width": width,
+ "x": x,
+ "y": y,
}
response = self.json_post("/cli-json/add_vr",
data,
@@ -5297,76 +5158,63 @@ class LFJsonPost(LFCliBase):
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 = AddVrBgpFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddVrBgpFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddVrBgpFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddVrBgpFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddVrBgpFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddVrBgpFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddVrBgpFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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:
@@ -5375,18 +5223,18 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "bgp_id" : bgp_id,
- "cluster_id" : cluster_id,
- "confed_id" : confed_id,
- "flags" : flags,
- "half_life" : half_life,
- "local_as" : local_as,
- "max_suppress" : max_suppress,
- "resource" : resource,
- "reuse" : reuse,
- "shelf" : shelf,
- "suppress" : suppress,
- "vr_id" : vr_id,
+ "bgp_id": bgp_id,
+ "cluster_id": cluster_id,
+ "confed_id": confed_id,
+ "flags": flags,
+ "half_life": half_life,
+ "local_as": local_as,
+ "max_suppress": max_suppress,
+ "resource": resource,
+ "reuse": reuse,
+ "shelf": shelf,
+ "suppress": suppress,
+ "vr_id": vr_id,
}
response = self.json_post("/cli-json/add_vr_bgp",
data,
@@ -5402,104 +5250,94 @@ class LFJsonPost(LFCliBase):
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 = AddVrcxFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
AddVrcxFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+AddVrcxFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("AddVrcxFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("AddVrcxFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- AddVrcxFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+AddVrcxFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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.
+ 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.
+ 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:
@@ -5508,37 +5346,37 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "dhcp_dns" : dhcp_dns,
- "dhcp_dns6" : dhcp_dns6,
- "dhcp_domain" : dhcp_domain,
- "dhcp_lease_time" : dhcp_lease_time,
- "dhcp_max" : dhcp_max,
- "dhcp_max6" : dhcp_max6,
- "dhcp_min" : dhcp_min,
- "dhcp_min6" : dhcp_min6,
- "flags" : flags,
- "height" : height,
- "interface_cost" : interface_cost,
- "local_dev" : local_dev,
- "local_dev_b" : local_dev_b,
- "nexthop" : nexthop,
- "ospf_area" : ospf_area,
- "remote_dev" : remote_dev,
- "remote_dev_b" : remote_dev_b,
- "resource" : resource,
- "rip_metric" : rip_metric,
- "shelf" : shelf,
- "subnets" : subnets,
- "vr_name" : vr_name,
- "vrrp_id" : vrrp_id,
- "vrrp_interval" : vrrp_interval,
- "vrrp_ip" : vrrp_ip,
- "vrrp_ip_prefix" : vrrp_ip_prefix,
- "vrrp_priority" : vrrp_priority,
- "wanlink" : wanlink,
- "width" : width,
- "x" : x,
- "y" : y,
+ "dhcp_dns": dhcp_dns,
+ "dhcp_dns6": dhcp_dns6,
+ "dhcp_domain": dhcp_domain,
+ "dhcp_lease_time": dhcp_lease_time,
+ "dhcp_max": dhcp_max,
+ "dhcp_max6": dhcp_max6,
+ "dhcp_min": dhcp_min,
+ "dhcp_min6": dhcp_min6,
+ "flags": flags,
+ "height": height,
+ "interface_cost": interface_cost,
+ "local_dev": local_dev,
+ "local_dev_b": local_dev_b,
+ "nexthop": nexthop,
+ "ospf_area": ospf_area,
+ "remote_dev": remote_dev,
+ "remote_dev_b": remote_dev_b,
+ "resource": resource,
+ "rip_metric": rip_metric,
+ "shelf": shelf,
+ "subnets": subnets,
+ "vr_name": vr_name,
+ "vrrp_id": vrrp_id,
+ "vrrp_interval": vrrp_interval,
+ "vrrp_ip": vrrp_ip,
+ "vrrp_ip_prefix": vrrp_ip_prefix,
+ "vrrp_priority": vrrp_priority,
+ "wanlink": wanlink,
+ "width": width,
+ "x": x,
+ "y": y,
}
response = self.json_post("/cli-json/add_vrcx",
data,
@@ -5552,12 +5390,14 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#add_vrcx2
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_add_vrcx2(self,
- local_dev=None, # Name of port A for the connection.
+ 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.
+ 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:
@@ -5566,12 +5406,12 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "local_dev" : local_dev,
- "nexthop6" : nexthop6,
- "resource" : resource,
- "shelf" : shelf,
- "subnets6" : subnets6,
- "vr_name" : vr_name,
+ "local_dev": local_dev,
+ "nexthop6": nexthop6,
+ "resource": resource,
+ "shelf": shelf,
+ "subnets6": subnets6,
+ "vr_name": vr_name,
}
response = self.json_post("/cli-json/add_vrcx2",
data,
@@ -5591,46 +5431,64 @@ class LFJsonPost(LFCliBase):
AddWlEndpWleFlags.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+AddWlEndpWleFlags.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- SHOW_WP = 1 # Show WanPaths in wanlink endpoint table in GUI
+ 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.
+ 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:
@@ -5639,43 +5497,43 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "cpu_id" : cpu_id,
- "description" : description,
- "dest_ip" : dest_ip,
- "dest_ip_mask" : dest_ip_mask,
- "drop_every_xth_pkt" : drop_every_xth_pkt,
- "drop_freq" : drop_freq,
- "dup_every_xth_pkt" : dup_every_xth_pkt,
- "dup_freq" : dup_freq,
- "extra_buffer" : extra_buffer,
- "ignore_bandwidth" : ignore_bandwidth,
- "ignore_dup" : ignore_dup,
- "ignore_latency" : ignore_latency,
- "ignore_loss" : ignore_loss,
- "jitter_freq" : jitter_freq,
- "latency" : latency,
- "max_drop_amt" : max_drop_amt,
- "max_jitter" : max_jitter,
- "max_lateness" : max_lateness,
- "max_rate" : max_rate,
- "max_reorder_amt" : max_reorder_amt,
- "min_drop_amt" : min_drop_amt,
- "min_reorder_amt" : min_reorder_amt,
- "playback_capture" : playback_capture,
- "playback_capture_file" : playback_capture_file,
- "playback_loop" : playback_loop,
- "port" : port,
- "reorder_every_xth_pkt" : reorder_every_xth_pkt,
- "reorder_freq" : reorder_freq,
- "resource" : resource,
- "shelf" : shelf,
- "source_ip" : source_ip,
- "source_ip_mask" : source_ip_mask,
- "speed" : speed,
- "test_mgr" : test_mgr,
- "wanlink" : wanlink,
- "wle_flags" : wle_flags,
+ "alias": alias,
+ "cpu_id": cpu_id,
+ "description": description,
+ "dest_ip": dest_ip,
+ "dest_ip_mask": dest_ip_mask,
+ "drop_every_xth_pkt": drop_every_xth_pkt,
+ "drop_freq": drop_freq,
+ "dup_every_xth_pkt": dup_every_xth_pkt,
+ "dup_freq": dup_freq,
+ "extra_buffer": extra_buffer,
+ "ignore_bandwidth": ignore_bandwidth,
+ "ignore_dup": ignore_dup,
+ "ignore_latency": ignore_latency,
+ "ignore_loss": ignore_loss,
+ "jitter_freq": jitter_freq,
+ "latency": latency,
+ "max_drop_amt": max_drop_amt,
+ "max_jitter": max_jitter,
+ "max_lateness": max_lateness,
+ "max_rate": max_rate,
+ "max_reorder_amt": max_reorder_amt,
+ "min_drop_amt": min_drop_amt,
+ "min_reorder_amt": min_reorder_amt,
+ "playback_capture": playback_capture,
+ "playback_capture_file": playback_capture_file,
+ "playback_loop": playback_loop,
+ "port": port,
+ "reorder_every_xth_pkt": reorder_every_xth_pkt,
+ "reorder_freq": reorder_freq,
+ "resource": resource,
+ "shelf": shelf,
+ "source_ip": source_ip,
+ "source_ip_mask": source_ip_mask,
+ "speed": speed,
+ "test_mgr": test_mgr,
+ "wanlink": wanlink,
+ "wle_flags": wle_flags,
}
response = self.json_post("/cli-json/add_wl_endp",
data,
@@ -5689,11 +5547,13 @@ class LFJsonPost(LFCliBase):
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
+ 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:
@@ -5702,11 +5562,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "arg1" : arg1,
- "arg2" : arg2,
- "arg3" : arg3,
- "arg5" : arg5,
- "cmd" : cmd,
+ "arg1": arg1,
+ "arg2": arg2,
+ "arg3": arg3,
+ "arg5": arg5,
+ "cmd": cmd,
}
response = self.json_post("/cli-json/admin",
data,
@@ -5720,8 +5580,8 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -5730,8 +5590,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/apply_vr_cfg",
data,
@@ -5745,9 +5605,9 @@ class LFJsonPost(LFCliBase):
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.
+ resource=None, # Resource number.
+ serno=None, # Serial number for requested Attenuator, or 'all'.
+ shelf=None, # Shelf number, usually 1.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -5756,9 +5616,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "serno" : serno,
- "shelf" : shelf,
+ "resource": resource,
+ "serno": serno,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/blink_attenuator",
data,
@@ -5774,70 +5634,58 @@ class LFJsonPost(LFCliBase):
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 = CShowPortsProbeFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
CShowPortsProbeFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+CShowPortsProbeFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("CShowPortsProbeFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("CShowPortsProbeFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- CShowPortsProbeFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+CShowPortsProbeFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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'.
+ 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:
@@ -5846,10 +5694,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "port" : port,
- "probe_flags" : probe_flags,
- "resource" : resource,
- "shelf" : shelf,
+ "port": port,
+ "probe_flags": probe_flags,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/c_show_ports",
data,
@@ -5863,8 +5711,8 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -5873,8 +5721,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/cancel_vr_cfg",
data,
@@ -5888,7 +5736,8 @@ class LFJsonPost(LFCliBase):
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'.
+ cd_name=None, # Name of Collision Domain, or 'all'. Null argument is same as
+ # 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -5897,7 +5746,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cd_name" : cd_name,
+ "cd_name": cd_name,
}
response = self.json_post("/cli-json/clear_cd_counters",
data,
@@ -5911,7 +5760,8 @@ class LFJsonPost(LFCliBase):
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'.
+ cx_name=None, # Name of Cross Connect, or 'all'. Null argument is same as
+ # 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -5920,7 +5770,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cx_name" : cx_name,
+ "cx_name": cx_name,
}
response = self.json_post("/cli-json/clear_cx_counters",
data,
@@ -5934,9 +5784,12 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -5945,9 +5798,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp_name" : endp_name,
- "incr_seqno" : incr_seqno,
- "just_latency" : just_latency,
+ "endp_name": endp_name,
+ "incr_seqno": incr_seqno,
+ "just_latency": just_latency,
}
response = self.json_post("/cli-json/clear_endp_counters",
data,
@@ -5961,7 +5814,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#clear_group
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_clear_group(self,
- name=None, # The name of the test group.
+ name=None, # The name of the test group.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -5970,7 +5823,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/clear_group",
data,
@@ -5990,15 +5843,16 @@ class LFJsonPost(LFCliBase):
ClearPortCountersExtra.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+ClearPortCountersExtra.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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
+ 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'.
+ 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:
@@ -6007,10 +5861,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "extra" : extra,
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
+ "extra": extra,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/clear_port_counters",
data,
@@ -6024,8 +5878,8 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -6034,8 +5888,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/clear_resource_counters",
data,
@@ -6049,8 +5903,8 @@ class LFJsonPost(LFCliBase):
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.
+ endp_name=None, # Name of WanLink Endpoint.
+ wp_name=None, # Name of WanPath to clear.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6059,8 +5913,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp_name" : endp_name,
- "wp_name" : wp_name,
+ "endp_name": endp_name,
+ "wp_name": wp_name,
}
response = self.json_post("/cli-json/clear_wp_counters",
data,
@@ -6074,9 +5928,11 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -6085,9 +5941,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
- "password" : password,
- "super_user" : super_user,
+ "name": name,
+ "password": password,
+ "super_user": super_user,
}
response = self.json_post("/cli-json/create_client",
data,
@@ -6101,8 +5957,9 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -6111,8 +5968,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "arg1" : arg1,
- "type" : p_type,
+ "arg1": arg1,
+ "type": p_type,
}
response = self.json_post("/cli-json/diag",
data,
@@ -6126,9 +5983,9 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -6137,9 +5994,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "disconnect" : disconnect,
- "resource" : resource,
- "shelf" : shelf,
+ "disconnect": disconnect,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/discover",
data,
@@ -6153,8 +6010,8 @@ class LFJsonPost(LFCliBase):
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.
+ endp_name=None, # Name of Endpoint.
+ result_file_name=None, # The name of the file received by the endpoint.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6163,8 +6020,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp_name" : endp_name,
- "result_file_name" : result_file_name,
+ "endp_name": endp_name,
+ "result_file_name": result_file_name,
}
response = self.json_post("/cli-json/do_pesq",
data,
@@ -6178,10 +6035,10 @@ class LFJsonPost(LFCliBase):
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
+ 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:
@@ -6190,10 +6047,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "card" : card,
- "cmd" : cmd,
- "filename" : filename,
- "shelf" : shelf,
+ "card": card,
+ "cmd": cmd,
+ "filename": filename,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/file",
data,
@@ -6207,10 +6064,10 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -6219,10 +6076,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "filename" : filename,
- "resource" : resource,
- "serno" : serno,
- "shelf" : shelf,
+ "filename": filename,
+ "resource": resource,
+ "serno": serno,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/flash_attenuator",
data,
@@ -6236,8 +6093,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For AtoB, enter 'B', for BtoA, enter 'A'.
+ cx=None, # Cross-connect or Test-Group name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6246,8 +6103,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/getavglatency",
data,
@@ -6261,8 +6118,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
+ cx=None, # Cross-connect or Test-Group name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6271,8 +6128,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/getinrxbps",
data,
@@ -6286,8 +6143,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
+ cx=None, # Cross-connect or Test-Group name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6296,8 +6153,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/getinrxrate",
data,
@@ -6311,8 +6168,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
+ cx=None, # Cross-connect or Test-Group name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6321,8 +6178,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/getintxrate",
data,
@@ -6336,8 +6193,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
+ cx=None, # Cross-connect name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6346,8 +6203,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/getipadd",
data,
@@ -6361,8 +6218,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
+ cx=None, # Cross-connect name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6371,8 +6228,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/getmac",
data,
@@ -6386,8 +6243,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
+ cx=None, # Cross-connect name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6396,8 +6253,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/getmask",
data,
@@ -6411,8 +6268,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For AtoB, enter 'B', for BtoA, enter 'A'.
+ cx=None, # Cross-connect or Test-Group name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6421,8 +6278,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/getpktdrops",
data,
@@ -6436,8 +6293,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For AtoB, enter 'B', for BtoA, enter 'A'.
+ cx=None, # Cross-connect or Test-Group name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6446,8 +6303,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/getrxendperrpkts",
data,
@@ -6461,8 +6318,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
+ cx=None, # Cross-connect or Test-Group name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6471,8 +6328,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/getrxpkts",
data,
@@ -6486,8 +6343,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For AtoB, enter 'B', for BtoA, enter 'A'.
+ cx=None, # Cross-connect name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6496,8 +6353,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/getrxporterrpkts",
data,
@@ -6511,8 +6368,8 @@ class LFJsonPost(LFCliBase):
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
+ aorb=None, # For endpoint a, enter 'A', for endpoint b, enter 'B'.
+ cx=None, # Cross-connect or Test-Group name
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6521,8 +6378,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "aorb" : aorb,
- "cx" : cx,
+ "aorb": aorb,
+ "cx": cx,
}
response = self.json_post("/cli-json/gettxpkts",
data,
@@ -6536,7 +6393,8 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#gossip
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_gossip(self,
- message=None, # Message to show to others currently logged on. Unescaped Value
+ message=None, # Message to show to others currently logged on. Unescaped Value
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6545,7 +6403,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "message" : message,
+ "message": message,
}
response = self.json_post("/cli-json/gossip",
data,
@@ -6559,7 +6417,7 @@ class LFJsonPost(LFCliBase):
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.
+ command=None, # The command to get help for. Can be 'all', or blank.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6568,7 +6426,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "command" : command,
+ "command": command,
}
response = self.json_post("/cli-json/help",
data,
@@ -6582,10 +6440,12 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -6594,10 +6454,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "file_name" : file_name,
- "node_count" : node_count,
- "resource" : resource,
- "shelf" : shelf,
+ "file_name": file_name,
+ "node_count": node_count,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/init_wiser",
data,
@@ -6611,8 +6471,9 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -6621,8 +6482,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "popup" : popup,
- "show_file" : show_file,
+ "popup": popup,
+ "show_file": show_file,
}
response = self.json_post("/cli-json/licenses",
data,
@@ -6636,11 +6497,14 @@ class LFJsonPost(LFCliBase):
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)
+ 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:
@@ -6649,11 +6513,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "action" : action,
- "clean_chambers" : clean_chambers,
- "clean_dut" : clean_dut,
- "clean_profiles" : clean_profiles,
- "name" : name,
+ "action": action,
+ "clean_chambers": clean_chambers,
+ "clean_dut": clean_dut,
+ "clean_profiles": clean_profiles,
+ "name": name,
}
response = self.json_post("/cli-json/load",
data,
@@ -6669,78 +6533,65 @@ class LFJsonPost(LFCliBase):
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 = LogLevelLevel.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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)
+ 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)
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
LogLevelLevel.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+LogLevelLevel.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("LogLevelLevel has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("LogLevelLevel has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- LogLevelLevel.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+LogLevelLevel.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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].
+ target=None, # Options: 'gnu' | [file-endp-name].
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6749,8 +6600,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "level" : level,
- "target" : target,
+ "level": level,
+ "target": target,
}
response = self.json_post("/cli-json/log_level",
data,
@@ -6764,7 +6615,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#log_msg
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_log_msg(self,
- message=None, # Message to log. Unescaped Value
+ message=None, # Message to log. Unescaped Value
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6773,7 +6624,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "message" : message,
+ "message": message,
}
response = self.json_post("/cli-json/log_msg",
data,
@@ -6787,8 +6638,9 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -6797,8 +6649,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
- "password" : password,
+ "name": name,
+ "password": password,
}
response = self.json_post("/cli-json/login",
data,
@@ -6833,9 +6685,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -6844,9 +6696,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "collision_domain" : collision_domain,
- "resource" : resource,
- "shelf" : shelf,
+ "collision_domain": collision_domain,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/nc_show_cd",
data,
@@ -6860,9 +6712,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -6871,9 +6723,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "channel_name" : channel_name,
- "resource" : resource,
- "shelf" : shelf,
+ "channel_name": channel_name,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/nc_show_channel_groups",
data,
@@ -6887,8 +6739,8 @@ class LFJsonPost(LFCliBase):
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.
+ endpoint=None, # Name of endpoint, or 'all'.
+ extra=None, # See above.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6897,8 +6749,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endpoint" : endpoint,
- "extra" : extra,
+ "endpoint": endpoint,
+ "extra": extra,
}
response = self.json_post("/cli-json/nc_show_endpoints",
data,
@@ -6912,7 +6764,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#nc_show_pesq
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_nc_show_pesq(self,
- endpoint=None, # Name of endpoint, or 'all'.
+ endpoint=None, # Name of endpoint, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -6921,7 +6773,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endpoint" : endpoint,
+ "endpoint": endpoint,
}
response = self.json_post("/cli-json/nc_show_pesq",
data,
@@ -6937,70 +6789,58 @@ class LFJsonPost(LFCliBase):
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 = NcShowPortsProbeFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
NcShowPortsProbeFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+NcShowPortsProbeFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("NcShowPortsProbeFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("NcShowPortsProbeFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- NcShowPortsProbeFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+NcShowPortsProbeFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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'.
+ 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:
@@ -7009,10 +6849,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "port" : port,
- "probe_flags" : probe_flags,
- "resource" : resource,
- "shelf" : shelf,
+ "port": port,
+ "probe_flags": probe_flags,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/nc_show_ports",
data,
@@ -7026,9 +6866,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -7037,9 +6877,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "link_num" : link_num,
- "resource" : resource,
- "shelf" : shelf,
+ "link_num": link_num,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/nc_show_ppp_links",
data,
@@ -7053,9 +6893,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -7064,9 +6904,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
- "span_number" : span_number,
+ "resource": resource,
+ "shelf": shelf,
+ "span_number": span_number,
}
response = self.json_post("/cli-json/nc_show_spans",
data,
@@ -7080,9 +6920,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -7091,9 +6931,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "router" : router,
- "shelf" : shelf,
+ "resource": resource,
+ "router": router,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/nc_show_vr",
data,
@@ -7108,8 +6948,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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'.
+ resource=None, # Resource number, or 'all'.
+ shelf=None, # Name/id of the shelf, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7118,9 +6958,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cx_name" : cx_name,
- "resource" : resource,
- "shelf" : shelf,
+ "cx_name": cx_name,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/nc_show_vrcx",
data,
@@ -7134,15 +6974,15 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -7151,15 +6991,15 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cmd" : cmd,
- "netmask" : netmask,
- "new_dns" : new_dns,
- "new_ip" : new_ip,
- "new_ip6" : new_ip6,
- "new_mtu" : new_mtu,
- "new_router" : new_router,
- "port" : port,
- "reason" : reason,
+ "cmd": cmd,
+ "netmask": netmask,
+ "new_dns": new_dns,
+ "new_ip": new_ip,
+ "new_ip6": new_ip6,
+ "new_mtu": new_mtu,
+ "new_router": new_router,
+ "port": port,
+ "reason": reason,
}
response = self.json_post("/cli-json/notify_dhcp",
data,
@@ -7173,9 +7013,10 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#port_reset_completed
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_port_reset_completed(self,
- extra=None, # IP for SECIP, blank for others.
+ 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.
+ p_type=None, # SUNOS, NORMAL, or SECIP..let us know what kind of reset
+ # completed.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7184,9 +7025,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "extra" : extra,
- "port" : port,
- "type" : p_type,
+ "extra": extra,
+ "port": port,
+ "type": p_type,
}
response = self.json_post("/cli-json/port_reset_completed",
data,
@@ -7200,10 +7041,10 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#probe_port
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_probe_port(self,
- key=None, # Unique identifier for this request. Usually left blank.
- port=None, # Port number or name
- resource=None, # Resource number.
- shelf=None, # Shelf number.
+ key=None, # Unique identifier for this request. Usually left blank.
+ port=None, # Port number or name
+ resource=None, # Resource number.
+ shelf=None, # Shelf number.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7212,10 +7053,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "key" : key,
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
+ "key": key,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/probe_port",
data,
@@ -7229,8 +7070,8 @@ class LFJsonPost(LFCliBase):
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'.
+ resource=None, # Resource number, or 'all'.
+ shelf=None, # Name/id of the shelf, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7239,8 +7080,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/probe_ports",
data,
@@ -7254,7 +7095,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#quiesce_endp
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_quiesce_endp(self,
- endp_name=None, # Name of the endpoint, or 'all'.
+ endp_name=None, # Name of the endpoint, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7263,7 +7104,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp_name" : endp_name,
+ "endp_name": endp_name,
}
response = self.json_post("/cli-json/quiesce_endp",
data,
@@ -7277,7 +7118,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#quiesce_group
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_quiesce_group(self,
- name=None, # The name of the test group, or 'all'
+ name=None, # The name of the test group, or 'all'
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7286,7 +7127,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/quiesce_group",
data,
@@ -7321,8 +7162,8 @@ class LFJsonPost(LFCliBase):
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.
+ resource=None, # Resource number, or ALL.
+ shelf=None, # Shelf number, or ALL.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7331,8 +7172,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/reboot_os",
data,
@@ -7347,10 +7188,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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)
+ 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:
@@ -7359,11 +7200,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "reporting_on" : reporting_on,
- "rpt_dir" : rpt_dir,
- "save_endps" : save_endps,
- "save_ports" : save_ports,
- "save_resource" : save_resource,
+ "reporting_on": reporting_on,
+ "rpt_dir": rpt_dir,
+ "save_endps": save_endps,
+ "save_ports": save_ports,
+ "save_resource": save_resource,
}
response = self.json_post("/cli-json/report",
data,
@@ -7383,16 +7224,17 @@ class LFJsonPost(LFCliBase):
ResetPortPreIfdown.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+ResetPortPreIfdown.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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 ... --logout before going down.
+ 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 ... --logout 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.
+ 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:
@@ -7401,11 +7243,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "port" : port,
- "pre_ifdown" : pre_ifdown,
- "reset_ospf" : reset_ospf,
- "resource" : resource,
- "shelf" : shelf,
+ "port": port,
+ "pre_ifdown": pre_ifdown,
+ "reset_ospf": reset_ospf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/reset_port",
data,
@@ -7419,9 +7261,9 @@ class LFJsonPost(LFCliBase):
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.
+ resource=None, # Resource (machine) number.
+ shelf=None, # Shelf number
+ span=None, # Serial-Span number to reset.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7430,9 +7272,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
- "span" : span,
+ "resource": resource,
+ "shelf": shelf,
+ "span": span,
}
response = self.json_post("/cli-json/reset_serial_span",
data,
@@ -7446,9 +7288,9 @@ class LFJsonPost(LFCliBase):
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
+ resource=None, # Resource number
+ serno=None, # Serial number for requested Attenuator.
+ shelf=None, # Shelf number, usually 1
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7457,9 +7299,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "serno" : serno,
- "shelf" : shelf,
+ "resource": resource,
+ "serno": serno,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/rm_attenuator",
data,
@@ -7473,7 +7315,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_cd
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_cd(self,
- cd=None, # Name of Collision Domain.
+ cd=None, # Name of Collision Domain.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7482,7 +7324,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cd" : cd,
+ "cd": cd,
}
response = self.json_post("/cli-json/rm_cd",
data,
@@ -7496,8 +7338,8 @@ class LFJsonPost(LFCliBase):
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.
+ cd=None, # Name of Collision Domain.
+ endp=None, # Endpoint name/id.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7506,8 +7348,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cd" : cd,
- "endp" : endp,
+ "cd": cd,
+ "endp": endp,
}
response = self.json_post("/cli-json/rm_cd_endp",
data,
@@ -7521,8 +7363,8 @@ class LFJsonPost(LFCliBase):
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.
+ cd=None, # Name of Collision Domain.
+ endp=None, # Virtual-Router name/id.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7531,8 +7373,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cd" : cd,
- "endp" : endp,
+ "cd": cd,
+ "endp": endp,
}
response = self.json_post("/cli-json/rm_cd_vr",
data,
@@ -7546,7 +7388,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_chamber
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_chamber(self,
- chamber=None, # Chamber name, or 'ALL'
+ chamber=None, # Chamber name, or 'ALL'
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7555,7 +7397,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "chamber" : chamber,
+ "chamber": chamber,
}
response = self.json_post("/cli-json/rm_chamber",
data,
@@ -7569,8 +7411,8 @@ class LFJsonPost(LFCliBase):
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.
+ chamber=None, # Chamber Name.
+ path=None, # Path Name, use 'ALL' to delete all paths.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7579,8 +7421,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "chamber" : chamber,
- "path" : path,
+ "chamber": chamber,
+ "path": path,
}
response = self.json_post("/cli-json/rm_chamber_path",
data,
@@ -7594,9 +7436,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -7605,9 +7447,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "channel_name" : channel_name,
- "resource" : resource,
- "shelf" : shelf,
+ "channel_name": channel_name,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/rm_channel_group",
data,
@@ -7621,8 +7463,8 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -7631,8 +7473,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "client_name" : client_name,
- "client_password" : client_password,
+ "client_name": client_name,
+ "client_password": client_password,
}
response = self.json_post("/cli-json/rm_client",
data,
@@ -7647,7 +7489,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_cx(self,
cx_name=None, # Name of the cross-connect, or 'all'.
- test_mgr=None, # Name of test-mgr, or 'all'.
+ test_mgr=None, # Name of test-mgr, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7656,8 +7498,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cx_name" : cx_name,
- "test_mgr" : test_mgr,
+ "cx_name": cx_name,
+ "test_mgr": test_mgr,
}
response = self.json_post("/cli-json/rm_cx",
data,
@@ -7671,7 +7513,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_db
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_db(self,
- db_name=None, # Name of the database to delete.
+ db_name=None, # Name of the database to delete.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7680,7 +7522,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "db_name" : db_name,
+ "db_name": db_name,
}
response = self.json_post("/cli-json/rm_db",
data,
@@ -7694,7 +7536,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_dut
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_dut(self,
- shelf=None, # DUT name, or 'ALL'
+ shelf=None, # DUT name, or 'ALL'
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7703,7 +7545,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "shelf" : shelf,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/rm_dut",
data,
@@ -7717,7 +7559,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_endp
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_endp(self,
- endp_name=None, # Name of the endpoint, or 'YES_ALL'.
+ endp_name=None, # Name of the endpoint, or 'YES_ALL'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7726,7 +7568,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp_name" : endp_name,
+ "endp_name": endp_name,
}
response = self.json_post("/cli-json/rm_endp",
data,
@@ -7740,7 +7582,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_event
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_event(self,
- event_id=None, # Numeric event-id, or 'all'
+ event_id=None, # Numeric event-id, or 'all'
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7749,7 +7591,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "event_id" : event_id,
+ "event_id": event_id,
}
response = self.json_post("/cli-json/rm_event",
data,
@@ -7763,7 +7605,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_group
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_group(self,
- name=None, # The name of the test group.
+ name=None, # The name of the test group.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7772,7 +7614,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/rm_group",
data,
@@ -7786,9 +7628,9 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -7797,9 +7639,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
- "unit_num" : unit_num,
+ "resource": resource,
+ "shelf": shelf,
+ "unit_num": unit_num,
}
response = self.json_post("/cli-json/rm_ppp_link",
data,
@@ -7813,7 +7655,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_profile
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_profile(self,
- name=None, # Profile name, or 'ALL'
+ name=None, # Profile name, or 'ALL'
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7822,7 +7664,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/rm_profile",
data,
@@ -7836,8 +7678,8 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_resource
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_resource(self,
- resource=None, # Resource number.
- shelf=None, # Shelf number.
+ resource=None, # Resource number.
+ shelf=None, # Shelf number.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7846,8 +7688,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/rm_resource",
data,
@@ -7861,8 +7703,8 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_rfgen
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_rfgen(self,
- resource=None, # Resource number
- shelf=None, # Shelf number, usually 1
+ resource=None, # Resource number
+ shelf=None, # Shelf number, usually 1
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7871,8 +7713,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/rm_rfgen",
data,
@@ -7887,9 +7729,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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.
+ 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:
@@ -7898,10 +7740,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "ip_list" : ip_list,
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
+ "ip_list": ip_list,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/rm_sec_ip",
data,
@@ -7915,9 +7757,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -7926,9 +7768,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
- "span_num" : span_num,
+ "resource": resource,
+ "shelf": shelf,
+ "span_num": span_num,
}
response = self.json_post("/cli-json/rm_span",
data,
@@ -7942,7 +7784,7 @@ class LFJsonPost(LFCliBase):
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.
+ test_mgr=None, # Name of the test manager to be removed.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7951,7 +7793,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "test_mgr" : test_mgr,
+ "test_mgr": test_mgr,
}
response = self.json_post("/cli-json/rm_test_mgr",
data,
@@ -7965,8 +7807,8 @@ class LFJsonPost(LFCliBase):
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'
+ name=None, # Text Blob Name, or 'ALL'
+ p_type=None, # Text Blob type, or 'ALL'
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -7975,8 +7817,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
- "type" : p_type,
+ "name": name,
+ "type": p_type,
}
response = self.json_post("/cli-json/rm_text_blob",
data,
@@ -7990,8 +7832,8 @@ class LFJsonPost(LFCliBase):
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.
+ cxname=None, # The name of the CX.
+ tgname=None, # The name of the test group.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -8000,8 +7842,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cxname" : cxname,
- "tgname" : tgname,
+ "cxname": cxname,
+ "tgname": tgname,
}
response = self.json_post("/cli-json/rm_tgcx",
data,
@@ -8015,8 +7857,8 @@ class LFJsonPost(LFCliBase):
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.
+ endp=None, # Endpoint name or ID.
+ thresh_id=None, # Threshold ID to remove. Use 'all' to remove all.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -8025,8 +7867,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp" : endp,
- "thresh_id" : thresh_id,
+ "endp": endp,
+ "thresh_id": thresh_id,
}
response = self.json_post("/cli-json/rm_threshold",
data,
@@ -8040,7 +7882,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_traffic_profile
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_traffic_profile(self,
- name=None, # Profile name, or 'ALL'
+ name=None, # Profile name, or 'ALL'
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -8049,7 +7891,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/rm_traffic_profile",
data,
@@ -8063,8 +7905,8 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#rm_venue
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_rm_venue(self,
- resource=None, # Resource number, or 'ALL'
- shelf=None, # Shelf number.
+ 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -8074,9 +7916,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
- "venu_id" : venu_id,
+ "resource": resource,
+ "shelf": shelf,
+ "venu_id": venu_id,
}
response = self.json_post("/cli-json/rm_venue",
data,
@@ -8090,9 +7932,9 @@ class LFJsonPost(LFCliBase):
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.
+ port=None, # Port number or name of the virtual interface.
+ resource=None, # Resource number.
+ shelf=None, # Shelf number.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -8101,9 +7943,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/rm_vlan",
data,
@@ -8117,9 +7959,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -8128,9 +7970,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "router_name" : router_name,
- "shelf" : shelf,
+ "resource": resource,
+ "router_name": router_name,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/rm_vr",
data,
@@ -8144,11 +7986,13 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -8157,11 +8001,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "connection_name" : connection_name,
- "resource" : resource,
- "shelf" : shelf,
- "vr_id" : vr_id,
- "vrcx_only" : vrcx_only,
+ "connection_name": connection_name,
+ "resource": resource,
+ "shelf": shelf,
+ "vr_id": vr_id,
+ "vrcx_only": vrcx_only,
}
response = self.json_post("/cli-json/rm_vrcx",
data,
@@ -8175,8 +8019,8 @@ class LFJsonPost(LFCliBase):
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.
+ endp_name=None, # Name of the endpoint.
+ wp_name=None, # Name of the wanpath.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -8185,8 +8029,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp_name" : endp_name,
- "wp_name" : wp_name,
+ "endp_name": endp_name,
+ "wp_name": wp_name,
}
response = self.json_post("/cli-json/rm_wanpath",
data,
@@ -8200,13 +8044,13 @@ class LFJsonPost(LFCliBase):
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
+ 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:
@@ -8215,13 +8059,13 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp" : endp,
- "flags" : flags,
- "group_action" : group_action,
- "loop_count" : loop_count,
- "name" : name,
- "private" : private,
- "type" : p_type,
+ "endp": endp,
+ "flags": flags,
+ "group_action": group_action,
+ "loop_count": loop_count,
+ "name": name,
+ "private": private,
+ "type": p_type,
}
response = self.json_post("/cli-json/rpt_script",
data,
@@ -8241,16 +8085,16 @@ class LFJsonPost(LFCliBase):
ScanWifiExtra.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+ScanWifiExtra.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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
+ 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.
+ 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:
@@ -8259,11 +8103,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "extra" : extra,
- "key" : key,
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
+ "extra": extra,
+ "key": key,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/scan_wifi",
data,
@@ -8279,84 +8123,76 @@ class LFJsonPost(LFCliBase):
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 = SetArmInfoArmFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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!)
+ 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!)
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetArmInfoArmFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetArmInfoArmFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetArmInfoArmFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetArmInfoArmFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetArmInfoArmFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetArmInfoArmFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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.
+ 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:
@@ -8365,25 +8201,25 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "arm_flags" : arm_flags,
- "burst" : burst,
- "dst_mac" : dst_mac,
- "dst_mac_count" : dst_mac_count,
- "ip_dst_max" : ip_dst_max,
- "ip_dst_min" : ip_dst_min,
- "ip_src_max" : ip_src_max,
- "ip_src_min" : ip_src_min,
- "max_pkt_size" : max_pkt_size,
- "min_pkt_size" : min_pkt_size,
- "multi_pkts" : multi_pkts,
- "name" : name,
- "pkts_to_send" : pkts_to_send,
- "src_mac" : src_mac,
- "src_mac_count" : src_mac_count,
- "udp_dst_max" : udp_dst_max,
- "udp_dst_min" : udp_dst_min,
- "udp_src_max" : udp_src_max,
- "udp_src_min" : udp_src_min,
+ "arm_flags": arm_flags,
+ "burst": burst,
+ "dst_mac": dst_mac,
+ "dst_mac_count": dst_mac_count,
+ "ip_dst_max": ip_dst_max,
+ "ip_dst_min": ip_dst_min,
+ "ip_src_max": ip_src_max,
+ "ip_src_min": ip_src_min,
+ "max_pkt_size": max_pkt_size,
+ "min_pkt_size": min_pkt_size,
+ "multi_pkts": multi_pkts,
+ "name": name,
+ "pkts_to_send": pkts_to_send,
+ "src_mac": src_mac,
+ "src_mac_count": src_mac_count,
+ "udp_dst_max": udp_dst_max,
+ "udp_dst_min": udp_dst_min,
+ "udp_src_max": udp_src_max,
+ "udp_src_min": udp_src_min,
}
response = self.json_post("/cli-json/set_arm_info",
data,
@@ -8397,16 +8233,18 @@ class LFJsonPost(LFCliBase):
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).
+ 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:
@@ -8415,16 +8253,16 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "atten_idx" : atten_idx,
- "mode" : mode,
- "pulse_count" : pulse_count,
- "pulse_interval_ms" : pulse_interval_ms,
- "pulse_time_ms" : pulse_time_ms,
- "pulse_width_us5" : pulse_width_us5,
- "resource" : resource,
- "serno" : serno,
- "shelf" : shelf,
- "val" : val,
+ "atten_idx": atten_idx,
+ "mode": mode,
+ "pulse_count": pulse_count,
+ "pulse_interval_ms": pulse_interval_ms,
+ "pulse_time_ms": pulse_time_ms,
+ "pulse_width_us5": pulse_width_us5,
+ "resource": resource,
+ "serno": serno,
+ "shelf": shelf,
+ "val": val,
}
response = self.json_post("/cli-json/set_attenuator",
data,
@@ -8438,12 +8276,14 @@ class LFJsonPost(LFCliBase):
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
+ 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:
@@ -8452,12 +8292,12 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "chamber" : chamber,
- "cur_rotation" : cur_rotation,
- "position" : position,
- "speed_rpm" : speed_rpm,
- "tilt" : tilt,
- "turntable" : turntable,
+ "chamber": chamber,
+ "cur_rotation": cur_rotation,
+ "position": position,
+ "speed_rpm": speed_rpm,
+ "tilt": tilt,
+ "turntable": turntable,
}
response = self.json_post("/cli-json/set_chamber",
data,
@@ -8471,10 +8311,10 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -8483,10 +8323,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cx_name" : cx_name,
- "cxonly" : cxonly,
- "milliseconds" : milliseconds,
- "test_mgr" : test_mgr,
+ "cx_name": cx_name,
+ "cxonly": cxonly,
+ "milliseconds": milliseconds,
+ "test_mgr": test_mgr,
}
response = self.json_post("/cli-json/set_cx_report_timer",
data,
@@ -8506,16 +8346,16 @@ class LFJsonPost(LFCliBase):
SetCxStateCxState.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetCxStateCxState.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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.
+ 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'.
+ 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:
@@ -8524,9 +8364,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cx_name" : cx_name,
- "cx_state" : cx_state,
- "test_mgr" : test_mgr,
+ "cx_name": cx_name,
+ "cx_state": cx_state,
+ "test_mgr": test_mgr,
}
response = self.json_post("/cli-json/set_cx_state",
data,
@@ -8540,11 +8380,11 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -8553,11 +8393,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "ip" : ip,
- "mac" : mac,
- "max_port" : max_port,
- "min_port" : min_port,
- "name" : name,
+ "ip": ip,
+ "mac": mac,
+ "max_port": max_port,
+ "min_port": min_port,
+ "name": name,
}
response = self.json_post("/cli-json/set_endp_addr",
data,
@@ -8571,23 +8411,33 @@ class LFJsonPost(LFCliBase):
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
+ 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).
+ 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:
@@ -8596,23 +8446,23 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "conn_timeout" : conn_timeout,
- "dst_mac" : dst_mac,
- "max_conn_timer" : max_conn_timer,
- "max_ip_port" : max_ip_port,
- "max_reconn_pause" : max_reconn_pause,
- "mcast_src_ip" : mcast_src_ip,
- "mcast_src_port" : mcast_src_port,
- "min_conn_timer" : min_conn_timer,
- "min_reconn_pause" : min_reconn_pause,
- "name" : name,
- "pkts_to_send" : pkts_to_send,
- "rcvbuf_size" : rcvbuf_size,
- "sndbuf_size" : sndbuf_size,
- "tcp_delack_segs" : tcp_delack_segs,
- "tcp_max_delack" : tcp_max_delack,
- "tcp_min_delack" : tcp_min_delack,
- "tcp_mss" : tcp_mss,
+ "conn_timeout": conn_timeout,
+ "dst_mac": dst_mac,
+ "max_conn_timer": max_conn_timer,
+ "max_ip_port": max_ip_port,
+ "max_reconn_pause": max_reconn_pause,
+ "mcast_src_ip": mcast_src_ip,
+ "mcast_src_port": mcast_src_port,
+ "min_conn_timer": min_conn_timer,
+ "min_reconn_pause": min_reconn_pause,
+ "name": name,
+ "pkts_to_send": pkts_to_send,
+ "rcvbuf_size": rcvbuf_size,
+ "sndbuf_size": sndbuf_size,
+ "tcp_delack_segs": tcp_delack_segs,
+ "tcp_max_delack": tcp_max_delack,
+ "tcp_min_delack": tcp_min_delack,
+ "tcp_mss": tcp_mss,
}
response = self.json_post("/cli-json/set_endp_details",
data,
@@ -8626,9 +8476,9 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -8637,9 +8487,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "file" : file,
- "name" : name,
- "playback" : playback,
+ "file": file,
+ "name": name,
+ "playback": playback,
}
response = self.json_post("/cli-json/set_endp_file",
data,
@@ -8659,24 +8509,23 @@ class LFJsonPost(LFCliBase):
SetEndpFlagFlag.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetEndpFlagFlag.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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
+ 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.
+ 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:
@@ -8685,9 +8534,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "flag" : flag,
- "name" : name,
- "val" : val,
+ "flag": flag,
+ "name": name,
+ "val": val,
}
response = self.json_post("/cli-json/set_endp_flag",
data,
@@ -8707,22 +8556,23 @@ class LFJsonPost(LFCliBase):
SetEndpPayloadPayloadType.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetEndpPayloadPayloadType.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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).
+ 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. Unescaped Value
- payload_type=None, # The payload type. See help for add_endp.
+ name=None, # The name of the endpoint we are configuring.
+ payload=None, # For custom payloads, enter the payload in hex, up to 2048
+ # bytes. Unescaped Value
+ payload_type=None, # The payload type. See help for add_endp.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -8731,9 +8581,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
- "payload" : payload,
- "payload_type" : payload_type,
+ "name": name,
+ "payload": payload,
+ "payload_type": payload_type,
}
response = self.json_post("/cli-json/set_endp_payload",
data,
@@ -8747,11 +8597,11 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -8760,11 +8610,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "is_random" : is_random,
- "max_pld_size" : max_pld_size,
- "min_pld_size" : min_pld_size,
- "name" : name,
- "use_checksum" : use_checksum,
+ "is_random": is_random,
+ "max_pld_size": max_pld_size,
+ "min_pld_size": min_pld_size,
+ "name": name,
+ "use_checksum": use_checksum,
}
response = self.json_post("/cli-json/set_endp_pld_bounds",
data,
@@ -8778,10 +8628,10 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -8790,10 +8640,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "enabled" : enabled,
- "endp_name" : endp_name,
- "proxy_ip" : proxy_ip,
- "proxy_ip_port" : proxy_ip_port,
+ "enabled": enabled,
+ "endp_name": endp_name,
+ "proxy_ip": proxy_ip,
+ "proxy_ip_port": proxy_ip_port,
}
response = self.json_post("/cli-json/set_endp_proxy",
data,
@@ -8807,8 +8657,9 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -8817,8 +8668,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
- "quiesce" : quiesce,
+ "name": name,
+ "quiesce": quiesce,
}
response = self.json_post("/cli-json/set_endp_quiesce",
data,
@@ -8832,8 +8683,8 @@ class LFJsonPost(LFCliBase):
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.
+ endp_name=None, # Name of endpoint.
+ milliseconds=None, # Report timer length in milliseconds.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -8842,8 +8693,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp_name" : endp_name,
- "milliseconds" : milliseconds,
+ "endp_name": endp_name,
+ "milliseconds": milliseconds,
}
response = self.json_post("/cli-json/set_endp_report_timer",
data,
@@ -8863,15 +8714,15 @@ class LFJsonPost(LFCliBase):
SetEndpTosTos.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetEndpTosTos.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- LOWCOST = "LOWCOST"
- LOWDELAY = "LOWDELAY"
- RELIABILITY = "RELIABILITY"
- THROUGHPUT = "THROUGHPUT"
+ 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.
+ 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:
@@ -8880,9 +8731,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
- "priority" : priority,
- "tos" : tos,
+ "name": name,
+ "priority": priority,
+ "tos": tos,
}
response = self.json_post("/cli-json/set_endp_tos",
data,
@@ -8896,10 +8747,10 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -8908,10 +8759,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "is_bursty" : is_bursty,
- "max_tx_rate" : max_tx_rate,
- "min_tx_rate" : min_tx_rate,
- "name" : name,
+ "is_bursty": is_bursty,
+ "max_tx_rate": max_tx_rate,
+ "min_tx_rate": min_tx_rate,
+ "name": name,
}
response = self.json_post("/cli-json/set_endp_tx_bounds",
data,
@@ -8927,225 +8778,186 @@ class LFJsonPost(LFCliBase):
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 = SetEventInterestEiFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- CLEAR = 0x0 # will clear interest
- SET = 0x1 # set interest flag
+ CLEAR = 0x0 # will clear interest
+ SET = 0x1 # set interest flag
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetEventInterestEiFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetEventInterestEiFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetEventInterestEiFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetEventInterestEiFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetEventInterestEiFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetEventInterestEiFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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 = SetEventInterestEvents1.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetEventInterestEvents1.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetEventInterestEvents1.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetEventInterestEvents1 has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetEventInterestEvents1 has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetEventInterestEvents1.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetEventInterestEvents1.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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 = SetEventInterestEvents2.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetEventInterestEvents2.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetEventInterestEvents2.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetEventInterestEvents2 has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetEventInterestEvents2 has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetEventInterestEvents2.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetEventInterestEvents2.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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:
@@ -9154,13 +8966,13 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "ei_flags" : ei_flags,
- "event_cnt" : event_cnt,
- "events1" : events1,
- "events2" : events2,
- "events3" : events3,
- "events4" : events4,
- "var1" : var1,
+ "ei_flags": ei_flags,
+ "event_cnt": event_cnt,
+ "events1": events1,
+ "events2": events2,
+ "events3": events3,
+ "events4": events4,
+ "var1": var1,
}
response = self.json_post("/cli-json/set_event_interest",
data,
@@ -9180,28 +8992,28 @@ class LFJsonPost(LFCliBase):
SetEventPriorityEvent.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetEventPriorityEvent.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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.
+ 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -9209,16 +9021,16 @@ class LFJsonPost(LFCliBase):
SetEventPriorityPriority.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetEventPriorityPriority.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- AUTO = "AUTO" # Let event creator decide the priority.
- CRITICAL = "CRITICAL"
- DEBUG = "DEBUG"
- FATAL = "FATAL"
- INFO = "INFO"
- WARNING = "WARNING"
+ 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.
+ event=None, # Number or name for the event, see above.
+ priority=None, # Number or name for the priority.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -9227,8 +9039,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "event" : event,
- "priority" : priority,
+ "event": event,
+ "priority": priority,
}
response = self.json_post("/cli-json/set_event_priority",
data,
@@ -9242,16 +9054,17 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -9260,16 +9073,16 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "directory" : directory,
- "io_direction" : io_direction,
- "max_file_size" : max_file_size,
- "max_rw_sz" : max_rw_sz,
- "min_file_size" : min_file_size,
- "min_rw_sz" : min_rw_sz,
- "name" : name,
- "num_files" : num_files,
- "prefix" : prefix,
- "quiesce_after_files" : quiesce_after_files,
+ "directory": directory,
+ "io_direction": io_direction,
+ "max_file_size": max_file_size,
+ "max_rw_sz": max_rw_sz,
+ "min_file_size": min_file_size,
+ "min_rw_sz": min_rw_sz,
+ "name": name,
+ "num_files": num_files,
+ "prefix": prefix,
+ "quiesce_after_files": quiesce_after_files,
}
response = self.json_post("/cli-json/set_fe_info",
data,
@@ -9289,18 +9102,19 @@ class LFJsonPost(LFCliBase):
SetFlagFlag.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetFlagFlag.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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
+ 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).
-
+ 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:
@@ -9309,9 +9123,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "client" : client,
- "flag" : flag,
- "val" : val,
+ "client": client,
+ "flag": flag,
+ "val": val,
}
response = self.json_post("/cli-json/set_flag",
data,
@@ -9325,8 +9139,9 @@ class LFJsonPost(LFCliBase):
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. Unescaped Value
- name=None, # The name of the file endpoint we are configuring.
+ command=None, # The rest of the command line arguments. Unescaped Value
+ name=None, # The name of the file endpoint we are configuring.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -9335,8 +9150,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "command" : command,
- "name" : name,
+ "command": command,
+ "name": name,
}
response = self.json_post("/cli-json/set_gen_cmd",
data,
@@ -9351,12 +9166,12 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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).
+ 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.
+ shelf=None, # Shelf number for the port to be modified, or SELF.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -9365,13 +9180,13 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "altitude" : altitude,
- "ew" : ew,
- "lattitude" : lattitude,
- "longitude" : longitude,
- "ns" : ns,
- "resource" : resource,
- "shelf" : shelf,
+ "altitude": altitude,
+ "ew": ew,
+ "lattitude": lattitude,
+ "longitude": longitude,
+ "ns": ns,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/set_gps_info",
data,
@@ -9385,11 +9200,13 @@ class LFJsonPost(LFCliBase):
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. Unescaped Value
- resource=None, # Resource number.
- shelf=None, # Shelf number.
+ 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. Unescaped
+ # Value
+ resource=None, # Resource number.
+ shelf=None, # Shelf number.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -9398,11 +9215,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "flags" : flags,
- "port" : port,
- "post_ifup_script" : post_ifup_script,
- "resource" : resource,
- "shelf" : shelf,
+ "flags": flags,
+ "port": port,
+ "post_ifup_script": post_ifup_script,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/set_ifup_script",
data,
@@ -9416,7 +9233,8 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#set_license
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_set_license(self,
- licenses=None, # License keys all appended into a single line. Unescaped Value
+ licenses=None, # License keys all appended into a single line. Unescaped Value
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -9425,7 +9243,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "licenses" : licenses,
+ "licenses": licenses,
}
response = self.json_post("/cli-json/set_license",
data,
@@ -9439,11 +9257,11 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -9452,11 +9270,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "mcast_dest_port" : mcast_dest_port,
- "mcast_group" : mcast_group,
- "name" : name,
- "rcv_mcast" : rcv_mcast,
- "ttl" : ttl,
+ "mcast_dest_port": mcast_dest_port,
+ "mcast_group": mcast_group,
+ "name": name,
+ "rcv_mcast": rcv_mcast,
+ "ttl": ttl,
}
response = self.json_post("/cli-json/set_mc_endp",
data,
@@ -9470,9 +9288,9 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -9481,9 +9299,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "client" : client,
- "new_password" : new_password,
- "old_password" : old_password,
+ "client": client,
+ "new_password": new_password,
+ "old_password": old_password,
}
response = self.json_post("/cli-json/set_password",
data,
@@ -9497,7 +9315,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#set_poll_mode
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_set_poll_mode(self,
- mode=None, # 'polling' or 'push'.
+ mode=None, # 'polling' or 'push'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -9506,7 +9324,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "mode" : mode,
+ "mode": mode,
}
response = self.json_post("/cli-json/set_poll_mode",
data,
@@ -9522,158 +9340,132 @@ class LFJsonPost(LFCliBase):
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 = SetPortCmdFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetPortCmdFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetPortCmdFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetPortCmdFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetPortCmdFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetPortCmdFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetPortCmdFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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 = SetPortCurrentFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetPortCurrentFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetPortCurrentFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetPortCurrentFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetPortCurrentFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetPortCurrentFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetPortCurrentFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -9681,11 +9473,11 @@ class LFJsonPost(LFCliBase):
SetPortDhcpClientId.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetPortDhcpClientId.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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.
+ 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -9693,11 +9485,11 @@ class LFJsonPost(LFCliBase):
SetPortDhcpHostname.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetPortDhcpHostname.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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]'
+ 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -9705,195 +9497,184 @@ class LFJsonPost(LFCliBase):
SetPortDhcpVendorId.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetPortDhcpVendorId.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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.
+ 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 = SetPortFlags2.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetPortFlags2.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetPortFlags2.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetPortFlags2 has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetPortFlags2 has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetPortFlags2.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetPortFlags2.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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 = SetPortInterest.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetPortInterest.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetPortInterest.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetPortInterest has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetPortInterest has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetPortInterest.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetPortInterest.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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.
+ 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:
@@ -9902,43 +9683,43 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "br_aging_time" : br_aging_time,
- "br_forwarding_delay" : br_forwarding_delay,
- "br_hello_time" : br_hello_time,
- "br_max_age" : br_max_age,
- "br_port_cost" : br_port_cost,
- "br_port_priority" : br_port_priority,
- "br_priority" : br_priority,
- "bypass_wdt" : bypass_wdt,
- "cmd_flags" : cmd_flags,
- "cpu_mask" : cpu_mask,
- "current_flags" : current_flags,
- "current_flags_msk" : current_flags_msk,
- "dhcp_client_id" : dhcp_client_id,
- "dhcp_hostname" : dhcp_hostname,
- "dhcp_vendor_id" : dhcp_vendor_id,
- "dns_servers" : dns_servers,
- "flags2" : flags2,
- "gateway" : gateway,
- "interest" : interest,
- "ip_addr" : ip_addr,
- "ipsec_concentrator" : ipsec_concentrator,
- "ipsec_local_id" : ipsec_local_id,
- "ipsec_passwd" : ipsec_passwd,
- "ipsec_remote_id" : ipsec_remote_id,
- "ipv6_addr_global" : ipv6_addr_global,
- "ipv6_addr_link" : ipv6_addr_link,
- "ipv6_dflt_gw" : ipv6_dflt_gw,
- "mac" : mac,
- "mtu" : mtu,
- "netmask" : netmask,
- "port" : port,
- "report_timer" : report_timer,
- "resource" : resource,
- "shelf" : shelf,
- "sta_br_id" : sta_br_id,
- "tx_queue_len" : tx_queue_len,
+ "alias": alias,
+ "br_aging_time": br_aging_time,
+ "br_forwarding_delay": br_forwarding_delay,
+ "br_hello_time": br_hello_time,
+ "br_max_age": br_max_age,
+ "br_port_cost": br_port_cost,
+ "br_port_priority": br_port_priority,
+ "br_priority": br_priority,
+ "bypass_wdt": bypass_wdt,
+ "cmd_flags": cmd_flags,
+ "cpu_mask": cpu_mask,
+ "current_flags": current_flags,
+ "current_flags_msk": current_flags_msk,
+ "dhcp_client_id": dhcp_client_id,
+ "dhcp_hostname": dhcp_hostname,
+ "dhcp_vendor_id": dhcp_vendor_id,
+ "dns_servers": dns_servers,
+ "flags2": flags2,
+ "gateway": gateway,
+ "interest": interest,
+ "ip_addr": ip_addr,
+ "ipsec_concentrator": ipsec_concentrator,
+ "ipsec_local_id": ipsec_local_id,
+ "ipsec_passwd": ipsec_passwd,
+ "ipsec_remote_id": ipsec_remote_id,
+ "ipv6_addr_global": ipv6_addr_global,
+ "ipv6_addr_link": ipv6_addr_link,
+ "ipv6_dflt_gw": ipv6_dflt_gw,
+ "mac": mac,
+ "mtu": mtu,
+ "netmask": netmask,
+ "port": port,
+ "report_timer": report_timer,
+ "resource": resource,
+ "shelf": shelf,
+ "sta_br_id": sta_br_id,
+ "tx_queue_len": tx_queue_len,
}
response = self.json_post("/cli-json/set_port",
data,
@@ -9952,11 +9733,12 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -9965,11 +9747,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "alias" : alias,
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
- "vport" : vport,
+ "alias": alias,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
+ "vport": vport,
}
response = self.json_post("/cli-json/set_port_alias",
data,
@@ -9983,10 +9765,10 @@ class LFJsonPost(LFCliBase):
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.
+ 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'.
+ shelf=None, # Name of the Shelf, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -9995,10 +9777,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "link" : link,
- "ppp_state" : ppp_state,
- "resource" : resource,
- "shelf" : shelf,
+ "link": link,
+ "ppp_state": ppp_state,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/set_ppp_link_state",
data,
@@ -10018,20 +9800,25 @@ class LFJsonPost(LFCliBase):
SetResourceResourceFlags.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetResourceResourceFlags.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- skip_load_db_on_start = 1 # Should we skip loading the DB on start?
+ 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 all.
- 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 all.
- top_left_x=None, # X Location for Chamber View.
- top_left_y=None, # X Location for Chamber View.
+ 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 all.
+ 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 all.
+ top_left_x=None, # X Location for Chamber View.
+ top_left_y=None, # X Location for Chamber View.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -10040,17 +9827,17 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "device_profiles" : device_profiles,
- "max_helper_count" : max_helper_count,
- "max_staged_bringup" : max_staged_bringup,
- "max_station_bringup" : max_station_bringup,
- "max_trying_ifup" : max_trying_ifup,
- "resource" : resource,
- "resource_flags" : resource_flags,
- "resource_flags_mask" : resource_flags_mask,
- "shelf" : shelf,
- "top_left_x" : top_left_x,
- "top_left_y" : top_left_y,
+ "device_profiles": device_profiles,
+ "max_helper_count": max_helper_count,
+ "max_staged_bringup": max_staged_bringup,
+ "max_station_bringup": max_station_bringup,
+ "max_trying_ifup": max_trying_ifup,
+ "resource": resource,
+ "resource_flags": resource_flags,
+ "resource_flags_mask": resource_flags_mask,
+ "shelf": shelf,
+ "top_left_x": top_left_x,
+ "top_left_y": top_left_y,
}
response = self.json_post("/cli-json/set_resource",
data,
@@ -10066,74 +9853,61 @@ class LFJsonPost(LFCliBase):
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 = SetRfgenRfgenFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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?
+ 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?
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetRfgenRfgenFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetRfgenRfgenFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetRfgenRfgenFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetRfgenRfgenFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetRfgenRfgenFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetRfgenRfgenFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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
- 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.
+ 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
+ shelf=None, # Shelf number, usually 1.
+ sweep_time_ms=None, # Time interval between pulse groups in miliseconds
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -10142,19 +9916,19 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "bb_gain" : bb_gain,
- "freq_khz" : freq_khz,
- "gain" : gain,
- "id" : id,
- "if_gain" : if_gain,
- "pulse_count" : pulse_count,
- "pulse_interval_us" : pulse_interval_us,
- "pulse_width_us" : pulse_width_us,
- "resource" : resource,
- "rfgen_flags" : rfgen_flags,
- "rfgen_flags_mask" : rfgen_flags_mask,
- "shelf" : shelf,
- "sweep_time_ms" : sweep_time_ms,
+ "bb_gain": bb_gain,
+ "freq_khz": freq_khz,
+ "gain": gain,
+ "id": p_id,
+ "if_gain": if_gain,
+ "pulse_count": pulse_count,
+ "pulse_interval_us": pulse_interval_us,
+ "pulse_width_us": pulse_width_us,
+ "resource": resource,
+ "rfgen_flags": rfgen_flags,
+ "rfgen_flags_mask": rfgen_flags_mask,
+ "shelf": shelf,
+ "sweep_time_ms": sweep_time_ms,
}
response = self.json_post("/cli-json/set_rfgen",
data,
@@ -10170,75 +9944,63 @@ class LFJsonPost(LFCliBase):
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 = SetScriptFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetScriptFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetScriptFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetScriptFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetScriptFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetScriptFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetScriptFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -10246,20 +10008,20 @@ class LFJsonPost(LFCliBase):
SetScriptType.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetScriptType.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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
+ 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
+ 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:
@@ -10268,13 +10030,13 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp" : endp,
- "flags" : flags,
- "group_action" : group_action,
- "loop_count" : loop_count,
- "name" : name,
- "private" : private,
- "type" : p_type,
+ "endp": endp,
+ "flags": flags,
+ "group_action": group_action,
+ "loop_count": loop_count,
+ "name": name,
+ "private": private,
+ "type": p_type,
}
response = self.json_post("/cli-json/set_script",
data,
@@ -10289,9 +10051,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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.
+ 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:
@@ -10300,10 +10062,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "ip_list" : ip_list,
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
+ "ip_list": ip_list,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/set_sec_ip",
data,
@@ -10317,24 +10079,28 @@ class LFJsonPost(LFCliBase):
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.
+ 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_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).
+ 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:
@@ -10343,24 +10109,24 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "codec" : codec,
- "first_call_delay" : first_call_delay,
- "jitter_buffer_sz" : jitter_buffer_sz,
- "local_sip_port" : local_sip_port,
- "loop_call_count" : loop_call_count,
- "loop_wavefile_count" : loop_wavefile_count,
- "max_call_duration" : max_call_duration,
- "max_inter_call_gap" : max_inter_call_gap,
- "messaging_protocol" : messaging_protocol,
- "min_call_duration" : min_call_duration,
- "min_inter_call_gap" : min_inter_call_gap,
- "name" : name,
- "pesq_server_ip" : pesq_server_ip,
- "pesq_server_passwd" : pesq_server_passwd,
- "pesq_server_port" : pesq_server_port,
- "reg_expire_timer" : reg_expire_timer,
- "ringing_timer" : ringing_timer,
- "sound_dev" : sound_dev,
+ "codec": codec,
+ "first_call_delay": first_call_delay,
+ "jitter_buffer_sz": jitter_buffer_sz,
+ "local_sip_port": local_sip_port,
+ "loop_call_count": loop_call_count,
+ "loop_wavefile_count": loop_wavefile_count,
+ "max_call_duration": max_call_duration,
+ "max_inter_call_gap": max_inter_call_gap,
+ "messaging_protocol": messaging_protocol,
+ "min_call_duration": min_call_duration,
+ "min_inter_call_gap": min_inter_call_gap,
+ "name": name,
+ "pesq_server_ip": pesq_server_ip,
+ "pesq_server_passwd": pesq_server_passwd,
+ "pesq_server_port": pesq_server_port,
+ "reg_expire_timer": reg_expire_timer,
+ "ringing_timer": ringing_timer,
+ "sound_dev": sound_dev,
}
response = self.json_post("/cli-json/set_voip_info",
data,
@@ -10374,15 +10140,16 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -10391,15 +10158,15 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "interface_cost" : interface_cost,
- "local_dev" : local_dev,
- "local_dev_b" : local_dev_b,
- "remote_dev" : remote_dev,
- "remote_dev_b" : remote_dev_b,
- "resource" : resource,
- "shelf" : shelf,
- "vr_name" : vr_name,
- "wanlink" : wanlink,
+ "interface_cost": interface_cost,
+ "local_dev": local_dev,
+ "local_dev_b": local_dev_b,
+ "remote_dev": remote_dev,
+ "remote_dev_b": remote_dev_b,
+ "resource": resource,
+ "shelf": shelf,
+ "vr_name": vr_name,
+ "wanlink": wanlink,
}
response = self.json_post("/cli-json/set_vrcx_cost",
data,
@@ -10413,21 +10180,32 @@ class LFJsonPost(LFCliBase):
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).
+ 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:
@@ -10436,21 +10214,21 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "drop_freq" : drop_freq,
- "dup_freq" : dup_freq,
- "extra_buffer" : extra_buffer,
- "jitter_freq" : jitter_freq,
- "latency" : latency,
- "max_drop_amt" : max_drop_amt,
- "max_jitter" : max_jitter,
- "max_lateness" : max_lateness,
- "max_reorder_amt" : max_reorder_amt,
- "min_drop_amt" : min_drop_amt,
- "min_reorder_amt" : min_reorder_amt,
- "name" : name,
- "playback_capture_file" : playback_capture_file,
- "reorder_freq" : reorder_freq,
- "speed" : speed,
+ "drop_freq": drop_freq,
+ "dup_freq": dup_freq,
+ "extra_buffer": extra_buffer,
+ "jitter_freq": jitter_freq,
+ "latency": latency,
+ "max_drop_amt": max_drop_amt,
+ "max_jitter": max_jitter,
+ "max_lateness": max_lateness,
+ "max_reorder_amt": max_reorder_amt,
+ "min_drop_amt": min_drop_amt,
+ "min_reorder_amt": min_reorder_amt,
+ "name": name,
+ "playback_capture_file": playback_capture_file,
+ "reorder_freq": reorder_freq,
+ "speed": speed,
}
response = self.json_post("/cli-json/set_wanlink_info",
data,
@@ -10464,9 +10242,10 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -10475,9 +10254,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "capture" : capture,
- "directory" : directory,
- "name" : name,
+ "capture": capture,
+ "directory": directory,
+ "name": name,
}
response = self.json_post("/cli-json/set_wanlink_pcap",
data,
@@ -10493,73 +10272,63 @@ class LFJsonPost(LFCliBase):
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 = SetWanpathCorruptionFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetWanpathCorruptionFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetWanpathCorruptionFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetWanpathCorruptionFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetWanpathCorruptionFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetWanpathCorruptionFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetWanpathCorruptionFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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:
@@ -10568,14 +10337,14 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "byte" : byte,
- "flags" : flags,
- "index" : index,
- "max_offset" : max_offset,
- "min_offset" : min_offset,
- "name" : name,
- "path" : path,
- "rate" : rate,
+ "byte": byte,
+ "flags": flags,
+ "index": index,
+ "max_offset": max_offset,
+ "min_offset": min_offset,
+ "name": name,
+ "path": path,
+ "rate": rate,
}
response = self.json_post("/cli-json/set_wanpath_corruption",
data,
@@ -10589,14 +10358,16 @@ class LFJsonPost(LFCliBase):
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.
+ 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.
+ 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:
@@ -10605,14 +10376,14 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "defer_flush" : defer_flush,
- "dst_filter" : dst_filter,
- "filter_type" : filter_type,
- "passive" : passive,
- "reverse" : reverse,
- "src_filter" : src_filter,
- "wl_name" : wl_name,
- "wp_name" : wp_name,
+ "defer_flush": defer_flush,
+ "dst_filter": dst_filter,
+ "filter_type": filter_type,
+ "passive": passive,
+ "reverse": reverse,
+ "src_filter": src_filter,
+ "wl_name": wl_name,
+ "wp_name": wp_name,
}
response = self.json_post("/cli-json/set_wanpath_filter",
data,
@@ -10632,14 +10403,14 @@ class LFJsonPost(LFCliBase):
SetWanpathRunningRunning.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetWanpathRunningRunning.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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.
+ 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.
+ 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:
@@ -10648,9 +10419,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "running" : running,
- "wl_name" : wl_name,
- "wp_name" : wp_name,
+ "running": running,
+ "wl_name": wl_name,
+ "wp_name": wp_name,
}
response = self.json_post("/cli-json/set_wanpath_running",
data,
@@ -10666,86 +10437,78 @@ class LFJsonPost(LFCliBase):
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 = SetWifiCorruptionsCorruptFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetWifiCorruptionsCorruptFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetWifiCorruptionsCorruptFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetWifiCorruptionsCorruptFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetWifiCorruptionsCorruptFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetWifiCorruptionsCorruptFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetWifiCorruptionsCorruptFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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:
@@ -10754,19 +10517,19 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "corrupt_flags" : corrupt_flags,
- "corrupt_per_mil" : corrupt_per_mil,
- "delay_flags" : delay_flags,
- "delay_max" : delay_max,
- "delay_min" : delay_min,
- "dup_flags" : dup_flags,
- "dup_per_65535" : dup_per_65535,
- "ignore_flags" : ignore_flags,
- "ignore_per_mil" : ignore_per_mil,
- "port" : port,
- "req_flush" : req_flush,
- "resource" : resource,
- "shelf" : shelf,
+ "corrupt_flags": corrupt_flags,
+ "corrupt_per_mil": corrupt_per_mil,
+ "delay_flags": delay_flags,
+ "delay_max": delay_max,
+ "delay_min": delay_min,
+ "dup_flags": dup_flags,
+ "dup_per_65535": dup_per_65535,
+ "ignore_flags": ignore_flags,
+ "ignore_per_mil": ignore_per_mil,
+ "port": port,
+ "req_flush": req_flush,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/set_wifi_corruptions",
data,
@@ -10780,11 +10543,12 @@ class LFJsonPost(LFCliBase):
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. Unescaped Value
- p_type=None, # NA for now, may specify specific locations later.
+ 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. Unescaped Value
+ p_type=None, # NA for now, may specify specific locations later.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -10793,11 +10557,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
- "text" : text,
- "type" : p_type,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
+ "text": text,
+ "type": p_type,
}
response = self.json_post("/cli-json/set_wifi_custom",
data,
@@ -10811,38 +10575,48 @@ class LFJsonPost(LFCliBase):
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
+ 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
+ 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.
+ 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:
@@ -10851,38 +10625,38 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "anonymous_identity" : anonymous_identity,
- "anqp_3gpp_cell_net" : anqp_3gpp_cell_net,
- "ca_cert" : ca_cert,
- "client_cert" : client_cert,
- "domain" : domain,
- "eap" : eap,
- "group" : group,
- "hessid" : hessid,
- "identity" : identity,
- "imsi" : imsi,
- "ipaddr_type_avail" : ipaddr_type_avail,
- "key" : key,
- "key_mgmt" : key_mgmt,
- "milenage" : milenage,
- "network_auth_type" : network_auth_type,
- "network_type" : network_type,
- "pac_file" : pac_file,
- "pairwise" : pairwise,
- "password" : password,
- "phase1" : phase1,
- "phase2" : phase2,
- "pin" : pin,
- "pk_passwd" : pk_passwd,
- "port" : port,
- "private_key" : private_key,
- "psk" : psk,
- "realm" : realm,
- "resource" : resource,
- "roaming_consortium" : roaming_consortium,
- "shelf" : shelf,
- "venue_group" : venue_group,
- "venue_type" : venue_type,
+ "anonymous_identity": anonymous_identity,
+ "anqp_3gpp_cell_net": anqp_3gpp_cell_net,
+ "ca_cert": ca_cert,
+ "client_cert": client_cert,
+ "domain": domain,
+ "eap": eap,
+ "group": group,
+ "hessid": hessid,
+ "identity": identity,
+ "imsi": imsi,
+ "ipaddr_type_avail": ipaddr_type_avail,
+ "key": key,
+ "key_mgmt": key_mgmt,
+ "milenage": milenage,
+ "network_auth_type": network_auth_type,
+ "network_type": network_type,
+ "pac_file": pac_file,
+ "pairwise": pairwise,
+ "password": password,
+ "phase1": phase1,
+ "phase2": phase2,
+ "pin": pin,
+ "pk_passwd": pk_passwd,
+ "port": port,
+ "private_key": private_key,
+ "psk": psk,
+ "realm": realm,
+ "resource": resource,
+ "roaming_consortium": roaming_consortium,
+ "shelf": shelf,
+ "venue_group": venue_group,
+ "venue_type": venue_type,
}
response = self.json_post("/cli-json/set_wifi_extra",
data,
@@ -10896,23 +10670,27 @@ class LFJsonPost(LFCliBase):
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.
- shelf=None, # Shelf number.
- venue_id=None, # Venue-ID for this wifi device. VAP in same venue will share neigh reports as appropriate.
+ 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:
@@ -10921,22 +10699,23 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "corrupt_gtk_rekey_mic" : corrupt_gtk_rekey_mic,
- "freq_24" : freq_24,
- "freq_5" : freq_5,
- "ignore_assoc" : ignore_assoc,
- "ignore_auth" : ignore_auth,
- "ignore_probe" : ignore_probe,
- "ignore_reassoc" : ignore_reassoc,
- "ocsp" : ocsp,
- "port" : port,
- "post_ifup_script" : post_ifup_script,
- "radius_ip" : radius_ip,
- "radius_port" : radius_port,
- "req_flush" : req_flush,
- "resource" : resource,
- "shelf" : shelf,
- "venue_id" : venue_id,
+ "corrupt_gtk_rekey_mic": corrupt_gtk_rekey_mic,
+ "freq_24": freq_24,
+ "freq_5": freq_5,
+ "ignore_assoc": ignore_assoc,
+ "ignore_auth": ignore_auth,
+ "ignore_probe": ignore_probe,
+ "ignore_reassoc": ignore_reassoc,
+ "ocsp": ocsp,
+ "port": port,
+ "post_ifup_script": post_ifup_script,
+ "radius_ip": radius_ip,
+ "radius_port": radius_port,
+ "req_flush": req_flush,
+ "resource": resource,
+ "sae_pwe": sae_pwe,
+ "shelf": shelf,
+ "venue_id": venue_id,
}
response = self.json_post("/cli-json/set_wifi_extra2",
data,
@@ -10952,65 +10731,54 @@ class LFJsonPost(LFCliBase):
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 = SetWifiRadioFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetWifiRadioFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetWifiRadioFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetWifiRadioFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetWifiRadioFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetWifiRadioFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetWifiRadioFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -11018,57 +10786,68 @@ class LFJsonPost(LFCliBase):
SetWifiRadioMode.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetWifiRadioMode.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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
+ 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. 0xFFFF, AUTO or DEFAULT 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. 0xFFFF, AUTO or DEFAULT 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.
+ 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.
+ # 0xFFFF, AUTO or DEFAULT 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. 0xFFFF, AUTO or DEFAULT
+ # 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:
@@ -11077,39 +10856,39 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "active_peer_count" : active_peer_count,
- "ampdu_factor" : ampdu_factor,
- "antenna" : antenna,
- "channel" : channel,
- "const_tx" : const_tx,
- "country" : country,
- "flags" : flags,
- "flags_mask" : flags_mask,
- "frag_thresh" : frag_thresh,
- "frequency" : frequency,
- "fwname" : fwname,
- "fwver" : fwver,
- "mac" : mac,
- "max_amsdu" : max_amsdu,
- "mode" : mode,
- "peer_count" : peer_count,
- "pref_ap" : pref_ap,
- "pulse2_interval_us" : pulse2_interval_us,
- "pulse_interval" : pulse_interval,
- "pulse_width" : pulse_width,
- "radio" : radio,
- "rate" : rate,
- "rate_ctrl_count" : rate_ctrl_count,
- "resource" : resource,
- "rts" : rts,
- "shelf" : shelf,
- "skid_limit" : skid_limit,
- "stations_count" : stations_count,
- "tids_count" : tids_count,
- "tx_pulses" : tx_pulses,
- "txdesc_count" : txdesc_count,
- "txpower" : txpower,
- "vdev_count" : vdev_count,
+ "active_peer_count": active_peer_count,
+ "ampdu_factor": ampdu_factor,
+ "antenna": antenna,
+ "channel": channel,
+ "const_tx": const_tx,
+ "country": country,
+ "flags": flags,
+ "flags_mask": flags_mask,
+ "frag_thresh": frag_thresh,
+ "frequency": frequency,
+ "fwname": fwname,
+ "fwver": fwver,
+ "mac": mac,
+ "max_amsdu": max_amsdu,
+ "mode": mode,
+ "peer_count": peer_count,
+ "pref_ap": pref_ap,
+ "pulse2_interval_us": pulse2_interval_us,
+ "pulse_interval": pulse_interval,
+ "pulse_width": pulse_width,
+ "radio": radio,
+ "rate": rate,
+ "rate_ctrl_count": rate_ctrl_count,
+ "resource": resource,
+ "rts": rts,
+ "shelf": shelf,
+ "skid_limit": skid_limit,
+ "stations_count": stations_count,
+ "tids_count": tids_count,
+ "tx_pulses": tx_pulses,
+ "txdesc_count": txdesc_count,
+ "txpower": txpower,
+ "vdev_count": vdev_count,
}
response = self.json_post("/cli-json/set_wifi_radio",
data,
@@ -11123,17 +10902,20 @@ class LFJsonPost(LFCliBase):
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.
+ 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.
+ 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:
@@ -11142,17 +10924,17 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
- "txo_bw" : txo_bw,
- "txo_enable" : txo_enable,
- "txo_mcs" : txo_mcs,
- "txo_nss" : txo_nss,
- "txo_pream" : txo_pream,
- "txo_retries" : txo_retries,
- "txo_sgi" : txo_sgi,
- "txo_txpower" : txo_txpower,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
+ "txo_bw": txo_bw,
+ "txo_enable": txo_enable,
+ "txo_mcs": txo_mcs,
+ "txo_nss": txo_nss,
+ "txo_pream": txo_pream,
+ "txo_retries": txo_retries,
+ "txo_sgi": txo_sgi,
+ "txo_txpower": txo_txpower,
}
response = self.json_post("/cli-json/set_wifi_txo",
data,
@@ -11168,72 +10950,62 @@ class LFJsonPost(LFCliBase):
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 = SetWlCorruptionFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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.
+ 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.
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SetWlCorruptionFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SetWlCorruptionFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SetWlCorruptionFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SetWlCorruptionFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SetWlCorruptionFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SetWlCorruptionFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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:
@@ -11242,13 +11014,13 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "byte" : byte,
- "flags" : flags,
- "index" : index,
- "max_offset" : max_offset,
- "min_offset" : min_offset,
- "name" : name,
- "rate" : rate,
+ "byte": byte,
+ "flags": flags,
+ "index": index,
+ "max_offset": max_offset,
+ "min_offset": min_offset,
+ "name": name,
+ "rate": rate,
}
response = self.json_post("/cli-json/set_wl_corruption",
data,
@@ -11268,12 +11040,12 @@ class LFJsonPost(LFCliBase):
SetWlQdiscQdisc.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+SetWlQdiscQdisc.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- FIFO = "FIFO" # is the default queuing discipline, no arguments
- WRR__queue_queue_____ = "WRR,[queue,queue,...]" # Weighted Round Robbin is also available
+ 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
+ qdisc=None, # FIFO, WRR,a,b,c,d,e,f,g etc
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11282,8 +11054,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
- "qdisc" : qdisc,
+ "name": name,
+ "qdisc": qdisc,
}
response = self.json_post("/cli-json/set_wl_qdisc",
data,
@@ -11303,26 +11075,26 @@ class LFJsonPost(LFCliBase):
ShowAlertsType.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+ShowAlertsType.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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"
+ 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.
+ 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.
+ shelf=None, # Alert shelf filter.
+ p_type=None, # Alert type filter.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11331,12 +11103,12 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "card" : card,
- "endp" : endp,
- "extra" : extra,
- "port" : port,
- "shelf" : shelf,
- "type" : p_type,
+ "card": card,
+ "endp": endp,
+ "extra": extra,
+ "port": port,
+ "shelf": shelf,
+ "type": p_type,
}
response = self.json_post("/cli-json/show_alerts",
data,
@@ -11350,9 +11122,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -11361,9 +11133,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "serno" : serno,
- "shelf" : shelf,
+ "resource": resource,
+ "serno": serno,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/show_attenuators",
data,
@@ -11377,9 +11149,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -11388,9 +11160,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "collision_domain" : collision_domain,
- "resource" : resource,
- "shelf" : shelf,
+ "collision_domain": collision_domain,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/show_cd",
data,
@@ -11404,7 +11176,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#show_chamber
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_show_chamber(self,
- name=None, # Chamber Name or 'ALL'.
+ name=None, # Chamber Name or 'ALL'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11413,7 +11185,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/show_chamber",
data,
@@ -11427,9 +11199,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -11438,9 +11210,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "channel_name" : channel_name,
- "resource" : resource,
- "shelf" : shelf,
+ "channel_name": channel_name,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/show_channel_groups",
data,
@@ -11475,8 +11247,8 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -11485,8 +11257,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cross_connect" : cross_connect,
- "test_mgr" : test_mgr,
+ "cross_connect": cross_connect,
+ "test_mgr": test_mgr,
}
response = self.json_post("/cli-json/show_cx",
data,
@@ -11500,8 +11272,8 @@ class LFJsonPost(LFCliBase):
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'.
+ cross_connect=None, # Specify cross-connect to show, or 'all'.
+ test_mgr=None, # Specify test-mgr to use, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11510,8 +11282,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cross_connect" : cross_connect,
- "test_mgr" : test_mgr,
+ "cross_connect": cross_connect,
+ "test_mgr": test_mgr,
}
response = self.json_post("/cli-json/show_cxe",
data,
@@ -11546,7 +11318,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#show_dut
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_show_dut(self,
- name=None, # DUT Name or 'ALL'.
+ name=None, # DUT Name or 'ALL'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11555,7 +11327,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/show_dut",
data,
@@ -11569,8 +11341,8 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -11579,8 +11351,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "max_bytes" : max_bytes,
- "name" : name,
+ "max_bytes": max_bytes,
+ "name": name,
}
response = self.json_post("/cli-json/show_endp_payload",
data,
@@ -11594,8 +11366,8 @@ class LFJsonPost(LFCliBase):
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.
+ endpoint=None, # Name of endpoint, or 'all'.
+ extra=None, # See above.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11604,8 +11376,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endpoint" : endpoint,
- "extra" : extra,
+ "endpoint": endpoint,
+ "extra": extra,
}
response = self.json_post("/cli-json/show_endpoints",
data,
@@ -11619,7 +11391,8 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#show_err
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_show_err(self,
- message=None, # Message to show to others currently logged on. Unescaped Value
+ message=None, # Message to show to others currently logged on. Unescaped Value
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11628,7 +11401,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "message" : message,
+ "message": message,
}
response = self.json_post("/cli-json/show_err",
data,
@@ -11669,26 +11442,26 @@ class LFJsonPost(LFCliBase):
ShowEventsType.clear_flags(['bridge', 'dhcp'])
print( 'value now: '+ShowEventsType.value())
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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"
+ 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.
+ 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.
+ shelf=None, # Event shelf filter.
+ p_type=None, # Event type filter.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11697,12 +11470,12 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "card" : card,
- "endp" : endp,
- "extra" : extra,
- "port" : port,
- "shelf" : shelf,
- "type" : p_type,
+ "card": card,
+ "endp": endp,
+ "extra": extra,
+ "port": port,
+ "shelf": shelf,
+ "type": p_type,
}
response = self.json_post("/cli-json/show_events",
data,
@@ -11716,12 +11489,12 @@ class LFJsonPost(LFCliBase):
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.
- filter=None, # An optional filter, as used by the 'ls' command.
- key=None, # A special key, can be used for scripting.
+ 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.
+ shelf=None, # The virtual shelf to search in. Use 0 for manager machine.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11730,12 +11503,12 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "dir_flags" : dir_flags,
- "directory" : directory,
- "filter" : filter,
- "key" : key,
- "resource" : resource,
- "shelf" : shelf,
+ "dir_flags": dir_flags,
+ "directory": directory,
+ "filter": p_filter,
+ "key": key,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/show_files",
data,
@@ -11749,7 +11522,7 @@ class LFJsonPost(LFCliBase):
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.
+ group=None, # Can be name of test group. Use 'all' or leave blank for all groups.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11758,7 +11531,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "group" : group,
+ "group": group,
}
response = self.json_post("/cli-json/show_group",
data,
@@ -11772,7 +11545,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#show_pesq
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_show_pesq(self,
- endpoint=None, # Name of endpoint, or 'all'.
+ endpoint=None, # Name of endpoint, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11781,7 +11554,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endpoint" : endpoint,
+ "endpoint": endpoint,
}
response = self.json_post("/cli-json/show_pesq",
data,
@@ -11795,10 +11568,11 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -11807,10 +11581,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "port" : port,
- "probe_flags" : probe_flags,
- "resource" : resource,
- "shelf" : shelf,
+ "port": port,
+ "probe_flags": probe_flags,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/show_ports",
data,
@@ -11824,9 +11598,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -11835,9 +11609,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "link_num" : link_num,
- "resource" : resource,
- "shelf" : shelf,
+ "link_num": link_num,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/show_ppp_links",
data,
@@ -11851,7 +11625,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#show_profile
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_show_profile(self,
- name=None, # Profile Name or 'ALL'.
+ name=None, # Profile Name or 'ALL'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11860,7 +11634,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/show_profile",
data,
@@ -11874,8 +11648,8 @@ class LFJsonPost(LFCliBase):
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'.
+ resource=None, # Resource number, or 'all'.
+ shelf=None, # Shelf number or alias, can be 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11884,8 +11658,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/show_resources",
data,
@@ -11899,8 +11673,8 @@ class LFJsonPost(LFCliBase):
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'.
+ resource=None, # Resource number, or 'all'.
+ shelf=None, # Shelf number or alias, can be 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -11909,8 +11683,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/show_rfgen",
data,
@@ -11924,10 +11698,10 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -11936,10 +11710,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "key" : key,
- "resource" : resource,
- "shelf" : shelf,
- "virtual_router" : virtual_router,
+ "key": key,
+ "resource": resource,
+ "shelf": shelf,
+ "virtual_router": virtual_router,
}
response = self.json_post("/cli-json/show_rt",
data,
@@ -11953,8 +11727,8 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -11963,8 +11737,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endpoint" : endpoint,
- "key" : key,
+ "endpoint": endpoint,
+ "key": key,
}
response = self.json_post("/cli-json/show_script_results",
data,
@@ -11978,9 +11752,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -11989,9 +11763,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
- "span_number" : span_number,
+ "resource": resource,
+ "shelf": shelf,
+ "span_number": span_number,
}
response = self.json_post("/cli-json/show_spans",
data,
@@ -12005,9 +11779,9 @@ class LFJsonPost(LFCliBase):
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.
+ 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'.
+ p_type=None, # Text Blob type or 'ALL'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12016,9 +11790,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "brief" : brief,
- "name" : name,
- "type" : p_type,
+ "brief": brief,
+ "name": name,
+ "type": p_type,
}
response = self.json_post("/cli-json/show_text_blob",
data,
@@ -12032,7 +11806,7 @@ class LFJsonPost(LFCliBase):
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'.
+ test_mgr=None, # Can be name of test manager, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12041,7 +11815,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "test_mgr" : test_mgr,
+ "test_mgr": test_mgr,
}
response = self.json_post("/cli-json/show_tm",
data,
@@ -12055,7 +11829,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#show_traffic_profile
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_show_traffic_profile(self,
- name=None, # Profile Name or 'ALL'.
+ name=None, # Profile Name or 'ALL'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12064,7 +11838,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/show_traffic_profile",
data,
@@ -12078,8 +11852,8 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#show_venue
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_show_venue(self,
- resource=None, # Resource number, or 'ALL'
- shelf=None, # Shelf number.
+ 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):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -12089,9 +11863,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
- "venu_id" : venu_id,
+ "resource": resource,
+ "shelf": shelf,
+ "venu_id": venu_id,
}
response = self.json_post("/cli-json/show_venue",
data,
@@ -12105,9 +11879,9 @@ class LFJsonPost(LFCliBase):
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'.
+ 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:
@@ -12116,9 +11890,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "router" : router,
- "shelf" : shelf,
+ "resource": resource,
+ "router": router,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/show_vr",
data,
@@ -12133,8 +11907,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
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'.
+ resource=None, # Resource number, or 'all'.
+ shelf=None, # Name/id of the shelf, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12143,9 +11917,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cx_name" : cx_name,
- "resource" : resource,
- "shelf" : shelf,
+ "cx_name": cx_name,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/show_vrcx",
data,
@@ -12159,7 +11933,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#show_wanpaths
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_show_wanpaths(self,
- endpoint=None, # Name of endpoint, or 'all'.
+ endpoint=None, # Name of endpoint, or 'all'.
wanpath=None, # Name of wanpath, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
@@ -12169,8 +11943,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endpoint" : endpoint,
- "wanpath" : wanpath,
+ "endpoint": endpoint,
+ "wanpath": wanpath,
}
response = self.json_post("/cli-json/show_wanpaths",
data,
@@ -12184,9 +11958,11 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -12195,9 +11971,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "chdir" : chdir,
- "really" : really,
- "serverctl" : serverctl,
+ "chdir": chdir,
+ "really": really,
+ "serverctl": serverctl,
}
response = self.json_post("/cli-json/shutdown",
data,
@@ -12211,8 +11987,8 @@ class LFJsonPost(LFCliBase):
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.
+ resource=None, # Resource number, or ALL.
+ shelf=None, # Shelf number, or ALL.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12221,8 +11997,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/shutdown_os",
data,
@@ -12236,8 +12012,8 @@ class LFJsonPost(LFCliBase):
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.
+ resource=None, # Resource number, or ALL.
+ shelf=None, # Shelf number, or ALL.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12246,8 +12022,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/shutdown_resource",
data,
@@ -12263,70 +12039,59 @@ class LFJsonPost(LFCliBase):
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 = SniffPortFlags.set_flags( flag_names=['bridge', 'dhcp'])
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- temp_flag_value = 0x0
- 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
+ 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
- def __init__(self):
- self.selected_named_flag_map = {}
-
- # (internal method) call this from add_flags() or remove_flags()
- def update_flag_value(self):
- self.temp_flag_value = 0x0
- for flag in self.selected_named_flag_map.keys():
- self.temp_flag_value |= flag.value
-
- def add_flags(self, flag_names=None):
+ @classmethod
+ def set_flags(cls, starting_value: int, flag_names=None):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
SniffPortFlags.add_flags(flag_names=['bridge', 'dhcp'])
print('value now: '+SniffPortFlags.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 flag is None:
- continue
- self.selected_named_flag_map[flag] = 0
- elif flag_names is not None:
- self.selected_named_flag_map[flag_names] = 0
- self.update_flag_value()
+ if flag not in cls.__members__:
+ raise ValueError("SniffPortFlags has no member:[%s]" % flag)
+ selected_flags.append([cls[member].value for member in cls.__members__ if member == flag])
+ selected_flags.append(starting_value)
+ return sum(selected_flags)
+ if flag_names not in cls.__members__:
+ raise ValueError("SniffPortFlags has no member:[%s]" % flag_names)
+ return cls.valueof(flag_names)
- def clear_flags(self, flag_names=None):
- """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
- Example Usage:
- SniffPortFlags.clear_flags(flag_names=['bridge', 'dhcp'])
- print( 'value now: '+SniffPortFlags.value())
- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
- 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:
- for flag in flag_names:
- if flag is None:
- continue
- if flag in self.selected_named_flag_map:
- del self.selected_named_flag_map[flag]
- elif (flag_names is not None) and (flag_names in self.selected_named_flag_map):
- del self.selected_named_flag_map[flag_names]
- self.update_flag_value()
-
- def value(self):
- return self.temp_flag_value
+ # 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.
+ 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.
+ 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:
@@ -12335,13 +12100,13 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "display" : display,
- "duration" : duration,
- "flags" : flags,
- "outfile" : outfile,
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
+ "display": display,
+ "duration": duration,
+ "flags": flags,
+ "outfile": outfile,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/sniff_port",
data,
@@ -12355,7 +12120,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#start_endp
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_start_endp(self,
- endp_name=None, # Name of the cross-connect, or 'all'.
+ endp_name=None, # Name of the cross-connect, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12364,7 +12129,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp_name" : endp_name,
+ "endp_name": endp_name,
}
response = self.json_post("/cli-json/start_endp",
data,
@@ -12378,7 +12143,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#start_group
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_start_group(self,
- name=None, # The name of the test group.
+ name=None, # The name of the test group.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12387,7 +12152,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/start_group",
data,
@@ -12401,9 +12166,9 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -12412,9 +12177,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
- "unit_num" : unit_num,
+ "resource": resource,
+ "shelf": shelf,
+ "unit_num": unit_num,
}
response = self.json_post("/cli-json/start_ppp_link",
data,
@@ -12428,7 +12193,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#stop_endp
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_stop_endp(self,
- endp_name=None, # Name of the endpoint, or 'all'.
+ endp_name=None, # Name of the endpoint, or 'all'.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12437,7 +12202,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "endp_name" : endp_name,
+ "endp_name": endp_name,
}
response = self.json_post("/cli-json/stop_endp",
data,
@@ -12451,7 +12216,7 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#stop_group
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_stop_group(self,
- name=None, # The name of the test group, or 'all'
+ name=None, # The name of the test group, or 'all'
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12460,7 +12225,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "name" : name,
+ "name": name,
}
response = self.json_post("/cli-json/stop_group",
data,
@@ -12474,9 +12239,9 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -12485,9 +12250,9 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
- "unit_num" : unit_num,
+ "resource": resource,
+ "shelf": shelf,
+ "unit_num": unit_num,
}
response = self.json_post("/cli-json/stop_ppp_link",
data,
@@ -12501,11 +12266,12 @@ class LFJsonPost(LFCliBase):
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) Unescaped Value
- resource=None, # Resource that holds the file.
- shelf=None, # Shelf that holds the resource that holds the file.
+ cmd=None, # Command: start, stop, results
+ key=None, # File-name that we should be tailing.
+ message=None, # The contents to display (for results only) Unescaped
+ # Value
+ resource=None, # Resource that holds the file.
+ shelf=None, # Shelf that holds the resource that holds the file.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12514,11 +12280,11 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "cmd" : cmd,
- "key" : key,
- "message" : message,
- "resource" : resource,
- "shelf" : shelf,
+ "cmd": cmd,
+ "key": key,
+ "message": message,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/tail",
data,
@@ -12532,8 +12298,8 @@ class LFJsonPost(LFCliBase):
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.)
+ 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:
@@ -12542,8 +12308,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "client_name" : client_name,
- "test_mgr" : test_mgr,
+ "client_name": client_name,
+ "test_mgr": test_mgr,
}
response = self.json_post("/cli-json/tm_register",
data,
@@ -12557,8 +12323,8 @@ class LFJsonPost(LFCliBase):
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.)
+ 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:
@@ -12567,8 +12333,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "client_name" : client_name,
- "test_mgr" : test_mgr,
+ "client_name": client_name,
+ "test_mgr": test_mgr,
}
response = self.json_post("/cli-json/tm_unregister",
data,
@@ -12624,10 +12390,12 @@ class LFJsonPost(LFCliBase):
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.
+ 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:
@@ -12636,10 +12404,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "port" : port,
- "resource" : resource,
- "shelf" : shelf,
- "wpa_cli_cmd" : wpa_cli_cmd,
+ "port": port,
+ "resource": resource,
+ "shelf": shelf,
+ "wpa_cli_cmd": wpa_cli_cmd,
}
response = self.json_post("/cli-json/wifi_cli_cmd",
data,
@@ -12653,10 +12421,10 @@ class LFJsonPost(LFCliBase):
https://www.candelatech.com/lfcli_ug.php#wifi_event
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
def post_wifi_event(self,
- device=None, # Interface or PHY in most cases.
+ 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.
+ msg=None, # Entire event in human readable form.
+ status=None, # Status on what happened.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12665,10 +12433,10 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "device" : device,
- "event" : event,
- "msg" : msg,
- "status" : status,
+ "device": device,
+ "event": event,
+ "msg": msg,
+ "status": status,
}
response = self.json_post("/cli-json/wifi_event",
data,
@@ -12682,8 +12450,8 @@ class LFJsonPost(LFCliBase):
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.
+ resource=None, # Resource number, or ALL.
+ shelf=None, # Shelf number, or ALL.
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12692,8 +12460,8 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "resource" : resource,
- "shelf" : shelf,
+ "resource": resource,
+ "shelf": shelf,
}
response = self.json_post("/cli-json/wiser_reset",
data,
@@ -12707,7 +12475,7 @@ class LFJsonPost(LFCliBase):
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)
+ db_name=None, # The name the backup shall be saved as (blank means dflt)
debug_=False):
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
Example Usage:
@@ -12716,7 +12484,7 @@ class LFJsonPost(LFCliBase):
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----"""
debug_ |= self.debug
data = {
- "db_name" : db_name,
+ "db_name": db_name,
}
response = self.json_post("/cli-json/write",
data,
diff --git a/py-scripts/scripts_deprecated/lf_check_orig.py b/py-scripts/scripts_deprecated/lf_check_orig.py
new file mode 100644
index 00000000..07982702
--- /dev/null
+++ b/py-scripts/scripts_deprecated/lf_check_orig.py
@@ -0,0 +1,1219 @@
+#!/usr/bin/python3
+
+'''
+NAME:
+lf_check.py
+
+PURPOSE:
+lf_check.py will tests based on .ini file or .json file.
+The config file name can be passed in as a configuraiton parameter.
+The json file may be copied from lf_check.json and updated. Currently all the parameters are needed to be set to a value
+
+The --production flag determine the email list for results
+
+EXAMPLE:
+lf_check.py # this will use the defaults
+lf_check.py --json --test_suite
+lf_check.py --json --production
+
+NOTES:
+Before using lf_check.py
+Using .ini:
+1. copy lf_check_config_template.ini to .ini , this will avoid .ini being overwritten on git pull
+2. update .ini to enable (TRUE) tests to be run in the test suite, the default suite is the TEST_DICTIONARY
+3. update other configuration to specific test bed for example radios
+
+Using .json:
+1. copy lf_check.json to .json this will avoide .json being overwritten on git pull
+2. update lf_check.json to enable (TRUE) tests to be run in the test suite, the default TEST_DICTIONARY
+
+NOTES: getting radio information:
+1. (Using Curl) curl -H 'Accept: application/json' http://localhost:8080/radiostatus/all | json_pp | less
+2. (using Python) response = self.json_get("/radiostatus/all")
+
+GENERIC NOTES:
+Starting LANforge:
+ On local or remote system: /home/lanforge/LANforgeGUI/lfclient.bash -cli-socket 3990 -s LF_MGR
+ On local system the -s LF_MGR will be local_host if not provided
+
+ On LANforge ~lanforge/.config/autostart/LANforge-auto.desktop is used to restart lanforge on boot.
+ http://www.candelatech.com/cookbook.php?vol=misc&book=Automatically+starting+LANforge+GUI+on+login
+
+1. add server (telnet localhost 4001) build info, GUI build sha, and Kernel version to the output.
+ A. for build information on LANforgeGUI : /home/lanforge ./btserver --version
+ B. for the kernel version uname -r (just verion ), uname -a build date
+ C. for getting the radio firmware: ethtool -i wlan0
+
+# may need to build in a testbed reboot at the beginning of a day's testing...
+# seeing some dhcp exhaustion and high latency values for testbeds that have been running
+# for a while that appear to clear up once the entire testbed is power cycled
+
+# issue a shutdown command on the lanforge(s)
+# ssh root@lanforge reboot (need to verify) or do a shutdown
+# send curl command to remote power switch to reboot testbed
+# curl -s http://admin:lanforge@192.168.100.237/outlet?1=CCL -o /dev/null 2>&1
+#
+
+
+'''
+import datetime
+import sys
+
+if sys.version_info[0] != 3:
+ print("This script requires Python3")
+ exit()
+
+import os
+import socket
+import logging
+import time
+from time import sleep
+import argparse
+import json
+import subprocess
+import csv
+import shlex
+import paramiko
+import pandas as pd
+import requests
+
+# lf_report is from the parent of the current file
+dir_path = os.path.dirname(os.path.realpath(__file__))
+parent_dir_path = os.path.abspath(os.path.join(dir_path, os.pardir))
+sys.path.insert(0, parent_dir_path)
+
+from lf_report import lf_report
+
+sys.path.append('/')
+
+# setup logging FORMAT
+FORMAT = '%(asctime)s %(name)s %(levelname)s: %(message)s'
+
+
+# lf_check class contains verificaiton configuration and ocastrates the testing.
+class lf_check():
+ def __init__(self,
+ _json_data,
+ _test_suite,
+ _production,
+ _csv_results,
+ _outfile,
+ _outfile_name,
+ _report_path,
+ _log_path):
+ self.json_data = _json_data
+ self.test_suite = _test_suite
+ self.production_run = _production
+ self.report_path = _report_path
+ self.log_path = _log_path
+ self.radio_dict = {}
+ self.test_dict = {}
+ path_parent = os.path.dirname(os.getcwd())
+ os.chdir(path_parent)
+ self.scripts_wd = os.getcwd()
+ self.results = ""
+ self.outfile = _outfile
+ self.outfile_name = _outfile_name
+ self.test_result = "Failure"
+ self.results_col_titles = ["Test", "Command", "Result", "STDOUT", "STDERR"]
+ self.html_results = ""
+ self.background_green = "background-color:green"
+ self.background_red = "background-color:red"
+ self.background_purple = "background-color:purple"
+ self.background_blue = "background-color:blue"
+
+ self.http_test_ip = ""
+ self.ftp_test_ip = ""
+ self.test_ip = ""
+
+ # section TEST_GENERIC
+ self.radio_lf = ""
+ self.ssdi = ""
+ self.ssid_pw = ""
+ self.security = ""
+ self.num_sta = ""
+ self.col_names = ""
+ self.upstream_port = ""
+
+ self.csv_results = _csv_results
+ self.csv_results_file = ""
+ self.csv_results_writer = ""
+ self.csv_results_column_headers = ""
+ self.logger = logging.getLogger(__name__)
+ self.test_timeout = 120
+ self.test_timeout_default = 120
+ self.use_blank_db = "FALSE"
+ self.use_factory_default_db = "FALSE"
+ self.use_custom_db = "FALSE"
+ self.email_list_production = ""
+ self.host_ip_production = None
+ self.email_list_test = ""
+ self.host_ip_test = None
+ self.email_title_txt = ""
+ self.email_txt = ""
+
+ # lanforge configuration
+ self.lf_mgr_ip = "192.168.0.102"
+ self.lf_mgr_port = "8080"
+ self.lf_mgr_user = "lanforge"
+ self.lf_mgr_pass = "lanforge"
+
+ # dut configuration
+ self.dut_name = "DUT_NAME_NA" # "ASUSRT-AX88U" note this is not dut_set_name
+ self.dut_hw = "DUT_HW_NA"
+ self.dut_sw = "DUT_SW_NA"
+ self.dut_model = "DUT_MODEL_NA"
+ self.dut_serial = "DUT_SERIAL_NA"
+ self.dut_bssid_2g = "BSSID_2G_NA" # "3c:7c:3f:55:4d:64" - this is the mac for the 2.4G radio this may be seen with a scan
+ self.dut_bssid_5g = "BSSID_5G_NA" # "3c:7c:3f:55:4d:64" - this is the mac for the 5G radio this may be seen with a scan
+ self.dut_bssid_6g = "BSSID_6G_NA" # "3c:7c:3f:55:4d:64" - this is the mac for the 6G radio this may be seen with a scan
+ # NOTE: My influx token is unlucky and starts with a '-', but using the syntax below # with '=' right after the argument keyword works as hoped.
+ # --influx_token=
+
+ # DUT , Test rig must match testbed
+ self.test_rig = "CT-US-NA"
+
+ # QA report
+ self.qa_report_html = "NA"
+
+ # database configuration # database
+ self.database_json = ""
+ self.database_config = "True" # default to False once testing done
+ self.database_host = "192.168.100.201" # "c7-grafana.candelatech.com" # influx and grafana have the same host "192.168.100.201"
+ self.database_port = "8086"
+ self.database_token = "-u_Wd-L8o992701QF0c5UmqEp7w7Z7YOMaWLxOMgmHfATJGnQbbmYyNxHBR9PgD6taM_tcxqJl6U8DjU1xINFQ=="
+ self.database_org = "Candela"
+ self.database_bucket = "lanforge_qa_testing"
+ self.database_tag = 'testbed CT-US-001' # the test_rig needs to match
+ self.dut_set_name = 'DUT_NAME ASUSRT-AX88U' # note the name will be set as --set DUT_NAME ASUSRT-AX88U, this is not dut_name (see above)
+
+ # grafana configuration #dashboard
+ self.dashboard_json = ""
+ self.dashboard_config = "True" # default to False once testing done
+ self.dashboard_host = "192.168.100.201" # "c7-grafana.candelatech.com" # 192.168.100.201
+ self.dashboard_port = "3000"
+ self.dashboard_token = "eyJrIjoiS1NGRU8xcTVBQW9lUmlTM2dNRFpqNjFqV05MZkM0dzciLCJuIjoibWF0dGhldyIsImlkIjoxfQ=="
+
+ # ghost configuration
+ self.blog_json = ""
+ self.blog_config = False
+ self.blog_host = "192.168.100.153"
+ self.blog_port = "2368"
+ self.blog_token = "60df4b0175953f400cd30650:d50e1fabf9a9b5d3d30fe97bc3bf04971d05496a89e92a169a0d72357c81f742"
+ self.blog_authors = "Matthew"
+ self.blog_customer = "candela"
+ self.blog_user_push = "lanforge"
+ self.blog_password_push = "lanforge"
+ self.blog_flag = "--kpi_to_ghost"
+
+ self.test_run = ""
+
+ def check_if_port_exists(self):
+ queries = dict()
+ queries['LANforge Manager'] = 'http://%s:%s' % (self.lf_mgr_ip, self.lf_mgr_port)
+ queries['Blog Host'] = 'http://%s:%s' % (self.blog_host, self.blog_port)
+ queries['Influx Host'] = 'http://%s:%s' % (self.database_host, self.database_port)
+ queries['Grafana Host'] = 'http://%s:%s' % (self.dashboard_host, self.dashboard_port)
+ results = dict()
+ for key, value in queries.items():
+ try:
+ ping = requests.get(value).text
+ results[key] = [str(ping), value]
+ except:
+ print('%s not found' % value)
+ results[key] = [value, None]
+ return results
+
+ def get_scripts_git_sha(self):
+ # get git sha
+ process = subprocess.Popen(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE)
+ (commit_hash, err) = process.communicate()
+ exit_code = process.wait()
+ scripts_git_sha = commit_hash.decode('utf-8', 'ignore')
+ return scripts_git_sha
+
+ def get_lanforge_node_version(self):
+ ssh = paramiko.SSHClient() # creating shh client object we use this object to connect to router
+ ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # automatically adds the missing host key
+ # ssh.connect(self.lf_mgr_ip, port=22, username=self.lf_mgr_user, password=self.lf_mgr_pass, banner_timeout=600)
+ ssh.connect(hostname=self.lf_mgr_ip, port=22, username=self.lf_mgr_user, password=self.lf_mgr_pass,
+ allow_agent=False, look_for_keys=False, banner_timeout=600)
+ stdin, stdout, stderr = ssh.exec_command('uname -n')
+ lanforge_node_version = stdout.readlines()
+ # print('\n'.join(output))
+ lanforge_node_version = [line.replace('\n', '') for line in lanforge_node_version]
+ ssh.close()
+ time.sleep(1)
+ return lanforge_node_version
+
+ def get_lanforge_kernel_version(self):
+ ssh = paramiko.SSHClient() # creating shh client object we use this object to connect to router
+ ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # automatically adds the missing host key
+ # ssh.connect(self.lf_mgr_ip, port=22, username=self.lf_mgr_user, password=self.lf_mgr_pass, banner_timeout=600)
+ ssh.connect(hostname=self.lf_mgr_ip, port=22, username=self.lf_mgr_user, password=self.lf_mgr_pass,
+ allow_agent=False, look_for_keys=False, banner_timeout=600)
+ stdin, stdout, stderr = ssh.exec_command('uname -r')
+ lanforge_kernel_version = stdout.readlines()
+ # print('\n'.join(output))
+ lanforge_kernel_version = [line.replace('\n', '') for line in lanforge_kernel_version]
+ ssh.close()
+ time.sleep(1)
+ return lanforge_kernel_version
+
+ def get_lanforge_gui_version(self):
+ output = ""
+ ssh = paramiko.SSHClient() # creating shh client object we use this object to connect to router
+ ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # automatically adds the missing host key
+ ssh.connect(hostname=self.lf_mgr_ip, port=22, username=self.lf_mgr_user, password=self.lf_mgr_pass,
+ allow_agent=False, look_for_keys=False, banner_timeout=600)
+ stdin, stdout, stderr = ssh.exec_command('./btserver --version | grep Version')
+ lanforge_gui_version = stdout.readlines()
+ # print('\n'.join(output))
+ lanforge_gui_version = [line.replace('\n', '') for line in lanforge_gui_version]
+ ssh.close()
+ time.sleep(1)
+ return lanforge_gui_version
+
+ def get_radio_status(self):
+ radio_status = self.json_get("/radiostatus/all")
+ print("radio status {radio_status}".format(radio_status=radio_status))
+
+
+ # NOT complete : will send the email results
+ def send_results_email(self, report_file=None):
+ if (report_file is None):
+ print("No report file, not sending email.")
+ return
+ report_url = report_file.replace('/home/lanforge/', '')
+ if report_url.startswith('/'):
+ report_url = report_url[1:]
+ qa_url = self.qa_report_html.replace('home/lanforge','')
+ if qa_url.startswith('/'):
+ qa_url = qa_url[1:]
+ # following recommendation
+ # NOTE: https://stackoverflow.com/questions/24196932/how-can-i-get-the-ip-address-from-nic-in-python
+ # Mail
+ # command to check if mail running : systemctl status postfix
+ # command = 'echo "$HOSTNAME mail system works!" | mail -s "Test: $HOSTNAME $(date)" chuck.rekiere@candelatech.com'
+ hostname = socket.gethostname()
+ ip = socket.gethostbyname(hostname)
+ if (self.email_txt != ""):
+ message_txt = """{email_txt} lanforge target {lf_mgr_ip}
+Results from {hostname}:
+http://{ip}/{report}
+QA Report Dashboard:
+http://{ip_qa}/{qa_url}
+NOTE: Diagrams are links in dashboard
+""".format(hostname=hostname, ip=ip, report=report_url, email_txt=self.email_txt, lf_mgr_ip=self.lf_mgr_ip,
+ ip_qa=ip,qa_url=qa_url)
+
+ else:
+ message_txt = """Results from {hostname}:
+http://{ip}/{report}
+QA Report Dashboard:
+QA Report: http://{ip_qa}/{qa_url}
+""".format(hostname=hostname, ip=ip,report=report_url,ip_qa=ip,qa_url=qa_url)
+
+ if (self.email_title_txt != ""):
+ mail_subject = "{} [{hostname}] {date}".format(self.email_title_txt, hostname=hostname,
+ date=datetime.datetime.now())
+ else:
+ mail_subject = "Regression Test [{hostname}] {date}".format(hostname=hostname, date=datetime.datetime.now())
+ try:
+ if self.production_run == True:
+ msg = message_txt.format(ip=self.host_ip_production)
+ # for postfix from command line echo "My message" | mail -s subject user@candelatech.com
+ command = "echo \"{message}\" | mail -s \"{subject}\" {address}".format(
+ message=msg,
+ subject=mail_subject,
+ ip=self.host_ip_production,
+ address=self.email_list_production)
+ else:
+ msg = message_txt.format(ip=ip)
+ command = "echo \"{message}\" | mail -s \"{subject}\" {address}".format(
+ message=msg,
+ subject=mail_subject,
+ ip=ip, # self.host_ip_test,
+ address=self.email_list_test)
+
+ print("running:[{}]".format(command))
+ process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ universal_newlines=True)
+ # have email on separate timeout
+ process.wait(timeout=int(self.test_timeout))
+ except subprocess.TimeoutExpired:
+ print("send email timed out")
+ process.terminate()
+
+ def get_csv_results(self):
+ return self.csv_file.name
+
+ def start_csv_results(self):
+ print("self.csv_results")
+ self.csv_results_file = open(self.csv_results, "w")
+ self.csv_results_writer = csv.writer(self.csv_results_file, delimiter=",")
+ self.csv_results_column_headers = ['Test', 'Command', 'Result', 'STDOUT', 'STDERR']
+ self.csv_results_writer.writerow(self.csv_results_column_headers)
+ self.csv_results_file.flush()
+
+ def get_html_results(self):
+ return self.html_results
+
+ def start_html_results(self):
+ self.html_results += """
+
+
+
+ | Test |
+ Command |
+ Result |
+ STDOUT |
+ STDERR |
+
+
+
+ """
+
+ def finish_html_results(self):
+ self.html_results += """
+
+
+
+
+
+ """
+
+ def read_config(self):
+ self.read_config_json()
+
+ # there is probably a more efficient way to do this in python
+ # Keeping it obvious for now, may be refactored later
+ def read_config_json(self):
+ # self.logger.info("read_config_json_contents {}".format(self.json_data))
+ if "test_parameters" in self.json_data:
+ self.logger.info("json: read test_parameters")
+ # self.logger.info("test_parameters {}".format(self.json_data["test_parameters"]))
+ self.read_test_parameters()
+ else:
+ self.logger.info("EXITING test_parameters not in json {}".format(self.json_data))
+ exit(1)
+
+ if "test_network" in self.json_data:
+ self.logger.info("json: read test_network")
+ # self.logger.info("test_network {}".format(self.json_data["test_network"]))
+ self.read_test_network()
+ else:
+ self.logger.info("EXITING test_network not in json {}".format(self.json_data))
+ exit(1)
+
+ if "test_database" in self.json_data:
+ self.logger.info("json: read test_database")
+ # self.logger.info("test_database {}".format(self.json_data["test_database"]))
+ self.read_test_database()
+ else:
+ self.logger.info("NOTE: test_database not found in json")
+
+ if "test_dashboard" in self.json_data:
+ self.logger.info("json: read test_dashboard")
+ # self.logger.info("test_dashboard {}".format(self.json_data["test_dashboard"]))
+ self.read_test_dashboard()
+ else:
+ self.logger.info("NOTE: test_dashboard not found in json")
+
+ if "test_blog" in self.json_data:
+ self.logger.info("json: read test_blog")
+ # self.logger.info("test_blog {}".format(self.json_data["test_blog"]))
+ self.read_test_blog()
+ else:
+ self.logger.info("NOTE: test_blog not found in json")
+
+ if "test_generic" in self.json_data:
+ self.logger.info("json: read test_generic")
+ # self.logger.info("test_generic {}".format(self.json_data["test_generic"]))
+ self.read_test_generic()
+ else:
+ self.logger.info("EXITING test_generic not in json {}".format(self.json_data))
+ exit(1)
+
+ if "radio_dict" in self.json_data:
+ self.logger.info("json: read radio_dict")
+ # self.logger.info("radio_dict {}".format(self.json_data["radio_dict"]))
+ self.radio_dict = self.json_data["radio_dict"]
+ self.logger.info("self.radio_dict {}".format(self.radio_dict))
+ else:
+ self.logger.info("EXITING radio_dict not in json {}".format(self.json_data))
+ exit(1)
+
+ if "test_suites" in self.json_data:
+ self.logger.info("json: read test_suites looking for: {}".format(self.test_suite))
+ # self.logger.info("test_suites {}".format(self.json_data["test_suites"]))
+ if self.test_suite in self.json_data["test_suites"]:
+ self.test_dict = self.json_data["test_suites"][self.test_suite]
+ # self.logger.info("self.test_dict {}".format(self.test_dict))
+ else:
+ self.logger.info("EXITING test_suite {} Not Present in json test_suites: {}".format(self.test_suite,
+ self.json_data[
+ "test_suites"]))
+ exit(1)
+ else:
+ self.logger.info("EXITING test_suites not in json {}".format(self.json_data))
+ exit(1)
+
+ def read_test_parameters(self):
+ if "test_timeout" in self.json_data["test_parameters"]:
+ self.test_timeout = self.json_data["test_parameters"]["test_timeout"]
+ self.test_timeout_default = self.test_timeout
+ else:
+ self.logger.info("test_timeout not in test_parameters json")
+ exit(1)
+ if "load_blank_db" in self.json_data["test_parameters"]:
+ self.load_blank_db = self.json_data["test_parameters"]["load_blank_db"]
+ else:
+ self.logger.info("load_blank_db not in test_parameters json")
+ exit(1)
+ if "load_factory_default_db" in self.json_data["test_parameters"]:
+ self.load_factory_default_db = self.json_data["test_parameters"]["load_factory_default_db"]
+ else:
+ self.logger.info("load_factory_default_db not in test_parameters json")
+ exit(1)
+ if "load_custom_db" in self.json_data["test_parameters"]:
+ self.load_custom_db = self.json_data["test_parameters"]["load_custom_db"]
+ else:
+ self.logger.info("load_custom_db not in test_parameters json")
+ exit(1)
+ if "custom_db" in self.json_data["test_parameters"]:
+ self.custom_db = self.json_data["test_parameters"]["custom_db"]
+ else:
+ self.logger.info("custom_db not in test_parameters json, if not using custom_db just put in a name")
+ exit(1)
+ if "email_list_production" in self.json_data["test_parameters"]:
+ self.email_list_production = self.json_data["test_parameters"]["email_list_production"]
+ else:
+ self.logger.info("email_list_production not in test_parameters json")
+ exit(1)
+ if "host_ip_production" in self.json_data["test_parameters"]:
+ self.host_ip_production = self.json_data["test_parameters"]["host_ip_production"]
+ else:
+ self.logger.info("host_ip_production not in test_parameters json")
+ exit(1)
+ if "email_list_test" in self.json_data["test_parameters"]:
+ self.email_list_test = self.json_data["test_parameters"]["email_list_test"]
+ print(self.email_list_test)
+ else:
+ self.logger.info("email_list_test not in test_parameters json")
+ exit(1)
+ if "host_ip_test" in self.json_data["test_parameters"]:
+ self.host_ip_test = self.json_data["test_parameters"]["host_ip_test"]
+ else:
+ self.logger.info("host_ip_test not in test_parameters json")
+ exit(1)
+ if "email_title_txt" in self.json_data["test_parameters"]:
+ self.email_title_txt = self.json_data["test_parameters"]["email_title_txt"]
+ else:
+ self.logger.info("email_title_txt not in test_parameters json")
+ if "email_txt" in self.json_data["test_parameters"]:
+ self.email_txt = self.json_data["test_parameters"]["email_txt"]
+ else:
+ self.logger.info("email_txt not in test_parameters json")
+ if "lf_mgr_ip" in self.json_data["test_parameters"]:
+ self.lf_mgr_ip = self.json_data["test_parameters"]["lf_mgr_ip"]
+ else:
+ self.logger.info("lf_mgr_ip not in test_parameters json")
+ if "lf_mgr_port" in self.json_data["test_parameters"]:
+ self.lf_mgr_port = self.json_data["test_parameters"]["lf_mgr_port"]
+ else:
+ self.logger.info("lf_mgr_port not in test_parameters json")
+ if "dut_name" in self.json_data["test_parameters"]:
+ self.dut_name = self.json_data["test_parameters"]["dut_name"]
+ else:
+ self.logger.info("dut_name not in test_parameters json")
+ if "dut_hw" in self.json_data["test_parameters"]:
+ self.dut_hw = self.json_data["test_parameters"]["dut_hw"]
+ else:
+ self.logger.info("dut_hw not in test_parameters json")
+ if "dut_sw" in self.json_data["test_parameters"]:
+ self.dut_sw = self.json_data["test_parameters"]["dut_sw"]
+ else:
+ self.logger.info("dut_sw not in test_parameters json")
+ if "dut_model" in self.json_data["test_parameters"]:
+ self.dut_model = self.json_data["test_parameters"]["dut_model"]
+ else:
+ self.logger.info("dut_model not in test_parameters json")
+ if "dut_serial" in self.json_data["test_parameters"]:
+ self.dut_serial = self.json_data["test_parameters"]["dut_serial"]
+ else:
+ self.logger.info("dut_serial not in test_parameters json")
+ if "dut_bssid_2g" in self.json_data["test_parameters"]:
+ self.dut_bssid_2g = self.json_data["test_parameters"]["dut_bssid_2g"]
+ else:
+ self.logger.info("dut_bssid_2G not in test_parameters json")
+ if "dut_bssid_5g" in self.json_data["test_parameters"]:
+ self.dut_bssid_5g = self.json_data["test_parameters"]["dut_bssid_5g"]
+ else:
+ self.logger.info("dut_bssid_5g not in test_parameters json")
+ if "dut_bssid_6g" in self.json_data["test_parameters"]:
+ self.dut_bssid_6g = self.json_data["test_parameters"]["dut_bssid_6g"]
+ else:
+ self.logger.info("dut_bssid_6g not in test_parameters json")
+
+ def read_test_network(self):
+ if "http_test_ip" in self.json_data["test_network"]:
+ self.http_test_ip = self.json_data["test_network"]["http_test_ip"]
+ else:
+ self.logger.info("http_test_ip not in test_network json")
+ exit(1)
+ if "ftp_test_ip" in self.json_data["test_network"]:
+ self.ftp_test_ip = self.json_data["test_network"]["ftp_test_ip"]
+ else:
+ self.logger.info("ftp_test_ip not in test_network json")
+ exit(1)
+ if "test_ip" in self.json_data["test_network"]:
+ self.ftp_test_ip = self.json_data["test_network"]["test_ip"]
+ else:
+ self.logger.info("test_ip not in test_network json")
+ exit(1)
+
+ def read_test_database(self):
+ if "database_config" in self.json_data["test_database"]:
+ self.database_config = self.json_data["test_database"]["database_config"]
+ else:
+ self.logger.info("database_config not in test_database json")
+ if "database_host" in self.json_data["test_database"]:
+ self.database_host = self.json_data["test_database"]["database_host"]
+ else:
+ self.logger.info("database_host not in test_database json")
+ if "database_port" in self.json_data["test_database"]:
+ self.database_port = self.json_data["test_database"]["database_port"]
+ else:
+ self.logger.info("database_port not in test_database json")
+ if "database_token" in self.json_data["test_database"]:
+ self.database_token = self.json_data["test_database"]["database_token"]
+ else:
+ self.logger.info("database_token not in test_database json")
+ if "database_org" in self.json_data["test_database"]:
+ self.database_org = self.json_data["test_database"]["database_org"]
+ else:
+ self.logger.info("database_org not in test_database json")
+ if "database_bucket" in self.json_data["test_database"]:
+ self.database_bucket = self.json_data["test_database"]["database_bucket"]
+ else:
+ self.logger.info("database_bucket not in test_database json")
+ if "database_tag" in self.json_data["test_database"]:
+ self.database_tag = self.json_data["test_database"]["database_tag"]
+ else:
+ self.logger.info("database_tag not in test_database json")
+ if "test_rig" in self.json_data["test_database"]:
+ self.test_rig = self.json_data["test_database"]["test_rig"]
+ else:
+ self.logger.info("test_rig not in test_database json")
+ if "dut_set_name" in self.json_data["test_database"]:
+ self.dut_set_name = self.json_data["test_database"]["dut_set_name"]
+ else:
+ self.logger.info("dut_set_name not in test_database json")
+
+ def read_test_dashboard(self):
+ if "dashboard_config" in self.json_data["test_dashboard"]:
+ self.dashboard_config = self.json_data["test_dashboard"]["dashboard_config"]
+ else:
+ self.logger.info("dashboard_config not in test_dashboard json")
+
+ if "dashboard_host" in self.json_data["test_dashboard"]:
+ self.dashboard_host = self.json_data["test_dashboard"]["dashboard_host"]
+ else:
+ self.logger.info("dashboard_host not in test_dashboard json")
+
+ if "dashboard_token" in self.json_data["test_dashboard"]:
+ self.dashboard_token = self.json_data["test_dashboard"]["dashboard_token"]
+ else:
+ self.logger.info("dashboard_token not in test_dashboard json")
+
+ def read_test_blog(self):
+ if "blog_config" in self.json_data["test_blog"]:
+ self.blog_config = self.json_data["test_blog"]["blog_config"]
+ else:
+ self.logger.info("blog_config not in test_blog json")
+
+ if "blog_host" in self.json_data["test_blog"]:
+ self.blog_host = self.json_data["test_blog"]["blog_host"]
+ else:
+ self.logger.info("blog_host not in test_blog json")
+
+ if "blog_token" in self.json_data["test_blog"]:
+ self.blog_token = self.json_data["test_blog"]["blog_token"]
+ else:
+ self.logger.info("blog_token not in test_blog json")
+
+ if "blog_authors" in self.json_data["test_blog"]:
+ self.blog_authors = self.json_data["test_blog"]["blog_authors"]
+ else:
+ self.logger.info("blog_authors not in test_blog json")
+
+ if "blog_customer" in self.json_data["test_blog"]:
+ self.blog_customer = self.json_data["test_blog"]["blog_customer"]
+ else:
+ self.logger.info("blog_customer not in test_blog json")
+
+ if "blog_user_push" in self.json_data["test_blog"]:
+ self.blog_user_push = self.json_data["test_blog"]["blog_user_push"]
+ else:
+ self.logger.info("blog_user_push not in test_blog json")
+
+ if "blog_password_push" in self.json_data["test_blog"]:
+ self.blog_password_push = self.json_data["test_blog"]["blog_password_push"]
+ else:
+ self.logger.info("blog_password_push not in test_blog json")
+
+ if "blog_flag" in self.json_data["test_blog"]:
+ self.blog_flag = self.json_data["test_blog"]["blog_flag"]
+ else:
+ self.logger.info("blog_flag not in test_blog json")
+
+ def read_test_generic(self):
+ if "radio_used" in self.json_data["test_generic"]:
+ self.radio_lf = self.json_data["test_generic"]["radio_used"]
+ else:
+ self.logger.info("radio_used not in test_generic json")
+ exit(1)
+ if "ssid_used" in self.json_data["test_generic"]:
+ self.ssid = self.json_data["test_generic"]["ssid_used"]
+ else:
+ self.logger.info("ssid_used not in test_generic json")
+ exit(1)
+ if "ssid_pw_used" in self.json_data["test_generic"]:
+ self.ssid_pw = self.json_data["test_generic"]["ssid_pw_used"]
+ else:
+ self.logger.info("ssid_pw_used not in test_generic json")
+ exit(1)
+ if "security_used" in self.json_data["test_generic"]:
+ self.security = self.json_data["test_generic"]["security_used"]
+ else:
+ self.logger.info("security_used not in test_generic json")
+ exit(1)
+ if "num_sta" in self.json_data["test_generic"]:
+ self.num_sta = self.json_data["test_generic"]["num_sta"]
+ else:
+ self.logger.info("num_sta not in test_generic json")
+ exit(1)
+ if "col_names" in self.json_data["test_generic"]:
+ self.num_sta = self.json_data["test_generic"]["col_names"]
+ else:
+ self.logger.info("col_names not in test_generic json")
+ exit(1)
+ if "upstream_port" in self.json_data["test_generic"]:
+ self.upstream_port = self.json_data["test_generic"]["upstream_port"]
+ else:
+ self.logger.info("upstream_port not in test_generic json")
+ exit(1)
+
+ def load_factory_default_db(self):
+ # self.logger.info("file_wd {}".format(self.scripts_wd))
+ try:
+ os.chdir(self.scripts_wd)
+ # self.logger.info("Current Working Directory {}".format(os.getcwd()))
+ except:
+ self.logger.info("failed to change to {}".format(self.scripts_wd))
+
+ # no spaces after FACTORY_DFLT
+ command = "./{} {}".format("scenario.py", "--load FACTORY_DFLT")
+ process = subprocess.Popen((command).split(' '), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ universal_newlines=True)
+ # wait for the process to terminate
+ out, err = process.communicate()
+ errcode = process.returncode
+
+ # not currently used
+ def load_blank_db(self):
+ try:
+ os.chdir(self.scripts_wd)
+ except:
+ self.logger.info("failed to change to {}".format(self.scripts_wd))
+
+ # no spaces after FACTORY_DFLT
+ command = "./{} {}".format("scenario.py", "--load BLANK")
+ process = subprocess.Popen((command).split(' '), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ universal_newlines=True)
+
+ def load_custom_db(self, custom_db):
+ try:
+ os.chdir(self.scripts_wd)
+ except:
+ self.logger.info("failed to change to {}".format(self.scripts_wd))
+
+ # no spaces after FACTORY_DFLT
+ command = "./{} {}".format("scenario.py", "--load {}".format(custom_db))
+ process = subprocess.Popen((command).split(' '), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ universal_newlines=True)
+ # wait for the process to terminate
+ out, err = process.communicate()
+ errcode = process.returncode
+
+ def run_script_test(self):
+ self.start_html_results()
+ self.start_csv_results()
+ print(self.test_dict)
+
+ for test in self.test_dict:
+ if self.test_dict[test]['enabled'] == "FALSE":
+ self.logger.info("test: {} skipped".format(test))
+ # load the default database
+ elif self.test_dict[test]['enabled'] == "TRUE":
+ # if args key has a value of an empty string then need to manipulate the args_list to args
+ # list does not have replace only stings do to args_list will be joined and converted to a string and placed
+ # in args. Then the replace below will work.
+ if self.test_dict[test]['args'] == "":
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace(self.test_dict[test]['args'],
+ ''.join(self.test_dict[test][
+ 'args_list']))
+ # Configure Tests
+ # loop through radios
+ for radio in self.radio_dict:
+ # replace RADIO, SSID, PASSWD, SECURITY with actual config values (e.g. RADIO_0_CFG to values)
+ # not "KEY" is just a word to refer to the RADIO define (e.g. RADIO_0_CFG) to get the vlaues
+ # --num_stations needs to be int not string (no double quotes)
+ if self.radio_dict[radio]["KEY"] in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace(
+ self.radio_dict[radio]["KEY"],
+ '--radio {} --ssid {} --passwd {} --security {} --num_stations {}'
+ .format(self.radio_dict[radio]['RADIO'], self.radio_dict[radio]['SSID'],
+ self.radio_dict[radio]['PASSWD'], self.radio_dict[radio]['SECURITY'],
+ self.radio_dict[radio]['STATIONS']))
+
+ if 'HTTP_TEST_IP' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('HTTP_TEST_IP',
+ self.http_test_ip)
+ if 'FTP_TEST_IP' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('FTP_TEST_IP', self.ftp_test_ip)
+ if 'TEST_IP' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('TEST_IP', self.test_ip)
+
+ if 'LF_MGR_IP' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('LF_MGR_IP', self.lf_mgr_ip)
+ if 'LF_MGR_PORT' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('LF_MGR_PORT', self.lf_mgr_port)
+
+ if 'DUT_NAME' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DUT_NAME', self.dut_name)
+ if 'DUT_HW' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DUT_HW', self.dut_hw)
+ if 'DUT_SW' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DUT_SW', self.dut_sw)
+ if 'DUT_MODEL' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DUT_MODEL', self.dut_model)
+ if 'DUT_SERIAL' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DUT_SERIAL', self.dut_serial)
+ if 'DUT_BSSID_2G' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DUT_BSSID_2G',
+ self.dut_bssid_2g)
+ if 'DUT_BSSID_5G' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DUT_BSSID_5G',
+ self.dut_bssid_5g)
+ if 'DUT_BSSID_6G' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DUT_BSSID_6G',
+ self.dut_bssid_6g)
+
+ if 'RADIO_USED' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('RADIO_USED', self.radio_lf)
+ if 'SSID_USED' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('SSID_USED', self.ssid)
+ if 'SSID_PW_USED' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('SSID_PW_USED', self.ssid_pw)
+ if 'SECURITY_USED' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('SECURITY_USED', self.security)
+ if 'NUM_STA' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('NUM_STA', self.num_sta)
+ if 'COL_NAMES' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('COL_NAMES', self.col_names)
+ if 'UPSTREAM_PORT' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('UPSTREAM_PORT',
+ self.upstream_port)
+
+ # lf_dataplane_test.py and lf_wifi_capacity_test.py use a parameter --local_path for the location
+ # of the reports when the reports are pulled.
+ if 'REPORT_PATH' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('REPORT_PATH', self.report_path)
+
+ # The TEST_BED is the database tag
+ if 'TEST_BED' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('TEST_BED', self.database_tag)
+
+ # database configuration
+ if 'DATABASE_HOST' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DATABASE_HOST',
+ self.database_host)
+ if 'DATABASE_PORT' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DATABASE_PORT',
+ self.database_port)
+ if 'DATABASE_TOKEN' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DATABASE_TOKEN',
+ self.database_token)
+ if 'DATABASE_ORG' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DATABASE_ORG',
+ self.database_org)
+ if 'DATABASE_BUCKET' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DATABASE_BUCKET',
+ self.database_bucket)
+ if 'DATABASE_TAG' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DATABASE_TAG',
+ self.database_tag)
+ if 'DUT_SET_NAME' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DUT_SET_NAME',
+ self.dut_set_name)
+
+ if 'TEST_RIG' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('TEST_RIG', self.test_rig)
+
+ # dashboard configuration
+ if 'DASHBOARD_HOST' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DASHBOARD_HOST',
+ self.dashboard_host)
+ if 'DASHBOARD_TOKEN' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('DASHBOARD_TOKEN',
+ self.dashboard_token)
+
+ # blog configuration
+ if 'BLOG_HOST' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('BLOG_HOST', self.blog_host)
+ if 'BLOG_TOKEN' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('BLOG_TOKEN', self.blog_token)
+ if 'BLOG_AUTHORS' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('BLOG_AUTHORS',
+ self.blog_authors)
+ if 'BLOG_CUSTOMER' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('BLOG_CUSTOMER',
+ self.blog_customer)
+ if 'BLOG_USER_PUSH' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('BLOG_USER_PUSH',
+ self.blog_user_push)
+ if 'BLOG_PASSWORD_PUSH' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('BLOG_PASSWORD_PUSH',
+ self.blog_password_push)
+ if 'BLOG_FLAG' in self.test_dict[test]['args']:
+ self.test_dict[test]['args'] = self.test_dict[test]['args'].replace('BLOG_FLAG', self.blog_flag)
+
+ if 'timeout' in self.test_dict[test]:
+ self.logger.info("timeout : {}".format(self.test_dict[test]['timeout']))
+ self.test_timeout = int(self.test_dict[test]['timeout'])
+ else:
+ self.test_timeout = self.test_timeout_default
+
+ if 'load_db' in self.test_dict[test]:
+ self.logger.info("load_db : {}".format(self.test_dict[test]['load_db']))
+ if str(self.test_dict[test]['load_db']).lower() != "none" and str(
+ self.test_dict[test]['load_db']).lower() != "skip":
+ try:
+ self.load_custom_db(self.test_dict[test]['load_db'])
+ except:
+ self.logger.info("custom database failed to load check existance and location: {}".format(
+ self.test_dict[test]['load_db']))
+ else:
+ self.logger.info("no load_db present in dictionary, load db normally")
+ if self.use_factory_default_db == "TRUE":
+ self.load_factory_default_db()
+ sleep(3)
+ self.logger.info("FACTORY_DFLT loaded between tests with scenario.py --load FACTORY_DFLT")
+ if self.use_blank_db == "TRUE":
+ self.load_blank_db()
+ sleep(1)
+ self.logger.info("BLANK loaded between tests with scenario.py --load BLANK")
+ if self.use_custom_db == "TRUE":
+ try:
+ self.load_custom_db(self.custom_db)
+ sleep(1)
+ self.logger.info("{} loaded between tests with scenario.py --load {}".format(self.custom_db,
+ self.custom_db))
+ except:
+ self.logger.info("custom database failed to load check existance and location: {}".format(
+ self.custom_db))
+ else:
+ self.logger.info("no db loaded between tests: {}".format(self.use_custom_db))
+
+ sleep(1) # DO NOT REMOVE the sleep is to allow for the database to stablize
+ try:
+ os.chdir(self.scripts_wd)
+ # self.logger.info("Current Working Directory {}".format(os.getcwd()))
+ except:
+ self.logger.info("failed to change to {}".format(self.scripts_wd))
+ cmd_args = "{}".format(self.test_dict[test]['args'])
+ command = "./{} {}".format(self.test_dict[test]['command'], cmd_args)
+ self.logger.info("command: {}".format(command))
+ self.logger.info("cmd_args {}".format(cmd_args))
+
+ if self.outfile_name is not None:
+ stdout_log_txt = os.path.join(self.log_path, "{}-{}-stdout.txt".format(self.outfile_name,test))
+ self.logger.info("stdout_log_txt: {}".format(stdout_log_txt))
+ stdout_log = open(stdout_log_txt, 'a')
+ stderr_log_txt = os.path.join(self.log_path, "{}-{}-stderr.txt".format(self.outfile_name,test))
+ self.logger.info("stderr_log_txt: {}".format(stderr_log_txt))
+ stderr_log = open(stderr_log_txt, 'a')
+
+ # need to take into account --raw_line parameters thus need to use shlex.split
+ # need to preserve command to have correct command syntax in command output
+ command_to_run = command
+ command_to_run = shlex.split(command_to_run)
+ print("running {command_to_run}".format(command_to_run=command_to_run))
+ try:
+ process = subprocess.Popen(command_to_run, shell=False, stdout=stdout_log, stderr=stderr_log,
+ universal_newlines=True)
+ # if there is a better solution please propose, the TIMEOUT Result is different then FAIL
+ try:
+ process.wait(timeout=int(self.test_timeout))
+ except subprocess.TimeoutExpired:
+ process.terminate()
+ self.test_result = "TIMEOUT"
+
+ except:
+ print("No such file or directory with command: {}".format(command))
+ self.logger.info("No such file or directory with command: {}".format(command))
+
+ if self.test_result != "TIMEOUT":
+ stderr_log_size = os.path.getsize(stderr_log_txt)
+ if stderr_log_size > 0:
+ self.logger.info("File: {} is not empty: {}".format(stderr_log_txt, str(stderr_log_size)))
+ text = open(stderr_log_txt).read()
+ if 'Error' in text:
+ self.text_result = "Failure"
+ background = self.background_red
+ else:
+ self.test_result = "Success"
+ background = self.background_green
+ else:
+ self.logger.info("File: {} is empty: {}".format(stderr_log_txt, str(stderr_log_size)))
+ self.test_result = "Success"
+ background = self.background_green
+ else:
+ self.logger.info("TIMEOUT FAILURE, Check LANforge Radios")
+ self.test_result = "Time Out"
+ background = self.background_purple
+
+ # Ghost will put data in stderr
+ if 'ghost' in command or 'lf_qa' in command:
+ if self.test_result != "TIMEOUT":
+ text = open(stderr_log_txt).read()
+ if 'Error' in text:
+ self.test_result = "Failure"
+ background = self.background_red
+ else:
+ self.test_result = "Success"
+ background = self.background_blue
+ if 'lf_qa' in command:
+ line_list = open(stdout_log_txt).readlines()
+ for line in line_list:
+ if 'html report:' in line:
+ self.qa_report_html = line
+ print("html_report: {report}".format(report=self.qa_report_html))
+ break
+
+ self.qa_report_html = self.qa_report_html.replace('html report: ','')
+
+
+ # stdout_log_link is used for the email reporting to have the corrected path
+ stdout_log_link = str(stdout_log_txt).replace('/home/lanforge', '')
+ stderr_log_link = str(stderr_log_txt).replace('/home/lanforge', '')
+ self.html_results += """
+ | """ + str(test) + """ | """ + str(command) + """ |
+ """ + str(self.test_result) + """
+ | STDOUT | """
+ if self.test_result == "Failure":
+ self.html_results += """STDERR | """
+ elif self.test_result == "Time Out":
+ self.html_results += """STDERR | """
+ else:
+ self.html_results += """ | """
+ self.html_results += """
"""
+
+ row = [test, command, self.test_result, stdout_log_txt, stderr_log_txt]
+ self.csv_results_writer.writerow(row)
+ self.csv_results_file.flush()
+ # self.logger.info("row: {}".format(row))
+ self.logger.info("test: {} executed".format(test))
+
+ else:
+ self.logger.info(
+ "enable value {} invalid for test: {}, test skipped".format(self.test_dict[test]['enabled'], test))
+ self.finish_html_results()
+
+
+def main():
+ # arguments
+ parser = argparse.ArgumentParser(
+ prog='lf_check.py',
+ formatter_class=argparse.RawTextHelpFormatter,
+ epilog='''\
+ lf_check.py : running scripts listed in .ini or .json
+ ''',
+ description='''\
+lf_check.py
+-----------
+
+Summary :
+---------
+running scripts listed in .ini or .json
+
+Example :
+./lf_check.py --json lf_check_test.json --suite suite_two
+---------
+ ''')
+
+ parser.add_argument('--ini', help="--ini default lf_check_config.ini",
+ default="lf_check_config.ini")
+ parser.add_argument('--dir', help="--dir ", default="lf_check")
+ parser.add_argument('--path', help="--path ", default="/home/lanforge/html-results")
+ parser.add_argument('--json', help="--json ", default="lf_check_config.json")
+ parser.add_argument('--use_json', help="--use_json FLAG DEPRECATED", action='store_true')
+ parser.add_argument('--suite', help="--suite default TEST_DICTIONARY", default="TEST_DICTIONARY")
+ parser.add_argument('--production', help="--production stores true, sends email results to production email list",
+ action='store_true')
+ parser.add_argument('--outfile', help="--outfile