Documentation
¶
Index ¶
- Variables
- func CreateChildIpamEntryForIPBlock(ctx context.Context, tx *cdb.Tx, dbSession *cdb.Session, ipamDB cipam.Storage, ...) (*cipam.Prefix, error)
- func CreateIpamEntryForIPBlock(ctx context.Context, ipamDB cipam.Storage, prefix string, blockSize int, ...) (*cipam.Prefix, error)
- func DeleteChildIpamEntryFromCidr(ctx context.Context, tx *cdb.Tx, dbSession *cdb.Session, ipamDB cipam.Storage, ...) error
- func DeleteIpamEntryForIPBlock(ctx context.Context, ipamDB cipam.Storage, prefix string, blockSize int, ...) error
- func GetCidrForIPBlock(ctx context.Context, prefix string, blockSize int) string
- func GetFirstIPFromCidr(cidr string) (string, error)
- func GetIpamNamespaceForIPBlock(ctx context.Context, routingType string, ...) string
- func GetIpamUsageForIPBlock(ctx context.Context, ipamDB cipam.Storage, ipBlock *cdbm.IPBlock) (*cipam.Usage, error)
- func NewIpamStorage(db *bun.DB, tx *bun.Tx) cipam.Storage
- func ParseCidrIntoPrefixAndBlockSize(cidr string) (string, int, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPrefixDoesNotExistForIPBlock is the error returned when ipam does not have the entry for the IPBlock ErrPrefixDoesNotExistForIPBlock = errors.New("prefix does not exist for IPBlock in ipam db") // ErrNilIPBlock is the error when a nil IPBlock was passed ErrNilIPBlock = errors.New("ipblock parameter is nil") )
Functions ¶
func CreateChildIpamEntryForIPBlock ¶
func CreateChildIpamEntryForIPBlock(ctx context.Context, tx *cdb.Tx, dbSession *cdb.Session, ipamDB cipam.Storage, parentIPBlock *cdbm.IPBlock, childBlockSize int) (*cipam.Prefix, error)
CreateChildIpamEntryForIPBlock will create an child ipam entry in the ipam DB for the given parent IP Block, with a given child block size Note: FullGrant is a special case when the childBlockSize matches the parentIPBlock, and the parentIPBlock has no child prefixes, then, the parentIPBlock is updated as a full grant in db, and its prefix is returned (without any updates to the ipam DB)
func CreateIpamEntryForIPBlock ¶
func CreateIpamEntryForIPBlock(ctx context.Context, ipamDB cipam.Storage, prefix string, blockSize int, routingType string, infrastructureProviderID, siteID string) (*cipam.Prefix, error)
CreateIpamEntryForIPBlock will create an ipam entry in the ipam DB for the IPBlock will error if there is a prefix clash in that same namespace
func DeleteChildIpamEntryFromCidr ¶
func DeleteChildIpamEntryFromCidr(ctx context.Context, tx *cdb.Tx, dbSession *cdb.Session, ipamDB cipam.Storage, parentIPBlock *cdbm.IPBlock, childCidr string) error
DeleteChildIpamEntryFromCidr will delete a child ipam entry in the ipam DB given the parent IPBlock, and child cidr Note: FullGrant is a special case when the parentIPBlock has a full grant, and the child is being deleted, then the parent IPBlock's full grant is cleared in db
func DeleteIpamEntryForIPBlock ¶
func DeleteIpamEntryForIPBlock(ctx context.Context, ipamDB cipam.Storage, prefix string, blockSize int, routingType string, infrastructureProviderID, siteID string) error
DeleteIpamEntryForIPBlock will delete the ipam entry in the ipam DB for the IPBlock will not error if the deleted cidr is not existing (idempotent)
func GetCidrForIPBlock ¶
GetCidrForIPBlock will return the cidr given the prefix, and block size
func GetFirstIPFromCidr ¶
GetFirstIPFromCidr will parse a cidr, and returns the first IP address in that cidr this is used as the gateway IP
func GetIpamNamespaceForIPBlock ¶
func GetIpamNamespaceForIPBlock(ctx context.Context, routingType string, infrastructureProviderID, siteID string) string
GetIpamNamespaceForIPBlock will return the namespace string for the IPBlock namespace is currently: routingtype/infrastructureProviderID/siteID
func GetIpamUsageForIPBlock ¶
func GetIpamUsageForIPBlock(ctx context.Context, ipamDB cipam.Storage, ipBlock *cdbm.IPBlock) (*cipam.Usage, error)
GetIpamUsageForIPBlock will get an ipam usage for the IPBlock
func NewIpamStorage ¶
NewIpamStorage will return a bun ipam storage interface
Types ¶
This section is empty.