use of org.onosproject.incubator.net.virtual.store.impl.primitives.VirtualFlowEntry in project onos by opennetworkinglab.
the class DistributedVirtualFlowRuleStore method removeFlowRule.
@Override
public FlowRuleEvent removeFlowRule(NetworkId networkId, FlowEntry rule) {
final DeviceId deviceId = rule.deviceId();
MastershipService mastershipService = vnaService.get(networkId, MastershipService.class);
NodeId master = mastershipService.getMasterFor(deviceId);
if (Objects.equals(local, master)) {
// bypass and handle it locally
return removeFlowRuleInternal(new VirtualFlowEntry(networkId, rule));
}
if (master == null) {
log.warn("Failed to removeFlowRule: No master for {}", deviceId);
// TODO: revisit if this should be null (="no-op") or Exception
return null;
}
log.trace("Forwarding removeFlowRule to {}, which is the master for device {}", master, deviceId);
return Futures.getUnchecked(clusterCommunicator.sendAndReceive(new VirtualFlowEntry(networkId, rule), REMOVE_FLOW_ENTRY, serializer::encode, serializer::decode, master));
}
use of org.onosproject.incubator.net.virtual.store.impl.primitives.VirtualFlowEntry in project onos by opennetworkinglab.
the class DistributedVirtualFlowRuleStore method removeFlowRuleInternal.
private FlowRuleEvent removeFlowRuleInternal(VirtualFlowEntry rule) {
final DeviceId deviceId = rule.flowEntry().deviceId();
// This is where one could mark a rule as removed and still keep it in the store.
final FlowEntry removed = flowTable.remove(rule.networkId(), deviceId, rule.flowEntry());
// rule may be partial rule that is missing treatment, we should use rule from store instead
return removed != null ? new FlowRuleEvent(RULE_REMOVED, removed) : null;
}
Aggregations