use of org.opendaylight.mdsal.eos.binding.api.Entity in project netvirt by opendaylight.
the class Ipv6ServiceEosHandler method registerEosListener.
private void registerEosListener() {
listenerRegistration = entityOwnershipService.registerListener(EOS_ENTITY_OWNER, this);
Entity instanceEntity = new Entity(EOS_ENTITY_OWNER, EOS_ENTITY_OWNER);
try {
candidateRegistration = entityOwnershipService.registerCandidate(instanceEntity);
} catch (CandidateAlreadyRegisteredException e) {
LOG.warn("Instance entity {} was already registered", instanceEntity);
}
LOG.trace("Entity ownership registration successful");
}
use of org.opendaylight.mdsal.eos.binding.api.Entity in project netvirt by opendaylight.
the class QosEosHandler method registerQosAlertEosListener.
private void registerQosAlertEosListener() {
listenerRegistration = entityOwnershipService.registerListener(QosConstants.QOS_ALERT_OWNER_ENTITY_TYPE, this);
Entity instanceEntity = new Entity(QosConstants.QOS_ALERT_OWNER_ENTITY_TYPE, QosConstants.QOS_ALERT_OWNER_ENTITY_TYPE);
try {
candidateRegistration = entityOwnershipService.registerCandidate(instanceEntity);
} catch (CandidateAlreadyRegisteredException e) {
LOG.warn("qosalert instance entity {} was already " + "registered for ownership", instanceEntity);
}
LOG.trace("entity ownership registeration successful");
}
use of org.opendaylight.mdsal.eos.binding.api.Entity in project openflowplugin by opendaylight.
the class LLDPDiscoveryUtils method getCurrentOwnershipStatus.
private static java.util.Optional<EntityOwnershipState> getCurrentOwnershipStatus(final EntityOwnershipService eos, final String nodeId) {
Entity entity = createNodeEntity(nodeId);
Optional<EntityOwnershipState> ownershipStatus = eos.getOwnershipState(entity);
if (ownershipStatus.isPresent()) {
LOG.debug("Fetched ownership status for node {} is {}", nodeId, ownershipStatus.get());
return java.util.Optional.of(ownershipStatus.get());
}
return java.util.Optional.empty();
}
use of org.opendaylight.mdsal.eos.binding.api.Entity 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());
}
use of org.opendaylight.mdsal.eos.binding.api.Entity 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());
}
Aggregations