rib

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CliSuccess = iota
	CliSuccessExec
	CliSuccessShow
)
View Source
const (
	IF_TYPE_UNKNOWN uint8 = iota
	IF_TYPE_ETHERNET
	IF_TYPE_LOOPBACK
	IF_TYPE_HDLC
	IF_TYPE_PPP
	IF_TYPE_ATM
	IF_TYPE_FRELAY
	IF_TYPE_VLAN
	IF_TYPE_IPIP
	IF_TYPE_IPGRE
	IF_TYPE_IP6GRE
	IF_TYPE_IP6IP
)
View Source
const (
	IF_WATCH_REGISTER = iota
	IF_WATCH_UNREGISTER
)
View Source
const (
	IFC_FLAG_SHUTDOWN = 1 << iota
	IFC_FLAG_MTU
	IFC_FLAG_DESCRIPTION
)
View Source
const (
	NDA_UNSPEC = iota
	NDA_DST
	NDA_LLADDR
	NDA_CACHEINFO
	NDA_PROBES
	NDA_VLAN
	NDA_PORT
	NDA_VNI
	NDA_IFINDEX
	NDA_MAX = NDA_IFINDEX
)
View Source
const (
	NUD_NONE       = 0x00
	NUD_INCOMPLETE = 0x01
	NUD_REACHABLE  = 0x02
	NUD_STALE      = 0x04
	NUD_DELAY      = 0x08
	NUD_PROBE      = 0x10
	NUD_FAILED     = 0x20
	NUD_NOARP      = 0x40
	NUD_PERMANENT  = 0x80
)

Neighbor Cache Entry States.

View Source
const (
	NTF_USE    = 0x01
	NTF_SELF   = 0x02
	NTF_MASTER = 0x04
	NTF_PROXY  = 0x08
	NTF_ROUTER = 0x80
)

Neighbor Flags

View Source
const (
	SizeOfIfReq = 40
	IFNAMSIZ    = 16
	TUN_DEV     = "/dev/net/tun"
)
View Source
const (
	RULE_SELECTOR_IIF = iota
	RULE_SELECTOR_OIF
)

Netlink VRF

View Source
const (
	AFI_IP = iota
	AFI_IP6
	AFI_MAX
)
View Source
const (
	RIB_UNKNOWN uint8 = iota
	RIB_KERNEL
	RIB_CONNECTED
	RIB_STATIC
	RIB_RIP
	RIB_RIPNG
	RIB_OSPF
	RIB_OSPF6
	RIB_BGP
	RIB_ISIS
)
View Source
const (
	RIB_SUB_OSPF_IA uint8 = iota
	RIB_SUB_OSPF_NSSA_1
	RIB_SUB_OSPF_NSSA_2
	RIB_SUB_OSPF_EXTERNAL_1
	RIB_SUB_OSPF_EXTERNAL_2
	RIB_SUB_BGP_IBGP
	RIB_SUB_BGP_EBGP
	RIB_SUB_BGP_CONFED
	RIB_SUB_ISIS_L1
	RIB_SUB_ISIS_L2
	RIB_SUB_ISIS_IA
)
View Source
const (
	DISTANCE_KERNEL    = 0
	DISTANCE_CONNECTED = 0
	DISTANCE_STATIC    = 1
	DISTANCE_RIP       = 120
	DISTANCE_RIPNG     = 120
	DISTANCE_OSPF      = 110
	DISTANCE_OSPF6     = 110
	DISTANCE_EBGP      = 20
	DISTANCE_IBGP      = 200
	DISTANCE_ISIS      = 115
	DISTNACE_INFINITY  = 255
)
View Source
const (
	RouterIdTypeUnset = iota
	RouterIdTypeConfig
	RouterIdTypeLoopback
	RouterIdTypeAutomatic
)
View Source
const (
	VRF_ID_MIN     = 1
	VRF_ID_MAX     = 253
	VRF_TABLE_SIZE = 254
)
View Source
const (
	HEADER_V2_LEN = 6
	HEADER_V3_LEN = 8
)
View Source
const (
	INTERFACE_ACTIVE        = 0x01
	INTERFACE_SUB           = 0x02
	INTERFACE_LINKDETECTION = 0x04
)
View Source
const (
	ZEBRA_LLT_UNKNOWN = iota
	ZEBRA_LLT_ETHER
	ZEBRA_LLT_EETHER
	ZEBRA_LLT_AX25
	ZEBRA_LLT_PRONET
	ZEBRA_LLT_IEEE802
	ZEBRA_LLT_ARCNET
	ZEBRA_LLT_APPLETLK
	ZEBRA_LLT_DLCI
	ZEBRA_LLT_ATM
	ZEBRA_LLT_METRICOM
	ZEBRA_LLT_IEEE1394
	ZEBRA_LLT_EUI64
	ZEBRA_LLT_INFINIBAND
	ZEBRA_LLT_SLIP
	ZEBRA_LLT_CSLIP
	ZEBRA_LLT_SLIP6
	ZEBRA_LLT_CSLIP6
	ZEBRA_LLT_RSRVD
	ZEBRA_LLT_ADAPT
	ZEBRA_LLT_ROSE
	ZEBRA_LLT_X25
	ZEBRA_LLT_PPP
	ZEBRA_LLT_CHDLC
	ZEBRA_LLT_LAPB
	ZEBRA_LLT_RAWHDLC
	ZEBRA_LLT_IPIP
	ZEBRA_LLT_IPIP6
	ZEBRA_LLT_FRAD
	ZEBRA_LLT_SKIP
	ZEBRA_LLT_LOOPBACK
	ZEBRA_LLT_LOCALTLK
	ZEBRA_LLT_FDDI
	ZEBRA_LLT_SIT
	ZEBRA_LLT_IPDDP
	ZEBRA_LLT_IPGRE
	ZEBRA_LLT_IP6GRE
	ZEBRA_LLT_PIMREG
	ZEBRA_LLT_HIPPI
	ZEBRA_LLT_ECONET
	ZEBRA_LLT_IRDA
	ZEBRA_LLT_FCPP
	ZEBRA_LLT_FCAL
	ZEBRA_LLT_FCPL
	ZEBRA_LLT_FCFABRIC
	ZEBRA_LLT_IEEE802_TR
	ZEBRA_LLT_IEEE80211
	ZEBRA_LLT_IEEE80211_RADIOTAP
	ZEBRA_LLT_IEEE802154
	ZEBRA_LLT_IEEE802154_PHY
)
View Source
const (
	HEADER_MARKER    = 255
	INTERFACE_NAMSIZ = 20
)
View Source
const (
	MESSAGE_NEXTHOP  = 0x01
	MESSAGE_IFINDEX  = 0x02
	MESSAGE_DISTANCE = 0x04
	MESSAGE_METRIC   = 0x08
)
View Source
const (
	GrpcConnRetryInterval = 5
)
View Source
const IFC_FLAG_MAX = 32
View Source
const IfShowTemplate = `` /* 409-byte string literal not displayed */

