fmcapi icon indicating copy to clipboard operation
fmcapi copied to clipboard

Are there any batch add network object interfaces?

Open Duanexiao opened this issue 4 years ago • 9 comments

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

Duanexiao avatar Feb 23 '21 15:02 Duanexiao

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.

daxm avatar Feb 23 '21 15:02 daxm

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)

caballero-oscuro avatar Feb 23 '21 15:02 caballero-oscuro

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.

daxm avatar Feb 23 '21 15:02 daxm

Sure, I can do that.

caballero-oscuro avatar Feb 23 '21 16:02 caballero-oscuro

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?

Duanexiao avatar Feb 24 '21 02:02 Duanexiao

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 [email protected] 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 .

Krandor1 avatar Feb 24 '21 02:02 Krandor1

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

caballero-oscuro avatar Mar 04 '21 23:03 caballero-oscuro

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!

Duanexiao avatar Mar 12 '21 02:03 Duanexiao

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. :)

lavermil avatar Mar 28 '22 00:03 lavermil