nefila package

Submodules

nefila.fortigate module

class nefila.fortigate.ApiUser(session, timeout, base_url, name)

Bases: object

List and configure API users.

Default API user is nefila-api-admin using super_admin profile and trusted hosts 192.168.0.0/16.

Usage:

device.system.api_user.list() device.system.api_user.create() device.system.api_user.token device.system.api_user.get() device.system.api_user.delete()

device.system.api_user.name = ‘custom-api-admin’ device.system.api_user.create(accprofile=’prof_admin’,

ipv4_trusthost=’192.0.2.0/24’)

create(accprofile='super_admin', ipv4_trusthosts=['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'], vdom='root')

Create a new API user and generate an access key

delete()

Delete API user

get()

Get details of a specific API user

list()

List all API users

class nefila.fortigate.Config(session, timeout, base_url)

Bases: object

Manage system configuration

Usage:

device.system.config.restore(filename=’config.cfg’) device.system.config.restore(filename=’config.cfg’) device.system.config.backup(filename=’config.cfg’) device.system.config.backup(filename=’config.cfg’, vdom=’vd01’)

restore(filename=None, config_id=None)

Restore system configuration from uploaded file

class nefila.fortigate.ConfigRevision(session, timeout, base_url)

Bases: object

Manage system configuration

Usage:

device.system.config_revision.create() device.system.config_revision.list()

list()

Return a list of system configuration revisions

class nefila.fortigate.DnsDatabase(session, timeout, base_url, name, device)

Bases: object

Add or check records on the DNS Database.

Usage:

device.system.dns_database.list() device.system.dns_database.name = ‘exampleZone’ device.system.dns_database.create() device.system.dns_database.add(ip=’192.2.0.1’, hostname=’example’) device.system.dns_database.get().json() device.system.dns_database.delete()

add(ip, hostname)

Add a new entry on a specific existing DNS Zone, preserving existing entries.

create()

Create a new DNS Zone

delete()

Delete DNS Zone

get()

Get all entries of a specific DNS Zone

list()

List all DNS zones

class nefila.fortigate.Firmware(session, timeout, base_url)

Bases: object

List and upgrade device firmware.

Usage:

device.system.firmware.list() device.system.firmware.upgrade() device.system.firmware.upgrade(‘v6.2.0’) device.system.firmware.upgrade_file(‘./var/FGT_VM64_KVM-v6-build1510-FORTINET.out’)

list()

Retrieve a list of firmware images available to use for upgrade on this device from FortiGuard

upgrade(version=None, timeout=300)

Upgrade firmware image on this device Default timeout is longer to allow firmware download from FDN

upgrade_file(filename=None, timeout=300)

Upgrade firmware image on this device using an uploaded file Default timeout is longer to allow firmware download from FDN

class nefila.fortigate.FortiGate(hostname)

Bases: object

basic_status()

Retrieve basic system status.

close()
hostname

Device hostname

license_status()

Get current license & registration status.

open(username=None, password=None, token=None, profile=None)
session

Use the same session for all requests

property status
timeout

How long to wait for the server to send data before giving up

class nefila.fortigate.Interface(session, timeout, base_url)

Bases: object

List and configure interfaces

Usage:

device.system.interface.list() device.system.interface.create() device.system.interface.get() device.system.interface.get(name=’wan1’) device.system.interface.delete()

list()

List all interfaces

class nefila.fortigate.License(session, timeout, base_url)

Bases: object

Manage VM License upload

Usage:

device.system.license.restore(filename=’license.lic’)

restore(filename=None)

Update VM license using uploaded file

class nefila.fortigate.System(session, timeout, base_url, device)

Bases: object

nefila.system module

nefila.utils module

nefila.utils.get_config(profile='DEFAULT', filename='/home/docs/.nefila/config')

Obtain config from file

nefila.utils.get_credentials(profile='DEFAULT', filename='/home/docs/.nefila/credentials')

Obtain credentials from file

nefila.utils.set_config(profile='DEFAULT', filename='/home/docs/.nefila/config', hostname='192.168.1.99')

Create config file

nefila.utils.set_credentials(profile='DEFAULT', filename='/home/docs/.nefila/credentials', username='admin', password='', token=None)

Create credential file, will overwrite if file already exist

Module contents