Variables

View Source
var (
	ArpAddHook    func(int, net.IP, net.HardwareAddr)
	ArpDeleteHook func(int, net.IP, net.HardwareAddr)
)
View Source
var (
	GrpcConn        *grpc.ClientConn
	GrpcCommitCount int
)
View Source
var (
	IfTable = netutil.NewPtree(32)
	IfMap   = map[string]*Interface{}
	IfMutex sync.Mutex
)
View Source
var (
	VlanAddHook    func(uint16, *InterfaceConfig) int
	VlanDeleteHook func(uint16, *InterfaceConfig) int
	VlanTapHook    func(uint16, []byte, int)
)
View Source
var (
	VrfTable = [VRF_TABLE_SIZE]*Vrf{}
	VrfMap   = map[string]*Vrf{}
	VrfMutex sync.RWMutex
)
View Source
var (
	ClientMap   = map[net.Conn]*Client{}
	ClientMutex sync.RWMutex
)
View Source
var AddPathDefault bool
View Source
var CommandTypeMap = map[COMMAND_TYPE]string{
	INTERFACE_ADD:               "INTERFACE_ADD",
	INTERFACE_DELETE:            "INTERFACE_DELETE",
	INTERFACE_ADDRESS_ADD:       "INTERFACE_ADDRESS_ADD",
	INTERFACE_ADDRESS_DELETE:    "INTERFACE_ADDRESS_DELETE",
	INTERFACE_UP:                "INTERFACE_UP",
	INTERFACE_DOWN:              "INTERFACE_DOWN",
	IPV4_ROUTE_ADD:              "IPV4_ROUTE_ADD",
	IPV4_ROUTE_DELETE:           "IPV4_ROUTE_DELETE",
	IPV6_ROUTE_ADD:              "IPV6_ROUTE_ADD",
	IPV6_ROUTE_DELETE:           "IPV6_ROUTE_DELETE",
	REDISTRIBUTE_ADD:            "REDISTRIBUTE_ADD",
	REDISTRIBUTE_DELETE:         "REDISTRIBUTE_DELETE",
	REDISTRIBUTE_DEFAULT_ADD:    "REDISTRIBUTE_DEFAULT_ADD",
	REDISTRIBUTE_DEFAULT_DELETE: "REDISTRIBUTE_DEFAULT_DELETE",
	IPV4_NEXTHOP_LOOKUP:         "IPV4_NEXTHOP_LOOKUP",
	IPV6_NEXTHOP_LOOKUP:         "IPV6_NEXTHOP_LOOKUP",
	IPV4_IMPORT_LOOKUP:          "IPV4_IMPORT_LOOKUP",
	IPV6_IMPORT_LOOKUP:          "IPV6_IMPORT_LOOKUP",
	INTERFACE_RENAME:            "INTERFACE_RENAME",
	ROUTER_ID_ADD:               "ROUTER_ID_ADD",
	ROUTER_ID_DELETE:            "ROUTER_ID_DELETE",
	ROUTER_ID_UPDATE:            "ROUTER_ID_UPDATE",
	HELLO:                       "HELLO",
	INTERFACE_LINK_PARAMS:       "INTERFACE_LINK_PARAMS",
	NEXTHOP_REGISTER:            "NEXTHOP_REGISTER",
	NEXTHOP_UNREGISTER:          "NEXTHOP_UNREGISTER",
	NEXTHOP_UPDATE:              "NEXTHOP_UPDATE",
}
View Source
var (
	DefaultVrfProtect = false
)
View Source
var (
	HardwareAddrSetHook func(int, []byte)
)
View Source
var HubNodeMap = map[int]string{}
View Source
var IfAddHook func(ifp *Interface)
View Source
var IfAddrAddHook func(ifp *Interface, ifaddr *netutil.Prefix)
View Source
var IfAddrDeleteHook func(ifp *Interface, ifaddr *netutil.Prefix)
View Source
var IfForceUpFlag bool
View Source
var IfStatusChangeHook func(string, bool, bool)
View Source
var IfTypeStringMap = map[uint8]string{
	IF_TYPE_UNKNOWN:  "Unknown",
	IF_TYPE_ETHERNET: "Ethernet",
	IF_TYPE_LOOPBACK: "Loopback",
	IF_TYPE_HDLC:     "HDLC",
	IF_TYPE_PPP:      "PPP",
	IF_TYPE_ATM:      "ATM",
	IF_TYPE_FRELAY:   "Frame Relay",
	IF_TYPE_VLAN:     "VLAN",
	IF_TYPE_IPIP:     "IP over IP Tunnel",
	IF_TYPE_IPGRE:    "IP over GRE Tunnel",
	IF_TYPE_IP6GRE:   "IPv6 over GRE Tunnel",
	IF_TYPE_IP6IP:    "IPv6 over IP Tunnel",
}
View Source
var InterfaceConfigMap = map[string]*InterfaceConfig{}
View Source
var InterfaceVlanBindHook func(int, int)
View Source
var InterfaceVlanFea bool
View Source
var NetlinkDoneHook func()
View Source
var NexthopFlagMap = map[NEXTHOP_FLAG]string{
	NEXTHOP_IFINDEX:      "NEXTHOP_IFINDEX",
	NEXTHOP_IFNAME:       "NEXTHOP_IFNAME",
	NEXTHOP_IPV4:         "NEXTHOP_IPV4",
	NEXTHOP_IPV4_IFINDEX: "NEXTHOP_IPV4_IFINDEX",
	NEXTHOP_IPV4_IFNAME:  "NEXTHOP_IPV4_IFNAME",
	NEXTHOP_IPV6:         "NEXTHOP_IPV6",
	NEXTHOP_IPV6_IFINDEX: "NEXTHOP_IPV6_IFINDEX",
	NEXTHOP_IPV6_IFNAME:  "NEXTHOP_IPV6_IFNAME",
	NEXTHOP_BLACKHOLE:    "NEXTHOP_BLACKHOLE",
}
View Source
var NexthopLookupHook func(vrf *Vrf, nexthop net.IP) bool
View Source
var NoVRFDelete bool
View Source
var Parser *cmd.Node
View Source
var RibShowHeader = `` /* 311-byte string literal not displayed */
View Source
var RibShowHeaderDB = `       > - selected route, * - FIB route
`
View Source
var RouterIdTypeMap = map[int]string{
	RouterIdTypeUnset:     "router id not set",
	RouterIdTypeConfig:    "configured",
	RouterIdTypeLoopback:  "automatic from looback",
	RouterIdTypeAutomatic: "automatic",
}
View Source
var ShowParser *cmd.Node
View Source
var ShutdownSkipHook func(ifp *Interface) bool
View Source
var Stream struct {
	// contains filtered or unexported fields
}
View Source
var VlanDB = &vlanDB{}

