xenamanager package¶
xenamanager.xena_app module¶
Classes and utilities that represents Xena XenaManager-2G application and chassis.
author: | yoram@ignissoft.com |
---|
-
class
xenamanager.xena_app.
XenaApp
(logger, owner, api_wrapper)[source]¶ Bases:
trafficgenerator.tgn_app.TgnApp
XenaManager object, equivalent to XenaManager-2G application.
-
class
xenamanager.xena_app.
XenaChassis
(parent, ip, port=22611, password='xena')[source]¶ Bases:
xenamanager.xena_object.XenaObject
Represents single Xena chassis.
-
get_session_id
()[source]¶ Get ID of the current automation session on the chassis.
Note that this ID can be different for different chassis on the same session.
Returns: chassis ID.
-
info_config_commands
= ['c_info', 'c_config']¶
-
inventory
(modules_inventory=False)[source]¶ Get chassis inventory.
Parameters: modules_inventory – True - read modules inventory, false - don’t read.
-
modules
¶ Returns: dictionary {index: object} of all modules.
-
ports
¶ Returns: dictionary {name: object} of all ports.
-
release_ports
()[source]¶ Release all ports that were reserved during the session.
XenaManager-2G -> Release Ports.
-
reserve_ports
(locations, force=False, reset=True)[source]¶ Reserve ports and reset factory defaults.
XenaManager-2G -> Reserve/Relinquish Port. XenaManager-2G -> Reset port.
Parameters: - locations – list of ports locations in the form <module/port> to reserve
- force – True - take forcefully, False - fail if port is reserved by other user
- reset – True - reset port, False - leave port configuration
Returns: ports dictionary (index: object)
-
start_traffic
(blocking=False, *ports)[source]¶ Start traffic on list of ports.
Parameters: - blocking – True - start traffic and wait until traffic ends, False - start traffic and return.
- ports – list of ports to start traffic on. Default - all session ports.
-
-
class
xenamanager.xena_app.
XenaModule
(parent, index)[source]¶ Bases:
xenamanager.xena_object.XenaObject
Represents Xena module.
-
info_config_commands
= ['m_info', 'm_config', 'm_portcount']¶
-
ports
¶ Returns: dictionary {index: object} of all ports.
-
-
class
xenamanager.xena_app.
XenaSession
(logger, owner, api)[source]¶ Bases:
xenamanager.xena_object.XenaObject
Xena scripting object. Root object for the Xena objects tree.
-
add_chassis
(chassis, port=22611, password='xena')[source]¶ Add chassis.
XenaManager-2G -> Add Chassis.
Parameters: - chassis – chassis IP address
- port – chassis port number
- password – chassis password
Returns: newly created chassis
Return type:
-
chassis_list
¶ Returns: dictionary {name: object} of all chassis.
-
clear_stats
(*ports)[source]¶ Clear stats (TX and RX) for list of ports.
Parameters: ports – list of ports to clear stats on. Default - all session ports.
-
ports
¶ Returns: dictionary {name: object} of all ports.
-
release_ports
()[source]¶ Release all ports that were reserved during the session.
XenaManager-2G -> Release Ports.
-
reserve_ports
(locations, force=False, reset=True)[source]¶ Reserve ports and reset factory defaults.
XenaManager-2G -> Reserve/Relinquish Port. XenaManager-2G -> Reserve Port.
Parameters: - locations – list of ports locations in the form <ip/slot/port> to reserve
- force – True - take forcefully. False - fail if port is reserved by other user
- reset – True - reset port, False - leave port configuration
Returns: ports dictionary (index: object)
-
start_capture
(*ports)[source]¶ Start capture on list of ports.
Parameters: ports – list of ports to start capture on. Default - all session ports.
-
start_traffic
(blocking=False, *ports)[source]¶ Start traffic on list of ports.
Parameters: - blocking – True - start traffic and wait until traffic ends, False - start traffic and return.
- ports – list of ports to start traffic on. Default - all session ports.
-
xenamanager.xena_object module¶
Base classes and utilities for all Xena Manager (Xena) objects.
author: | yoram@ignissoft.com |
---|
-
class
xenamanager.xena_object.
XenaObject
(**data)[source]¶ Bases:
trafficgenerator.tgn_object.TgnObject
-
get_attribute
(attribute)[source]¶ Returns single object attribute.
Parameters: attribute – requested attribute to query. Returns: returned value. Return type: str
-
get_attributes
()[source]¶ Returns all object’s attributes.
Returns: dictionary of <name, value> of all attributes. Return type: dict of (str, str)
-
id
¶ Returns: object ID.
-
index
¶ Returns: object index.
-
send_command
(command, *arguments)[source]¶ Send command with no output.
Parameters: - command – command to send.
- arguments – list of command arguments.
-
send_command_return_multilines
(command, *arguments)[source]¶ Send command and wait for multiple lines output.
-
xenamanager.xena_port module¶
Classes and utilities that represents Xena XenaManager-2G port.
author: | yoram@ignissoft.com |
---|
-
class
xenamanager.xena_port.
XenaCapture
(parent)[source]¶ Bases:
xenamanager.xena_object.XenaObject
Represents capture parameters, correspond to the Capture panel of the XenaManager, and deal with configuration of the capture criteria and inspection of the captured data from a port.
-
get_packets
(from_index=0, to_index=None, cap_type=<XenaCaptureBufferType.text: 1>, file_name=None, tshark=None)[source]¶ Get captured packets from chassis.
Parameters: - from_index – index of first packet to read.
- to_index – index of last packet to read. If None - read all packets.
- cap_type – returned capture format. If pcap then file name and tshark must be provided.
- file_name – if specified, capture will be saved in file.
- tshark – tshark object for pcap type only.
Type: xenamanager.xena_tshark.Tshark
Returns: list of requested packets, None for pcap type.
-
info_config_commands
= ['pc_fullconfig']¶
-
packets
¶ Returns: dictionary {id: object} of all packets. Return type: dict of (int, xenamanager.xena_port.XenaCapturePacket)
-
-
class
xenamanager.xena_port.
XenaCaptureBufferType
[source]¶ Bases:
enum.Enum
-
pcap
= 2¶
-
raw
= 0¶
-
text
= 1¶
-
-
class
xenamanager.xena_port.
XenaCapturePacket
(parent, index)[source]¶ Bases:
xenamanager.xena_object.XenaObject21
-
info_config_commands
= ['pc_info']¶
-
-
class
xenamanager.xena_port.
XenaPort
(parent, index)[source]¶ Bases:
xenamanager.xena_object.XenaObject
Represents Xena port.
-
add_stream
(name=None, tpld_id=None, state=<XenaStreamState.enabled: 'ON'>)[source]¶ Add stream.
Parameters: - name – stream description.
- tpld_id – TPLD ID. If None the a unique value will be set.
- state (xenamanager.xena_stream.XenaStreamState) – new stream state.
Returns: newly created stream.
Return type:
-
capture
¶ Returns: capture object. Return type: XenaCapture
-
clear_stats
()[source]¶ Clear att TX and RX statistics counter.
Port Statistics -> Clear TX Counters, Clear RX Counters
-
info_config_commands
= ['p_info', 'p_config', 'p_receivesync', 'ps_indices', 'pr_tplds']¶
-
load_config
(config_file_name)[source]¶ Load configuration file from xpc file.
Parameters: config_file_name – full path to the configuration file.
-
read_port_stats
()[source]¶ Returns: dictionary {group name {stat name: value}}. Sea XenaPort.stats_captions.
-
read_stream_stats
()[source]¶ Returns: dictionary {stream index {stat name: value}}. Sea XenaStream.stats_captions.
-
read_tpld_stats
()[source]¶ Returns: dictionary {tpld index {group name {stat name: value}}}. Sea XenaTpld.stats_captions.
-
reserve
(force=False)[source]¶ Reserve port.
XenaManager-2G -> Reserve/Relinquish Port.
Parameters: force – True - take forcefully, False - fail if port is reserved by other user
-
reset
()[source]¶ Reset port-level parameters to standard values, and delete all streams, filters, capture, and dataset definitions.
-
save_config
(config_file_name)[source]¶ Save configuration file to xpc file.
Parameters: config_file_name – full path to the configuration file.
-
start_traffic
(blocking=False)[source]¶ Start port traffic.
Port -> Start Traffic
Parameters: blocking – True - start traffic and wait until traffic ends, False - start traffic and return.
-
streams
¶ Returns: dictionary {id: object} of all streams. Return type: dict of (int, xenamanager.xena_stream.XenaStream)
-
tplds
¶ Returns: dictionary {id: object} of all current tplds. Return type: dict of (int, xenamanager.xena_port.XenaTpld)
-
-
class
xenamanager.xena_port.
XenaTpld
(parent, index)[source]¶ Bases:
xenamanager.xena_object.XenaObject21
-
read_stats
()[source]¶ Returns: dictionary {group name {stat name: value}}. Sea XenaTpld.stats_captions.
-
xenamanager.xena_statistics_view module¶
Classes and utilities that represents Xena statistics as tables like the GUI.
Statistics views represent statistics as tables. There are three different views - ports, streams and TPLD.
author: | yoram@ignissoft.com |
---|
-
class
xenamanager.xena_statistics_view.
XenaPortsStats
(session)[source]¶ Bases:
xenamanager.xena_statistics_view.XenaStats
Ports statistics view.
Represents all ports statistics as multi table:
Port Name Group Group … Name Name … Name Name … … IP/Module/Port value value … Name Name … … IP/Module/Port value value … Name Name … …
-
class
xenamanager.xena_statistics_view.
XenaStats
(session)[source]¶ Bases:
object
Base class for all statistics views.
-
class
xenamanager.xena_statistics_view.
XenaStreamsStats
(session)[source]¶ Bases:
xenamanager.xena_statistics_view.XenaStats
Streams statistics view.
Represents all streams statistics as table:
Stream tx rx TPLD TPLD Group Group Group Group Name … Name … Name … Name … Name … Object value … value … value … value … value … Object value … value … value … value … value …
-
class
xenamanager.xena_statistics_view.
XenaTpldsStats
(session)[source]¶ Bases:
xenamanager.xena_statistics_view.XenaStats
TPLDs statistics view.
Represents all TPLDs statistics as multi column table:
TPLD Full Index Group Group … Name Name … Name Name … … Module/Port/Index value value … Name Name … … Module/Port/Index value value … Name Name … …
xenamanager.xena_stream module¶
Classes and utilities that represents Xena XenaManager-2G stream.
author: | yoram@ignissoft.com |
---|
-
class
xenamanager.xena_stream.
XenaModifier
(parent, index)[source]¶ Bases:
xenamanager.xena_stream._XenaModifierBase
-
info_config_commands
= ['ps_modifier', 'ps_modifierrange']¶
-
-
class
xenamanager.xena_stream.
XenaModifierAction
[source]¶ Bases:
enum.Enum
-
decrement
= 'DEC'¶
-
increment
= 'INC'¶
-
random
= 'RANDOM'¶
-
-
class
xenamanager.xena_stream.
XenaModifierType
[source]¶ Bases:
enum.Enum
-
extended
= 1¶
-
standard
= 0¶
-
-
class
xenamanager.xena_stream.
XenaStream
(parent, index, name='')[source]¶ Bases:
xenamanager.xena_object.XenaObject21
-
add_modifier
(m_type=<XenaModifierType.standard: 0>, **kwargs)[source]¶ Add modifier.
Parameters: m_type – modifier type - standard or extended. Type: xenamanager.xena_stram.ModifierType Returns: newly created modifier. Return type: xenamanager.xena_stream.XenaModifier
-
create_command
= 'ps_create'¶
-
get_packet_headers
()[source]¶ Returns: current packet headers Return type: pypacker.layer12.ethernet.Ethernet
-
info_config_commands
= ['ps_config']¶
-
modifiers
¶ Returns: dictionary {index: object} of standard modifiers.
-
next_tpld_id
= 0¶
-
remove_modifier
(index, m_type=<XenaModifierType.standard: 0>)[source]¶ Remove modifier.
Parameters: - m_type – modifier type - standard or extended.
- index – index of modifier to remove.
-
set_packet_headers
(headers)[source]¶ Set packet header.
The method will try to set ps_headerprotocol to inform the Xena GUI and tester how to interpret the packet header byte sequence specified with PS_PACKETHEADER. This is mainly for information purposes, and the stream will transmit the packet header bytes even if no protocol segments are specified. If the method fails to set some segment it will log a warning and skip setup.
Parameters: headers (pypacker.layer12.ethernet.Ethernet) – current packet headers
-
xmodifiers
¶ Returns: dictionary {index: object} of extended modifiers.
-