Tabnine Logo
FlowObjectiveService
Code IndexAdd Tabnine to your IDE (free)

How to use
FlowObjectiveService
in
org.onosproject.net.flowobjective

Best Java code snippets using org.onosproject.net.flowobjective.FlowObjectiveService (Showing top 20 results out of 315)

origin: org.onosproject/onos-app-openstackswitching

private void setSecurityGroupRule(DeviceId id, OpenstackSecurityGroupRule sgRule,
                 Ip4Address vmIp, IpPrefix remoteIp) {
  ForwardingObjective.Builder foBuilder = buildFlowObjective(id, sgRule, vmIp, remoteIp);
  if (foBuilder != null) {
    flowObjectiveService.forward(id, foBuilder.add());
  }
}
origin: org.onosproject/onos-core-net

private List<Objective> createBroadcastObjective(ForwardingInstructions instructions,
                         Set<TrafficTreatment> treatmentsWithDifferentPort,
                         LinkCollectionIntent intent) {
  List<Objective> objectives = Lists.newArrayList();
  ForwardingObjective forwardingObjective;
  NextObjective nextObjective;
  Integer nextId = flowObjectiveService.allocateNextId();
  forwardingObjective = buildForwardingObjective(instructions.selector(),
                          nextId, intent.priority());
  DefaultNextObjective.Builder nxBuilder = DefaultNextObjective.builder();
  nxBuilder.withId(nextId)
      .withMeta(instructions.selector())
      .withType(NextObjective.Type.BROADCAST)
      .fromApp(appId)
      .withPriority(intent.priority())
      .makePermanent();
  treatmentsWithDifferentPort.forEach(nxBuilder::addTreatment);
  nextObjective = nxBuilder.add();
  objectives.add(forwardingObjective);
  objectives.add(nextObjective);
  return objectives;
}
origin: org.onosproject/onos-core-net

/**
 * Applies all contexts to flow objective service.
 */
public void apply() {
  if (pendingContexts.isEmpty()) {
    moveNextPendingToPending();
  }
  final Set<ObjectiveContext> contextsToApply = pendingContexts();
  contextsToApply.forEach(ctx -> {
    FlowObjectiveInstallationContext foiCtx =
        (FlowObjectiveInstallationContext) ctx;
    flowObjectiveService.apply(foiCtx.deviceId, foiCtx.objective);
  });
}
origin: org.onosproject/onos-app-routing

int nextId = flowObjectiveService.allocateNextId();
NextObjective.Builder nextBuilder = DefaultNextObjective.builder()
    .withId(nextId)
flowObjectiveService.next(deviceId, nextObjective);
  flowObjectiveService.forward(deviceId, fob);
origin: org.onosproject/onos-app-routing

int nextId = flowObjectiveService.allocateNextId();
NextObjective.Builder nextObjBuilder = DefaultNextObjective
    .builder().withId(nextId)
    nextId, deviceId, portNumber, vlanId);
if (install) {
   flowObjectiveService.next(deviceId, nextObjBuilder.add());
} else {
   flowObjectiveService.next(deviceId, nextObjBuilder.remove());
origin: org.onosproject/onos-app-routing

private void sendFilteringObjective(boolean install, FilteringObjective.Builder fob,
                  Interface intf) {
  ObjectiveContext context = new DefaultObjectiveContext(
      (objective) -> log.info("Installed filter for interface {}", intf),
      (objective, error) ->
          log.error("Failed to install filter for interface {}: {}", intf, error));
  FilteringObjective filter = install ? fob.add(context) : fob.remove(context);
  flowObjectiveService.filter(deviceId, filter);
}
origin: org.onosproject/onos-cli

@Override
protected void doExecute() {
  if (please == null || !please.equals(CONFIRM_PHRASE)) {
    print("WARNING: System may enter an unpredictable state if the flow obj queues are force emptied." +
        "Enter confirmation phrase to continue.");
    return;
  }
  try {
    FlowObjectiveService service = get(FlowObjectiveService.class);
    service.clearQueue();
  } catch (ServiceNotFoundException e) {
    print("FlowObjectiveService unavailable");
  }
}
origin: org.onosproject/onos-app-routing

private int createPeerGroup(MacAddress srcMac, MacAddress dstMac,
    VlanId vlanId, DeviceId deviceId, PortNumber port) {
  int nextId = flowObjectiveService.allocateNextId();
  NextObjective.Builder nextObjBuilder = DefaultNextObjective.builder()
      .withId(nextId)
      .withType(NextObjective.Type.SIMPLE)
      .fromApp(appId);
  TrafficTreatment.Builder ttBuilder = DefaultTrafficTreatment.builder();
  ttBuilder.setEthSrc(srcMac);
  ttBuilder.setEthDst(dstMac);
  ttBuilder.setOutput(port);
  nextObjBuilder.addTreatment(ttBuilder.build());
  TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder();
  VlanId matchVlanId = (vlanId.equals(VlanId.NONE)) ?
      VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN) :
      vlanId;
  metabuilder.matchVlanId(matchVlanId);
  nextObjBuilder.withMeta(metabuilder.build());
  flowObjectiveService.next(deviceId, nextObjBuilder.add());
  return nextId;
}
origin: org.onosproject/onos-app-openstackswitching

