bcm

package
v0.107.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 40 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MCLAGDomainID                 = 100
	MCLAGPeerLinkPortChannelID    = 250
	MCLAGSessionLinkPortChannelID = 251
	MCLAGPeerLinkTrunkVLANRange   = "2..4094" // TODO do we need to configure it?
	AgentUser                     = "hhagent"
	// LoopbackSwitch                 = "Loopback0"
	LoopbackProto                = "Loopback1"
	LoopbackVTEP                 = "Loopback2"
	VRFDefault                   = "default"
	VTEPFabric                   = "vtepfabric"
	EVPNNVO                      = "nvo1"
	AnycastMAC                   = "00:00:00:11:11:11"
	RouteMapMaxStatement         = 65535
	RouteMapL2VPNNeighbors       = "l2vpn-neighbors"
	RouteMapFilterAttachedHost   = "filter-attached-hosts"
	RouteMapLoopbackAllVTEPs     = "loopback-all-vteps"
	RouteMapProtocolLoopbackOnly = "protocol-loopback-only"
	PrefixListAny                = "any-prefix"
	PrefixListVPCLoopback        = "vpc-loopback-prefix"
	PrefixListAllVTEPPrefixes    = "all-vtep-prefixes"
	PrefixListProtocolLoopback   = "protocol-loopback-prefix"
	PrefixListStaticExternals    = "static-ext-subnets"
	NoCommunity                  = "no-community"
	LSTGroupSpineLink            = "spinelink"
	BGPCommListAllExternals      = "all-externals"
	MgmtIface                    = "Management0"
	FabricBFDProfile             = "fabric"
	MaxGWPrioLevels              = 100
)
View Source
const (
	IfacePrefixManagement    = "Management"
	IfacePrefixPhysical      = "Ethernet"
	IfacePrefixVLAN          = "Vlan"
	IfacePrefixPortChannel   = "PortChannel"
	IfaceCPU                 = "CPU"
	IfaceDisabledDescription = "Disabled by Fabric"
)

Variables

This section is empty.

Functions

func NextHopCompare added in v0.76.0

func NextHopCompare(a, b dozer.SpecVRFStaticRouteNextHop) int

