mirror of
https://github.com/jbowdre/phpIPAM-for-vRA8.git
synced 2024-11-21 14:32:19 +00:00
calculate IP version for allocate_ip; increment to v1.0.3
This commit is contained in:
parent
11645c7add
commit
2279014db1
3 changed files with 6 additions and 3 deletions
2
pom.xml
2
pom.xml
|
@ -23,7 +23,7 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
|
|||
<properties>
|
||||
<provider.name>phpIPAM</provider.name>
|
||||
<provider.description>phpIPAM integration for vRA</provider.description>
|
||||
<provider.version>1.0.2</provider.version>
|
||||
<provider.version>1.0.3</provider.version>
|
||||
|
||||
<provider.supportsAddressSpaces>false</provider.supportsAddressSpaces>
|
||||
<provider.supportsUpdateRecord>true</provider.supportsUpdateRecord>
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
requests==2.21.0
|
||||
datetime
|
||||
datetime
|
||||
ipaddress
|
|
@ -15,6 +15,7 @@ import requests
|
|||
from vra_ipam_utils.ipam import IPAM
|
||||
import logging
|
||||
from datetime import datetime
|
||||
import ipaddress
|
||||
|
||||
"""
|
||||
Example payload
|
||||
|
@ -153,10 +154,11 @@ def allocate_in_range(range_id, resource, allocation, context, endpoint, bundle)
|
|||
allocate_req = requests.post(allocate_uri, data=payload, headers=token, verify=cert)
|
||||
allocate_req = allocate_req.json()
|
||||
if allocate_req['success']:
|
||||
version = ipaddress.ip_address(allocate_req['data']).version
|
||||
result = {
|
||||
"ipAllocationId": allocation['id'],
|
||||
"ipRangeId": range_id,
|
||||
"ipVersion": "IPv4",
|
||||
"ipVersion": "IPv" + str(version),
|
||||
"ipAddresses": [allocate_req['data']]
|
||||
}
|
||||
logging.info(f"Successfully reserved {str(result['ipAddresses'])} for {vmName}.")
|
||||
|
|
Loading…
Reference in a new issue