@Override public void forward(ForwardingObjective forwardingObjective) { Collection<FlowRule> rules; FlowRuleOperations.Builder flowOpsBuilder = FlowRuleOperations.builder();
synchronized void fail(DeviceId devId, Set<? extends FlowRule> failures) { hasFailed = true; pendingDevices.remove(devId); if (pendingDevices.isEmpty()) { operationsService.execute(this); } FlowRuleOperations.Builder failedOpsBuilder = FlowRuleOperations.builder(); failures.forEach(failedOpsBuilder::add); fops.callback().onError(failedOpsBuilder.build()); } }
FlowOperationsProcessor(FlowRuleOperations ops) { this.stages = Lists.newArrayList(ops.stages()); this.fops = ops; }
@Override public synchronized void run() { if (!stages.isEmpty()) { process(stages.remove(0)); } else if (!hasFailed) { fops.callback().onSuccess(fops); } }
@Override public void onSuccess(FlowRuleOperations ops) { log.info("Applied {} filtering rules in device {}", ops.stages().get(0).size(), deviceId); pass(filt); }
FlowRuleOperations.Builder flowOpsBuilder = FlowRuleOperations.builder();
@Override public void onSuccess(FlowRuleOperations ops) { log.info("Applied {} filtering rules in device {}", ops.stages().get(0).size(), deviceId); pass(filt); }
@Override public void forward(ForwardingObjective fwd) { Collection<FlowRule> rules; FlowRuleOperations.Builder flowOpsBuilder = FlowRuleOperations.builder();
@Override public void forward(ForwardingObjective fwd) { Collection<FlowRule> rules; FlowRuleOperations.Builder flowBuilder = FlowRuleOperations.builder();
@Override public void forward(ForwardingObjective fwd) { Collection<FlowRule> rules; FlowRuleOperations.Builder flowOpsBuilder = FlowRuleOperations.builder();
@Override public void forward(ForwardingObjective fwd) { Collection<FlowRule> rules; FlowRuleOperations.Builder flowBuilder = FlowRuleOperations.builder();
@Override public void forward(ForwardingObjective fwd) { Collection<FlowRule> rules; FlowRuleOperations.Builder flowBuilder = FlowRuleOperations.builder();
@Override public void applyFlowRules(FlowRule... flowRules) { checkPermission(FLOWRULE_WRITE); FlowRuleOperations.Builder builder = FlowRuleOperations.builder(); for (FlowRule flowRule : flowRules) { builder.add(flowRule); } apply(builder.build()); }
@Override public void removeFlowRules(FlowRule... flowRules) { checkPermission(FLOWRULE_WRITE); FlowRuleOperations.Builder builder = FlowRuleOperations.builder(); for (FlowRule flowRule : flowRules) { builder.remove(flowRule); } apply(builder.build()); }
private void applyRules(boolean install, FlowRule flowRule) { FlowRuleOperations.Builder flowOpsBuilder = FlowRuleOperations.builder(); flowOpsBuilder = install ? flowOpsBuilder.add(flowRule) : flowOpsBuilder.remove(flowRule); flowRuleService.apply(flowOpsBuilder.build(new FlowRuleOperationsContext() { @Override public void onSuccess(FlowRuleOperations ops) { log.debug("Provisioned vni or forwarding table"); } @Override public void onError(FlowRuleOperations ops) { log.debug("Failed to privision vni or forwarding table"); } })); }
private void applyRules(boolean install, FlowRule rule) { FlowRuleOperations.Builder ops = FlowRuleOperations.builder(); ops = install ? ops.add(rule) : ops.remove(rule); flowRuleService.apply(ops.build(new FlowRuleOperationsContext() { @Override public void onSuccess(FlowRuleOperations ops) { log.info("ONOSW provisioned " + rule.tableId() + " table"); } @Override public void onError(FlowRuleOperations ops) { log.info("ONOSW failed to provision " + rule.tableId() + " table"); } })); }
FlowRuleOperations.Builder firstStageOperationsBuilder = FlowRuleOperations.builder(); List<FlowRule> secondStageFlowRules = Lists.newArrayList(); FlowRuleOperations.Builder thirdStageOperationsBuilder = FlowRuleOperations.builder(); FlowRuleOperations.Builder finalStageOperationsBuilder = FlowRuleOperations.builder(); FlowRuleOperations operations = FlowRuleOperations.builder() .newStage() .remove(flowRule)
private void installObjective(FlowRule.Builder ruleBuilder, Objective objective) { FlowRuleOperations.Builder flowBuilder = FlowRuleOperations.builder(); switch (objective.op()) { case ADD: flowBuilder.add(ruleBuilder.build()); break; case REMOVE: flowBuilder.remove(ruleBuilder.build()); break; default: log.warn("Unknown operation {}", objective.op()); } flowRuleService.apply(flowBuilder.build(new FlowRuleOperationsContext() { @Override public void onSuccess(FlowRuleOperations ops) { objective.context().ifPresent(context -> context.onSuccess(objective)); } @Override public void onError(FlowRuleOperations ops) { objective.context() .ifPresent(context -> context.onError(objective, ObjectiveError.FLOWINSTALLATIONFAILED)); } })); }