normalize nexthops as we get them in an inconsistent order, and otherwise this can cause a diff when there is none

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(ctx context.Context, client *gnmi.Client) 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

	ActionWeightVLANProxyARPDelete
	ActionWeightSubinterfaceProxyARPDelete

	ActionWeightInterfaceBasePortChannelsUpdate
	ActionWeightInterfaceBaseUpdate

	ActionWeightVRFBaseUpdate
	ActionWeightVRFVNIUpdate

	ActionWeightRouteMapUpdate
	ActionWeightRouteMapStatementDelete
	ActionWeightRouteMapStatementUpdate

	ActionWeightInterfaceVLANIPsUpdate
	ActionWeightInterfacePortChannelSwitchedAccessUpdate
	ActionWeightInterfacePortChannelSwitchedTrunkUpdate
	ActionWeightInterfaceEthernetBaseUpdate
	ActionWeightInterfaceEthernetSwitchedAccessUpdate
	ActionWeightInterfaceEthernetSwitchedTrunkUpdate
	ActionWeightInterfaceVLANAnycastGatewayUpdate
	ActionWeightInterfaceNATZoneUpdate
	ActionWeightPortChannelConfigMACUpdate
	ActionWeightPortChannelConfigFallbackUpdate

	ActionWeightInterfaceSubinterfaceIPsDelete
	ActionWeightInterfaceVLANStaticARPDelete
	ActionWeightInterfaceSubinterfaceStaticARPDelete
	ActionWeightVRFAttachedHostDelete
	ActionWeightInterfaceSubinterfaceIPv6Delete
	ActionWeightVRFInterfaceDelete
	ActionWeightACLInterfaceDelete
	ActionWeightVRFBGPNeighborDelete
	ActionWeightInterfaceSubinterfaceDelete
	ActionWeightInterfaceSubinterfaceUpdate
	ActionWeightInterfaceVLANStaticARPUpdate
	ActionWeightInterfaceSubinterfaceStaticARPUpdate
	ActionWeightVRFInterfaceUpdate
	ActionWeightInterfaceSubinterfaceIPv6Update
	ActionWeightVRFAttachedHostUpdate
	ActionWeightInterfaceSubinterfaceIPsUpdate

	ActionWeightVLANProxyARPUpdate
	ActionWeightSubinterfaceProxyARPUpdate

	ActionWeightLLDPInterfaceUpdate
	ActionWeightNTP
	ActionWeightNTPServerUpdate

	ActionWeightMCLAGDomainUpdate
	ActionWeightMCLAGInterfaceUpdate

	ActionWeightNATBaseUpdate
	ActionWeightNATPoolUpdate
	ActionWeightNATBindingUpdate
	ActionWeightNATEntryUpdate

	ActionWeightSuppressVLANNeighUpdate

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

	ActionWeightVRFSAGUpdate
	ActionWeightVRFEVPNMHUpdate
	ActionWeightVRFEthernetSegmentUpdate

	ActionWeightLSTGroupUpdate
	ActionWeightLSTInterfaceUpdate

	ActionWeightVRFVNIDelete
	ActionWeightVXLANTunnelMapDelete
	ActionWeightVXLANTunnelUpdate
	ActionWeightVXLANEVPNNVODelete
	ActionWeightVXLANEVPNNVOUpdate
	ActionWeightVXLANTunnelDelete
	ActionWeightVXLANTunnelMapUpdate

	// ACL after VNI mappings (for BCM bug) and before BGP (to avoid traffic leaking)
	ActionWeightACLBaseUpdate
	ActionWeightACLEntryDelete
	ActionWeightACLEntryUpdate
	ActionWeightACLInterfaceUpdate

	ActionWeightVRFBGPBaseUpdate
	ActionWeightVRFBGPL2VPNUpdate
	ActionWeightBFDProfileUpdate
	ActionWeightVRFBGPNeighborUpdate
	ActionWeightVRFBGPNetworkUpdate
	ActionWrightVRFTableConnectionUpdate

	ActionWeightVRFBGPImportVRFPolicyUpdate
	ActionWeightVRFBGPImportVRFUpdate

	ActionWeightDHCPRelayUpdate

	ActionWeightDHCPRelayDelete

	ActionWeightVRFBGPImportVRFDelete
	ActionWeightVRFBGPImportVRFPolicyDelete

	ActionWeightLSTInterfaceDelete
	ActionWeightLSTGroupDelete

	ActionWeightVRFEthernetSegmentDelete
	ActionWeightVRFEVPNMHDelete
	ActionWrightVRFTableConnectionDelete
	ActionWeightVRFBGPNetworkDelete
	ActionWeightBFDProfileDelete
	ActionWeightVRFSAGDelete
	ActionWeightVRFBGPL2VPNDelete
	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

	ActionWeightECMPRoCE

	ActionWeightMax // keep it last
)

type BroadcomProcessor added in v0.34.0

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

func Processor

func Processor() (*BroadcomProcessor, error)

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) GetRoCE added in v0.80.0

func (p *BroadcomProcessor) GetRoCE(ctx context.Context) (bool, 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) SetClient added in v0.88.0

func (p *BroadcomProcessor) SetClient(client *gnmi.Client)

func (*BroadcomProcessor) SetRoCE added in v0.80.0

func (p *BroadcomProcessor) SetRoCE(ctx context.Context, val bool) error

func (*BroadcomProcessor) SetSkipCustomFuncs added in v0.105.0

func (p *BroadcomProcessor) SetSkipCustomFuncs(skip bool)

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 comparison or it should return values to compart
	NoReplace     bool                                      // replace instead of update
	MutateActual  func(key Key, actual Value) Value         // Mutates actual value before comparison
	MutateDesired func(key Key, desired Value) Value        // Mutates desired value before comparison

	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 SystemStatusResponse added in v0.90.2

type SystemStatusResponse struct {
	Output struct {
		Status  int      `json:"status"`
		Details []string `json:"status-detail"`
	} `json:"openconfig-system-rpc:output"`
}

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