kaisero / fireREST

Python library for interacting with Cisco Firepower Management Center REST API
GNU General Public License v3.0
70 stars 49 forks source link

How to Deploy #64

Open jasonyates opened 2 years ago

jasonyates commented 2 years ago

Are there any code examples available for best practice on how to check if changes made to FMC and deployable and to trigger a deployment?

kaisero commented 2 years ago

There is currently no detailed documentation available. I plan to create doc samples for the upcoming release which should arrive by the end of March

iurikura commented 2 years ago

I did a quick try with interaction shell with single ftd device. *Not considered about complex topology and errer handling. Minimal fields have not been scrutinized for fields in the data payload. I am also looking forward more detailed documentation from the author for deployment.

How to get deployable devices

>>> dd = fmc.deployment.deployabledevices.get()
>>> print(dd)
[{'isDeploying': False, .....(snip).....
>>> print(dd[0]['device']['id'])
1fae3094-b632-11ec-87bd-eb4724961310

How to deploy

>>> from datetime import datetime
>>> data = {
...     "type": "DeploymentRequest",
...     "version": datetime.now().strftime('%s') + "000",
...     "forceDeploy": True,
...     "ignoreWarning": True,
...     "deviceList": [
...        "1fae3094-b632-11ec-87bd-eb4724961310"
...     ]
... }
>>> request = fmc.deployment.deploymentrequest.create(data=data)

Confirmation

>>> dd = fmc.deployment.deployabledevices.get()
>>> print(dd)
[{'isDeploying': True, .....(snip).....