Search in sources :

Example 1 with EntityOwnershipChange

use of org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange in project openflowplugin by opendaylight.

the class ContextChainHolderImplTest method ownershipChangedButHasOwner.

@Test
public void ownershipChangedButHasOwner() throws Exception {
    registration.close();
    contextChainHolder.createContextChain(connectionContext);
    contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_FLOW_REGISTRY_FILL);
    contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_GATHERING);
    contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.RPC_REGISTRATION);
    contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.MASTER_ON_DEVICE);
    contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_SUBMIT);
    EntityOwnershipChange ownershipChange = new EntityOwnershipChange(new Entity(ENTITY_TEST, OPENFLOW_TEST), EntityOwnershipChangeState.LOCAL_OWNERSHIP_LOST_NEW_OWNER);
    contextChainHolder.ownershipChanged(ownershipChange);
    Mockito.verify(deviceManager, Mockito.never()).removeDeviceFromOperationalDS(Mockito.any());
}
Also used : Entity(org.opendaylight.mdsal.eos.binding.api.Entity) EntityOwnershipChange(org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange) Test(org.junit.Test)

Example 2 with EntityOwnershipChange

use of org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange in project openflowplugin by opendaylight.

the class ContextChainHolderImplTest method ownershipChanged.

@Test
public void ownershipChanged() throws Exception {
    registration.close();
    contextChainHolder.createContextChain(connectionContext);
    contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_FLOW_REGISTRY_FILL);
    contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_GATHERING);
    contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.RPC_REGISTRATION);
    contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.MASTER_ON_DEVICE);
    contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_SUBMIT);
    EntityOwnershipChange ownershipChange = new EntityOwnershipChange(new Entity(ENTITY_TEST, OPENFLOW_TEST), EntityOwnershipChangeState.LOCAL_OWNERSHIP_LOST_NO_OWNER);
    contextChainHolder.ownershipChanged(ownershipChange);
    Mockito.verify(deviceManager).removeDeviceFromOperationalDS(Mockito.any());
}
Also used : Entity(org.opendaylight.mdsal.eos.binding.api.Entity) EntityOwnershipChange(org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Entity (org.opendaylight.mdsal.eos.binding.api.Entity)2 EntityOwnershipChange (org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange)2