Ipam service
I think the main functionality regarding the ipam service (NAT-152) is implemented so I'm sending the PR. Since the last call, I added support for list of containers per service, support for extattrs, and added an endpoint to get status and usage fields of hosts in a network.
The service is implemented in this directory: https://gitlab.geant.org/goat/gap/geant-service-orchestrator/-/tree/ipam-service/gso/services
A configuration file is needed based on this template exported as OSS_PARAMS_FILENAME
: https://gitlab.geant.org/goat/gap/geant-service-orchestrator/-/blob/ipam-service/gso/oss-params-example.json
There is still some polishing to do regarding error checking/propagation and how to expose some functionality to WFO (if needed) such as constraints for extensible atributes, different modes for allocating things, host/network deletion, etc. but maybe it's better to tinker with the IPAM service from WFO to see how to handle these things according to the workflows.
I kept a dummy menu in _ipam.py
and a dummy entry point in ipam.py
that are useful for testing. Can be deleted later.
Merge request reports
Activity
requested review from @Aleksandr.Kurbatov, @erik.reid, and @simone.spinelli
assigned to @jorge.sasiain
1 1 import ipaddress 2 2 from pydantic import BaseSettings 3 from gso import settings 3 4 import _ipam changed this line in version 2 of the diff
41 42 43 def new_service_host(hostname, 44 service_type, 45 service_networks: ServiceNetworks = None, 46 host_addresses: HostAddresses = None, 47 extattrs={}) -> HostAddresses: 48 return _ipam.allocate_service_host( 49 hostname=hostname, 50 service_type=service_type, 51 service_networks=service_networks, 52 host_addresses=host_addresses, 53 extattrs=extattrs) 54 55 56 if __name__ == '__main__': this part can be removed (maybe convert it to one or more unit tests)
Edited by Erik Reid
- gso/services/_ipam.py 0 → 100644
574 575 r = requests.get( 576 f'{_wapi(infoblox_params)}/{endpoint}', 577 params={ 578 '_return_fields': 'ip_address,status,usage', 579 'network': network}, 580 auth=HTTPBasicAuth(infoblox_params.username, 581 infoblox_params.password), 582 verify=False 583 ) 584 assert r.status_code >= 200 and r.status_code < 300, \ 585 f"HTTP error {r.status_code}: {r.reason}\n\n{r.text}" 586 return r.json() 587 588 589 if __name__ == '__main__': @jorge.sasiain @simone.spinelli @erik.reid
I am testing the code, it will take a while.
added 1 commit
- 28f7797a - NAT-152: add comment field to create network
added 9 commits
-
28f7797a...a94a4cd1 - 8 commits from branch
develop
- daa2edc7 - Merge develop
-
28f7797a...a94a4cd1 - 8 commits from branch
mentioned in commit 5893f566