marksull / fmcapi

A Python package designed to help users of Cisco's FMC interface with its API.
BSD 3-Clause "New" or "Revised" License
81 stars 57 forks source link

Are there any batch add network object interfaces? #98

Open Duanexiao opened 3 years ago

Duanexiao commented 3 years ago

When I batch add 200 network objects, it takes almost 10 minutes!That's not acceptable

daxm commented 3 years ago

To my knowledge the batch function is only for Access Rules. That said, I haven't revisited the newer options in the FMC's API for 6 months or so.  If you know of some change that would allow batching of Network Objects we could look into adding it.  (Or you can.)  :-)

On 2/23/21 8:08 AM, Duanexiao wrote:

When I batch add 200 network objects, it takes almost 10 minutes!That's not acceptable

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/daxm/fmcapi/issues/98, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZOMZ3ROSIFBFSM6KLHJPTTAPAHDANCNFSM4YCUYZIQ.

caballero-oscuro commented 3 years ago

I use the 'bulk=true' parameter when posting network groups. I believe the same can be used for network objects.

def fmcapi_post_bulk(fmc, post_data): api_path = '/object/networkgroups?bulk=true' post_resp = fmc.send_to_api(method='post', url=fmc.configuration_url+api_path, json_data=post_data)

daxm commented 3 years ago

Sweet! Care to submit a PR with the code that works?

On 2/23/21 8:36 AM, caballero-oscuro wrote:

I use the 'bulk=true' parameter when posting network objects. I believe the same can be used for network objects.

|def fmcapi_post_bulk(fmc, post_data): api_path = '/object/networkgroups?bulk=true' post_resp = fmc.send_to_api(method='post', url=fmc.configuration_url+api_path, json_data=post_data)|

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/daxm/fmcapi/issues/98#issuecomment-784289545, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZOMZ6NHGWQUQJRWLWA5L3TAPDPJANCNFSM4YCUYZIQ.

caballero-oscuro commented 3 years ago

Sure, I can do that.

Duanexiao commented 3 years ago

I use the 'bulk=true' parameter when posting network groups. I believe the same can be used for network objects.

def fmcapi_post_bulk(fmc, post_data): api_path = '/object/networkgroups?bulk=true' post_resp = fmc.send_to_api(method='post', url=fmc.configuration_url+api_path, json_data=post_data)

nice job! Could you post some usage examples?

Krandor1 commented 3 years ago

Separate from this issue (and I can create a new one if you want), adding the virtualtunnelinterfaces which was added to API in 6.7 would be really nice to have. VTIs being missing from Firepower has been a big issue for me for a while but since they are now added and in the API would be nice to add to your library

Brian Hartsfield

On Tue, Feb 23, 2021 at 10:23 AM daxm notifications@github.com wrote:

To my knowledge the batch function is only for Access Rules. That said, I haven't revisited the newer options in the FMC's API for 6 months or so. If you know of some change that would allow batching of Network Objects we could look into adding it. (Or you can.) :-)

On 2/23/21 8:08 AM, Duanexiao wrote:

When I batch add 200 network objects, it takes almost 10 minutes!That's not acceptable

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/daxm/fmcapi/issues/98, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAZOMZ3ROSIFBFSM6KLHJPTTAPAHDANCNFSM4YCUYZIQ .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/daxm/fmcapi/issues/98#issuecomment-784279749, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBHJKVUSEANSZL5KILN72LTAPCATANCNFSM4YCUYZIQ .

caballero-oscuro commented 3 years ago

I use the 'bulk=true' parameter when posting network groups. I believe the same can be used for network objects. def fmcapi_post_bulk(fmc, post_data): api_path = '/object/networkgroups?bulk=true' post_resp = fmc.send_to_api(method='post', url=fmc.configuration_url+api_path, json_data=post_data)

nice job! Could you post some usage examples? Sorry it taken me a while to get back to you, but here's an example:

fmcapi-bulk-example.txt

Duanexiao commented 3 years ago

I use the 'bulk=true' parameter when posting network groups. I believe the same can be used for network objects. def fmcapi_post_bulk(fmc, post_data): api_path = '/object/networkgroups?bulk=true' post_resp = fmc.send_to_api(method='post', url=fmc.configuration_url+api_path, json_data=post_data)

nice job! Could you post some usage examples? Sorry it taken me a while to get back to you, but here's an example:

fmcapi-bulk-example.txt

many thanks!

lavermil commented 2 years ago

Also worth the mention if you don't find the solution here for bulk object, port, object-group (port or object) you can use the Cisco import tool for that. It give a nice compare and shows if stuff is already in use. While I think it would be cool to have a nice tool that does everything I have to look at options I have available that are the most efficient and ready to use. Great enhancement idea though. :)