Search in sources :

Example 1 with VirtualFlowRule

use of org.onosproject.incubator.net.virtual.store.impl.primitives.VirtualFlowRule in project onos by opennetworkinglab.

the class DistributedVirtualFlowRuleStore method getFlowEntry.

@Override
public FlowEntry getFlowEntry(NetworkId networkId, FlowRule rule) {
    MastershipService mastershipService = vnaService.get(networkId, MastershipService.class);
    NodeId master = mastershipService.getMasterFor(rule.deviceId());
    if (master == null) {
        log.debug("Failed to getFlowEntry: No master for {}, vnet {}", rule.deviceId(), networkId);
        return null;
    }
    if (Objects.equals(local, master)) {
        return flowTable.getFlowEntry(networkId, rule);
    }
    log.trace("Forwarding getFlowEntry to {}, which is the primary (master) " + "for device {}, vnet {}", master, rule.deviceId(), networkId);
    VirtualFlowRule vRule = new VirtualFlowRule(networkId, rule);
    return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive(vRule, GET_FLOW_ENTRY, serializer::encode, serializer::decode, master), FLOW_RULE_STORE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS, null);
}
Also used : NodeId(org.onosproject.cluster.NodeId) MastershipService(org.onosproject.mastership.MastershipService) VirtualFlowRule(org.onosproject.incubator.net.virtual.store.impl.primitives.VirtualFlowRule)

Aggregations

NodeId (org.onosproject.cluster.NodeId)1 VirtualFlowRule (org.onosproject.incubator.net.virtual.store.impl.primitives.VirtualFlowRule)1 MastershipService (org.onosproject.mastership.MastershipService)1