################################################################################ # # # Copyright 1997 - 2020 by IXIA Keysight # # All Rights Reserved. # # # ################################################################################ ################################################################################ # # # LEGAL NOTICE: # # ============== # # The following code and documentation (hereinafter "the script") is an # # example script for demonstration purposes only. # # The script is not a standard commercial product offered by Ixia and have # # been developed and is being provided for use only as indicated herein. The # # script [and all modifications enhancements and updates thereto (whether # # made by Ixia and/or by the user and/or by a third party)] shall at all times # # remain the property of Ixia. # # # # Ixia does not warrant (i) that the functions contained in the script will # # meet the users requirements or (ii) that the script will be without # # omissions or error-free. # # THE SCRIPT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND IXIA # # DISCLAIMS ALL WARRANTIES EXPRESS IMPLIED STATUTORY OR OTHERWISE # # INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF MERCHANTABILITY AND FITNESS FOR # # A PARTICULAR PURPOSE OR OF NON-INFRINGEMENT. # # THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SCRIPT IS WITH THE # # USER. # # IN NO EVENT SHALL IXIA BE LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING # # OUT OF THE USE OF OR THE INABILITY TO USE THE SCRIPT OR ANY PART THEREOF # # INCLUDING BUT NOT LIMITED TO ANY LOST PROFITS LOST BUSINESS LOST OR # # DAMAGED DATA OR SOFTWARE OR ANY INDIRECT INCIDENTAL PUNITIVE OR # # CONSEQUENTIAL DAMAGES EVEN IF IXIA HAS BEEN ADVISED OF THE POSSIBILITY OF # # SUCH DAMAGES IN ADVANCE. # # Ixia will not be required to provide any software maintenance or support # # services of any kind (e.g. any error corrections) in connection with the # # script or any part thereof. The user acknowledges that although Ixia may # # from time to time and in its sole discretion provide maintenance or support # # services for the script any such services are subject to the warranty and # # damages limitations set forth herein and will not obligate Ixia to provide # # any additional maintenance or support services. # # # ################################################################################ ################################################################################ # # # Description: # # This script intends to demonstrate how to configure ESMC using perl. # # Users are expected to run this against a b2b configuration or a DUT. # # # # About Topology: # # # # On the port, configure an ESMC topology with Extended Quality Level # # enabled. Configure other relevant parameter values.Run the protocol # # and check stats # # # # Script Flow: # # 1. Configuration of protocols as described in topology. # # 2. Start the ESMC protocol. # # 3. Retrieve protocol statistics. # # 4. Stop all protocols. # # # # Ixia Software: # # IxOS 9.10 EB # # IxNetwork 9.10 EB # # # ################################################################################ ################################################################################ # Please ensure that PERL5LIB environment variable is set properly so that # # IxNetwork.pm module is available. IxNetwork.pm is generally available in # # C:\\API\Perl # ################################################################################ use IxNetwork; use strict; sub assignPorts { my @my_resource = @_; my $ixNet = $my_resource[0]; my $chassis1 = $my_resource[1]; my $card1 = $my_resource[2]; my $port1 = $my_resource[3]; my $vport1 = $my_resource[4]; my $root = $ixNet->getRoot(); my $chassisObj1 = $ixNet->add($root.'/availableHardware', 'chassis'); $ixNet->setAttribute($chassisObj1, '-hostname', $chassis1); $ixNet->commit(); $chassisObj1 = ($ixNet->remapIds($chassisObj1))[0]; my $cardPortRef1 = $chassisObj1.'/card:'.$card1.'/port:'.$port1; $ixNet->setMultiAttribute($vport1, '-connectedTo', $cardPortRef1, '-rxMode', 'captureAndMeasure', '-name', 'Ethernet - 001'); $ixNet->commit(); } # Script Starts print("!!! Test Script Starts !!!\n"); # Edit this variables values to match your setup my $ixTclServer = '10.39.50.134'; my $ixTclPort = '8779'; my @ports = (('10.39.50.126', '1', '1')); # Spawn a new instance of IxNetwork object. my $ixNet = new IxNetwork(); print("Connect to IxNetwork Tcl server\n"); $ixNet->connect($ixTclServer, '-port', $ixTclPort, '-version', '9.10', '-setAttribute', 'strict'); print("Creating a new config\n"); $ixNet->execute('newConfig'); print("Adding a vport\n"); $ixNet->add($ixNet->getRoot(), 'vport'); $ixNet->commit(); my @vPorts = $ixNet->getList($ixNet->getRoot(), 'vport'); my $vportTx = $vPorts[0]; assignPorts($ixNet, @ports, $vportTx); sleep(5); print("Adding a topology\n"); $ixNet->add($ixNet->getRoot(), 'topology', '-vports', $vportTx); $ixNet->commit(); my @topologies = $ixNet->getList($ixNet->getRoot(), 'topology'); my $topo1 = $topologies[0]; print("Adding a device group\n"); $ixNet->add($topo1, 'deviceGroup'); $ixNet->commit(); my @t1devices = $ixNet->getList($topo1, 'deviceGroup'); my $t1dev1 = $t1devices[0]; print("Configuring the multipliers (number of sessions)\n"); $ixNet->setAttribute($t1dev1, '-multiplier', '1'); $ixNet->commit(); print("Adding ethernet/mac endpoints\n"); $ixNet->add($t1dev1, 'ethernet'); $ixNet->commit(); my $mac1 = ($ixNet->getList($t1dev1, 'ethernet'))[0]; print("Configuring the mac addresses\n"); $ixNet->setMultiAttribute($ixNet->getAttribute($mac1, '-mac').'/counter', '-direction', 'increment', '-start', '00:11:01:00:00:01', '-step', '00:00:00:00:00:01'); $ixNet->commit(); print("Add esmc\n"); $ixNet->add($mac1, 'esmc'); $ixNet->commit(); my $esmc1 = ($ixNet->getList($mac1, 'esmc'))[0]; $ixNet->commit(); ############################################################################ #OTF changing the ESMC parameters ############################################################################ print("Enabling Extended QL level and changing ESMC parameter values \n"); my $ql = $ixNet->getAttribute($esmc1, '-qualityLevel'); my $extql = $ixNet->getAttribute($esmc1, '-extendedQlTlvEnable'); my $syncE = $ixNet->getAttribute($esmc1, '-enableCustomSyncEclockIdentity'); my $custSyncE = $ixNet->getAttribute($esmc1, '-customSyncEclockIdentity'); my $eeecs = $ixNet->getAttribute($esmc1, '-numberOfCascadedEeecs'); $ixNet->setAttribute($extql.'/singleValue', '-value', 'true'); $ixNet->setAttribute($ql.'/singleValue', '-value', 'ql_eprtc_op1'); $ixNet->setAttribute($syncE.'/singleValue', '-value', 'true'); $ixNet->setAttribute($custSyncE.'/singleValue', '-value', '2202AAFD055556'); $ixNet->setAttribute($eeecs.'/singleValue', '-value', '78'); $ixNet->commit(); ################################################################################ # Start ESMC protocol and wait for 30 seconds # ################################################################################ print("Starting protocols and waiting for 45 seconds for protocols to come up\n"); $ixNet->execute('startAllProtocols'); sleep(30); ################################################################################ # Retrieve protocol statistics # ################################################################################ print("Fetching all Protocol Summary Stats\n"); my $viewPage = '::ixNet::OBJ-/statistics/view:"ESMC Per Port"/page'; my @statcap = $ixNet->getAttribute($viewPage, '-columnCaptions'); my @rowvals = $ixNet->getAttribute($viewPage, '-rowValues'); my $index = 0; my $statValueList= ''; foreach $statValueList (@rowvals) { print("***************************************************\n"); my $statVal = ''; foreach $statVal (@$statValueList) { my $statIndiv = ''; $index = 0; foreach $statIndiv (@$statVal) { printf(" %-30s:%s\n", $statcap[$index], $statIndiv); $index++; } } } print("***************************************************\n"); ################################################################################ # Stop all protocols # ################################################################################ print("Stopping All Protocols"); $ixNet->execute('stopAllProtocols'); print("!!! Test Script Ends !!!");