Functions

func ARPHRD2IfType

func ARPHRD2IfType(ARPHRD uint16) uint8

func ArpDump

func ArpDump(ptree *netutil.Ptree)

func ClientRegister

func ClientRegister(conn net.Conn)

func ClientUnregister

func ClientUnregister(conn net.Conn)

func ClientVersion

func ClientVersion(conn net.Conn) uint8

func Config

func Config(command int, path []string)

func ConfigPull

func ConfigPull(path []string)

func ConfigPush

func ConfigPush(path []string)

func DtlsNexthop

func DtlsNexthop(vrfId int, nexthop net.IP) bool

func EsiConnected

func EsiConnected(p *netutil.Prefix) bool

func EsiIfAddHook

func EsiIfAddHook(ifp *Interface)

func EsiIfAddrAddHook

func EsiIfAddrAddHook(ifp *Interface, ifaddr *netutil.Prefix)

func EsiIfAddrDeleteHook

func EsiIfAddrDeleteHook(ifp *Interface, ifaddr *netutil.Prefix)

func EsiIfMask

func EsiIfMask(addr net.IP) int

func EsiNetlinkDoneHook

func EsiNetlinkDoneHook()

func EsiNexthopLookup

func EsiNexthopLookup(vrf *Vrf, nexthop net.IP) bool

func EsiShutdownSkipHook

func EsiShutdownSkipHook(ifp *Interface) bool

func EtcdIf

func EtcdIf(ifName string, ifp *Interface) string

func EtcdSetIfStatus

func EtcdSetIfStatus(ifname string, up bool, running bool)

func HandleMessage

func HandleMessage(conn net.Conn, h *Header, payloadLen int) error

func HandleRequest

func HandleRequest(conn net.Conn, vrfId int)

func HardwareAddrSet

func HardwareAddrSet(ifp *Interface, hwaddr net.HardwareAddr) error

func HeaderSize

func HeaderSize(version uint8) int

func Hello

func Hello(conn net.Conn, h *Header, data []byte) error

func IPv4NexthopLookup

func IPv4NexthopLookup(conn net.Conn, version byte, data []byte, vrfId uint16)

func IPv4Route

func IPv4Route(command COMMAND_TYPE, version uint8, conn net.Conn, data []byte, vrfId uint16)

func IPv4RouteApi

func IPv4RouteApi(Cmd int, Args cmd.Args) int

func IPv4VrfRouteApi

func IPv4VrfRouteApi(Cmd int, Args cmd.Args) int

func IPv4VrfRouteApi2

func IPv4VrfRouteApi2(Cmd int, Args cmd.Args) int

func IPv6RouteApi

func IPv6RouteApi(Cmd int, Args cmd.Args) int

func IfAdd

func IfAdd(ifi *IfInfo)

func IfAddrAdd

func IfAddrAdd(ai *IfAddrInfo)

func IfAddrClean

func IfAddrClean()

func IfAddrDelete

func IfAddrDelete(ai *IfAddrInfo)

func IfDelete

func IfDelete(ifi *IfInfo)

func IfDownRibRemove

func IfDownRibRemove(ifp *Interface)

func IfFlagsString

func IfFlagsString(flags uint32) string

func IfForceUp

func IfForceUp(ifName string)

func IfNameByIndex

func IfNameByIndex(index IfIndex) string

func IfRegister

func IfRegister(ifp *Interface)

func IfStatsScan

func IfStatsScan(version int, buf string, stats *IfStats)

func IfStatsUpdate

func IfStatsUpdate()

func IfStatusNotifyEtcd

func IfStatusNotifyEtcd(ifname string, up bool, running bool)

func IfSync

func IfSync(ifp *Interface, ifi *IfInfo)

func IfUnregister

func IfUnregister(ifp *Interface)

func IfUpRibAdd

func IfUpRibAdd(ifp *Interface)

func IfUpdate

func IfUpdate(ifi *IfInfo)

func IfVrfString

func IfVrfString(vrfIndex int) string

func InitAPI

func InitAPI()

func InterfaceAdd

func InterfaceAdd(conn net.Conn, h *Header, data []byte)

func InterfaceAddress

func InterfaceAddress(Cmd int, Args cmd.Args) int

func InterfaceConfigPush

func InterfaceConfigPush()

func InterfaceConfigSync

func InterfaceConfigSync(ifp *Interface, ifc *InterfaceConfig)

func InterfaceDescription

func InterfaceDescription(Cmd int, Args cmd.Args) int

func InterfaceIterate

func InterfaceIterate(f func(*Interface))

func InterfaceMtu

func InterfaceMtu(Cmd int, Args cmd.Args) int

func InterfaceShow

func InterfaceShow(jsonFlag bool, Args ...string) string

func InterfaceShowBrief

func InterfaceShowBrief(afi int) (line string)

func InterfaceShutdown

func InterfaceShutdown(Cmd int, Args cmd.Args) int

func InterfaceSyncWithConfig

func InterfaceSyncWithConfig()

func InterfaceVlanApi

func InterfaceVlanApi(Cmd int, Args cmd.Args) int

func InterfaceVrfApi

func InterfaceVrfApi(Cmd int, Args cmd.Args) int

func LinkSetDown

func LinkSetDown(ifp *Interface) error

func LinkSetMtu

func LinkSetMtu(ifp *Interface, mtu uint32) error

func LinkSetUp

func LinkSetUp(ifp *Interface) error

func MessageString

func MessageString(m uint8) string

func NeighFlagString

func NeighFlagString(flag uint8) string

func NeighStateString

func NeighStateString(state uint16) string

func NetlinkDumpAndSubscribe

func NetlinkDumpAndSubscribe(inst *Server) error

func NetlinkIpAddrAdd

func NetlinkIpAddrAdd(ifp *Interface, p *netutil.Prefix)

func NetlinkIpAddrDelete

func NetlinkIpAddrDelete(ifp *Interface, p *netutil.Prefix)

func NetlinkRouteAdd

func NetlinkRouteAdd(p *netutil.Prefix, rib *Rib, vrfId int) error

func NetlinkRouteDelete

func NetlinkRouteDelete(p *netutil.Prefix, rib *Rib, vrfId int) error

func NetlinkVlanAdd

func NetlinkVlanAdd(name string, vlanId int, parentIndex int)

func NetlinkVlanDelete

func NetlinkVlanDelete(name string, vlanId int)

func NetlinkVrfAdd

func NetlinkVrfAdd(name string, table int)

func NetlinkVrfBindInterface

func NetlinkVrfBindInterface(ifname string, ifindex IfIndex, master IfIndex)

func NetlinkVrfDelete

func NetlinkVrfDelete(name string, table int)

func NetlinkVrfUnbindInterface

func NetlinkVrfUnbindInterface(ifname string, ifindex IfIndex)

