bcm

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MCLAGDomainID                  = 100
	MCLAGPeerLinkPortChannelID     = 250
	MCLAGSessionLinkPortChannelID  = 251
	MCLAGPeerLinkTrunkVLANRange    = "2..4094"    // TODO do we need to configure it?
	MCLAGSessionIP1                = "172.30.5.0" // TODO move to config
	MCLAGSessionIP2                = "172.30.5.1" // TODO move to config
	MCLAGSessionIPPrefixLen        = 31           // TODO move to config
	AgentUser                      = "hhagent"
	LoopbackSwitch                 = "Loopback0"
	LoopbackProto                  = "Loopback1"
	LoopbackVTEP                   = "Loopback2"
	VRFDefault                     = "default"
	VTEPFabric                     = "vtepfabric"
	EVPNNVO                        = "nvo1"
	AnycastMAC                     = "00:00:00:11:11:11"
	RouteMapMaxStatement           = 65535
	RouteMapBlockEVPNDefaultRemote = "evpn-default-remote-block"
	PrefixListAny                  = "any-prefix"
	PrefixListVPCLoopback          = "vpc-loopback-prefix"
	NoCommunity                    = "no-community"
	LSTGroupSpineLink              = "spinelink"
	BGPCommListAllExternals        = "all-externals"
)
View Source
const (
	IfacePrefixManagement    = "Management"
	IfacePrefixPhysical      = "Ethernet"
	IfacePrefixVLAN          = "Vlan"
	IfacePrefixPortChannel   = "PortChannel"
	IfaceDisabledDescription = "Disabled by Fabric"
)

Variables

This section is empty.

Functions

func SafeSprintf

func SafeSprintf(format string, key any) string

func UnmarshalPortBreakout

func UnmarshalPortBreakout(mode string) string

func UnmarshalPortSpeed

func UnmarshalPortSpeed(speedRaw oc.E_OpenconfigIfEthernet_ETHERNET_SPEED) *string

func ValueOrNil

func ValueOrNil[Value dozer.SpecPart, Result any](actual, desired Value, getter func(Value) Result) (Result, Result)

Types

type Action

type Action struct {
	Weight         ActionWeight           `json:"weight,omitempty"`
	ASummary       string                 `json:"summary,omitempty"`
	Type           ActionType             `json:"type,omitempty"`
	Path           string                 `json:"path,omitempty"`
	Value          ygot.ValidatedGoStruct `json:"value,omitempty"`
	CustomFunc     func() error
	WarningOnError bool
}

func (*Action) Summary

func (a *Action) Summary() string

type ActionQueue

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

func (*ActionQueue) Add

func (q *ActionQueue) Add(action *Action) error

func (*ActionQueue) Sort

func (q *ActionQueue) Sort()

type ActionType

type ActionType string
const (
	ActionTypeUpdate  ActionType = "update"
	ActionTypeReplace ActionType = "replace"
	ActionTypeDelete  ActionType = "delete"
)

type ActionWeight

