Skip to content

IxNetwork Utility Scripts

Hubert Gee edited this page Feb 9, 2018 · 2 revisions

MonitorTraffic.py

Description:

Monitor specified Traffic Item by its name and/or monitor protocol sessions up/down (flapping)
and send email alerts if the frames delta counter is equal or greater than
the user defined threshold value.

A separate email alert is sent foreach unique Traffic Item and protocol session.

Supports single session Windows and Linux API server. If monitoring a session on Linux API Server,
include parameter -apiKey <apiKey> and -sessionId <sessionId>

Features:
- Traffic Item monitoring.
  - Monitor one or more Traffic Items.
  - Monitor protocol sessions also on a sepate termianl.
  - Use regex for -trafficName input.
  - Set frame loss threshold.
  - Stats includes:
       - timestamp, trafficItemName, packetLossDuration, txLineRate, rxLineRate, lossFramesDelta
  - For protocol session monitoring, set protocol session flapping threshold.
  - Send email alerts for each Traffic Item if it reach the threshold.
  - Set the stat monitoring polling interval.
  - Each Traffic Item will have its own recorded stats in json file.
    The json file name is the name of the TrafficItem.stats.
- Statistics result filename: monitorTraffic.json

- Protocol Session flap monitoring.
  - Statistics result filename: monitorProtocol.json
  - On seperate terminal.
  - One or more protocols to monitor.
    Stats includes:
       - timestamp, protocol, port, flapMarker, flap, flapDelta.
  - Available protocols: bgp, ospf, isis, igmp, pim, mld
  - Each port/protocol will send it's own threshold alert.
  - Each protocol will have its own recorded stats.
    The text file name is the name of the protocol.stats.

  Time       Protocol  Port                 Up    Down   FlapMarker  Flapped   FlapDelta
  ---------------------------------------------------------------------------------------
  19:45:55   BGP       1/1                  3     0      8           18        10
  19:45:55   BGP       2/1                  3     0      8           18        10

Command Line Parameters:

   For help:
      Enter: python monitorTraffic.py help

   For monitoring Traffic Items:
      To show a list of configured Traffic Items:
          Enter: python monitorTraffic.py -showTrafficItemNames

      Enter: python monitorTraffic.py -apiServerIp 192.168.70.127 -trafficName 'traf.*1 traf.*2' -frameLossThreshold 500 -recordStatsToFile

   For monitoring protocol session flappings:
      Enter: python monitorTraffic.py -apiServerIp 192.168.70.127 -protocolSessions "bgp" -frameLossThreshold 2 -recordStatsToFile

Back to top

convertIxncfgToJson.py

Description                                                                                                                                              
                                                                                                                                                     
This script converts .ixncfg configurations to a JSON config file:                                                                                   
                                                                                                                                                     
- All converted filenames are the same names as the original .ixncfg config file with the .json extension.                                           
- All converted JSON config files are stored in the user defined variable destinationPath.                                                           
- You provide a list of folders containing .ixncfg config files and this script will convert all .ixncfg                                             
  config files in it.                                                                                                                                
- You could also provide a list of .ixncfg config files including its path.                                                                          
                                                                                                                                                     
This script could connect to any IxNetwork API servers: Windows or Linux.                                                                            
                                                                                                                                                     
    1> It will load each .ixncfg file (Takes approximately a minute to load).                                                                        
    2> Verify port state if the ports are being connected to the chassis and ports.                                                                  
    3> If ports are not assigned, then the port verification will be skipped.                                                                        
    4> Export the loaded configuration to a JSON config file.                                                                                        
                                                                                                                                                     

Variables                                                                                                                                                
                                                                                                                                                     
    destinationPath: The location to store all the converted .json config files                                                                          
                                                                                                                                                     
    ixncfgFolder: Provide a list of all the folders with .ixncfg config files.                                                                           
                  This script will automatically convert all .ixncfg in each folder.                                                                     
                  Leave variable empty if none.                                                                                                          
                                                                                                                                                     
    ixncfgFiles:  Provide a list of all the .ixncfg files including its path.                                                                            
                  Leave variable empty if none.                                                                                                          

Back to top

verifyPortLicense.py

Description
Verify port license availability.
Supports retrieving license check on Linux chassis and Windows.
For Windows, you must install SSH first.

Usage:

   import verifyPortLicense

   licenseObj = verifyPortLicense.Connect(platform='chassis', licenseServerIp=ip, username='admin', password='admin', licenseModel='VM-IXN-TIER3')
   licenseObj = verifyPortLicense.Connect(platform='windows', licenseServerIp=ip, username='user1', password='password', licenseModel='VM-IXN-TIER3')
   availablePortLiceneses = licenseObj.areThereEnoughLicenses(2)

Back to top

ixVmChassisBuilderRestApi.py

DESCRIPTION

This script assumes that you already imported the ixVM chassis and ixVM modules on either a VMWare ESX Host or KVM Host.

This script will add or remove vChassis and vLMs on a specified IxNetwork API server using ReST APIs.

Operates in two modes:

   1> Interactive mode: Will ask you all the necessary questions to add
      the vChassis and vLMs on your IxNetwork API server.

   2> Non-Interactive mode: Will not ask you any questions. 
      Requires you to fill out the ixvmParams.py file.

NOTE:
   For adding: This script will check for residual hypervisors and cards.
               Remove all before adding. Otherwise, adding new cardID will fail.

USAGE:

 Non-Interactive mode: This script will read all the parameters/values from ixvmParams.py and do it.
                       You must have the ixvmParams.py file in the same path as ixVmChassisBuilder.py

     Enter: python ixVmChassisBuilder.py add|remove

 Interactive mode: Ask questions. 
     Enter: python ixVmChassisBuilder.py

Back to top

Clone this wiki locally