Nat 185
Includes:
- IPv4, IPv6, A, AAAA, and PTR in the same host record when allocating a host
- Optional CNAME record when allocating a host (passed as a list of alias name, one CNAME record is created for each)
- Support for networks as well as containers in the
oss-params.json
file.
Hosts can be allocated through ipam.new_service_host()
by passing domain name, hostname, and service type (mandatory). Optinally, you can pass either ipv4/ipv6 addresses, ipv4/ipv6 networks, or nothing. Passing nothing is considered default. In that case:
- If the service type has any container specified in the params file, networks have to be allocated before allocating hosts (through
ipam.new_service_networks()
). The mask parameter is used to create the new networks. Containers are filled up in the order that they appear in the params file. - If the service type has any network specified in the params file, those networks are used directly to allocate hosts. Networks are filled up in the order that they appear in the params file.
If you pass addresses or networks, the module will always attempt to use those, but will fail if they don't match the configuration in the params file for the service type (i.e. if you request an address or network that places outside of the configured containers/networks).
Either a non-empty list of networks
or a non-empty list of containers
is required in the params file per service type. Having both is redundant, but in that case containers take precedence. The mask
parameter is irrelevant if the service type uses networks instead of containers.
Example config:
"LO": {
"V4": {"containers": [], "networks": ["10.255.255.32/32", "10.255.255.0/28", "10.255.255.16/28"], "mask": 0},
"V6": {"containers": [], "networks": ["dead:beef::/80", "dead:beef:0:1::/80"], "mask": 0},
"domain_name": ".gso"
},
"TRUNK": {
"V4": {"containers": ["10.255.255.0/24", "10.255.254.0/24"], "networks": [], "mask": 31},
"V6": {"containers": ["dead:beef::/64", "dead:beee::/64"], "networks": [], "mask": 126},
"domain_name": ".gso"
},
Merge request reports
Activity
requested review from @Aleksandr.Kurbatov, @erik.reid, and @simone.spinelli
There is a problem in the logic of assigning host IP addresses. I will provide details in NAT-185.
added 1 commit
- 63f6f34f - NAT-152: fix ipv6 allocation by host ip address
added 1 commit
- 4ce8282e - NAT-152: fix bug in host allocation behavior when all networks are full or don't exist
I completed NAT-198, NAT-199, and NAT-200.
Host and network deleting functions are exposed in ipam.py. I also consolidated the input arguments to all functions to use classes from the IPAM module (such as
HostAddresses
).The code checks that the resource you are trying to delete is allocated to the service as per
containers
ornetworks
in the service's configuration. If not, you are not allowed to delete it.No host or cname records are deleted via the
delete_service_host
function until all passed arguments match the hostname, IP, and CNAME data of the host. If anything doesn't match, no record is deleted.Usage examples:
service_network = ipam.delete_service_network( network=ipaddress.ip_network('10.255.255.0/26'), service_type='LO' )
input_host_addresses = ipam.HostAddresses( v4=ipaddress.ip_address('10.255.255.1'), v6=ipaddress.ip_address('dead:beef::1') ) host_addresses = ipam.delete_service_host( hostname='ha_lo', host_addresses=input_host_addresses, cname_aliases=['alias1.ha', 'alias2.ha'], service_type='LO' )
I haven't checked key-based auth as per NAT-201, but I think for now feel free to test all of this, and then, when ready, maybe we can merge this branch into develop since there are many commits already?
Edited by JORGE SASIAINadded 25 commits
-
a00152af...7baaeb33 - 24 commits from branch
develop
- 45b9f41e - Merge branch 'develop' into NAT-185
-
a00152af...7baaeb33 - 24 commits from branch