private void removeSecurityGroupRule(DeviceId id, OpenstackSecurityGroupRule sgRule,
                 Ip4Address vmIp, IpPrefix remoteIp) {
  ForwardingObjective.Builder foBuilder = buildFlowObjective(id, sgRule, vmIp, remoteIp);
  if (foBuilder != null) {
    flowObjectiveService.forward(id, foBuilder.remove());
  }
}
origin: org.onosproject/onos-core-net

private List<Objective> createSimpleNextObjective(ForwardingInstructions instructions,
                         LinkCollectionIntent intent) {
  List<Objective> objectives = Lists.newArrayList();
  ForwardingObjective forwardingObjective;
  NextObjective nextObjective;
  Integer nextId = flowObjectiveService.allocateNextId();
  forwardingObjective = buildForwardingObjective(instructions.selector(),
                          nextId, intent.priority());
  DefaultNextObjective.Builder nxBuilder = DefaultNextObjective.builder();
  nextObjective = nxBuilder.withId(nextId)
      .withMeta(instructions.selector())
      .addTreatment(instructions.treatment())
      .withType(NextObjective.Type.SIMPLE)
      .fromApp(appId)
      .makePermanent()
      .withPriority(intent.priority())
      .add();
  objectives.add(forwardingObjective);
  objectives.add(nextObjective);
  return objectives;
}
origin: org.onosproject/onos-core-net

    ctx.setObjective(newObj, ctx.deviceId);
    ctx.increaseRetryValue();
    flowObjectiveService.apply(ctx.deviceId, ctx.objective);
  } else {
    pendingContexts.remove(ctx);
  flowObjectiveService.apply(ctx.deviceId, ctx.objective);
  break;
case GROUPMISSING:
    ctx.setObjective(newObj, ctx.deviceId);
    ctx.increaseRetryValue();
    flowObjectiveService.apply(ctx.deviceId, ctx.objective);
  } else if (ctx.objective.op() == Objective.Operation.REMOVE ||
      ctx.objective.op() == Objective.Operation.REMOVE_FROM_EXISTING) {
    flowObjectiveService.apply(ctx.deviceId, ctx.objective);
  flowObjectiveService.apply(ctx.deviceId, ctx.objective);
  break;
default:
origin: org.onosproject/onos-app-routing

private synchronized void deleteRoute(ResolvedRoute route) {
  //Integer nextId = nextHops.get(route.nextHop());
  /* Group group = deleteNextHop(route.prefix());
  if (group == null) {
    log.warn("Group not found when deleting {}", route);
    return;
  }*/
  flowObjectiveService.forward(deviceId,
      generateRibForwardingObj(route.prefix(), null).remove());
}
origin: org.onosproject/onos-core-net

.withId(flowObjectiveService.allocateNextId())
.addTreatment(treatment)
.withType(NextObjective.Type.SIMPLE)
origin: org.onosproject/onos-core-net

  flowObjectiveService.apply(nextContext.deviceId,
                nextContext.objective);
  intentInstallationContext.removePendingContext(this);
contextsToApply.forEach(ctx -> {
  FlowObjectiveInstallationContext foiCtx = (FlowObjectiveInstallationContext) ctx;
  flowObjectiveService.apply(foiCtx.deviceId,
                foiCtx.objective);
});
origin: org.onosproject/onos-app-routing

private void updateRoute(ResolvedRoute route) {
  addNextHop(route);
  Integer nextId;
  synchronized (this) {
    nextId = nextHops.get(route.nextHop());
  }
  flowObjectiveService.forward(deviceId,
      generateRibForwardingObj(route.prefix(), nextId).add());
  log.trace("Sending forwarding objective {} -> nextId:{}", route, nextId);
}
origin: org.onosproject/onos-app-routing

  flowObjectiveService.forward(peer.location().deviceId(),
      createPeerObjBuilder(toRouterL3Unicast, routerIp.ipAddress().toIpPrefix()).remove());
});
  flowObjectiveService.forward(peer.location().deviceId(),
      createPeerObjBuilder(toPeerL3Unicast, peerIp.toIpPrefix()).remove());
});
origin: org.onosproject/onos-app-sfc-mgr

