infobloxopen / infoblox-client

Infoblox NIOS Python WAPI Client
Apache License 2.0
142 stars 104 forks source link

Help need: Add DHCP options to network #378

Open juanituarte opened 6 months ago

juanituarte commented 6 months ago

Hello guys, I need to add a DHCP options to a network, I wasnt able to achieve it. Could you help me?

from infoblox_client_master.infoblox_client.objects import DhcpOption
from infoblox_client_master.infoblox_client.connector import Connector
from infoblox_client_master.infoblox_client.object_manager import InfobloxObjectManager

from credentials import credentials
from urllib3 import disable_warnings
disable_warnings()

ib_conn = Connector(
    dict(host='xxxx', 
    wapi_version='2.11.2',
    iba_dns_view='default', 
    iba_network_view='default', 
    iba_verify_ssl=False, 
    **credentials["lab"])
    )

dhcp_option = DhcpOption()
dhcp_option.name = "option"
dhcp_option.num = 240
dhcp_option.space = "ztp_fortinet"
dhcp_option.type = "IPv4 Address"

manager = InfobloxObjectManager(ib_conn)

subnet = manager.get_network('default', "172.23.125.0/27")
subnet.dhcp_option = [dhcp_option]
subnet.update()

ERROR

Traceback (most recent call last): File "c:\Users\jsituar\CODE\infoblox\main.py", line 54, in network.update() File "c:\Users\jsituar\CODE\infoblox\infoblox_client_master\infoblox_client\objects.py", line 460, in update ib_obj = self.connector.update_object(self.ref, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\jsituar\CODE\infoblox\infoblox_client_master\infoblox_client\connector.py", line 55, in callee return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\jsituar\CODE\infoblox\infoblox_client_master\infoblox_client\connector.py", line 511, in update_object url = self._construct_url(ref, query_params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\jsituar\CODE\infoblox\infoblox_client_master\infoblox_client\connector.py", line 171, in _construct_url raise ValueError('Path in request must be relative.') ValueError: Path in request must be relative.