func PeerId

func PeerId(vrfId string, nexthop string) string

func RedistIPv4Add

func RedistIPv4Add(vrfId int, p *netutil.Prefix, rib *Rib, conn net.Conn)

func RedistIPv4Delete

func RedistIPv4Delete(vrfId int, p *netutil.Prefix, rib *Rib)

func RedistIPv4Route

func RedistIPv4Route(command COMMAND_TYPE, conn net.Conn, version uint8, vrfId int, p *netutil.Prefix, rib *Rib)

func RedistSync

func RedistSync(vrfId int, conn net.Conn)

func RedistSyncVrf

func RedistSyncVrf(vrf *Vrf, vrfId int, conn net.Conn)

func ResourceHandler

func ResourceHandler(resource Resource) http.HandlerFunc

func RibAdd

func RibAdd(index int, p *netutil.Prefix, ri *Rib)

func RibClearSrc

func RibClearSrc(src interface{})

func RibDelete

func RibDelete(index int, p *netutil.Prefix, ri *Rib)

func RibShow

func RibShow(vrfName string, t *ShowTask)

func RibStringType

func RibStringType(str string) uint8

func RibTypeString

func RibTypeString(typ uint8) string

func RibWalker

func RibWalker()

func RouteType2RibType

func RouteType2RibType(t ROUTE_TYPE) uint8

func RouterIdAdd

func RouterIdAdd(conn net.Conn, version byte, data []byte)

func RouterIdApi

func RouterIdApi(Cmd int, Args cmd.Args) int

func RpcConfig

func RpcConfig(conf *rpc.ConfigReply)

func RpcRegister

func RpcRegister()

func RpcServer

func RpcServer()

func ShowInterface

func ShowInterface(t *ShowTask, Args []interface{})

func ShowInterfaceVrf

func ShowInterfaceVrf(t *ShowTask, Args []interface{})

func ShowIpInterfaceBrief

func ShowIpInterfaceBrief(t *ShowTask, Args []interface{})

func ShowIpRoute

func ShowIpRoute(t *ShowTask, Args []interface{})

func ShowIpRouteDatabase

func ShowIpRouteDatabase(t *ShowTask, Args []interface{})

func ShowIpRouteType

func ShowIpRouteType(t *ShowTask, Args []interface{})

func ShowIpRouteVrf

func ShowIpRouteVrf(t *ShowTask, Args []interface{})

func ShowIpRouteVrfDatabase

func ShowIpRouteVrfDatabase(t *ShowTask, Args []interface{})

func ShowIpRouteVrfType

func ShowIpRouteVrfType(t *ShowTask, Args []interface{})

func ShowIpv6InterfaceBrief

func ShowIpv6InterfaceBrief(t *ShowTask, Args []interface{})

func ShowIpv6Route

func ShowIpv6Route(t *ShowTask, Args []interface{})

func ShowIpv6RouteDatabase

func ShowIpv6RouteDatabase(t *ShowTask, Args []interface{})

func ShowIpv6RouteVrf

func ShowIpv6RouteVrf(t *ShowTask, Args []interface{})

func ShowIpv6RouteVrfDatabase

func ShowIpv6RouteVrfDatabase(t *ShowTask, Args []interface{})

func ShowRouterId

func ShowRouterId(t *ShowTask, Args []interface{})

func TapAdd

func TapAdd(name string) (*os.File, error)

func TapDelete

func TapDelete(name string) error

func TunnelProbe

func TunnelProbe(vrfId string, peerId string) bool

func VIFClean

func VIFClean()

func VlanApi

func VlanApi(Cmd int, Args cmd.Args) int

func VrfApi

func VrfApi(Cmd int, Args cmd.Args) int

func VrfAssignIndex

func VrfAssignIndex() int

func VrfDefaultZservStart

func VrfDefaultZservStart()

func VrfExtractIndex

func VrfExtractIndex(name string) int

func VrfHubNodeAdd

func VrfHubNodeAdd(vrf string, hubNode string)

func VrfHubNodeApi

func VrfHubNodeApi(Cmd int, Args cmd.Args) int

func VrfHubNodeDelete

func VrfHubNodeDelete(vrf string, hubNode string)

func VrfStop

func VrfStop()

func WaitAsync

func WaitAsync(errCh chan error) error

func WatcherDone

func WatcherDone(v *Vrf, w *IfWatcher)

func ZServerStop

func ZServerStop(s *ZServer)

Types

type Body

type Body interface {
	DecodeFromBytes([]byte) error
	Serialize() ([]byte, error)
}

type COMMAND_TYPE

type COMMAND_TYPE uint16
const (
	INTERFACE_ADD COMMAND_TYPE
	INTERFACE_DELETE
	INTERFACE_ADDRESS_ADD
	INTERFACE_ADDRESS_DELETE
	INTERFACE_UP
	INTERFACE_DOWN
	IPV4_ROUTE_ADD
	IPV4_ROUTE_DELETE
	IPV6_ROUTE_ADD
	IPV6_ROUTE_DELETE
	REDISTRIBUTE_ADD
	REDISTRIBUTE_DELETE
	REDISTRIBUTE_DEFAULT_ADD
	REDISTRIBUTE_DEFAULT_DELETE
	IPV4_NEXTHOP_LOOKUP
	IPV6_NEXTHOP_LOOKUP
	IPV4_IMPORT_LOOKUP
	IPV6_IMPORT_LOOKUP
	INTERFACE_RENAME
	ROUTER_ID_ADD
	ROUTER_ID_DELETE
	ROUTER_ID_UPDATE
	HELLO
	IPV4_NEXTHOP_LOOKUP_MRIB
	VRF_UNREGISTER
	INTERFACE_LINK_PARAMS
	NEXTHOP_REGISTER
	NEXTHOP_UNREGISTER
	NEXTHOP_UPDATE
	MESSAGE_MAX
)

func (COMMAND_TYPE) String

func (c COMMAND_TYPE) String() string

type Client

type Client struct {
	Version uint8
	VrfId   int
}

type EtcdIfStatus

type EtcdIfStatus struct {
	Status         string `json:"status"`
	ProtocolStatus string `json:"protocol_status"`
	Address        string `json:"address,omitempty"`
	Prefix         string `json:"prefix,omitempty"`
}

type FLAG

type FLAG uint64

Message Flags

const (
	FLAG_INTERNAL  FLAG = 0x01
	FLAG_SELFROUTE FLAG = 0x02
	FLAG_BLACKHOLE FLAG = 0x04
	FLAG_IBGP      FLAG = 0x08
	FLAG_SELECTED  FLAG = 0x10
	FLAG_CHANGED   FLAG = 0x20
	FLAG_STATIC    FLAG = 0x40
	FLAG_REJECT    FLAG = 0x80
)

func (FLAG) String

func (t FLAG) String() string

type Fn

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

type GrpcComponent

