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.
read_stats()[source]
Returns:dictionary {own: {stat name: value}}
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.
stats_captions = ['ses', 'typ', 'adr', 'own', 'ops', 'req', 'rsp']
stop_traffic(*ports)[source]

Stop traffic on list of ports.

Parameters:ports – list of ports to stop traffic on. Default - all session ports.
wait_traffic(*ports)[source]

Wait until traffic stops on ports.

Parameters:ports – list of ports to wait for.
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']
inventory()[source]

Get module inventory.

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:

xenamanager.xena_app.XenaChassis

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.
disconnect()[source]

Release ports and disconnect from all chassis.

inventory()[source]

Get inventory for all chassis.

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.
stop_capture(*ports)[source]

Stop capture on list of ports.

Parameters:ports – list of ports to stop capture on. Default - all session ports.
stop_traffic(*ports)[source]

Stop traffic on list of ports.

Parameters:ports – list of ports to stop traffic on. Default - all session ports.
xenamanager.xena_app.init_xena(api, logger, owner, ip=None, port=57911)[source]

Create XenaManager object.

Parameters:
  • api – cli/rest
  • logger – python logger
  • owner – owner of the scripting session
  • ip – rest server IP
  • port – rest server TCP port
Returns:

Xena object

Return type:

XenaApp

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.
obj_id()[source]
Returns:object ID.
obj_index()[source]
Returns:object index.
read_stat(captions, stat_name)[source]
send_command(command, *arguments)[source]

Send command with no output.

Parameters:
  • command – command to send.
  • arguments – list of command arguments.
send_command_return(command, *arguments)[source]

Send command and wait for single line output.

send_command_return_multilines(command, *arguments)[source]

Send command and wait for multiple lines output.

set_attributes(**attributes)[source]

Sets list of attributes.

Parameters:attributes – dictionary of {attribute: value} to set.
wait_for_states(attribute, timeout=40, *states)[source]
class xenamanager.xena_object.XenaObject21(**data)[source]

Bases: xenamanager.xena_object.XenaObject

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)
read_stats()[source]
Returns:dictionary {stat name: value}. Sea XenaCapture.stats_captions.
stats_captions = ['status', 'packets', 'starttime']
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:
Returns:

newly created stream.

Return type:

xenamanager.xena_stream.XenaStream

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']
inventory()[source]
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.
release()[source]
relinquish()[source]
remove_stream(index)[source]

Remove stream.

Parameters:index – index of stream to remove.
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_capture()[source]

Start capture on port.

Capture -> Start Capture

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.
stats_captions = {'pr_extra': ['fcserrors', 'pauseframes', 'arprequests', 'arpreplies', 'pingrequests', 'pingreplies', 'gapcount', 'gapduration'], 'pr_notpld': ['bps', 'pps', 'bytes', 'packets'], 'pr_pfcstats': ['total', 'CoS 0', 'CoS 1', 'CoS 2', 'CoS 3', 'CoS 4', 'CoS 5', 'CoS 6', 'CoS 7'], 'pr_total': ['bps', 'pps', 'bytes', 'packets'], 'pt_extra': ['arprequests', 'arpreplies', 'pingrequests', 'pingreplies', 'injectedfcs', 'injectedseq', 'injectedmis', 'injectedint', 'injectedtid', 'training'], 'pt_notpld': ['bps', 'pps', 'bytes', 'packets'], 'pt_total': ['bps', 'pps', 'bytes', 'packets']}
stop_capture()[source]

Stop capture on port.

Capture -> Stop Capture

stop_traffic()[source]

Stop port traffic.

Port -> Stop Traffic

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)
wait_for_up(timeout=40)[source]
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.
stats_captions = {'pr_tplderrors': ['dummy', 'seq', 'mis', 'pld'], 'pr_tpldjitter': ['min', 'avg', 'max', 'avg1sec', 'min1sec', 'max1sec'], 'pr_tpldlatency': ['min', 'avg', 'max', 'avg1sec', 'min1sec', 'max1sec'], 'pr_tpldtraffic': ['bps', 'pps', 'byt', 'pac']}

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
read_stats()[source]

Read current ports statistics from chassis.

Returns:dictionary {port name {group name, {stat name: stat value}}}
class xenamanager.xena_statistics_view.XenaStats(session)[source]

Bases: object

Base class for all statistics views.

get_flat_stats()[source]
Returns:statistics as flat table {port/strea,/tpld name {group_stat name: value}}
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
get_flat_stats()[source]
Returns:statistics as flat table {port/strea,/tpld name {group_stat name: value}}
read_stats()[source]

Read current statistics from chassis.

Returns:dictionary {stream: {tx: {stat name: stat value}} rx: {tpld: {stat group {stat name: 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
read_stats()[source]

Read current statistics from chassis.

Returns:dictionary {tpld full index {group name {stat name: stat value}}}

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'
del_object_from_parent()[source]

Delete object from parent object.

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
read_stats()[source]
Returns:dictionary {stat name: value} See XenaStream.stats_captions
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
set_state(state)[source]

Set stream state.

Parameters:state – new stream state.
stats_captions = ['bps', 'pps', 'bytes', 'packets']
xmodifiers
Returns:dictionary {index: object} of extended modifiers.
class xenamanager.xena_stream.XenaStreamState[source]

Bases: enum.Enum

disabled = 'OFF'
enabled = 'ON'
suspended = 'SUPPRESS'
class xenamanager.xena_stream.XenaXModifier(parent, index)[source]

Bases: xenamanager.xena_stream._XenaModifierBase

info_config_commands = ['ps_modifierext', 'ps_modifierextrange']