Tabnine Logo
EthType.toShort
Code IndexAdd Tabnine to your IDE (free)

How to use
toShort
method
in
org.onlab.packet.EthType

Best Java code snippets using org.onlab.packet.EthType.toShort (Showing top 20 results out of 315)

origin: org.onosproject/onos-core-common

  @Override
  public ObjectNode encodeCriterion(ObjectNode root, Criterion criterion) {
    final EthTypeCriterion ethTypeCriterion =
        (EthTypeCriterion) criterion;
    return root.put(CriterionCodec.ETH_TYPE, "0x"
        + Integer.toHexString(ethTypeCriterion.ethType().toShort() & 0xffff));
  }
}
origin: org.onosproject/onos-drivers

private boolean isSupportedEthTypeObjective(ForwardingObjective fwd) {
  TrafficSelector selector = fwd.selector();
  EthTypeCriterion ethType = (EthTypeCriterion) selector
      .getCriterion(Criterion.Type.ETH_TYPE);
  if ((ethType == null) ||
      ((ethType.ethType().toShort() != Ethernet.TYPE_IPV4) &&
          (ethType.ethType().toShort() != Ethernet.MPLS_UNICAST))) {
    return false;
  }
  return true;
}
origin: org.onosproject/onlab-misc

public static EtherType lookup(short etherType) {
  for (EtherType ethType : EtherType.values()) {
    if (ethType.ethType().toShort() == etherType) {
      return ethType;
    }
  }
  return UNKNOWN;
}
origin: org.onosproject/onos-drivers

private boolean isSupportedEthTypeObjective(ForwardingObjective fwd) {
  TrafficSelector selector = fwd.selector();
  EthTypeCriterion ethType = (EthTypeCriterion) selector
      .getCriterion(Criterion.Type.ETH_TYPE);
  return !((ethType == null) ||
      ((ethType.ethType().toShort() != Ethernet.TYPE_IPV4) &&
          (ethType.ethType().toShort() != Ethernet.MPLS_UNICAST)));
}
origin: org.onosproject/onlab-misc

/**
 * Looks up the ethertype by it's numerical representation
 * and returns it's textual format.
 *
 * @param etherType the short value of the ethertype
 * @return a textual representation
 */
public EtherType lookup(short etherType) {
  for (EtherType ethType : EtherType.values()) {
    if (ethType.ethType().toShort() == etherType) {
      return ethType;
    }
  }
  return null;
}
origin: org.onosproject/onos-core-net

  @Override
  public void init(Criterion criterion, int bitWidth) throws ByteSequenceTrimException {
    EthTypeCriterion c = (EthTypeCriterion) criterion;
    initAsExactMatch(copyFrom(c.ethType().toShort()), bitWidth);
  }
}
origin: org.onosproject/onos-core-common

      (L2ModificationInstruction.ModMplsHeaderInstruction) l2Instruction;
  result.put(InstructionCodec.ETHERNET_TYPE,
      pushHeaderInstructions.ethernetType().toShort());
  break;
case TUNNEL_ID:
      (L2ModificationInstruction.ModMplsHeaderInstruction) l2Instruction;
  result.put(InstructionCodec.ETHERNET_TYPE,
      toHexWithPrefix(popHeaderInstruction.ethernetType().toShort()));
  break;
case DEC_MPLS_TTL:
origin: org.onosproject/onos-drivers

