use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createAppyActionInstruction48.
private static InstructionsBuilder createAppyActionInstruction48() {
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
// Tunnel
final TunnelBuilder tunnel = new TunnelBuilder();
tunnel.setTunnelId(BigInteger.valueOf(10668));
setFieldBuilder.setTunnel(tunnel.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
ab.setKey(new ActionKey(0));
actionList.add(ab.build());
final ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
final InstructionBuilder ib = new InstructionBuilder();
ib.setKey(new InstructionKey(0));
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
// Put our Instruction in a list of Instructions
final InstructionsBuilder isb = new InstructionsBuilder();
final List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel in project openflowplugin by opendaylight.
the class MatchDeserializerInjector method injectDeserializers.
/**
* Injects deserializers into provided
* {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}.
*
* @param provider OpenflowJava deserializer extension provider
*/
static void injectDeserializers(final DeserializerExtensionProvider provider) {
for (MatchPath path : MatchPath.values()) {
final MatchDeserializer deserializer = new MatchDeserializer(path);
provider.registerDeserializer(new MessageCodeMatchKey(EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_LENGTH, Match.class, path), deserializer);
// Inject new match entry serializers here using injector created by createInjector method
final Function<Integer, Function<Long, Function<Integer, Consumer<MatchEntryDeserializer>>>> injector = createInjector(deserializer, EncodeConstants.OF13_VERSION_ID);
// Wrapped injector that uses OPENFLOW_BASIC_CLASS
final Function<Integer, Consumer<MatchEntryDeserializer>> basicInjector = injector.apply(OxmMatchConstants.OPENFLOW_BASIC_CLASS).apply(null);
// Wrapped injector that uses EXPERIMENTER_CLASS
final Function<Long, Function<Integer, Consumer<MatchEntryDeserializer>>> experInjector = injector.apply(OxmMatchConstants.EXPERIMENTER_CLASS);
basicInjector.apply(OxmMatchConstants.ARP_OP).accept(new ArpOpEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ARP_SHA).accept(new ArpSourceHardwareAddressEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ARP_THA).accept(new ArpTargetHardwareAddressEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ARP_SPA).accept(new ArpSourceTransportAddressEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ARP_TPA).accept(new ArpTargetTransportAddressEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IN_PORT).accept(new InPortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IN_PHY_PORT).accept(new InPhyPortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.METADATA).accept(new MetadataEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ETH_DST).accept(new EthernetDestinationEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ETH_SRC).accept(new EthernetSourceEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ETH_TYPE).accept(new EthernetTypeEntryDeserializer());
basicInjector.apply(OxmMatchConstants.VLAN_PCP).accept(new VlanPcpEntryDeserializer());
basicInjector.apply(OxmMatchConstants.VLAN_VID).accept(new VlanVidEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IP_DSCP).accept(new IpDscpEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IP_ECN).accept(new IpEcnEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IP_PROTO).accept(new IpProtoEntryDeserializer());
basicInjector.apply(OxmMatchConstants.TCP_SRC).accept(new TcpSourcePortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.TCP_DST).accept(new TcpDestinationPortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.UDP_SRC).accept(new UdpSourcePortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.UDP_DST).accept(new UdpDestinationPortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.SCTP_SRC).accept(new SctpSourcePortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.SCTP_DST).accept(new SctpDestinationPortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ICMPV4_CODE).accept(new Icmpv4CodeEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ICMPV4_TYPE).accept(new Icmpv4TypeEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ICMPV6_CODE).accept(new Icmpv6CodeEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ICMPV6_TYPE).accept(new Icmpv6TypeEntryDeserializer());
// TODO: How to differentiate between Ipv4 and Tunnel when both are serialized to same format?
basicInjector.apply(OxmMatchConstants.IPV4_SRC).accept(new Ipv4SourceEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV4_DST).accept(new Ipv4DestinationEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_SRC).accept(new Ipv6SourceEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_DST).accept(new Ipv6DestinationEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_EXTHDR).accept(new Ipv6ExtHeaderEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_FLABEL).accept(new Ipv6FlabelEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_ND_SLL).accept(new Ipv6NdSllEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_ND_TLL).accept(new Ipv6NdTllEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_ND_TARGET).accept(new Ipv6NdTargetEntryDeserializer());
basicInjector.apply(OxmMatchConstants.MPLS_LABEL).accept(new MplsLabelEntryDeserializer());
basicInjector.apply(OxmMatchConstants.MPLS_BOS).accept(new MplsBosEntryDeserializer());
basicInjector.apply(OxmMatchConstants.MPLS_TC).accept(new MplsTcEntryDeserializer());
basicInjector.apply(OxmMatchConstants.PBB_ISID).accept(new PbbEntryDeserializer());
basicInjector.apply(OxmMatchConstants.TUNNEL_ID).accept(new TunnelIdEntryDeserializer());
experInjector.apply(EncodeConstants.ONF_EXPERIMENTER_ID).apply(EncodeConstants.ONFOXM_ET_TCP_FLAGS).accept(new TcpFlagsEntryDeserializer());
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel in project openflowplugin by opendaylight.
the class MultipartMatchFieldSerializerInjector method injectSerializers.
/**
* Injects multipart match field serializers into provided
* {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
*
* @param provider OpenflowJava serializer extension provider
*/
static void injectSerializers(final SerializerExtensionProvider provider) {
// Inject new message serializers here using injector created by createInjector method
final Function<Class<? extends MatchField>, Consumer<OFSerializer<SetFieldMatch>>> injector = createInjector(provider, EncodeConstants.OF13_VERSION_ID);
injector.apply(ArpOp.class).accept(new ArpOpMatchFieldSerializer());
injector.apply(ArpSha.class).accept(new ArpShaMatchFieldSerializer());
injector.apply(ArpSpa.class).accept(new ArpSpaMatchFieldSerializer());
injector.apply(ArpTha.class).accept(new ArpThaMatchFieldSerializer());
injector.apply(ArpTpa.class).accept(new ArpTpaMatchFieldSerializer());
injector.apply(EthDst.class).accept(new EthDstMatchFieldSerializer());
injector.apply(EthSrc.class).accept(new EthSrcMatchFieldSerializer());
injector.apply(EthType.class).accept(new EthTypeMatchFieldSerializer());
injector.apply(Icmpv4Code.class).accept(new Icmpv4CodeMatchFieldSerializer());
injector.apply(Icmpv4Type.class).accept(new Icmpv4TypeMatchFieldSerializer());
injector.apply(Icmpv6Code.class).accept(new Icmpv6CodeMatchFieldSerializer());
injector.apply(Icmpv6Type.class).accept(new Icmpv6TypeMatchFieldSerializer());
injector.apply(InPhyPort.class).accept(new InPhyPortMatchFieldSerializer());
injector.apply(InPort.class).accept(new InPortMatchFieldSerializer());
injector.apply(IpDscp.class).accept(new IpDscpMatchFieldSerializer());
injector.apply(IpEcn.class).accept(new IpEcnMatchFieldSerializer());
injector.apply(IpProto.class).accept(new IpProtoMatchFieldSerializer());
injector.apply(Ipv4Dst.class).accept(new Ipv4DstMatchFieldSerializer());
injector.apply(Ipv4Src.class).accept(new Ipv4SrcMatchFieldSerializer());
injector.apply(Ipv6Dst.class).accept(new Ipv6DstMatchFieldSerializer());
injector.apply(Ipv6Exthdr.class).accept(new Ipv6ExtHdrMatchFieldSerializer());
injector.apply(Ipv6Flabel.class).accept(new Ipv6FlabelMatchFieldSerializer());
injector.apply(Ipv6NdSll.class).accept(new Ipv6NdSllMatchFieldSerializer());
injector.apply(Ipv6NdTarget.class).accept(new Ipv6NdTargetMatchFieldSerializer());
injector.apply(Ipv6NdTll.class).accept(new Ipv6NdTllMatchFieldSerializer());
injector.apply(Ipv6Src.class).accept(new Ipv6SrcMatchFieldSerializer());
injector.apply(Metadata.class).accept(new MetadataMatchFieldSerializer());
injector.apply(MplsBos.class).accept(new MplsBosMatchFieldSerializer());
injector.apply(MplsLabel.class).accept(new MplsLabelMatchFieldSerializer());
injector.apply(MplsTc.class).accept(new MplsTcMatchFieldSerializer());
injector.apply(PbbIsid.class).accept(new PbbIsidMatchFieldSerializer());
injector.apply(SctpDst.class).accept(new SctpDstMatchFieldSerializer());
injector.apply(SctpSrc.class).accept(new SctpSrcMatchFieldSerializer());
injector.apply(TcpDst.class).accept(new TcpDstMatchFieldSerializer());
injector.apply(TcpFlags.class).accept(new TcpFlagsMatchFieldSerializer());
injector.apply(TcpSrc.class).accept(new TcpSrcMatchFieldSerializer());
injector.apply(TunnelId.class).accept(new TunnelIdMatchFieldSerializer());
// TODO: Finish implementation of Tunnel Ipv4 src and dst
injector.apply(TunnelIpv4Dst.class).accept(new Ipv4DstMatchFieldSerializer());
injector.apply(TunnelIpv4Src.class).accept(new Ipv4SrcMatchFieldSerializer());
injector.apply(UdpDst.class).accept(new UdpDstMatchFieldSerializer());
injector.apply(UdpSrc.class).accept(new UdpSrcMatchFieldSerializer());
injector.apply(VlanPcp.class).accept(new VlanPcpMatchFieldSerializer());
injector.apply(VlanVid.class).accept(new VlanVidMatchFieldSerializer());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel in project openflowplugin by opendaylight.
the class MatchConvertor method tunnelMatch.
private static void tunnelMatch(final List<MatchEntry> matchEntryList, final org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel tunnel) {
if (tunnel == null) {
return;
}
TunnelIdCaseBuilder tunnelIdCaseBuilder = new TunnelIdCaseBuilder();
TunnelIdBuilder tunnelIdBuilder = new TunnelIdBuilder();
boolean hasMask = tunnel.getTunnelMask() != null;
if (hasMask) {
tunnelIdBuilder.setMask(ByteUtil.convertBigIntegerToNBytes(tunnel.getTunnelMask(), OFConstants.SIZE_OF_LONG_IN_BYTES));
}
tunnelIdBuilder.setTunnelId(ByteUtil.convertBigIntegerToNBytes(tunnel.getTunnelId(), OFConstants.SIZE_OF_LONG_IN_BYTES));
tunnelIdCaseBuilder.setTunnelId(tunnelIdBuilder.build());
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setMatchEntryValue(tunnelIdCaseBuilder.build());
matchEntryBuilder.setHasMask(hasMask);
matchEntryBuilder.setOxmMatchField(TunnelId.class);
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryList.add(matchEntryBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel in project genius by opendaylight.
the class ItmTunnelEventListener method update.
@Override
public void update(@Nonnull InstanceIdentifier<StateTunnelList> instanceIdentifier, @Nonnull StateTunnelList originalTunnelList, @Nonnull StateTunnelList updatedTunnelList) {
LOG.trace("Tunnel Interface updated. Old: {} New: {}", originalTunnelList, updatedTunnelList);
TunnelOperStatus operStatus = updatedTunnelList.getOperState();
if (!Objects.equals(originalTunnelList.getOperState(), updatedTunnelList.getOperState())) {
LOG.debug("Tunnel Interface {} changed state to {}", originalTunnelList.getTunnelInterfaceName(), operStatus);
ItmTunnelUpdateAlarmWorker itmTunnelUpdateAlarmWorker = new ItmTunnelUpdateAlarmWorker(originalTunnelList, updatedTunnelList);
jobCoordinator.enqueueJob(ITMConstants.ITM_ALARM, itmTunnelUpdateAlarmWorker);
}
}
Aggregations