Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ssato/3ff8fc97f81548d1c4b37404376c84ae to your computer and use it in GitHub Desktop.
Save ssato/3ff8fc97f81548d1c4b37404376c84ae to your computer and use it in GitHub Desktop.
Demo to parse fortios 'show firewall policy' output using anyconfig_cli
ssato@x1-carbon-gen6% anyconfig_cli -L ~/repos/public/github.com/ssato/python-anyconfig-fortios-backend.git
Supported types: fortios, ini, json, pickle, properties, shellvars, toml, xml, yaml
File extensions:
ini: ini
js: std.json, simplejson
jsn: std.json, simplejson
json: std.json, simplejson
pickle: pickle
pkl: pickle
properties: properties
toml: toml
xml: xml
yaml: pyyaml, ruamel.yaml
yml: pyyaml, ruamel.yaml
IDs: fortios, ini, pickle, properties, pyyaml, ruamel.yaml, shellvars, simplejson, std.json, toml, xml
ssato@x1-carbon-gen6% anyconfig_cli tests/res/firewall_policy_20.txt -I fortios -O yaml ~/repos/public/github.com/ssato/python-anyconfig-fortios-backend.git
configs:
- config: firewall policy
edits:
- edit: '2'
name: Sample Policy
uuid: 83ca38c4-3a67-51e9-6b3e-9437f3c23e08
srcintf: lan
dstintf: wan1
srcaddr:
- N_192.168.122.0
- N_192.168.1.0
dstaddr: all
action: accept
status: enable
schedule: always
service:
- HTTP
- PING
- TRACEROUTE
session-ttl: '600'
application-list: app-sample
ssl-ssh-profile: deep-inspection
nat: enable
- comments:
- ''
- '.. seealso:: https://csps.hitachi-solutions.co.jp/fortinet/faq/FG-21-0054/'
- ''
ssato@x1-carbon-gen6% rpm -qa python3-anyconfig\* ~/repos/public/github.com/ssato/python-anyconfig-fortios-backend.git
python3-anyconfig-0.9.10-1.fc31.noarch
python3-anyconfig-fortios-backend-0.1.1-1.fc31.fc31.noarch
ssato@x1-carbon-gen6% ~/repos/public/github.com/ssato/python-anyconfig-fortios-backend.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment