iktool (Indeni Knowledge Tool)

Deployment

  1. Download the iktool from this page: https://indeni.atlassian.net/wiki/pages/viewpageattachments.action?pageId=1033503118 and copy to /usr/bin

  2. (Optional) To enable tab-completion install the python module argcomplete as follows.

    1. Download argcomplete package (sudo pip3 install argcomplete)

    2. Add the following line to the end of the file ~/.bashrc to tell bash that it should auto complete for iktool:
      eval "$(register-python-argcomplete iktool)"

    3. Run the following command to refresh bash and enable the tab completion
      source ~/.bashrc

Compilation

Python is generally not a compiled language, however we wish to create a portable binary file for use on our Linux servers. To accomplish this, we use the tool pyinstaller.

Required only at the first time the virtual env is created

  1. Create a directory for your virtual environment

  2. Create a virtual environment and activate it (only need to create it the first time you compile)
    virtualenv -p python3 ~/virtualenv/iktool

  3. Activate the virtual environment
    source ~/virtualenv/iktool/bin/activate

  4. Install the dependencies
    pip3 install -r ~/<your_path>/indeni-knowledge/scripts/iktool.deploy/requirements.txt

  5. Install pyinstaller
    pip3 install pyinstaller

  6. deactivate

iktool compilation

  1. source ~/virtualenv/iktool/bin/activate

  2. Compile
    pyinstaller ~/indeni-knowledge/scripts/iktool.deploy/iktool.py -F
    Compiled file is located in /Users/<username>/dist/iktool

Run iktool --help.
If the usage is printed, the compilation was successful.

Examples

  1. Config file (for running workflow/block on real device)

workflow: "" # path to the workflow in question device_ip: "" # IP address of device to run on device_vendor: "" # either "checkpoint" or "paloaltonetworks" device_os_version: "" # E.g., "R80.20" or "9.0.4" device_user: "" device_pass: "" # Comment out the below if you don't need issue items issue_items: - "item1" - "item2" - "another_item" # This section is only needed when running a specific block block: "" # name of the block to run scope: # dictionary of variable name to variable values var1: "some value" var2: 25

2. Data file (for running workflow/block on mock data)

workflow: "" # path to the workflow in question pairs: "command 1 (quotes around key allow spaces)": |+ Mutli Line Output 1 "command 2": "single-line output 2" tags: # The tags of the "device" to simulate vendor: "checkpoint" os.name: "gaia" os.version: R77.30 scope: # Optional section, useful when running just a single block uptime_result: "sample" block: "sample" # Optional key, useful when running just a single block