ipam

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPAMer

type IPAMer interface {
	AllocateIP(prefix metal.Prefix) (string, error)
	AllocateSpecificIP(prefix metal.Prefix, specificIP string) (string, error)
	ReleaseIP(ip metal.IP) error
	AllocateChildPrefix(parentPrefix metal.Prefix, childLength uint8) (*metal.Prefix, error)
	ReleaseChildPrefix(childPrefix metal.Prefix) error
	CreatePrefix(prefix metal.Prefix) error
	DeletePrefix(prefix metal.Prefix) error
	PrefixUsage(cidr string) (*metal.NetworkUsage, error)
	PrefixesOverlapping(existingPrefixes metal.Prefixes, newPrefixes metal.Prefixes) error
}

A IPAMer is responsible to allocate a IP for a given purpose On the other hand it should release the IP. Later Implementations should also allocate and release Networks.

type Ipam

type Ipam struct {
	// contains filtered or unexported fields
}

func InitTestIpam

func InitTestIpam(t *testing.T) *Ipam

func New

func New(ip ipam.Ipamer) *Ipam

New creates a new IPAM module.

func (*Ipam) AllocateChildPrefix

func (i *Ipam) AllocateChildPrefix(parentPrefix metal.Prefix, childLength uint8) (*metal.Prefix, error)

AllocateChildPrefix creates a child prefix from a parent prefix in the IPAM.

func (*Ipam) AllocateIP

func (i *Ipam) AllocateIP(prefix metal.Prefix) (string, error)

AllocateIP an ip in the IPAM and returns the allocated IP as a string.

func (*Ipam) AllocateSpecificIP

func (i *Ipam) AllocateSpecificIP(prefix metal.Prefix, specificIP string) (string, error)

AllocateSpecificIP a specific ip in the IPAM and returns the allocated IP as a string.

func (*Ipam) CreatePrefix

func (i *Ipam) CreatePrefix(prefix metal.Prefix) error

CreatePrefix creates a prefix in the IPAM.

func (*Ipam) DeletePrefix

func (i *Ipam) DeletePrefix(prefix metal.Prefix) error

DeletePrefix remove a prefix in the IPAM.

func (*Ipam) PrefixUsage

func (i *Ipam) PrefixUsage(cidr string) (*metal.NetworkUsage, error)

PrefixUsage calculates the IP and Prefix Usage

func (*Ipam) PrefixesOverlapping

func (i *Ipam) PrefixesOverlapping(existingPrefixes metal.Prefixes, newPrefixes metal.Prefixes) error

PrefixesOverlapping returns an error if prefixes overlap.

func (*Ipam) ReleaseChildPrefix

func (i *Ipam) ReleaseChildPrefix(childPrefix metal.Prefix) error

ReleaseChildPrefix release a child prefix from a parent prefix in the IPAM.

func (*Ipam) ReleaseIP

func (i *Ipam) ReleaseIP(ip metal.IP) error

ReleaseIP an ip in the IPAM.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL