Download the iktool from this page: https://indeni.atlassian.net/wiki/pages/viewpageattachments.action?pageId=1033503118 and copy to /usr/bin
(Optional) To enable tab-completion install the python module argcomplete
as follows.
Download argcomplete
package (sudo pip3 install argcomplete)
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)"
Run the following command to refresh bash and enable the tab completionsource ~/.bashrc
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
Create a directory for your virtual environment
Create a virtual environment and activate it (only need to create it the first time you compile)virtualenv -p python3 ~/virtualenv/iktool
Activate the virtual environmentsource ~/virtualenv/iktool/bin/activate
Install the dependenciespip3 install -r ~/<your_path>/indeni-knowledge/scripts/iktool.deploy/requirements.txt
Install pyinstallerpip3 install pyinstaller
deactivate
iktool compilation
source ~/virtualenv/iktool/bin/activate
Compilepyinstaller ~/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.
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 |