Using Firepyer

Interacting

All functionailty for interacting with an FTD device is contained within the Fdm class and it’s methods. Authentication is taken care of transparently when calling a method, so this doesn’t need to be done explicitly.

class firepyer.Fdm(host: str, username: str, password: str, verify: bool = True)

Provides a connection point to an FTD device

Parameters
  • host (str) – The IP or hostname of the FTD device

  • username (str) – Username to login to FDM

  • password (str) – Password to login to FDM

  • verify (bool, optional) – Verify the SSL certificate presented by the FTD API, defaults to True

Import the Fdm class and instantiate an object, passing in your FTD hostname/IP, username and password (and ignoring SSL verification if using an untrusted/self-signed cert):

>>> from firepyer import Fdm
>>> fdm = Fdm(host='192.168.45.45', username='admin', password='Admin123', verify=False)

Then call any of the available methods to run against your FTD:

>>> fdm.get_hostname()
     'firepyer2120'
>>> fdm.get_net_objects('any-ipv4')
     {'description': None,
      'dnsResolution': None,
      'id': '00f7b297-4d44-11eb-9e04-13721b05d633',
      'isSystemDefined': True,
      'links': {'self': 'https://192.168.45.45/api/fdm/latest/object/networks/00f7b297-4d44-11eb-9e04-13721b05d633'},
      'name': 'any-ipv4',
      'subType': 'NETWORK',
      'type': 'networkobject',
      'value': '0.0.0.0/0',
      'version': 'kxd2dzxm2gtwn'}

Error Handling

Some common errors that may be encountered when using Fdm methods:

exception firepyer.exceptions.FirepyerAuthError(message)

Raised when the FTD rejects the username/password authentication

exception firepyer.exceptions.FirepyerError(message)

Raised if no more-specific exception applies, such as errors presented directly from FTD

exception firepyer.exceptions.FirepyerInvalidOption(message)

Raised when the value provided does not match the set of predefined options

exception firepyer.exceptions.FirepyerResourceNotFound(message)

Raised when an object by a given name or ID cannot be found in the FTD config

exception firepyer.exceptions.FirepyerUnreachableError(message)

Raised when the IP or hostname of the FTD device is unreachable