joaopio / samtools

Python tools for the SAM-O interface (NBI for Nokia NSP)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

samtools - Python tools for the SAM-O interface (NBI for Nokia NSP)

"samtools" is a collection of Nokia SAM-O tools in Python.

csvtool.py - CSV Tool

The csvtool can be used for automation use-cases using SAM-O.

  1. Find Requests (using XML)
$ csvtool.py -s 10.0.0.1 -u NbiUser -p p@ssw0rD --xml findEpipe.xml
  1. Find Requests (using class name, filters and result filters)
$ csvtool.py -s 10.0.0.1 -u NbiUser -p p@ssw0rD --class epipe.Epipe
$ csvtool.py -s 10.0.0.1 -u NbiUser -p p@ssw0rD --class security.Span --filter "spanId>9"
$ csvtool.py -s 10.0.0.1 -u NbiUser -p p@ssw0rD --class netw.TopologyGroup --filter "<filter><and><equal name='application' value='sam'/><not><wildcard name='description' value='Default%%'/></not><notEqual name='displayedName' value='UnmanagedNEs'/></and></filter>"
$ csvtool.py -s 10.0.0.1 -u NbiUser -p p@ssw0rD --class trapmapper.AlarmCatalogue --children

After reviewing/changing the CSV files they can be used for running batch requests against Nokia NSP. An XML file needs to be specified. Every data row of the CSV file is used to fill the XMLAPI template and is executed:

  1. Simple Request
$ csvtool.py -s 10.0.0.1 -u NbiUser -p p@ssw0rD --batch epipe.Epipe.csv --xml xml\modEpipe.xml
  1. Combine Find/Execute in one request (no need for CSV)
$ csvtool.py -s 10.0.0.1 -u NbiUser -p p@ssw0rD --class epipe.Epipe --xml xml\modEpipe.xml
  1. Improve performance using bulk size
$ csvtool.py -s 10.0.0.1 -u NbiUser -p p@ssw0rD --batch epipe.Epipe.csv --xml xml\modEpipe.xml --bulksize 100 --warn
  1. Store failed objects in another CSV file
$ csvtool.py -s 10.0.0.1 -u NbiUser -p p@ssw0rD --batch epipe.Epipe.csv --xml xml\modEpipe.xml --store

Some more options:

  • Use option "--secure" if SAM security (certificate based) is enabled.
  • Use option "--md5" if SAM user password is already md5 hashed.
  • Use option "--csv" to define output CSV file name (default is [classname].csv)
  • Use option "--help" to get some usage information
  • Use option "--delay" to slow down batch execution
  • Use option "--result -1" to define the XML hierarchy level to determine objects
  • Use option "--separator" to specify the delimiter used in CSV files
  • Use option "--interactive" to prompt interactively for username and password
  • Use option "--logfile -" to write log

About

Python tools for the SAM-O interface (NBI for Nokia NSP)

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 100.0%