type ActionWeight uint8
const (
	ActionWeightUnset ActionWeight = iota // keep it first

	ActionWeightSystemZTP
	ActionWeightSystemHostname
	ActionWeightLLDP
	ActionWeightUser
	ActionWeightUserAuthorizedKeys
	ActionWeightPortGroup
	ActionWeightPortBreakout

	ActionWeightPrefixListUpdate
	ActionWeightPrefixListEntryDelete
	ActionWeightPrefixListEntryUpdate

	ActionWeightCommunityListUpdate

	ActionWeightInterfaceBasePortChannelsUpdate
	ActionWeightInterfaceBaseUpdate

	ActionWeightVRFBaseUpdate
	ActionWeightVRFVNIUpdate

	ActionWeightRouteMapUpdate
	ActionWeightRouteMapStatementDelete
	ActionWeightRouteMapStatementUpdate

	ActionWeightInterfaceVLANIPsUpdate
	ActionWeightInterfacePortChannelSwitchedAccessUpdate
	ActionWeightInterfacePortChannelSwitchedTrunkUpdate
	ActionWeightInterfaceEthernetBaseUpdate
	ActionWeightInterfaceEthernetSwitchedAccessUpdate
	ActionWeightInterfaceEthernetSwitchedTrunkUpdate
	ActionWeightInterfaceVLANAnycastGatewayUpdate
	ActionWeightInterfaceNATZoneUpdate
	ActionWeightPortChannelConfigMACUpdate
	ActionWeightPortChannelConfigFallbackUpdate

	ActionWeightInterfaceSubinterfaceIPsDelete
	ActionWeightVRFInterfaceDelete
	ActionWeightACLInterfaceDelete
	ActionWeightInterfaceSubinterfaceDelete
	ActionWeightInterfaceSubinterfaceUpdate
	ActionWeightVRFInterfaceUpdate
	ActionWeightInterfaceSubinterfaceIPsUpdate

	ActionWeightLLDPInterfaceUpdate
	ActionWeightNTP
	ActionWeightNTPServerUpdate

	ActionWeightMCLAGDomainUpdate
	ActionWeightMCLAGInterfaceUpdate

	ActionWeightACLBaseUpdate
	ActionWeightACLInterfaceUpdate
	ActionWeightACLEntryDelete
	ActionWeightACLEntryUpdate

	ActionWeightNATBaseUpdate
	ActionWeightNATPoolUpdate
	ActionWeightNATBindingUpdate
	ActionWeightNATEntryUpdate

	ActionWeightSuppressVLANNeighUpdate

	ActionWeightVRFStaticRouteDelete // it seems like it's better to first remove routes and then add new ones
	ActionWeightVRFStaticRouteUpdate

	ActionWeightVRFBGPBaseUpdate
	ActionWeightVRFSAGUpdate
	ActionWeightVRFEVPNMHUpdate
	ActionWeightVRFEthernetSegmentUpdate

	ActionWeightLSTGroupUpdate
	ActionWeightLSTInterfaceUpdate

	ActionWeightVXLANTunnelMapDelete
	ActionWeightVXLANTunnelUpdate
	ActionWeightVXLANEVPNNVODelete
	ActionWeightVXLANEVPNNVOUpdate
	ActionWeightVXLANTunnelDelete
	ActionWeightVXLANTunnelMapUpdate

	ActionWeightVRFBGPNeighborUpdate
	ActionWeightVRFBGPNetworkUpdate
	ActionWrightVRFTableConnectionUpdate

	ActionWeightVRFBGPImportVRFPolicyUpdate
	ActionWeightVRFBGPImportVRFUpdate

	ActionWeightDHCPRelayUpdate

	ActionWeightDHCPRelayDelete

	ActionWeightVRFBGPImportVRFDelete
	ActionWeightVRFBGPImportVRFPolicyDelete

	ActionWeightVRFVNIDelete

	ActionWeightLSTInterfaceDelete
	ActionWeightLSTGroupDelete

	ActionWeightVRFEthernetSegmentDelete
	ActionWeightVRFEVPNMHDelete
	ActionWrightVRFTableConnectionDelete
	ActionWeightVRFBGPNetworkDelete
	ActionWeightVRFBGPNeighborDelete
	ActionWeightVRFSAGDelete
	ActionWeightVRFBGPBaseDelete
	ActionWeightVRFBaseDelete

	ActionWeightSuppressVLANNeighDelete

	ActionWeightNATEntryDelete
	ActionWeightNATBindingDelete
	ActionWeightNATPoolDelete
	ActionWeightNATBaseDelete

	ActionWeightLLDPInterfaceDelete
	ActionWeightNTPServerDelete

	ActionWeightMCLAGInterfaceDelete
	ActionWeightMCLAGDomainDelete

	ActionWeightPortChannelConfigMACDelete
	ActionWeightPortChannelConfigFallbackDelete
	ActionWeightInterfaceEthernetSwitchedAccessDelete
	ActionWeightInterfaceEthernetSwitchedTrunkDelete
	ActionWeightInterfaceEthernetBaseDelete
	ActionWeightInterfacePortChannelSwitchedAccessDelete
	ActionWeightInterfacePortChannelSwitchedTrunkDelete
	ActionWeightInterfaceNATZoneDelete
	ActionWeightInterfaceVLANIPsDelete
	ActionWeightInterfaceVLANAnycastGatewayDelete

	ActionWeightACLBaseDelete

	ActionWeightInterfaceBaseDelete

	ActionWeightRouteMapDelete
	ActionWeightPrefixListDelete
	ActionWeightCommunityListDelete

	ActionWeightMax // keep it last
)

