Class PhasedRecoveryManager
- java.lang.Object
-
- org.onosproject.segmentrouting.phasedrecovery.impl.PhasedRecoveryManager
-
- All Implemented Interfaces:
PhasedRecoveryService
public class PhasedRecoveryManager extends Object implements PhasedRecoveryService
-
-
Field Summary
-
Fields inherited from interface org.onosproject.segmentrouting.phasedrecovery.api.PhasedRecoveryService
EDGE_TIMEOUT, INFRA_TIMEOUT, PAIR_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description PhasedRecoveryManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactivate(org.osgi.service.component.ComponentContext context)Set<org.onosproject.net.PortNumber>changeAllPorts(org.onosproject.net.DeviceId deviceId, boolean enabled)Enables every ports on the given device.Set<org.onosproject.net.PortNumber>changeEdgePorts(org.onosproject.net.DeviceId deviceId, boolean enabled)Enables edge ports on the given device.Set<org.onosproject.net.PortNumber>changeInfraPorts(org.onosproject.net.DeviceId deviceId, boolean enabled)Enables infrastructure ports on the given device.Set<org.onosproject.net.PortNumber>changePairPort(org.onosproject.net.DeviceId deviceId, boolean enabled)Enables pair port on the given device.protected voiddeactivate()PhasegetPhase(org.onosproject.net.DeviceId deviceId)Gets recovery phase of given device.Map<org.onosproject.net.DeviceId,Phase>getPhases()Gets recovery phase of every devices.booleaninit(org.onosproject.net.DeviceId deviceId)Initializes a device.booleanisEnabled()Returns true if phased recovery is enabled.protected voidmodified(org.osgi.service.component.ComponentContext context)booleanreset(org.onosproject.net.DeviceId deviceId)Resets a device.PhasesetPhase(org.onosproject.net.DeviceId deviceId, Phase newPhase)Sets given device with given recovery phase.
-
-
-
Method Detail
-
activate
protected void activate(org.osgi.service.component.ComponentContext context)
-
deactivate
protected void deactivate()
-
modified
protected void modified(org.osgi.service.component.ComponentContext context)
-
isEnabled
public boolean isEnabled()
Description copied from interface:PhasedRecoveryServiceReturns true if phased recovery is enabled.- Specified by:
isEnabledin interfacePhasedRecoveryService- Returns:
- true if phased recovery is enabled.
-
init
public boolean init(org.onosproject.net.DeviceId deviceId)
Description copied from interface:PhasedRecoveryServiceInitializes a device. Only the instance leading the programming of the device is allowed to do this.- Specified by:
initin interfacePhasedRecoveryService- Parameters:
deviceId- device ID- Returns:
- true if the device is initialized successfully and the caller should proceed, false if the device initialization has failed and the caller should abort.
-
reset
public boolean reset(org.onosproject.net.DeviceId deviceId)
Description copied from interface:PhasedRecoveryServiceResets a device. Only the instance leading the programming of the device is allowed to do this.- Specified by:
resetin interfacePhasedRecoveryService- Parameters:
deviceId- device ID- Returns:
- true if the device is reset successfully. false if the device has not been previously initialized.
-
getPhases
public Map<org.onosproject.net.DeviceId,Phase> getPhases()
Description copied from interface:PhasedRecoveryServiceGets recovery phase of every devices.- Specified by:
getPhasesin interfacePhasedRecoveryService- Returns:
- a map between device ID and recovery phase
-
getPhase
public Phase getPhase(org.onosproject.net.DeviceId deviceId)
Description copied from interface:PhasedRecoveryServiceGets recovery phase of given device.- Specified by:
getPhasein interfacePhasedRecoveryService- Parameters:
deviceId- device ID- Returns:
- current phase or null if the device wasn't seen before
-
setPhase
public Phase setPhase(org.onosproject.net.DeviceId deviceId, Phase newPhase)
Description copied from interface:PhasedRecoveryServiceSets given device with given recovery phase. Only the instance leading the programming of the device is allowed to do this.- Specified by:
setPhasein interfacePhasedRecoveryService- Parameters:
deviceId- device IDnewPhase- recovery phase- Returns:
- new phase if transition succeeded, otherwise return current phase.
-
changeAllPorts
public Set<org.onosproject.net.PortNumber> changeAllPorts(org.onosproject.net.DeviceId deviceId, boolean enabled)
Description copied from interface:PhasedRecoveryServiceEnables every ports on the given device.- Specified by:
changeAllPortsin interfacePhasedRecoveryService- Parameters:
deviceId- device idenabled- true to enable, false to disable- Returns:
- ports that have been enabled
-
changePairPort
public Set<org.onosproject.net.PortNumber> changePairPort(org.onosproject.net.DeviceId deviceId, boolean enabled)
Description copied from interface:PhasedRecoveryServiceEnables pair port on the given device.- Specified by:
changePairPortin interfacePhasedRecoveryService- Parameters:
deviceId- device idenabled- true to enable, false to disable- Returns:
- ports that have been enabled
-
changeInfraPorts
public Set<org.onosproject.net.PortNumber> changeInfraPorts(org.onosproject.net.DeviceId deviceId, boolean enabled)
Description copied from interface:PhasedRecoveryServiceEnables infrastructure ports on the given device.- Specified by:
changeInfraPortsin interfacePhasedRecoveryService- Parameters:
deviceId- device idenabled- true to enable, false to disable- Returns:
- ports that have been enabled
-
changeEdgePorts
public Set<org.onosproject.net.PortNumber> changeEdgePorts(org.onosproject.net.DeviceId deviceId, boolean enabled)
Description copied from interface:PhasedRecoveryServiceEnables edge ports on the given device.- Specified by:
changeEdgePortsin interfacePhasedRecoveryService- Parameters:
deviceId- device idenabled- true to enable, false to disable- Returns:
- ports that have been enabled
-
-