project-safari / zebra

lab resource inventory and reservation system
Apache License 2.0
6 stars 8 forks source link

IP Assignment #190

Open evaachim opened 11 months ago

evaachim commented 10 months ago

Assign IP addresses for resources which are added to the Zebra server tool by users.

evaachim commented 10 months ago

Ideas to keep in mind:

  1. Are the IP addresses internal only to Zebra?
  2. Make sure the IPs are unique.
  3. Consider "releasing" an IP address once the resource it belonged to was deleted.
evaachim commented 10 months ago

Some ideas:

We need an address pool to allocate addresses from to every resource that is being added/requested by a user We need an interface to store all IP addresses for active resources We need to check against the above interface to make sure IP addresses do not repeat We need to "free up" addresses once the resource is no longer active so it can be potentially re-used

evaachim commented 10 months ago

Further Ideas:

  1. generate IPs as per the protocol
  2. Check or convert to IPv4 format
  3. Create a list of "in-use" IPs
  4. Add any newly used IP to the above list
  5. Store all associated IPs in an IP address pool.
evaachim commented 10 months ago

Some things to consider:

  1. How will we manage IP address pools AND how will we group them - by resource or by user?
  2. If local, what is the plan to determine the domain or port for them?
evaachim commented 10 months ago

To add more as per Dan's requirements

evaachim commented 10 months ago

Requirements from Dan:

  1. Replicate the IP address as it is in Racktables
  2. Enhance the experience from above to generate and assign IP addresses to newly created resources, as needed.
evaachim commented 10 months ago

The IPs in Racktables are of the type long or integer, represented as a string, of either one of the following types: 2887224186, 180612481, 173099303. Thus, these need to be converted to a valid IP address via a series of conversions.

evaachim commented 10 months ago

Ideas for achieving this:

  1. generate numeric strings
  2. convert the string to IP-type
  3. validate IP to ensure it is of correct / valid format
  4. pass this IP to newly created resources
evaachim commented 10 months ago

This can be accomplished like this:

  1. function to generate random numeric values
  2. function to convert to hex and then IP
  3. function to validate IP
  4. function to assign this new IP to any new resource that requires an IP address,
evaachim commented 10 months ago

Conversion to IP is as follows:

decimal -> hex -> bit grouping -> bit shifting -> IP

evaachim commented 10 months ago

Assignment of IP:

a function that operates on the new base resource struct to add IPs to those resources which need them.

evaachim commented 10 months ago

Our desired format is subnet + slashes