Documentation
¶
Index ¶
- func NewConnector(name string, mode api.Mode) api.Connector
- func NodeInit()
- type DeviceNode
- func (node *DeviceNode) AddPort(port api.Port, connection []*config.ConnectionInfo)
- func (n *DeviceNode) CmdIp() string
- func (n *DeviceNode) ExtraInit(adapter api.Adapter, deviceConfig *config.DeviceConfig)
- func (node *DeviceNode) FlattenName() string
- func (node *DeviceNode) FlattenPath() []string
- func (n *DeviceNode) GetDeviceConfig() *config.DeviceConfig
- func (n *DeviceNode) GetOrCreateVrf(name string) api.Vrf
- func (n *DeviceNode) GetPortByID(id string) api.Port
- func (n *DeviceNode) GetPortByIfIndex(ifIndex int) api.Port
- func (n *DeviceNode) GetPortByNameOrAlias(name string) api.Port
- func (n *DeviceNode) GetVrf(name string) api.Vrf
- func (n *DeviceNode) ID() string
- func (node *DeviceNode) IpRouteCheck(netList network.NetworkList, inPort, vrf string, af network.IPFamily) (bool, *tools.Table, []string, error)
- func (node *DeviceNode) IpRouteCheckInternal(netList network.NetworkList, inPort, vrf string, af network.IPFamily) *model.RouteCheckResult
- func (node *DeviceNode) Ipv4RouteCheck(netList network.NetworkList, inPort, vrf string) (bool, *tools.Table, []string, error)
- func (node *DeviceNode) Ipv4RouteTable(vrfName string) *network.AddressTable
- func (node *DeviceNode) Ipv6RouteCheck(netList network.NetworkList, inPort, vrf string) (bool, *tools.Table, []string, error)
- func (node *DeviceNode) Ipv6RouteTable(vrfName string) *network.AddressTable
- func (n *DeviceNode) MarshalJSON() ([]byte, error)
- func (n *DeviceNode) Name() string
- func (n *DeviceNode) NodeType() api.NodeType
- func (n *DeviceNode) PortList() []api.Port
- func (n *DeviceNode) PortRefs() []string
- func (n *DeviceNode) SetDeviceConfig(deviceConfig *config.DeviceConfig)
- func (n *DeviceNode) SetIpv4RouteTable(vrfName string, table *network.AddressTable)
- func (n *DeviceNode) SetIpv6RouteTable(vrfName string, table *network.AddressTable)
- func (n *DeviceNode) TypeName() string
- func (n *DeviceNode) UnmarshalJSON(data []byte) error
- func (n *DeviceNode) Vrfs() []api.Vrf
- func (n *DeviceNode) WithCmdIp(ip string)
- func (n *DeviceNode) WithID(id string) api.Node
- func (n *DeviceNode) WithName(name string) api.Node
- func (node *DeviceNode) WithNodeMap(name string) api.Node
- func (n *DeviceNode) WithNodeType(t api.NodeType)
- func (n *DeviceNode) WithPortIterator(iterator api.PortIterator) api.Node
- type FhrpGroup
- func (g *FhrpGroup) Active() api.Member
- func (g *FhrpGroup) AddMember(member api.Member)
- func (fg *FhrpGroup) GroupIp() string
- func (fg FhrpGroup) MarshalJSON() ([]byte, error)
- func (FhrpGroup) TableName() string
- func (fg *FhrpGroup) TypeName() string
- func (fg *FhrpGroup) UnmarshalJSON(data []byte) error
- type FhrpGroupValidator
- type InterfaceConnectionValidator
- type IpAddressConflictValidator
- type Member
- func (m Member) FhrpMode() api.FhrpMode
- func (m Member) Hit(MemberIp string) bool
- func (m Member) Ip() string
- func (m Member) IsActive() bool
- func (m Member) MarshalJSON() ([]byte, error)
- func (m Member) PortName() string
- func (Member) TableName() string
- func (m Member) TypeName() string
- func (m *Member) UnmarshalJSON(data []byte) error
- type NameDuplicationValidator
- type NetworkInRouteValidator
- type NetworkListRuleValidator
- type NetworkTypeValidator
- type NodeConnector
- func (c *NodeConnector) AddFhrpGroupMember(member api.Member)
- func (c *NodeConnector) Attach(port api.Port)
- func (c *NodeConnector) GetOrCreateFhrpGroup(groupIp string, mode api.FhrpMode) api.FhrpGroup
- func (c *NodeConnector) HitByIp(ipWithPrefix, vrf string) bool
- func (c *NodeConnector) HitByNetwork(net network.AbbrNet, vrf string) bool
- func (c *NodeConnector) ID() string
- func (c *NodeConnector) IPv4List() api.StringList
- func (c *NodeConnector) IPv6List() api.StringList
- func (c *NodeConnector) MarshalJSON() ([]byte, error)
- func (c *NodeConnector) Mode() api.Mode
- func (c *NodeConnector) Port(name string) api.Port
- func (c *NodeConnector) PortCount() int
- func (c *NodeConnector) PortList() []api.Port
- func (c *NodeConnector) SelectNodeByIp(ip, vrf string) (api.Node, api.Port)
- func (c *NodeConnector) SelectPortListByNetwork(net network.AbbrNet, vrf string) []api.Port
- func (c *NodeConnector) TypeName() string
- func (c *NodeConnector) UnmarshalJSON(data []byte) error
- func (c *NodeConnector) Verify(port api.Port) validator.Result
- func (c *NodeConnector) WithPortIterator(iterator api.PortIterator)
- type NodePort
- func (p *NodePort) AddIpv4(ip string)
- func (p *NodePort) AddIpv6(ip string)
- func (p *NodePort) AliasName() []string
- func (p *NodePort) Area(ipFamily network.IPFamily) string
- func (p *NodePort) ConnectorID() string
- func (p *NodePort) FlattenName() string
- func (p *NodePort) FlattenPath() []string
- func (p *NodePort) FullMatchByIp(ip, PortVrf string) bool
- func (p *NodePort) GetIpList() map[network.IPFamily][]string
- func (p *NodePort) HitByIfIndex(SnmpIfIndex int) bool
- func (p *NodePort) HitByIp(target, PortVrf string) bool
- func (p *NodePort) HitByIpWithoutPrefix(target, PortVrf string) bool
- func (p *NodePort) HitByName(name string) bool
- func (p *NodePort) HitByNetwork(net network.AbbrNet) bool
- func (p *NodePort) ID() string
- func (p *NodePort) IfIndex() int
- func (p *NodePort) Ipv4List() []string
- func (p *NodePort) Ipv6List() []string
- func (p *NodePort) IsStubArea(ipFamily network.IPFamily) bool
- func (p NodePort) MarshalJSON() ([]byte, error)
- func (p *NodePort) MatchVrfOrPeerVrf(name string) bool
- func (p *NodePort) Members() []api.Member
- func (p *NodePort) Name() string
- func (p *NodePort) NetworkGroup() *network.NetworkGroup
- func (p *NodePort) Node() api.Node
- func (p *NodePort) PeerVrf() []string
- func (NodePort) TableName() string
- func (p *NodePort) TypeName() string
- func (p *NodePort) UnmarshalJSON(data []byte) error
- func (p *NodePort) V4NetworkGroup() *network.NetworkGroup
- func (p *NodePort) V6NetworkGroup() *network.NetworkGroup
- func (p *NodePort) Vrf() string
- func (p *NodePort) WithAliasName(name string) api.Port
- func (p *NodePort) WithArea(areaName string, ipFamily network.IPFamily) api.Port
- func (p *NodePort) WithConnectorID(id string)
- func (p *NodePort) WithDescription(description string) api.Port
- func (p *NodePort) WithID(id string) api.Port
- func (p *NodePort) WithIfIndex(SnmpIfIndex int) api.Port
- func (p *NodePort) WithNode(node api.Node) api.Port
- func (p *NodePort) WithPeerVrf(name string) api.Port
- func (p *NodePort) WithStatus(status string) api.Port
- func (p *NodePort) WithStubArea(isStubArea bool, ipFamily network.IPFamily) api.Port
- func (p *NodePort) WithVrf(PortVrf string) api.Port
- type NodePortIpList
- type NodeVrf
- func (nv *NodeVrf) Ipv4Table() *network.AddressTable
- func (nv *NodeVrf) Ipv6Table() *network.AddressTable
- func (nv *NodeVrf) MarshalJSON() ([]byte, error)
- func (nv *NodeVrf) Name() string
- func (nv *NodeVrf) TypeName() string
- func (nv *NodeVrf) UnmarshalJSON(data []byte) error
- func (NodeVrf) WappterUuid() string
- type State
- type VrfExistValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeviceNode ¶
type DeviceNode struct {
NodeMapName string
DeviceConfig *config.DeviceConfig
// contains filtered or unexported fields
}
修改 DeviceNode
func NewDeviceNode ¶
func NewDeviceNode(id, name string, nodeType api.NodeType) *DeviceNode
func (*DeviceNode) AddPort ¶
func (node *DeviceNode) AddPort(port api.Port, connection []*config.ConnectionInfo)
func (*DeviceNode) CmdIp ¶
func (n *DeviceNode) CmdIp() string
func (*DeviceNode) ExtraInit ¶
func (n *DeviceNode) ExtraInit(adapter api.Adapter, deviceConfig *config.DeviceConfig)
func (*DeviceNode) FlattenName ¶
func (node *DeviceNode) FlattenName() string
func (*DeviceNode) FlattenPath ¶
func (node *DeviceNode) FlattenPath() []string
func (*DeviceNode) GetDeviceConfig ¶
func (n *DeviceNode) GetDeviceConfig() *config.DeviceConfig
func (*DeviceNode) GetOrCreateVrf ¶
func (n *DeviceNode) GetOrCreateVrf(name string) api.Vrf
func (*DeviceNode) GetPortByID ¶
func (n *DeviceNode) GetPortByID(id string) api.Port
func (*DeviceNode) GetPortByIfIndex ¶
func (n *DeviceNode) GetPortByIfIndex(ifIndex int) api.Port
func (*DeviceNode) GetPortByNameOrAlias ¶
func (n *DeviceNode) GetPortByNameOrAlias(name string) api.Port
func (*DeviceNode) ID ¶
func (n *DeviceNode) ID() string
func (*DeviceNode) IpRouteCheck ¶
func (node *DeviceNode) IpRouteCheck(netList network.NetworkList, inPort, vrf string, af network.IPFamily) (bool, *tools.Table, []string, error)
IpRouteCheck 实现 api.Node 接口,保持向后兼容
func (*DeviceNode) IpRouteCheckInternal ¶
func (node *DeviceNode) IpRouteCheckInternal(netList network.NetworkList, inPort, vrf string, af network.IPFamily) *model.RouteCheckResult
IpRouteCheckInternal 内部路由检查方法,返回 RouteCheckResult(公开方法供 traverse 包使用)
func (*DeviceNode) Ipv4RouteCheck ¶
func (node *DeviceNode) Ipv4RouteCheck(netList network.NetworkList, inPort, vrf string) (bool, *tools.Table, []string, error)
func (*DeviceNode) Ipv4RouteTable ¶
func (node *DeviceNode) Ipv4RouteTable(vrfName string) *network.AddressTable
func (*DeviceNode) Ipv6RouteCheck ¶
func (node *DeviceNode) Ipv6RouteCheck(netList network.NetworkList, inPort, vrf string) (bool, *tools.Table, []string, error)
func (*DeviceNode) Ipv6RouteTable ¶
func (node *DeviceNode) Ipv6RouteTable(vrfName string) *network.AddressTable
func (*DeviceNode) MarshalJSON ¶
func (n *DeviceNode) MarshalJSON() ([]byte, error)
MarshalJSON 实现 JSON 序列化
func (*DeviceNode) Name ¶
func (n *DeviceNode) Name() string
func (*DeviceNode) NodeType ¶
func (n *DeviceNode) NodeType() api.NodeType
func (*DeviceNode) PortList ¶
func (n *DeviceNode) PortList() []api.Port
func (*DeviceNode) PortRefs ¶
func (n *DeviceNode) PortRefs() []string
func (*DeviceNode) SetDeviceConfig ¶
func (n *DeviceNode) SetDeviceConfig(deviceConfig *config.DeviceConfig)
func (*DeviceNode) SetIpv4RouteTable ¶
func (n *DeviceNode) SetIpv4RouteTable(vrfName string, table *network.AddressTable)
func (*DeviceNode) SetIpv6RouteTable ¶
func (n *DeviceNode) SetIpv6RouteTable(vrfName string, table *network.AddressTable)
func (*DeviceNode) TypeName ¶
func (n *DeviceNode) TypeName() string
func (*DeviceNode) UnmarshalJSON ¶
func (n *DeviceNode) UnmarshalJSON(data []byte) error
UnmarshalJSON 实现 JSON 反序列化
func (*DeviceNode) Vrfs ¶
func (n *DeviceNode) Vrfs() []api.Vrf
func (*DeviceNode) WithCmdIp ¶
func (n *DeviceNode) WithCmdIp(ip string)
func (*DeviceNode) WithNodeMap ¶
func (node *DeviceNode) WithNodeMap(name string) api.Node
func (*DeviceNode) WithNodeType ¶
func (n *DeviceNode) WithNodeType(t api.NodeType)
func (*DeviceNode) WithPortIterator ¶
func (n *DeviceNode) WithPortIterator(iterator api.PortIterator) api.Node
type FhrpGroup ¶
type FhrpGroup struct {
FhrpGroupIp string `json:"group_ip" gorm:"group_ip"`
FhrpMode api.FhrpMode `json:"fhrp_mode" gorm:"fhrp_mode"`
Members []api.Member `json:"members" gorm:"members"`
Chain *validator.ValidateChain `json:"-" gorm:"-"`
}
func (FhrpGroup) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (fg FhrpGroup) MarshalJSON() ([]byte, error) {
type Alias FhrpGroup
members := make([]json.RawMessage, len(fg.Members))
for i, member := range fg.Members {
b, err := member.MarshalJSON()
if err != nil {
return nil, err
}
members[i] = json.RawMessage(b)
}
return json.Marshal(&struct {
Alias
FhrpMode string `json:"fhrp_mode"`
Members []json.RawMessage `json:"members"`
}{
Alias: Alias(fg),
FhrpMode: fg.FhrpMode.String(),
Members: members,
})
}
func (*FhrpGroup) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface
type FhrpGroupValidator ¶
type FhrpGroupValidator struct{}
type InterfaceConnectionValidator ¶
type InterfaceConnectionValidator struct{}
type IpAddressConflictValidator ¶
type IpAddressConflictValidator struct{}
type Member ¶
type Member struct {
MemberPortName string `json:"port_name" gorm:"column:port_name"`
FrhgGroupId int `json:"group_id" gorm:"column:group_id"`
MemberIp string `json:"ip" gorm:"column:ip"`
Priority int `json:"priority" gorm:"column:priority"`
MemberFhrpMode api.FhrpMode `json:"mode" gorm:"column:fhrp_mode"`
State State `json:"state" gorm:"column:state"`
}
func NewMember ¶
func NewMember(MemberPortName, MemberIp, state, mode string, groupId, Priority int, port *Port) *Member {
func (Member) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (*Member) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface
type NameDuplicationValidator ¶
type NameDuplicationValidator struct{}
type NetworkInRouteValidator ¶
type NetworkInRouteValidator struct{}
type NetworkListRuleValidator ¶
type NetworkListRuleValidator struct{}
type NetworkTypeValidator ¶
type NetworkTypeValidator struct{}
type NodeConnector ¶
type NodeConnector struct {
Name string `json:"name"`
IPv4 api.StringList `json:"ipv4"`
IPv6 api.StringList `json:"ipv6"`
PortRawData api.ByteList `json:"port_raw_data"`
FhrpGroup []api.FhrpGroup `json:"fhrp_group"`
// contains filtered or unexported fields
}
func (*NodeConnector) AddFhrpGroupMember ¶
func (c *NodeConnector) AddFhrpGroupMember(member api.Member)
func (*NodeConnector) Attach ¶
func (c *NodeConnector) Attach(port api.Port)
func (*NodeConnector) GetOrCreateFhrpGroup ¶
func (*NodeConnector) HitByIp ¶
func (c *NodeConnector) HitByIp(ipWithPrefix, vrf string) bool
func (*NodeConnector) HitByNetwork ¶
func (c *NodeConnector) HitByNetwork(net network.AbbrNet, vrf string) bool
func (*NodeConnector) ID ¶
func (c *NodeConnector) ID() string
func (*NodeConnector) IPv4List ¶
func (c *NodeConnector) IPv4List() api.StringList
func (*NodeConnector) IPv6List ¶
func (c *NodeConnector) IPv6List() api.StringList
func (*NodeConnector) MarshalJSON ¶
func (c *NodeConnector) MarshalJSON() ([]byte, error)
MarshalJSON 实现 JSON 序列化
func (*NodeConnector) Mode ¶
func (c *NodeConnector) Mode() api.Mode
func (*NodeConnector) PortCount ¶
func (c *NodeConnector) PortCount() int
func (*NodeConnector) PortList ¶
func (c *NodeConnector) PortList() []api.Port
func (*NodeConnector) SelectNodeByIp ¶
func (*NodeConnector) SelectPortListByNetwork ¶
func (*NodeConnector) TypeName ¶
func (c *NodeConnector) TypeName() string
func (*NodeConnector) UnmarshalJSON ¶
func (c *NodeConnector) UnmarshalJSON(data []byte) error
UnmarshalJSON 实现 JSON 反序列化
func (*NodeConnector) WithPortIterator ¶
func (c *NodeConnector) WithPortIterator(iterator api.PortIterator)
type NodePort ¶
type NodePort struct {
PortName string `json:"port_name"`
Alias api.StringList `json:"alias"`
IpList map[network.IPFamily][]string `json:"ip_list"`
IpListRaw string `json:"ip_list_raw"`
Tenant string `json:"tenant"`
FhrpMembers []api.Member `json:"fhrp_members"`
FhrpMembersRaw string `json:"fhrp_members_raw"`
PortVrf string `json:"port_vrf"`
RemoteVrf api.StringList `json:"remote_vrf"`
SnmpIfIndex int `json:"snmp_if_index"`
NodeID int `json:"node_id"`
ParentNode api.Node `json:"-"`
Connector string `json:"connector"`
ConnectorRaw string `json:"connector_raw"`
PrimaryIpv4 string `json:"primary_ipv4"`
PrimaryIpv6 string `json:"primary_ipv6"`
InputAcl string `json:"input_acl"`
OutputAcl string `json:"output_acl"`
SecurityLevel string `json:"security_level"`
ZoneName string `json:"zone_name"`
Description string `json:"description"`
Status api.PortStatus `json:"status"`
AreaIPv4 string `json:"area_ipv4"`
AreaIPv6 string `json:"area_ipv6"`
StubAreaIPv4 bool `json:"stub_area_ipv4"`
StubAreaIPv6 bool `json:"stub_area_ipv6"`
// contains filtered or unexported fields
}
func (*NodePort) ConnectorID ¶
func (*NodePort) FlattenName ¶
func (*NodePort) FlattenPath ¶
func (*NodePort) FullMatchByIp ¶
func (*NodePort) HitByIfIndex ¶
func (p *NodePort) HitByNetwork(net *network.IPNet) bool { for _, family := range []string{"ipv4", "ipv6"} { for _, _ip := range p.IpList[family] { interfaceIp, _ := network.ParseIPNet(_ip) if interfaceIp.MatchIPNet(net) { return true } } }
return false }
func (*NodePort) HitByIpWithoutPrefix ¶
func (*NodePort) IsStubArea ¶
IsStubArea 获取指定 IP 地址族的 stub area 标记
func (NodePort) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (*NodePort) MatchVrfOrPeerVrf ¶
func (*NodePort) NetworkGroup ¶
func (p *NodePort) NetworkGroup() *network.NetworkGroup
func (*NodePort) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface
func (*NodePort) V4NetworkGroup ¶
func (p *NodePort) V4NetworkGroup() *network.NetworkGroup
func (*NodePort) V6NetworkGroup ¶
func (p *NodePort) V6NetworkGroup() *network.NetworkGroup
func (*NodePort) WithConnectorID ¶
func (*NodePort) WithStubArea ¶
WithStubArea 设置指定 IP 地址族的 stub area 标记
type NodePortIpList ¶
type NodeVrf ¶
type NodeVrf struct {
// contains filtered or unexported fields
}
func (*NodeVrf) Ipv4Table ¶
func (nv *NodeVrf) Ipv4Table() *network.AddressTable
func (*NodeVrf) Ipv6Table ¶
func (nv *NodeVrf) Ipv6Table() *network.AddressTable
func (*NodeVrf) MarshalJSON ¶
MarshalJSON 实现 JSON 序列化
func (*NodeVrf) UnmarshalJSON ¶
UnmarshalJSON 实现 JSON 反序列化
func (NodeVrf) WappterUuid ¶
type VrfExistValidator ¶
type VrfExistValidator struct{}