type GrpcComponent struct {
}

func NewGrpcComponent

func NewGrpcComponent() *GrpcComponent

func (*GrpcComponent) Start

func (g *GrpcComponent) Start() component.Component

func (*GrpcComponent) Stop

func (g *GrpcComponent) Stop() component.Component
type Header struct {
	Length  uint16
	Marker  uint8
	Version uint8
	VrfId   uint16
	Command COMMAND_TYPE
}

func (*Header) DecodeFromBytes

func (h *Header) DecodeFromBytes(data []byte) error

func (*Header) Serialize

func (h *Header) Serialize() ([]byte, error)

type INTERFACE_STATUS

type INTERFACE_STATUS uint8

func (INTERFACE_STATUS) String

func (t INTERFACE_STATUS) String() string

type IPRouteBody

type IPRouteBody struct {
	Type      ROUTE_TYPE
	Flags     FLAG
	Message   uint8
	SAFI      SAFI
	Prefix    *netutil.Prefix
	Nexthop   *Nexthop
	Nexthops  []*Nexthop
	Ifindexes []uint32
	Distance  uint8
	Metric    uint32
	Api       COMMAND_TYPE
	Version   uint8
}

func (*IPRouteBody) DecodeFromBytes

func (b *IPRouteBody) DecodeFromBytes(data []byte) error

func (*IPRouteBody) Serialize

func (b *IPRouteBody) Serialize() ([]byte, error)

func (*IPRouteBody) SerializeV2

func (b *IPRouteBody) SerializeV2() ([]byte, error)

func (*IPRouteBody) SerializeV3

func (b *IPRouteBody) SerializeV3() ([]byte, error)

type IPv4NexthopLookupBody

type IPv4NexthopLookupBody struct {
	Addr net.IP
}

func (*IPv4NexthopLookupBody) DecodeFromBytes

func (b *IPv4NexthopLookupBody) DecodeFromBytes(data []byte) error

func (*IPv4NexthopLookupBody) Serialize

func (b *IPv4NexthopLookupBody) Serialize() ([]byte, error)

type IPv4NexthopReplyBody

type IPv4NexthopReplyBody struct {
	Addr       net.IP
	Metric     uint32
	NexthopNum uint8
	Nexthops   []*Nexthop
}

func (*IPv4NexthopReplyBody) DecodeFromBytes

func (b *IPv4NexthopReplyBody) DecodeFromBytes([]byte) error

func (*IPv4NexthopReplyBody) Serialize

func (b *IPv4NexthopReplyBody) Serialize() ([]byte, error)

type IfAddr

type IfAddr struct {
	Flags  IfAddrFlag      `json:"-"`
	Prefix *netutil.Prefix `json:"address"`
	Label  string          `json:"-"`
}

type IfAddrFlag

type IfAddrFlag uint32
const (
	IFADDR_SOURCE_SYSTEM IfAddrFlag = 1 << iota
	IFADDR_SOURCE_CONFIG
)

func (IfAddrFlag) CheckFlag

func (f IfAddrFlag) CheckFlag(flag IfAddrFlag) bool

func (IfAddrFlag) SetFlag

func (f IfAddrFlag) SetFlag(flag IfAddrFlag) IfAddrFlag

func (IfAddrFlag) SourceConfig

func (f IfAddrFlag) SourceConfig() bool

func (IfAddrFlag) SourceSystem

func (f IfAddrFlag) SourceSystem() bool

type IfAddrInfo

type IfAddrInfo struct {
	Flags   IfAddrFlag
	MsgType uint16
	Prefix  *netutil.Prefix
	Family  int
	Index   IfIndex
	Label   string
	Scope   int
}

func (*IfAddrInfo) String

func (ifaddr *IfAddrInfo) String() string

type IfAddrSlice

type IfAddrSlice []*IfAddr

func (IfAddrSlice) Delete

func (addrs IfAddrSlice) Delete(prefix *netutil.Prefix) (IfAddrSlice, *IfAddr)

func (IfAddrSlice) Lookup

func (addrs IfAddrSlice) Lookup(prefix *netutil.Prefix) *IfAddr

type IfIndex

type IfIndex uint32

type IfInfo

type IfInfo struct {
	MsgType uint16
	Name    string
	Index   uint32
	Mtu     uint32
	Metric  int
	Flags   uint32
	IfType  uint8
	HwAddr  net.HardwareAddr
	Table   int
	Master  int
	Boot    bool
}

func (*IfInfo) String

func (ifi *IfInfo) String() string

type IfShow

type IfShow struct {
	Name        string      `json:"name,omitempty"`
	Type        string      `json:"type,omitempty"`
	HwAddr      string      `json:"hardware-adddress,omitempty"`
	Desc        string      `json:"description,omitempty"`
	Index       IfIndex     `json:"index,omitempty"`
	Metric      int         `json:"metric,omitempty"`
	Mtu         uint32      `json:"mtu,omitempty"`
	Flags       string      `json:"flags,omitempty"`
	Vrf         string      `json:"vrf,omitempty"`
	AddressIPv4 IfAddrSlice `json:"ipv4-address,omitempty"`
	AddressIPv6 IfAddrSlice `json:"ipv6-address,omitempty"`
}

type IfStats

type IfStats struct {
	Rx_packets          uint32
	Rx_bytes            uint64
	Rx_errors           uint32
	Rx_dropped          uint32
	Rx_multicast        uint32
	Rx_compressed       uint32
	Rx_length_errors    uint32
	Rx_over_errors      uint32
	Rx_crc_errors       uint32
	Rx_frame_errors     uint32
	Rx_fifo_errors      uint32
	Rx_missed_errors    uint32
	Tx_packets          uint32
	Tx_bytes            uint64
	Tx_errors           uint32
	Tx_dropped          uint32
	Tx_compressed       uint32
	Tx_aborted_errors   uint32
	Tx_carrier_errors   uint32
	Tx_fifo_errors      uint32
	Tx_heartbeat_errors uint32
	Tx_window_errors    uint32
	Collisions          uint32
}

type IfStatsYang

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

type IfWatcher

type IfWatcher struct {
	Type   int
	IfName string
	Chan   chan error
	Timer  *time.Timer
}

type IfcFlag

type IfcFlag uint32

func (IfcFlag) CheckFlag

func (f IfcFlag) CheckFlag(flag IfcFlag) bool

func (IfcFlag) SetFlag

func (f IfcFlag) SetFlag(flag IfcFlag) IfcFlag

func (IfcFlag) UnsetFlag

func (f IfcFlag) UnsetFlag(flag IfcFlag) IfcFlag

type Interface

type Interface struct {
	Name        string
	Index       IfIndex
	VrfIndex    int
	Vrf         *Vrf
	IfType      uint8
	Mtu         uint32
	DefaultMtu  uint32
	Metric      int
	Flags       uint32
	Stats       IfStats
	Addrs       [AFI_MAX]IfAddrSlice
	HwAddr      net.HardwareAddr
	Description string
	Master      int
	VIFs        []*VIF
}