type BroadcomProcessor added in v0.34.0

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

func Processor

func Processor(client *gnmi.Client) *BroadcomProcessor

func (*BroadcomProcessor) ApplyActions added in v0.34.0

func (p *BroadcomProcessor) ApplyActions(ctx context.Context, actions []dozer.Action) ([]string, error)

func (*BroadcomProcessor) CalculateActions added in v0.34.0

func (p *BroadcomProcessor) CalculateActions(_ context.Context, actual, desired *dozer.Spec) ([]dozer.Action, error)
func (p *BroadcomProcessor) EnsureControlLink(_ context.Context, agent *agentapi.Agent) error

func (*BroadcomProcessor) FactoryReset added in v0.34.0

func (p *BroadcomProcessor) FactoryReset(_ context.Context) error

func (*BroadcomProcessor) LoadActualState added in v0.34.0

func (p *BroadcomProcessor) LoadActualState(ctx context.Context, agent *agentapi.Agent) (*dozer.Spec, error)

func (*BroadcomProcessor) PlanDesiredState added in v0.34.0

func (p *BroadcomProcessor) PlanDesiredState(_ context.Context, agent *agentapi.Agent) (*dozer.Spec, error)

func (*BroadcomProcessor) Reboot added in v0.34.0

func (p *BroadcomProcessor) Reboot(ctx context.Context, _ bool) error

func (*BroadcomProcessor) Reinstall added in v0.34.0

func (p *BroadcomProcessor) Reinstall(ctx context.Context) error

func (*BroadcomProcessor) UpdateSwitchState added in v0.35.0

func (p *BroadcomProcessor) UpdateSwitchState(ctx context.Context, agent *agentapi.Agent, reg *switchstate.Registry) error

func (*BroadcomProcessor) WaitReady added in v0.34.0

func (p *BroadcomProcessor) WaitReady(ctx context.Context) error

type DefaultMapEnforcer

type DefaultMapEnforcer[Key cmp.Ordered, Value dozer.SpecPart] struct {
	Summary       string
	CustomHandler func(basePath string, actual, desired map[Key]Value, actions *ActionQueue) error
	ValueHandler  ValueEnforcer[Key, Value] // used by default map handler
}

func (*DefaultMapEnforcer[Key, Value]) Handle

func (h *DefaultMapEnforcer[Key, Value]) Handle(basePath string, actualMap, desiredMap map[Key]Value, actions *ActionQueue) error

type DefaultValueEnforcer

type DefaultValueEnforcer[Key comparable, Value dozer.SpecPart] struct {
	Summary       string
	Skip          func(key Key, actual, desired Value) bool // skip if true
	Getter        func(key Key, value Value) any            // nil to use Value for comparision or it should return values to compart
	NoReplace     bool                                      // replace instead of update
	MutateActual  func(key Key, actual Value) Value         // Mutates actual value before comparision
	MutateDesired func(key Key, desired Value) Value        // Mutates desired value before comparision

	CustomHandler func(basePath string, key Key, actual, desired Value, actions *ActionQueue) error // will be used instead of default one

	Path             string // used by default value handler
	CreatePath       string
	PathFunc         func(key Key, value Value) string
	Marshal          func(key Key, value Value) (ygot.ValidatedGoStruct, error) // used by default value handler
	Weight           ActionWeight
	UpdateWeight     ActionWeight
	DeleteWeight     ActionWeight
	WarningOnError   bool
	SkipDelete       bool
	RecreateOnUpdate bool
}

func (*DefaultValueEnforcer[Key, Value]) Handle

func (h *DefaultValueEnforcer[Key, Value]) Handle(basePath string, key Key, actual, desired Value, actions *ActionQueue) error

type ValueEnforcer

type ValueEnforcer[Key cmp.Ordered, Value dozer.SpecPart] interface {
	Handle(basePath string, key Key, actual, desired Value, actions *ActionQueue) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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