Skip to content
Snippets Groups Projects

Ipam service

Merged JORGE SASIAIN requested to merge ipam-service into develop
3 unresolved threads

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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 1 import ipaddress
2 2 from pydantic import BaseSettings
3 from gso import settings
3
4 import _ipam
  • Erik Reid
  • 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__':
  • Erik Reid
  • 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.

  • JORGE SASIAIN added 1 commit

    added 1 commit

    • 28f7797a - NAT-152: add comment field to create network

    Compare with previous version

  • JORGE SASIAIN added 9 commits

    added 9 commits

    Compare with previous version

  • JORGE SASIAIN added 1 commit

    added 1 commit

    • 07633cce - NAT-152: Add test. Comment out unused code

    Compare with previous version

  • JORGE SASIAIN added 1 commit

    added 1 commit

    Compare with previous version

  • I created tests for new networks and new hosts as well as for the configuration. I commented out other testing code and unused methods.

  • Erik Reid added 1 commit

    added 1 commit

    Compare with previous version

  • Erik Reid mentioned in commit 5893f566

    mentioned in commit 5893f566

  • merged

  • Please register or sign in to reply
    Loading