func IfLookupByIndex

func IfLookupByIndex(index IfIndex) *Interface

func IfLookupByName

func IfLookupByName(name string) *Interface

func (*Interface) IsBroadcast

func (ifp *Interface) IsBroadcast() bool

func (*Interface) IsLoopback

func (ifp *Interface) IsLoopback() bool

func (*Interface) IsRunning

func (ifp *Interface) IsRunning() bool

func (*Interface) IsUp

func (ifp *Interface) IsUp() bool

func (*Interface) Show

func (ifp *Interface) Show(jsonFlag bool) string

func (*Interface) ShowStats

func (ifp *Interface) ShowStats() string

func (*Interface) UnregisterVIF

func (ifp *Interface) UnregisterVIF(vlanId uint64) *VIF

func (*Interface) VIFLookup

func (ifp *Interface) VIFLookup(vlanId uint64) *VIF

type InterfaceAddressUpdateBody

type InterfaceAddressUpdateBody struct {
	Index  uint32
	Flags  uint8
	Prefix net.IP
	Length uint8
}

func NewInterfaceAddrUpdateBody

func NewInterfaceAddrUpdateBody(addr *IfAddr) *InterfaceAddressUpdateBody

func (*InterfaceAddressUpdateBody) DecodeFromBytes

func (b *InterfaceAddressUpdateBody) DecodeFromBytes(data []byte) error

func (*InterfaceAddressUpdateBody) Serialize

func (b *InterfaceAddressUpdateBody) Serialize() ([]byte, error)

type InterfaceConfig

type InterfaceConfig struct {
	Flags       IfcFlag
	Name        string
	Description string
	Shutdown    bool
	HwAddr      []byte
	Index       int
	L3Index     int
	VlanId      int
	Addrs       [AFI_MAX]IfAddrSlice
	Interface   *Interface
	Mtu         uint32
}

func InterfaceConfigGet

func InterfaceConfigGet(ifname string) *InterfaceConfig

func InterfaceConfigLookup

func InterfaceConfigLookup(ifname string) *InterfaceConfig

func NewInterfaceConfig

func NewInterfaceConfig(ifname string) *InterfaceConfig

func (*InterfaceConfig) AddrAdd

func (ifc *InterfaceConfig) AddrAdd(ifName string, addr *netutil.Prefix) error

func (*InterfaceConfig) AddrDelete

func (ifc *InterfaceConfig) AddrDelete(ifName string, addr *netutil.Prefix) error

func (*InterfaceConfig) DescriptionSet

func (ifc *InterfaceConfig) DescriptionSet(desc string)

func (*InterfaceConfig) DescriptionUnset

func (ifc *InterfaceConfig) DescriptionUnset()

func (*InterfaceConfig) MtuSet

func (ifc *InterfaceConfig) MtuSet(mtu uint32)

func (*InterfaceConfig) MtuSync

func (ifc *InterfaceConfig) MtuSync(ifp *Interface)

func (*InterfaceConfig) MtuUnset

func (ifc *InterfaceConfig) MtuUnset()

func (*InterfaceConfig) ShutdownSet

func (ifc *InterfaceConfig) ShutdownSet()

func (*InterfaceConfig) ShutdownSync

func (ifc *InterfaceConfig) ShutdownSync(ifp *Interface)

func (*InterfaceConfig) ShutdownUnset

func (ifc *InterfaceConfig) ShutdownUnset()

func (*InterfaceConfig) Sync

func (ifc *InterfaceConfig) Sync(flags IfcFlag)

type InterfaceUpdateBody

type InterfaceUpdateBody struct {
	Name      string
	Index     uint32
	Status    INTERFACE_STATUS
	Flags     uint64
	Metric    uint32
	Mtu       uint32
	Mtu6      uint32
	Bandwidth uint32
	HwAddr    net.HardwareAddr
}

func NewInterfaceUpdateBody

func NewInterfaceUpdateBody(ifp *Interface) *InterfaceUpdateBody

func (*InterfaceUpdateBody) DecodeFromBytes

func (b *InterfaceUpdateBody) DecodeFromBytes([]byte) error

func (*InterfaceUpdateBody) Serialize

func (b *InterfaceUpdateBody) Serialize() ([]byte, error)

type InterfacesStateHandler

type InterfacesStateHandler struct {
	ResourceBase
}

func (InterfacesStateHandler) Get

func (InterfacesStateHandler) Get(url string, queries url.Values) (Status, interface{})

(ietf-)interfaces/interfaces-state/[name]/statistics

type Message

type Message struct {
	Header Header
	Body   Body
}

func (*Message) Serialize

func (m *Message) Serialize() ([]byte, error)

type NEXTHOP_FLAG

type NEXTHOP_FLAG uint8
const (
	NEXTHOP_IFINDEX NEXTHOP_FLAG
	NEXTHOP_IFNAME
	NEXTHOP_IPV4
	NEXTHOP_IPV4_IFINDEX
	NEXTHOP_IPV4_IFNAME
	NEXTHOP_IPV6
	NEXTHOP_IPV6_IFINDEX
	NEXTHOP_IPV6_IFNAME
	NEXTHOP_BLACKHOLE
)

func (NEXTHOP_FLAG) String

func (n NEXTHOP_FLAG) String() string

type Ndmsg

type Ndmsg struct {
	Family uint8
	Index  uint32
	State  uint16
	Flags  uint8
	Type   uint8
}

func (*Ndmsg) Len

func (msg *Ndmsg) Len() int

type Neigh

type Neigh struct {
	LinkIndex    int
	Family       int
	State        uint16
	Type         int
	Flags        uint8
	IP           net.IP
	HardwareAddr net.HardwareAddr
}

Neigh represents a link layer neighbor from netlink.

func (*Neigh) IsReachable

func (n *Neigh) IsReachable() bool

type Nexthop

type Nexthop struct {
	net.IP
	Index IfIndex
}

func NewNexthopAddr

func NewNexthopAddr(ip net.IP) *Nexthop

func NewNexthopAddrIf

func NewNexthopAddrIf(ip net.IP, index IfIndex) *Nexthop

func NewNexthopIf

func NewNexthopIf(index IfIndex) *Nexthop

func (*Nexthop) AddressString

func (n *Nexthop) AddressString() string

func (*Nexthop) Equal

func (n *Nexthop) Equal(nn *Nexthop) bool

func (*Nexthop) InterfaceString

func (n *Nexthop) InterfaceString() string

func (*Nexthop) IsAddrIf

func (n *Nexthop) IsAddrIf() bool

func (*Nexthop) IsAddrOnly

func (n *Nexthop) IsAddrOnly() bool

func (*Nexthop) IsIfOnly

func (n *Nexthop) IsIfOnly() bool