/**
 * Send service-function-forwarder to OVS.
 *
 * @param selector traffic selector
 * @param treatment traffic treatment
 * @param deviceId device id
 * @param type operation type
 * @param priority priority of classifier
 */
public void sendSfcRule(TrafficSelector.Builder selector, TrafficTreatment.Builder treatment, DeviceId deviceId,
    Objective.Operation type, int priority) {
  log.info("Sending sfc flow rule. Selector {}, Treatment {}", selector.toString(),
       treatment.toString());
  ForwardingObjective.Builder objective = DefaultForwardingObjective.builder().withTreatment(treatment.build())
      .withSelector(selector.build()).fromApp(appId).makePermanent().withFlag(Flag.VERSATILE)
      .withPriority(priority);
  if (type.equals(Objective.Operation.ADD)) {
    log.debug("flowClassifierRules-->ADD");
    flowObjectiveService.forward(deviceId, objective.add());
  } else {
    log.debug("flowClassifierRules-->REMOVE");
    flowObjectiveService.forward(deviceId, objective.remove());
  }
}
origin: org.onosproject/onos-app-vtn-mgr

  @Override
  public void removeSnatRules(DeviceId deviceId, TrafficSelector selector,
                TrafficTreatment treatment, int priority,
                Objective.Operation type) {
    ForwardingObjective.Builder objective = DefaultForwardingObjective
        .builder().withTreatment(treatment).withSelector(selector)
        .fromApp(appId).withFlag(Flag.SPECIFIC).withPriority(priority);
    if (type.equals(Objective.Operation.ADD)) {
      flowObjectiveService.forward(deviceId, objective.add());
    } else {
      flowObjectiveService.forward(deviceId, objective.remove());
    }
  }
}
origin: org.onosproject/onos-app-bgp-flowmgr

  /**
   * Send bgp flow forwarder to bgp provider.
   *
   * @param selector traffic selector
   * @param treatment traffic treatment
   * @param deviceId device id
   * @param type operation type
   */
  public void sendBgpFlowRuleForwarder(TrafficSelector.Builder selector, TrafficTreatment.Builder treatment,
      DeviceId deviceId, Objective.Operation type) {
    ForwardingObjective.Builder objective = DefaultForwardingObjective.builder().withTreatment(treatment.build())
        .withSelector(selector.build()).fromApp(appId).makePermanent().withFlag(Flag.VERSATILE);
    if (type.equals(Objective.Operation.ADD)) {
      log.debug("ADD");
      flowObjectiveService.forward(deviceId, objective.add());
    } else {
      log.debug("REMOVE");
      flowObjectiveService.forward(deviceId, objective.remove());
    }
  }
}
origin: org.onosproject/onos-core-net

/**
 * Removes packet intercept flow rules from the device.
 *
 * @param device  the device to remove the rules deom
 * @param request the packet request
 */
private void removeRule(Device device, PacketRequest request) {
  if (!device.type().equals(Device.Type.SWITCH)) {
    return;
  }
  ForwardingObjective forwarding = createBuilder(request)
      .remove(new ObjectiveContext() {
        @Override
        public void onError(Objective objective, ObjectiveError error) {
          log.warn("Failed to withdraw packet request {} from {}: {}",
               request, device.id(), error);
        }
      });
  objectiveService.forward(device.id(), forwarding);
}
org.onosproject.net.flowobjectiveFlowObjectiveService

Most used methods

  • forward
  • allocateNextId
  • apply
  • clearQueue
  • filter
  • getFilteringObjQueue
  • getFilteringObjQueueHead
  • getForwardingObjQueue
  • getForwardingObjQueueHead
  • getNextMappings
  • getNextObjQueue
  • getNextObjQueueHead
  • getNextObjQueue,
  • getNextObjQueueHead,
  • getPendingFlowObjectives,
  • initPolicy,
  • next

Popular in Java

  • Making http post requests using okhttp
  • getExternalFilesDir (Context)
  • getSystemService (Context)
  • startActivity (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now