stp

package
v0.0.0-...-a4e6d7a Latest Latest
Warning

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

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

README

It should me noted that the tests must be run as root as the tests use the pcap lib that needs root access

Tests can be run via go test

example:

go test -v

As of 3/22/16 because tests use interface l0 to in inject and listen for STP packets how long it takes the tests to run can take longer. I have seen the tests run in as little as 6 seconds but as high as 30 seconds. Will create a secondary loopback interface specifically used by the test so that run time is more consistant

Documentation

Overview

802.1D-2004 17.25 Bridge Detection State Machine The Bridge Detection state machine shall implement the function specified by the state diagram in Figure 17-16, the definitions in 17.16, 17.13, 17.20, and 17.21, and the variable declarations in 17.17, 17.18, and 17.19.

bridge.go

Copyright [2016] [SnapRoute Inc]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

	 Unless required by applicable law or agreed to in writing, software
	 distributed under the License is distributed on an "AS IS" BASIS,
	 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	 See the License for the specific language governing permissions and
	 limitations under the License.

_______ __ __________ ___ _______.____ __ ____ __ .___________. ______ __ __ | ____|| | | ____\ \ / / / |\ \ / \ / / | | | | / || | | | | |__ | | | |__ \ V / | (----` \ \/ \/ / | | `---| |----`| ,----'| |__| | | __| | | | __| > < \ \ \ / | | | | | | | __ | | | | `----.| |____ / . \ .----) | \ /\ / | | | | | `----.| | | | |__| |_______||_______/__/ \__\ |_______/ \__/ \__/ |__| |__| \______||__| |__|

config.go

def.go

enum

global.go

init.go

logger.go

802.1D-2004 17.27 Port Information State Machine The Port Information state machine shall implement the function specified by the state diagram in Figure 17- 18, the definitions in 17.13, 17.16, 17.20, and 17.21, and the variable declarations in 17.17, 17.18, and 17.19. This state machine is responsible for updating and recording the source (infoIs, 17.19.10) of the Spanning Tree information (portPriority 17.19.21, portTimes 17.19.22) used to test the information conveyed (msgPriority, 17.19.14; msgTimes, 17.19.15) by received Configuration Messages. If new, superior, information arrives on the port, or the existing information is aged out, it sets the reselect variable to request the Port Role Selection state machine to update the spanning tree priority vectors held by the Bridge and the Bridge’s Port Roles.

port.go

802.1D-2004 17.24 Port Protocol Migration state machine The Port Protocol Migration state machine shall implement the function specified by the state diagram in Figure 17-15, the definitions in 17.16, 17.20, and 17.21, and the variable declarations in 17.17, 17.18, and 17.19. It updates sendRSTP (17.19.38) to tell the Port Transmit state machine (17.26) which BPDU types (9.3) to transmit, to support interoperability (17.4) with the Spanning Tree Algorithm and Protocol specified in previous revisions of this standard.

802.1D-2004 17.28 Port Role Selection State Machine The Port Role Selection state machine shall implement the function specified by the state diagram in Figure 17-19, the definitions in 17.13, 17.16, 17.20, and 17.21, and the variable declarations in 17.17, 17.18, and 17.19. It selects roles for all Bridge Ports. On initialization all Bridge Ports are assigned the Disabled Port Role. Whenever any Bridge Port’s reselect variable (17.19.34) is set by the Port Information state machine (17.27), spanning tree information including the designatedPriority (17.19.4) and designatedTimes (17.19.5) for each Port is recomputed and its Port Role (selectedRole, 17.19.37) updated by the updtRolesTree() procedure (17.21.25). The reselect variables are cleared before computation starts so that recomputation will take place if new information becomes available while the computation is in progress.

802.1D-2004 17.29 Port Role Selection State Machine The Port Role Selection state machine shall implement the function specified by the state diagram in Figure 17-19, the definitions in 17.13, 17.16, 17.20, and 17.21, and the variable declarations in 17.17, 17.18, and 17.19. It selects roles for all Bridge Ports. On initialization all Bridge Ports are assigned the Disabled Port Role. Whenever any Bridge Port’s reselect variable (17.19.34) is set by the Port Information state machine (17.27), spanning tree information including the designatedPriority (17.19.4) and designatedTimes (17.19.5) for each Port is recomputed and its Port Role (selectedRole, 17.19.37) updated by the updtRolesTree() procedure (17.21.25). The reselect variables are cleared before computation starts so that recomputation will take place if new information becomes available while the computation is in progress.

17.23 Port Receive state machine

802.1D-2004 17.29 Port State Transition State Machine The Port State Transition state machine shall implement the function specified by the state diagram in Figure 17-24, the definitions in 17.13, 17.16, 17.20, and 17.21, and variable declarations in 17.17, 17.18, and 17.19. This state machine models changes in the Port State (7.4). The Port Role Transitions state machine requests changes by setting the learn and forward variables; the Port State Transitions machine updates the learning and forwarding variables as the actual Port State changes. The disableLearning(), disableForwarding(), enableLearning(), and enableForwarding() procedures model the system-dependent actions and delays that take place; these procedures do not complete until the desired behavior has been achieved.

17.22 Port Timers state machine

802.1D-2004 17.24 Port Protocol Migration state machine The Port Protocol Migration state machine shall implement the function specified by the state diagram in Figure 17-15, the definitions in 17.16, 17.20, and 17.21, and the variable declarations in 17.17, 17.18, and 17.19. It updates sendRSTP (17.19.38) to tell the Port Transmit state machine (17.26) which BPDU types (9.3) to transmit, to support interoperability (17.4) with the Spanning Tree Algorithm and Protocol specified in previous revisions of this standard.

rx will take care of parsing a received frame from a linux socket if checks pass then packet will be either passed rx machine or marker responder

802.1D-2004 17.30 Topology Change State Machine The Topology Change state machine shall implement the function specified by the state diagram in Figure 17-25, the definitions in 17.13, 17.16, 17.20, and 17.21, and variable declarations in 17.17, 17.18, and 17.19 This state machine is responsible for topology change detection, notification, and propagation, and for instructing the Filtering Database to remove Dynamic Filtering Entries for certain ports (17.11).

timers

tx.go

Index

Constants

View Source
const (
	BdmStateNone = iota + 1
	BdmStateEdge
	BdmStateNotEdge
)
View Source
const (
	BdmEventBeginAdminEdge = iota + 1
	BdmEventBeginNotAdminEdge
	BdmEventNotPortEnabledAndAdminEdge
	BdmEventEdgeDelayWhileEqualZeroAndAutoEdgeAndSendRSTPAndProposing
	BdmEventNotPortEnabledAndNotAdminEdge
	BdmEventNotOperEdge
)
View Source
const (
	MigrateTimeDefault        = 3
	BridgeHelloTimeMin        = 1
	BridgeHelloTimeDefault    = 2
	BridgeMaxAgeMin           = 6
	BridgeMaxAgeMax           = 40
	BridgeMaxAgeDefault       = 20
	BridgeForwardDelayMin     = 4
	BridgeForwardDelayMax     = 30
	BridgeForwardDelayDefault = 15
	TransmitHoldCountMin      = 1
	TransmitHoldCountMax      = 10
	TransmitHoldCountDefault  = 6
)
View Source
const (
	// usage 20,000,000-200,000,000
	PortPathCostSpeedLess100Kbs = 200000000
	// usage 2,000,000-200,000,000
	PortPathCostSpeed1Mb = 20000000
	// usage 200,000-20,000,000
	PortPathCostSpeed10Mb = 2000000
	// usage 20,000-2,000,000
	PortPathCostSpeed100Mb = 200000
	// usage 2,000-200,000
	PortPathCost1Gb = 20000
	// usage 200-20,000
	PortPathCost10Gb = 2000
	// usage 20-2000
	PortPathCost100Gb = 200
	// usage 20-200
	PortPathCost1Tb = 20
	// usage 1-20
	PortPathCost10Tb = 2
)

Table 17-3 Recommended Port Path Cost Values provisionable range 1-200,000,000

View Source
const (
	StpPointToPointForceTrue  PointToPointMac = 0
	StpPointToPointForceFalse                 = 1
	StpPointToPointAuto                       = 2
)
View Source
const (
	// init
	STP_GLOBAL_INIT = iota + 1
	// allow all config
	STP_GLOBAL_ENABLE
	// disallow all config
	STP_GLOBAL_DISABLE
	// transition state to to allow deleting on
	// when global state changes to disable
	STP_GLOBAL_DISABLE_PENDING
)
View Source
const (
	PimStateNone = iota + 1
	PimStateDisabled
	PimStateAged
	PimStateUpdate
	PimStateSuperiorDesignated
	PimStateRepeatedDesignated
	PimStateInferiorDesignated
	PimStateNotDesignated
	PimStateOther
	PimStateCurrent
	PimStateReceive
)
View Source
const (
	PimEventBegin = iota + 1
	PimEventNotPortEnabledInfoIsNotEqualDisabled
	PimEventRcvdMsg
	PimEventRcvdMsgAndNotUpdtInfo
	PimEventPortEnabled
	PimEventSelectedAndUpdtInfo
	PimEventUnconditionalFallThrough
	PimEventInflsEqualReceivedAndRcvdInfoWhileEqualZeroAndNotUpdtInfoAndNotRcvdMsg
	PimEventRcvdInfoEqualSuperiorDesignatedInfo
	PimEventRcvdInfoEqualRepeatedDesignatedInfo
	PimEventRcvdInfoEqualInferiorDesignatedInfo
	PimEventRcvdInfoEqualInferiorRootAlternateInfo
	PimEventRcvdInfoEqualOtherInfo
)
View Source
const (
	PpmmStateNone = iota + 1
	PpmmStateCheckingRSTP
	PpmmStateSelectingSTP
	PpmmStateSensing
)
View Source
const (
	PpmmEventBegin = iota + 1
	PpmmEventMdelayNotEqualMigrateTimeAndNotPortEnabled
	PpmmEventNotPortEnabled
	PpmmEventMcheck
	PpmmEventRstpVersionAndNotSendRSTPAndRcvdRSTP
	PpmmEventMdelayWhileEqualZero
	PpmmEventSendRSTPAndRcvdSTP
)
View Source
const (
	PrsStateNone = iota + 1
	PrsStateInitBridge
	PrsStateRoleSelection
)
View Source
const (
	PrsEventBegin = iota + 1
	PrsEventUnconditionallFallThrough
	PrsEventReselect
)
View Source
const (
	PrtStateNone = iota + 1
	// Role: Disabled
	PrtStateInitPort
	PrtStateDisablePort
	PrtStateDisabledPort
	// Role Root
	PrtStateRootPort
	PrtStateReRoot
	PrtStateRootAgreed
	PrtStateRootProposed
	PrtStateRootForward
	PrtStateRootLearn
	PrtStateReRooted
	// Role Designated
	PrtStateDesignatedPort
	PrtStateDesignatedRetired
	PrtStateDesignatedSynced
	PrtStateDesignatedPropose
	PrtStateDesignatedForward
	PrtStateDesignatedLearn
	PrtStateDesignatedDiscard
	// Role Alternate Backup
	PrtStateAlternatePort
	PrtStateAlternateAgreed
	PrtStateAlternateProposed
	PrtStateBlockPort
	PrtStateBackupPort
)
View Source
const (
	PrtEventBegin                     = iota + 1
	PrtEventUnconditionallFallThrough // 2
	// events taken from Figure 17.20 Disabled Port role transitions
	PrtEventSelectedRoleEqualDisabledPortAndRoleNotEqualSelectedRoleAndSelectedAndNotUpdtInfo // 3
	PrtEventNotLearningAndNotForwardingAndSelectedAndNotUpdtInfo                              // 4
	PrtEventFdWhileNotEqualMaxAgeAndSelectedAndNotUpdtInfo                                    // 5
	PrtEventSyncAndSelectedAndNotUpdtInfo                                                     // 6 also applies to Alternate and Backup Port role
	PrtEventReRootAndSelectedAndNotUpdtInfo                                                   // 7 also applies to Alternate and Backup Port role
	PrtEventNotSyncedAndSelectedAndNotUpdtInfo                                                // 8 also applies to Alternate and Backup Port role
	// events taken from Figure 17.21 Root Port role transitions
	PrtEventSelectedRoleEqualRootPortAndRoleNotEqualSelectedRoleAndSelectedAndNotUpdtInfo           // 9
	PrtEventProposedAndNotAgreeAndSelectedAndNotUpdtInfo                                            // 10 also applies to Alternate and Backup Port role
	PrtEventAllSyncedAndNotAgreeAndSelectedAndNotUpdtInfo                                           // 11 also applies to Alternate and Backup Port role
	PrtEventProposedAndAgreeAndSelectedAndNotUpdtInfo                                               // 12 also applies to Alternate and Backup Port role
	PrtEventNotForwardAndNotReRootAndSelectedAndNotUpdtInfo                                         // 13
	PrtEventRrWhileNotEqualFwdDelayAndSelectedAndNotUpdtInfo                                        // 14
	PrtEventReRootAndForwardAndSelectedAndNotUpdtInfo                                               // 15
	PrtEventFdWhileEqualZeroAndRstpVersionAndNotLearnAndSelectedAndNotUpdtInfo                      // 16
	PrtEventReRootedAndRbWhileEqualZeroAndRstpVersionAndNotLearnAndSelectedAndNotUpdtInfo           // 17
	PrtEventFdWhileEqualZeroAndRstpVersionAndLearnAndNotForwardAndSelectedAndNotUpdtInfo            // 18
	PrtEventReRootedAndRbWhileEqualZeroAndRstpVersionAndLearnAndNotForwardAndSelectedAndNotUpdtInfo // 19
	// events take from Figure 17-22 Designated port role transitions
	PrtEventSelectedRoleEqualDesignatedPortAndRoleNotEqualSelectedRoleAndSelectedAndNotUpdtInfo      // 20
	PrtEventNotForwardAndNotAgreedAndNotProposingAndNotOperEdgeAndSelectedAndNotUpdtInfo             // 21
	PrtEventNotLearningAndNotForwardingAndNotSyncedAndSelectedAndNotUpdtInfo                         // 22
	PrtEventAgreedAndNotSyncedAndSelectedAndNotUpdtInfo                                              // 23
	PrtEventOperEdgeAndNotSyncedAndSelectedAndNotUpdtInfo                                            // 24
	PrtEventSyncAndSyncedAndSelectedAndNotUpdtInfo                                                   // 25
	PrtEventRrWhileEqualZeroAndReRootAndSelectedAndNotUpdtInfo                                       // 26
	PrtEventSyncAndNotSyncedAndNotOperEdgeAndLearnAndSelectedAndNotUpdtInfo                          // 27
	PrtEventSyncAndNotSyncedAndNotOperEdgeAndForwardAndSelectedAndNotUpdtInfo                        // 28
	PrtEventReRootAndRrWhileNotEqualZeroAndNotOperEdgeAndLearnAndSelectedAndNotUpdtInfo              // 29
	PrtEventReRootAndRrWhileNotEqualZeroAndNotOperEdgeAndForwardAndSelectedAndNotUpdtInfo            // 30
	PrtEventDisputedAndNotOperEdgeAndLearnAndSelectedAndNotUpdtInfo                                  // 31
	PrtEventDisputedAndNotOperEdgeAndForwardAndSelectedAndNotUpdtInfo                                // 32
	PrtEventFdWhileEqualZeroAndRrWhileEqualZeroAndNotSyncAndNotLearnAndSelectedAndNotUpdtInfo        // 33
	PrtEventFdWhileEqualZeroAndNotReRootAndNotSyncAndNotLearnSelectedAndNotUpdtInfo                  // 34
	PrtEventAgreedAndRrWhileEqualZeroAndNotSyncAndNotLearnAndSelectedAndNotUpdtInfo                  // 35
	PrtEventAgreedAndNotReRootAndNotSyncAndNotLearnAndSelectedAndNotUpdtInfo                         // 36
	PrtEventOperEdgeAndRrWhileEqualZeroAndNotSyncAndNotLearnAndSelectedAndNotUpdtInfo                // 37
	PrtEventOperEdgeAndNotReRootAndNotSyncAndNotLearnAndSelectedAndNotUpdtInfo                       // 38
	PrtEventNotReRootAndNotSyncAndNotLearnAndSelectedAndNotUpdtInfo                                  // 39
	PrtEventFdWhileEqualZeroAndRrWhileEqualZeroAndNotSyncAndLearnAndNotForwardSelectedAndNotUpdtInfo // 40
	PrtEventFdWhileEqualZeroAndNotReRootAndNotSyncAndLearnAndNotForwardSelectedAndNotUpdtInfo        // 41
	PrtEventAgreedAndRrWhileEqualZeroAndNotSyncAndLearnAndNotForwardAndSelectedAndNotUpdtInfo        // 42
	PrtEventAgreedAndNotReRootAndNotSyncAndLearnAndNotForwardAndSelectedAndNotUpdtInfo               // 43
	PrtEventOperEdgeAndRrWhileEqualZeroAndNotSyncAndLearnAndNotForwardAndSelectedAndNotUpdtInfo      // 44
	PrtEventOperEdgeAndNotReRootAndNotSyncAndLearnAndNotForwardAndSelectedAndNotUpdtInfo             // 45
	PrtEventNotReRootAndNotSyncAndLearnAndNotForwardAndSelectedAndNotUpdtInfo                        // 46
	// events taken from Figure 17-23 Alternate and Backup Port role transitions
	PrtEventSelectedRoleEqualAlternateAndRoleNotEqualSelectedRoleAndSelectedAndNotUpdtInfo   // 47
	PrtEventSelectedRoleEqualBackupPortAndRoleNotEqualSelectedRoleAndSelectedAndNotUpdtInfo  // 48
	PrtEventRbWhileNotEqualTwoTimesHelloTimeAndRoleEqualsBackupPortAndSelectedAndNotUpdtInfo // 49
	PrtEventFdWhileNotEqualForwardDelayAndSelectedAndNotUpdtInfo                             // 50
)
View Source
const (
	PrxmStateNone = iota + 1
	PrxmStateDiscard
	PrxmStateReceive
)
View Source
const (
	PrxmEventBegin = iota + 1
	PrxmEventRcvdBpduAndNotPortEnabled
	PrxmEventEdgeDelayWhileNotEqualMigrateTimeAndNotPortEnabled
	PrxmEventRcvdBpduAndPortEnabled
	PrxmEventRcvdBpduAndPortEnabledAndNotRcvdMsg
)
View Source
const (
	PstStateNone = iota + 1
	PstStateDiscarding
	PstStateLearning
	PstStateForwarding
)
View Source
const (
	PstEventBegin = iota + 1
	PstEventLearn
	PstEventNotLearn
	PstEventForward
	PstEventNotForward
)
View Source
const (
	PtmStateNone = iota + 1
	PtmStateOneSecond
	PtmStateTick
)
View Source
const (
	PtmEventBegin = iota + 1
	PtmEventTickEqualsTrue
	PtmEventUnconditionalFallthrough
)
View Source
const (
	PtxmStateNone = iota + 1
	PtxmStateTransmitInit
	PtxmStateTransmitConfig
	PtxmStateTransmitTCN
	PtxmStateTransmitPeriodic
	PtxmStateTransmitRSTP
	PtxmStateIdle
)
View Source
const (
	PtxmEventBegin = iota + 1
	PtxmEventUnconditionalFallThrough
	PtxmEventSendRSTPAndNewInfoAndTxCountLessThanTxHoldCoundAndHelloWhenNotEqualZeroAndSelectedAndNotUpdtInfo
	PtxmEventNotSendRSTPAndNewInfoAndRootPortAndTxCountLessThanTxHoldCountAndHellWhenNotEqualZeroAndSelectedAndNotUpdtInfo
	PtxmEventNotSendRSTPAndNewInfoAndDesignatedPortAndTxCountLessThanTxHoldCountAndHellWhenNotEqualZeroAndSelectedAndNotUpdtInfo
	PtxmEventHelloWhenEqualsZeroAndSelectedAndNotUpdtInfo
)
View Source
const (
	TcStateNone = iota + 1
	TcStateInactive
	TcStateLearning
	TcStateDetected
	TcStateActive
	TcStateNotifiedTcn
	TcStateNotifiedTc
	TcStatePropagating
	TcStateAcknowledged
)
View Source
const (
	TcEventBegin = iota + 1
	TcEventUnconditionalFallThrough
	TcEventRoleNotEqualRootPortAndRoleNotEqualDesignatedPortAndNotLearnAndNotLearningAndNotRcvdTcAndNotRcvdTcnAndNotRcvdTcAckAndNotTcProp
	TcEventLearnAndNotFdbFlush
	TcEventRcvdTc
	TcEventRcvdTcn
	TcEventRcvdTcAck
	TcEventTcProp
	TcEventRoleEqualRootPortAndForwardAndNotOperEdge
	TcEventRoleEqualDesignatedPortAndForwardAndNotOperEdge
	TcEventTcPropAndNotOperEdge
	TcEventRoleNotEqualRootPortAndRoleNotEqualDesignatedPort
	TcEventOperEdge
)
View Source
const BdmMachineModuleStr = "BDM"
View Source
const BridgeConfigModuleStr = "BRG CFG"
View Source
const DEFAULT_STP_BRIDGE_VLAN = 0
View Source
const PVST_VLAN_PRIORITY = 7
View Source
const PimMachineModuleStr = "PIM"
View Source
const PortConfigModuleStr = "PORT CFG"
View Source
const PpmmMachineModuleStr = "PPMM"
View Source
const PrsMachineModuleStr = "PRSM"
View Source
const PrtMachineModuleStr = "PRTM"
View Source
const PrxmMachineModuleStr = "PRXM"
View Source
const PstMachineModuleStr = "PSTM"
View Source
const PtmMachineModuleStr = "PTIM"
View Source
const PtxmMachineModuleStr = "PTXM"
View Source
const RxModuleStr = "Rx Module STP"
View Source
const TcMachineModuleStr = "TCM"

Variables

View Source
var BdmStateStrMap map[fsm.State]string
View Source
var BridgeListTable []*Bridge
View Source
var BridgeMapTable map[BridgeKey]*Bridge
View Source
var PimStateStrMap map[fsm.State]string
View Source
var PortConfigMap map[int32]portConfig
View Source
var PortListTable []*StpPort
View Source
var PortMapTable map[PortMapKey]*StpPort
View Source
var PpmmStateStrMap map[fsm.State]string
View Source
var PrsStateStrMap map[fsm.State]string
View Source
var PrtStateStrMap map[fsm.State]string
View Source
var PrxmStateStrMap map[fsm.State]string
View Source
var PstStateStrMap map[fsm.State]string
View Source
var PtmStateStrMap map[fsm.State]string
View Source
var PtxmStateStrMap map[fsm.State]string
View Source
var StpBridgeConfigMap map[int32]StpBridgeConfig

store the bridge config for each bridge

View Source
var StpBridgeMac [6]uint8
View Source
var StpGlobalState int = STP_GLOBAL_INIT
View Source
var StpPortConfigMap map[int32]StpPortConfig

store the port config for each port

View Source
var TcStateStrMap map[fsm.State]string
View Source
var TimerTypeStrMap map[TimerType]string

Functions

func BdmMachineStrStateMapInit

func BdmMachineStrStateMapInit()

func BpduRxMain

func BpduRxMain(pId int32, bId int32, rxPktChan chan gopacket.Packet)

BpduRxMain will process incomming packets from

func CompareBridgeAddr

func CompareBridgeAddr(b1 [6]uint8, b2 [6]uint8) int

func CompareBridgeId

func CompareBridgeId(b1 BridgeId, b2 BridgeId) int

Compare BridgeId 0 == equal > 1 == greater than < 1 == less than

func ConstructPortConfigMap

func ConstructPortConfigMap()

func ConvertBoolToUint8

func ConvertBoolToUint8(v bool) (rv uint8)

func ConvertRoleToPktRole

func ConvertRoleToPktRole(r PortRole) (rv uint8)

func CreateBridgeIdStr

func CreateBridgeIdStr(bId BridgeId) string

func DelStpBridge

func DelStpBridge(b *Bridge, force bool)

func DelStpPort

func DelStpPort(p *StpPort)
NOT NEEDED

func (p *StpPort) PollLinuxLinkStatus() {

	p.PollingTimer = time.NewTimer(time.Second * 1)
	p.PollingRoutine = true

	go func(p *StpPort) {
		StpMachineLogger("DEBUG", "LINUX POLLING", p.IfIndex, p.BrgIfIndex, "Start")
		for {
			if !p.PollingRoutine {
				fmt.Println("Stopping Link Polling Routine")
				return
			}
			select {
			case <-p.PollingTimer.C:
				netif, _ := netlink.LinkByName(PortConfigMap[p.IfIndex].Name)
				netifattr := netif.Attrs()
				//StpLogger("DEBUG", fmt.Sprintf("Polling link flags%#v, running=0x%x up=0x%x check1 %t check2 %t", netifattr.Flags, syscall.IFF_RUNNING, syscall.IFF_UP, ((netifattr.Flags>>6)&0x1) == 1, (netifattr.Flags&1) == 1))
				//if (((netifattr.Flags >> 6) & 0x1) == 1) && (netifattr.Flags&1) == 1 {
				if (netifattr.Flags & 1) == 1 {
					//StpLogger("DEBUG", "LINUX LINK UP")
					prevPortEnabled := p.PortEnabled
					p.PortEnabled = true
					p.NotifyPortEnabled("LINUX LINK STATUS", prevPortEnabled, true)

				} else {
					//StpLogger("DEBUG", "LINUX LINK DOWN")
					prevPortEnabled := p.PortEnabled
					p.PortEnabled = false
					p.NotifyPortEnabled("LINUX LINK STATUS", prevPortEnabled, false)

				}
				p.PollingTimer.Reset(time.Second * 1)
			}
		}
	}(p)
}

func GetAsicDPluginList

func GetAsicDPluginList() []asicdClient.AsicdClientIntf

func GetBridgeAddrFromBridgeId

func GetBridgeAddrFromBridgeId(b BridgeId) [6]uint8

func GetBridgePriorityFromBridgeId

func GetBridgePriorityFromBridgeId(b BridgeId) uint16

func GetBridgeVlanFromBridgeId

func GetBridgeVlanFromBridgeId(b BridgeId) (vlan uint16)

func GetIfIndexFromIntfRef

func GetIfIndexFromIntfRef(intfref string) int32

IntfRef can be string number or fpPort

func GetPortNameFromIfIndex

func GetPortNameFromIfIndex(ifindex int32) string

func GetStpLogger

func GetStpLogger() *logging.Writer

func IsDesignatedPriorytVectorNotHigherThanPortPriorityVector

func IsDesignatedPriorytVectorNotHigherThanPortPriorityVector(d *PriorityVector, p *PriorityVector) bool

func IsMsgPriorityVectorSuperiorOrSameThanPortPriorityVector

func IsMsgPriorityVectorSuperiorOrSameThanPortPriorityVector(msg *PriorityVector, port *PriorityVector) bool

func IsMsgPriorityVectorSuperiorThanPortPriorityVector

func IsMsgPriorityVectorSuperiorThanPortPriorityVector(msg *PriorityVector, port *PriorityVector) bool

17.6 Priority vector calculations

func IsMsgPriorityVectorTheSameOrWorseThanPortPriorityVector

func IsMsgPriorityVectorTheSameOrWorseThanPortPriorityVector(msg *PriorityVector, port *PriorityVector) bool

func IsMsgPriorityVectorWorseThanPortPriorityVector

func IsMsgPriorityVectorWorseThanPortPriorityVector(msg *PriorityVector, port *PriorityVector) bool

func IsValidStpPort

func IsValidStpPort(pId int32) bool

func PimMachineStrStateMapInit

func PimMachineStrStateMapInit()

func PpmmMachineStrStateMapInit

func PpmmMachineStrStateMapInit()

func ProcessBpduFrame

func ProcessBpduFrame(p *StpPort, ptype BPDURxType, packet gopacket.Packet)

ProcessBpduFrame will lookup the cooresponding port from which the packet arrived and forward the packet to the Port Rx Machine for processing

func PrsMachineStrStateMapInit

func PrsMachineStrStateMapInit()

func PrtMachineStrStateMapInit

func PrtMachineStrStateMapInit()

func PrxmMachineStrStateMapInit

func PrxmMachineStrStateMapInit()

func PstMachineStrStateMapInit

func PstMachineStrStateMapInit()

func PtmMachineStrStateMapInit

func PtmMachineStrStateMapInit()

func PtxmMachineStrStateMapInit

func PtxmMachineStrStateMapInit()

func SaveSwitchMac

func SaveSwitchMac(switchMac string)

func SendResponse

func SendResponse(msg string, responseChan chan string)

func SetAsicDPlugin

func SetAsicDPlugin(clientif asicdClient.AsicdClientIntf)

func StpBrgConfigDelete

func StpBrgConfigDelete(bId int32) error

func StpBrgConfigParamCheck

func StpBrgConfigParamCheck(c *StpBridgeConfig, create bool) error

StpBrgConfigParamCheck will validate the bridge config paramaters

func StpBrgConfigSave

func StpBrgConfigSave(c *StpBridgeConfig) error

StpPortConfigSave Save the last config given by user this is a validation check as well so that all port contain the same config

func StpBrgForceVersion

func StpBrgForceVersion(bId int32, version int32) error

func StpBrgForwardDelaySet

func StpBrgForwardDelaySet(bId int32, fwddelay uint16) error

func StpBrgHelloTimeSet

func StpBrgHelloTimeSet(bId int32, hellotime uint16) error

func StpBrgMaxAgeSet

func StpBrgMaxAgeSet(bId int32, maxage uint16) error

func StpBrgPrioritySet

func StpBrgPrioritySet(bId int32, priority uint16) error

func StpBrgTxHoldCountSet

func StpBrgTxHoldCountSet(bId int32, txholdcount uint16) error

func StpBridgeCreate

func StpBridgeCreate(c *StpBridgeConfig) error

func StpBridgeDelete

func StpBridgeDelete(c *StpBridgeConfig) error

func StpFindBridgeById

func StpFindBridgeById(key BridgeKey, b **Bridge) bool

func StpFindBridgeByIfIndex

func StpFindBridgeByIfIndex(brgIfIndex int32, brg **Bridge) bool

func StpFindPortByIfIndex

func StpFindPortByIfIndex(pId int32, brgId int32, p **StpPort) bool

func StpGetBpduAgreement

func StpGetBpduAgreement(flags uint8) bool

func StpGetBpduForwarding

func StpGetBpduForwarding(flags uint8) bool

func StpGetBpduLearning

func StpGetBpduLearning(flags uint8) bool

func StpGetBpduProposal

func StpGetBpduProposal(flags uint8) bool

func StpGetBpduTopoChange

func StpGetBpduTopoChange(flags uint8) bool

func StpGetBpduTopoChangeAck

func StpGetBpduTopoChangeAck(flags uint8) bool

func StpGlobalStateGet

func StpGlobalStateGet() int

func StpGlobalStateSet

func StpGlobalStateSet(state int)

func StpLogger

func StpLogger(t string, msg string)

func StpMachineLogger

func StpMachineLogger(t string, m string, p int32, b int32, msg string)

func StpPortAddToBridge

func StpPortAddToBridge(pId int32, brgifindex int32)

func StpPortAdminEdgeSet

func StpPortAdminEdgeSet(pId int32, bId int32, adminedge bool) error

StpPortAdminEdgeSet will set all bridge port as admin edge ports

func StpPortBpduGuardSet

func StpPortBpduGuardSet(pId int32, bId int32, bpduguard bool) error

func StpPortBridgeAssuranceSet

func StpPortBridgeAssuranceSet(pId int32, bId int32, bridgeassurance bool) error

func StpPortConfigDelete

func StpPortConfigDelete(Id int32)

Delete the saved port configuration

func StpPortConfigParamCheck

func StpPortConfigParamCheck(c *StpPortConfig, update bool, create bool) error

StpPortConfigParamCheck will validate the config paramater for a bridge port

func StpPortConfigSave

func StpPortConfigSave(c *StpPortConfig, update bool) error

StpPortConfigSave Save the last config given by user this is a validation check as well so that all port contain the same config

func StpPortCreate

func StpPortCreate(c *StpPortConfig) error

func StpPortDelFromBridge

func StpPortDelFromBridge(pId int32, brgifindex int32)

func StpPortDelete

func StpPortDelete(c *StpPortConfig) error

func StpPortEnable

func StpPortEnable(pId int32, bId int32, enable bool) error

func StpPortLinkDown

func StpPortLinkDown(pId int32)

func StpPortLinkUp

func StpPortLinkUp(pId int32)

func StpPortPortPathCostSet

func StpPortPortPathCostSet(pId int32, bId int32, pathcost uint32) error

StpPortPortPathCostSet N/A

func StpPortPrioritySet

func StpPortPrioritySet(pId int32, bId int32, priority uint16) error

StpPortPrioritySet will set the priority on all bridge ports

func StpPortProtocolMigrationSet

func StpPortProtocolMigrationSet(pId int32, bId int32, protocolmigration bool) error

func StpSetBpduFlags

func StpSetBpduFlags(topochangeack uint8, agreement uint8, forwarding uint8, learning uint8, role uint8, proposal uint8, topochange uint8, flags *uint8)

func TcMachineStrStateMapInit

func TcMachineStrStateMapInit()

func TimerTypeStrStateMapInit

func TimerTypeStrStateMapInit()

Types

type BPDURxType

type BPDURxType int8
const (
	BPDURxTypeUnknown BPDURxType = iota
	BPDURxTypeUnknownBPDU
	BPDURxTypeSTP
	BPDURxTypeRSTP
	BPDURxTypeTopo
	BPDURxTypeTopoAck
	BPDURxTypePVST
)

this is not to be confused with bpdu type as defined in message

func ValidateBPDUFrame

func ValidateBPDUFrame(p *StpPort, packet gopacket.Packet) (bpduType BPDURxType)

ValidateBPDUFrame: 802.1D Section 9.3.4 Function shall validate the received BPDU

type BdmMachine

type BdmMachine struct {
	Machine *fsm.Machine

	// machine specific events
	BdmEvents chan MachineEvent
	// enable logging
	BdmLogEnableEvent chan bool
	// contains filtered or unexported fields
}

BdmMachine holds FSM and current State and event channels for State transitions

func BdmMachineFSMBuild

func BdmMachineFSMBuild(p *StpPort) *BdmMachine

func NewStpBdmMachine

func NewStpBdmMachine(p *StpPort) *BdmMachine

NewStpPimMachine will create a new instance of the LacpRxMachine

func (*BdmMachine) Apply

func (bdm *BdmMachine) Apply(r *fsm.Ruleset) *fsm.Machine

A helpful function that lets us apply arbitrary rulesets to this instances State machine without reallocating the machine.

func (*BdmMachine) BdmLogger

func (bdm *BdmMachine) BdmLogger(s string)

func (*BdmMachine) BdmMachineEdge

func (bdm *BdmMachine) BdmMachineEdge(m fsm.Machine, data interface{}) fsm.State

BdmMachineEdge

func (*BdmMachine) BdmMachineNotEdge

func (bdm *BdmMachine) BdmMachineNotEdge(m fsm.Machine, data interface{}) fsm.State

BdmMachineNotEdge

func (*BdmMachine) GetCurrStateStr

func (m *BdmMachine) GetCurrStateStr() string

func (*BdmMachine) GetPrevStateStr

func (m *BdmMachine) GetPrevStateStr() string

func (*BdmMachine) ProcessPostStateEdge

func (bdm *BdmMachine) ProcessPostStateEdge()

func (*BdmMachine) ProcessPostStateNotEdge

func (bdm *BdmMachine) ProcessPostStateNotEdge()

func (*BdmMachine) ProcessPostStateProcessing

func (bdm *BdmMachine) ProcessPostStateProcessing()

func (*BdmMachine) Stop

func (bdm *BdmMachine) Stop()

Stop should clean up all resources

type Bridge

type Bridge struct {

	// 17.18.1
	Begin bool
	// 17.18.2
	BridgeIdentifier BridgeId
	// 17.18.3
	// Root/Designated equal to Bridge Identifier
	BridgePriority PriorityVector
	// 17.18.4
	BridgeTimes Times
	// 17.18.6
	RootPortId int32
	// 17.18.7
	RootTimes Times
	// Stp IfIndex
	StpPorts []int32

	ForceVersion int32
	TxHoldCount  uint64

	// Vlan
	Vlan uint16

	PrsMachineFsm *PrsMachine

	// store the previous bridge id
	OldRootBridgeIdentifier BridgeId

	// IntfRef
	IntfRef string

	// bridge ifIndex
	BrgIfIndex int32
	// hw stgId
	StgId int32

	DebugLevel int
	// contains filtered or unexported fields
}

func NewStpBridge

func NewStpBridge(c *StpBridgeConfig) *Bridge

func (*Bridge) AllSynced

func (b *Bridge) AllSynced() bool

func (*Bridge) BEGIN

func (b *Bridge) BEGIN(restart bool)

func (*Bridge) PrsMachineMain

func (b *Bridge) PrsMachineMain()

PrsMachineMain:

func (*Bridge) ReRooted

func (b *Bridge) ReRooted(p *StpPort) bool

func (*Bridge) Stop

func (b *Bridge) Stop()

type BridgeId

type BridgeId [8]uint8

func CreateBridgeId

func CreateBridgeId(bridgeAddress [6]uint8, bridgePriority uint16, vlan uint16) BridgeId

type BridgeKey

type BridgeKey struct {
	Vlan uint16
}

type MachineEvent

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

type PimMachine

type PimMachine struct {
	Machine *fsm.Machine

	// machine specific events
	PimEvents chan MachineEvent
	// enable logging
	PimLogEnableEvent chan bool
	// contains filtered or unexported fields
}

PimMachine holds FSM and current State and event channels for State transitions

func NewStpPimMachine

func NewStpPimMachine(p *StpPort) *PimMachine

NewStpPimMachine will create a new instance of the LacpRxMachine

func PimMachineFSMBuild

func PimMachineFSMBuild(p *StpPort) *PimMachine

func (*PimMachine) Apply

func (pim *PimMachine) Apply(r *fsm.Ruleset) *fsm.Machine

A helpful function that lets us apply arbitrary rulesets to this instances State machine without reallocating the machine.

func (*PimMachine) GetCurrStateStr

func (m *PimMachine) GetCurrStateStr() string

func (*PimMachine) GetPrevStateStr

func (m *PimMachine) GetPrevStateStr() string

func (*PimMachine) NotifyAgreeChanged

func (pim *PimMachine) NotifyAgreeChanged(oldagree bool, newagree bool)

notify the prt machine

func (*PimMachine) NotifyAgreedChanged

func (pim *PimMachine) NotifyAgreedChanged(oldagreed bool, newagreed bool)

func (*PimMachine) NotifyDisputedChanged

func (pim *PimMachine) NotifyDisputedChanged(olddisputed bool, newdisputed bool)

func (*PimMachine) NotifyNewInfoChange

func (pim *PimMachine) NotifyNewInfoChange(oldnewinfo bool, newnewinfo bool)

func (*PimMachine) NotifyProposedChanged

func (pim *PimMachine) NotifyProposedChanged(oldproposed bool, newproposed bool)

func (*PimMachine) NotifyReselectChanged

func (pim *PimMachine) NotifyReselectChanged(oldreselect bool, newreselect bool)

func (*PimMachine) PimLogger

func (pim *PimMachine) PimLogger(s string)

func (*PimMachine) PimMachineAged

func (pim *PimMachine) PimMachineAged(m fsm.Machine, data interface{}) fsm.State

PimMachineAged

func (*PimMachine) PimMachineCurrent

func (pim *PimMachine) PimMachineCurrent(m fsm.Machine, data interface{}) fsm.State

PimMachineCurrent

func (*PimMachine) PimMachineDisabled

func (pim *PimMachine) PimMachineDisabled(m fsm.Machine, data interface{}) fsm.State

PimMachineDisabled

func (*PimMachine) PimMachineInferiorDesignated

func (pim *PimMachine) PimMachineInferiorDesignated(m fsm.Machine, data interface{}) fsm.State

PimMachineInferiorDesignated

func (*PimMachine) PimMachineNotDesignated

func (pim *PimMachine) PimMachineNotDesignated(m fsm.Machine, data interface{}) fsm.State

PimMachineNotDesignated

func (*PimMachine) PimMachineOther

func (pim *PimMachine) PimMachineOther(m fsm.Machine, data interface{}) fsm.State

PimMachineOther

func (*PimMachine) PimMachineReceive

func (pim *PimMachine) PimMachineReceive(m fsm.Machine, data interface{}) fsm.State

PimMachineReceive

func (*PimMachine) PimMachineRepeatedDesignated

func (pim *PimMachine) PimMachineRepeatedDesignated(m fsm.Machine, data interface{}) fsm.State

PimMachineRepeatedDesignated

func (*PimMachine) PimMachineSuperiorDesignated

func (pim *PimMachine) PimMachineSuperiorDesignated(m fsm.Machine, data interface{}) fsm.State

PimMachineSuperiorDesignated

func (*PimMachine) PimMachineUpdate

func (pim *PimMachine) PimMachineUpdate(m fsm.Machine, data interface{}) fsm.State

PimMachineUpdate

func (*PimMachine) ProcessPostStateProcessing

func (pim *PimMachine) ProcessPostStateProcessing(data interface{})

func (*PimMachine) ProcessingPostStateAged

func (pim *PimMachine) ProcessingPostStateAged(data interface{})

func (*PimMachine) ProcessingPostStateCurrent

func (pim *PimMachine) ProcessingPostStateCurrent(data interface{})

func (*PimMachine) ProcessingPostStateDisabled

func (pim *PimMachine) ProcessingPostStateDisabled(data interface{})

func (*PimMachine) ProcessingPostStateInferiorDesignated

func (pim *PimMachine) ProcessingPostStateInferiorDesignated(data interface{})

func (*PimMachine) ProcessingPostStateNotDesignated

func (pim *PimMachine) ProcessingPostStateNotDesignated(data interface{})

func (*PimMachine) ProcessingPostStateOther

func (pim *PimMachine) ProcessingPostStateOther(data interface{})

func (*PimMachine) ProcessingPostStateReceive

func (pim *PimMachine) ProcessingPostStateReceive(data interface{})

func (*PimMachine) ProcessingPostStateRepeatedDesignated

func (pim *PimMachine) ProcessingPostStateRepeatedDesignated(data interface{})

func (*PimMachine) ProcessingPostStateSuperiorDesignated

func (pim *PimMachine) ProcessingPostStateSuperiorDesignated(data interface{})

func (*PimMachine) ProcessingPostStateUpdate

func (pim *PimMachine) ProcessingPostStateUpdate(data interface{})

func (*PimMachine) Stop

func (pim *PimMachine) Stop()

Stop should clean up all resources

type PointToPointMac

type PointToPointMac int

type PortDesignatedRcvInfo

type PortDesignatedRcvInfo int
const (
	SuperiorDesignatedInfo PortDesignatedRcvInfo = iota
	RepeatedDesignatedInfo
	InferiorDesignatedInfo
	InferiorRootAlternateInfo
	OtherInfo
)

type PortInfoState

type PortInfoState int
const (
	PortInfoStateMine PortInfoState = iota
	PortInfoStateAged
	PortInfoStateReceived
	PortInfoStateDisabled
)

type PortMapKey

type PortMapKey struct {
	IfIndex    int32
	BrgIfIndex int32
}

type PortRole

type PortRole int
const (
	PortRoleInvalid PortRole = iota
	PortRoleBridgePort
	PortRoleRootPort
	PortRoleDesignatedPort
	PortRoleAlternatePort
	PortRoleBackupPort
	PortRoleDisabledPort
)

func StpGetBpduRole

func StpGetBpduRole(flags uint8) (role PortRole)

type PortTimer

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

func (*PortTimer) GetCount

func (t *PortTimer) GetCount() int32

type PpmmMachine

type PpmmMachine struct {
	Machine *fsm.Machine

	// machine specific events
	PpmmEvents chan MachineEvent
	// enable logging
	PpmmLogEnableEvent chan bool
	// contains filtered or unexported fields
}

LacpRxMachine holds FSM and current State and event channels for State transitions

func NewStpPpmmMachine

func NewStpPpmmMachine(p *StpPort) *PpmmMachine

NewLacpRxMachine will create a new instance of the LacpRxMachine

func PpmmMachineFSMBuild

func PpmmMachineFSMBuild(p *StpPort) *PpmmMachine

func (*PpmmMachine) Apply

func (ppmm *PpmmMachine) Apply(r *fsm.Ruleset) *fsm.Machine

A helpful function that lets us apply arbitrary rulesets to this instances State machine without reallocating the machine.

func (*PpmmMachine) GetCurrStateStr

func (m *PpmmMachine) GetCurrStateStr() string

func (*PpmmMachine) GetPrevStateStr

func (m *PpmmMachine) GetPrevStateStr() string

func (*PpmmMachine) InformPtxMachineSendRSTPChanged

func (ppmm *PpmmMachine) InformPtxMachineSendRSTPChanged()

func (*PpmmMachine) PpmLogger

func (ppm *PpmmMachine) PpmLogger(s string)

func (*PpmmMachine) PpmmMachineCheckingRSTP

func (ppmm *PpmmMachine) PpmmMachineCheckingRSTP(m fsm.Machine, data interface{}) fsm.State

PpmMachineCheckingRSTP

func (*PpmmMachine) PpmmMachineSelectingSTP

func (ppmm *PpmmMachine) PpmmMachineSelectingSTP(m fsm.Machine, data interface{}) fsm.State

PpmmMachineSelectingSTP

func (*PpmmMachine) PpmmMachineSensing

func (ppmm *PpmmMachine) PpmmMachineSensing(m fsm.Machine, data interface{}) fsm.State

PpmmMachineSensing

func (*PpmmMachine) ProcessPostStateCheckingRSTP

func (ppmm *PpmmMachine) ProcessPostStateCheckingRSTP()

func (*PpmmMachine) ProcessPostStateProcessing

func (ppmm *PpmmMachine) ProcessPostStateProcessing()

func (*PpmmMachine) ProcessPostStateSelectingSTP

func (ppmm *PpmmMachine) ProcessPostStateSelectingSTP()

func (*PpmmMachine) ProcessPostStateSensing

func (ppmm *PpmmMachine) ProcessPostStateSensing()

func (*PpmmMachine) Stop

func (ppmm *PpmmMachine) Stop()

Stop should clean up all resources

type PriorityVector

type PriorityVector struct {
	RootBridgeId       BridgeId
	RootPathCost       uint32
	DesignatedBridgeId BridgeId
	DesignatedPortId   uint16
	BridgePortId       uint16
}

type PrsMachine

type PrsMachine struct {
	Machine *fsm.Machine

	// machine specific events
	PrsEvents chan MachineEvent
	// enable logging
	PrsLogEnableEvent chan bool
	// contains filtered or unexported fields
}

PrsMachine holds FSM and current State and event channels for State transitions

func NewStpPrsMachine

func NewStpPrsMachine(b *Bridge) *PrsMachine

NewStpPimMachine will create a new instance of the LacpRxMachine

func PrsMachineFSMBuild

func PrsMachineFSMBuild(b *Bridge) *PrsMachine

func (*PrsMachine) Apply

func (prsm *PrsMachine) Apply(r *fsm.Ruleset) *fsm.Machine

A helpful function that lets us apply arbitrary rulesets to this instances State machine without reallocating the machine.

func (*PrsMachine) GetCurrStateStr

func (m *PrsMachine) GetCurrStateStr() string

func (*PrsMachine) GetPrevStateStr

func (m *PrsMachine) GetPrevStateStr() string

func (*PrsMachine) PrsLogger

func (prsm *PrsMachine) PrsLogger(s string)

func (*PrsMachine) PrsMachineInitBridge

func (prsm *PrsMachine) PrsMachineInitBridge(m fsm.Machine, data interface{}) fsm.State

PrsMachineInitBridge

func (*PrsMachine) PrsMachineRoleSelection

func (prsm *PrsMachine) PrsMachineRoleSelection(m fsm.Machine, data interface{}) fsm.State

PrsMachineRoleSelection

func (*PrsMachine) Stop

func (prsm *PrsMachine) Stop()

Stop should clean up all resources

type PrtMachine

type PrtMachine struct {
	Machine *fsm.Machine

	// machine specific events
	PrtEvents chan MachineEvent
	// enable logging
	PrtLogEnableEvent chan bool
	// contains filtered or unexported fields
}

PrtMachine holds FSM and current State and event channels for State transitions

func NewStpPrtMachine

func NewStpPrtMachine(p *StpPort) *PrtMachine

NewStpPrtMachine will create a new instance of the LacpRxMachine

func PrtMachineFSMBuild

func PrtMachineFSMBuild(p *StpPort) *PrtMachine

func (*PrtMachine) Apply

func (prtm *PrtMachine) Apply(r *fsm.Ruleset) *fsm.Machine

A helpful function that lets us apply arbitrary rulesets to this instances State machine without reallocating the machine.

func (*PrtMachine) GetCurrStateStr

func (m *PrtMachine) GetCurrStateStr() string

func (*PrtMachine) GetPrevStateStr

func (m *PrtMachine) GetPrevStateStr() string

func (*PrtMachine) NotifyForwardChanged

func (prtm *PrtMachine) NotifyForwardChanged(oldforward bool, newforward bool)

func (*PrtMachine) NotifyLearnChanged

func (prtm *PrtMachine) NotifyLearnChanged(oldlearn bool, newlearn bool)

func (*PrtMachine) NotifyNewInfoChanged

func (prtm *PrtMachine) NotifyNewInfoChanged(oldnewinfo bool, newnewinfo bool)

func (*PrtMachine) NotifyReRootChanged

func (prtm *PrtMachine) NotifyReRootChanged(oldreroot bool, newreroot bool)

func (*PrtMachine) NotifyRoleChanged

func (prtm *PrtMachine) NotifyRoleChanged(oldrole PortRole, newrole PortRole)

func (*PrtMachine) NotifySyncChanged

func (prtm *PrtMachine) NotifySyncChanged(oldsync bool, newsync bool)

func (*PrtMachine) ProcessPostStateInitPort

func (prtm *PrtMachine) ProcessPostStateInitPort()

func (*PrtMachine) ProcessPostStateProcessing

func (prtm *PrtMachine) ProcessPostStateProcessing()

func (*PrtMachine) ProcessPostStateRootPort

func (prtm *PrtMachine) ProcessPostStateRootPort()

func (*PrtMachine) ProcessingPostStateAlternateAgreed

func (prtm *PrtMachine) ProcessingPostStateAlternateAgreed()

func (*PrtMachine) ProcessingPostStateAlternatePort

func (prtm *PrtMachine) ProcessingPostStateAlternatePort()

func (*PrtMachine) ProcessingPostStateAlternateProposed

func (prtm *PrtMachine) ProcessingPostStateAlternateProposed()

func (*PrtMachine) ProcessingPostStateBackupPort

func (prtm *PrtMachine) ProcessingPostStateBackupPort()

func (*PrtMachine) ProcessingPostStateBlockedPort

func (prtm *PrtMachine) ProcessingPostStateBlockedPort()

func (*PrtMachine) ProcessingPostStateDesignatedDiscard

func (prtm *PrtMachine) ProcessingPostStateDesignatedDiscard()

func (*PrtMachine) ProcessingPostStateDesignatedForward

func (prtm *PrtMachine) ProcessingPostStateDesignatedForward()

func (*PrtMachine) ProcessingPostStateDesignatedLearn

func (prtm *PrtMachine) ProcessingPostStateDesignatedLearn()

func (*PrtMachine) ProcessingPostStateDesignatedPort

func (prtm *PrtMachine) ProcessingPostStateDesignatedPort()

func (*PrtMachine) ProcessingPostStateDesignatedPropose

func (prtm *PrtMachine) ProcessingPostStateDesignatedPropose()

func (*PrtMachine) ProcessingPostStateDesignatedRetired

func (prtm *PrtMachine) ProcessingPostStateDesignatedRetired()

func (*PrtMachine) ProcessingPostStateDesignatedSynced

func (prtm *PrtMachine) ProcessingPostStateDesignatedSynced()

func (*PrtMachine) ProcessingPostStateDisable

func (prtm *PrtMachine) ProcessingPostStateDisable()

func (*PrtMachine) ProcessingPostStateDisabled

func (prtm *PrtMachine) ProcessingPostStateDisabled()

func (*PrtMachine) ProcessingPostStateReRoot

func (prtm *PrtMachine) ProcessingPostStateReRoot()

func (*PrtMachine) ProcessingPostStateReRooted

func (prtm *PrtMachine) ProcessingPostStateReRooted()

func (*PrtMachine) ProcessingPostStateRootAgreed

func (prtm *PrtMachine) ProcessingPostStateRootAgreed()

func (*PrtMachine) ProcessingPostStateRootForward

func (prtm *PrtMachine) ProcessingPostStateRootForward()

func (*PrtMachine) ProcessingPostStateRootLearn

func (prtm *PrtMachine) ProcessingPostStateRootLearn()

func (*PrtMachine) ProcessingPostStateRootProposed

func (prtm *PrtMachine) ProcessingPostStateRootProposed()

func (*PrtMachine) PrtLogger

func (prtm *PrtMachine) PrtLogger(s string)

func (*PrtMachine) PrtMachineAlternateAgreed

func (prtm *PrtMachine) PrtMachineAlternateAgreed(m fsm.Machine, data interface{}) fsm.State

PrtMachineAlternateAgreed

func (*PrtMachine) PrtMachineAlternatePort

func (prtm *PrtMachine) PrtMachineAlternatePort(m fsm.Machine, data interface{}) fsm.State

PrtMachineAlternatePort

func (*PrtMachine) PrtMachineAlternateProposed

func (prtm *PrtMachine) PrtMachineAlternateProposed(m fsm.Machine, data interface{}) fsm.State

PrtMachineAlternateProposed

func (*PrtMachine) PrtMachineBackupPort

func (prtm *PrtMachine) PrtMachineBackupPort(m fsm.Machine, data interface{}) fsm.State

PrtMachineBackupPort

func (*PrtMachine) PrtMachineBlockPort

func (prtm *PrtMachine) PrtMachineBlockPort(m fsm.Machine, data interface{}) fsm.State

PrtMachineBlockPort

func (*PrtMachine) PrtMachineDesignatedDiscard

func (prtm *PrtMachine) PrtMachineDesignatedDiscard(m fsm.Machine, data interface{}) fsm.State

PrtMachineDesignatedDiscard

func (*PrtMachine) PrtMachineDesignatedForward

func (prtm *PrtMachine) PrtMachineDesignatedForward(m fsm.Machine, data interface{}) fsm.State

PrtMachineDesignatedForward

func (*PrtMachine) PrtMachineDesignatedLearn

func (prtm *PrtMachine) PrtMachineDesignatedLearn(m fsm.Machine, data interface{}) fsm.State

PrtMachineDesignatedLearn

func (*PrtMachine) PrtMachineDesignatedPort

func (prtm *PrtMachine) PrtMachineDesignatedPort(m fsm.Machine, data interface{}) fsm.State

PrtMachineDesignatedPort

func (*PrtMachine) PrtMachineDesignatedPropose

func (prtm *PrtMachine) PrtMachineDesignatedPropose(m fsm.Machine, data interface{}) fsm.State

PrtMachineDesignatedPropose

func (*PrtMachine) PrtMachineDesignatedRetired

func (prtm *PrtMachine) PrtMachineDesignatedRetired(m fsm.Machine, data interface{}) fsm.State

PrtMachineDesignatedRetired

func (*PrtMachine) PrtMachineDesignatedSynced

func (prtm *PrtMachine) PrtMachineDesignatedSynced(m fsm.Machine, data interface{}) fsm.State

PrtMachineDesignatedSynced

func (*PrtMachine) PrtMachineDisablePort

func (prtm *PrtMachine) PrtMachineDisablePort(m fsm.Machine, data interface{}) fsm.State

PrtMachineDisablePort

func (*PrtMachine) PrtMachineDisabledPort

func (prtm *PrtMachine) PrtMachineDisabledPort(m fsm.Machine, data interface{}) fsm.State

PrtMachineDisablePort

func (*PrtMachine) PrtMachineInitPort

func (prtm *PrtMachine) PrtMachineInitPort(m fsm.Machine, data interface{}) fsm.State

PrtMachineInitPort

func (*PrtMachine) PrtMachineReRoot

func (prtm *PrtMachine) PrtMachineReRoot(m fsm.Machine, data interface{}) fsm.State

PrtMachineReroot

func (*PrtMachine) PrtMachineReRooted

func (prtm *PrtMachine) PrtMachineReRooted(m fsm.Machine, data interface{}) fsm.State

PrtMachineReRooted

func (*PrtMachine) PrtMachineRootAgreed

func (prtm *PrtMachine) PrtMachineRootAgreed(m fsm.Machine, data interface{}) fsm.State

PrtMachineRootAgreed

func (*PrtMachine) PrtMachineRootForward

func (prtm *PrtMachine) PrtMachineRootForward(m fsm.Machine, data interface{}) fsm.State

PrtMachineRootForward

func (*PrtMachine) PrtMachineRootLearn

func (prtm *PrtMachine) PrtMachineRootLearn(m fsm.Machine, data interface{}) fsm.State

PrtMachineRootLearn

func (*PrtMachine) PrtMachineRootPort

func (prtm *PrtMachine) PrtMachineRootPort(m fsm.Machine, data interface{}) fsm.State

PrtMachineRootPort

func (*PrtMachine) PrtMachineRootProposed

func (prtm *PrtMachine) PrtMachineRootProposed(m fsm.Machine, data interface{}) fsm.State

PrtMachineRootProposed

func (*PrtMachine) Stop

func (prtm *PrtMachine) Stop()

Stop should clean up all resources

type PrxmMachine

type PrxmMachine struct {
	Machine *fsm.Machine

	// machine specific events
	PrxmEvents chan MachineEvent
	// rx pkt
	PrxmRxBpduPkt chan RxBpduPdu

	// enable logging
	PrxmLogEnableEvent chan bool
	// contains filtered or unexported fields
}

LacpRxMachine holds FSM and current State and event channels for State transitions

func NewStpPrxmMachine

func NewStpPrxmMachine(p *StpPort) *PrxmMachine

NewLacpRxMachine will create a new instance of the LacpRxMachine

func PrxmMachineFSMBuild

func PrxmMachineFSMBuild(p *StpPort) *PrxmMachine

func (*PrxmMachine) Apply

func (prxm *PrxmMachine) Apply(r *fsm.Ruleset) *fsm.Machine

A helpful function that lets us apply arbitrary rulesets to this instances State machine without reallocating the machine.

func (*PrxmMachine) GetCurrStateStr

func (m *PrxmMachine) GetCurrStateStr() string

func (*PrxmMachine) GetPrevStateStr

func (m *PrxmMachine) GetPrevStateStr() string

func (*PrxmMachine) ProcessPostStateDiscard

func (prxm *PrxmMachine) ProcessPostStateDiscard(data interface{})

func (*PrxmMachine) ProcessPostStateProcessing

func (prxm *PrxmMachine) ProcessPostStateProcessing(data interface{})

func (*PrxmMachine) ProcessPostStateReceive

func (prxm *PrxmMachine) ProcessPostStateReceive(data interface{})

func (*PrxmMachine) PrxmLogger

func (prxm *PrxmMachine) PrxmLogger(s string)

func (*PrxmMachine) PrxmMachineDiscard

func (prxm *PrxmMachine) PrxmMachineDiscard(m fsm.Machine, data interface{}) fsm.State

PrmMachineDiscard

func (*PrxmMachine) PrxmMachineReceive

func (prxm *PrxmMachine) PrxmMachineReceive(m fsm.Machine, data interface{}) fsm.State

LacpPtxMachineFastPeriodic sets the periodic transmission time to fast and starts the timer

func (*PrxmMachine) Stop

func (prxm *PrxmMachine) Stop()

Stop should clean up all resources

func (*PrxmMachine) UpdtBPDUVersion

func (prxm *PrxmMachine) UpdtBPDUVersion(data interface{}) bool

UpdtBPDUVersion: 17.21.22 This function will also inform Port Migration of BPDU type rcvdRSTP or rcvdSTP Figure 17-12

type PstMachine

type PstMachine struct {
	Machine *fsm.Machine

	// machine specific events
	PstEvents chan MachineEvent
	// enable logging
	PstLogEnableEvent chan bool
	// contains filtered or unexported fields
}

PstMachine holds FSM and current State and event channels for State transitions

func NewStpPstMachine

func NewStpPstMachine(p *StpPort) *PstMachine

NewStpPrtMachine will create a new instance of the LacpRxMachine

func PstMachineFSMBuild

func PstMachineFSMBuild(p *StpPort) *PstMachine

func (*PstMachine) Apply

func (pstm *PstMachine) Apply(r *fsm.Ruleset) *fsm.Machine

A helpful function that lets us apply arbitrary rulesets to this instances State machine without reallocating the machine.

func (*PstMachine) GetCurrStateStr

func (m *PstMachine) GetCurrStateStr() string

func (*PstMachine) GetPrevStateStr

func (m *PstMachine) GetPrevStateStr() string

func (*PstMachine) NotifyForwardingChanged

func (pstm *PstMachine) NotifyForwardingChanged(oldforwarding bool, newforwarding bool)

func (*PstMachine) NotifyLearningChanged

func (pstm *PstMachine) NotifyLearningChanged(oldlearning bool, newlearning bool)

func (*PstMachine) ProcessPostStateDiscarding

func (pstm *PstMachine) ProcessPostStateDiscarding()

func (*PstMachine) ProcessPostStateForwarding

func (pstm *PstMachine) ProcessPostStateForwarding()

func (*PstMachine) ProcessPostStateLearning

func (pstm *PstMachine) ProcessPostStateLearning()

func (*PstMachine) ProcessPostStateProcessing

func (pstm *PstMachine) ProcessPostStateProcessing()

func (*PstMachine) PstMachineDiscarding

func (pstm *PstMachine) PstMachineDiscarding(m fsm.Machine, data interface{}) fsm.State

PstMachineDiscarding

func (*PstMachine) PstMachineForwarding

func (pstm *PstMachine) PstMachineForwarding(m fsm.Machine, data interface{}) fsm.State

PstMachineForwarding

func (*PstMachine) PstMachineLearning

func (pstm *PstMachine) PstMachineLearning(m fsm.Machine, data interface{}) fsm.State

PstMachineLearning

func (*PstMachine) PstmLogger

func (pstm *PstMachine) PstmLogger(s string)

func (*PstMachine) Stop

func (pstm *PstMachine) Stop()

Stop should clean up all resources

type PtmMachine

type PtmMachine struct {
	// for debugging
	PreviousState fsm.State

	Machine *fsm.Machine

	// timer type
	TickTimer *time.Timer
	Tick      bool

	// machine specific events
	PtmEvents chan MachineEvent
	// enable logging
	PtmLogEnableEvent chan bool
	// contains filtered or unexported fields
}

LacpRxMachine holds FSM and current State and event channels for State transitions

func NewStpPtmMachine

func NewStpPtmMachine(p *StpPort) *PtmMachine

NewLacpRxMachine will create a new instance of the LacpRxMachine

func PtmMachineFSMBuild

func PtmMachineFSMBuild(p *StpPort) *PtmMachine

func (*PtmMachine) Apply

func (ptm *PtmMachine) Apply(r *fsm.Ruleset) *fsm.Machine

A helpful function that lets us apply arbitrary rulesets to this instances State machine without reallocating the machine.

func (*PtmMachine) GetCurrStateStr

func (m *PtmMachine) GetCurrStateStr() string

func (*PtmMachine) GetPrevStateStr

func (m *PtmMachine) GetPrevStateStr() string

func (*PtmMachine) PrevState

func (ptm *PtmMachine) PrevState() fsm.State

func (*PtmMachine) PrevStateSet

func (ptm *PtmMachine) PrevStateSet(s fsm.State)

PrevStateSet will set the previous State

func (*PtmMachine) PtmLogger

func (ptm *PtmMachine) PtmLogger(s string)

func (*PtmMachine) PtmMachineOneSecond

func (ptm *PtmMachine) PtmMachineOneSecond(m fsm.Machine, data interface{}) fsm.State

LacpPtxMachineNoPeriodic stops the periodic transmission of packets

func (*PtmMachine) PtmMachineTick

func (ptm *PtmMachine) PtmMachineTick(m fsm.Machine, data interface{}) fsm.State

LacpPtxMachineFastPeriodic sets the periodic transmission time to fast and starts the timer

func (*PtmMachine) Stop

func (ptm *PtmMachine) Stop()

Stop should clean up all resources

func (*PtmMachine) TickTimerDestroy

func (m *PtmMachine) TickTimerDestroy()

func (*PtmMachine) TickTimerStart

func (m *PtmMachine) TickTimerStart()

TickTimerStart: Port Timers Tick timer

func (*PtmMachine) TickTimerStop

func (m *PtmMachine) TickTimerStop()

TickTimerStop Stop the running timer

type PtxmMachine

type PtxmMachine struct {
	Machine *fsm.Machine

	// machine specific events
	PtxmEvents chan MachineEvent
	// enable logging
	PtxmLogEnableEvent chan bool
	// contains filtered or unexported fields
}

LacpRxMachine holds FSM and current State and event channels for State transitions

func NewStpPtxmMachine

func NewStpPtxmMachine(p *StpPort) *PtxmMachine

NewLacpRxMachine will create a new instance of the LacpRxMachine

func PtxmMachineFSMBuild

func PtxmMachineFSMBuild(p *StpPort) *PtxmMachine

func (*PtxmMachine) Apply

func (ptxm *PtxmMachine) Apply(r *fsm.Ruleset) *fsm.Machine

A helpful function that lets us apply arbitrary rulesets to this instances State machine without reallocating the machine.

func (*PtxmMachine) GetCurrStateStr

func (m *PtxmMachine) GetCurrStateStr() string

func (*PtxmMachine) GetPrevStateStr

func (m *PtxmMachine) GetPrevStateStr() string

func (*PtxmMachine) ProcessPostStateIdle

func (ptxm *PtxmMachine) ProcessPostStateIdle()

func (*PtxmMachine) ProcessPostStateProcessing

func (ptxm *PtxmMachine) ProcessPostStateProcessing()

func (*PtxmMachine) ProcessPostStateTransmitConfig

func (ptxm *PtxmMachine) ProcessPostStateTransmitConfig()

func (*PtxmMachine) ProcessPostStateTransmitInit

func (ptxm *PtxmMachine) ProcessPostStateTransmitInit()

func (*PtxmMachine) ProcessPostStateTransmitPeriodic

func (ptxm *PtxmMachine) ProcessPostStateTransmitPeriodic()

func (*PtxmMachine) ProcessPostStateTransmitRstp

func (ptxm *PtxmMachine) ProcessPostStateTransmitRstp()

func (*PtxmMachine) ProcessPostStateTransmitTcn

func (ptxm *PtxmMachine) ProcessPostStateTransmitTcn()

func (*PtxmMachine) PtxmLogger

func (ptxm *PtxmMachine) PtxmLogger(s string)

func (*PtxmMachine) PtxmMachineTransmitConfig

func (ptxm *PtxmMachine) PtxmMachineTransmitConfig(m fsm.Machine, data interface{}) fsm.State

func (*PtxmMachine) PtxmMachineTransmitIdle

func (ptxm *PtxmMachine) PtxmMachineTransmitIdle(m fsm.Machine, data interface{}) fsm.State

PtxmMachineTransmitIdle

func (*PtxmMachine) PtxmMachineTransmitInit

func (ptxm *PtxmMachine) PtxmMachineTransmitInit(m fsm.Machine, data interface{}) fsm.State

PtxmMachineTransmitInit

func (*PtxmMachine) PtxmMachineTransmitPeriodic

func (ptxm *PtxmMachine) PtxmMachineTransmitPeriodic(m fsm.Machine, data interface{}) fsm.State

PtxmMachineTransmitPeriodic

func (*PtxmMachine) PtxmMachineTransmitRSTP

func (ptxm *PtxmMachine) PtxmMachineTransmitRSTP(m fsm.Machine, data interface{}) fsm.State

func (*PtxmMachine) PtxmMachineTransmitTCN

func (ptxm *PtxmMachine) PtxmMachineTransmitTCN(m fsm.Machine, data interface{}) fsm.State

func (*PtxmMachine) Stop

func (ptxm *PtxmMachine) Stop()

Stop should clean up all resources

type RxBpduPdu

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

type StpBridgeConfig

type StpBridgeConfig struct {
	IfIndex      int32
	Address      string
	Priority     uint16
	MaxAge       uint16
	HelloTime    uint16
	ForwardDelay uint16
	ForceVersion int32
	TxHoldCount  int32
	Vlan         uint16
	DebugLevel   int
}

StpBridgeConfig config data

func StpBrgConfigGet

func StpBrgConfigGet(bId int32) *StpBridgeConfig

StpBrgConfigGet gets the current bridge config

type StpPort

type StpPort struct {
	IfIndex        int32
	ProtocolPortId uint16

	// 17.19
	AgeingTime                  int32 // TODO STP functionality
	Agree                       bool
	Agreed                      bool
	AdminEdge                   bool
	AutoEdgePort                bool // optional
	AdminPathCost               int32
	BpduGuard                   bool
	BpduGuardInterval           int32
	BridgeAssurance             bool
	BridgeAssuranceInconsistant bool
	Disputed                    bool
	FdbFlush                    bool
	Forward                     bool
	Forwarding                  bool
	InfoIs                      PortInfoState
	Learn                       bool
	Learning                    bool
	Mcheck                      bool
	MsgPriority                 PriorityVector
	MsgTimes                    Times
	NewInfo                     bool
	OperEdge                    bool
	PortEnabled                 bool
	PortId                      uint16
	PortPathCost                uint32
	PortPriority                PriorityVector
	PortTimes                   Times
	Priority                    uint16
	Proposed                    bool
	Proposing                   bool
	RcvdBPDU                    bool
	RcvdInfo                    PortDesignatedRcvInfo
	RcvdMsg                     bool
	RcvdRSTP                    bool
	RcvdSTP                     bool
	RcvdTc                      bool
	RcvdTcAck                   bool
	RcvdTcn                     bool
	RstpVersion                 bool
	ReRoot                      bool
	Reselect                    bool
	Role                        PortRole
	Selected                    bool
	SelectedRole                PortRole
	SendRSTP                    bool
	Sync                        bool
	Synced                      bool
	TcAck                       bool
	TcProp                      bool
	Tick                        bool
	TxCount                     uint64
	UpdtInfo                    bool
	// 6.4.3
	OperPointToPointMAC  bool
	AdminPointToPointMAC PointToPointMac

	// link operational state
	AdminPortEnabled bool

	// Associated Bridge Id
	BridgeId   BridgeId
	BrgIfIndex int32

	// statistics
	BpduRx  uint64
	BpduTx  uint64
	StpRx   uint64
	StpTx   uint64
	TcRx    uint64
	TcTx    uint64
	TcAckRx uint64
	TcAckTx uint64
	RstpRx  uint64
	RstpTx  uint64
	PvstRx  uint64
	PvstTx  uint64

	ForwardingTransitions uint64

	// 17.17
	EdgeDelayWhileTimer PortTimer
	FdWhileTimer        PortTimer
	HelloWhenTimer      PortTimer
	MdelayWhiletimer    PortTimer
	RbWhileTimer        PortTimer
	RcvdInfoWhiletimer  PortTimer
	RrWhileTimer        PortTimer
	TcWhileTimer        PortTimer
	BAWhileTimer        PortTimer
	BPDUGuardTimer      PortTimer

	PrxmMachineFsm *PrxmMachine
	PtmMachineFsm  *PtmMachine
	PpmmMachineFsm *PpmmMachine
	PtxmMachineFsm *PtxmMachine
	PimMachineFsm  *PimMachine
	BdmMachineFsm  *BdmMachine
	PrtMachineFsm  *PrtMachine
	TcMachineFsm   *TcMachine
	PstMachineFsm  *PstMachine

	// used to poll linux interface status.  Useful for SIM/TEST
	PollingRoutine bool
	PollingTimer   *time.Timer
	// contains filtered or unexported fields
}

func GetBrgPort

func GetBrgPort(pId int32, bId int32, packet gopacket.Packet) *StpPort

find proper bridge for the given port

func NewStpPort

func NewStpPort(c *StpPortConfig) *StpPort

func (*StpPort) BEGIN

func (p *StpPort) BEGIN(restart bool)

func (*StpPort) BdmMachineMain

func (p *StpPort) BdmMachineMain()

PimMachineMain:

func (*StpPort) BridgeProtocolVersionGet

func (p *StpPort) BridgeProtocolVersionGet() uint8

func (*StpPort) BuildRSTPEthernetLlcHeaders

func (p *StpPort) BuildRSTPEthernetLlcHeaders() (eth layers.Ethernet, llc layers.LLC)

func (*StpPort) CreateRxTx

func (p *StpPort) CreateRxTx()

func (*StpPort) DecrementTimerCounters

func (p *StpPort) DecrementTimerCounters()

func (*StpPort) DeleteRxTx

func (p *StpPort) DeleteRxTx()

func (*StpPort) DistributeMachineEvents

func (p *StpPort) DistributeMachineEvents(mec []chan MachineEvent, e []MachineEvent, waitForResponse bool)

DistributeMachineEvents will distribute the events in parrallel to each machine

func (*StpPort) EdgeDelay

func (p *StpPort) EdgeDelay() uint16

func (*StpPort) ForceVersionSet

func (p *StpPort) ForceVersionSet(src string, val int)

func (*StpPort) GetPortListToApplyConfigTo

func (p *StpPort) GetPortListToApplyConfigTo() (newlist []*StpPort)

This function can be used to know whether or not to apply configuration parameters to one port or all ports, as of 3/21/16 applying to all ports

func (*StpPort) IsAdminEdgePort

func (p *StpPort) IsAdminEdgePort() bool

check if any other bridge port is adminEdge

func (*StpPort) NotifyEdgeDelayWhileTimerExpired

func (p *StpPort) NotifyEdgeDelayWhileTimerExpired()

func (*StpPort) NotifyFdWhileTimerExpired

func (p *StpPort) NotifyFdWhileTimerExpired()

func (*StpPort) NotifyHelloWhenTimerExpired

func (p *StpPort) NotifyHelloWhenTimerExpired()

func (*StpPort) NotifyMdelayWhileTimerExpired

func (p *StpPort) NotifyMdelayWhileTimerExpired()

func (*StpPort) NotifyOperEdgeChanged

func (p *StpPort) NotifyOperEdgeChanged(src string, oldoperedge bool, newoperedge bool)

func (*StpPort) NotifyPortEnabled

func (p *StpPort) NotifyPortEnabled(src string, oldportenabled bool, newportenabled bool)

func (*StpPort) NotifyProposingChanged

func (p *StpPort) NotifyProposingChanged(src string, oldproposing bool, newproposing bool)

func (*StpPort) NotifyRbWhileTimerExpired

func (p *StpPort) NotifyRbWhileTimerExpired()

func (*StpPort) NotifyRcvdInfoWhileTimerExpired

func (p *StpPort) NotifyRcvdInfoWhileTimerExpired()

func (*StpPort) NotifyRcvdMsgChanged

func (p *StpPort) NotifyRcvdMsgChanged(src string, oldrcvdmsg bool, newrcvdmsg bool, data interface{})

func (*StpPort) NotifyRcvdTcRcvdTcnRcvdTcAck

func (p *StpPort) NotifyRcvdTcRcvdTcnRcvdTcAck(oldrcvdtc bool, oldrcvdtcn bool, oldrcvdtcack bool, newrcvdtc bool, newrcvdtcn bool, newrcvdtcack bool)

func (*StpPort) NotifyRrWhileTimerExpired

func (p *StpPort) NotifyRrWhileTimerExpired()

func (*StpPort) NotifySelectedChanged

func (p *StpPort) NotifySelectedChanged(src string, oldselected bool, newselected bool)

No need to when these parameters change as selected/updtInfo will be used as the trigger for update

func (p *StpPort) DesignatedPrioritySet(src string, val *PriorityVector) {
	// The following machines need to know about
	// changes in DesignatedPriority State
	// 1) Port Information
	// 2) Port Transmit
	p.DesignatedPriority = *val
}
func (p *StpPort) DesignatedTimesSet(src string, val *Times) {
	// The following machines need to know about
	// changes in DesignatedTimes State
	// 1) Port Information
	// 2) Port Transmit
	p.DesignatedTimes = *val
}

func (*StpPort) NotifySelectedRoleChanged

func (p *StpPort) NotifySelectedRoleChanged(src string, oldselectedrole PortRole, newselectedrole PortRole)

func (*StpPort) NotifySyncedChanged

func (p *StpPort) NotifySyncedChanged(src string, oldsynced bool, newsynced bool)

func (*StpPort) NotifyTcWhileTimerExpired

func (p *StpPort) NotifyTcWhileTimerExpired()

func (*StpPort) NotifyUpdtInfoChanged

func (p *StpPort) NotifyUpdtInfoChanged(src string, oldupdtinfo bool, newupdtinfo bool)

func (*StpPort) PimMachineMain

func (p *StpPort) PimMachineMain()

PimMachineMain:

func (*StpPort) PpmmMachineMain

func (p *StpPort) PpmmMachineMain()

PrxmMachineMain:

func (*StpPort) PrtMachineMain

func (p *StpPort) PrtMachineMain()

PimMachineMain:

func (*StpPort) PrxmMachineMain

func (p *StpPort) PrxmMachineMain()

PrxmMachineMain:

func (*StpPort) PstMachineMain

func (p *StpPort) PstMachineMain()

PstmMachineMain:

func (*StpPort) PtmMachineMain

func (p *StpPort) PtmMachineMain()

LacpRxMachineMain: 802.1ax-2014 Table 6-18 Creation of Rx State Machine State transitions and callbacks and create go routine to pend on events

func (*StpPort) PtxmMachineMain

func (p *StpPort) PtxmMachineMain()

PrxmMachineMain:

func (*StpPort) ResetTimerCounters

func (p *StpPort) ResetTimerCounters(counterType TimerType)

func (*StpPort) SaveMsgRcvInfo

func (p *StpPort) SaveMsgRcvInfo(data interface{})

func (*StpPort) SetRxPortCounters

func (p *StpPort) SetRxPortCounters(ptype BPDURxType)

func (*StpPort) SetTxPortCounters

func (p *StpPort) SetTxPortCounters(ptype BPDURxType)

func (*StpPort) Stop

func (p *StpPort) Stop()

func (*StpPort) TcMachineMain

func (p *StpPort) TcMachineMain()

PimMachineMain:

func (*StpPort) TxConfig

func (p *StpPort) TxConfig()

func (*StpPort) TxPVST

func (p *StpPort) TxPVST()

func (*StpPort) TxRSTP

func (p *StpPort) TxRSTP()

func (*StpPort) TxTCN

func (p *StpPort) TxTCN()

type StpPortConfig

type StpPortConfig struct {
	IfIndex           int32
	Priority          uint16
	Enable            bool
	PathCost          int32
	ProtocolMigration int32
	AdminPointToPoint int32
	AdminEdgePort     bool
	AdminPathCost     int32
	BrgIfIndex        int32
	BridgeAssurance   bool
	BpduGuard         bool
	BpduGuardInterval int32
}

StpPortConfig config data

func StpPortConfigGet

func StpPortConfigGet(pId int32) *StpPortConfig

StpPortConfigGet gets the current port config

type StpStateEvent

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

func (*StpStateEvent) CurrentEvent

func (se *StpStateEvent) CurrentEvent() fsm.Event

func (*StpStateEvent) CurrentState

func (se *StpStateEvent) CurrentState() fsm.State

func (*StpStateEvent) EnableLogging

func (se *StpStateEvent) EnableLogging(ena bool)

func (*StpStateEvent) IsLoggerEna

func (se *StpStateEvent) IsLoggerEna() bool

func (*StpStateEvent) LoggerSet

func (se *StpStateEvent) LoggerSet(log func(string))

func (*StpStateEvent) PreviousEvent

func (se *StpStateEvent) PreviousEvent() fsm.Event

func (*StpStateEvent) PreviousState

func (se *StpStateEvent) PreviousState() fsm.State

func (*StpStateEvent) SetEvent

func (se *StpStateEvent) SetEvent(es string, e fsm.Event)

func (*StpStateEvent) SetState

func (se *StpStateEvent) SetState(s fsm.State)

func (*StpStateEvent) StateStrMapSet

func (se *StpStateEvent) StateStrMapSet(strMap map[fsm.State]string)

type TcMachine

type TcMachine struct {
	Machine *fsm.Machine

	// machine specific events
	TcEvents chan MachineEvent
	// enable logging
	TcLogEnableEvent chan bool
	// contains filtered or unexported fields
}

TcMachine holds FSM and current State and event channels for State transitions

func NewStpTcMachine

func NewStpTcMachine(p *StpPort) *TcMachine

NewStpTcMachine will create a new instance of the LacpRxMachine

func TcMachineFSMBuild

func TcMachineFSMBuild(p *StpPort) *TcMachine

func (*TcMachine) Apply

func (tcm *TcMachine) Apply(r *fsm.Ruleset) *fsm.Machine

A helpful function that lets us apply arbitrary rulesets to this instances State machine without reallocating the machine.

func (*TcMachine) FlushFdb

func (tcm *TcMachine) FlushFdb()

17.19.7 A boolean. Set by the topology change state machine to instruct the filtering database to remove all entries for this Port, immediately if rstpVersion (17.20.11) is TRUE, or by rapid ageing (17.19.1) if stpVersion (17.20.12) is TRUE. Reset by the filtering database once the entries are removed if rstpVersion is TRUE, and immediately if stpVersion is TRUE.

func (*TcMachine) GetCurrStateStr

func (m *TcMachine) GetCurrStateStr() string

func (*TcMachine) GetPrevStateStr

func (m *TcMachine) GetPrevStateStr() string

func (*TcMachine) NotifyFdbFlush

func (tcm *TcMachine) NotifyFdbFlush()

func (*TcMachine) NotifyNewInfoChanged

func (tcm *TcMachine) NotifyNewInfoChanged(oldnewinfo bool, newnewinfo bool)

func (*TcMachine) NotifyTcAckChanged

func (tcm *TcMachine) NotifyTcAckChanged(val bool)

func (*TcMachine) NotifyTcPropChanged

func (tcm *TcMachine) NotifyTcPropChanged(oldtcprop bool, newtcprop bool)

func (*TcMachine) NotifyTcWhileChanged

func (tcm *TcMachine) NotifyTcWhileChanged(val int32)

func (*TcMachine) ProcessPostStateAcknowledged

func (tcm *TcMachine) ProcessPostStateAcknowledged()

func (*TcMachine) ProcessPostStateActive

func (tcm *TcMachine) ProcessPostStateActive()

func (*TcMachine) ProcessPostStateDetected

func (tcm *TcMachine) ProcessPostStateDetected()

func (*TcMachine) ProcessPostStateInactive

func (tcm *TcMachine) ProcessPostStateInactive()

func (*TcMachine) ProcessPostStateLearning

func (tcm *TcMachine) ProcessPostStateLearning()

func (*TcMachine) ProcessPostStateNotifiedTc

func (tcm *TcMachine) ProcessPostStateNotifiedTc()

func (*TcMachine) ProcessPostStateNotifiedTcn

func (tcm *TcMachine) ProcessPostStateNotifiedTcn()

func (*TcMachine) ProcessPostStateProcessing

func (tcm *TcMachine) ProcessPostStateProcessing()

ProcessPostStateProcessing: advance states after a given event for faster state transitions

func (*TcMachine) ProcessPostStatePropagating

func (tcm *TcMachine) ProcessPostStatePropagating()

func (*TcMachine) Stop

func (tcm *TcMachine) Stop()

Stop should clean up all resources

func (*TcMachine) TcMachineAcknowledged

func (tcm *TcMachine) TcMachineAcknowledged(m fsm.Machine, data interface{}) fsm.State

TcMachineAcknowledged

func (*TcMachine) TcMachineActive

func (tcm *TcMachine) TcMachineActive(m fsm.Machine, data interface{}) fsm.State

TcMachineActive

func (*TcMachine) TcMachineDetected

func (tcm *TcMachine) TcMachineDetected(m fsm.Machine, data interface{}) fsm.State

TcMachineDetected

func (*TcMachine) TcMachineInactive

func (tcm *TcMachine) TcMachineInactive(m fsm.Machine, data interface{}) fsm.State

TcmMachineInactive

func (*TcMachine) TcMachineLearning

func (tcm *TcMachine) TcMachineLearning(m fsm.Machine, data interface{}) fsm.State

TcMachineLearning

func (*TcMachine) TcMachineNotifiedTc

func (tcm *TcMachine) TcMachineNotifiedTc(m fsm.Machine, data interface{}) fsm.State

TcMachineNotifyTc

func (*TcMachine) TcMachineNotifiedTcn

func (tcm *TcMachine) TcMachineNotifiedTcn(m fsm.Machine, data interface{}) fsm.State

TcMachineNotifyTcn

func (*TcMachine) TcMachinePropagating

func (tcm *TcMachine) TcMachinePropagating(m fsm.Machine, data interface{}) fsm.State

TcMachinePropagating

func (*TcMachine) TcmLogger

func (tcm *TcMachine) TcmLogger(s string)

type TimerType

type TimerType int
const (
	TimerTypeEdgeDelayWhile TimerType = iota
	TimerTypeFdWhile
	TimerTypeHelloWhen
	TimerTypeMdelayWhile
	TimerTypeRbWhile
	TimerTypeRcvdInfoWhile
	TimerTypeRrWhile
	TimerTypeTcWhile
	TimerTypeBAWhile
)

type Times

type Times struct {
	ForwardingDelay uint16
	HelloTime       uint16
	MaxAge          uint16
	MessageAge      uint16
}

Jump to

Keyboard shortcuts

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