Search in sources :

Example 6 with EntityOwnershipState

use of org.opendaylight.mdsal.eos.common.api.EntityOwnershipState in project openflowplugin by opendaylight.

the class LLDPDiscoveryUtils method isEntityOwned.

public static boolean isEntityOwned(final EntityOwnershipService eos, final String nodeId) {
    Preconditions.checkNotNull(eos, "Entity ownership service must not be null");
    EntityOwnershipState state = null;
    java.util.Optional<EntityOwnershipState> status = getCurrentOwnershipStatus(eos, nodeId);
    if (status.isPresent()) {
        state = status.get();
    } else {
        LOG.error("Fetching ownership status failed for node {}", nodeId);
    }
    return state != null && state.equals(EntityOwnershipState.IS_OWNER);
}
Also used : EntityOwnershipState(org.opendaylight.mdsal.eos.common.api.EntityOwnershipState)

Aggregations

EntityOwnershipState (org.opendaylight.mdsal.eos.common.api.EntityOwnershipState)6 Test (org.junit.Test)2 AbstractDataStore (org.opendaylight.controller.cluster.datastore.AbstractDataStore)1 MemberNode (org.opendaylight.controller.cluster.datastore.MemberNode)1 Shard (org.opendaylight.controller.cluster.datastore.Shard)1 ShardDataTree (org.opendaylight.controller.cluster.datastore.ShardDataTree)1 Entity (org.opendaylight.mdsal.eos.binding.api.Entity)1 DOMEntity (org.opendaylight.mdsal.eos.dom.api.DOMEntity)1 DOMEntityOwnershipCandidateRegistration (org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipCandidateRegistration)1 DOMEntityOwnershipChange (org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipChange)1 DOMEntityOwnershipService (org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService)1