Documentation ¶
Index ¶
- type NetAlloc
- func (p *NetAlloc) Allocate(network, ifaceName, address, gw string)
- func (p *NetAlloc) CorrelateRetrievedIPs(expAddrsOrRefs []string, retrievedAddrs []string, ifaceName string, ...) (correlated []string)
- func (p *NetAlloc) CreateAddressAllocRef(network, iface string, getGW bool) string
- func (p *NetAlloc) Deallocate(network, ifaceName string)
- func (p *NetAlloc) GetAddressAllocDep(addrOrAllocRef, ifaceName, depLabelPrefix string) (dep kvs.Dependency, hasAllocDep bool)
- func (p *NetAlloc) GetOrParseIPAddress(addrOrAllocRef string, ifaceName string, addrForm netalloc.IPAddressForm) (addr *net.IPNet, err error)
- func (p *NetAlloc) ParseAddressAllocRef(addrAllocRef, expIface string) (network, iface string, isGW, isRef bool, err error)
- func (p *NetAlloc) ValidateIPAddress(addrOrAllocRef, ifaceName, fieldName string, gwCheck plugin.GwValidityCheck) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NetAlloc ¶
type NetAlloc struct {
// contains filtered or unexported fields
}
NetAlloc is a mock version of the netplugin, suitable for unit testing.
func NewMockNetAlloc ¶
func NewMockNetAlloc() *NetAlloc
NewMockNetAlloc is a constructor for mock netalloc plugin.
func (*NetAlloc) Allocate ¶
Allocate simulates allocation of an IP address.
func (*NetAlloc) CorrelateRetrievedIPs ¶
func (p *NetAlloc) CorrelateRetrievedIPs(expAddrsOrRefs []string, retrievedAddrs []string, ifaceName string, addrForm netalloc.IPAddressForm) (correlated []string)
CorrelateRetrievedIPs is not implemented here.
func (*NetAlloc) CreateAddressAllocRef ¶
CreateAddressAllocRef creates reference to an allocated IP address.
func (*NetAlloc) Deallocate ¶
Deallocate simulates de-allocation of an IP address.
func (*NetAlloc) GetAddressAllocDep ¶
func (p *NetAlloc) GetAddressAllocDep(addrOrAllocRef, ifaceName, depLabelPrefix string) ( dep kvs.Dependency, hasAllocDep bool)
GetAddressAllocDep is not implemented here.
func (*NetAlloc) GetOrParseIPAddress ¶
func (p *NetAlloc) GetOrParseIPAddress(addrOrAllocRef string, ifaceName string, addrForm netalloc.IPAddressForm) (addr *net.IPNet, err error)
GetOrParseIPAddress tries to get allocated interface (or GW) IP address referenced by <addrOrAllocRef> in the requested form. But if the string contains/ an actual IP address instead of a reference, the address is parsed using methods from the net package and returned in the requested form. For ADDR_ONLY address form, the returned <addr> will have the mask unset and the IP address should be accessed as <addr>.IP