Documentation ¶
Overview ¶
Package client implements the client interface to the Seesaw v2 Network Control Centre component, which provides an interface for the Seesaw engine to manipulate and control network related configuration.
Index ¶
- func NewNCC(socket string) (*nccClient, error)
- type DummyLBInterface
- func (lb *DummyLBInterface) AddVIP(vip *seesaw.VIP) error
- func (lb *DummyLBInterface) AddVLAN(vlan *seesaw.VLAN) error
- func (lb *DummyLBInterface) AddVserver(v *seesaw.Vserver, af seesaw.AF) error
- func (lb *DummyLBInterface) DeleteVIP(vip *seesaw.VIP) error
- func (lb *DummyLBInterface) DeleteVLAN(vlan *seesaw.VLAN) error
- func (lb *DummyLBInterface) DeleteVserver(v *seesaw.Vserver, af seesaw.AF) error
- func (lb *DummyLBInterface) Down() error
- func (lb *DummyLBInterface) Init() error
- func (lb *DummyLBInterface) Up() error
- type LBInterface
- type NCC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNCC ¶
NewNCC returns an initialised NCC client. Only unix socket is supported. It keeps using the same single connection for RPC assuming underlying unix socket connection is stable. But caller should be prepared for failures caused by connection disruptions. The client itself doesn't handle reconnecting.
Types ¶
type DummyLBInterface ¶
type DummyLBInterface struct { Vips map[seesaw.VIP]bool Vlans map[uint16]bool Vservers map[string]map[seesaw.AF]bool }
func NewDummyLBInterface ¶
func NewDummyLBInterface() *DummyLBInterface
NewDummyLBInterface returns a dummy LBInterface for testing purpose. Internally it tracks the vips, vlans and vservers resources it manages and can be read back through public fields.
func (*DummyLBInterface) AddVserver ¶
func (*DummyLBInterface) DeleteVLAN ¶
func (lb *DummyLBInterface) DeleteVLAN(vlan *seesaw.VLAN) error
func (*DummyLBInterface) DeleteVserver ¶
func (*DummyLBInterface) Down ¶
func (lb *DummyLBInterface) Down() error
func (*DummyLBInterface) Init ¶
func (lb *DummyLBInterface) Init() error
func (*DummyLBInterface) Up ¶
func (lb *DummyLBInterface) Up() error
type LBInterface ¶
type LBInterface interface { // Init initialises the load balancing network interface. Init() error // Up attempts to bring the network interface up. Up() error // Down attempts to bring the network interface down. Down() error // AddVserver adds a Vserver to the load balancing interface. AddVserver(*seesaw.Vserver, seesaw.AF) error // Delete Vserver removes a Vserver from the load balancing interface. DeleteVserver(*seesaw.Vserver, seesaw.AF) error // AddVIP adds a VIP to the load balancing interface. AddVIP(*seesaw.VIP) error // DeleteVIP removes a VIP from the load balancing interface. DeleteVIP(*seesaw.VIP) error // AddVLAN adds a VLAN interface to the load balancing interface. AddVLAN(vlan *seesaw.VLAN) error // DeleteVLAN removes a VLAN interface from the load balancing interface. DeleteVLAN(vlan *seesaw.VLAN) error }
LBInterface provides an interface for manipulating a load balancing network interface.
type NCC ¶
type NCC interface { // NewLBInterface returns an initialised NCC network LB interface. NewLBInterface(name string, cfg *ncctypes.LBConfig) LBInterface // Close closes the connection to the Seesaw NCC. Close() error // ARPSendGratuitous sends a gratuitious ARP message. ARPSendGratuitous(map[string][]net.IP) error // BGPConfig returns the configuration for the Quagga BGP daemon. BGPConfig() ([]string, error) // BGPNeighbors returns the neighbors that the Quagga BGP daemon // is peering with. BGPNeighbors() ([]*quagga.Neighbor, error) // BGPWithdrawAll requests the Quagga BGP daemon to withdraw all // configured network advertisements. BGPWithdrawAll() error // BGPAdvertiseVIP requests the Quagga BGP daemon to advertise the // specified VIP. BGPAdvertiseVIP(vip net.IP) error // BGPWithdrawVIP requests the Quagga BGP daemon to withdraw the // specified VIP. BGPWithdrawVIP(vip net.IP) error // IPVSFlush flushes all services and destinations from the IPVS table. IPVSFlush() error // IPVSGetServices returns all services configured in the IPVS table. IPVSGetServices() ([]*ipvs.Service, error) // IPVSGetService returns the service entry currently configured in // the kernel IPVS table, which matches the specified service. IPVSGetService(svc *ipvs.Service) (*ipvs.Service, error) // IPVSAddService adds the specified service to the IPVS table. IPVSAddService(svc *ipvs.Service) error // IPVSUpdateService updates the specified service in the IPVS table. IPVSUpdateService(svc *ipvs.Service) error // IPVSDeleteService deletes the specified service from the IPVS table. IPVSDeleteService(svc *ipvs.Service) error // IPVSAddDestination adds the specified destination to the IPVS table. IPVSAddDestination(svc *ipvs.Service, dst *ipvs.Destination) error // IPVSUpdateDestination updates the specified destination in // the IPVS table. IPVSUpdateDestination(svc *ipvs.Service, dst *ipvs.Destination) error // IPVSDeleteDestination deletes the specified destination from // the IPVS table. IPVSDeleteDestination(svc *ipvs.Service, dst *ipvs.Destination) error // RouteDefaultIPv4 returns the default route for IPv4 traffic. RouteDefaultIPv4() (net.IP, error) }
NCC provides a client interface to the network control component.
func NewDummyNCC ¶
func NewDummyNCC() NCC
NewDummyNCC returns a dummy NCC client for testing purpose. It implements all methods NCC interface requires with no-op.