rib

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: Apache-2.0 Imports: 41 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_OSPF
	RIB_ISIS
	RIB_BGP
	RIB_MAX
)
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_OSPF      = 110
	DISTANCE_ISIS      = 115
	DISTANCE_EBGP      = 20
	DISTANCE_IBGP      = 200
	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 (
	WATCH_TYPE_INTERFACE      = 0
	WATCH_TYPE_ROUTER_ID      = 1
	WATCH_TYPE_REDIST         = 2
	WATCH_TYPE_REDIST_DEFAULT = 3
	WATCH_TYPE_MAX            = 4
)
View Source
const (
	HEADER_V2_LEN    = 6
	HEADER_V3_V4_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
	MESSAGE_MTU      = 0x10
	MESSAGE_TAG      = 0x20
	MESSAGE_PATH_ID  = 0x40
	MESSAGE_ASPATH   = 0x80
)
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 (
	LanInterfaceTable LanForwardingTable
	LanInterfaceFound bool
	LanInterfaceMutex sync.RWMutex
)
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[CommandType]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[uint32]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 LocalPolicy = false
View Source
var NetlinkDoneHook func()
View Source
var NetlinkIPv4AddressEnsure = false
View Source
var (
	NewServerHook 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

For all VRF redistribute.

View Source
var RibShowHeader = `` /* 311-byte string literal not displayed */
View Source
var RibShowHeaderDB = `       > - selected route, * - FIB route
`
View Source
var RouteTypeStringMap = map[RouteType]string{
	ROUTE_SYSTEM:  "system",
	ROUTE_KERNEL:  "kernel",
	ROUTE_CONNECT: "connect",
	ROUTE_STATIC:  "static",
	ROUTE_RIP:     "rip",
	ROUTE_RIPNG:   "ripng",
	ROUTE_OSPF:    "ospf",
	ROUTE_OSPF6:   "ospf3",
	ROUTE_ISIS:    "isis",
	ROUTE_BGP:     "bgp",
	ROUTE_HSLS:    "hsls",
	ROUTE_OLSR:    "olsr",
	ROUTE_BABEL:   "babel",
}
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 ClientUnregister

func ClientUnregister(conn net.Conn)

func Config

func Config(command int, path []string)

func ConfigJSON added in v1.8.1

func ConfigJSON(conf *rpc.ConfigReply)

func ConfigPrefixListJSON added in v1.8.1

func ConfigPrefixListJSON(jsonStr string)

func ConfigPull

func ConfigPull(path []string)

func ConfigPush

func ConfigPush(path []string)

func DistanceCalc added in v1.8.1

func DistanceCalc(typ uint8, subType uint8) uint8

func DistributeListOspf added in v1.8.1

func DistributeListOspf(dlistName string, p *netutil.Prefix, ri *Rib) policy.Action

func DistributeListOspfApi added in v1.8.1

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

func DtlsNexthop

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

func EncapTypeString added in v1.8.1

func EncapTypeString(typ int) string

Encap Helper functions for LWT (light weight tunnel)

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 EsiNewServerHook added in v1.8.1

func EsiNewServerHook()

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 HandleBody added in v1.8.1

func HandleBody(client *Client, h *Header, len int) error

func HardwareAddrSet

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

func HeaderSize

func HeaderSize(version uint8) int

func IPv4RouteApi

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

func IPv4RouteSeg6SegmentsApi added in v1.8.1

func IPv4RouteSeg6SegmentsApi(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 IPv6RouteSeg6SegmentsApi added in v1.8.1

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

func IPv6VrfRouteApi added in v1.8.1

func IPv6VrfRouteApi(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(vrfId uint32) string

func InitAPI

func InitAPI()

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 IsLanInterface added in v1.8.1

func IsLanInterface(ifName string) bool

func LanFileMonitor added in v1.8.1

func LanFileMonitor(fileName string)

func LanInterfaceMonitorStart added in v1.8.1

func LanInterfaceMonitorStart()

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 uint32) error

func NetlinkRouteDelete

func NetlinkRouteDelete(p *netutil.Prefix, rib *Rib, vrfId uint32) 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 uint32)

func NetlinkVrfBindInterface

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

func NetlinkVrfDelete

func NetlinkVrfDelete(name string, table uint32)

func NetlinkVrfUnbindInterface

func NetlinkVrfUnbindInterface(ifname string, ifindex IfIndex)

func NewAddress added in v1.8.1

func NewAddress(addr *IfAddr) *pb.Address

func NewInterfaceAddrUpdate added in v1.8.1

func NewInterfaceAddrUpdate(op pb.Op, ifp *Interface, addr *IfAddr) *pb.InterfaceUpdate

func NewInterfaceUpdate added in v1.8.1

func NewInterfaceUpdate(op pb.Op, ifp *Interface) *pb.InterfaceUpdate

func NewInterfaceUpdateFull added in v1.8.1

func NewInterfaceUpdateFull(op pb.Op, ifp *Interface) *pb.InterfaceUpdate

func NewPrefixFromPb added in v1.8.1

func NewPrefixFromPb(p *pb.Prefix) *netutil.Prefix

func NewRpcPeer added in v1.8.1

func NewRpcPeer(s *Server) *rpcPeer

func NewRpcServer added in v1.8.1

func NewRpcServer(s *Server) *rpcServer

func NexthopEncode added in v1.8.1

func NexthopEncode(rib *Rib) []*pb.Nexthop

func NotifyInterfaces added in v1.8.1

func NotifyInterfaces(w Watcher, vrf *Vrf)

func NotifyRouterId added in v1.8.1

func NotifyRouterId(w Watcher, vrf *Vrf)

func PeerId

func PeerId(vrfId string, nexthop string) string

func PrefixFilter added in v1.8.1

func PrefixFilter(p *netutil.Prefix, r *pb.Route) bool

func ResourceHandler

func ResourceHandler(resource Resource) http.HandlerFunc

func RibAdd

func RibAdd(vrfId uint32, p *netutil.Prefix, ri *Rib)

func RibClearSrc

func RibClearSrc(src interface{})

func RibDelete

func RibDelete(vrfId uint32, p *netutil.Prefix, ri *Rib)

func RibShow

func RibShow(vrfName string, t *ShowTask)

func RibStringType

func RibStringType(str string) uint8

func RibTypeFromRouteType added in v1.8.1

func RibTypeFromRouteType(typ uint8) (uint8, int)

func RibTypeString

func RibTypeString(typ uint8) string

func RibWalker

func RibWalker()

func RouteType2RibType

func RouteType2RibType(t RouteType) uint8

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 Seg6LocalEndApi added in v1.8.1

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

func Seg6LocalEndB6Api added in v1.8.1

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

func Seg6LocalEndB6EncapsApi added in v1.8.1

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

func Seg6LocalEndDT6Api added in v1.8.1

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

func Seg6LocalEndDX2Api added in v1.8.1

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

func Seg6LocalEndDX4Api added in v1.8.1

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

func Seg6LocalEndDX6Api added in v1.8.1

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

func Seg6LocalEndTApi added in v1.8.1

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

func Seg6LocalEndXApi added in v1.8.1

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

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 ShowRibdNumGoroutine added in v1.8.1

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

func ShowRouterId

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

func ShowRouterIdVrf added in v1.8.1

func ShowRouterIdVrf(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() uint32

func VrfDefaultZservStart

func VrfDefaultZservStart()

func VrfExtractIndex

func VrfExtractIndex(name string) uint32

func VrfFilter added in v1.8.1

func VrfFilter(c *Client, r *pb.Route) bool

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, err error)

func WatcherNotifyAddressAdd added in v1.8.1

func WatcherNotifyAddressAdd(ifp *Interface, addr *IfAddr)

func WatcherNotifyAddressDelete added in v1.8.1

func WatcherNotifyAddressDelete(ifp *Interface, addr *IfAddr)

func ZServerStop

func ZServerStop(s *ZServer)

Types

type Body

type Body interface {
	DecodeFromBytes(CommandType, []byte) error
	Serialize() ([]byte, error)
	Process(*Client, *Header) error
}

type Client

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

func ClientRegister

func ClientRegister(conn net.Conn) *Client

func (*Client) HandleRequest added in v1.8.1

func (c *Client) HandleRequest(conn net.Conn, vrfId uint32)

func (*Client) InterfaceNotify added in v1.8.1

func (c *Client) InterfaceNotify(mes *pb.InterfaceUpdate)

func (*Client) Notify added in v1.8.1

func (c *Client) Notify(mes interface{})

func (*Client) RouteNotify added in v1.8.1

func (c *Client) RouteNotify(r *pb.Route)

func (*Client) RouteNotifyGobgp added in v1.8.1

func (c *Client) RouteNotifyGobgp(p *netutil.Prefix, r *pb.Route)

func (*Client) RouterIdUpdateNotify added in v1.8.1

func (c *Client) RouterIdUpdateNotify(mes *pb.RouterIdUpdate)

type CommandType added in v1.8.1

type CommandType uint16
const (
	INTERFACE_ADD CommandType
	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 (CommandType) String added in v1.8.1

func (c CommandType) String() string

type EncapSEG6 added in v1.8.1

type EncapSEG6 struct {
	Mode     int
	Segments []net.IP
}

func (EncapSEG6) Equal added in v1.8.1

func (e EncapSEG6) Equal(x EncapSEG6) bool

func (EncapSEG6) String added in v1.8.1

func (e EncapSEG6) String() string

type EncapSEG6Local added in v1.8.1

type EncapSEG6Local netlink.SEG6LocalEncap

func (EncapSEG6Local) Equal added in v1.8.1

func (e EncapSEG6Local) Equal(o EncapSEG6Local) bool

func (EncapSEG6Local) String added in v1.8.1

func (e EncapSEG6Local) String() string

type EtcdIfStatus

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

type EtcdIfStatusIPv6 added in v1.8.1

type EtcdIfStatusIPv6 struct {
	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 CommandType
}

func (*Header) DecodeFromBytes

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

func (*Header) Serialize

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

type HelloBody added in v1.8.1

type HelloBody struct {
	RouteType RouteType `json:"route-type"`
}

func (*HelloBody) DecodeFromBytes added in v1.8.1

func (b *HelloBody) DecodeFromBytes(command CommandType, data []byte) error

func (*HelloBody) MarshalJSON added in v1.8.1

func (b *HelloBody) MarshalJSON() ([]byte, error)

func (*HelloBody) Process added in v1.8.1

func (b *HelloBody) Process(client *Client, h *Header) error

func (*HelloBody) Serialize added in v1.8.1

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

type INTERFACE_STATUS

type INTERFACE_STATUS uint8

func (INTERFACE_STATUS) String

func (t INTERFACE_STATUS) String() string

type IPv4NexthopLookupBody

type IPv4NexthopLookupBody struct {
	Addr net.IP
}

Nexthop lookup for IPv4 routes.

func (*IPv4NexthopLookupBody) DecodeFromBytes

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

func (*IPv4NexthopLookupBody) Process added in v1.8.1

func (b *IPv4NexthopLookupBody) Process(client *Client, h *Header) 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(CommandType, []byte) error

func (*IPv4NexthopReplyBody) Process added in v1.8.1

func (b *IPv4NexthopReplyBody) Process(*Client, *Header) 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  uint32
	Flags   uint32
	IfType  uint8
	HwAddr  net.HardwareAddr
	Table   uint32
	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      uint32      `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   uint32
	Vrf        *Vrf
	IfType     uint8
	Mtu        uint32
	DefaultMtu uint32
	Metric     uint32
	Flags      uint32
	Stats      IfStats
	Addrs      [AFI_MAX]IfAddrSlice
	//HwAddr      net.HardwareAddr
	HwAddr      []byte
	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) NotifyInterface added in v1.8.1

func (ifp *Interface) NotifyInterface(op pb.Op)

func (*Interface) NotifyInterfaceAdd added in v1.8.1

func (ifp *Interface) NotifyInterfaceAdd()

func (*Interface) NotifyInterfaceDelete added in v1.8.1

func (ifp *Interface) NotifyInterfaceDelete()

func (*Interface) NotifyInterfaceDown added in v1.8.1

func (ifp *Interface) NotifyInterfaceDown()

func (*Interface) NotifyInterfaceFlagChange added in v1.8.1

func (ifp *Interface) NotifyInterfaceFlagChange()

func (*Interface) NotifyInterfaceMtuChange added in v1.8.1

func (ifp *Interface) NotifyInterfaceMtuChange()

func (*Interface) NotifyInterfaceNameChange added in v1.8.1

func (ifp *Interface) NotifyInterfaceNameChange()

func (*Interface) NotifyInterfaceUp added in v1.8.1

func (ifp *Interface) NotifyInterfaceUp()

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 NewInterfaceAddrUpdateBodyPb added in v1.8.1

func NewInterfaceAddrUpdateBodyPb(ifIndex uint32, addr *pb.Address) *InterfaceAddressUpdateBody

func (*InterfaceAddressUpdateBody) DecodeFromBytes

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

func (*InterfaceAddressUpdateBody) Process added in v1.8.1

func (b *InterfaceAddressUpdateBody) Process(client *Client, h *Header) 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    []byte
}

func NewInterfaceUpdateBodyPb added in v1.8.1

func NewInterfaceUpdateBodyPb(mes *pb.InterfaceUpdate) *InterfaceUpdateBody

func (*InterfaceUpdateBody) DecodeFromBytes

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

func (*InterfaceUpdateBody) Process added in v1.8.1

func (b *InterfaceUpdateBody) Process(client *Client, h *Header) 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 LanForwardingTable added in v1.8.1

type LanForwardingTable struct {
	InterfaceTable struct {
		Tenant struct {
			Interfaces []string `mapstructure:"local-interface"`
		} `mapstructure:"tenant"`
	} `mapstructure:"interface-table"`
}

type Message

type Message struct {
	Header Header
	Body   Body
}

func NewMessage added in v1.8.1

func NewMessage(version uint8, command CommandType, body Body) *Message

func (*Message) Send added in v1.8.1

func (m *Message) Send(conn net.Conn)

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
	EncapType      int
	EncapSeg6      EncapSEG6
	EncapSeg6Local EncapSEG6Local
}

func NewNexthop added in v1.8.1

func NewNexthop(nhop *pb.Nexthop) *Nexthop

func NewNexthopAddr

func NewNexthopAddr(ip net.IP) *Nexthop

func NewNexthopAddrIf

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

func NewNexthopFromPb added in v1.8.1

func NewNexthopFromPb(n *pb.Nexthop) *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
	EncapType      int
	EncapSeg6      EncapSEG6
	EncapSeg6Local EncapSEG6Local
}

type RedistributeBody added in v1.8.1

type RedistributeBody struct {
	Type uint8
}

Redistribute routes.

func (*RedistributeBody) DecodeFromBytes added in v1.8.1

func (b *RedistributeBody) DecodeFromBytes(command CommandType, data []byte) error

func (*RedistributeBody) Process added in v1.8.1

func (b *RedistributeBody) Process(client *Client, h *Header) error

func (*RedistributeBody) Serialize added in v1.8.1

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

type RedistributeDefaultBody added in v1.8.1

type RedistributeDefaultBody struct {
}

Redistribute default message. Message body is empty. When redistribute default is on, it effective to both IPv4 and IPv6.

func (*RedistributeDefaultBody) DecodeFromBytes added in v1.8.1

func (b *RedistributeDefaultBody) DecodeFromBytes(command CommandType, data []byte) error

func (*RedistributeDefaultBody) Process added in v1.8.1

func (b *RedistributeDefaultBody) Process(client *Client, h *Header) error

func (*RedistributeDefaultBody) Serialize added in v1.8.1

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

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 {
	pb.Rib
	Flags    RibFlag
	Prefix   *netutil.Prefix
	Type     uint8
	SubType  uint8
	Distance uint8
	Metric   uint32
	PathId   uint32
	Nexthops []*Nexthop
	Color    []string
	Aux      []byte
	Src      interface{}
}

func NewRib

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

func NewRoute added in v1.8.1

func NewRoute(r *pb.Route, p *netutil.Prefix, src *rpcPeer) *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) IsDelete added in v1.8.1

func (r *Rib) IsDelete() 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) SetDelete added in v1.8.1

func (r *Rib) SetDelete()

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) String added in v1.8.1

func (r *Rib) String() string

func (*Rib) UnsetDelete added in v1.8.1

func (r *Rib) UnsetDelete()

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_SELECTED RibFlag = 1 << iota
	RIB_FLAG_FIB
	RIB_FLAG_DISTANCE
	RIB_FLAG_METRIC
	RIB_FLAG_RESOLVED  // Static route and iBGP (multipath eBGP) next hop will be resolved.
	RIB_FLAG_BLACKHOLE // This is black hole route.
	RIB_FLAG_DELETE
)

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 RouteType added in v1.8.1

type RouteType uint8
const (
	ROUTE_SYSTEM RouteType = 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
)

func RibType2RouteType added in v1.8.1

func RibType2RouteType(t uint8) RouteType

func RouteTypeFromPb added in v1.8.1

func RouteTypeFromPb(afi int, typ pb.RouteType) RouteType

func (RouteType) String added in v1.8.1

func (r RouteType) String() string

type RouteUpdateBody added in v1.8.1

type RouteUpdateBody struct {
	Message  uint8
	Type     RouteType
	Flags    FLAG
	Prefix   *netutil.Prefix
	Nexthops []*Nexthop
	Distance uint8
	Metric   uint32
	PathId   uint32
	Aux      []byte
}

func (*RouteUpdateBody) DecodeFromBytes added in v1.8.1

func (b *RouteUpdateBody) DecodeFromBytes(command CommandType, data []byte) error

func (*RouteUpdateBody) Process added in v1.8.1

func (b *RouteUpdateBody) Process(client *Client, h *Header) error

func (*RouteUpdateBody) Serialize added in v1.8.1

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

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 RouterIdUpdateBody added in v1.8.1

type RouterIdUpdateBody struct {
	RouterId net.IP
	Length   uint8
}

Router ID update.

func (*RouterIdUpdateBody) DecodeFromBytes added in v1.8.1

func (b *RouterIdUpdateBody) DecodeFromBytes(command CommandType, data []byte) error

func (*RouterIdUpdateBody) Process added in v1.8.1

func (b *RouterIdUpdateBody) Process(client *Client, h *Header) error

func (*RouterIdUpdateBody) Serialize added in v1.8.1

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

type RpcComponent added in v1.8.1

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

func NewRpcComponent added in v1.8.1

func NewRpcComponent(server *Server, port int) *RpcComponent

func (*RpcComponent) Start added in v1.8.1

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

func (*RpcComponent) Stop added in v1.8.1

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

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) IfVrfBind

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

func (*Server) IfVrfUnbind

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

func (*Server) InterfaceSubscribe added in v1.8.1

func (s *Server) InterfaceSubscribe(w Watcher, vrfId uint32) error

func (*Server) InterfaceUnsubscribe added in v1.8.1

func (s *Server) InterfaceUnsubscribe(w Watcher, vrfId uint32) error

func (*Server) PrefixListLookup added in v1.8.1

func (s *Server) PrefixListLookup(plistName string) *policy.PrefixList

func (*Server) PrefixListMasterSet added in v1.8.1

func (s *Server) PrefixListMasterSet(pm *policy.PrefixListMaster) error

func (*Server) PrefixListOut added in v1.8.1

func (s *Server) PrefixListOut() *policy.PrefixList

func (*Server) PrefixListOutAdd added in v1.8.1

func (s *Server) PrefixListOutAdd(entry *policy.PrefixListEntry)

func (*Server) RedistDefaultSubscribe added in v1.8.1

func (s *Server) RedistDefaultSubscribe(w Watcher, allVrf bool, vrfId uint32, afi int) error

func (*Server) RedistDefaultUnsubscribe added in v1.8.1

func (s *Server) RedistDefaultUnsubscribe(w Watcher, allVrf bool, vrfId uint32, afi int) error

func (*Server) RedistSubscribe added in v1.8.1

func (s *Server) RedistSubscribe(w Watcher, allVrf bool, vrfId uint32, afi int, typ uint8) error

func (*Server) RedistUnsubscribe added in v1.8.1

func (s *Server) RedistUnsubscribe(w Watcher, allVrf bool, vrfId uint32, afi int, typ uint8) error

func (*Server) RouterIdSubscribe added in v1.8.1

func (s *Server) RouterIdSubscribe(w Watcher, vrfId uint32) error

func (*Server) RouterIdUnsubscribe added in v1.8.1

func (s *Server) RouterIdUnsubscribe(w Watcher, vrfId uint32) 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) StaticSeg6LocalAdd added in v1.8.1

func (s *Server) StaticSeg6LocalAdd(prefix *netutil.Prefix, nexthop net.IP, seg6local EncapSEG6Local) error

func (*Server) StaticSeg6LocalDelete added in v1.8.1

func (s *Server) StaticSeg6LocalDelete(prefix *netutil.Prefix, nexthop net.IP, seg6local EncapSEG6Local) error

func (*Server) StaticSeg6SegmentsAdd added in v1.8.1

func (s *Server) StaticSeg6SegmentsAdd(prefix *netutil.Prefix, nexthop net.IP, mode string, segs []net.IP) error

func (*Server) StaticSeg6SegmentsDelete added in v1.8.1

func (s *Server) StaticSeg6SegmentsDelete(prefix *netutil.Prefix, nexthop net.IP, mode string, segs []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

func (*Server) VrfDistributeListOspfAdd added in v1.8.1

func (s *Server) VrfDistributeListOspfAdd(vrfName string, dlistName string) error

func (*Server) VrfDistributeListOspfDelete added in v1.8.1

func (s *Server) VrfDistributeListOspfDelete(vrfName string, dlistName string) error

func (*Server) WatcherUnsubscribe added in v1.8.1

func (s *Server) WatcherUnsubscribe(w Watcher) 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
	Id      uint32
	IfTable *netutil.Ptree
	IfMap   map[string]*Interface

	ZServer   *ZServer
	Mutex     sync.RWMutex
	IfMutex   sync.Mutex
	Watcher   map[*IfWatcher]bool // Will be merged to Watchers
	WMutex    sync.Mutex
	Watchers  []Watchers
	DListOspf string
	// contains filtered or unexported fields
}

func NewVrf

func NewVrf(name string, vrfId uint32) *Vrf

func VrfAssign

func VrfAssign(name string, id uint32) (*Vrf, error)

func VrfDefault

func VrfDefault() *Vrf

func VrfLookupByIndex

func VrfLookupByIndex(id uint32) *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) FibAdd added in v1.8.1

func (v *Vrf) FibAdd(p *netutil.Prefix, rib *Rib)

func (*Vrf) FibDelete added in v1.8.1

func (v *Vrf) FibDelete(p *netutil.Prefix, rib *Rib)

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) NotifyRouterId added in v1.8.1

func (vrf *Vrf) NotifyRouterId()

func (*Vrf) RedistAdd added in v1.8.1

func (v *Vrf) RedistAdd(p *netutil.Prefix, rib *Rib)

func (*Vrf) RedistDefaultSync added in v1.8.1

func (vrf *Vrf) RedistDefaultSync(w Watcher, afi int)

func (*Vrf) RedistDelete added in v1.8.1

func (v *Vrf) RedistDelete(p *netutil.Prefix, rib *Rib)

func (*Vrf) RedistSync added in v1.8.1

func (vrf *Vrf) RedistSync(w Watcher, afi int, typ uint8)

func (*Vrf) Redistribute added in v1.8.1

func (v *Vrf) Redistribute(op pb.Op, p *netutil.Prefix, rib *Rib)

func (*Vrf) Resolve

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

func (*Vrf) Rib2Route added in v1.8.1

func (vrf *Vrf) Rib2Route(op pb.Op, p *netutil.Prefix, rib *Rib) *pb.Route

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, dels []*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(af int)

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) 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

func (*Vrf) StaticSeg6LocalAdd added in v1.8.1

func (v *Vrf) StaticSeg6LocalAdd(p *netutil.Prefix, naddr net.IP, seg6local EncapSEG6Local) error

func (*Vrf) StaticSeg6LocalDelete added in v1.8.1

func (v *Vrf) StaticSeg6LocalDelete(p *netutil.Prefix, naddr net.IP, seg6local EncapSEG6Local) error

func (*Vrf) StaticSeg6SegmentsAdd added in v1.8.1

func (v *Vrf) StaticSeg6SegmentsAdd(p *netutil.Prefix, naddr net.IP, mode string, segs []net.IP) error

func (*Vrf) StaticSeg6SegmentsDelete added in v1.8.1

func (v *Vrf) StaticSeg6SegmentsDelete(p *netutil.Prefix, naddr net.IP, mode string, segs []net.IP) error

type Watcher added in v1.8.1

type Watcher interface {
	Notify(interface{})
}

type WatcherRedist added in v1.8.1

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

type Watchers added in v1.8.1

type Watchers []Watcher

func RedistWatcherAdd added in v1.8.1

func RedistWatcherAdd(watchers Watchers, w Watcher) Watchers

func RedistWatcherRemove added in v1.8.1

func RedistWatcherRemove(watchers Watchers, w Watcher) Watchers

type ZServer

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

func ZServerStart

func ZServerStart(typ string, path string, vrfId uint32) *ZServer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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