cisco-en-programmability / dnacentersdk

Cisco DNA Center Python SDK
https://dnacentersdk.readthedocs.io/en/latest/
MIT License
70 stars 33 forks source link

It is not possible to create a global pool with network_settings.create_global_pool #60

Closed nextnoob closed 2 years ago

nextnoob commented 2 years ago

Prerequisites

Yes →

Example Payload:

{
    "settings": { 
        "ippool": [ 
            { 
                "ipPoolName": "TestPool", 
                "type": "Generic", 
                "ipPoolCidr": "10.253.0.0/20",
                "IpAddressSpace": "IPv4"
            }
        ] 
    }
}

Describe the bug

Class: classNetworkSettings Function: create_global_pool(settings=None, headers=None, payload=None, active_validation=True, **request_parameters)

The parameter "IpAddressSpace" in the payload does not allow valid values. This is apparently due to the validator.

Error message:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/dnacentersdk/models/validators/v2_3_3_0/jsd_eecf4323cb285985be72a7e061891059.py", line 97, in validate
    self._validator(request)
  File "<string>", line 37, in validate
fastjsonschema.exceptions.JsonSchemaValueException: data.settings.ippool[0].IpAddressSpace must be one of ['IPv6 or IPv4']

When I adjust the validator, the API call works.

"IpAddressSpace": {
    "enum": [
        "IPv6",   
        "IPv4"
    ]

Expected behavior "IPv4" or "IPv6" should be accepted as value for "IpAddressSpace".

Screenshots CreateIPPool1 CreateIPPool2 CreateIPPool3

Environment (please complete the following information):

Additional context

Thanks for maintaining the very good SDK :blush:

bvargasre commented 2 years ago

Hi @nextnoob, thanks for report, we will work on it.

bvargasre commented 2 years ago

Hi @nextnoob, dnacentersdk has been updated to version 2.5.1, so try this new version and tell me if it works.

nextnoob commented 2 years ago

Hi @bvargasre ,

it works perfectly. Thanks for the quick implementation!