infobloxopen / infoblox-client

Infoblox NIOS Python WAPI Client
Apache License 2.0
141 stars 105 forks source link

Create a new api "get_network_by_subnet_id" in object_manager #58

Closed hosunghwang closed 2 years ago

hosunghwang commented 8 years ago

The following api should return ib network by subnet id and ip_version. But ip_version is None by default.

def get_network_by_subnet_id(self, subnet_id, ip_version=None): ea = ib_objects.EA({'Subnet ID': subnet_id})

    if ip_version == 4 or ip_version is None:
        try:
            ib_network = ib_objects.NetworkV4.search(
                self._grid_config.gm_connector,
                network_view=network_view,
                search_extattrs=ea)
        except ib_exc.InfobloxSearchError:
            ib_network = None

    if ip_version == 6 or ib_network is None:
        try:
            ib_network = ib_objects.NetworkV6.search(
                self._grid_config.gm_connector,
                network_view=network_view,
                search_extattrs=ea)
        except ib_exc.InfobloxSearchError:
            ib_network = None

    return ib_network
bondar-pavel commented 8 years ago

The way how it is implemented now makes this code useful almost only for networking-infoblox, since only there we have strict mapping between Network and Subnet ID EA.

To make it more useful for other cases I am thiking about doing it in more generic way.

  1. One way is to add to object_manager method that allows to search network by any EA:

get_network_by_ea

But still it limit search_by_ea approach for both v4/v6 objects with network.

  1. So second way is to excend ib_objects interface that would allow to search by EA in versioned childes.

I'll do some prototyping to see if [2] is easy to implement in cosistent way without spending too much time, if not I fall back to way [1], since this one is easy to implement.

sarya-infoblox commented 2 years ago

Hi @hosunghwang can you confirm if you are still facing this issue?

bondar-pavel commented 2 years ago

The issue is 6 years old, should be safe to close it.

sarya-infoblox commented 2 years ago

Closing the issue.