Class ContextChainHolderImpl
- java.lang.Object
-
- org.opendaylight.openflowplugin.impl.lifecycle.ContextChainHolderImpl
-
- All Implemented Interfaces:
AutoCloseable
,org.opendaylight.mdsal.eos.binding.api.EntityOwnershipListener
,org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipListener<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?>,org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange>
,DeviceConnectedHandler
,DeviceDisconnectedHandler
,DeviceRemovedHandler
,ContextChainHolder
,ContextChainMastershipWatcher
,MasterChecker
public class ContextChainHolderImpl extends Object implements ContextChainHolder, MasterChecker
-
-
Constructor Summary
Constructors Constructor Description ContextChainHolderImpl(Executor executor, org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider singletonServiceProvider, org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService entityOwnershipService, OwnershipChangeListener ownershipChangeListener, OpenflowProviderConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends OFPManager>
voidaddManager(T manager)
Managers need to be added before.void
close()
ConnectionStatus
deviceConnected(ConnectionContext connectionContext)
Method is used to propagate information about established connection with device.ContextChain
getContextChain(DeviceInfo deviceInfo)
Return theContextChain
for a givenDeviceInfo
.boolean
isAnyDeviceMastered()
Check if any device is mastered by controller.List<DeviceInfo>
listOfMasteredDevices()
Mastered devices.void
onDeviceDisconnected(ConnectionContext connectionContext)
Method is used to propagate information about closed connection with device.void
onDeviceRemoved(DeviceInfo deviceInfo)
Method is used to propagate information about device being removed from manager.void
onMasterRoleAcquired(DeviceInfo deviceInfo, ContextChainMastershipState mastershipState)
Changed to MASTER role on device.void
onNotAbleToStartMastership(DeviceInfo deviceInfo, String reason, boolean mandatory)
Event occurs if there was a try to acquire MASTER role.void
onSlaveRoleAcquired(DeviceInfo deviceInfo)
Change to SLAVE role on device was successful.void
onSlaveRoleNotAcquired(DeviceInfo deviceInfo, String reason)
Change to SLAVE role on device was not able.void
ownershipChanged(org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange entityOwnershipChange)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opendaylight.openflowplugin.api.openflow.lifecycle.ContextChainMastershipWatcher
onNotAbleToStartMastershipMandatory
-
-
-
-
Constructor Detail
-
ContextChainHolderImpl
public ContextChainHolderImpl(Executor executor, org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider singletonServiceProvider, org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService entityOwnershipService, OwnershipChangeListener ownershipChangeListener, OpenflowProviderConfig config)
-
-
Method Detail
-
addManager
public <T extends OFPManager> void addManager(T manager)
Description copied from interface:ContextChainHolder
- Specified by:
addManager
in interfaceContextChainHolder
- Type Parameters:
T
-OFPManager
- Parameters:
manager
- a child class ofOFPManager
-
deviceConnected
public ConnectionStatus deviceConnected(ConnectionContext connectionContext)
Description copied from interface:DeviceConnectedHandler
Method is used to propagate information about established connection with device. It propagates connected device's connection context.- Specified by:
deviceConnected
in interfaceDeviceConnectedHandler
-
onNotAbleToStartMastership
public void onNotAbleToStartMastership(DeviceInfo deviceInfo, String reason, boolean mandatory)
Description copied from interface:ContextChainMastershipWatcher
Event occurs if there was a try to acquire MASTER role. But it was not possible to start this MASTER role on device.- Specified by:
onNotAbleToStartMastership
in interfaceContextChainMastershipWatcher
- Parameters:
deviceInfo
- connected switch identificationreason
- reasonmandatory
- if it is mandatory connection will be dropped
-
onMasterRoleAcquired
public void onMasterRoleAcquired(DeviceInfo deviceInfo, ContextChainMastershipState mastershipState)
Description copied from interface:ContextChainMastershipWatcher
Changed to MASTER role on device.- Specified by:
onMasterRoleAcquired
in interfaceContextChainMastershipWatcher
- Parameters:
deviceInfo
- connected switch identificationmastershipState
- state
-
onSlaveRoleAcquired
public void onSlaveRoleAcquired(DeviceInfo deviceInfo)
Description copied from interface:ContextChainMastershipWatcher
Change to SLAVE role on device was successful.- Specified by:
onSlaveRoleAcquired
in interfaceContextChainMastershipWatcher
- Parameters:
deviceInfo
- connected switch identification
-
onSlaveRoleNotAcquired
public void onSlaveRoleNotAcquired(DeviceInfo deviceInfo, String reason)
Description copied from interface:ContextChainMastershipWatcher
Change to SLAVE role on device was not able.- Specified by:
onSlaveRoleNotAcquired
in interfaceContextChainMastershipWatcher
- Parameters:
deviceInfo
- connected switch identificationreason
- reason
-
onDeviceDisconnected
public void onDeviceDisconnected(ConnectionContext connectionContext)
Description copied from interface:DeviceDisconnectedHandler
Method is used to propagate information about closed connection with device. It propagates connected device's connection context.- Specified by:
onDeviceDisconnected
in interfaceDeviceDisconnectedHandler
-
getContextChain
public ContextChain getContextChain(DeviceInfo deviceInfo)
Description copied from interface:ContextChainHolder
Return theContextChain
for a givenDeviceInfo
.- Specified by:
getContextChain
in interfaceContextChainHolder
- Returns:
ContextChain
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceContextChainHolder
-
ownershipChanged
public void ownershipChanged(org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange entityOwnershipChange)
- Specified by:
ownershipChanged
in interfaceorg.opendaylight.mdsal.eos.binding.api.EntityOwnershipListener
- Specified by:
ownershipChanged
in interfaceorg.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipListener<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?>,org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange>
-
listOfMasteredDevices
public List<DeviceInfo> listOfMasteredDevices()
Description copied from interface:MasterChecker
Mastered devices.- Specified by:
listOfMasteredDevices
in interfaceMasterChecker
- Returns:
- list of mastered devices
-
isAnyDeviceMastered
public boolean isAnyDeviceMastered()
Description copied from interface:MasterChecker
Check if any device is mastered by controller.- Specified by:
isAnyDeviceMastered
in interfaceMasterChecker
- Returns:
- true if there is at least one device mastered by controller
-
onDeviceRemoved
public void onDeviceRemoved(DeviceInfo deviceInfo)
Description copied from interface:DeviceRemovedHandler
Method is used to propagate information about device being removed from manager.- Specified by:
onDeviceRemoved
in interfaceDeviceRemovedHandler
-
-