cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2044
Views
10
Helpful
5
Replies

DNA 2.2.2.3 and Reserve ip pool API-call.

trondaker
Level 1
Level 1

Hi,

Having some problems reserving a subpool from a global pool in DNA API. Upgraded to 2.2.2.3 to actually get the function in the API, but i cant seem to get what it wants in the "IPv4GlobalPool"-parameter when making the call.

 

Doc for the function call here: 

 

https://dnacentersdk.readthedocs.io/en/latest/api/api.html#dnacentersdk.api.v2_2_1.network_settings.NetworkSettings.reserve_ip_subpool

 

Trying with the global pool name:

 

"bapiError" : "{\"status\":false,\"errorMessage\":[\"Invalid ippool cidr(YE-transit-pool) address for ipv4 global pool\"]}",

 

Trying with global pool name and cidr:

 

"bapiError" : "{\"status\":false,\"errorMessage\":[\"Invalid ip subnet(192.168.192.0/21 (YE-transit-pool)) address for ipv4 global pool\"]}",

 

Trying with just the cidr (suddenly it interprets this as an ipv6 pool, even though the parameter name is ipv4:

 

"bapiError" : "{\"status\":false,\"errorMessage\":[\"Ipv6 Global pool(192.168.192.0/21) is not present.\"]}",

 

Call being made:

 

result = dnac.network_settings.reserve_ip_subpool(site_id=siteid, ipv4GlobalPool="192.168.192.0/21",type="Generic", ipv4GateWay="192.168.193.1", ipv4Subnet="192.168.193.0", name="Transit-pool", ipv4PrefixLength=26)

 

Has anyone figured out what this should be?

1 Accepted Solution

Accepted Solutions

Aninda Chatterjee
Cisco Employee
Cisco Employee

There is a bug in the API, where IPv4 reservations cannot be done without IPv6 being specified in the API as well. The bug ID is CSCvz18353. This should be a public bug, but for reference, you can follow the workaround below (also mentioned in the bug):

 

<workaround>

To workaround this issue, create a dummy IPv6 global IP address pool and use that in the request body. Make sure that "ipv6AddressSpace" is set to false, otherwise the IPv6 IP address pool will also be reserved.

 

Here is an example request body that works.

{
"name": "API_Pool",
"type": "Generic",
"ipv4GlobalPool": "x.x.0.0/16",
"ipv4Prefix": true,
"ipv6AddressSpace": false,
"ipv4PrefixLength": 24,
"ipv4Subnet": "x.x.140.0",
"ipv4GateWay": "x.x.140.1",
"ipv6Prefix": true,
"ipv6GlobalPool": "2001:xxx::1234/64",
"ipv6PrefixLength": 64,
"ipv6Subnet": "2001:xxx::1234"
}

This reserves the IPv4 address pool, but doesn't reserve the IPv6 address pool.

View solution in original post

5 Replies 5

Aninda Chatterjee
Cisco Employee
Cisco Employee

There is a bug in the API, where IPv4 reservations cannot be done without IPv6 being specified in the API as well. The bug ID is CSCvz18353. This should be a public bug, but for reference, you can follow the workaround below (also mentioned in the bug):

 

<workaround>

To workaround this issue, create a dummy IPv6 global IP address pool and use that in the request body. Make sure that "ipv6AddressSpace" is set to false, otherwise the IPv6 IP address pool will also be reserved.

 

Here is an example request body that works.

{
"name": "API_Pool",
"type": "Generic",
"ipv4GlobalPool": "x.x.0.0/16",
"ipv4Prefix": true,
"ipv6AddressSpace": false,
"ipv4PrefixLength": 24,
"ipv4Subnet": "x.x.140.0",
"ipv4GateWay": "x.x.140.1",
"ipv6Prefix": true,
"ipv6GlobalPool": "2001:xxx::1234/64",
"ipv6PrefixLength": 64,
"ipv6Subnet": "2001:xxx::1234"
}

This reserves the IPv4 address pool, but doesn't reserve the IPv6 address pool.

Thanks, that did the trick!

 

"status" : "SUCCESS",
"bapiSyncResponse" : "{\"name\":\"API_Pool\",\"type\":\"generic\",\"result\":{\"startTime\":1628590708573,\"endTime\":1628590709411,\"progress\":\"Subpool Creation 9e9f87a5-e8ad-4d1f-9549-f5bc05c186b9\"},\"status\":\"True\"}",

Aninda,

 

This API POST works above until you try to add the DHCP and DNS Servers to the IPv4 Pool. Is there a work around to that issue as well? 

 

Thanks for any pointers. 

AN EXAMPLE

** Reserve IP Pool for Building-1
*
"name": "Building-1",
"id": "5828a8ba-585e-4f84-97cf-25f52e8b2a9e",

POST
{{PROTOCOL}}://{{DNAC.IP.ADDRESS}}/dna/intent/api/v1/reserve-ip-subpool/5828a8ba-585e-4f84-97cf-25f52e8b2a9e

BODY
{
"name": "IP-Pool-2",
"type": "Generic",
"ipv4GlobalPool": "14.1.0.0/16",
"ipv4Prefix": true,
"ipv4PrefixLength": 24,
"ipv4Subnet": "14.1.101.0",
"ipv4GateWay": "14.1.101.1",
"ipv4DhcpServers": [
"192.168.211.215"
],
"ipv4DnsServers": [
"192.168.211.213"
],
"ipv6AddressSpace": false,
"ipv6Prefix": false
}

RESPONSE
{
"executionId": "be763d58-d2be-4510-a13e-a970e288da31",
"executionStatusUrl": "/dna/platform/management/business-api/v1/execution-status/be763d58-d2be-4510-a13e-a970e288da31",
"message": "The request has been accepted for execution"
}


** GET Task Results
*

GET
{{PROTOCOL}}://{{DNAC.IP.ADDRESS}}/dna/platform/management/business-api/v1/execution-status/be763d58-d2be-4510-a13e-a970e288da31

RESPONSE
{
"bapiKey": "429f-aa81-4d3b-960a",
"bapiName": "Reserve IP Subpool",
"bapiExecutionId": "be763d58-d2be-4510-a13e-a970e288da31",
"startTime": "Sun Jan 30 20:27:09 UTC 2022",
"startTimeEpoch": 1643574429936,
"endTime": "Sun Jan 30 20:27:11 UTC 2022",
"endTimeEpoch": 1643574431510,
"timeDuration": 1574,
"status": "SUCCESS",
"bapiSyncResponse": "{\"name\":\"IP-Pool-2\",\"type\":\"generic\",\"result\":{\"startTime\":1643574430146,\"endTime\":1643574431333,\"progress\":\"Subpool Creation 4f8adec4-9246-4636-91ed-7fca693ec537\"},\"status\":\"True\"}",
"runtimeInstanceId": "DNACP_Runtime_c2faa72e-4574-413c-94df-cc55f5acaacd"
}

 Screen Shot 2022-01-30 at 3.30.01 PM.png

Hi. iam trying the same. if i use a global ip pool 172.19.0.0/16 it works fine. but if i use a global ip pool with /15 i get 

'FAILURE', 'bapiError': '{"status":false,"errorMessage":["Invalid ip subnet(192.170.0.0/15) address for ipv4 global pool"]}'

'FAILURE', 'bapiError': '{"status":false,"errorMessage":["Invalid ip subnet(10.90.0.0/15) address for ipv4 global pool"]}'

'FAILURE', 'bapiError': '{"status":false,"errorMessage":["Invalid ip subnet(10.98.0.0/15) address for ipv4 global pool"]}'

 

 

Iam running DNAC Version 2.2.2.8 Any idea what can be wrong. I have used same body data as described above.

 

Regards

T

Review Cisco Networking for a $25 gift card