if (ethType.ethType().toShort() == Ethernet.TYPE_ARP) {
  if (filters.isEmpty()) {
    pendingVersatiles.add(fwd);
origin: org.onosproject/onos-drivers

private Collection<FlowRule> processVersatile(ForwardingObjective forwardingObjective) {
  log.debug("Processing versatile forwarding objective");
  FlowRule.Builder ruleBuilder = DefaultFlowRule.builder()
      .forDevice(deviceId)
      .withSelector(forwardingObjective.selector())
      .withTreatment(forwardingObjective.treatment())
      .withPriority(forwardingObjective.priority())
      .fromApp(forwardingObjective.appId());
  if (forwardingObjective.permanent()) {
    ruleBuilder.makePermanent();
  } else {
    ruleBuilder.makeTemporary(TIME_OUT);
  }
  //ARP & DHCP Rule
  EthTypeCriterion ethCriterion =
      (EthTypeCriterion) forwardingObjective.selector().getCriterion(Criterion.Type.ETH_TYPE);
  UdpPortCriterion udpPortCriterion = (UdpPortCriterion) forwardingObjective
      .selector().getCriterion(Criterion.Type.UDP_DST);
  if (ethCriterion != null) {
    if (ethCriterion.ethType().toShort() == Ethernet.TYPE_ARP ||
        ethCriterion.ethType().toShort() == Ethernet.TYPE_LLDP) {
      ruleBuilder.forTable(VNI_TABLE);
      return Collections.singletonList(ruleBuilder.build());
    } else if (udpPortCriterion != null && udpPortCriterion.udpPort().toInt() == DHCP_SERVER_PORT) {
      ruleBuilder.forTable(VNI_TABLE);
      return Collections.singletonList(ruleBuilder.build());
    }
  }
  return Collections.emptySet();
}
origin: org.onosproject/onos-app-vtn-mgr

@Override
public void programArpClassifierRules(DeviceId deviceId, PortNumber inPort,
                   IpAddress dstIp,
                   SegmentationId actionVni,
                   Objective.Operation type) {
  TrafficSelector selector = DefaultTrafficSelector.builder()
      .matchInPort(inPort).matchEthType(ETH_TYPE.ethType().toShort())
      .matchArpTpa(Ip4Address.valueOf(dstIp.toString())).build();
  TrafficTreatment treatment = DefaultTrafficTreatment.builder()
      .setTunnelId(Long.parseLong(actionVni.segmentationId()))
      .build();
  ForwardingObjective.Builder objective = DefaultForwardingObjective
      .builder().withTreatment(treatment).withSelector(selector)
      .fromApp(appId).withFlag(Flag.SPECIFIC)
      .withPriority(ARP_CLASSIFIER_PRIORITY);
  if (type.equals(Objective.Operation.ADD)) {
    log.debug("ArpClassifierRules-->ADD");
    flowObjectiveService.forward(deviceId, objective.add());
  } else {
    log.debug("ArpClassifierRules-->REMOVE");
    flowObjectiveService.forward(deviceId, objective.remove());
  }
}
origin: org.onosproject/onos-app-routing

private ForwardingObjective.Builder createPeerObjBuilder(
    int nextId, IpPrefix ipAddresses) {
  TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
  sbuilder.matchEthType(EthType.EtherType.IPV4.ethType().toShort());
  sbuilder.matchIPDst(ipAddresses);
  DefaultForwardingObjective.Builder builder =
      DefaultForwardingObjective.builder()
      .withSelector(sbuilder.build())
      .fromApp(appId)
      .withPriority(getPriorityFromPrefix(ipAddresses))
      .withFlag(ForwardingObjective.Flag.SPECIFIC);
  if (nextId != -1) {
    builder.nextStep(nextId);
  }
  return builder;
}
origin: org.onosproject/onos-app-vtn-mgr

@Override
public void programArpClassifierRules(DeviceId deviceId, IpAddress dstIp,
                   SegmentationId actionVni,
                   Objective.Operation type) {
  TrafficSelector selector = DefaultTrafficSelector.builder()
      .matchEthType(ETH_TYPE.ethType().toShort())
      .matchArpTpa(Ip4Address.valueOf(dstIp.toString()))
      .build();
  TrafficTreatment treatment = DefaultTrafficTreatment.builder()
      .setTunnelId(Long.parseLong(actionVni.segmentationId()))
      .build();
  ForwardingObjective.Builder objective = DefaultForwardingObjective
      .builder().withTreatment(treatment).withSelector(selector)
      .fromApp(appId).withFlag(Flag.SPECIFIC)
      .withPriority(ARP_CLASSIFIER_PRIORITY);
  if (type.equals(Objective.Operation.ADD)) {
    log.debug("ArpClassifierRules-->ADD");
    flowObjectiveService.forward(deviceId, objective.add());
  } else {
    log.debug("ArpClassifierRules-->REMOVE");
    flowObjectiveService.forward(deviceId, objective.remove());
  }
}
origin: org.onosproject/onos-drivers

EthTypeCriterion ethType =
    (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE);
if (ethType == null || ethType.ethType().toShort() != Ethernet.TYPE_IPV4) {
  fail(fwd, ObjectiveError.UNSUPPORTED);
  return Collections.emptySet();
origin: org.onosproject/onos-drivers

    (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE);
if (ethType == null || ethType.ethType().toShort() != Ethernet.TYPE_IPV4) {
  fail(fwd, ObjectiveError.UNSUPPORTED);
  return Collections.emptySet();
origin: org.onosproject/onos-drivers

EthTypeCriterion ethType =
    (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE);
if (ethType == null || ethType.ethType().toShort() != Ethernet.TYPE_IPV4) {
  fail(fwd, ObjectiveError.UNSUPPORTED);
  return Collections.emptySet();
origin: org.onosproject/onos-app-routing

.matchEthType(EthType.EtherType.IPV4.ethType().toShort())
.matchVlanId(intf.vlan())
.matchIPProtocol((byte) OSPF_IP_PROTO)
origin: org.onosproject/onos-app-vtn-mgr

               MacAddress dstMac, Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
    .matchEthType(ARP_TYPE.ethType().toShort())
    .matchArpTpa(Ip4Address.valueOf(dstIP.toString()))
    .matchTunnelId(Long.parseLong(srcVni.segmentationId())).build();
origin: org.onosproject/onos-app-vtn-mgr

  @Override
  public void programExportPortArpClassifierRules(Port exportPort,
                          DeviceId deviceId,
                          Operation type) {
    TrafficSelector selector = DefaultTrafficSelector.builder()
        .matchEthType(EtherType.ARP.ethType().toShort())
        .matchInPort(exportPort.number()).build();
    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    treatment.add(Instructions.createOutput(PortNumber.CONTROLLER));
    ForwardingObjective.Builder objective = DefaultForwardingObjective
        .builder().withTreatment(treatment.build())
        .withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
        .withPriority(L3_CLASSIFIER_PRIORITY);
    if (type.equals(Objective.Operation.ADD)) {
      flowObjectiveService.forward(deviceId, objective.add());
    } else {
      flowObjectiveService.forward(deviceId, objective.remove());
    }
  }
}
origin: org.onosproject/onos-of-provider-group

      = (L2ModificationInstruction.PushHeaderInstructions) l2m;
  return factory.actions().pushVlan(
      EthType.of(pushVlanInstruction.ethernetType().toShort()));
case MPLS_PUSH:
  L2ModificationInstruction.PushHeaderInstructions pushHeaderInstructions =
      (L2ModificationInstruction.PushHeaderInstructions) l2m;
  return factory.actions().pushMpls(EthType.of(pushHeaderInstructions
                         .ethernetType().toShort()));
case MPLS_POP:
  L2ModificationInstruction.PushHeaderInstructions popHeaderInstructions =
      (L2ModificationInstruction.PushHeaderInstructions) l2m;
  return factory.actions().popMpls(EthType.of(popHeaderInstructions
                        .ethernetType().toShort()));
case MPLS_LABEL:
  L2ModificationInstruction.ModMplsLabelInstruction mplsLabel =
origin: org.onosproject/onos-of-provider-flow

      (PushHeaderInstructions) l2m;
  return factory().actions().pushMpls(EthType.of(pushHeaderInstructions
                          .ethernetType().toShort()));
case MPLS_POP:
  PushHeaderInstructions popHeaderInstructions =
      (PushHeaderInstructions) l2m;
  return factory().actions().popMpls(EthType.of(popHeaderInstructions
                         .ethernetType().toShort()));
case MPLS_LABEL:
  ModMplsLabelInstruction mplsLabel =
  PushHeaderInstructions pushVlanInstruction = (PushHeaderInstructions) l2m;
  return factory().actions().pushVlan(
      EthType.of(pushVlanInstruction.ethernetType().toShort()));
case TUNNEL_ID:
  ModTunnelIdInstruction tunnelId = (ModTunnelIdInstruction) l2m;
org.onlab.packetEthTypetoShort

Javadoc

Returns the short value for this ethtype.

Popular methods of EthType

  • <init>
    Builds the EthType.
  • toString
  • equals
  • lookup
    Looks up the ethertype by it's numerical representation and returns it's textual format.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setContentView (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • JFileChooser (javax.swing)
  • Top Vim plugins
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