func (*Nexthop) MarshalJSON

func (n *Nexthop) MarshalJSON() ([]byte, error)

func (Nexthop) String

func (n Nexthop) String() string

type NexthopInfo

type NexthopInfo struct {
	LinkIndex int
	Hops      int
	Gateway   net.IP
}

type ROUTE_TYPE

type ROUTE_TYPE uint8
const (
	ROUTE_SYSTEM ROUTE_TYPE = iota
	ROUTE_KERNEL
	ROUTE_CONNECT
	ROUTE_STATIC
	ROUTE_RIP
	ROUTE_RIPNG
	ROUTE_OSPF
	ROUTE_OSPF6
	ROUTE_ISIS
	ROUTE_BGP
	ROUTE_HSLS
	ROUTE_OLSR
	ROUTE_BABEL
	ROUTE_MAX
)

type Resource

type Resource interface {
	Get(url string, queries url.Values) (Status, interface{})
	Post(url string, queries url.Values) (Status, interface{})
	Put(url string, queries url.Values) (Status, interface{})
	Delete(url string, queries url.Values) (Status, interface{})
}

type ResourceBase

type ResourceBase struct{}

func (ResourceBase) Delete

func (ResourceBase) Delete(url string, queries url.Values) (Status, interface{})

func (ResourceBase) Get

func (ResourceBase) Get(url string, queries url.Values) (Status, interface{})

func (ResourceBase) Post

func (ResourceBase) Post(url string, queries url.Values) (Status, interface{})

func (ResourceBase) Put

func (ResourceBase) Put(url string, queries url.Values) (Status, interface{})

type RestComponent

type RestComponent struct {
}

func NewRestComponent

func NewRestComponent() *RestComponent

func (*RestComponent) Start

func (r *RestComponent) Start() component.Component

func (*RestComponent) Stop

func (r *RestComponent) Stop() component.Component

type Rib

type Rib struct {
	Flags    RibFlag
	Prefix   *netutil.Prefix
	Type     uint8
	Subtype  uint8
	Distance uint8
	Metric   uint32
	IfAddr   *IfAddr
	Nexthop  *Nexthop
	Nexthops []*Nexthop
	Src      interface{}
	Redist   bool
}

func NewRib

func NewRib(p *netutil.Prefix, ri *Rib) *Rib

func (*Rib) CheckFlag

func (r *Rib) CheckFlag(flag RibFlag) bool

func (*Rib) Equal

func (rib *Rib) Equal(ri *Rib) bool

func (*Rib) HasDistance

func (r *Rib) HasDistance() bool

func (*Rib) HasMetric

func (r *Rib) HasMetric() bool

func (*Rib) IsFib

func (r *Rib) IsFib() bool

func (*Rib) IsResolved

func (r *Rib) IsResolved() bool

func (*Rib) IsSelected

func (r *Rib) IsSelected() bool

func (*Rib) IsSelectedFib

func (r *Rib) IsSelectedFib() bool

func (*Rib) IsSystem

func (r *Rib) IsSystem() bool

func (*Rib) MarshalJSON

func (r *Rib) MarshalJSON() ([]byte, error)

func (*Rib) SetFib

func (r *Rib) SetFib()

func (*Rib) SetFlag

func (r *Rib) SetFlag(flag RibFlag)

func (*Rib) SetResolved

func (r *Rib) SetResolved()

func (*Rib) SetSelected

func (r *Rib) SetSelected()

func (*Rib) UnsetFib

func (r *Rib) UnsetFib()

func (*Rib) UnsetFlag

func (r *Rib) UnsetFlag(flag RibFlag)

func (*Rib) UnsetResolved

func (r *Rib) UnsetResolved()

func (*Rib) UnsetSelected

func (r *Rib) UnsetSelected()

type RibFlag

type RibFlag uint
const (
	RIB_FLAG_RESOLVED  RibFlag // Static route and iBGP (multipath eBGP) next hop will be resolved.
	RIB_FLAG_BLACKHOLE         // This is black hole route.
)

type RibShowParam

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

type RibSlice

type RibSlice []*Rib

type RouteInfo

type RouteInfo struct {
	MsgType uint16
	Rib
	Table     int
	MultiPath []*NexthopInfo
}

Route represents a netlink route.

func (RouteInfo) String

func (route RouteInfo) String() string

type RouterIDUpdateBody

type RouterIDUpdateBody struct {
	IP     net.IP
	Length uint8
}

ROUTER_ID_ADD

func (*RouterIDUpdateBody) DecodeFromBytes

func (b *RouterIDUpdateBody) DecodeFromBytes(data []byte) error

func (*RouterIDUpdateBody) Serialize

func (b *RouterIDUpdateBody) Serialize() ([]byte, error)

func (*RouterIDUpdateBody) String

func (b *RouterIDUpdateBody) String() string

type RouterId

type RouterId struct {
	Type          int
	Configured    bool
	ConfigId      net.IP
	Id            net.IP
	LoopbackAddrs *netutil.Ptree
	OtherAddrs    *netutil.Ptree
}

func (*RouterId) Init

func (rid *RouterId) Init()

type SAFI

type SAFI uint8

Subsequent Address Family Identifier.

const (
	SAFI_UNICAST SAFI
	SAFI_MULTICAST
	SAFI_RESERVED_3
	SAFI_MPLS_VPN
	SAFI_MAX
)

type Server

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

func NewServer

func NewServer() *Server

func (*Server) AddrAdd

func (s *Server) AddrAdd(ifName string, addr *netutil.Prefix) error

func (*Server) AddrDelete

func (s *Server) AddrDelete(ifName string, addr *netutil.Prefix) error

func (*Server) IfUp

func (s *Server) IfUp(ifName string) error

func (*Server) IfVrfBind

func (s *Server) IfVrfBind(ifName string, vrfName string) error

func (*Server) IfVrfUnbind

func (s *Server) IfVrfUnbind(ifName string, vrfName string) error

func (*Server) Serv

func (s *Server) Serv()

func (*Server) Start

func (s *Server) Start() component.Component

func (*Server) StaticAdd

func (s *Server) StaticAdd(prefix *netutil.Prefix, nexthop net.IP) error

func (*Server) StaticDelete

func (s *Server) StaticDelete(prefix *netutil.Prefix, nexthop net.IP) error

func (*Server) Stop

func (s *Server) Stop() component.Component

func (*Server) VIFAdd

func (s *Server) VIFAdd(ifName string, vlanId uint64) error

API.

func (*Server) VIFDelete

func (s *Server) VIFDelete(ifName string, vlanId uint64) error

func (*Server) VrfAdd

func (s *Server) VrfAdd(vrfName string) error

func (*Server) VrfDelete

func (s *Server) VrfDelete(vrfName string) error

type ShowFunc

type ShowFunc func(*ShowTask, []interface{})

type ShowServer

