Open Kilda Java Documentation
org.openkilda.wfm.isl.DiscoveryManager Class Reference

Classes

class  Plan
 

Public Member Functions

 DiscoveryManager (Map< SwitchId, Set< DiscoveryLink >> linksBySwitch, int islHealthCheckInterval, int islConsecutiveFailureLimit, int maxAttempts, Integer minutesKeepRemovedIsl)
 
Plan makeDiscoveryPlan ()
 
boolean handleDiscovered (SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort)
 
boolean handleFailed (SwitchId switchId, int portId)
 
void handleSentDiscoPacket (NetworkEndpoint endpoint)
 
void handleSwitchUp (SwitchId switchId)
 
void handleSwitchDown (SwitchId switchId)
 
void handlePortUp (SwitchId switchId, int portId)
 
DiscoveryLink registerPort (SwitchId switchId, int portId)
 
void handlePortDown (SwitchId switchId, int portId)
 
boolean isIslMoved (SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort)
 
NetworkEndpoint getLinkDestination (SwitchId srcSwitch, int srcPort)
 
void deactivateLinkFromEndpoint (NetworkEndpoint endpoint)
 
boolean isInDiscoveryPlan (SwitchId switchId, int portId)
 

Detailed Description

The DiscoveryManager holds the core logic for managing ISLs. This includes all of the business rules related to Switch Up/Down, Port Up/Down, failure counts and limits, etc. Comments on the business logic and rules are embedded in the rest of this class.

TODO: Refactor DiscoveryManager in the following ways: 1) Integrate any remaining business logic for storm code into this class so that the logic is concentrated in one place 2) The timers/counters are a little bit out of whack and should be cleaned up:

  • how frequently to emit is clear .. but could be better to base it on seconds, not ticks
  • when to send a Failure if it is an ISL and we are not getting a response - currently using islConsecutiveFailureLimit, but the name could be better
  • when to stop - using forlornLimit - but would like a better name and more clarity
  • there are a few other fields that may be worthwhile .. ie better, more advance policy mechanism for behavior around ISL 3) Ensure some separation between lifetime failure counts, current failure counts, and whether an ISL discovery packet should be sent. As an example, if we've stopped sending, and want to send discovery again, is there a clean way to do this?

Definition at line 59 of file DiscoveryManager.java.

Constructor & Destructor Documentation

◆ DiscoveryManager()

org.openkilda.wfm.isl.DiscoveryManager.DiscoveryManager ( Map< SwitchId, Set< DiscoveryLink >>  linksBySwitch,
int  islHealthCheckInterval,
int  islConsecutiveFailureLimit,
int  maxAttempts,
Integer  minutesKeepRemovedIsl 
)

Base constructor of discovery manager.

Parameters
linksBySwitch- links storage.
islHealthCheckInterval- how frequently (in ticks) to check.
islConsecutiveFailureLimit- the threshold for sending ISL down, if it is an ISL
maxAttempts- the limit for stopping all checks.

Definition at line 85 of file DiscoveryManager.java.

Member Function Documentation

◆ deactivateLinkFromEndpoint()

void org.openkilda.wfm.isl.DiscoveryManager.deactivateLinkFromEndpoint ( NetworkEndpoint  endpoint)

Deactivate link from switch/port and mark it as inactive. The link will be pulled from main discovery queue or from temporary storage where we store ISLs to be deleted.

Definition at line 443 of file DiscoveryManager.java.

◆ getLinkDestination()

NetworkEndpoint org.openkilda.wfm.isl.DiscoveryManager.getLinkDestination ( SwitchId  srcSwitch,
int  srcPort 
)

Returns the endpoint of the link.

Definition at line 427 of file DiscoveryManager.java.

◆ handleDiscovered()

boolean org.openkilda.wfm.isl.DiscoveryManager.handleDiscovered ( SwitchId  srcSwitch,
int  srcPort,
SwitchId  dstSwitch,
int  dstPort 
)

ISL Discovery Event.

Returns
true if this is a new event (ie first time discovered or prior failure).

Definition at line 181 of file DiscoveryManager.java.

◆ handleFailed()

boolean org.openkilda.wfm.isl.DiscoveryManager.handleFailed ( SwitchId  switchId,
int  portId 
)

ISL Failure Event.

Returns
true if this is new .. ie this isn't a consecutive failure.

Definition at line 224 of file DiscoveryManager.java.

◆ handlePortDown()

void org.openkilda.wfm.isl.DiscoveryManager.handlePortDown ( SwitchId  switchId,
int  portId 
)

Handle port down event.

Definition at line 338 of file DiscoveryManager.java.

◆ handlePortUp()

void org.openkilda.wfm.isl.DiscoveryManager.handlePortUp ( SwitchId  switchId,
int  portId 
)

Handle port up event.

Definition at line 296 of file DiscoveryManager.java.

◆ handleSentDiscoPacket()

void org.openkilda.wfm.isl.DiscoveryManager.handleSentDiscoPacket ( NetworkEndpoint  endpoint)

Processes response from speaker. Speaker notifies us that disco packet is sent as requested.

Parameters
endpointthe switch and the port from which disco packets is sent.

Definition at line 251 of file DiscoveryManager.java.

◆ handleSwitchDown()

void org.openkilda.wfm.isl.DiscoveryManager.handleSwitchDown ( SwitchId  switchId)

Handle deactivated switch.

Parameters
switchIdid of the switch.

Definition at line 288 of file DiscoveryManager.java.

◆ handleSwitchUp()

void org.openkilda.wfm.isl.DiscoveryManager.handleSwitchUp ( SwitchId  switchId)

Handle added/activated switch.

Parameters
switchIdid of the switch.

Definition at line 263 of file DiscoveryManager.java.

◆ isInDiscoveryPlan()

boolean org.openkilda.wfm.isl.DiscoveryManager.isInDiscoveryPlan ( SwitchId  switchId,
int  portId 
)

Checks if we are sending disco packets from specified endpoint.

Parameters
switchIdswitch datapath id.
portIdport number.
Returns
true if we already send disco packets, no need to add it one more time to discovery plan.

Definition at line 460 of file DiscoveryManager.java.

◆ isIslMoved()

boolean org.openkilda.wfm.isl.DiscoveryManager.isIslMoved ( SwitchId  srcSwitch,
int  srcPort,
SwitchId  dstSwitch,
int  dstPort 
)

Check whether destination of the ISL is changed (replugged to another port/switch).

Definition at line 411 of file DiscoveryManager.java.

◆ makeDiscoveryPlan()

Plan org.openkilda.wfm.isl.DiscoveryManager.makeDiscoveryPlan ( )

The discovery plan takes into consideration multiple metrics to determine what should be discovered.

At present, we want to send Discovery health checks on every ISL every x period. And, if the Discovery fails (either isn't an ISL or ISL is down) then we may want to give up checking.

General algorithm: 1) if the node is an ISL (isFoundIsl) .. and is UP .. keep checking 2) if the node is not an ISL (ie !isFoundIsl), then check less frequently 3) if the node is an ISL .. and is DOWN .. keep checking

Definition at line 108 of file DiscoveryManager.java.

◆ registerPort()

DiscoveryLink org.openkilda.wfm.isl.DiscoveryManager.registerPort ( SwitchId  switchId,
int  portId 
)

Register a switch port for the discovery process.

Parameters
switchIdthe port's switch.
portIdthe port number.
Returns
either a link of already registered port or a new one.

Definition at line 318 of file DiscoveryManager.java.


The documentation for this class was generated from the following file: