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

Creating NetworkGroups #55

Closed rmv-first closed 4 years ago

rmv-first commented 4 years ago

Hello!

I can't find any documentation about using fmcapi to create NetworksGroups with 2 literal Networks. I would like to achieve the following: Снимок Now there is a way to create single object Network for 7.7.7.0/29 and single object Network for 8.8.8.0/29 and сombine them in one group. It is not very convenient and flexible.

marksull commented 4 years ago
from fmcapi.fmc import FMC
from fmcapi.api_objects import NetworkGroups

with FMC(
    host="hostname",
    username="username",
    password="password",
    autodeploy=False,
) as fmc:
    group = NetworkGroups(fmc=fmc, name="test_network_object")
    group.unnamed_networks(action="add", value="10.0.0.0/24")
    group.unnamed_networks(action="add", value="11.0.0.0/24")
    group.post()