type ShowServer struct {
}

func NewShowServer

func NewShowServer() *ShowServer

func (*ShowServer) Show

func (s *ShowServer) Show(req *rpc.ShowRequest, stream rpc.Show_ShowServer) error

type ShowTask

type ShowTask struct {
	Json     bool
	First    bool
	Continue bool
	Str      string
	Index    interface{}
}

Show framework.

func NewShowTask

func NewShowTask() *ShowTask

type Static

type Static struct {
	Prefix   *netutil.Prefix
	Distance uint8
	IfName   string
	Nexthops []*Nexthop
}

func (*Static) Rib

func (s *Static) Rib() *Rib

type Status

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

func FailCode

func FailCode(code int) Status

type VIF

type VIF struct {
	Id uint64
}

func NewVIF

func NewVIF(vlanId uint64) *VIF

type Vlan

type Vlan struct {
	VlanId   uint16
	IfName   string
	IfConfig *InterfaceConfig
	File     *os.File
	Ports    []*InterfaceConfig
}

func (*Vlan) Reader

func (vlan *Vlan) Reader()

type Vrf

type Vrf struct {
	Name    string
	Index   int
	IfTable *netutil.Ptree
	IfMap   map[string]*Interface

	ZServer *ZServer
	Mutex   sync.RWMutex
	IfMutex sync.Mutex
	Watcher map[*IfWatcher]bool
	WMutex  sync.Mutex
	// contains filtered or unexported fields
}

func NewVrf

func NewVrf(name string, index int) *Vrf

func VrfAssign

func VrfAssign(name string, index int) (*Vrf, error)

func VrfDefault

func VrfDefault() *Vrf

func VrfLookupByIndex

func VrfLookupByIndex(index int) *Vrf

func VrfLookupByName

func VrfLookupByName(name string) *Vrf

func (*Vrf) AfiPtree

func (v *Vrf) AfiPtree(p *netutil.Prefix) *netutil.Ptree

func (*Vrf) ArpAdd

func (v *Vrf) ArpAdd(neigh *Neigh)

func (*Vrf) ArpDelete

func (v *Vrf) ArpDelete(neigh *Neigh)

func (*Vrf) ArpTable

func (v *Vrf) ArpTable(neigh *Neigh) *netutil.Ptree

func (*Vrf) IfLookupByIndex

func (v *Vrf) IfLookupByIndex(index IfIndex) *Interface

func (*Vrf) IfLookupByName

func (v *Vrf) IfLookupByName(name string) *Interface

func (*Vrf) IfName

func (v *Vrf) IfName(index IfIndex) string

func (*Vrf) IfRegister

func (v *Vrf) IfRegister(ifp *Interface)

func (*Vrf) IfUnregister

func (v *Vrf) IfUnregister(ifp *Interface)

func (*Vrf) IfWatchAdd

func (v *Vrf) IfWatchAdd(typ int, ifName string, errCh chan error) *IfWatcher

func (*Vrf) InterfaceIterate

func (v *Vrf) InterfaceIterate(f func(*Interface))

func (*Vrf) InterfaceShow

func (v *Vrf) InterfaceShow(jsonFlag bool, Args ...string) (line string)

func (*Vrf) IsValid

func (v *Vrf) IsValid(rib *Rib) bool

func (*Vrf) Resolve

func (v *Vrf) Resolve(ri *Rib)

func (*Vrf) RibAdd

func (v *Vrf) RibAdd(p *netutil.Prefix, ri *Rib)

func (*Vrf) RibClean

func (v *Vrf) RibClean(src interface{})

func (*Vrf) RibDelete

func (v *Vrf) RibDelete(p *netutil.Prefix, ri *Rib)

func (*Vrf) RibProcess

func (v *Vrf) RibProcess(p *netutil.Prefix, ribs RibSlice, del *Rib, resolve bool)

func (*Vrf) RibShow

func (v *Vrf) RibShow(t *ShowTask)

func (*Vrf) RibShowEntryJson

func (v *Vrf) RibShowEntryJson(t *ShowTask, p *RibShowParam, rib *Rib)

func (*Vrf) RibShowIPv4Entry

func (v *Vrf) RibShowIPv4Entry(t *ShowTask, rib *Rib, database bool)

func (*Vrf) RibShowIPv4Nexthop

func (v *Vrf) RibShowIPv4Nexthop(rib *Rib, n *Nexthop, offset int, out io.Writer)

func (*Vrf) RibShowIPv6Entry

func (v *Vrf) RibShowIPv6Entry(t *ShowTask, rib *Rib, database bool)

func (*Vrf) RibSync

func (v *Vrf) RibSync(afi int)

func (*Vrf) RibWalker

func (v *Vrf) RibWalker()

func (*Vrf) RouterId

func (v *Vrf) RouterId() net.IP

func (*Vrf) RouterIdAdd

func (v *Vrf) RouterIdAdd(ifp *Interface, addr *IfAddr)

func (*Vrf) RouterIdDelete

func (v *Vrf) RouterIdDelete(ifp *Interface, addr *IfAddr)

func (*Vrf) RouterIdSet

func (v *Vrf) RouterIdSet(id net.IP)

func (*Vrf) RouterIdShow

func (v *Vrf) RouterIdShow() string

func (*Vrf) RouterIdUnset

func (v *Vrf) RouterIdUnset()

func (*Vrf) RouterIdUpdate

func (v *Vrf) RouterIdUpdate()

func (*Vrf) RouterIdUpdateNotification

func (v *Vrf) RouterIdUpdateNotification()

func (*Vrf) StaticAdd

func (v *Vrf) StaticAdd(p *netutil.Prefix, naddr net.IP) error

func (*Vrf) StaticDelete

func (v *Vrf) StaticDelete(p *netutil.Prefix, naddr net.IP) error

type ZServer

type ZServer struct {
	Path   string
	Listen net.Listener
	VrfId  int
}

func ZServerStart

func ZServerStart(path string, vrfId int) *ZServer

type ZebraServer

type ZebraServer struct{}

func NewZebraServer

func NewZebraServer() *ZebraServer

func (*ZebraServer) RouteIPv4Add

func (z *ZebraServer) RouteIPv4Add(_ context.Context, req *zebra.RouteIPv4) (*zebra.RouteIPv4Response, error)

func (*ZebraServer) RouteIPv4Delete

func (z *ZebraServer) RouteIPv4Delete(_ context.Context, req *zebra.RouteIPv4) (*zebra.RouteIPv4Response, error)

func (*ZebraServer) RouteIPv6Add

func (z *ZebraServer) RouteIPv6Add(_ context.Context, req *zebra.RouteIPv6) (*zebra.RouteIPv6Response, error)

func (*ZebraServer) RouteIPv6Delete

func (z *ZebraServer) RouteIPv6Delete(_ context.Context, req *zebra.RouteIPv6) (*zebra.RouteIPv6Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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