Mass replace CRLF->LF 09/13209/2
authorRobert Varga <rovarga@cisco.com>
Fri, 28 Nov 2014 14:59:46 +0000 (15:59 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 28 Nov 2014 15:41:25 +0000 (16:41 +0100)
Windows EOLs generate a checkstyle warning. Eliminate them to silence
the build a bit.

Change-Id: I16281420a51e237f516decd64ed46bbe7b4b1461
Signed-off-by: Robert Varga <rovarga@cisco.com>
373 files changed:
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/connection/ThreadConfiguration.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/connection/TlsConfiguration.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/connection/TlsConfigurationImpl.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/DeserializerExtensionProvider.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/DeserializerRegistry.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/DeserializerRegistryInjector.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/EnhancedMessageCodeKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/EnhancedMessageTypeKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/HeaderDeserializer.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/HeaderSerializer.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/MessageCodeKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/OFGeneralDeserializer.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/OFGeneralSerializer.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/SerializerExtensionProvider.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/SerializerRegistry.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/SerializerRegistryInjector.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ActionDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ActionSerializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/InstructionDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/InstructionSerializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/MatchEntryDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/MatchEntrySerializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterActionDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterActionSerializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterIdDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterIdSerializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterInstructionDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterInstructionSerializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterSerializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/OxmMatchConstants.java
openflow-protocol-api/src/main/yang/openflow-augments.yang
openflow-protocol-api/src/main/yang/openflow-configuration.yang
openflow-protocol-api/src/main/yang/openflow-protocol.yang
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/connection/TlsConfigurationImplTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/extensibility/EnhancedMessageCodeKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/extensibility/EnhancedMessageTypeKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/extensibility/MessageCodeKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/extensibility/MessageTypeKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/ActionDeserializerKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/ActionSerializerKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/InstructionDeserializerKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/InstructionSerializerKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/MatchEntryDeserializerKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/MatchEntrySerializerKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterActionDeserializerKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterActionSerializerKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterIdDeserializerKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterIdSerializerKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterInstructionDeserializerKeyTest.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterInstructionSerializerKeyTest.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ChannelInitializerFactory.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketDecoder.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketEncoder.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketHandler.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/PipelineHandlers.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ProtocolChannelInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/UdpChannelInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/UdpConnectionMap.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/UdpHandler.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/VersionMessageUdpWrapper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/MessageListenerWrapper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/UdpMessageListenerWrapper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/ActionDeserializerInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/InstructionDeserializerInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/MatchEntryDeserializerInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/MessageDeserializerInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/TypeToClassMapInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/AbstractActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/AbstractEthertypeActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/AbstractHeaderActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10AbstractIpAddressActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10AbstractMacAddressActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10AbstractPortActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10EnqueueActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10OutputActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetDlDstActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetDlSrcActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetNwDstActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetNwSrcActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetNwTosActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetTpDstActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetTpSrcActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetVlanPcpActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetVlanVidActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10StripVlanActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13CopyTtlInActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13CopyTtlOutActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13DecMplsTtlActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13DecNwTtlActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13GroupActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13OutputActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13PopMplsActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13PopPbbActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13PopVlanActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13PushMplsActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13PushPbbActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13PushVlanActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13SetFieldActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13SetMplsTtlActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13SetNwTtlActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF13SetQueueActionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactory.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/VendorMessageFactory.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/AbstractActionInstructionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/AbstractInstructionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/ApplyActionsInstructionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/ClearActionsInstructionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/GoToTableInstructionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/MeterInstructionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/WriteActionsInstructionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/WriteMetadataInstructionDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/AbstractOxmIpv4AddressDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/AbstractOxmIpv6AddressDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/AbstractOxmMacAddressDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/AbstractOxmMatchEntryDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/AbstractOxmMetadataDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/AbstractOxmPortDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/AbstractOxmPortNumberDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/NxmTcpFlagDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmArpOpDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmArpShaDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmArpSpaDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmArpThaDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmArpTpaDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmEthDstDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmEthSrcDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmEthTypeDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIcmpv4CodeDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIcmpv4TypeDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIcmpv6CodeDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIcmpv6TypeDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmInPhyPortDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmInPortDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpDscpDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpEcnDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpProtoDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv4DstDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv4SrcDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv6DstDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv6ExtHdrDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv6FlabelDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv6NdSllDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv6NdTargetDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv6NdTllDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv6SrcDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMaskDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMetadataDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMplsBosDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMplsLabelDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMplsTcDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmPbbIsidDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmSctpDstDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmSctpSrcDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmTcpDstDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmTcpSrcDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmTunnelIdDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmUdpDstDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmUdpSrcDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmVlanPcpDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmVlanVidDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/ActionsInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/InstructionsInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/MatchEntriesInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/MessageFactoryInitializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/AbstractActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/AbstractEthertypeActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/AbstractHeaderActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10AbstractIpAddressActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10AbstractMacAddressActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10AbstractPortActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10EnqueueActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10OutputActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10SetDlDstActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10SetDlSrcActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10SetNwDstActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10SetNwSrcActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10SetNwTosActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10SetTpDstActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10SetTpSrcActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10SetVlanPcpActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10SetVlanVidActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF10StripVlanActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13CopyTtlInActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13CopyTtlOutActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13DecMplsTtlActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13DecNwTtlActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13GroupActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13OutputActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13PopMplsActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13PopPbbActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13PopVlanActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13PushMplsActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13PushPbbActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13PushVlanActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13SetFieldActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13SetMplsTtlActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13SetNwTtlActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/action/OF13SetQueueActionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/instruction/AbstractActionInstructionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/instruction/AbstractInstructionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/instruction/ApplyActionsInstructionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/instruction/ClearActionsInstructionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/instruction/GoToTableInstructionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/instruction/MeterInstructionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/instruction/WriteActionsInstructionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/instruction/WriteMetadataInstructionSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmIpv4AddressSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmIpv6AddressSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmMacAddressSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmMatchEntrySerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmMetadataSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmPortNumberSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmPortSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/NxmTcpFlagSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmArpOpSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmArpShaSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmArpSpaSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmArpThaSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmArpTpaSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmEthDstSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmEthSrcSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmEthTypeSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIcmpv4CodeSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIcmpv4TypeSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIcmpv6CodeSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIcmpv6TypeSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmInPhyPortSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmInPortSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpDscpSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpEcnSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpProtoSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv4DstSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv4SrcSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv6DstSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv6ExtHdrSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv6FlabelSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv6NdSllSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv6NdTargetSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv6NdTllSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv6SrcSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmMetadataSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmMplsBosSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmMplsLabelSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmMplsTcSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmPbbIsidSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmSctpDstSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmSctpSrcSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmTcpDstSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmTcpSrcSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmTunnelIdSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmUdpDstSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmUdpSrcSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmVlanPcpSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmVlanVidSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/AbstractCodeKeyMaker.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/AbstractTypeKeyMaker.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ActionConstants.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ActionDeserializerRegistryHelper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ActionSerializerRegistryHelper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/CodeKeyMaker.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/CodeKeyMakerFactory.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/CommonMessageRegistryHelper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/InstructionConstants.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/InstructionDeserializerRegistryHelper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/InstructionSerializerRegistryHelper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ListDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ListSerializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntryDeserializerRegistryHelper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntrySerializerRegistryHelper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OpenflowUtils.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/SimpleDeserializerRegistryHelper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/TypeKeyMaker.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/TypeKeyMakerFactory.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/TypeToClassInitHelper.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/TypeToClassKey.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/Counter.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/CounterEventTypes.java
openflow-protocol-impl/src/main/resources/log4j.xml
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketEncoderTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ChannelOutboundQueueTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ConnectionAdapterImplTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/MessageListenerWrapperTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ResponseExpectedRpcListenerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/SimpleRpcListenerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/SwitchConnectionProviderImplTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DeserializationFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/TypeToClassMapInitializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10StatsReplyMessageFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/VendorMessageFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyExperimenterTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyFlowTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyGroupFeaturesTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyMeterFeaturesTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyPortDescTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyTableFeaturesTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/OF10StatsReplyExperimenterTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/AbstractInstructionDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv6ExtHdrDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmIpv6FlabelDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMetadataDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMplsBosDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmPbbIsidDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmVlanVidDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/SerializationFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/ExperimenterInputMessageFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10StatsRequestInputFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/VendorInputMessageFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestExperimenterTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestGroupDescTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestGroupFeaturesTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestMeterFeaturesTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestPortDescTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestTableFeaturesTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/MultipartRequestTableTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/OF10StatsRequestAggregateTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/OF10StatsRequestExperimenterTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmArpOpSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmArpShaSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmArpSpaSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmArpThaSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmArpTpaSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmEthDstSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmEthSrcSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmEthTypeSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIcmpv4CodeSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIcmpv4TypeSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIcmpv6CodeSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIcmpv6TypeSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpDscpSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpProtoSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv4DstSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv4SrcSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv6ExtHdrSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv6NdSllSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmIpv6NdTllSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmMetadataSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmMplsBosSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmMplsLabelSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmMplsTcSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmPbbIsidSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmSctpDstSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmSctpSrcSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmTcpDstSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmTcpSrcSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmTunnelIdSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmUdpDstSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmUdpSrcSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmVlanPcpSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmVlanVidSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/ActionsDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/CodeKeyMakerFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/InstructionsDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/ListDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/ListSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/MatchDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13ActionsSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13InstructionsSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializer02Test.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OpenflowUtilsTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/TypeKeyMakerFactoryTest.java
openflow-protocol-it/src/test/resources/log4j.xml
openflow-protocol-spi/src/main/java/org/opendaylight/openflowjava/protocol/spi/statistics/StatisticsHandler.java
openflowjava-config/pom.xml
openflowjava-config/src/main/resources/45-openflowjava-stats.xml
simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/OFClient.java
util/src/main/java/org/opendaylight/openflowjava/util/ExperimenterDeserializerKeyFactory.java
util/src/main/java/org/opendaylight/openflowjava/util/ExperimenterSerializerKeyFactory.java
util/src/test/java/org/opendaylight/openflowjava/util/ExperimenterDeserializerKeyFactoryTest.java
util/src/test/java/org/opendaylight/openflowjava/util/ExperimenterSerializerKeyFactoryTest.java

index 89dae4a2ce37d8f1318fc354e22f01db0f8f9782..e3d1fb66c40c1cdaf36404b7140f79443bb5696f 100644 (file)
@@ -1,26 +1,26 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.connection;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public interface ThreadConfiguration {\r
-\r
-    /**\r
-     * @return desired number of workerThreads processing the Openflow I/O\r
-     */\r
-    int getWorkerThreadCount();\r
-\r
-    /**\r
-     * @return desired number of bossThreads registering incomming Openflow connections\r
-     */\r
-    int getBossThreadCount();\r
-}\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.connection;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public interface ThreadConfiguration {
+
+    /**
+     * @return desired number of workerThreads processing the Openflow I/O
+     */
+    int getWorkerThreadCount();
+
+    /**
+     * @return desired number of bossThreads registering incomming Openflow connections
+     */
+    int getBossThreadCount();
+}
index fde44efb70d816ccd91a5218aa1a0eb45ed0a275..84eeab3ea1af8c7e94212d2f32732119fec487e4 100644 (file)
@@ -1,65 +1,65 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.connection;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public interface TlsConfiguration {\r
-\r
-    /**\r
-     * @return keystore location\r
-     */\r
-    String getTlsKeystore();\r
-    \r
-    /**\r
-     * @return keystore type\r
-     */\r
-    KeystoreType getTlsKeystoreType();\r
-    \r
-    /**\r
-     * @return truststore location\r
-     */\r
-    String getTlsTruststore();\r
-    \r
-    /**\r
-     * @return truststore type\r
-     */\r
-    KeystoreType getTlsTruststoreType();\r
-\r
-    /**\r
-     * @return keystore path type (CLASSPATH or PATH)\r
-     */\r
-    PathType getTlsKeystorePathType();\r
-\r
-    /**\r
-     * @return truststore path type (CLASSPATH or PATH)\r
-     */\r
-    PathType getTlsTruststorePathType();\r
-\r
-    /**\r
-     * @return password protecting specified keystore\r
-     */\r
-    String getKeystorePassword();\r
-\r
-    /**\r
-     * @return password protecting certificate\r
-     */\r
-    String getCertificatePassword();\r
-\r
-    /**\r
-     * @return password protecting specified truststore\r
-     */\r
-    String getTruststorePassword();\r
-}\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.connection;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
+
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public interface TlsConfiguration {
+
+    /**
+     * @return keystore location
+     */
+    String getTlsKeystore();
+    
+    /**
+     * @return keystore type
+     */
+    KeystoreType getTlsKeystoreType();
+    
+    /**
+     * @return truststore location
+     */
+    String getTlsTruststore();
+    
+    /**
+     * @return truststore type
+     */
+    KeystoreType getTlsTruststoreType();
+
+    /**
+     * @return keystore path type (CLASSPATH or PATH)
+     */
+    PathType getTlsKeystorePathType();
+
+    /**
+     * @return truststore path type (CLASSPATH or PATH)
+     */
+    PathType getTlsTruststorePathType();
+
+    /**
+     * @return password protecting specified keystore
+     */
+    String getKeystorePassword();
+
+    /**
+     * @return password protecting certificate
+     */
+    String getCertificatePassword();
+
+    /**
+     * @return password protecting specified truststore
+     */
+    String getTruststorePassword();
+}
index 4d6fa87d7ef469393251fa92264e957a6e2ef2f3..78a6c6b8c1804b0132a719884bca80706961114a 100644 (file)
@@ -1,91 +1,91 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.connection;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;\r
-\r
-/**\r
- * Class is used only for testing purposes - passwords are hardcoded\r
- * @author michal.polkorab\r
- */\r
-public class TlsConfigurationImpl implements TlsConfiguration {\r
-\r
-    private KeystoreType trustStoreType;\r
-    private String trustStore;\r
-    private KeystoreType keyStoreType;\r
-    private String keyStore;\r
-    private PathType keystorePathType;\r
-    private PathType truststorePathType;\r
-\r
-    /**\r
-     * Default constructor\r
-     * @param trustStoreType JKS or PKCS12\r
-     * @param trustStore path to trustStore file\r
-     * @param trustStorePathType truststore path type (classpath or path)\r
-     * @param keyStoreType JKS or PKCS12\r
-     * @param keyStore path to keyStore file\r
-     * @param keyStorePathType keystore path type (classpath or path)\r
-     */\r
-    public TlsConfigurationImpl(KeystoreType trustStoreType, String trustStore,\r
-            PathType trustStorePathType, KeystoreType keyStoreType,\r
-            String keyStore, PathType keyStorePathType) {\r
-        this.trustStoreType = trustStoreType;\r
-        this.trustStore = trustStore;\r
-        this.truststorePathType = trustStorePathType;\r
-        this.keyStoreType = keyStoreType;\r
-        this.keyStore = keyStore;\r
-        this.keystorePathType = keyStorePathType;\r
-    }\r
-\r
-    @Override\r
-    public KeystoreType getTlsTruststoreType() {\r
-        return trustStoreType;\r
-    }\r
-\r
-    @Override\r
-    public String getTlsTruststore() {\r
-        return trustStore;\r
-    }\r
-\r
-    @Override\r
-    public KeystoreType getTlsKeystoreType() {\r
-        return keyStoreType;\r
-    }\r
-\r
-    @Override\r
-    public String getTlsKeystore() {\r
-        return keyStore;\r
-    }\r
-\r
-    @Override\r
-    public PathType getTlsKeystorePathType() {\r
-        return keystorePathType;\r
-    }\r
-\r
-    @Override\r
-    public PathType getTlsTruststorePathType() {\r
-        return truststorePathType;\r
-    }\r
-\r
-    @Override\r
-    public String getKeystorePassword() {\r
-        return "opendaylight";\r
-    }\r
-\r
-    @Override\r
-    public String getCertificatePassword() {\r
-        return "opendaylight";\r
-    }\r
-\r
-    @Override\r
-    public String getTruststorePassword() {\r
-        return "opendaylight";\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.connection;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
+
+/**
+ * Class is used only for testing purposes - passwords are hardcoded
+ * @author michal.polkorab
+ */
+public class TlsConfigurationImpl implements TlsConfiguration {
+
+    private KeystoreType trustStoreType;
+    private String trustStore;
+    private KeystoreType keyStoreType;
+    private String keyStore;
+    private PathType keystorePathType;
+    private PathType truststorePathType;
+
+    /**
+     * Default constructor
+     * @param trustStoreType JKS or PKCS12
+     * @param trustStore path to trustStore file
+     * @param trustStorePathType truststore path type (classpath or path)
+     * @param keyStoreType JKS or PKCS12
+     * @param keyStore path to keyStore file
+     * @param keyStorePathType keystore path type (classpath or path)
+     */
+    public TlsConfigurationImpl(KeystoreType trustStoreType, String trustStore,
+            PathType trustStorePathType, KeystoreType keyStoreType,
+            String keyStore, PathType keyStorePathType) {
+        this.trustStoreType = trustStoreType;
+        this.trustStore = trustStore;
+        this.truststorePathType = trustStorePathType;
+        this.keyStoreType = keyStoreType;
+        this.keyStore = keyStore;
+        this.keystorePathType = keyStorePathType;
+    }
+
+    @Override
+    public KeystoreType getTlsTruststoreType() {
+        return trustStoreType;
+    }
+
+    @Override
+    public String getTlsTruststore() {
+        return trustStore;
+    }
+
+    @Override
+    public KeystoreType getTlsKeystoreType() {
+        return keyStoreType;
+    }
+
+    @Override
+    public String getTlsKeystore() {
+        return keyStore;
+    }
+
+    @Override
+    public PathType getTlsKeystorePathType() {
+        return keystorePathType;
+    }
+
+    @Override
+    public PathType getTlsTruststorePathType() {
+        return truststorePathType;
+    }
+
+    @Override
+    public String getKeystorePassword() {
+        return "opendaylight";
+    }
+
+    @Override
+    public String getCertificatePassword() {
+        return "opendaylight";
+    }
+
+    @Override
+    public String getTruststorePassword() {
+        return "opendaylight";
+    }
+}
index 0fd529db2e7bc9ed08b30189e7120688348d0749..f8f3c1b31bbe2977473159e2bf216456dc9fe6c8 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionDeserializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
-\r
-/**\r
- * Provides methods for deserialization part of extensibility.\r
- * In case of handling multiple multiple structures of same type (actions,\r
- * instructions, match entries, ... ) which are differentiated by\r
- * vendor / experimenter subtype, vendor has to switch / choose between\r
- * these subtypes. <br />\r
- * \r
- * This has to be done in this way because of experimenter headers, which\r
- * provide only vendor / experimenter ID. Subtype position may be different\r
- * for different vendors (or not present at all) - that's why vendor has to\r
- * handle it in his own implementations.\r
- * @author michal.polkorab\r
- */\r
-public interface DeserializerExtensionProvider {\r
-\r
-    /**\r
-     * Unregisters custom deserializer\r
-     * @param key used for deserializer lookup\r
-     * @return true if deserializer was removed,\r
-     *  false if no deserializer was found under specified key\r
-     */\r
-    boolean unregisterDeserializer(ExperimenterDeserializerKey key);\r
-\r
-    /**\r
-     * Registers action deserializer\r
-     * @param key used for deserializer lookup\r
-     * @param deserializer deserializer instance\r
-     */\r
-    void registerActionDeserializer(ExperimenterActionDeserializerKey key,\r
-            OFGeneralDeserializer deserializer);\r
-\r
-    /**\r
-     * Registers instruction deserializer\r
-     * @param key used for deserializer lookup\r
-     * @param deserializer deserializer instance\r
-     */\r
-    void registerInstructionDeserializer(ExperimenterInstructionDeserializerKey key,\r
-            OFGeneralDeserializer deserializer);\r
-\r
-    /**\r
-     * Registers match entry deserializer\r
-     * @param key used for deserializer lookup\r
-     * @param deserializer deserializer instance\r
-     */\r
-    void registerMatchEntryDeserializer(MatchEntryDeserializerKey key,\r
-            OFGeneralDeserializer deserializer);\r
-\r
-    /**\r
-     * Registers error message deserializer\r
-     * @param key used for deserializer lookup\r
-     * @param deserializer deserializer instance\r
-     */\r
-    void registerErrorDeserializer(ExperimenterIdDeserializerKey key,\r
-            OFDeserializer<ErrorMessage> deserializer);\r
-\r
-    /**\r
-     * Registers experimenter (vendor) message deserializer\r
-     * @param key used for deserializer lookup\r
-     * @param deserializer deserializer instance\r
-     */\r
-    void registerExperimenterMessageDeserializer(ExperimenterIdDeserializerKey key,\r
-            OFDeserializer<ExperimenterMessage> deserializer);\r
-\r
-    /**\r
-     * Registers multipart-reply (stats) message deserializer\r
-     * @param key used for deserializer lookup\r
-     * @param deserializer deserializer instance\r
-     */\r
-    void registerMultipartReplyMessageDeserializer(ExperimenterIdDeserializerKey key,\r
-            OFDeserializer<MultipartReplyMessage> deserializer);\r
-\r
-    /**\r
-     * Registers multipart-reply table-features message deserializer\r
-     * @param key used for deserializer lookup\r
-     * @param deserializer deserializer instance\r
-     */\r
-    void registerMultipartReplyTFDeserializer(ExperimenterIdDeserializerKey key,\r
-            OFGeneralDeserializer deserializer);\r
-\r
-    /**\r
-     * Registers meter band deserializer (used in multipart-reply meter-config)\r
-     * @param key used for deserializer lookup\r
-     * @param deserializer deserializer instance\r
-     */\r
-    void registerMeterBandDeserializer(ExperimenterIdDeserializerKey key,\r
-            OFDeserializer<MeterBandExperimenterCase> deserializer);\r
-\r
-    /**\r
-     * Registers queue property (QUEUE_GET_CONFIG_REPLY message) deserializer\r
-     * @param key used for deserializer lookup\r
-     * @param deserializer deserializer instance\r
-     */\r
-    void registerQueuePropertyDeserializer(ExperimenterIdDeserializerKey key,\r
-            OFDeserializer<QueueProperty> deserializer);\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionDeserializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
+
+/**
+ * Provides methods for deserialization part of extensibility.
+ * In case of handling multiple multiple structures of same type (actions,
+ * instructions, match entries, ... ) which are differentiated by
+ * vendor / experimenter subtype, vendor has to switch / choose between
+ * these subtypes. <br />
+ * 
+ * This has to be done in this way because of experimenter headers, which
+ * provide only vendor / experimenter ID. Subtype position may be different
+ * for different vendors (or not present at all) - that's why vendor has to
+ * handle it in his own implementations.
+ * @author michal.polkorab
+ */
+public interface DeserializerExtensionProvider {
+
+    /**
+     * Unregisters custom deserializer
+     * @param key used for deserializer lookup
+     * @return true if deserializer was removed,
+     *  false if no deserializer was found under specified key
+     */
+    boolean unregisterDeserializer(ExperimenterDeserializerKey key);
+
+    /**
+     * Registers action deserializer
+     * @param key used for deserializer lookup
+     * @param deserializer deserializer instance
+     */
+    void registerActionDeserializer(ExperimenterActionDeserializerKey key,
+            OFGeneralDeserializer deserializer);
+
+    /**
+     * Registers instruction deserializer
+     * @param key used for deserializer lookup
+     * @param deserializer deserializer instance
+     */
+    void registerInstructionDeserializer(ExperimenterInstructionDeserializerKey key,
+            OFGeneralDeserializer deserializer);
+
+    /**
+     * Registers match entry deserializer
+     * @param key used for deserializer lookup
+     * @param deserializer deserializer instance
+     */
+    void registerMatchEntryDeserializer(MatchEntryDeserializerKey key,
+            OFGeneralDeserializer deserializer);
+
+    /**
+     * Registers error message deserializer
+     * @param key used for deserializer lookup
+     * @param deserializer deserializer instance
+     */
+    void registerErrorDeserializer(ExperimenterIdDeserializerKey key,
+            OFDeserializer<ErrorMessage> deserializer);
+
+    /**
+     * Registers experimenter (vendor) message deserializer
+     * @param key used for deserializer lookup
+     * @param deserializer deserializer instance
+     */
+    void registerExperimenterMessageDeserializer(ExperimenterIdDeserializerKey key,
+            OFDeserializer<ExperimenterMessage> deserializer);
+
+    /**
+     * Registers multipart-reply (stats) message deserializer
+     * @param key used for deserializer lookup
+     * @param deserializer deserializer instance
+     */
+    void registerMultipartReplyMessageDeserializer(ExperimenterIdDeserializerKey key,
+            OFDeserializer<MultipartReplyMessage> deserializer);
+
+    /**
+     * Registers multipart-reply table-features message deserializer
+     * @param key used for deserializer lookup
+     * @param deserializer deserializer instance
+     */
+    void registerMultipartReplyTFDeserializer(ExperimenterIdDeserializerKey key,
+            OFGeneralDeserializer deserializer);
+
+    /**
+     * Registers meter band deserializer (used in multipart-reply meter-config)
+     * @param key used for deserializer lookup
+     * @param deserializer deserializer instance
+     */
+    void registerMeterBandDeserializer(ExperimenterIdDeserializerKey key,
+            OFDeserializer<MeterBandExperimenterCase> deserializer);
+
+    /**
+     * Registers queue property (QUEUE_GET_CONFIG_REPLY message) deserializer
+     * @param key used for deserializer lookup
+     * @param deserializer deserializer instance
+     */
+    void registerQueuePropertyDeserializer(ExperimenterIdDeserializerKey key,
+            OFDeserializer<QueueProperty> deserializer);
 }
\ No newline at end of file
index 646f4e0815d69dc087de77817b5bc5b41b34c523..3b647a4926f819b4a124fc9637ef216da97f33a7 100644 (file)
@@ -1,51 +1,51 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public interface DeserializerRegistry {\r
-\r
-    /**\r
-     * Initializes deserializers\r
-     */\r
-    void init();\r
-\r
-    /**\r
-     * @param key used for deserializer lookup\r
-     * @return deserializer found\r
-     */\r
-    <SERIALIZERTYPE extends OFGeneralDeserializer>\r
-            SERIALIZERTYPE getDeserializer(MessageCodeKey key);\r
-\r
-    /**\r
-     * Registers deserializer.\r
-     * Throws IllegalStateException when there is\r
-     * a deserializer already registered under given key.\r
-     * \r
-     * If the deserializer implements {@link DeserializerRegistryInjector} interface,\r
-     * the deserializer is injected with DeserializerRegistry instance.\r
-     * \r
-     * @param key used for deserializer lookup\r
-     * @param deserializer deserializer instance\r
-     */\r
-    void registerDeserializer(MessageCodeKey key,\r
-            OFGeneralDeserializer deserializer);\r
-\r
-    /**\r
-     * Unregisters deserializer\r
-     * @param key used for deserializer lookup\r
-     * @param deserializer deserializer instance\r
-     * @return true if deserializer was removed,\r
-     *  false if no deserializer was found under specified key\r
-     */\r
-    boolean unregisterDeserializer(MessageCodeKey key);\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public interface DeserializerRegistry {
+
+    /**
+     * Initializes deserializers
+     */
+    void init();
+
+    /**
+     * @param key used for deserializer lookup
+     * @return deserializer found
+     */
+    <SERIALIZERTYPE extends OFGeneralDeserializer>
+            SERIALIZERTYPE getDeserializer(MessageCodeKey key);
+
+    /**
+     * Registers deserializer.
+     * Throws IllegalStateException when there is
+     * a deserializer already registered under given key.
+     * 
+     * If the deserializer implements {@link DeserializerRegistryInjector} interface,
+     * the deserializer is injected with DeserializerRegistry instance.
+     * 
+     * @param key used for deserializer lookup
+     * @param deserializer deserializer instance
+     */
+    void registerDeserializer(MessageCodeKey key,
+            OFGeneralDeserializer deserializer);
+
+    /**
+     * Unregisters deserializer
+     * @param key used for deserializer lookup
+     * @param deserializer deserializer instance
+     * @return true if deserializer was removed,
+     *  false if no deserializer was found under specified key
+     */
+    boolean unregisterDeserializer(MessageCodeKey key);
+}
index 662ac802ec998e2f75f54edcfed2cdeb49c92b3d..0b291af384bdc1c88310a1836ddcb17671197567 100644 (file)
@@ -1,21 +1,21 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-/**\r
- * Injects registry\r
- * @author michal.polkorab\r
- */\r
-public interface DeserializerRegistryInjector {\r
-\r
-    /**\r
-     * Injects deserializer registry into deserializer\r
-     * @param deserializerRegistry\r
-     */\r
-    void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry);\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+/**
+ * Injects registry
+ * @author michal.polkorab
+ */
+public interface DeserializerRegistryInjector {
+
+    /**
+     * Injects deserializer registry into deserializer
+     * @param deserializerRegistry
+     */
+    void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry);
+}
index 08db5a013400515673f82f4df3f9119422a66c83..4ecec614ed8db4934ee4f42149b0d4e7faae7ab5 100644 (file)
@@ -1,60 +1,60 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class EnhancedMessageCodeKey extends MessageCodeKey {\r
-\r
-    private int msgType2;\r
-\r
-    /**\r
-     * Constructor\r
-     * @param version wire protocol version\r
-     * @param value used as distinguisher\r
-     * @param value2 used as detailed distinguisher\r
-     * @param clazz class of object that is going to be deserialized\r
-     */\r
-    public EnhancedMessageCodeKey(short version, int value, int value2, Class<?> clazz) {\r
-        super(version, value, clazz);\r
-        this.msgType2 = value2;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + msgType2;\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        if (getClass() != obj.getClass()) {\r
-            return false;\r
-        }\r
-        EnhancedMessageCodeKey other = (EnhancedMessageCodeKey) obj;\r
-        if (msgType2 != other.msgType2) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " msgType2: " + msgType2;\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class EnhancedMessageCodeKey extends MessageCodeKey {
+
+    private int msgType2;
+
+    /**
+     * Constructor
+     * @param version wire protocol version
+     * @param value used as distinguisher
+     * @param value2 used as detailed distinguisher
+     * @param clazz class of object that is going to be deserialized
+     */
+    public EnhancedMessageCodeKey(short version, int value, int value2, Class<?> clazz) {
+        super(version, value, clazz);
+        this.msgType2 = value2;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + msgType2;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        EnhancedMessageCodeKey other = (EnhancedMessageCodeKey) obj;
+        if (msgType2 != other.msgType2) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + " msgType2: " + msgType2;
+    }
 }
\ No newline at end of file
index d2ce5a91e8f8b49d02ef5811642900ea3863f304..c0f17c6a8f71d07a9479549020ba129c109eac58 100644 (file)
@@ -1,66 +1,66 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-\r
-/**\r
- * More specific key for {@link SerializerRegistry}\r
- * @author michal.polkorab\r
- * @param <E> main type\r
- * @param <F> specific type\r
- */\r
-public class EnhancedMessageTypeKey<E, F> extends MessageTypeKey<E> {\r
-\r
-    private final Class<F> msgType2;\r
-\r
-    /**\r
-     * @param msgVersion\r
-     * @param msgType\r
-     * @param msgType2\r
-     */\r
-    public EnhancedMessageTypeKey(short msgVersion, Class<E> msgType, Class<F> msgType2) {\r
-        super(msgVersion, msgType);\r
-        this.msgType2 = msgType2;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + ((msgType2 == null) ? 0 : msgType2.hashCode());\r
-        return result;\r
-    }\r
-    \r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        if (getClass() != obj.getClass()) {\r
-            return false;\r
-        }\r
-        @SuppressWarnings("rawtypes")\r
-        EnhancedMessageTypeKey other = (EnhancedMessageTypeKey) obj;\r
-        if (msgType2 == null) {\r
-            if (other.msgType2 != null) {\r
-                return false;\r
-            }\r
-        } else if (!msgType2.getName().equals(other.msgType2.getName())) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " msgType2: " + msgType2.getName();\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+
+/**
+ * More specific key for {@link SerializerRegistry}
+ * @author michal.polkorab
+ * @param <E> main type
+ * @param <F> specific type
+ */
+public class EnhancedMessageTypeKey<E, F> extends MessageTypeKey<E> {
+
+    private final Class<F> msgType2;
+
+    /**
+     * @param msgVersion
+     * @param msgType
+     * @param msgType2
+     */
+    public EnhancedMessageTypeKey(short msgVersion, Class<E> msgType, Class<F> msgType2) {
+        super(msgVersion, msgType);
+        this.msgType2 = msgType2;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((msgType2 == null) ? 0 : msgType2.hashCode());
+        return result;
+    }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        @SuppressWarnings("rawtypes")
+        EnhancedMessageTypeKey other = (EnhancedMessageTypeKey) obj;
+        if (msgType2 == null) {
+            if (other.msgType2 != null) {
+                return false;
+            }
+        } else if (!msgType2.getName().equals(other.msgType2.getName())) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + " msgType2: " + msgType2.getName();
+    }
 }
index 594f3d024539a330e95838d1f786b8a074e5c741..855b2f69c71db6fd47298e0630031bf4cbf19ad6 100644 (file)
@@ -1,27 +1,27 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <E> \r
- */\r
-public interface HeaderDeserializer<E extends DataObject> extends OFGeneralDeserializer {\r
-\r
-    /**\r
-     * Deserializes byte message headers\r
-     * \r
-     * @param rawMessage message as bytes in ByteBuf\r
-     * @return POJO/DTO\r
-     */\r
-    E deserializeHeader(ByteBuf rawMessage);\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author michal.polkorab
+ * @param <E> 
+ */
+public interface HeaderDeserializer<E extends DataObject> extends OFGeneralDeserializer {
+
+    /**
+     * Deserializes byte message headers
+     * 
+     * @param rawMessage message as bytes in ByteBuf
+     * @return POJO/DTO
+     */
+    E deserializeHeader(ByteBuf rawMessage);
+}
index cd8cf0386c8c53a1a9e6cc737da4615244d06764..d1966fb1e81bd7f01d6bb30416160cb771f162e4 100644 (file)
@@ -1,27 +1,27 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-/**\r
- * Does only-header serialization (such as oxm_ids, action_ids, instruction_ids)\r
- * @author michal.polkorab\r
- * @param <SERIALIZER_TYPE>\r
- */\r
-public interface HeaderSerializer<SERIALIZER_TYPE extends DataObject> extends OFGeneralSerializer {\r
-\r
-    /**\r
-     * Serializes object headers (e.g. for Multipart message - Table Features)\r
-     * @param input object whose headers should be serialized\r
-     * @param outBuffer output buffer\r
-     */\r
-    void serializeHeader(SERIALIZER_TYPE input, ByteBuf outBuffer);\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+import io.netty.buffer.ByteBuf;
+
+/**
+ * Does only-header serialization (such as oxm_ids, action_ids, instruction_ids)
+ * @author michal.polkorab
+ * @param <SERIALIZER_TYPE>
+ */
+public interface HeaderSerializer<SERIALIZER_TYPE extends DataObject> extends OFGeneralSerializer {
+
+    /**
+     * Serializes object headers (e.g. for Multipart message - Table Features)
+     * @param input object whose headers should be serialized
+     * @param outBuffer output buffer
+     */
+    void serializeHeader(SERIALIZER_TYPE input, ByteBuf outBuffer);
+}
index 56b6bb1a8a123457cd96dede185bef13b658565e..ea487ea61c82b4c168463da4913174b8c0ace0b8 100644 (file)
@@ -1,73 +1,73 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public class MessageCodeKey {\r
-\r
-    private short msgVersion;\r
-    private int msgType;\r
-    private Class<?> clazz;\r
-\r
-    /**\r
-     * Constructor\r
-     * @param version wire protocol version\r
-     * @param value used as distinguisher (read from binary data / buffer)\r
-     * @param clazz class of object that is going to be deserialized\r
-     */\r
-    public MessageCodeKey(short version, int value, Class<?> clazz) {\r
-        this.msgVersion = version;\r
-        this.msgType = value;\r
-        this.clazz = clazz;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = 1;\r
-        result = prime * result + ((clazz == null) ? 0 : clazz.hashCode());\r
-        result = prime * result + msgType;\r
-        result = prime * result + msgVersion;\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (obj == null) {\r
-            return false;\r
-        }\r
-        if (!(obj instanceof MessageCodeKey)) {\r
-            return false;\r
-        }\r
-        MessageCodeKey other = (MessageCodeKey) obj;\r
-        if (clazz == null) {\r
-            if (other.clazz != null) {\r
-                return false;\r
-            }\r
-        } else if (!clazz.equals(other.clazz)) {\r
-            return false;\r
-        }\r
-        if (msgType != other.msgType) {\r
-            return false;\r
-        }\r
-        if (msgVersion != other.msgVersion) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return "msgVersion: " + msgVersion + " objectClass: " + clazz.getName() + " msgType: " + msgType;\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+/**
+ * @author michal.polkorab
+ */
+public class MessageCodeKey {
+
+    private short msgVersion;
+    private int msgType;
+    private Class<?> clazz;
+
+    /**
+     * Constructor
+     * @param version wire protocol version
+     * @param value used as distinguisher (read from binary data / buffer)
+     * @param clazz class of object that is going to be deserialized
+     */
+    public MessageCodeKey(short version, int value, Class<?> clazz) {
+        this.msgVersion = version;
+        this.msgType = value;
+        this.clazz = clazz;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((clazz == null) ? 0 : clazz.hashCode());
+        result = prime * result + msgType;
+        result = prime * result + msgVersion;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof MessageCodeKey)) {
+            return false;
+        }
+        MessageCodeKey other = (MessageCodeKey) obj;
+        if (clazz == null) {
+            if (other.clazz != null) {
+                return false;
+            }
+        } else if (!clazz.equals(other.clazz)) {
+            return false;
+        }
+        if (msgType != other.msgType) {
+            return false;
+        }
+        if (msgVersion != other.msgVersion) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "msgVersion: " + msgVersion + " objectClass: " + clazz.getName() + " msgType: " + msgType;
+    }
 }
\ No newline at end of file
index bedb267ad81296e869e53ad378f3c1db32d6fb1d..c4132cc6dd564481a9a5aaeb82553e7efe1f74d5 100644 (file)
@@ -1,17 +1,17 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public interface OFGeneralDeserializer {\r
-\r
-    // empty unifying interface\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+
+/**
+ * @author michal.polkorab
+ */
+public interface OFGeneralDeserializer {
+
+    // empty unifying interface
+}
index 0001c3e9da11da1e571b42e00b27039910d615db..6dd5d3f07ba41027dfdcc724cfba5e1c8446ec12 100644 (file)
@@ -1,17 +1,17 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-/**\r
- * Unifying superinterface\r
- * @author michal.polkorab\r
- * */\r
-public interface OFGeneralSerializer {\r
-\r
-    // empty unifying superinterface\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+/**
+ * Unifying superinterface
+ * @author michal.polkorab
+ * */
+public interface OFGeneralSerializer {
+
+    // empty unifying superinterface
+}
index f658f5f109d4197fe05136cac172e635d6fd7ee1..b5bb0c2c49c6f423ed866b14e31f8b3dd419e163 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-\r
-/**\r
- * Provides methods for serialization part of extensibility.\r
- * In case of handling multiple structures of same type (actions,\r
- * instructions, match entries, ... ) which are differentiated by\r
- * vendor / experimenter subtype, vendor has to switch / choose between\r
- * these subtypes. <br />\r
- * \r
- * This has to be done in this way because of unknown augmentations\r
- * - that's why vendor has to handle it in his own implementations.\r
- * @author michal.polkorab\r
- */\r
-public interface SerializerExtensionProvider {\r
-\r
-    /**\r
-     * Unregisters custom serializer\r
-     * @param key used for serializer lookup\r
-     * @return true if serializer was removed,\r
-     *  false if no serializer was found under specified key\r
-     */\r
-    boolean unregisterSerializer(ExperimenterSerializerKey key);\r
-\r
-    /**\r
-     * Registers action serializer\r
-     * @param key used for serializer lookup\r
-     * @param serializer serializer implementation\r
-     */\r
-    void registerActionSerializer(ExperimenterActionSerializerKey key,\r
-            OFGeneralSerializer serializer);\r
-\r
-    /**\r
-     * Registers instruction serializer\r
-     * @param key used for serializer lookup\r
-     * @param serializer serializer implementation\r
-     */\r
-    void registerInstructionSerializer(ExperimenterInstructionSerializerKey key,\r
-            OFGeneralSerializer serializer);\r
-\r
-    /**\r
-     * Registers match entry serializer\r
-     * @param key used for serializer lookup\r
-     * @param serializer serializer implementation\r
-     */\r
-    <OXMCLASS extends OxmClassBase, OXMTYPE extends MatchField> void registerMatchEntrySerializer(\r
-            MatchEntrySerializerKey<OXMCLASS, OXMTYPE> key,OFGeneralSerializer serializer);\r
-\r
-    /**\r
-     * Registers experimenter (vendor) message serializer\r
-     * @param key used for serializer lookup\r
-     * @param serializer serializer implementation\r
-     */\r
-    void registerExperimenterMessageSerializer(ExperimenterIdSerializerKey<ExperimenterInput> key,\r
-            OFSerializer<ExperimenterInput> serializer);\r
-\r
-    /**\r
-     * Registers multipart-request (stats-request) serializer\r
-     * @param key used for serializer lookup\r
-     * @param serializer serializer implementation\r
-     */\r
-    void registerMultipartRequestSerializer(ExperimenterIdSerializerKey<MultipartRequestExperimenterCase> key,\r
-            OFSerializer<MultipartRequestExperimenterCase> serializer);\r
-\r
-    /**\r
-     * Registers multipart-request table-features serializer\r
-     * @param key used for serializer lookup\r
-     * @param serializer serializer implementation\r
-     */\r
-    void registerMultipartRequestTFSerializer(ExperimenterIdSerializerKey<TableFeatureProperties> key,\r
-            OFGeneralSerializer serializer);\r
-\r
-    /**\r
-     * Registers meter band serializer (used in meter-mod messages)\r
-     * @param key used for serializer lookup\r
-     * @param serializer serializer implementation\r
-     */\r
-    void registerMeterBandSerializer(ExperimenterIdSerializerKey<MeterBandExperimenterCase> key,\r
-            OFSerializer<MeterBandExperimenterCase> serializer);\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+
+/**
+ * Provides methods for serialization part of extensibility.
+ * In case of handling multiple structures of same type (actions,
+ * instructions, match entries, ... ) which are differentiated by
+ * vendor / experimenter subtype, vendor has to switch / choose between
+ * these subtypes. <br />
+ * 
+ * This has to be done in this way because of unknown augmentations
+ * - that's why vendor has to handle it in his own implementations.
+ * @author michal.polkorab
+ */
+public interface SerializerExtensionProvider {
+
+    /**
+     * Unregisters custom serializer
+     * @param key used for serializer lookup
+     * @return true if serializer was removed,
+     *  false if no serializer was found under specified key
+     */
+    boolean unregisterSerializer(ExperimenterSerializerKey key);
+
+    /**
+     * Registers action serializer
+     * @param key used for serializer lookup
+     * @param serializer serializer implementation
+     */
+    void registerActionSerializer(ExperimenterActionSerializerKey key,
+            OFGeneralSerializer serializer);
+
+    /**
+     * Registers instruction serializer
+     * @param key used for serializer lookup
+     * @param serializer serializer implementation
+     */
+    void registerInstructionSerializer(ExperimenterInstructionSerializerKey key,
+            OFGeneralSerializer serializer);
+
+    /**
+     * Registers match entry serializer
+     * @param key used for serializer lookup
+     * @param serializer serializer implementation
+     */
+    <OXMCLASS extends OxmClassBase, OXMTYPE extends MatchField> void registerMatchEntrySerializer(
+            MatchEntrySerializerKey<OXMCLASS, OXMTYPE> key,OFGeneralSerializer serializer);
+
+    /**
+     * Registers experimenter (vendor) message serializer
+     * @param key used for serializer lookup
+     * @param serializer serializer implementation
+     */
+    void registerExperimenterMessageSerializer(ExperimenterIdSerializerKey<ExperimenterInput> key,
+            OFSerializer<ExperimenterInput> serializer);
+
+    /**
+     * Registers multipart-request (stats-request) serializer
+     * @param key used for serializer lookup
+     * @param serializer serializer implementation
+     */
+    void registerMultipartRequestSerializer(ExperimenterIdSerializerKey<MultipartRequestExperimenterCase> key,
+            OFSerializer<MultipartRequestExperimenterCase> serializer);
+
+    /**
+     * Registers multipart-request table-features serializer
+     * @param key used for serializer lookup
+     * @param serializer serializer implementation
+     */
+    void registerMultipartRequestTFSerializer(ExperimenterIdSerializerKey<TableFeatureProperties> key,
+            OFGeneralSerializer serializer);
+
+    /**
+     * Registers meter band serializer (used in meter-mod messages)
+     * @param key used for serializer lookup
+     * @param serializer serializer implementation
+     */
+    void registerMeterBandSerializer(ExperimenterIdSerializerKey<MeterBandExperimenterCase> key,
+            OFSerializer<MeterBandExperimenterCase> serializer);
 }
\ No newline at end of file
index c059014078a498792163d36047c4b1c46e849368..3014191158ad4109af4d59136bd34c6e3a0de117 100644 (file)
@@ -1,54 +1,54 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-\r
-\r
-\r
-/**\r
- * Stores and handles serializers \r
- * @author michal.polkorab\r
- *\r
- */\r
-public interface SerializerRegistry {\r
-\r
-    /**\r
-     * Serializer registry provisioning\r
-     */\r
-    public void init();\r
-\r
-    /**\r
-     * @param msgTypeKey lookup key\r
-     * @return serializer or NullPointerException if no serializer was found\r
-     */\r
-    <KEYTYPE, SERIALIZERTYPE extends OFGeneralSerializer> SERIALIZERTYPE \r
-        getSerializer(MessageTypeKey<KEYTYPE> msgTypeKey);\r
-\r
-    /**\r
-     * Registers serializer\r
-     * Throws IllegalStateException when there is\r
-     * a serializer already registered under given key.\r
-     * \r
-     * If the serializer implements {@link SerializerRegistryInjector} interface,\r
-     * the serializer is injected with SerializerRegistry instance.\r
-     * \r
-     * @param key used for serializer lookup\r
-     * @param serializer serializer implementation\r
-     */\r
-    <KEYTYPE> void registerSerializer(MessageTypeKey<KEYTYPE> key,\r
-            OFGeneralSerializer serializer);\r
-\r
-    /**\r
-     * Unregisters serializer\r
-     * @param key used for serializer lookup\r
-     * @param serializer serializer implementation\r
-     * @return true if serializer was removed,\r
-     *  false if no serializer was found under specified key\r
-     */\r
-    <KEYTYPE> boolean unregisterSerializer(MessageTypeKey<KEYTYPE> key);\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+
+
+
+/**
+ * Stores and handles serializers 
+ * @author michal.polkorab
+ *
+ */
+public interface SerializerRegistry {
+
+    /**
+     * Serializer registry provisioning
+     */
+    public void init();
+
+    /**
+     * @param msgTypeKey lookup key
+     * @return serializer or NullPointerException if no serializer was found
+     */
+    <KEYTYPE, SERIALIZERTYPE extends OFGeneralSerializer> SERIALIZERTYPE 
+        getSerializer(MessageTypeKey<KEYTYPE> msgTypeKey);
+
+    /**
+     * Registers serializer
+     * Throws IllegalStateException when there is
+     * a serializer already registered under given key.
+     * 
+     * If the serializer implements {@link SerializerRegistryInjector} interface,
+     * the serializer is injected with SerializerRegistry instance.
+     * 
+     * @param key used for serializer lookup
+     * @param serializer serializer implementation
+     */
+    <KEYTYPE> void registerSerializer(MessageTypeKey<KEYTYPE> key,
+            OFGeneralSerializer serializer);
+
+    /**
+     * Unregisters serializer
+     * @param key used for serializer lookup
+     * @param serializer serializer implementation
+     * @return true if serializer was removed,
+     *  false if no serializer was found under specified key
+     */
+    <KEYTYPE> boolean unregisterSerializer(MessageTypeKey<KEYTYPE> key);
+}
index 1204055e05fcef005d4a2be2e3089604dc2b4d85..b074b15fc726920df4e19f5896d4f49506f050d4 100644 (file)
@@ -1,22 +1,22 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-/**\r
- * Serializer registry injector\r
- * @author michal.polkorab\r
- */\r
-public interface SerializerRegistryInjector {\r
-\r
-    /**\r
-     * Injects serializer registry\r
-     * @param serializerRegistry registry instance\r
-     */\r
-    void injectSerializerRegistry(SerializerRegistry serializerRegistry);\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+/**
+ * Serializer registry injector
+ * @author michal.polkorab
+ */
+public interface SerializerRegistryInjector {
+
+    /**
+     * Injects serializer registry
+     * @param serializerRegistry registry instance
+     */
+    void injectSerializerRegistry(SerializerRegistry serializerRegistry);
+
+}
index d7363fbb1cf43a9d383d6dcb5e3f230610718bd6..a80bd7ae265dd19d976f89124a2de709d80e981a 100644 (file)
@@ -1,66 +1,66 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionDeserializerKey extends MessageCodeKey {\r
-\r
-    private Long experimenterId;\r
-    /**\r
-     * @param version protocol wire version\r
-     * @param type action type\r
-     * @param experimenterId experimenter / vendor ID\r
-     */\r
-    public ActionDeserializerKey(short version,\r
-            int type, Long experimenterId) {\r
-        super(version, type, Action.class);\r
-        this.experimenterId = experimenterId;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        if (!(obj instanceof ActionDeserializerKey)) {\r
-            return false;\r
-        }\r
-        ActionDeserializerKey other = (ActionDeserializerKey) obj;\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null) {\r
-                return false;\r
-            }\r
-        } else if (!experimenterId.equals(other.experimenterId)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " experimenterID: " + experimenterId;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionDeserializerKey extends MessageCodeKey {
+
+    private Long experimenterId;
+    /**
+     * @param version protocol wire version
+     * @param type action type
+     * @param experimenterId experimenter / vendor ID
+     */
+    public ActionDeserializerKey(short version,
+            int type, Long experimenterId) {
+        super(version, type, Action.class);
+        this.experimenterId = experimenterId;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (!(obj instanceof ActionDeserializerKey)) {
+            return false;
+        }
+        ActionDeserializerKey other = (ActionDeserializerKey) obj;
+        if (experimenterId == null) {
+            if (other.experimenterId != null) {
+                return false;
+            }
+        } else if (!experimenterId.equals(other.experimenterId)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + " experimenterID: " + experimenterId;
+    }
 }
\ No newline at end of file
index 4e33c56ca293055ca8e8f82d0512944362cc9503..d1120467a25f2cf9ca8ac9a5e28cce8750731a7d 100644 (file)
@@ -1,78 +1,78 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <TYPE> action type\r
- */\r
-public class ActionSerializerKey<TYPE extends ActionBase> extends MessageTypeKey<Action> {\r
-\r
-    private Class<TYPE> actionType;\r
-    private Long experimenterId;\r
-\r
-    /**\r
-     * @param msgVersion protocol wire version\r
-     * @param actionType type of action\r
-     * @param experimenterId experimenter / vendor ID\r
-     */\r
-    public ActionSerializerKey(short msgVersion, Class<TYPE> actionType,\r
-            Long experimenterId) {\r
-        super(msgVersion, Action.class);\r
-        this.actionType = actionType;\r
-        this.experimenterId = experimenterId;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + ((actionType == null) ? 0 : actionType.hashCode());\r
-        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        if (getClass() != obj.getClass()) {\r
-            return false;\r
-        }\r
-        ActionSerializerKey<?> other = (ActionSerializerKey<?>) obj;\r
-        if (actionType == null) {\r
-            if (other.actionType != null) {\r
-                return false;\r
-            }\r
-        } else if (!actionType.equals(other.actionType)) {\r
-            return false;\r
-        }\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null) {\r
-                return false;\r
-            }\r
-        } else if (!experimenterId.equals(other.experimenterId)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " action type: " + actionType.getName() + " experimenterID: " + experimenterId;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ * @param <TYPE> action type
+ */
+public class ActionSerializerKey<TYPE extends ActionBase> extends MessageTypeKey<Action> {
+
+    private Class<TYPE> actionType;
+    private Long experimenterId;
+
+    /**
+     * @param msgVersion protocol wire version
+     * @param actionType type of action
+     * @param experimenterId experimenter / vendor ID
+     */
+    public ActionSerializerKey(short msgVersion, Class<TYPE> actionType,
+            Long experimenterId) {
+        super(msgVersion, Action.class);
+        this.actionType = actionType;
+        this.experimenterId = experimenterId;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((actionType == null) ? 0 : actionType.hashCode());
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ActionSerializerKey<?> other = (ActionSerializerKey<?>) obj;
+        if (actionType == null) {
+            if (other.actionType != null) {
+                return false;
+            }
+        } else if (!actionType.equals(other.actionType)) {
+            return false;
+        }
+        if (experimenterId == null) {
+            if (other.experimenterId != null) {
+                return false;
+            }
+        } else if (!experimenterId.equals(other.experimenterId)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + " action type: " + actionType.getName() + " experimenterID: " + experimenterId;
+    }
 }
\ No newline at end of file
index c21608780b272208a59f09190dd10423c8aae0d4..f7ebcb3c25e86bdbbce4d56af6fd90fe7a22ad87 100644 (file)
@@ -1,66 +1,66 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class InstructionDeserializerKey extends MessageCodeKey {\r
-\r
-    private Long experimenterId;\r
-    /**\r
-     * @param version protocol wire version\r
-     * @param type instruction type\r
-     * @param experimenterId \r
-     */\r
-    public InstructionDeserializerKey(short version, int type,\r
-            Long experimenterId) {\r
-        super(version, type, Instruction.class);\r
-        this.experimenterId = experimenterId;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        if (!(obj instanceof InstructionDeserializerKey)) {\r
-            return false;\r
-        }\r
-        InstructionDeserializerKey other = (InstructionDeserializerKey) obj;\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null) {\r
-                return false;\r
-            }\r
-        } else if (!experimenterId.equals(other.experimenterId)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " experimenterID: " + experimenterId;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class InstructionDeserializerKey extends MessageCodeKey {
+
+    private Long experimenterId;
+    /**
+     * @param version protocol wire version
+     * @param type instruction type
+     * @param experimenterId 
+     */
+    public InstructionDeserializerKey(short version, int type,
+            Long experimenterId) {
+        super(version, type, Instruction.class);
+        this.experimenterId = experimenterId;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (!(obj instanceof InstructionDeserializerKey)) {
+            return false;
+        }
+        InstructionDeserializerKey other = (InstructionDeserializerKey) obj;
+        if (experimenterId == null) {
+            if (other.experimenterId != null) {
+                return false;
+            }
+        } else if (!experimenterId.equals(other.experimenterId)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + " experimenterID: " + experimenterId;
+    }
 }
\ No newline at end of file
index 7759c0bf0b64e1431b0ffbefabc44d1928b9809f..73d0f1530dee2610ee05fb489c5e7b7b14c865f8 100644 (file)
@@ -1,81 +1,81 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <TYPE> action type\r
- */\r
-public class InstructionSerializerKey<TYPE extends InstructionBase>\r
-        extends MessageTypeKey<Instruction>{\r
-\r
-    private Class<TYPE> instructionType;\r
-    private Long experimenterId;\r
-\r
-    /**\r
-     * @param msgVersion protocol wire version\r
-     * @param objectType class of serialized object (Instruction.class)\r
-     * @param instructionType type of instruction\r
-     * @param experimenterId experimenter / vendor ID\r
-     */\r
-    public InstructionSerializerKey(short msgVersion, Class<TYPE> instructionType,\r
-            Long experimenterId) {\r
-        super(msgVersion, Instruction.class);\r
-        this.instructionType = instructionType;\r
-        this.experimenterId = experimenterId;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
-        result = prime * result + ((instructionType == null) ? 0 : instructionType.hashCode());\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        if (!(obj instanceof InstructionSerializerKey)) {\r
-            return false;\r
-        }\r
-        InstructionSerializerKey<?> other = (InstructionSerializerKey<?>) obj;\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null) {\r
-                return false;\r
-            }\r
-        } else if (!experimenterId.equals(other.experimenterId)) {\r
-            return false;\r
-        }\r
-        if (instructionType == null) {\r
-            if (other.instructionType != null) {\r
-                return false;\r
-            }\r
-        } else if (!instructionType.equals(other.instructionType)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " instructionType type: " + instructionType.getName()\r
-                + " vendorID: " + experimenterId;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
+
+/**
+ * @author michal.polkorab
+ * @param <TYPE> action type
+ */
+public class InstructionSerializerKey<TYPE extends InstructionBase>
+        extends MessageTypeKey<Instruction>{
+
+    private Class<TYPE> instructionType;
+    private Long experimenterId;
+
+    /**
+     * @param msgVersion protocol wire version
+     * @param objectType class of serialized object (Instruction.class)
+     * @param instructionType type of instruction
+     * @param experimenterId experimenter / vendor ID
+     */
+    public InstructionSerializerKey(short msgVersion, Class<TYPE> instructionType,
+            Long experimenterId) {
+        super(msgVersion, Instruction.class);
+        this.instructionType = instructionType;
+        this.experimenterId = experimenterId;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+        result = prime * result + ((instructionType == null) ? 0 : instructionType.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (!(obj instanceof InstructionSerializerKey)) {
+            return false;
+        }
+        InstructionSerializerKey<?> other = (InstructionSerializerKey<?>) obj;
+        if (experimenterId == null) {
+            if (other.experimenterId != null) {
+                return false;
+            }
+        } else if (!experimenterId.equals(other.experimenterId)) {
+            return false;
+        }
+        if (instructionType == null) {
+            if (other.instructionType != null) {
+                return false;
+            }
+        } else if (!instructionType.equals(other.instructionType)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + " instructionType type: " + instructionType.getName()
+                + " vendorID: " + experimenterId;
+    }
 }
\ No newline at end of file
index d50d9fb1450ab6b9fcddb1fd5e3a56acef526e81..ebd16ad76757ab82c0cb5e8de636a1a333c8a649 100644 (file)
@@ -1,81 +1,81 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterDeserializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class MatchEntryDeserializerKey extends MessageCodeKey\r
-        implements ExperimenterDeserializerKey {\r
-\r
-    private int oxmField;\r
-    private Long experimenterId;\r
-\r
-    /**\r
-     * @param version protocol wire version\r
-     * @param oxmClass oxm_class (see specification)\r
-     * @param oxmField oxm_field (see specification)\r
-     */\r
-    public MatchEntryDeserializerKey(short version,\r
-            int oxmClass, int oxmField) {\r
-        super(version, oxmClass, MatchEntries.class);\r
-        this.oxmField = oxmField;\r
-    }\r
-\r
-    /**\r
-     * @param experimenterId experimenter / vendor ID\r
-     */\r
-    public void setExperimenterId(Long experimenterId) {\r
-        this.experimenterId = experimenterId;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
-        result = prime * result + oxmField;\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        if (getClass() != obj.getClass()) {\r
-            return false;\r
-        }\r
-        MatchEntryDeserializerKey other = (MatchEntryDeserializerKey) obj;\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null) {\r
-                return false;\r
-            }\r
-        } else if (!experimenterId.equals(other.experimenterId)) {\r
-            return false;\r
-        }\r
-        if (oxmField != other.oxmField) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " oxm_field: " + oxmField + " experimenterID: " + experimenterId;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterDeserializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class MatchEntryDeserializerKey extends MessageCodeKey
+        implements ExperimenterDeserializerKey {
+
+    private int oxmField;
+    private Long experimenterId;
+
+    /**
+     * @param version protocol wire version
+     * @param oxmClass oxm_class (see specification)
+     * @param oxmField oxm_field (see specification)
+     */
+    public MatchEntryDeserializerKey(short version,
+            int oxmClass, int oxmField) {
+        super(version, oxmClass, MatchEntries.class);
+        this.oxmField = oxmField;
+    }
+
+    /**
+     * @param experimenterId experimenter / vendor ID
+     */
+    public void setExperimenterId(Long experimenterId) {
+        this.experimenterId = experimenterId;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+        result = prime * result + oxmField;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        MatchEntryDeserializerKey other = (MatchEntryDeserializerKey) obj;
+        if (experimenterId == null) {
+            if (other.experimenterId != null) {
+                return false;
+            }
+        } else if (!experimenterId.equals(other.experimenterId)) {
+            return false;
+        }
+        if (oxmField != other.oxmField) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + " oxm_field: " + oxmField + " experimenterID: " + experimenterId;
+    }
 }
\ No newline at end of file
index 55d67e56fd29bf37d9d328a362ddfabb97fad3c4..fddc35c6e8390e8180921799f5ce151c73d74daa 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <OXM_CLASS> oxm_class (see specification)\r
- * @param <OXM_FIELD> oxm_field (see specification)\r
- */\r
-public final class MatchEntrySerializerKey<OXM_CLASS extends OxmClassBase, OXM_FIELD extends MatchField>\r
-        extends MessageTypeKey<MatchEntries> implements ExperimenterSerializerKey {\r
-\r
-    private Class<OXM_CLASS> oxmClass;\r
-    private Class<OXM_FIELD> oxmField;\r
-    private Long experimenterId;\r
-\r
-    /**\r
-     * @param msgVersion protocol wire version\r
-     * @param objectType class of serialized object\r
-     * @param oxmClass oxm_class (see specification)\r
-     * @param oxmField oxm_field (see specification)\r
-     */\r
-    public MatchEntrySerializerKey(short msgVersion, Class<OXM_CLASS> oxmClass,\r
-            Class<OXM_FIELD> oxmField) {\r
-        super(msgVersion, MatchEntries.class);\r
-        this.oxmClass = oxmClass;\r
-        this.oxmField = oxmField;\r
-    }\r
-\r
-    /**\r
-     * @param experimenterId experimenter / vendor ID\r
-     */\r
-    public void setExperimenterId(Long experimenterId) {\r
-        this.experimenterId = experimenterId;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
-        result = prime * result + ((oxmClass == null) ? 0 : oxmClass.hashCode());\r
-        result = prime * result + ((oxmField == null) ? 0 : oxmField.hashCode());\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        if (getClass() != obj.getClass()) {\r
-            return false;\r
-        }\r
-        MatchEntrySerializerKey<?, ?> other = (MatchEntrySerializerKey<?, ?>) obj;\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null) {\r
-                return false;\r
-            }\r
-        } else if (!experimenterId.equals(other.experimenterId)) {\r
-            return false;\r
-        }\r
-        if (oxmClass == null) {\r
-            if (other.oxmClass != null) {\r
-                return false;\r
-            }\r
-        } else if (!oxmClass.equals(other.oxmClass)) {\r
-            return false;\r
-        }\r
-        if (oxmField == null) {\r
-            if (other.oxmField != null) {\r
-                return false;\r
-            }\r
-        } else if (!oxmField.equals(other.oxmField)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " oxm_class: " + oxmClass.getName() + " oxm_field: "\r
-                + oxmField.getName() + " experimenterID: " + experimenterId;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ * @param <OXM_CLASS> oxm_class (see specification)
+ * @param <OXM_FIELD> oxm_field (see specification)
+ */
+public final class MatchEntrySerializerKey<OXM_CLASS extends OxmClassBase, OXM_FIELD extends MatchField>
+        extends MessageTypeKey<MatchEntries> implements ExperimenterSerializerKey {
+
+    private Class<OXM_CLASS> oxmClass;
+    private Class<OXM_FIELD> oxmField;
+    private Long experimenterId;
+
+    /**
+     * @param msgVersion protocol wire version
+     * @param objectType class of serialized object
+     * @param oxmClass oxm_class (see specification)
+     * @param oxmField oxm_field (see specification)
+     */
+    public MatchEntrySerializerKey(short msgVersion, Class<OXM_CLASS> oxmClass,
+            Class<OXM_FIELD> oxmField) {
+        super(msgVersion, MatchEntries.class);
+        this.oxmClass = oxmClass;
+        this.oxmField = oxmField;
+    }
+
+    /**
+     * @param experimenterId experimenter / vendor ID
+     */
+    public void setExperimenterId(Long experimenterId) {
+        this.experimenterId = experimenterId;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+        result = prime * result + ((oxmClass == null) ? 0 : oxmClass.hashCode());
+        result = prime * result + ((oxmField == null) ? 0 : oxmField.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        MatchEntrySerializerKey<?, ?> other = (MatchEntrySerializerKey<?, ?>) obj;
+        if (experimenterId == null) {
+            if (other.experimenterId != null) {
+                return false;
+            }
+        } else if (!experimenterId.equals(other.experimenterId)) {
+            return false;
+        }
+        if (oxmClass == null) {
+            if (other.oxmClass != null) {
+                return false;
+            }
+        } else if (!oxmClass.equals(other.oxmClass)) {
+            return false;
+        }
+        if (oxmField == null) {
+            if (other.oxmField != null) {
+                return false;
+            }
+        } else if (!oxmField.equals(other.oxmField)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + " oxm_class: " + oxmClass.getName() + " oxm_field: "
+                + oxmField.getName() + " experimenterID: " + experimenterId;
+    }
 }
\ No newline at end of file
index b700f04b3ee949da1a8259e2c32fb90f0305a895..3b599b43430ea994a76d0a40ea531d21be33ef62 100644 (file)
@@ -1,29 +1,29 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ExperimenterActionDeserializerKey extends ActionDeserializerKey \r
-        implements ExperimenterDeserializerKey {\r
-\r
-    /**\r
-     * @param version protocol wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     */\r
-    public ExperimenterActionDeserializerKey(short version, Long experimenterId) {\r
-        super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);\r
-    }\r
-\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ExperimenterActionDeserializerKey extends ActionDeserializerKey 
+        implements ExperimenterDeserializerKey {
+
+    /**
+     * @param version protocol wire version
+     * @param experimenterId experimenter / vendor ID
+     */
+    public ExperimenterActionDeserializerKey(short version, Long experimenterId) {
+        super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);
+    }
+
 }
\ No newline at end of file
index 45b2d02aae405dfe5803872c45095ada2840a981..e5c9c8063e8eb234521fd18e88915573490c9cdd 100644 (file)
@@ -1,62 +1,62 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public final class ExperimenterActionSerializerKey extends ActionSerializerKey<Experimenter> \r
-        implements ExperimenterSerializerKey {\r
-\r
-    private Class<? extends ExperimenterActionSubType> actionSubType;\r
-\r
-    /**\r
-     * @param msgVersion protocol wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @param actionSubType vendor defined subtype\r
-     */\r
-    public ExperimenterActionSerializerKey(short msgVersion, Long experimenterId, Class<? extends ExperimenterActionSubType> actionSubType) {\r
-        super(msgVersion, Experimenter.class, experimenterId);\r
-        this.actionSubType = actionSubType;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + ((actionSubType == null) ? 0 : actionSubType.hashCode());\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        if (getClass() != obj.getClass()) {\r
-            return false;\r
-        }\r
-        ExperimenterActionSerializerKey other = (ExperimenterActionSerializerKey) obj;\r
-        if (actionSubType == null) {\r
-            if (other.actionSubType != null) {\r
-                return false;\r
-            }\r
-        } else if (!actionSubType.equals(other.actionSubType)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;
+
+/**
+ * @author michal.polkorab
+ */
+public final class ExperimenterActionSerializerKey extends ActionSerializerKey<Experimenter> 
+        implements ExperimenterSerializerKey {
+
+    private Class<? extends ExperimenterActionSubType> actionSubType;
+
+    /**
+     * @param msgVersion protocol wire version
+     * @param experimenterId experimenter / vendor ID
+     * @param actionSubType vendor defined subtype
+     */
+    public ExperimenterActionSerializerKey(short msgVersion, Long experimenterId, Class<? extends ExperimenterActionSubType> actionSubType) {
+        super(msgVersion, Experimenter.class, experimenterId);
+        this.actionSubType = actionSubType;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((actionSubType == null) ? 0 : actionSubType.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ExperimenterActionSerializerKey other = (ExperimenterActionSerializerKey) obj;
+        if (actionSubType == null) {
+            if (other.actionSubType != null) {
+                return false;
+            }
+        } else if (!actionSubType.equals(other.actionSubType)) {
+            return false;
+        }
+        return true;
+    }
 }
\ No newline at end of file
index 2b73858d3b3b828aae26f0a57a2e06aa1fa21d41..770a9162c1054d6ec3f54859d74851c5aa721fca 100644 (file)
@@ -1,17 +1,17 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-/**\r
- * Marker interface - marks keys appropriate for experimenter deserializer registration\r
- * @author michal.polkorab\r
- */\r
-public interface ExperimenterDeserializerKey {\r
-    // only empty marker interface - to ease extensions registration\r
-}\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+/**
+ * Marker interface - marks keys appropriate for experimenter deserializer registration
+ * @author michal.polkorab
+ */
+public interface ExperimenterDeserializerKey {
+    // only empty marker interface - to ease extensions registration
+}
index 1682d6d3405a85599b112e217352d2f22c8911a1..cb00362e068c8d727235e58527a25d2345e54e8e 100644 (file)
@@ -1,70 +1,70 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ExperimenterIdDeserializerKey extends MessageCodeKey \r
-        implements ExperimenterDeserializerKey {\r
-\r
-    private Long experimenterId;\r
-\r
-    /**\r
-     * @param version protocol wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @param objectClass class of created object\r
-     */\r
-    public <E extends DataObject> ExperimenterIdDeserializerKey(short version,\r
-            Long experimenterId, Class<E> objectClass) {\r
-        super(version, EncodeConstants.EXPERIMENTER_VALUE, objectClass);\r
-        this.experimenterId = experimenterId;\r
-    }\r
-\r
-    \r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        if (!(obj instanceof ExperimenterIdDeserializerKey)) {\r
-            return false;\r
-        }\r
-        ExperimenterIdDeserializerKey other = (ExperimenterIdDeserializerKey) obj;\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null) {\r
-                return false;\r
-            }\r
-        } else if (!experimenterId.equals(other.experimenterId)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " experimenterID: " + experimenterId;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ExperimenterIdDeserializerKey extends MessageCodeKey 
+        implements ExperimenterDeserializerKey {
+
+    private Long experimenterId;
+
+    /**
+     * @param version protocol wire version
+     * @param experimenterId experimenter / vendor ID
+     * @param objectClass class of created object
+     */
+    public <E extends DataObject> ExperimenterIdDeserializerKey(short version,
+            Long experimenterId, Class<E> objectClass) {
+        super(version, EncodeConstants.EXPERIMENTER_VALUE, objectClass);
+        this.experimenterId = experimenterId;
+    }
+
+    
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (!(obj instanceof ExperimenterIdDeserializerKey)) {
+            return false;
+        }
+        ExperimenterIdDeserializerKey other = (ExperimenterIdDeserializerKey) obj;
+        if (experimenterId == null) {
+            if (other.experimenterId != null) {
+                return false;
+            }
+        } else if (!experimenterId.equals(other.experimenterId)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + " experimenterID: " + experimenterId;
+    }
 }
\ No newline at end of file
index 2336e9a8390ee98ba033883a5eb33eedc3813242..1718246ce25e16586b6954bb5d18462b210a38e4 100644 (file)
@@ -1,68 +1,68 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <TYPE> class of object to be serialized\r
- */\r
-public class ExperimenterIdSerializerKey<TYPE extends DataObject> extends MessageTypeKey<TYPE>\r
-        implements ExperimenterSerializerKey {\r
-\r
-    private Long experimenterId;\r
-\r
-    /**\r
-     * @param msgVersion protocol wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @param objectClass class of object to be serialized\r
-     */\r
-    public ExperimenterIdSerializerKey(short msgVersion,\r
-            Long experimenterId, Class<TYPE> objectClass) {\r
-        super(msgVersion, objectClass);\r
-        this.experimenterId = experimenterId;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = super.hashCode();\r
-        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (!super.equals(obj)) {\r
-            return false;\r
-        }\r
-        if (!(obj instanceof ExperimenterIdSerializerKey)) {\r
-            return false;\r
-        }\r
-        ExperimenterIdSerializerKey<?> other = (ExperimenterIdSerializerKey<?>) obj;\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null) {\r
-                return false;\r
-            }\r
-        } else if (!experimenterId.equals(other.experimenterId)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " experimenterID: " + experimenterId;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author michal.polkorab
+ * @param <TYPE> class of object to be serialized
+ */
+public class ExperimenterIdSerializerKey<TYPE extends DataObject> extends MessageTypeKey<TYPE>
+        implements ExperimenterSerializerKey {
+
+    private Long experimenterId;
+
+    /**
+     * @param msgVersion protocol wire version
+     * @param experimenterId experimenter / vendor ID
+     * @param objectClass class of object to be serialized
+     */
+    public ExperimenterIdSerializerKey(short msgVersion,
+            Long experimenterId, Class<TYPE> objectClass) {
+        super(msgVersion, objectClass);
+        this.experimenterId = experimenterId;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (!(obj instanceof ExperimenterIdSerializerKey)) {
+            return false;
+        }
+        ExperimenterIdSerializerKey<?> other = (ExperimenterIdSerializerKey<?>) obj;
+        if (experimenterId == null) {
+            if (other.experimenterId != null) {
+                return false;
+            }
+        } else if (!experimenterId.equals(other.experimenterId)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + " experimenterID: " + experimenterId;
+    }
 }
\ No newline at end of file
index cfe995692ddad3b2f40daeec9177567687455c4b..b15a11732f8b17bfb2f5b09d1b8b744339411189 100644 (file)
@@ -1,29 +1,29 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ExperimenterInstructionDeserializerKey extends InstructionDeserializerKey\r
-        implements ExperimenterDeserializerKey {\r
-\r
-    /**\r
-     * @param version protocol wire version\r
-     * @param experimenterId \r
-     */\r
-    public ExperimenterInstructionDeserializerKey(short version, Long experimenterId) {\r
-        super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);\r
-    }\r
-\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ExperimenterInstructionDeserializerKey extends InstructionDeserializerKey
+        implements ExperimenterDeserializerKey {
+
+    /**
+     * @param version protocol wire version
+     * @param experimenterId 
+     */
+    public ExperimenterInstructionDeserializerKey(short version, Long experimenterId) {
+        super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);
+    }
+
 }
\ No newline at end of file
index 28201506eef02b8a3a8749d02637ee85eb6efd45..7d46b59089ca81d230de1593eda7b8378a23eb18 100644 (file)
@@ -1,28 +1,28 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public final class ExperimenterInstructionSerializerKey extends InstructionSerializerKey<Experimenter>\r
-        implements ExperimenterSerializerKey {\r
-\r
-    /**\r
-     * @param msgVersion protocol wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     */\r
-    public ExperimenterInstructionSerializerKey(short msgVersion, Long experimenterId) {\r
-        super(msgVersion, Experimenter.class, experimenterId);\r
-    }\r
-\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter;
+
+/**
+ * @author michal.polkorab
+ */
+public final class ExperimenterInstructionSerializerKey extends InstructionSerializerKey<Experimenter>
+        implements ExperimenterSerializerKey {
+
+    /**
+     * @param msgVersion protocol wire version
+     * @param experimenterId experimenter / vendor ID
+     */
+    public ExperimenterInstructionSerializerKey(short msgVersion, Long experimenterId) {
+        super(msgVersion, Experimenter.class, experimenterId);
+    }
+
 }
\ No newline at end of file
index a99990fec97494e23cf62c097af8b8d141633f94..8ce152bcb281b121ff887a3ba7d44f4d491236b3 100644 (file)
@@ -1,17 +1,17 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-/**\r
- * Marker interface - marks keys appropriate for experimenter serializer registration\r
- * @author michal.polkorab\r
- */\r
-public interface ExperimenterSerializerKey {\r
-    // only empty marker interface - to ease extensions registration\r
-}\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+/**
+ * Marker interface - marks keys appropriate for experimenter serializer registration
+ * @author michal.polkorab
+ */
+public interface ExperimenterSerializerKey {
+    // only empty marker interface - to ease extensions registration
+}
index 499e95c5211ae9913b7e04d78dcc92ae0695fcc0..3bc7558ed204f1c3b99db393c78067cc337683d6 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.api.util;\r
-\r
-/**\r
- * Stores oxm_match constants\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OxmMatchConstants {\r
-\r
-    /** Backward compatibility with NXM */\r
-    public static final int NXM_0_CLASS = 0x0000;\r
-    /** Backward compatibility with NXM */\r
-    public static final int NXM_1_CLASS = 0x0001;\r
-    /** Basic class for OpenFlow */\r
-    public static final int OPENFLOW_BASIC_CLASS = 0x8000;\r
-    /** Experimenter class */\r
-    public static final int EXPERIMENTER_CLASS = 0xFFFF;\r
-\r
-    /** Switch input port */\r
-    public static final int IN_PORT = 0;\r
-    /** Switch physical input port */\r
-    public static final int IN_PHY_PORT = 1;\r
-    /** Metadata passed between tables */\r
-    public static final int METADATA = 2;\r
-    /** Ethernet destination address */\r
-    public static final int ETH_DST = 3;\r
-    /** Ethernet source address */\r
-    public static final int ETH_SRC = 4;\r
-    /** Ethernet frame type */\r
-    public static final int ETH_TYPE = 5;\r
-    /** VLAN id. */\r
-    public static final int VLAN_VID = 6;\r
-    /** VLAN priority. */\r
-    public static final int VLAN_PCP = 7;\r
-    /** IP DSCP (6 bits in ToS field). */\r
-    public static final int IP_DSCP = 8;\r
-    /** IP ECN (2 bits in ToS field). */\r
-    public static final int IP_ECN = 9;\r
-    /** IP protocol. */\r
-    public static final int IP_PROTO = 10;\r
-    /** IPv4 source address. */\r
-    public static final int IPV4_SRC = 11;\r
-    /** IPv4 destination address. */\r
-    public static final int IPV4_DST = 12;\r
-    /** TCP source port. */\r
-    public static final int TCP_SRC = 13;\r
-    /** TCP destination port. */\r
-    public static final int TCP_DST = 14;\r
-    /** UDP source port. */\r
-    public static final int UDP_SRC = 15;\r
-    /** UDP destination port. */\r
-    public static final int UDP_DST = 16;\r
-    /** SCTP source port. */\r
-    public static final int SCTP_SRC = 17;\r
-    /** SCTP destination port. */\r
-    public static final int SCTP_DST = 18;\r
-    /** ICMP type. */\r
-    public static final int ICMPV4_TYPE = 19;\r
-    /** ICMP code. */\r
-    public static final int ICMPV4_CODE = 20;\r
-    /** ARP opcode. */\r
-    public static final int ARP_OP = 21;\r
-    /** ARP source IPv4 address. */\r
-    public static final int ARP_SPA = 22;\r
-    /** ARP target IPv4 address. */\r
-    public static final int ARP_TPA = 23;\r
-    /** ARP source hardware address. */\r
-    public static final int ARP_SHA = 24;\r
-    /** ARP target hardware address. */\r
-    public static final int ARP_THA = 25;\r
-    /** IPv6 source address. */\r
-    public static final int IPV6_SRC = 26;\r
-    /** IPv6 destination address. */\r
-    public static final int IPV6_DST = 27;\r
-    /** IPv6 Flow Label */\r
-    public static final int IPV6_FLABEL = 28;\r
-    /** ICMPv6 type. */\r
-    public static final int ICMPV6_TYPE = 29;\r
-    /** ICMPv6 code. */\r
-    public static final int ICMPV6_CODE = 30;\r
-    /** Target address for ND. */\r
-    public static final int IPV6_ND_TARGET = 31;\r
-    /** Source link-layer for ND. */\r
-    public static final int IPV6_ND_SLL = 32;\r
-    /** Target link-layer for ND. */\r
-    public static final int IPV6_ND_TLL = 33;\r
-    /** MPLS label. */\r
-    public static final int MPLS_LABEL = 34;\r
-    /** MPLS TC. */\r
-    public static final int MPLS_TC = 35;\r
-    /** MPLS BoS bit. */\r
-    public static final int MPLS_BOS = 36;\r
-    /** PBB I-SID. */\r
-    public static final int PBB_ISID = 37;\r
-    /** Logical Port Metadata. */\r
-    public static final int TUNNEL_ID = 38;\r
-    /** IPv6 Extension Header pseudo-field */\r
-    public static final int IPV6_EXTHDR = 39;\r
-\r
-    /**\r
-     * OFPXMC_NXM_1 class Constants\r
-     */\r
-\r
-    /** NXM IPv4 Tunnel Endpoint Source */\r
-    public static final int NXM_NX_TUN_IPV4_SRC = 31;\r
-    /** NXM IPv4 Tunnel Endpoint Destination */\r
-    public static final int NXM_NX_TUN_IPV4_DST = 32;\r
-    /** NXM TCP_Flag value */\r
-    public static final int NXM_NX_TCP_FLAG = 34;\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.util;
+
+/**
+ * Stores oxm_match constants
+ * @author michal.polkorab
+ *
+ */
+public abstract class OxmMatchConstants {
+
+    /** Backward compatibility with NXM */
+    public static final int NXM_0_CLASS = 0x0000;
+    /** Backward compatibility with NXM */
+    public static final int NXM_1_CLASS = 0x0001;
+    /** Basic class for OpenFlow */
+    public static final int OPENFLOW_BASIC_CLASS = 0x8000;
+    /** Experimenter class */
+    public static final int EXPERIMENTER_CLASS = 0xFFFF;
+
+    /** Switch input port */
+    public static final int IN_PORT = 0;
+    /** Switch physical input port */
+    public static final int IN_PHY_PORT = 1;
+    /** Metadata passed between tables */
+    public static final int METADATA = 2;
+    /** Ethernet destination address */
+    public static final int ETH_DST = 3;
+    /** Ethernet source address */
+    public static final int ETH_SRC = 4;
+    /** Ethernet frame type */
+    public static final int ETH_TYPE = 5;
+    /** VLAN id. */
+    public static final int VLAN_VID = 6;
+    /** VLAN priority. */
+    public static final int VLAN_PCP = 7;
+    /** IP DSCP (6 bits in ToS field). */
+    public static final int IP_DSCP = 8;
+    /** IP ECN (2 bits in ToS field). */
+    public static final int IP_ECN = 9;
+    /** IP protocol. */
+    public static final int IP_PROTO = 10;
+    /** IPv4 source address. */
+    public static final int IPV4_SRC = 11;
+    /** IPv4 destination address. */
+    public static final int IPV4_DST = 12;
+    /** TCP source port. */
+    public static final int TCP_SRC = 13;
+    /** TCP destination port. */
+    public static final int TCP_DST = 14;
+    /** UDP source port. */
+    public static final int UDP_SRC = 15;
+    /** UDP destination port. */
+    public static final int UDP_DST = 16;
+    /** SCTP source port. */
+    public static final int SCTP_SRC = 17;
+    /** SCTP destination port. */
+    public static final int SCTP_DST = 18;
+    /** ICMP type. */
+    public static final int ICMPV4_TYPE = 19;
+    /** ICMP code. */
+    public static final int ICMPV4_CODE = 20;
+    /** ARP opcode. */
+    public static final int ARP_OP = 21;
+    /** ARP source IPv4 address. */
+    public static final int ARP_SPA = 22;
+    /** ARP target IPv4 address. */
+    public static final int ARP_TPA = 23;
+    /** ARP source hardware address. */
+    public static final int ARP_SHA = 24;
+    /** ARP target hardware address. */
+    public static final int ARP_THA = 25;
+    /** IPv6 source address. */
+    public static final int IPV6_SRC = 26;
+    /** IPv6 destination address. */
+    public static final int IPV6_DST = 27;
+    /** IPv6 Flow Label */
+    public static final int IPV6_FLABEL = 28;
+    /** ICMPv6 type. */
+    public static final int ICMPV6_TYPE = 29;
+    /** ICMPv6 code. */
+    public static final int ICMPV6_CODE = 30;
+    /** Target address for ND. */
+    public static final int IPV6_ND_TARGET = 31;
+    /** Source link-layer for ND. */
+    public static final int IPV6_ND_SLL = 32;
+    /** Target link-layer for ND. */
+    public static final int IPV6_ND_TLL = 33;
+    /** MPLS label. */
+    public static final int MPLS_LABEL = 34;
+    /** MPLS TC. */
+    public static final int MPLS_TC = 35;
+    /** MPLS BoS bit. */
+    public static final int MPLS_BOS = 36;
+    /** PBB I-SID. */
+    public static final int PBB_ISID = 37;
+    /** Logical Port Metadata. */
+    public static final int TUNNEL_ID = 38;
+    /** IPv6 Extension Header pseudo-field */
+    public static final int IPV6_EXTHDR = 39;
+
+    /**
+     * OFPXMC_NXM_1 class Constants
+     */
+
+    /** NXM IPv4 Tunnel Endpoint Source */
+    public static final int NXM_NX_TUN_IPV4_SRC = 31;
+    /** NXM IPv4 Tunnel Endpoint Destination */
+    public static final int NXM_NX_TUN_IPV4_DST = 32;
+    /** NXM TCP_Flag value */
+    public static final int NXM_NX_TCP_FLAG = 34;
 }
\ No newline at end of file
index a2e69293ca6eb6c66e3e27a292ffbf4f7ff85bb1..9a5454165f7df43254e7f109d4d1e9e44da6edee 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
\r
- module openflow-augments {\r
-    namespace "urn:opendaylight:openflow:augments";\r
-    prefix "aug";\r
-    \r
-    import yang-ext {prefix ext;}\r
-    import ietf-inet-types {prefix inet;}\r
-    import ietf-yang-types {prefix yang;}\r
-\r
-    import openflow-types {prefix oft;}\r
-    import openflow-protocol {prefix ofproto;}\r
-    import openflow-action {prefix ofaction;}\r
-    import openflow-instruction {prefix ofinstruction;}\r
-    import openflow-extensible-match {prefix oxm;}\r
-\r
-    revision "2013-10-02" {\r
-        description "OpenFlow 1.3 - augments model. \r
-                    Please visit \r
-                    https://wiki.opendaylight.org/view/File:OpenFlow_Protocol_Library_-_Project_documentation.pdf\r
-                     - Augmentation Tables chapter";\r
-    }\r
-\r
-// OFP_MATCH AUGMENTS\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "port-number-match-entry";\r
-         leaf port-number {\r
-             type oft:port-number;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "metadata-match-entry";\r
-         leaf metadata {\r
-             type binary;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "mask-match-entry";\r
-         leaf mask {\r
-             type binary;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "mac-address-match-entry";\r
-         leaf mac-address {\r
-             type yang:mac-address;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "eth-type-match-entry";\r
-         leaf eth-type {\r
-             type oft:ether-type;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "vlan-vid-match-entry";\r
-         leaf vlan-vid {\r
-             type uint16;\r
-         }\r
-         leaf cfi-bit {\r
-             type boolean;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "vlan-pcp-match-entry";\r
-         leaf vlan-pcp {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "dscp-match-entry";\r
-         leaf dscp {\r
-             type inet:dscp;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "ecn-match-entry";\r
-         leaf ecn {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "protocol-number-match-entry";\r
-         leaf protocol-number {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "port-match-entry";\r
-         leaf port {\r
-             type inet:port-number;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "icmpv4-type-match-entry";\r
-         leaf icmpv4-type {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "icmpv4-code-match-entry";\r
-         leaf icmpv4-code {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "op-code-match-entry";\r
-         leaf op-code {\r
-             type uint16;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "ipv6-flabel-match-entry";\r
-         leaf ipv6-flabel {\r
-             type inet:ipv6-flow-label;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "icmpv6-type-match-entry";\r
-         leaf icmpv6-type {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "icmpv6-code-match-entry";\r
-         leaf icmpv6-code {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "ipv6-address-match-entry";\r
-         leaf ipv6-address {\r
-             type inet:ipv6-address;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "ipv4-address-match-entry";\r
-         leaf ipv4-address {\r
-             type inet:ipv4-address;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "mpls-label-match-entry";\r
-         leaf mpls-label {\r
-             type uint32;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "tc-match-entry";\r
-         leaf tc {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "bos-match-entry";\r
-         leaf bos {\r
-             type boolean;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "isid-match-entry";\r
-         leaf isid {\r
-             type uint32;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "pseudo-field-match-entry";\r
-         leaf pseudo-field {\r
-             type oft:ipv6-exthdr-flags;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "experimenter-id-match-entry";\r
-         leaf experimenter {\r
-             type oft:experimenter-id;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "tcp-flag-match-entry";\r
-         leaf tcp-flag {\r
-             type uint16;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "tunnel-ipv4-dst-match-entry";\r
-         leaf tunnel-ipv4-dst {\r
-             type inet:ipv4-address;\r
-         }\r
-     }\r
-     augment "/oxm:oxm-container/oxm:match-entries" {\r
-         ext:augment-identifier "tunnel-ipv4-src-match-entry";\r
-         leaf tunnel-ipv4-src {\r
-             type inet:ipv4-address;\r
-         }\r
-     }\r
-\r
-// OFP_ACTION AUGMENTS\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "port-action";\r
-         leaf port {\r
-             type oft:port-number;\r
-         }\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "max-length-action";\r
-         leaf max-length {\r
-             type uint16;\r
-         }\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "mpls-ttl-action";\r
-         leaf mpls-ttl {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "ethertype-action";\r
-         leaf ethertype {\r
-             type oft:ether-type;\r
-         }\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "queue-id-action";\r
-         leaf queue-id {\r
-             type uint32;\r
-         }\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "group-id-action";\r
-         leaf group-id {\r
-             type uint32;\r
-         }\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "nw-ttl-action";\r
-         leaf nw-ttl {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "oxm-fields-action";\r
-         uses oxm:oxm-fields-grouping;\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "experimenter-id-action";\r
-         leaf experimenter {\r
-             type oft:experimenter-id;\r
-         }\r
-         leaf sub-type {\r
-            type identityref {\r
-                base ofaction:experimenter-action-sub-type;\r
-            }\r
-         }\r
-     }\r
-     // OF1.0 structures\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "vlan-vid-action";\r
-         leaf vlan-vid {\r
-             type uint16;\r
-         }\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "vlan-pcp-action";\r
-         leaf vlan-pcp {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "dl-address-action";\r
-         leaf dl-address {\r
-             type yang:mac-address;\r
-         }\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "nw-tos-action";\r
-         leaf nw-tos {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/ofaction:actions-container/ofaction:action" {\r
-         ext:augment-identifier "ip-address-action";\r
-         leaf ip-address {\r
-             type inet:ipv4-address;\r
-         }\r
-     }\r
-\r
-// OFP_TABLE_FEATURES_PROPERTIES AUGMENTS\r
-     augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
-         ext:augment-identifier "instruction-related-table-feature-property";\r
-         uses ofinstruction:instructions-grouping;\r
-     }\r
-     augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
-         ext:augment-identifier "next-table-related-table-feature-property";\r
-         list next-table-ids {\r
-             config false;\r
-             leaf table-id {\r
-                 type uint8;\r
-             }\r
-         }\r
-     }\r
-     augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
-         ext:augment-identifier "action-related-table-feature-property";\r
-         uses ofaction:actions-grouping;\r
-     }\r
-     augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
-         ext:augment-identifier "oxm-related-table-feature-property";\r
-         uses oxm:oxm-fields-grouping;\r
-     }\r
-     augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
-         ext:augment-identifier "experimenter-id-table-feature-property";\r
-         leaf experimenter {\r
-             type oft:experimenter-id;\r
-         }\r
-         leaf exp-type {\r
-             type uint32;\r
-         }\r
-     }\r
-\r
-// OFP_INSTRUCTION AUGMENTS\r
-     augment "/ofinstruction:instruction-container/ofinstruction:instruction" {\r
-         ext:augment-identifier "table-id-instruction";\r
-         leaf table-id {\r
-             type uint8;\r
-         }\r
-     }\r
-     augment "/ofinstruction:instruction-container/ofinstruction:instruction" {\r
-         ext:augment-identifier "metadata-instruction";\r
-         leaf metadata {\r
-             type binary;\r
-         }\r
-         leaf metadata-mask {\r
-             type binary;\r
-         }\r
-     }\r
-     augment "/ofinstruction:instruction-container/ofinstruction:instruction" {\r
-         ext:augment-identifier "actions-instruction";\r
-         uses ofaction:actions-grouping;\r
-     }\r
-     augment "/ofinstruction:instruction-container/ofinstruction:instruction" {\r
-         ext:augment-identifier "meter-id-instruction";\r
-         leaf meter-id {\r
-             type uint32;\r
-         }\r
-     }\r
-     augment "/ofinstruction:instruction-container/ofinstruction:instruction" {\r
-         ext:augment-identifier "experimenter-id-instruction";\r
-         leaf experimenter {\r
-             type oft:experimenter-id;\r
-         }\r
-     }\r
-     \r
-// OFP_QUEUE_PROP AUGMENTS\r
-     augment "/ofproto:queue-prop-container/ofproto:queue-property" {\r
-         ext:augment-identifier "rate-queue-property";\r
-         leaf rate {\r
-             type uint16;\r
-         }\r
-     }\r
-     augment "/ofproto:queue-prop-container/ofproto:queue-property" {\r
-         ext:augment-identifier "experimenter-id-queue-property";\r
-         leaf experimenter {\r
-             type oft:experimenter-id;\r
-         }\r
-     }\r
-     \r
-// OFP_ERROR_AUGMENTS (only experimenter till OpenFlow v1.3)\r
-     augment "/ofproto:error-message" {\r
-         ext:augment-identifier "experimenter-id-error";\r
-         leaf experimenter {\r
-             type oft:experimenter-id;\r
-         }\r
-     }\r
-\r
-// OFP_MULTIPART AUGMENTS\r
-     augment "/ofproto:multipart-request/input/ofproto:multipart-request-body/ofproto:multipart-request-experimenter-case/ofproto:multipart-request-experimenter" {\r
-         ext:augment-identifier "experimenter-id-multipart-request";\r
-         leaf experimenter {\r
-             type oft:experimenter-id;\r
-         }\r
-         leaf exp-type {\r
-             type uint32;\r
-         }\r
-     }\r
-     augment "/ofproto:multipart-reply-message/ofproto:multipart-reply-body/ofproto:multipart-reply-experimenter-case/ofproto:multipart-reply-experimenter" {\r
-         ext:augment-identifier "experimenter-id-multipart-reply";\r
-         leaf experimenter {\r
-             type oft:experimenter-id;\r
-         }\r
-         leaf exp-type {\r
-             type uint32;\r
-         }\r
-     }\r
-\r
-// OFP_METER_BAND AUGMENTS\r
-     augment "/ofproto:meter-band-container/ofproto:meter-band/ofproto:meter-band-experimenter-case/ofproto:meter-band-experimenter" {\r
-         ext:augment-identifier "experimenter-id-meter-band";\r
-         leaf experimenter {\r
-             type oft:experimenter-id;\r
-         }\r
-     }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+ module openflow-augments {
+    namespace "urn:opendaylight:openflow:augments";
+    prefix "aug";
+    
+    import yang-ext {prefix ext;}
+    import ietf-inet-types {prefix inet;}
+    import ietf-yang-types {prefix yang;}
+
+    import openflow-types {prefix oft;}
+    import openflow-protocol {prefix ofproto;}
+    import openflow-action {prefix ofaction;}
+    import openflow-instruction {prefix ofinstruction;}
+    import openflow-extensible-match {prefix oxm;}
+
+    revision "2013-10-02" {
+        description "OpenFlow 1.3 - augments model. 
+                    Please visit 
+                    https://wiki.opendaylight.org/view/File:OpenFlow_Protocol_Library_-_Project_documentation.pdf
+                     - Augmentation Tables chapter";
+    }
+
+// OFP_MATCH AUGMENTS
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "port-number-match-entry";
+         leaf port-number {
+             type oft:port-number;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "metadata-match-entry";
+         leaf metadata {
+             type binary;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "mask-match-entry";
+         leaf mask {
+             type binary;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "mac-address-match-entry";
+         leaf mac-address {
+             type yang:mac-address;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "eth-type-match-entry";
+         leaf eth-type {
+             type oft:ether-type;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "vlan-vid-match-entry";
+         leaf vlan-vid {
+             type uint16;
+         }
+         leaf cfi-bit {
+             type boolean;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "vlan-pcp-match-entry";
+         leaf vlan-pcp {
+             type uint8;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "dscp-match-entry";
+         leaf dscp {
+             type inet:dscp;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "ecn-match-entry";
+         leaf ecn {
+             type uint8;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "protocol-number-match-entry";
+         leaf protocol-number {
+             type uint8;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "port-match-entry";
+         leaf port {
+             type inet:port-number;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "icmpv4-type-match-entry";
+         leaf icmpv4-type {
+             type uint8;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "icmpv4-code-match-entry";
+         leaf icmpv4-code {
+             type uint8;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "op-code-match-entry";
+         leaf op-code {
+             type uint16;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "ipv6-flabel-match-entry";
+         leaf ipv6-flabel {
+             type inet:ipv6-flow-label;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "icmpv6-type-match-entry";
+         leaf icmpv6-type {
+             type uint8;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "icmpv6-code-match-entry";
+         leaf icmpv6-code {
+             type uint8;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "ipv6-address-match-entry";
+         leaf ipv6-address {
+             type inet:ipv6-address;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "ipv4-address-match-entry";
+         leaf ipv4-address {
+             type inet:ipv4-address;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "mpls-label-match-entry";
+         leaf mpls-label {
+             type uint32;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "tc-match-entry";
+         leaf tc {
+             type uint8;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "bos-match-entry";
+         leaf bos {
+             type boolean;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "isid-match-entry";
+         leaf isid {
+             type uint32;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "pseudo-field-match-entry";
+         leaf pseudo-field {
+             type oft:ipv6-exthdr-flags;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "experimenter-id-match-entry";
+         leaf experimenter {
+             type oft:experimenter-id;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "tcp-flag-match-entry";
+         leaf tcp-flag {
+             type uint16;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "tunnel-ipv4-dst-match-entry";
+         leaf tunnel-ipv4-dst {
+             type inet:ipv4-address;
+         }
+     }
+     augment "/oxm:oxm-container/oxm:match-entries" {
+         ext:augment-identifier "tunnel-ipv4-src-match-entry";
+         leaf tunnel-ipv4-src {
+             type inet:ipv4-address;
+         }
+     }
+
+// OFP_ACTION AUGMENTS
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "port-action";
+         leaf port {
+             type oft:port-number;
+         }
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "max-length-action";
+         leaf max-length {
+             type uint16;
+         }
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "mpls-ttl-action";
+         leaf mpls-ttl {
+             type uint8;
+         }
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "ethertype-action";
+         leaf ethertype {
+             type oft:ether-type;
+         }
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "queue-id-action";
+         leaf queue-id {
+             type uint32;
+         }
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "group-id-action";
+         leaf group-id {
+             type uint32;
+         }
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "nw-ttl-action";
+         leaf nw-ttl {
+             type uint8;
+         }
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "oxm-fields-action";
+         uses oxm:oxm-fields-grouping;
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "experimenter-id-action";
+         leaf experimenter {
+             type oft:experimenter-id;
+         }
+         leaf sub-type {
+            type identityref {
+                base ofaction:experimenter-action-sub-type;
+            }
+         }
+     }
+     // OF1.0 structures
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "vlan-vid-action";
+         leaf vlan-vid {
+             type uint16;
+         }
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "vlan-pcp-action";
+         leaf vlan-pcp {
+             type uint8;
+         }
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "dl-address-action";
+         leaf dl-address {
+             type yang:mac-address;
+         }
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "nw-tos-action";
+         leaf nw-tos {
+             type uint8;
+         }
+     }
+     augment "/ofaction:actions-container/ofaction:action" {
+         ext:augment-identifier "ip-address-action";
+         leaf ip-address {
+             type inet:ipv4-address;
+         }
+     }
+
+// OFP_TABLE_FEATURES_PROPERTIES AUGMENTS
+     augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {
+         ext:augment-identifier "instruction-related-table-feature-property";
+         uses ofinstruction:instructions-grouping;
+     }
+     augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {
+         ext:augment-identifier "next-table-related-table-feature-property";
+         list next-table-ids {
+             config false;
+             leaf table-id {
+                 type uint8;
+             }
+         }
+     }
+     augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {
+         ext:augment-identifier "action-related-table-feature-property";
+         uses ofaction:actions-grouping;
+     }
+     augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {
+         ext:augment-identifier "oxm-related-table-feature-property";
+         uses oxm:oxm-fields-grouping;
+     }
+     augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {
+         ext:augment-identifier "experimenter-id-table-feature-property";
+         leaf experimenter {
+             type oft:experimenter-id;
+         }
+         leaf exp-type {
+             type uint32;
+         }
+     }
+
+// OFP_INSTRUCTION AUGMENTS
+     augment "/ofinstruction:instruction-container/ofinstruction:instruction" {
+         ext:augment-identifier "table-id-instruction";
+         leaf table-id {
+             type uint8;
+         }
+     }
+     augment "/ofinstruction:instruction-container/ofinstruction:instruction" {
+         ext:augment-identifier "metadata-instruction";
+         leaf metadata {
+             type binary;
+         }
+         leaf metadata-mask {
+             type binary;
+         }
+     }
+     augment "/ofinstruction:instruction-container/ofinstruction:instruction" {
+         ext:augment-identifier "actions-instruction";
+         uses ofaction:actions-grouping;
+     }
+     augment "/ofinstruction:instruction-container/ofinstruction:instruction" {
+         ext:augment-identifier "meter-id-instruction";
+         leaf meter-id {
+             type uint32;
+         }
+     }
+     augment "/ofinstruction:instruction-container/ofinstruction:instruction" {
+         ext:augment-identifier "experimenter-id-instruction";
+         leaf experimenter {
+             type oft:experimenter-id;
+         }
+     }
+     
+// OFP_QUEUE_PROP AUGMENTS
+     augment "/ofproto:queue-prop-container/ofproto:queue-property" {
+         ext:augment-identifier "rate-queue-property";
+         leaf rate {
+             type uint16;
+         }
+     }
+     augment "/ofproto:queue-prop-container/ofproto:queue-property" {
+         ext:augment-identifier "experimenter-id-queue-property";
+         leaf experimenter {
+             type oft:experimenter-id;
+         }
+     }
+     
+// OFP_ERROR_AUGMENTS (only experimenter till OpenFlow v1.3)
+     augment "/ofproto:error-message" {
+         ext:augment-identifier "experimenter-id-error";
+         leaf experimenter {
+             type oft:experimenter-id;
+         }
+     }
+
+// OFP_MULTIPART AUGMENTS
+     augment "/ofproto:multipart-request/input/ofproto:multipart-request-body/ofproto:multipart-request-experimenter-case/ofproto:multipart-request-experimenter" {
+         ext:augment-identifier "experimenter-id-multipart-request";
+         leaf experimenter {
+             type oft:experimenter-id;
+         }
+         leaf exp-type {
+             type uint32;
+         }
+     }
+     augment "/ofproto:multipart-reply-message/ofproto:multipart-reply-body/ofproto:multipart-reply-experimenter-case/ofproto:multipart-reply-experimenter" {
+         ext:augment-identifier "experimenter-id-multipart-reply";
+         leaf experimenter {
+             type oft:experimenter-id;
+         }
+         leaf exp-type {
+             type uint32;
+         }
+     }
+
+// OFP_METER_BAND AUGMENTS
+     augment "/ofproto:meter-band-container/ofproto:meter-band/ofproto:meter-band-experimenter-case/ofproto:meter-band-experimenter" {
+         ext:augment-identifier "experimenter-id-meter-band";
+         leaf experimenter {
+             type oft:experimenter-id;
+         }
+     }
 }
\ No newline at end of file
index 8a1f8bbc42d70c810b606a6bb03c9eb53bbdb188..38d8d58b26e2cd51acc651d922bc39c98c88a47c 100644 (file)
@@ -1,59 +1,59 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
\r
- module openflow-configuration {\r
-    namespace "urn:opendaylight:openflow:config";\r
-    prefix "of-config";\r
-\r
-    revision "2014-06-30" {\r
-        description "Library configuration classes";\r
-    }\r
-\r
-    typedef path-type {\r
-        type enumeration {\r
-            enum CLASSPATH {\r
-                value 0; \r
-                description "Keystore file is located on classpath.";\r
-            }\r
-            enum PATH {\r
-                value 1; \r
-                description "Keystore file is located on absolute or relative path.";\r
-            }\r
-        }\r
-    }\r
-\r
-    typedef keystore-type {\r
-        type enumeration {\r
-            enum JKS {\r
-                value 0; \r
-                description "Keystore type - JKS.";\r
-            }\r
-            enum PKCS12 {\r
-                value 1; \r
-                description "Keystore type - PKCS12.";\r
-            }\r
-        }\r
-    }\r
-\r
-    typedef transport-protocol {\r
-        type enumeration {\r
-            enum TCP {\r
-                value 0;\r
-                description "Communication over TCP protocol.";\r
-            }\r
-            enum TLS {\r
-                value 1;\r
-                description "Communication over TLS protocol.";\r
-            }\r
-            enum UDP {\r
-                value 2;\r
-                description "Communication over UDP protocol.";\r
-            }\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+ module openflow-configuration {
+    namespace "urn:opendaylight:openflow:config";
+    prefix "of-config";
+
+    revision "2014-06-30" {
+        description "Library configuration classes";
+    }
+
+    typedef path-type {
+        type enumeration {
+            enum CLASSPATH {
+                value 0; 
+                description "Keystore file is located on classpath.";
+            }
+            enum PATH {
+                value 1; 
+                description "Keystore file is located on absolute or relative path.";
+            }
+        }
+    }
+
+    typedef keystore-type {
+        type enumeration {
+            enum JKS {
+                value 0; 
+                description "Keystore type - JKS.";
+            }
+            enum PKCS12 {
+                value 1; 
+                description "Keystore type - PKCS12.";
+            }
+        }
+    }
+
+    typedef transport-protocol {
+        type enumeration {
+            enum TCP {
+                value 0;
+                description "Communication over TCP protocol.";
+            }
+            enum TLS {
+                value 1;
+                description "Communication over TLS protocol.";
+            }
+            enum UDP {
+                value 2;
+                description "Communication over UDP protocol.";
+            }
+        }
+    }
 }
\ No newline at end of file
index 32070d14cf900c973825c3fe47985df02d7e7e3a..9330fac6fd5fbdd4f9f0305d7cbc8e5b33ca78a3 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
\r
- module openflow-protocol {\r
-    namespace "urn:opendaylight:openflow:protocol";\r
-    prefix "ofproto";\r
-\r
-    import ietf-yang-types {prefix yang;}\r
-    \r
-    import openflow-types {prefix oft;}\r
-    import openflow-extensible-match { prefix oxm;}\r
-    import openflow-instruction { prefix ofinstruction;}\r
-    import openflow-action {prefix ofaction;}\r
-\r
-    revision "2013-07-31" {\r
-        description "OpenFlow 1.3 - protocol objects model";\r
-    }\r
-\r
-    // Generic Structures\r
-        grouping port-grouping {\r
-            reference "ofp_port";\r
-            leaf port-no {\r
-                type uint32;\r
-            }\r
-            leaf hw-addr {\r
-                type yang:mac-address;\r
-            }\r
-            leaf name {\r
-                type string;\r
-            }\r
-            leaf config {\r
-                description "Bitmap of OFPPC_* flags.";\r
-                type oft:port-config;\r
-            }\r
-            leaf state {\r
-                description "Bitmap of OFPPS_* flags.";\r
-                type oft:port-state;\r
-            }\r
-            leaf current-features {\r
-                description "Current features.";\r
-                type oft:port-features;\r
-            }\r
-            leaf advertised-features {\r
-                description "Features being advertised by the port.";\r
-                type oft:port-features;\r
-            }\r
-            leaf supported-features {\r
-                description "Features supported by the port.";\r
-                type oft:port-features;\r
-            }\r
-            leaf peer-features {\r
-                description "Features advertised by peer.";\r
-                type oft:port-features; \r
-            }\r
-            leaf curr-speed {\r
-                description "Current port bitrate in kbps.";\r
-                type uint32;\r
-                units "kbps";\r
-            }\r
-            leaf max-speed {\r
-                description "Max port bitrate in kbps";\r
-                type uint32;\r
-                units "kbps";\r
-            }\r
-\r
-            // OF1.0 structures\r
-            leaf config-v10 {\r
-                type oft:port-config-v10;\r
-            }\r
-            leaf state-v10 { \r
-                type oft:port-state-v10;\r
-            }\r
-            leaf current-features-v10 {\r
-                description "Current features.";\r
-                type oft:port-features-v10;\r
-            }\r
-            leaf advertised-features-v10 {\r
-                description "Features being advertised by the port.";\r
-                type oft:port-features-v10;\r
-            }\r
-            leaf supported-features-v10 {\r
-                description "Features supported by the port.";\r
-                type oft:port-features-v10;\r
-            }\r
-            leaf peer-features-v10 { \r
-                description "Features advertised by peer.";\r
-                type oft:port-features-v10; \r
-            }\r
-        }\r
-\r
-        grouping buckets-grouping {\r
-                list buckets-list {\r
-                    uses bucket-grouping;\r
-                }\r
-            }\r
-\r
-            grouping bucket-grouping {\r
-                description "Bucket for use in groups.";\r
-                leaf weight {\r
-                    description "Relative weight of bucket. Only\r
-                                defined for select groups.";\r
-                    type uint16;\r
-                }\r
-                leaf watch-port {\r
-                    description "Port whose state affects whether this\r
-                                bucket is live. Only required for fast\r
-                                failover groups.";\r
-                    type oft:port-number;\r
-                }\r
-                leaf watch-group {\r
-                    description "Group whose state affects whether this\r
-                                bucket is live. Only required for fast\r
-                                failover groups.";\r
-                    type uint32;\r
-                }\r
-\r
-                uses ofaction:actions-grouping;\r
-            }\r
-            \r
-        container table-features-properties-container {\r
-            uses table-features-properties-grouping;\r
-        }\r
-\r
-        grouping table-features-properties-grouping {\r
-            list table-feature-properties {\r
-                config false;\r
-                leaf type {\r
-                    type oft:table-features-prop-type;\r
-                }\r
-            }\r
-        }\r
-\r
-    // # MESSAGE Structures\r
-        /* Immutable messages. */\r
-            grouping ofHeader {\r
-                reference "ofp_header struct in Openflow Switch 1.3 Spec";\r
-                leaf version {\r
-                    type uint8;\r
-                    description "OpenFlow version";\r
-                }\r
-                leaf xid {\r
-                    type uint32;\r
-                    description "Transaction ID";\r
-                }\r
-            }\r
-            grouping ofHelloElementHeader {\r
-                reference "ofpt_hello_elem_header struct in Openflow Switch 1.3 Spec";\r
-                leaf type {\r
-                    type oft:hello-element-type;\r
-                    //reference "OpenFlow Header element type - OFPHET_*";\r
-                }\r
-            }\r
-            grouping hello {\r
-                reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";\r
-                /* Symmetric message */\r
-                uses ofHeader;\r
-                \r
-                list elements {\r
-                    uses ofHelloElementHeader;\r
-                    \r
-                    leaf-list version-bitmap {\r
-                        type boolean;\r
-                    }\r
-                }\r
-            }\r
-            grouping error {\r
-                reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";\r
-                /* Symmetric message */\r
-                uses ofHeader;\r
-                \r
-                leaf type {\r
-                    type uint16;\r
-                }\r
-                leaf code {\r
-                    type uint16;\r
-                }\r
-                leaf type-string {\r
-                    type string;\r
-                }\r
-                leaf code-string {\r
-                    type string;\r
-                }\r
-                leaf data {\r
-                    type binary; \r
-                }\r
-            }\r
-            grouping echo-request {\r
-                reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";\r
-                /* Symmetric message */\r
-                uses ofHeader;\r
-                \r
-                leaf data {\r
-                    type binary;\r
-                }\r
-            }\r
-            grouping echo-reply {\r
-                reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec";\r
-                /* Symmetric message */\r
-                uses ofHeader;\r
-                \r
-                leaf data {\r
-                    type binary;\r
-                }\r
-            }\r
-            grouping experimenter {\r
-                reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";\r
-                /* Symmetric message */\r
-                uses ofHeader;\r
-                \r
-                leaf experimenter {\r
-                    type oft:experimenter-id;\r
-                }\r
-                leaf exp_type {\r
-                    type uint32;\r
-                }\r
-            }\r
-        /* Switch configuration messages. */\r
-            grouping features-request {\r
-                reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                uses ofHeader;\r
-            }\r
-            grouping features-reply {\r
-                reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                uses ofHeader;\r
-                \r
-                leaf datapathId {\r
-                    type uint64;\r
-                }\r
-                leaf buffers {\r
-                    type uint32;\r
-                }\r
-                leaf tables {\r
-                    type uint8;\r
-                }\r
-                leaf auxiliaryId {\r
-                    type uint8;\r
-                }\r
-                leaf capabilities {\r
-                    type oft:capabilities;\r
-                }\r
-                leaf reserved {\r
-                    type uint32;\r
-                }\r
-                // OF1.0 structures\r
-                leaf capabilities-v10 {\r
-                    type oft:capabilities-v10;\r
-                }\r
-                leaf actions-v10 {\r
-                    type oft:action-type-v10;\r
-                }\r
-                list phy-port {\r
-                    uses port-grouping;\r
-                }\r
-            }\r
-            grouping get-config-request {\r
-                reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                uses ofHeader;\r
-            }\r
-            grouping get-config-reply {\r
-                reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                uses ofHeader;\r
-                \r
-                leaf flags {\r
-                    type oft:switch-config-flag;\r
-                }\r
-                leaf miss-send-len {\r
-                    type uint16;\r
-                }\r
-            }\r
-            grouping set-config {\r
-                reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                \r
-                uses ofHeader;\r
-                \r
-                leaf flags {\r
-                    type oft:switch-config-flag;\r
-                }\r
-                leaf miss-send-len {\r
-                    type uint16;\r
-                }\r
-            }\r
-        /* Asynchronous messages. */\r
-            grouping packet-in {\r
-                reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec";\r
-                /* Async message */\r
-                \r
-                uses ofHeader;\r
-                \r
-                leaf buffer-id {\r
-                    // ID assigned by datapath.\r
-                    type uint32;\r
-                }\r
-                leaf total-len {\r
-                    // Full length of frame.\r
-                    type uint16;\r
-                }\r
-                leaf reason {\r
-                    // Reason packet is being sent (one of OFPR_*) \r
-                    type oft:packet-in-reason;\r
-                }\r
-                leaf table-id {\r
-                    // ID of the table that was looked up\r
-                    type oft:table-id;\r
-                }\r
-                leaf cookie {\r
-                    // Cookie of the flow entry that was looked up.\r
-                    type uint64;\r
-                }\r
-                uses oxm:match-grouping;\r
-\r
-                leaf data {\r
-                    type binary;\r
-                }\r
-                \r
-                // OF1.0 structures\r
-                leaf in-port {\r
-                    type uint16;\r
-                }\r
-            }\r
-            grouping flow-removed {\r
-                reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec";\r
-                /* Async message */\r
-                uses ofHeader;\r
-                \r
-                leaf cookie {\r
-                    type uint64;\r
-                }\r
-                leaf priority {\r
-                    type uint16;\r
-                }\r
-                leaf reason {\r
-                    type oft:flow-removed-reason;\r
-                }\r
-                leaf table-id {\r
-                    type oft:table-id;\r
-                }\r
-                leaf duration-sec {\r
-                    type uint32;\r
-                }\r
-                leaf duration-nsec {\r
-                    type uint32;\r
-                }\r
-                leaf idle-timeout {\r
-                    type uint16;\r
-                }\r
-                leaf hard-timeout {\r
-                    type uint16;\r
-                }\r
-                leaf packet-count {\r
-                    type uint64;\r
-                }\r
-                leaf byte-count {\r
-                    type uint64;\r
-                }\r
-                uses oxm:match-grouping;\r
-                \r
-                // OF1.0 structures\r
-                uses oxm:match-v10-grouping;\r
-            } \r
-            grouping port-status {\r
-                reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec";\r
-                \r
-                uses ofHeader;\r
-                \r
-                uses port-grouping;\r
-                \r
-                leaf reason {\r
-                    type oft:port-reason;\r
-                }\r
-            }\r
-        /* Controller command messages. */\r
-            grouping packet-out {\r
-                reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                \r
-                uses ofHeader;\r
-                \r
-                uses ofaction:actions-grouping;\r
-                \r
-                leaf data {\r
-                    type binary;\r
-                }\r
-                leaf buffer-id {\r
-                    type uint32;\r
-                }\r
-                leaf in-port {\r
-                    type oft:port-number;\r
-                }\r
-            } \r
-            grouping flow-mod {\r
-                reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                \r
-                uses ofHeader;\r
-                \r
-                leaf cookie {\r
-                    type uint64;\r
-                }\r
-                leaf cookie-mask {\r
-                    type uint64;\r
-                }\r
-                leaf table-id {\r
-                    type oft:table-id;\r
-                }\r
-                leaf command {\r
-                    type oft:flow-mod-command;\r
-                }\r
-                leaf idle-timeout {\r
-                    type uint16;\r
-                }\r
-                leaf hard-timeout {\r
-                    type uint16;\r
-                }\r
-                leaf priority {\r
-                    type uint16;\r
-                }\r
-                leaf buffer-id {\r
-                    type uint32;\r
-                }\r
-                leaf out-port {\r
-                    type oft:port-number;\r
-                }\r
-                leaf out-group {\r
-                    type uint32;\r
-                }\r
-                leaf flags {\r
-                    type oft:flow-mod-flags;\r
-                }\r
-                uses oxm:match-grouping;\r
-                \r
-                uses ofinstruction:instructions-grouping;\r
-                \r
-                // OF1.0 structures\r
-                leaf flags-v10 {\r
-                    type oft:flow-mod-flags-v10;\r
-                }\r
-                uses oxm:match-v10-grouping;\r
-                uses ofaction:actions-grouping;\r
-            } \r
-            grouping group-mod {\r
-                reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                \r
-                uses ofHeader;\r
-                \r
-                leaf command {\r
-                    type oft:group-mod-command;\r
-                }\r
-                leaf type {\r
-                    type oft:group-type;\r
-                }\r
-                leaf group-id {\r
-                    type oft:group-id;\r
-                }\r
-                \r
-                uses buckets-grouping;\r
-            }\r
-            \r
-            grouping port-mod {\r
-                reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-\r
-                uses ofHeader;\r
-                \r
-                leaf port-no {\r
-                    type oft:port-number;\r
-                }\r
-                leaf hw-address {\r
-                    type yang:mac-address;\r
-                }       \r
-                leaf config {\r
-                    type oft:port-config;\r
-                }   \r
-                leaf mask {\r
-                    type oft:port-config;\r
-                }\r
-                leaf advertise {\r
-                    type oft:port-features;\r
-                }\r
-                // OF1.0 structures\r
-                leaf config-v10 {\r
-                    type oft:port-config-v10;\r
-                }\r
-                leaf mask-v10 {\r
-                    type oft:port-config-v10;\r
-                }\r
-                leaf advertise-v10 {\r
-                    type oft:port-features-v10;\r
-                }\r
-            } \r
-            grouping table-mod {\r
-                reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-\r
-                uses ofHeader;\r
-                \r
-                leaf table-id {\r
-                    type oft:table-id;\r
-                }\r
-                leaf config {\r
-                    type oft:table-config;\r
-                }\r
-            } \r
-            \r
-        /* Multipart messages. */\r
-            grouping multipart-request {\r
-                reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-\r
-                uses ofHeader;\r
-                \r
-                leaf type {\r
-                    type oft:multipart-type;\r
-                }\r
-                leaf flags {\r
-                    type oft:multipart-request-flags;\r
-                }\r
-                choice multipart-request-body {\r
-                    case multipart-request-desc-case {\r
-                        container multipart-request-desc {\r
-                            leaf empty {\r
-                                type empty;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-flow-case {\r
-                        container multipart-request-flow {\r
-                            leaf table-id {\r
-                                type uint8;\r
-                            }\r
-                            leaf out-port {\r
-                                type uint32;\r
-                            }\r
-                            leaf out-group {\r
-                                type uint32;\r
-                            }\r
-                            leaf cookie {\r
-                                type uint64;\r
-                            }\r
-                            leaf cookie-mask {\r
-                                type uint64;\r
-                            }\r
-                            uses oxm:match-grouping;\r
-                            \r
-                            // OF1.0 structures\r
-                            uses oxm:match-v10-grouping;\r
-                        }\r
-                    }\r
-                    case multipart-request-aggregate-case {\r
-                        container multipart-request-aggregate {\r
-                            leaf table-id {\r
-                                type uint8;\r
-                            }\r
-                            leaf out-port {\r
-                                type uint32;\r
-                            }\r
-                            leaf out-group {\r
-                                type uint32;\r
-                            }\r
-                            leaf cookie {\r
-                                type uint64;\r
-                            }\r
-                            leaf cookie-mask {\r
-                                type uint64;\r
-                            }\r
-                            uses oxm:match-grouping;\r
-                            \r
-                            // OF1.0 structures\r
-                            uses oxm:match-v10-grouping;\r
-                        }\r
-                    }\r
-                    case multipart-request-table-case {\r
-                        container multipart-request-table {\r
-                            leaf empty {\r
-                                type empty;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-port-stats-case {\r
-                        container multipart-request-port-stats {\r
-                            leaf port-no {\r
-                                type uint32;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-queue-case {\r
-                        container multipart-request-queue {\r
-                            leaf port-no {\r
-                                type uint32;\r
-                            }\r
-                            leaf queue-id {\r
-                                type uint32;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-group-case {\r
-                        container multipart-request-group {\r
-                            leaf group-id {\r
-                                type oft:group-id;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-group-desc-case {\r
-                        container multipart-request-group-desc {\r
-                            leaf empty {\r
-                                type empty;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-group-features-case {\r
-                        container multipart-request-group-features {\r
-                            leaf empty {\r
-                                type empty;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-meter-case {\r
-                        container multipart-request-meter {\r
-                            leaf meter-id {\r
-                                type oft:meter-id;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-meter-config-case {\r
-                        container multipart-request-meter-config {\r
-                            leaf meter-id {\r
-                                type oft:meter-id;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-meter-features-case {\r
-                        container multipart-request-meter-features {\r
-                            leaf empty {\r
-                                type empty;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-table-features-case {\r
-                        container multipart-request-table-features {\r
-                            list table-features {\r
-                                leaf table-id {\r
-                                    type uint8;\r
-                                }\r
-                                leaf name {\r
-                                    type string;\r
-                                }\r
-                                leaf metadata-match {\r
-                                    type uint64;\r
-                                }\r
-                                leaf metadata-write {\r
-                                    type uint64;\r
-                                }\r
-                                leaf config {\r
-                                    type oft:table-config;\r
-                                }\r
-                                leaf max-entries {\r
-                                    type uint32;\r
-                                }\r
-                                uses table-features-properties-grouping;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-port-desc-case {\r
-                        container multipart-request-port-desc {\r
-                            leaf empty {\r
-                                type empty;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-request-experimenter-case {\r
-                        container multipart-request-experimenter {\r
-                            // empty body - used for experimenter augmentation\r
-                        }\r
-                    }\r
-                }\r
-            } \r
-            grouping multipart-reply {\r
-                reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-\r
-                uses ofHeader;\r
-                \r
-                leaf type {\r
-                    type oft:multipart-type;\r
-                }\r
-                leaf flags {\r
-                    type oft:multipart-request-flags;\r
-                }\r
-                choice multipart-reply-body {\r
-                    case multipart-reply-desc-case {\r
-                        container multipart-reply-desc {\r
-                            leaf mfr_desc {\r
-                                type string;\r
-                            }\r
-                            leaf hw_desc {\r
-                                type string;\r
-                            }\r
-                            leaf sw_desc {\r
-                                type string;\r
-                            }\r
-                            leaf serial_num {\r
-                                type string;\r
-                            }\r
-                            leaf dp_desc {\r
-                                type string;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-flow-case {\r
-                        container multipart-reply-flow {\r
-                            list flow-stats {\r
-                                leaf table-id {\r
-                                    type uint8;\r
-                                }\r
-                                leaf duration-sec {\r
-                                    type uint32;\r
-                                }\r
-                                leaf duration-nsec {\r
-                                    type uint32;\r
-                                }\r
-                                leaf priority {\r
-                                    type uint16;\r
-                                }\r
-                                leaf idle-timeout {\r
-                                    type uint16;\r
-                                }\r
-                                leaf hard-timeout {\r
-                                    type uint16;\r
-                                }\r
-                                leaf flags {\r
-                                    type oft:flow-mod-flags;\r
-                                }\r
-                                leaf cookie {\r
-                                    type uint64;\r
-                                }\r
-                                leaf packet-count {\r
-                                    type uint64;\r
-                                }\r
-                                leaf byte-count {\r
-                                    type uint64;\r
-                                }\r
-                                uses oxm:match-grouping;\r
-                                \r
-                                uses ofinstruction:instructions-grouping;\r
-                                \r
-                                // OF1.0 structures\r
-                                uses oxm:match-v10-grouping;\r
-                                uses ofaction:actions-grouping;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-aggregate-case {\r
-                        container multipart-reply-aggregate {\r
-                            leaf packet-count {\r
-                                type uint64;\r
-                            }\r
-                            leaf byte-count {\r
-                                type uint64;\r
-                            }\r
-                            leaf flow-count {\r
-                                type uint32;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-table-case {\r
-                        container multipart-reply-table {\r
-                            list table-stats {\r
-                                leaf table-id {\r
-                                    type uint8;\r
-                                }\r
-                                leaf active-count {\r
-                                    type uint32;\r
-                                }\r
-                                leaf lookup-count {\r
-                                    type uint64;\r
-                                }\r
-                                leaf matched-count {\r
-                                    type uint64;\r
-                                }\r
-                                \r
-                                // OF1.0 structures\r
-                                leaf name {\r
-                                    type string;\r
-                                }\r
-                                leaf wildcards {\r
-                                    type oft:flow-wildcards-v10;\r
-                                }\r
-                                leaf nw-src-mask {\r
-                                    type uint8;\r
-                                }\r
-                                leaf nw-dst-mask {\r
-                                    type uint8;\r
-                                }\r
-                                leaf max-entries {\r
-                                    type uint32;\r
-                                }\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-port-stats-case {\r
-                        container multipart-reply-port-stats {\r
-                            list port-stats {\r
-                                leaf port-no {\r
-                                    type uint32;\r
-                                }\r
-                                leaf rx-packets {\r
-                                    type uint64;\r
-                                }\r
-                                leaf tx-packets {\r
-                                    type uint64;\r
-                                }\r
-                                leaf rx-bytes {\r
-                                    type uint64;\r
-                                }\r
-                                leaf tx-bytes {\r
-                                    type uint64;\r
-                                }\r
-                                leaf rx-dropped {\r
-                                    type uint64;\r
-                                }\r
-                                leaf tx-dropped {\r
-                                    type uint64;\r
-                                }\r
-                                leaf rx-errors {\r
-                                    type uint64;\r
-                                }\r
-                                leaf tx-errors {\r
-                                    type uint64;\r
-                                }\r
-                                leaf rx-frame-err {\r
-                                    type uint64;\r
-                                }\r
-                                leaf rx-over-err {\r
-                                    type uint64;\r
-                                }\r
-                                leaf rx-crc-err {\r
-                                    type uint64;\r
-                                }\r
-                                leaf collisions {\r
-                                    type uint64;\r
-                                }\r
-                                leaf duration-sec {\r
-                                    type uint32;\r
-                                }\r
-                                leaf duration-nsec {\r
-                                    type uint32;\r
-                                }\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-queue-case {\r
-                        container multipart-reply-queue {\r
-                            list queue-stats {\r
-                                leaf port-no {\r
-                                    type uint32;\r
-                                }\r
-                                leaf queue-id {\r
-                                    type uint32;\r
-                                }\r
-                                leaf tx-bytes {\r
-                                    type uint64;\r
-                                }\r
-                                leaf tx-packets {\r
-                                    type uint64;\r
-                                }\r
-                                leaf tx-errors {\r
-                                    type uint64;\r
-                                }\r
-                                leaf duration-sec {\r
-                                    type uint32;\r
-                                }\r
-                                leaf duration-nsec {\r
-                                    type uint32;\r
-                                }\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-group-case {\r
-                        container multipart-reply-group {\r
-                            list group-stats {\r
-                                leaf group-id {\r
-                                    type oft:group-id;\r
-                                }\r
-                                leaf ref-count {\r
-                                    type uint32;\r
-                                }\r
-                                leaf packet-count {\r
-                                    type uint64;\r
-                                }\r
-                                leaf byte-count {\r
-                                    type uint64;\r
-                                }\r
-                                leaf duration-sec {\r
-                                    type uint32;\r
-                                }\r
-                                leaf duration-nsec {\r
-                                    type uint32;\r
-                                }\r
-                                list bucket-stats {\r
-                                    leaf packet-count {\r
-                                        type uint64;\r
-                                    }\r
-                                    leaf byte-count {\r
-                                        type uint64;\r
-                                    }\r
-                                }\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-group-desc-case {\r
-                        container multipart-reply-group-desc {\r
-                            list group-desc {\r
-                                leaf type {\r
-                                    type oft:group-type;\r
-                                }\r
-                                leaf group-id {\r
-                                    type oft:group-id;\r
-                                }\r
-                                uses buckets-grouping;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-group-features-case {\r
-                        container multipart-reply-group-features {\r
-                            leaf types {\r
-                                type oft:group-types;\r
-                            }\r
-                            leaf capabilities {\r
-                                type oft:group-capabilities;\r
-                            }\r
-                            leaf-list max_groups {\r
-                                type uint32;\r
-                            }\r
-                            leaf-list actions-bitmap {\r
-                                type oft:action-type;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-meter-case {\r
-                        container multipart-reply-meter {\r
-                            list meter-stats {\r
-                                leaf meter-id {\r
-                                    type oft:meter-id;\r
-                                }\r
-                                leaf flow-count {\r
-                                    type uint32;\r
-                                }\r
-                                leaf packet-in-count {\r
-                                    type uint64;\r
-                                }\r
-                                leaf byte-in-count {\r
-                                    type uint64;\r
-                                }\r
-                                leaf duration-sec {\r
-                                    type uint32;\r
-                                }\r
-                                leaf duration-nsec {\r
-                                    type uint32;\r
-                                }\r
-                                list meter-band-stats {\r
-                                    leaf packet-band-count {\r
-                                        type uint64;\r
-                                    }\r
-                                    leaf byte-band-count {\r
-                                        type uint64;\r
-                                    }\r
-                                }\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-meter-config-case {\r
-                        container multipart-reply-meter-config {\r
-                            list meter-config {\r
-                                leaf flags {\r
-                                    type oft:meter-flags;\r
-                                }\r
-                                leaf meter-id {\r
-                                    type oft:meter-id;\r
-                                }\r
-                                list bands {\r
-                                    uses meter-band-header;\r
-                                }\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-meter-features-case {\r
-                        container multipart-reply-meter-features {\r
-                            leaf max-meter {\r
-                                type uint32;\r
-                            }\r
-                            leaf band-types {\r
-                                type oft:meter-band-type-bitmap;\r
-                            }\r
-                            leaf capabilities {\r
-                                type oft:meter-flags;\r
-                            }\r
-                            leaf max-bands {\r
-                                type uint8;\r
-                            }\r
-                            leaf max-color {\r
-                                type uint8;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-table-features-case {\r
-                        container multipart-reply-table-features {\r
-                            list table-features {\r
-                                leaf table-id {\r
-                                    type uint8;\r
-                                }\r
-                                leaf name {\r
-                                    type string;\r
-                                }\r
-                                leaf metadata-match {\r
-                                    type binary;\r
-                                }\r
-                                leaf metadata-write {\r
-                                    type binary;\r
-                                }\r
-                                leaf config {\r
-                                    type oft:table-config;\r
-                                } \r
-                                leaf max-entries {\r
-                                    type uint32;\r
-                                }\r
-                                uses table-features-properties-grouping;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-port-desc-case {\r
-                        container multipart-reply-port-desc {\r
-                            list ports {\r
-                                uses port-grouping;\r
-                            }\r
-                        }\r
-                    }\r
-                    case multipart-reply-experimenter-case {\r
-                        container multipart-reply-experimenter {\r
-                            // empty body - used for experimenter augmentation\r
-                        }\r
-                    }\r
-                }\r
-            } \r
-            /* Barrier messages. */\r
-            grouping barrier-request {\r
-                reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                uses ofHeader;\r
-            } \r
-            grouping barrier-reply {\r
-                reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                uses ofHeader;\r
-            } \r
-        /* Queue Configuration messages. */\r
-            grouping queue-get-config-request {\r
-                reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                \r
-                uses ofHeader;\r
-                \r
-                leaf port {\r
-                    type oft:port-number;\r
-                }\r
-            } \r
-            grouping queue-get-config-reply {\r
-                reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-\r
-                uses ofHeader;\r
-                \r
-                leaf port {\r
-                    type oft:port-number;\r
-                }\r
-                list queues {\r
-                    uses packet-queue;\r
-                }\r
-            }\r
-            grouping packet-queue {\r
-                leaf queue-id {\r
-                    type oft:queue-id;\r
-                }\r
-                leaf port {\r
-                    type oft:port-number;\r
-                }\r
-                uses queue-property-header;\r
-            }\r
-            container queue-prop-container {\r
-                uses queue-property-header;\r
-            }\r
-            grouping queue-property-header {\r
-                list queue-property {\r
-                    config false;\r
-                    leaf property {\r
-                        type oft:queue-properties;\r
-                    }\r
-                }\r
-            }\r
-            /* Controller role change request messages. */\r
-            grouping role-request {\r
-                reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                \r
-                uses ofHeader;\r
-                \r
-                leaf role {\r
-                    type oft:controller-role;\r
-                }\r
-                leaf generation-id {\r
-                    type uint64;\r
-                }\r
-            } \r
-            grouping role-reply {\r
-                reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-\r
-                uses ofHeader;\r
-                \r
-                leaf role {\r
-                    type oft:controller-role;\r
-                }\r
-                leaf generation-id {\r
-                    type uint64;\r
-                }\r
-            } \r
-            /* Asynchronous message configuration. */\r
-            grouping get-async-request {\r
-                reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-\r
-                uses ofHeader;\r
-            } \r
-            grouping get-async-reply {\r
-                reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-\r
-                uses ofHeader;\r
-                uses async-body-grouping;\r
-            } \r
-            grouping set-async {\r
-                reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-                \r
-                uses ofHeader;\r
-                uses async-body-grouping;\r
-            }\r
-            \r
-            grouping async-body-grouping {\r
-                list packet-in-mask {\r
-                    leaf-list mask {\r
-                        type oft:packet-in-reason;\r
-                    }\r
-                }\r
-                list port-status-mask {\r
-                    leaf-list mask {\r
-                        type oft:port-reason;\r
-                    }\r
-                }\r
-                list flow-removed-mask {\r
-                    leaf-list mask {\r
-                        type oft:flow-removed-reason;\r
-                    }\r
-                }\r
-            }\r
-            /* Meters and rate limiters configuration messages. */\r
-            grouping meter-mod {\r
-                reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec";\r
-                /* Controller/switch message */\r
-\r
-                uses ofHeader;\r
-                \r
-                leaf command {\r
-                    type oft:meter-mod-command;\r
-                } \r
-                leaf flags {\r
-                    type oft:meter-flags;\r
-                }\r
-                leaf meter-id {\r
-                    type oft:meter-id;\r
-                }\r
-                list bands {\r
-                    uses meter-band-header;\r
-                }\r
-            }\r
-            \r
-            container meter-band-container {\r
-                uses meter-band-header;\r
-            }\r
-            grouping meter-band-header {\r
-                choice meter-band {\r
-                    case meter-band-drop-case {\r
-                        container meter-band-drop {\r
-                            uses meter-band-commons;\r
-                        }\r
-                    }\r
-                    case meter-band-dscp-remark-case {\r
-                        container meter-band-dscp-remark {\r
-                            uses meter-band-commons;\r
-                            leaf prec-level {\r
-                                type uint8;\r
-                            }\r
-                        }\r
-                    }\r
-                    case meter-band-experimenter-case {\r
-                        container meter-band-experimenter {\r
-                            uses meter-band-commons;\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-            \r
-            grouping meter-band-commons {\r
-                leaf type {\r
-                    type oft:meter-band-type;\r
-                }\r
-                leaf rate {\r
-                    type uint32;\r
-                }\r
-                leaf burst-size {\r
-                    type uint32;\r
-                }\r
-            }\r
-\r
-            /* Immutable messages. */\r
-            notification hello-message {\r
-                uses hello;\r
-                reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";\r
-                \r
-                /* Symmetric message */\r
-            }\r
-            notification error-message {\r
-                uses error;\r
-                reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";\r
-                \r
-                /* Symmetric message */\r
-            }\r
-            notification echo-request-message {\r
-                uses echo-request;\r
-                reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";\r
-                \r
-                /* Symmetric message */\r
-            }\r
-            notification experimenter-message {\r
-                uses experimenter;\r
-                reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";\r
-                // TODO:: does switch send this when understood experimenter msg from lib?\r
-                /* Symmetric message */\r
-            }\r
-    // # Notification and RPCs\r
-        /* Symmetric RPC. */\r
-            rpc echo {\r
-                input {\r
-                    uses echo-request;\r
-                }\r
-                /* Controller/switch message */\r
-                output {\r
-                    uses echo-reply;\r
-                }\r
-            }\r
-            \r
-            rpc echo-reply {\r
-                input {\r
-                    uses echo-reply;\r
-                }\r
-            }\r
-            \r
-            rpc hello {\r
-                input {\r
-                    uses hello;\r
-                }\r
-            }\r
-            \r
-            rpc experimenter {\r
-                input {\r
-                    uses experimenter;\r
-                }\r
-            }\r
-\r
-        /* Switch configuration messages. */\r
-            rpc get-features {\r
-                input {\r
-                    uses features-request;\r
-                }\r
-                /* Controller/switch message */\r
-                output {\r
-                    uses features-reply;\r
-                }\r
-            }\r
-            \r
-            rpc get-config {\r
-                input {\r
-                    uses get-config-request;\r
-                }\r
-                output {\r
-                    uses get-config-reply;\r
-                }\r
-                /* Controller/switch message */\r
-            }\r
-            \r
-            rpc set-config {\r
-                input {\r
-                    uses set-config;\r
-                }   \r
-                /* Controller/switch message */\r
-            }\r
-        /* Asynchronous messages. */\r
-            notification packet-in-message {\r
-                uses packet-in;\r
-                \r
-             /* Async message */\r
-            }\r
-            notification flow-removed-message {\r
-                uses flow-removed;\r
-                \r
-                /* Async message */\r
-            } \r
-            notification port-status-message {\r
-                uses port-status;\r
-                \r
-            } /* Async message */\r
-\r
-        /* Controller command messages. */\r
-            rpc packet-out {\r
-                input {\r
-                    uses packet-out;\r
-                }\r
-                /* Controller/switch message */\r
-            } \r
-            rpc flow-mod {\r
-                input {\r
-                    uses flow-mod;\r
-                }\r
-                /* Controller/switch message */\r
-            } \r
-            rpc group-mod {\r
-                input {\r
-                    uses group-mod;\r
-                }\r
-                /* Controller/switch message */\r
-            } \r
-            rpc port-mod {\r
-                input {\r
-                    uses port-mod;\r
-                }\r
-            } /* Controller/switch message */\r
-            \r
-            rpc table-mod {\r
-                input {\r
-                    uses table-mod;\r
-                }\r
-            } /* Controller/switch message */\r
-\r
-        /* Multipart messages. */\r
-\r
-            rpc multipart-request {\r
-                input {\r
-                    uses multipart-request;\r
-                }\r
-            }\r
-\r
-             /* Controller/switch message */\r
-            notification multipart-reply-message {\r
-                uses multipart-reply;\r
-                // notification because of multiple following responses\r
-            } /* Controller/switch message */\r
-            \r
-\r
-            /* Barrier messages. */\r
-            rpc barrier {\r
-                input {\r
-                    uses barrier-request;\r
-                }\r
-                output {\r
-                    uses barrier-reply;\r
-                }\r
-            }\r
-        /* Queue Configuration messages. */\r
-            rpc get-queue-config {\r
-                input {\r
-                    uses queue-get-config-request;\r
-                }\r
-                output {\r
-                    uses queue-get-config-reply;\r
-                }\r
-            } \r
-\r
-        /* Controller role change request messages. */\r
-            rpc role-request {\r
-                input {\r
-                    uses role-request;\r
-                }\r
-                output {\r
-                    uses role-reply;\r
-                }\r
-            } /* Controller/switch message */\r
-            \r
-        /* Asynchronous message configuration. */\r
-            rpc get-async {\r
-                input {\r
-                    uses get-async-request;\r
-                }\r
-                output {\r
-                    uses get-async-reply;\r
-                }\r
-            } \r
-             /* Controller/switch message */\r
-            rpc set-async {\r
-                input { \r
-                    uses set-async;\r
-                }\r
-                \r
-            } \r
-        /* Meters and rate limiters configuration messages. */\r
-            rpc meter-mod {\r
-                input {\r
-                    uses meter-mod;\r
-                }\r
-            } /* Controller/switch message */\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+ module openflow-protocol {
+    namespace "urn:opendaylight:openflow:protocol";
+    prefix "ofproto";
+
+    import ietf-yang-types {prefix yang;}
+    
+    import openflow-types {prefix oft;}
+    import openflow-extensible-match { prefix oxm;}
+    import openflow-instruction { prefix ofinstruction;}
+    import openflow-action {prefix ofaction;}
+
+    revision "2013-07-31" {
+        description "OpenFlow 1.3 - protocol objects model";
+    }
+
+    // Generic Structures
+        grouping port-grouping {
+            reference "ofp_port";
+            leaf port-no {
+                type uint32;
+            }
+            leaf hw-addr {
+                type yang:mac-address;
+            }
+            leaf name {
+                type string;
+            }
+            leaf config {
+                description "Bitmap of OFPPC_* flags.";
+                type oft:port-config;
+            }
+            leaf state {
+                description "Bitmap of OFPPS_* flags.";
+                type oft:port-state;
+            }
+            leaf current-features {
+                description "Current features.";
+                type oft:port-features;
+            }
+            leaf advertised-features {
+                description "Features being advertised by the port.";
+                type oft:port-features;
+            }
+            leaf supported-features {
+                description "Features supported by the port.";
+                type oft:port-features;
+            }
+            leaf peer-features {
+                description "Features advertised by peer.";
+                type oft:port-features; 
+            }
+            leaf curr-speed {
+                description "Current port bitrate in kbps.";
+                type uint32;
+                units "kbps";
+            }
+            leaf max-speed {
+                description "Max port bitrate in kbps";
+                type uint32;
+                units "kbps";
+            }
+
+            // OF1.0 structures
+            leaf config-v10 {
+                type oft:port-config-v10;
+            }
+            leaf state-v10 { 
+                type oft:port-state-v10;
+            }
+            leaf current-features-v10 {
+                description "Current features.";
+                type oft:port-features-v10;
+            }
+            leaf advertised-features-v10 {
+                description "Features being advertised by the port.";
+                type oft:port-features-v10;
+            }
+            leaf supported-features-v10 {
+                description "Features supported by the port.";
+                type oft:port-features-v10;
+            }
+            leaf peer-features-v10 { 
+                description "Features advertised by peer.";
+                type oft:port-features-v10; 
+            }
+        }
+
+        grouping buckets-grouping {
+                list buckets-list {
+                    uses bucket-grouping;
+                }
+            }
+
+            grouping bucket-grouping {
+                description "Bucket for use in groups.";
+                leaf weight {
+                    description "Relative weight of bucket. Only
+                                defined for select groups.";
+                    type uint16;
+                }
+                leaf watch-port {
+                    description "Port whose state affects whether this
+                                bucket is live. Only required for fast
+                                failover groups.";
+                    type oft:port-number;
+                }
+                leaf watch-group {
+                    description "Group whose state affects whether this
+                                bucket is live. Only required for fast
+                                failover groups.";
+                    type uint32;
+                }
+
+                uses ofaction:actions-grouping;
+            }
+            
+        container table-features-properties-container {
+            uses table-features-properties-grouping;
+        }
+
+        grouping table-features-properties-grouping {
+            list table-feature-properties {
+                config false;
+                leaf type {
+                    type oft:table-features-prop-type;
+                }
+            }
+        }
+
+    // # MESSAGE Structures
+        /* Immutable messages. */
+            grouping ofHeader {
+                reference "ofp_header struct in Openflow Switch 1.3 Spec";
+                leaf version {
+                    type uint8;
+                    description "OpenFlow version";
+                }
+                leaf xid {
+                    type uint32;
+                    description "Transaction ID";
+                }
+            }
+            grouping ofHelloElementHeader {
+                reference "ofpt_hello_elem_header struct in Openflow Switch 1.3 Spec";
+                leaf type {
+                    type oft:hello-element-type;
+                    //reference "OpenFlow Header element type - OFPHET_*";
+                }
+            }
+            grouping hello {
+                reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";
+                /* Symmetric message */
+                uses ofHeader;
+                
+                list elements {
+                    uses ofHelloElementHeader;
+                    
+                    leaf-list version-bitmap {
+                        type boolean;
+                    }
+                }
+            }
+            grouping error {
+                reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";
+                /* Symmetric message */
+                uses ofHeader;
+                
+                leaf type {
+                    type uint16;
+                }
+                leaf code {
+                    type uint16;
+                }
+                leaf type-string {
+                    type string;
+                }
+                leaf code-string {
+                    type string;
+                }
+                leaf data {
+                    type binary; 
+                }
+            }
+            grouping echo-request {
+                reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";
+                /* Symmetric message */
+                uses ofHeader;
+                
+                leaf data {
+                    type binary;
+                }
+            }
+            grouping echo-reply {
+                reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec";
+                /* Symmetric message */
+                uses ofHeader;
+                
+                leaf data {
+                    type binary;
+                }
+            }
+            grouping experimenter {
+                reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
+                /* Symmetric message */
+                uses ofHeader;
+                
+                leaf experimenter {
+                    type oft:experimenter-id;
+                }
+                leaf exp_type {
+                    type uint32;
+                }
+            }
+        /* Switch configuration messages. */
+            grouping features-request {
+                reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                uses ofHeader;
+            }
+            grouping features-reply {
+                reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                uses ofHeader;
+                
+                leaf datapathId {
+                    type uint64;
+                }
+                leaf buffers {
+                    type uint32;
+                }
+                leaf tables {
+                    type uint8;
+                }
+                leaf auxiliaryId {
+                    type uint8;
+                }
+                leaf capabilities {
+                    type oft:capabilities;
+                }
+                leaf reserved {
+                    type uint32;
+                }
+                // OF1.0 structures
+                leaf capabilities-v10 {
+                    type oft:capabilities-v10;
+                }
+                leaf actions-v10 {
+                    type oft:action-type-v10;
+                }
+                list phy-port {
+                    uses port-grouping;
+                }
+            }
+            grouping get-config-request {
+                reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                uses ofHeader;
+            }
+            grouping get-config-reply {
+                reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                uses ofHeader;
+                
+                leaf flags {
+                    type oft:switch-config-flag;
+                }
+                leaf miss-send-len {
+                    type uint16;
+                }
+            }
+            grouping set-config {
+                reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                
+                uses ofHeader;
+                
+                leaf flags {
+                    type oft:switch-config-flag;
+                }
+                leaf miss-send-len {
+                    type uint16;
+                }
+            }
+        /* Asynchronous messages. */
+            grouping packet-in {
+                reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec";
+                /* Async message */
+                
+                uses ofHeader;
+                
+                leaf buffer-id {
+                    // ID assigned by datapath.
+                    type uint32;
+                }
+                leaf total-len {
+                    // Full length of frame.
+                    type uint16;
+                }
+                leaf reason {
+                    // Reason packet is being sent (one of OFPR_*) 
+                    type oft:packet-in-reason;
+                }
+                leaf table-id {
+                    // ID of the table that was looked up
+                    type oft:table-id;
+                }
+                leaf cookie {
+                    // Cookie of the flow entry that was looked up.
+                    type uint64;
+                }
+                uses oxm:match-grouping;
+
+                leaf data {
+                    type binary;
+                }
+                
+                // OF1.0 structures
+                leaf in-port {
+                    type uint16;
+                }
+            }
+            grouping flow-removed {
+                reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec";
+                /* Async message */
+                uses ofHeader;
+                
+                leaf cookie {
+                    type uint64;
+                }
+                leaf priority {
+                    type uint16;
+                }
+                leaf reason {
+                    type oft:flow-removed-reason;
+                }
+                leaf table-id {
+                    type oft:table-id;
+                }
+                leaf duration-sec {
+                    type uint32;
+                }
+                leaf duration-nsec {
+                    type uint32;
+                }
+                leaf idle-timeout {
+                    type uint16;
+                }
+                leaf hard-timeout {
+                    type uint16;
+                }
+                leaf packet-count {
+                    type uint64;
+                }
+                leaf byte-count {
+                    type uint64;
+                }
+                uses oxm:match-grouping;
+                
+                // OF1.0 structures
+                uses oxm:match-v10-grouping;
+            } 
+            grouping port-status {
+                reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec";
+                
+                uses ofHeader;
+                
+                uses port-grouping;
+                
+                leaf reason {
+                    type oft:port-reason;
+                }
+            }
+        /* Controller command messages. */
+            grouping packet-out {
+                reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                
+                uses ofHeader;
+                
+                uses ofaction:actions-grouping;
+                
+                leaf data {
+                    type binary;
+                }
+                leaf buffer-id {
+                    type uint32;
+                }
+                leaf in-port {
+                    type oft:port-number;
+                }
+            } 
+            grouping flow-mod {
+                reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                
+                uses ofHeader;
+                
+                leaf cookie {
+                    type uint64;
+                }
+                leaf cookie-mask {
+                    type uint64;
+                }
+                leaf table-id {
+                    type oft:table-id;
+                }
+                leaf command {
+                    type oft:flow-mod-command;
+                }
+                leaf idle-timeout {
+                    type uint16;
+                }
+                leaf hard-timeout {
+                    type uint16;
+                }
+                leaf priority {
+                    type uint16;
+                }
+                leaf buffer-id {
+                    type uint32;
+                }
+                leaf out-port {
+                    type oft:port-number;
+                }
+                leaf out-group {
+                    type uint32;
+                }
+                leaf flags {
+                    type oft:flow-mod-flags;
+                }
+                uses oxm:match-grouping;
+                
+                uses ofinstruction:instructions-grouping;
+                
+                // OF1.0 structures
+                leaf flags-v10 {
+                    type oft:flow-mod-flags-v10;
+                }
+                uses oxm:match-v10-grouping;
+                uses ofaction:actions-grouping;
+            } 
+            grouping group-mod {
+                reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                
+                uses ofHeader;
+                
+                leaf command {
+                    type oft:group-mod-command;
+                }
+                leaf type {
+                    type oft:group-type;
+                }
+                leaf group-id {
+                    type oft:group-id;
+                }
+                
+                uses buckets-grouping;
+            }
+            
+            grouping port-mod {
+                reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+
+                uses ofHeader;
+                
+                leaf port-no {
+                    type oft:port-number;
+                }
+                leaf hw-address {
+                    type yang:mac-address;
+                }       
+                leaf config {
+                    type oft:port-config;
+                }   
+                leaf mask {
+                    type oft:port-config;
+                }
+                leaf advertise {
+                    type oft:port-features;
+                }
+                // OF1.0 structures
+                leaf config-v10 {
+                    type oft:port-config-v10;
+                }
+                leaf mask-v10 {
+                    type oft:port-config-v10;
+                }
+                leaf advertise-v10 {
+                    type oft:port-features-v10;
+                }
+            } 
+            grouping table-mod {
+                reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+
+                uses ofHeader;
+                
+                leaf table-id {
+                    type oft:table-id;
+                }
+                leaf config {
+                    type oft:table-config;
+                }
+            } 
+            
+        /* Multipart messages. */
+            grouping multipart-request {
+                reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+
+                uses ofHeader;
+                
+                leaf type {
+                    type oft:multipart-type;
+                }
+                leaf flags {
+                    type oft:multipart-request-flags;
+                }
+                choice multipart-request-body {
+                    case multipart-request-desc-case {
+                        container multipart-request-desc {
+                            leaf empty {
+                                type empty;
+                            }
+                        }
+                    }
+                    case multipart-request-flow-case {
+                        container multipart-request-flow {
+                            leaf table-id {
+                                type uint8;
+                            }
+                            leaf out-port {
+                                type uint32;
+                            }
+                            leaf out-group {
+                                type uint32;
+                            }
+                            leaf cookie {
+                                type uint64;
+                            }
+                            leaf cookie-mask {
+                                type uint64;
+                            }
+                            uses oxm:match-grouping;
+                            
+                            // OF1.0 structures
+                            uses oxm:match-v10-grouping;
+                        }
+                    }
+                    case multipart-request-aggregate-case {
+                        container multipart-request-aggregate {
+                            leaf table-id {
+                                type uint8;
+                            }
+                            leaf out-port {
+                                type uint32;
+                            }
+                            leaf out-group {
+                                type uint32;
+                            }
+                            leaf cookie {
+                                type uint64;
+                            }
+                            leaf cookie-mask {
+                                type uint64;
+                            }
+                            uses oxm:match-grouping;
+                            
+                            // OF1.0 structures
+                            uses oxm:match-v10-grouping;
+                        }
+                    }
+                    case multipart-request-table-case {
+                        container multipart-request-table {
+                            leaf empty {
+                                type empty;
+                            }
+                        }
+                    }
+                    case multipart-request-port-stats-case {
+                        container multipart-request-port-stats {
+                            leaf port-no {
+                                type uint32;
+                            }
+                        }
+                    }
+                    case multipart-request-queue-case {
+                        container multipart-request-queue {
+                            leaf port-no {
+                                type uint32;
+                            }
+                            leaf queue-id {
+                                type uint32;
+                            }
+                        }
+                    }
+                    case multipart-request-group-case {
+                        container multipart-request-group {
+                            leaf group-id {
+                                type oft:group-id;
+                            }
+                        }
+                    }
+                    case multipart-request-group-desc-case {
+                        container multipart-request-group-desc {
+                            leaf empty {
+                                type empty;
+                            }
+                        }
+                    }
+                    case multipart-request-group-features-case {
+                        container multipart-request-group-features {
+                            leaf empty {
+                                type empty;
+                            }
+                        }
+                    }
+                    case multipart-request-meter-case {
+                        container multipart-request-meter {
+                            leaf meter-id {
+                                type oft:meter-id;
+                            }
+                        }
+                    }
+                    case multipart-request-meter-config-case {
+                        container multipart-request-meter-config {
+                            leaf meter-id {
+                                type oft:meter-id;
+                            }
+                        }
+                    }
+                    case multipart-request-meter-features-case {
+                        container multipart-request-meter-features {
+                            leaf empty {
+                                type empty;
+                            }
+                        }
+                    }
+                    case multipart-request-table-features-case {
+                        container multipart-request-table-features {
+                            list table-features {
+                                leaf table-id {
+                                    type uint8;
+                                }
+                                leaf name {
+                                    type string;
+                                }
+                                leaf metadata-match {
+                                    type uint64;
+                                }
+                                leaf metadata-write {
+                                    type uint64;
+                                }
+                                leaf config {
+                                    type oft:table-config;
+                                }
+                                leaf max-entries {
+                                    type uint32;
+                                }
+                                uses table-features-properties-grouping;
+                            }
+                        }
+                    }
+                    case multipart-request-port-desc-case {
+                        container multipart-request-port-desc {
+                            leaf empty {
+                                type empty;
+                            }
+                        }
+                    }
+                    case multipart-request-experimenter-case {
+                        container multipart-request-experimenter {
+                            // empty body - used for experimenter augmentation
+                        }
+                    }
+                }
+            } 
+            grouping multipart-reply {
+                reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+
+                uses ofHeader;
+                
+                leaf type {
+                    type oft:multipart-type;
+                }
+                leaf flags {
+                    type oft:multipart-request-flags;
+                }
+                choice multipart-reply-body {
+                    case multipart-reply-desc-case {
+                        container multipart-reply-desc {
+                            leaf mfr_desc {
+                                type string;
+                            }
+                            leaf hw_desc {
+                                type string;
+                            }
+                            leaf sw_desc {
+                                type string;
+                            }
+                            leaf serial_num {
+                                type string;
+                            }
+                            leaf dp_desc {
+                                type string;
+                            }
+                        }
+                    }
+                    case multipart-reply-flow-case {
+                        container multipart-reply-flow {
+                            list flow-stats {
+                                leaf table-id {
+                                    type uint8;
+                                }
+                                leaf duration-sec {
+                                    type uint32;
+                                }
+                                leaf duration-nsec {
+                                    type uint32;
+                                }
+                                leaf priority {
+                                    type uint16;
+                                }
+                                leaf idle-timeout {
+                                    type uint16;
+                                }
+                                leaf hard-timeout {
+                                    type uint16;
+                                }
+                                leaf flags {
+                                    type oft:flow-mod-flags;
+                                }
+                                leaf cookie {
+                                    type uint64;
+                                }
+                                leaf packet-count {
+                                    type uint64;
+                                }
+                                leaf byte-count {
+                                    type uint64;
+                                }
+                                uses oxm:match-grouping;
+                                
+                                uses ofinstruction:instructions-grouping;
+                                
+                                // OF1.0 structures
+                                uses oxm:match-v10-grouping;
+                                uses ofaction:actions-grouping;
+                            }
+                        }
+                    }
+                    case multipart-reply-aggregate-case {
+                        container multipart-reply-aggregate {
+                            leaf packet-count {
+                                type uint64;
+                            }
+                            leaf byte-count {
+                                type uint64;
+                            }
+                            leaf flow-count {
+                                type uint32;
+                            }
+                        }
+                    }
+                    case multipart-reply-table-case {
+                        container multipart-reply-table {
+                            list table-stats {
+                                leaf table-id {
+                                    type uint8;
+                                }
+                                leaf active-count {
+                                    type uint32;
+                                }
+                                leaf lookup-count {
+                                    type uint64;
+                                }
+                                leaf matched-count {
+                                    type uint64;
+                                }
+                                
+                                // OF1.0 structures
+                                leaf name {
+                                    type string;
+                                }
+                                leaf wildcards {
+                                    type oft:flow-wildcards-v10;
+                                }
+                                leaf nw-src-mask {
+                                    type uint8;
+                                }
+                                leaf nw-dst-mask {
+                                    type uint8;
+                                }
+                                leaf max-entries {
+                                    type uint32;
+                                }
+                            }
+                        }
+                    }
+                    case multipart-reply-port-stats-case {
+                        container multipart-reply-port-stats {
+                            list port-stats {
+                                leaf port-no {
+                                    type uint32;
+                                }
+                                leaf rx-packets {
+                                    type uint64;
+                                }
+                                leaf tx-packets {
+                                    type uint64;
+                                }
+                                leaf rx-bytes {
+                                    type uint64;
+                                }
+                                leaf tx-bytes {
+                                    type uint64;
+                                }
+                                leaf rx-dropped {
+                                    type uint64;
+                                }
+                                leaf tx-dropped {
+                                    type uint64;
+                                }
+                                leaf rx-errors {
+                                    type uint64;
+                                }
+                                leaf tx-errors {
+                                    type uint64;
+                                }
+                                leaf rx-frame-err {
+                                    type uint64;
+                                }
+                                leaf rx-over-err {
+                                    type uint64;
+                                }
+                                leaf rx-crc-err {
+                                    type uint64;
+                                }
+                                leaf collisions {
+                                    type uint64;
+                                }
+                                leaf duration-sec {
+                                    type uint32;
+                                }
+                                leaf duration-nsec {
+                                    type uint32;
+                                }
+                            }
+                        }
+                    }
+                    case multipart-reply-queue-case {
+                        container multipart-reply-queue {
+                            list queue-stats {
+                                leaf port-no {
+                                    type uint32;
+                                }
+                                leaf queue-id {
+                                    type uint32;
+                                }
+                                leaf tx-bytes {
+                                    type uint64;
+                                }
+                                leaf tx-packets {
+                                    type uint64;
+                                }
+                                leaf tx-errors {
+                                    type uint64;
+                                }
+                                leaf duration-sec {
+                                    type uint32;
+                                }
+                                leaf duration-nsec {
+                                    type uint32;
+                                }
+                            }
+                        }
+                    }
+                    case multipart-reply-group-case {
+                        container multipart-reply-group {
+                            list group-stats {
+                                leaf group-id {
+                                    type oft:group-id;
+                                }
+                                leaf ref-count {
+                                    type uint32;
+                                }
+                                leaf packet-count {
+                                    type uint64;
+                                }
+                                leaf byte-count {
+                                    type uint64;
+                                }
+                                leaf duration-sec {
+                                    type uint32;
+                                }
+                                leaf duration-nsec {
+                                    type uint32;
+                                }
+                                list bucket-stats {
+                                    leaf packet-count {
+                                        type uint64;
+                                    }
+                                    leaf byte-count {
+                                        type uint64;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    case multipart-reply-group-desc-case {
+                        container multipart-reply-group-desc {
+                            list group-desc {
+                                leaf type {
+                                    type oft:group-type;
+                                }
+                                leaf group-id {
+                                    type oft:group-id;
+                                }
+                                uses buckets-grouping;
+                            }
+                        }
+                    }
+                    case multipart-reply-group-features-case {
+                        container multipart-reply-group-features {
+                            leaf types {
+                                type oft:group-types;
+                            }
+                            leaf capabilities {
+                                type oft:group-capabilities;
+                            }
+                            leaf-list max_groups {
+                                type uint32;
+                            }
+                            leaf-list actions-bitmap {
+                                type oft:action-type;
+                            }
+                        }
+                    }
+                    case multipart-reply-meter-case {
+                        container multipart-reply-meter {
+                            list meter-stats {
+                                leaf meter-id {
+                                    type oft:meter-id;
+                                }
+                                leaf flow-count {
+                                    type uint32;
+                                }
+                                leaf packet-in-count {
+                                    type uint64;
+                                }
+                                leaf byte-in-count {
+                                    type uint64;
+                                }
+                                leaf duration-sec {
+                                    type uint32;
+                                }
+                                leaf duration-nsec {
+                                    type uint32;
+                                }
+                                list meter-band-stats {
+                                    leaf packet-band-count {
+                                        type uint64;
+                                    }
+                                    leaf byte-band-count {
+                                        type uint64;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    case multipart-reply-meter-config-case {
+                        container multipart-reply-meter-config {
+                            list meter-config {
+                                leaf flags {
+                                    type oft:meter-flags;
+                                }
+                                leaf meter-id {
+                                    type oft:meter-id;
+                                }
+                                list bands {
+                                    uses meter-band-header;
+                                }
+                            }
+                        }
+                    }
+                    case multipart-reply-meter-features-case {
+                        container multipart-reply-meter-features {
+                            leaf max-meter {
+                                type uint32;
+                            }
+                            leaf band-types {
+                                type oft:meter-band-type-bitmap;
+                            }
+                            leaf capabilities {
+                                type oft:meter-flags;
+                            }
+                            leaf max-bands {
+                                type uint8;
+                            }
+                            leaf max-color {
+                                type uint8;
+                            }
+                        }
+                    }
+                    case multipart-reply-table-features-case {
+                        container multipart-reply-table-features {
+                            list table-features {
+                                leaf table-id {
+                                    type uint8;
+                                }
+                                leaf name {
+                                    type string;
+                                }
+                                leaf metadata-match {
+                                    type binary;
+                                }
+                                leaf metadata-write {
+                                    type binary;
+                                }
+                                leaf config {
+                                    type oft:table-config;
+                                } 
+                                leaf max-entries {
+                                    type uint32;
+                                }
+                                uses table-features-properties-grouping;
+                            }
+                        }
+                    }
+                    case multipart-reply-port-desc-case {
+                        container multipart-reply-port-desc {
+                            list ports {
+                                uses port-grouping;
+                            }
+                        }
+                    }
+                    case multipart-reply-experimenter-case {
+                        container multipart-reply-experimenter {
+                            // empty body - used for experimenter augmentation
+                        }
+                    }
+                }
+            } 
+            /* Barrier messages. */
+            grouping barrier-request {
+                reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                uses ofHeader;
+            } 
+            grouping barrier-reply {
+                reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                uses ofHeader;
+            } 
+        /* Queue Configuration messages. */
+            grouping queue-get-config-request {
+                reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                
+                uses ofHeader;
+                
+                leaf port {
+                    type oft:port-number;
+                }
+            } 
+            grouping queue-get-config-reply {
+                reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+
+                uses ofHeader;
+                
+                leaf port {
+                    type oft:port-number;
+                }
+                list queues {
+                    uses packet-queue;
+                }
+            }
+            grouping packet-queue {
+                leaf queue-id {
+                    type oft:queue-id;
+                }
+                leaf port {
+                    type oft:port-number;
+                }
+                uses queue-property-header;
+            }
+            container queue-prop-container {
+                uses queue-property-header;
+            }
+            grouping queue-property-header {
+                list queue-property {
+                    config false;
+                    leaf property {
+                        type oft:queue-properties;
+                    }
+                }
+            }
+            /* Controller role change request messages. */
+            grouping role-request {
+                reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                
+                uses ofHeader;
+                
+                leaf role {
+                    type oft:controller-role;
+                }
+                leaf generation-id {
+                    type uint64;
+                }
+            } 
+            grouping role-reply {
+                reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+
+                uses ofHeader;
+                
+                leaf role {
+                    type oft:controller-role;
+                }
+                leaf generation-id {
+                    type uint64;
+                }
+            } 
+            /* Asynchronous message configuration. */
+            grouping get-async-request {
+                reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+
+                uses ofHeader;
+            } 
+            grouping get-async-reply {
+                reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+
+                uses ofHeader;
+                uses async-body-grouping;
+            } 
+            grouping set-async {
+                reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+                
+                uses ofHeader;
+                uses async-body-grouping;
+            }
+            
+            grouping async-body-grouping {
+                list packet-in-mask {
+                    leaf-list mask {
+                        type oft:packet-in-reason;
+                    }
+                }
+                list port-status-mask {
+                    leaf-list mask {
+                        type oft:port-reason;
+                    }
+                }
+                list flow-removed-mask {
+                    leaf-list mask {
+                        type oft:flow-removed-reason;
+                    }
+                }
+            }
+            /* Meters and rate limiters configuration messages. */
+            grouping meter-mod {
+                reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec";
+                /* Controller/switch message */
+
+                uses ofHeader;
+                
+                leaf command {
+                    type oft:meter-mod-command;
+                } 
+                leaf flags {
+                    type oft:meter-flags;
+                }
+                leaf meter-id {
+                    type oft:meter-id;
+                }
+                list bands {
+                    uses meter-band-header;
+                }
+            }
+            
+            container meter-band-container {
+                uses meter-band-header;
+            }
+            grouping meter-band-header {
+                choice meter-band {
+                    case meter-band-drop-case {
+                        container meter-band-drop {
+                            uses meter-band-commons;
+                        }
+                    }
+                    case meter-band-dscp-remark-case {
+                        container meter-band-dscp-remark {
+                            uses meter-band-commons;
+                            leaf prec-level {
+                                type uint8;
+                            }
+                        }
+                    }
+                    case meter-band-experimenter-case {
+                        container meter-band-experimenter {
+                            uses meter-band-commons;
+                        }
+                    }
+                }
+            }
+            
+            grouping meter-band-commons {
+                leaf type {
+                    type oft:meter-band-type;
+                }
+                leaf rate {
+                    type uint32;
+                }
+                leaf burst-size {
+                    type uint32;
+                }
+            }
+
+            /* Immutable messages. */
+            notification hello-message {
+                uses hello;
+                reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";
+                
+                /* Symmetric message */
+            }
+            notification error-message {
+                uses error;
+                reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";
+                
+                /* Symmetric message */
+            }
+            notification echo-request-message {
+                uses echo-request;
+                reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";
+                
+                /* Symmetric message */
+            }
+            notification experimenter-message {
+                uses experimenter;
+                reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
+                // TODO:: does switch send this when understood experimenter msg from lib?
+                /* Symmetric message */
+            }
+    // # Notification and RPCs
+        /* Symmetric RPC. */
+            rpc echo {
+                input {
+                    uses echo-request;
+                }
+                /* Controller/switch message */
+                output {
+                    uses echo-reply;
+                }
+            }
+            
+            rpc echo-reply {
+                input {
+                    uses echo-reply;
+                }
+            }
+            
+            rpc hello {
+                input {
+                    uses hello;
+                }
+            }
+            
+            rpc experimenter {
+                input {
+                    uses experimenter;
+                }
+            }
+
+        /* Switch configuration messages. */
+            rpc get-features {
+                input {
+                    uses features-request;
+                }
+                /* Controller/switch message */
+                output {
+                    uses features-reply;
+                }
+            }
+            
+            rpc get-config {
+                input {
+                    uses get-config-request;
+                }
+                output {
+                    uses get-config-reply;
+                }
+                /* Controller/switch message */
+            }
+            
+            rpc set-config {
+                input {
+                    uses set-config;
+                }   
+                /* Controller/switch message */
+            }
+        /* Asynchronous messages. */
+            notification packet-in-message {
+                uses packet-in;
+                
+             /* Async message */
+            }
+            notification flow-removed-message {
+                uses flow-removed;
+                
+                /* Async message */
+            } 
+            notification port-status-message {
+                uses port-status;
+                
+            } /* Async message */
+
+        /* Controller command messages. */
+            rpc packet-out {
+                input {
+                    uses packet-out;
+                }
+                /* Controller/switch message */
+            } 
+            rpc flow-mod {
+                input {
+                    uses flow-mod;
+                }
+                /* Controller/switch message */
+            } 
+            rpc group-mod {
+                input {
+                    uses group-mod;
+                }
+                /* Controller/switch message */
+            } 
+            rpc port-mod {
+                input {
+                    uses port-mod;
+                }
+            } /* Controller/switch message */
+            
+            rpc table-mod {
+                input {
+                    uses table-mod;
+                }
+            } /* Controller/switch message */
+
+        /* Multipart messages. */
+
+            rpc multipart-request {
+                input {
+                    uses multipart-request;
+                }
+            }
+
+             /* Controller/switch message */
+            notification multipart-reply-message {
+                uses multipart-reply;
+                // notification because of multiple following responses
+            } /* Controller/switch message */
+            
+
+            /* Barrier messages. */
+            rpc barrier {
+                input {
+                    uses barrier-request;
+                }
+                output {
+                    uses barrier-reply;
+                }
+            }
+        /* Queue Configuration messages. */
+            rpc get-queue-config {
+                input {
+                    uses queue-get-config-request;
+                }
+                output {
+                    uses queue-get-config-reply;
+                }
+            } 
+
+        /* Controller role change request messages. */
+            rpc role-request {
+                input {
+                    uses role-request;
+                }
+                output {
+                    uses role-reply;
+                }
+            } /* Controller/switch message */
+            
+        /* Asynchronous message configuration. */
+            rpc get-async {
+                input {
+                    uses get-async-request;
+                }
+                output {
+                    uses get-async-reply;
+                }
+            } 
+             /* Controller/switch message */
+            rpc set-async {
+                input { 
+                    uses set-async;
+                }
+                
+            } 
+        /* Meters and rate limiters configuration messages. */
+            rpc meter-mod {
+                input {
+                    uses meter-mod;
+                }
+            } /* Controller/switch message */
 }
\ No newline at end of file
index 9816c25003ca4de744edd6c358973b21a0efc206..f71d23022c8ea3e0d6b63980a3971f69df6d06e7 100644 (file)
@@ -1,40 +1,40 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.connection;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class TlsConfigurationImplTest {\r
-\r
-    /**\r
-     * Test correct TlsConfigurationImpl creation\r
-     */\r
-    @Test\r
-    public void test() {\r
-        TlsConfigurationImpl config = new TlsConfigurationImpl(KeystoreType.JKS,\r
-                "user/dir", PathType.CLASSPATH, KeystoreType.PKCS12, "/var/lib", PathType.PATH);\r
-        assertEquals("Wrong keystore location", "/var/lib", config.getTlsKeystore());\r
-        assertEquals("Wrong truststore location", "user/dir", config.getTlsTruststore());\r
-        assertEquals("Wrong keystore type", KeystoreType.PKCS12, config.getTlsKeystoreType());\r
-        assertEquals("Wrong truststore type", KeystoreType.JKS, config.getTlsTruststoreType());\r
-        assertEquals("Wrong keystore path type", PathType.PATH, config.getTlsKeystorePathType());\r
-        assertEquals("Wrong truststore path type", PathType.CLASSPATH, config.getTlsTruststorePathType());\r
-        assertEquals("Wrong certificate password", "opendaylight", config.getCertificatePassword());\r
-        assertEquals("Wrong keystore password", "opendaylight", config.getKeystorePassword());\r
-        assertEquals("Wrong truststore password", "opendaylight", config.getTruststorePassword());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.connection;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class TlsConfigurationImplTest {
+
+    /**
+     * Test correct TlsConfigurationImpl creation
+     */
+    @Test
+    public void test() {
+        TlsConfigurationImpl config = new TlsConfigurationImpl(KeystoreType.JKS,
+                "user/dir", PathType.CLASSPATH, KeystoreType.PKCS12, "/var/lib", PathType.PATH);
+        assertEquals("Wrong keystore location", "/var/lib", config.getTlsKeystore());
+        assertEquals("Wrong truststore location", "user/dir", config.getTlsTruststore());
+        assertEquals("Wrong keystore type", KeystoreType.PKCS12, config.getTlsKeystoreType());
+        assertEquals("Wrong truststore type", KeystoreType.JKS, config.getTlsTruststoreType());
+        assertEquals("Wrong keystore path type", PathType.PATH, config.getTlsKeystorePathType());
+        assertEquals("Wrong truststore path type", PathType.CLASSPATH, config.getTlsTruststorePathType());
+        assertEquals("Wrong certificate password", "opendaylight", config.getCertificatePassword());
+        assertEquals("Wrong keystore password", "opendaylight", config.getKeystorePassword());
+        assertEquals("Wrong truststore password", "opendaylight", config.getTruststorePassword());
+    }
 }
\ No newline at end of file
index 7b350d55c42d59afe3ee897971792bad6f4e9e49..82377828c6ccaeab741ca8ddb228e0c11f535602 100644 (file)
@@ -1,74 +1,74 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class EnhancedMessageCodeKeyTest {\r
-\r
-    /**\r
-     * Test EnhancedMessageCodeKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        EnhancedMessageCodeKey key1 =\r
-                new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);\r
-        EnhancedMessageCodeKey key2 =\r
-                new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new EnhancedMessageCodeKey(EncodeConstants.OF13_VERSION_ID, 4, 8, BarrierInput.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierOutput.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 6, 8, BarrierInput.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 16, BarrierInput.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
-    \r
-    /**\r
-     * Test EnhancedMessageTypeKey equals - additional test\r
-     */\r
-    @Test\r
-    public void testEquals() {\r
-         EnhancedMessageCodeKey key1 =\r
-                 new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);\r
-         \r
-         Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-         Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-    }\r
-\r
-    /**\r
-     * Test EnhancedMessageCodeKey toString()\r
-     */\r
-    @Test\r
-    public void testToString() {\r
-        EnhancedMessageCodeKey key1 =\r
-                new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);\r
-\r
-        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.protocol.rev130731.BarrierInput msgType: 4 msgType2: 8", key1.toString());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class EnhancedMessageCodeKeyTest {
+
+    /**
+     * Test EnhancedMessageCodeKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        EnhancedMessageCodeKey key1 =
+                new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);
+        EnhancedMessageCodeKey key2 =
+                new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new EnhancedMessageCodeKey(EncodeConstants.OF13_VERSION_ID, 4, 8, BarrierInput.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierOutput.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 6, 8, BarrierInput.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 16, BarrierInput.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
+    
+    /**
+     * Test EnhancedMessageTypeKey equals - additional test
+     */
+    @Test
+    public void testEquals() {
+         EnhancedMessageCodeKey key1 =
+                 new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);
+         
+         Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+         Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+    }
+
+    /**
+     * Test EnhancedMessageCodeKey toString()
+     */
+    @Test
+    public void testToString() {
+        EnhancedMessageCodeKey key1 =
+                new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);
+
+        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.protocol.rev130731.BarrierInput msgType: 4 msgType2: 8", key1.toString());
+    }
 }
\ No newline at end of file
index e6be8a8d19528d88c953b12838bb7a4d874a2a70..40ff08cc706a69a44fbd360d0f3584082882b548 100644 (file)
@@ -1,85 +1,85 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class EnhancedMessageTypeKeyTest {\r
-\r
-    /**\r
-     * Test EnhancedMessageTypeKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        EnhancedMessageTypeKey<?,?> key1 =\r
-                new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
-        EnhancedMessageTypeKey<?,?> key2 =\r
-                new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, Output.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null, Output.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Instruction.class, Output.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, SetField.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
-    \r
-    /**\r
-     * Test EnhancedMessageTypeKey equals - additional test\r
-     */\r
-    @Test\r
-    public void testEquals() {\r
-        EnhancedMessageTypeKey<?,?> key1;\r
-        EnhancedMessageTypeKey<?,?> key2;\r
-        key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
-        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
-        \r
-        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-        \r
-        key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, null);\r
-        Assert.assertFalse("Wrong equal by msgType2.", key1.equals(key2));\r
-        key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);\r
-        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, SetField.class);\r
-        Assert.assertFalse("Wrong equal by msgType2 class name.", key1.equals(key2));\r
-    }\r
-\r
-    /**\r
-     * Test EnhancedMessageTypeKey toString()\r
-     */\r
-    @Test\r
-    public void testToString() {\r
-        EnhancedMessageTypeKey<?,?> key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID,\r
-                Action.class, Output.class);\r
-\r
-         Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                 + ".openflow.common.action.rev130731.actions.grouping.Action msgType2: org.opendaylight.yang.gen.v1.urn"\r
-                 + ".opendaylight.openflow.common.action.rev130731.Output", key1.toString());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class EnhancedMessageTypeKeyTest {
+
+    /**
+     * Test EnhancedMessageTypeKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        EnhancedMessageTypeKey<?,?> key1 =
+                new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);
+        EnhancedMessageTypeKey<?,?> key2 =
+                new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, Output.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null, Output.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Instruction.class, Output.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Action.class, SetField.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
+    
+    /**
+     * Test EnhancedMessageTypeKey equals - additional test
+     */
+    @Test
+    public void testEquals() {
+        EnhancedMessageTypeKey<?,?> key1;
+        EnhancedMessageTypeKey<?,?> key2;
+        key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);
+        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);
+        
+        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+        
+        key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, null);
+        Assert.assertFalse("Wrong equal by msgType2.", key1.equals(key2));
+        key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, Output.class);
+        key2 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, Action.class, SetField.class);
+        Assert.assertFalse("Wrong equal by msgType2 class name.", key1.equals(key2));
+    }
+
+    /**
+     * Test EnhancedMessageTypeKey toString()
+     */
+    @Test
+    public void testToString() {
+        EnhancedMessageTypeKey<?,?> key1 = new EnhancedMessageTypeKey<>(EncodeConstants.OF10_VERSION_ID,
+                Action.class, Output.class);
+
+         Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"
+                 + ".openflow.common.action.rev130731.actions.grouping.Action msgType2: org.opendaylight.yang.gen.v1.urn"
+                 + ".opendaylight.openflow.common.action.rev130731.Output", key1.toString());
+    }
 }
\ No newline at end of file
index 4087a55bd744af0c9c0725923d5bd5e65fcdcf77..2c0425f4064b1c763b853047a65f8c1110f1b6ca 100644 (file)
@@ -1,77 +1,77 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MessageCodeKeyTest {\r
-\r
-    /**\r
-     * Test MessageCodeKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        MessageCodeKey key1 =\r
-                new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
-        MessageCodeKey key2 =\r
-                new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 4, BarrierInput.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierOutput.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 6, BarrierInput.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
-\r
-    /**\r
-     * Test MessageCodeKey equals - additional test\r
-     */\r
-    @Test\r
-    public void testEquals() {\r
-        MessageCodeKey key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
-\r
-        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-        Assert.assertFalse("Wrong equal to null.", key1.equals(null));\r
-        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-\r
-        key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);\r
-        MessageCodeKey key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
-        Assert.assertFalse("Wrong equal by clazz.", key1.equals(key2));\r
-\r
-        key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);\r
-        Assert.assertTrue("Wrong equal by clazz.", key1.equals(key2));\r
-    }\r
-\r
-    /**\r
-     * Test MessageCodeKey toString()\r
-     */\r
-    @Test\r
-    public void testToString() {\r
-        MessageCodeKey key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);\r
-\r
-        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn"\r
-                + ".opendaylight.openflow.protocol.rev130731.BarrierInput msgType: 4", key1.toString());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MessageCodeKeyTest {
+
+    /**
+     * Test MessageCodeKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        MessageCodeKey key1 =
+                new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);
+        MessageCodeKey key2 =
+                new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 4, BarrierInput.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierOutput.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 6, BarrierInput.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
+
+    /**
+     * Test MessageCodeKey equals - additional test
+     */
+    @Test
+    public void testEquals() {
+        MessageCodeKey key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);
+
+        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+        Assert.assertFalse("Wrong equal to null.", key1.equals(null));
+        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+
+        key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);
+        MessageCodeKey key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);
+        Assert.assertFalse("Wrong equal by clazz.", key1.equals(key2));
+
+        key2 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, null);
+        Assert.assertTrue("Wrong equal by clazz.", key1.equals(key2));
+    }
+
+    /**
+     * Test MessageCodeKey toString()
+     */
+    @Test
+    public void testToString() {
+        MessageCodeKey key1 = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, BarrierInput.class);
+
+        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn"
+                + ".opendaylight.openflow.protocol.rev130731.BarrierInput msgType: 4", key1.toString());
+    }
 }
\ No newline at end of file
index 4dbd5541622704c03f98b0f9d9c075639c8cd7de..83f426c4e126dd57038a88e3a4b6ab53a632bc7a 100644 (file)
@@ -1,76 +1,76 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.extensibility;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MessageTypeKeyTest {\r
-\r
-    /**\r
-     * Test MessageTypeKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        MessageTypeKey<?> key1 =\r
-                new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
-        MessageTypeKey<?> key2 =\r
-                new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, BarrierInput.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierOutput.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
-\r
-    /**\r
-     * Test MessageTypeKey equals - additional test\r
-     */\r
-    @Test\r
-    public void testEquals() {\r
-         MessageTypeKey<?> key1;\r
-         MessageTypeKey<?> key2; \r
-         key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
-\r
-         Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-         Assert.assertFalse("Wrong equal to null.", key1.equals(null));\r
-         Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-\r
-         key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);\r
-         key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
-         Assert.assertFalse("Wrong equal by msgType.", key1.equals(key2));\r
-\r
-         key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);\r
-         Assert.assertTrue("Wrong equal by msgType.", key1.equals(key2));\r
-    }\r
-\r
-    /**\r
-     * Test MessageTypeKey toString()\r
-     */\r
-    @Test\r
-    public void testToString() {\r
-         MessageTypeKey<?> key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);\r
-\r
-         Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn"\r
-                 + ".opendaylight.openflow.protocol.rev130731.BarrierInput", key1.toString());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MessageTypeKeyTest {
+
+    /**
+     * Test MessageTypeKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        MessageTypeKey<?> key1 =
+                new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+        MessageTypeKey<?> key2 =
+                new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, BarrierInput.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierOutput.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
+
+    /**
+     * Test MessageTypeKey equals - additional test
+     */
+    @Test
+    public void testEquals() {
+         MessageTypeKey<?> key1;
+         MessageTypeKey<?> key2; 
+         key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+
+         Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+         Assert.assertFalse("Wrong equal to null.", key1.equals(null));
+         Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+
+         key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);
+         key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+         Assert.assertFalse("Wrong equal by msgType.", key1.equals(key2));
+
+         key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);
+         Assert.assertTrue("Wrong equal by msgType.", key1.equals(key2));
+    }
+
+    /**
+     * Test MessageTypeKey toString()
+     */
+    @Test
+    public void testToString() {
+         MessageTypeKey<?> key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+
+         Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn"
+                 + ".opendaylight.openflow.protocol.rev130731.BarrierInput", key1.toString());
+    }
 }
\ No newline at end of file
index 66a09fe9bef05361047549d17825f76c6bc285b9..6ba052b79f2c7caae3e1fa64481d687d48031861 100644 (file)
@@ -1,70 +1,70 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionDeserializerKeyTest {\r
-\r
-    /**\r
-     * Test ActionDeserializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
-        ActionDeserializerKey key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 55L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 11, 42L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
-    \r
-    /**\r
-     * Test ActionDeserializerKey equals - additional test\r
-     */\r
-    @Test\r
-    public void testEquals(){\r
-        ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
-        ActionDeserializerKey key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
-\r
-        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-        Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));\r
-        key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
-        Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));\r
-    }\r
-\r
-    /**\r
-     * Test InstructionDeserializerKey toString()\r
-     */\r
-    @Test\r
-    public void testToString(){\r
-        ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
-\r
-        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn"\r
-                + ".opendaylight.openflow.common.action.rev130731.actions.grouping.Action msgType: 11"\r
-                + " experimenterID: null", key1.toString());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionDeserializerKeyTest {
+
+    /**
+     * Test ActionDeserializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);
+        ActionDeserializerKey key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 55L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 11, 42L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
+    
+    /**
+     * Test ActionDeserializerKey equals - additional test
+     */
+    @Test
+    public void testEquals(){
+        ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+        ActionDeserializerKey key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);
+
+        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+        Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+        key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+        Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));
+    }
+
+    /**
+     * Test InstructionDeserializerKey toString()
+     */
+    @Test
+    public void testToString(){
+        ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+
+        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn"
+                + ".opendaylight.openflow.common.action.rev130731.actions.grouping.Action msgType: 11"
+                + " experimenterID: null", key1.toString());
+    }
 }
\ No newline at end of file
index f9c5225d3568ab57d4f6b741dfad3a7ce7df98cd..043a3cfb1fe37e4d3006f6ae4c8a18d2cfb5c8fe 100644 (file)
@@ -1,81 +1,81 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionSerializerKeyTest {\r
-\r
-    /**\r
-     * Test ActionSerializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ActionSerializerKey<CopyTtlIn> key1 =\r
-                new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);\r
-        ActionSerializerKey<?> key2 =\r
-                new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlOut.class, 42L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 55L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlIn.class, 55L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-    }\r
-    \r
-    /**\r
-     * Test ActionSerializerKey equals - additional test\r
-     */\r
-    @Test\r
-    public void testEquals(){\r
-         ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
-         ActionSerializerKey<?> key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);\r
-         \r
-         Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-         Assert.assertFalse("Wrong equal by actionType", key1.equals(key2));\r
-         \r
-         key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
-         Assert.assertTrue("Wrong equal by action type", key1.equals(key2));\r
-         key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID,  CopyTtlIn.class, null);\r
-         Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));\r
-         key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);\r
-         Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));\r
-    }\r
-\r
-    /**\r
-     * Test ActionSerializerKey toString()\r
-     */\r
-    @Test\r
-    public void testToString(){\r
-        ActionSerializerKey<CopyTtlIn> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);\r
-\r
-        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.actions.grouping.Action action type: org.opendaylight.yang.gen.v1.urn"\r
-                + ".opendaylight.openflow.common.action.rev130731.CopyTtlIn experimenterID: 42", key1.toString());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionSerializerKeyTest {
+
+    /**
+     * Test ActionSerializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        ActionSerializerKey<CopyTtlIn> key1 =
+                new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+        ActionSerializerKey<?> key2 =
+                new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlOut.class, 42L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 55L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlIn.class, 55L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+    }
+    
+    /**
+     * Test ActionSerializerKey equals - additional test
+     */
+    @Test
+    public void testEquals(){
+         ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+         ActionSerializerKey<?> key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+         
+         Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+         Assert.assertFalse("Wrong equal by actionType", key1.equals(key2));
+         
+         key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+         Assert.assertTrue("Wrong equal by action type", key1.equals(key2));
+         key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID,  CopyTtlIn.class, null);
+         Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+         key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, null);
+         Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));
+    }
+
+    /**
+     * Test ActionSerializerKey toString()
+     */
+    @Test
+    public void testToString(){
+        ActionSerializerKey<CopyTtlIn> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, CopyTtlIn.class, 42L);
+
+        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.actions.grouping.Action action type: org.opendaylight.yang.gen.v1.urn"
+                + ".opendaylight.openflow.common.action.rev130731.CopyTtlIn experimenterID: 42", key1.toString());
+    }
 }
\ No newline at end of file
index 2497413a91939968adeb139e702eab02903e8d06..208b4ff7fd7143984ea4e95115a4b8cb7001b414 100644 (file)
@@ -1,70 +1,70 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class InstructionDeserializerKeyTest {\r
-\r
-    /**\r
-     * Test InstructionDeserializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
-        InstructionDeserializerKey key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 55L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 11, 42L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
-    \r
-    /**\r
-     * Test InstructionDeserializerKey equals - additional test\r
-     */\r
-    @Test\r
-    public void testEquals(){\r
-        InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
-        InstructionDeserializerKey key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 24L);\r
-\r
-        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-        Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));\r
-        key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
-        Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));\r
-    }\r
-\r
-    /**\r
-     * Test InstructionDeserializerKey toString()\r
-     */\r
-    @Test\r
-    public void testToString(){\r
-        InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);\r
-\r
-        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.instruction.rev130731.instructions.grouping.Instruction msgType: 11"\r
-                + " experimenterID: null", key1.toString());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class InstructionDeserializerKeyTest {
+
+    /**
+     * Test InstructionDeserializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);
+        InstructionDeserializerKey key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 55L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 11, 42L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
+    
+    /**
+     * Test InstructionDeserializerKey equals - additional test
+     */
+    @Test
+    public void testEquals(){
+        InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+        InstructionDeserializerKey key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 24L);
+
+        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+        Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+        key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+        Assert.assertTrue("Wrong equal by experimenterId", key1.equals(key2));
+    }
+
+    /**
+     * Test InstructionDeserializerKey toString()
+     */
+    @Test
+    public void testToString(){
+        InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
+
+        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.instruction.rev130731.instructions.grouping.Instruction msgType: 11"
+                + " experimenterID: null", key1.toString());
+    }
 }
\ No newline at end of file
index 8e7d1f5fd53676c836b488dfad182af981ae29ca..23aecd79f770219cbffe6b8933131cc749f0d8cb 100644 (file)
@@ -1,85 +1,85 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class InstructionSerializerKeyTest {\r
-\r
-    /**\r
-     * Test InstructionSerializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        InstructionSerializerKey<?> key1 =\r
-                new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
-                InstructionSerializerKey<?> key2 =\r
-                new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, WriteActions.class, 42L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 55L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, ApplyActions.class, 42L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-    }\r
-    \r
-    /**\r
-     * Test InstructionSerializerKey equals  - additional test\r
-     */\r
-    @Test\r
-    public void testEquals(){\r
-        InstructionSerializerKey<?> key1 =\r
-                new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
-        InstructionSerializerKey<?> key2 =\r
-                new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
-\r
-        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-\r
-        key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, null);\r
-        Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));\r
-\r
-        key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
-        key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);\r
-        Assert.assertTrue("Wrong equal by instructionType.", key1.equals(key2));\r
-    }\r
-\r
-    /**\r
-     * Test InstructionSerializerKey toString()\r
-     */\r
-    @Test\r
-    public void testToString(){\r
-        InstructionSerializerKey<?> key1 =\r
-                new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);\r
-\r
-        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.instruction.rev130731.instructions.grouping.Instruction"\r
-                + " instructionType type: org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
-                + ".instruction.rev130731.ApplyActions vendorID: 42", key1.toString());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class InstructionSerializerKeyTest {
+
+    /**
+     * Test InstructionSerializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        InstructionSerializerKey<?> key1 =
+                new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);
+                InstructionSerializerKey<?> key2 =
+                new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, WriteActions.class, 42L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 55L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, ApplyActions.class, 42L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+    }
+    
+    /**
+     * Test InstructionSerializerKey equals  - additional test
+     */
+    @Test
+    public void testEquals(){
+        InstructionSerializerKey<?> key1 =
+                new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);
+        InstructionSerializerKey<?> key2 =
+                new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);
+
+        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+
+        key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, null);
+        Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
+
+        key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+        key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
+        Assert.assertTrue("Wrong equal by instructionType.", key1.equals(key2));
+    }
+
+    /**
+     * Test InstructionSerializerKey toString()
+     */
+    @Test
+    public void testToString(){
+        InstructionSerializerKey<?> key1 =
+                new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActions.class, 42L);
+
+        Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.instruction.rev130731.instructions.grouping.Instruction"
+                + " instructionType type: org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
+                + ".instruction.rev130731.ApplyActions vendorID: 42", key1.toString());
+    }
 }
\ No newline at end of file
index be87d557792e6af09fff09891e993544b8c7b30f..5c69cc65d01f6cdc6e1b49e94bc9f564b8aba943 100644 (file)
@@ -1,83 +1,83 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MatchEntryDeserializerKeyTest {\r
-\r
-    /**\r
-     * Test MatchEntryDeserializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
-        MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 0);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);\r
-        key2.setExperimenterId(158L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
-        key2.setExperimenterId(158L);\r
-        key1.setExperimenterId(158L);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
-    \r
-    /**\r
-     * Test MatchEntryDeserializerKey equals - additional test\r
-     */\r
-    @Test\r
-    public void testEquals() {\r
-         MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
-         MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);\r
-         \r
-         Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-         Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-         \r
-         Long expId1=123456L;\r
-         Long expId2=654321L;\r
-         key1.setExperimenterId(null);\r
-         key2.setExperimenterId(expId2);\r
-         Assert.assertFalse("Wrong equal by experimeterId.", key1.equals(key2));\r
-         \r
-         key1.setExperimenterId(expId1);\r
-         Assert.assertFalse("Wrong equal by experimeterId.", key1.equals(key2));\r
-         Assert.assertFalse("Wrong equals with different object class", key1.equals(key2));\r
-    }\r
-\r
-    /**\r
-     * Test MatchEntryDeserializerKey toString()\r
-     */\r
-    @Test\r
-    public void testToString(){\r
-        MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);\r
-\r
-        Assert.assertEquals("Wrong toString()", "msgVersion: 4 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries msgType: 32768 oxm_field: 42"\r
-                + " experimenterID: null", key1.toString());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MatchEntryDeserializerKeyTest {
+
+    /**
+     * Test MatchEntryDeserializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
+        MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0, 42);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 0);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);
+        key2.setExperimenterId(158L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
+        key2.setExperimenterId(158L);
+        key1.setExperimenterId(158L);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
+    
+    /**
+     * Test MatchEntryDeserializerKey equals - additional test
+     */
+    @Test
+    public void testEquals() {
+         MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
+         MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
+         
+         Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+         Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+         
+         Long expId1=123456L;
+         Long expId2=654321L;
+         key1.setExperimenterId(null);
+         key2.setExperimenterId(expId2);
+         Assert.assertFalse("Wrong equal by experimeterId.", key1.equals(key2));
+         
+         key1.setExperimenterId(expId1);
+         Assert.assertFalse("Wrong equal by experimeterId.", key1.equals(key2));
+         Assert.assertFalse("Wrong equals with different object class", key1.equals(key2));
+    }
+
+    /**
+     * Test MatchEntryDeserializerKey toString()
+     */
+    @Test
+    public void testToString(){
+        MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);
+
+        Assert.assertEquals("Wrong toString()", "msgVersion: 4 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries msgType: 32768 oxm_field: 42"
+                + " experimenterID: null", key1.toString());
+    }
 }
\ No newline at end of file
index 576c446f0e9a3d661aed547e45a5f31b312f9467..0863db37aeead4d153af4b83fb1de42ed30d734d 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm0Class;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MatchEntrySerializerKeyTest {\r
-\r
-    /**\r
-     * Test MatchEntrySerializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        MatchEntrySerializerKey<?, ?> key1 = new MatchEntrySerializerKey<>\r
-                (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
-        MatchEntrySerializerKey<?, ?> key2 = new MatchEntrySerializerKey<>\r
-                (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
-                OpenflowBasicClass.class, InPhyPort.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
-                Nxm0Class.class, InPort.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
-                OpenflowBasicClass.class, InPhyPort.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
-                OpenflowBasicClass.class, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
-                null, InPhyPort.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-        key2.setExperimenterId(42L);\r
-        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());\r
-    }\r
-    \r
-    /**\r
-     * Test MatchEntrySerializerKey equals - additional test \r
-     */\r
-    @Test\r
-    public void testEquals(){\r
-        MatchEntrySerializerKey<?, ?> key1;\r
-        MatchEntrySerializerKey<?, ?> key2;\r
-        key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
-        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
-        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));\r
-        \r
-        Long expId1 = 987654331L;\r
-        Long expId2 = 123456789L;\r
-        \r
-        key1.setExperimenterId(null);\r
-        key2.setExperimenterId(expId2);\r
-        Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));\r
-        key1.setExperimenterId(expId1);\r
-        Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));\r
-        key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, null, InPort.class);\r
-        key1.setExperimenterId(expId2);\r
-        Assert.assertFalse("Wrong equal by oxmClass", key1.equals(key2));\r
-        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, null, InPort.class);\r
-        key2.setExperimenterId(expId2);\r
-        Assert.assertTrue("Wrong equal by oxmClass", key1.equals(key2));\r
-        key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, null);\r
-        key1.setExperimenterId(expId2);\r
-        Assert.assertFalse("Wrong equal by oxmField", key1.equals(key2));\r
-        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, null);\r
-        key2.setExperimenterId(expId2);\r
-        Assert.assertTrue("Wrong equal by oxmField", key1.equals(key2));\r
-    }\r
-\r
-    /**\r
-     * Test MatchEntrySerializerKey toString()\r
-     */\r
-    @Test\r
-    public void testToString(){\r
-        MatchEntrySerializerKey<?, ?> key1;\r
-        key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);\r
-\r
-        Assert.assertEquals("Wrong toString()", "msgVersion: 4 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries oxm_class: org.opendaylight.yang.gen.v1.urn"\r
-                + ".opendaylight.openflow.oxm.rev130731.OpenflowBasicClass oxm_field: org.opendaylight.yang.gen.v1.urn"\r
-                + ".opendaylight.openflow.oxm.rev130731.InPort experimenterID: null", key1.toString());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm0Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MatchEntrySerializerKeyTest {
+
+    /**
+     * Test MatchEntrySerializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        MatchEntrySerializerKey<?, ?> key1 = new MatchEntrySerializerKey<>
+                (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+        MatchEntrySerializerKey<?, ?> key2 = new MatchEntrySerializerKey<>
+                (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+                OpenflowBasicClass.class, InPhyPort.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+                Nxm0Class.class, InPort.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+                OpenflowBasicClass.class, InPhyPort.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+                OpenflowBasicClass.class, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+                null, InPhyPort.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+        key2.setExperimenterId(42L);
+        Assert.assertFalse("Wrong hashCode", key1.hashCode() == key2.hashCode());
+    }
+    
+    /**
+     * Test MatchEntrySerializerKey equals - additional test 
+     */
+    @Test
+    public void testEquals(){
+        MatchEntrySerializerKey<?, ?> key1;
+        MatchEntrySerializerKey<?, ?> key2;
+        key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+        Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+        
+        Long expId1 = 987654331L;
+        Long expId2 = 123456789L;
+        
+        key1.setExperimenterId(null);
+        key2.setExperimenterId(expId2);
+        Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+        key1.setExperimenterId(expId1);
+        Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+        key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, null, InPort.class);
+        key1.setExperimenterId(expId2);
+        Assert.assertFalse("Wrong equal by oxmClass", key1.equals(key2));
+        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, null, InPort.class);
+        key2.setExperimenterId(expId2);
+        Assert.assertTrue("Wrong equal by oxmClass", key1.equals(key2));
+        key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, null);
+        key1.setExperimenterId(expId2);
+        Assert.assertFalse("Wrong equal by oxmField", key1.equals(key2));
+        key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, null);
+        key2.setExperimenterId(expId2);
+        Assert.assertTrue("Wrong equal by oxmField", key1.equals(key2));
+    }
+
+    /**
+     * Test MatchEntrySerializerKey toString()
+     */
+    @Test
+    public void testToString(){
+        MatchEntrySerializerKey<?, ?> key1;
+        key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+
+        Assert.assertEquals("Wrong toString()", "msgVersion: 4 objectType: org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries oxm_class: org.opendaylight.yang.gen.v1.urn"
+                + ".opendaylight.openflow.oxm.rev130731.OpenflowBasicClass oxm_field: org.opendaylight.yang.gen.v1.urn"
+                + ".opendaylight.openflow.oxm.rev130731.InPort experimenterID: null", key1.toString());
+    }
 }
\ No newline at end of file
index 47c59033c9f342e57305483b94ca9a774301ea24..2357c71a9db91d0d2f9c70138d31dc9c5e06f12d 100644 (file)
@@ -1,42 +1,42 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterActionDeserializerKeyTest {\r
-\r
-    /**\r
-     * Test ExperimenterActionDeserializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ExperimenterActionDeserializerKey key1 =\r
-                new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
-        ExperimenterActionDeserializerKey key2 =\r
-                new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterActionDeserializerKeyTest {
+
+    /**
+     * Test ExperimenterActionDeserializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        ExperimenterActionDeserializerKey key1 =
+                new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+        ExperimenterActionDeserializerKey key2 =
+                new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
 }
\ No newline at end of file
index 761698d3bee913ef350cc2319603c1e64749385d..c8111fbda788ecfe332d3090223b527b59a109d2 100644 (file)
@@ -1,73 +1,73 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterActionSerializerKeyTest {\r
-\r
-\r
-    /**\r
-     * Test ExperimenterActionSerializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ExperimenterActionSerializerKey key1 =\r
-                new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);\r
-        ExperimenterActionSerializerKey key2 =\r
-                new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L, TestSubType.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, null, TestSubType.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType2.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
-\r
-    @Test\r
-    public void testEquals() {\r
-        ExperimenterActionSerializerKey key1;\r
-        ExperimenterActionSerializerKey key2;\r
-        key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, null);\r
-        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType2.class);\r
-        Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));\r
-        key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);\r
-        Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));\r
-    }\r
-\r
\r
-    private static class TestSubType extends ExperimenterActionSubType {\r
-        // empty class - only used in test for comparation\r
-    }\r
-\r
-    private static class TestSubType2 extends ExperimenterActionSubType {\r
-        // empty class - only used in test for comparation\r
-    }\r
-    \r
-\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterActionSerializerKeyTest {
+
+
+    /**
+     * Test ExperimenterActionSerializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        ExperimenterActionSerializerKey key1 =
+                new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+        ExperimenterActionSerializerKey key2 =
+                new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L, TestSubType.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, null, TestSubType.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType2.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
+
+    @Test
+    public void testEquals() {
+        ExperimenterActionSerializerKey key1;
+        ExperimenterActionSerializerKey key2;
+        key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, null);
+        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType2.class);
+        Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));
+        key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+        Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));
+    }
+
+    private static class TestSubType extends ExperimenterActionSubType {
+        // empty class - only used in test for comparation
+    }
+
+    private static class TestSubType2 extends ExperimenterActionSubType {
+        // empty class - only used in test for comparation
+    }
+    
+
 }
\ No newline at end of file
index dc3e956bd8b94106f698d9bdbca7529cd24a3f89..6938223a9ed9dc742b241b7e8e434813f5dd965f 100644 (file)
@@ -1,67 +1,67 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterIdDeserializerKeyTest {\r
-\r
-    /**\r
-     * Test ExperimenterIdDeserializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ExperimenterIdDeserializerKey key1 =\r
-                new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
-        ExperimenterIdDeserializerKey key2 =\r
-                new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ErrorMessage.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
-\r
-    /**\r
-     * Test ExperimenterIdDeserializerKey equals - additional test\r
-     */\r
-    @Test\r
-    public void testEquals() {\r
-         ExperimenterIdDeserializerKey key1 =\r
-                 new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);\r
-         Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-         MessageCodeKey mk = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID,EncodeConstants.EXPERIMENTER_VALUE, ExperimenterMessage.class);\r
-         Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));\r
-         ExperimenterIdDeserializerKey key2 =\r
-                 new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
-         Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));\r
-    }\r
-\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterIdDeserializerKeyTest {
+
+    /**
+     * Test ExperimenterIdDeserializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        ExperimenterIdDeserializerKey key1 =
+                new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+        ExperimenterIdDeserializerKey key2 =
+                new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ErrorMessage.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
+
+    /**
+     * Test ExperimenterIdDeserializerKey equals - additional test
+     */
+    @Test
+    public void testEquals() {
+         ExperimenterIdDeserializerKey key1 =
+                 new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);
+         Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+         MessageCodeKey mk = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID,EncodeConstants.EXPERIMENTER_VALUE, ExperimenterMessage.class);
+         Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));
+         ExperimenterIdDeserializerKey key2 =
+                 new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+         Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
+    }
+
 }
\ No newline at end of file
index 97fd73e163d5f117a4c54892c318f138e9df34c7..06f06cbfe7f1f8ccb802e53d2e1e4b6bd4f07416 100644 (file)
@@ -1,67 +1,67 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterIdSerializerKeyTest {\r
-\r
-    /**\r
-     * Test ExperimenterIdSerializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ExperimenterIdSerializerKey<?> key1 =\r
-                new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
-        ExperimenterIdSerializerKey<?> key2 =\r
-                new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, ErrorMessage.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
-    \r
-    /**\r
-     * Test ExperimenterIdSerializerKey equals - additional test\r
-     */\r
-    @Test\r
-    public void testEquals() {\r
-        ExperimenterIdSerializerKey<?> key1 =\r
-                new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);\r
-        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));\r
-        MessageTypeKey<?>mk = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID,ExperimenterMessage.class);\r
-        Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));\r
-        ExperimenterIdSerializerKey<?> key2 =\r
-                new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);\r
-        Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));\r
-    }\r
-    \r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterIdSerializerKeyTest {
+
+    /**
+     * Test ExperimenterIdSerializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        ExperimenterIdSerializerKey<?> key1 =
+                new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+        ExperimenterIdSerializerKey<?> key2 =
+                new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, ErrorMessage.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
+    
+    /**
+     * Test ExperimenterIdSerializerKey equals - additional test
+     */
+    @Test
+    public void testEquals() {
+        ExperimenterIdSerializerKey<?> key1 =
+                new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);
+        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+        MessageTypeKey<?>mk = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID,ExperimenterMessage.class);
+        Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));
+        ExperimenterIdSerializerKey<?> key2 =
+                new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+        Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
+    }
+    
 }
\ No newline at end of file
index 563cb5623f92444b723210a9dc330b8e04a0c14a..fa924f91288e036273dccb4da3dfb8ac158b37ae 100644 (file)
@@ -1,42 +1,42 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterInstructionDeserializerKeyTest {\r
-\r
-    /**\r
-     * Test ExperimenterInstructionDeserializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ExperimenterInstructionDeserializerKey key1 =\r
-                new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
-        ExperimenterInstructionDeserializerKey key2 =\r
-                new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterInstructionDeserializerKeyTest {
+
+    /**
+     * Test ExperimenterInstructionDeserializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        ExperimenterInstructionDeserializerKey key1 =
+                new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+        ExperimenterInstructionDeserializerKey key2 =
+                new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
 }
\ No newline at end of file
index 58c535f807dadb752c56cb291a8f399234a489c1..db78e28cf3227aaaa092b656d585c56db052e04f 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterInstructionSerializerKeyTest {\r
-\r
-    /**\r
-     * Test ExperimenterInstructionSerializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ExperimenterInstructionSerializerKey key1 =\r
-                new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
-        ExperimenterInstructionSerializerKey key2 =\r
-                new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterInstructionSerializerKeyTest {
+
+    /**
+     * Test ExperimenterInstructionSerializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        ExperimenterInstructionSerializerKey key1 =
+                new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+        ExperimenterInstructionSerializerKey key2 =
+                new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+
+    }
 }
\ No newline at end of file
index c453b0b092244ed4dc54336457126303bb2baab1..7328f8c76f12aed9ffefa070b973102f65a70b13 100644 (file)
@@ -1,87 +1,87 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;\r
-import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ChannelInitializerFactory {\r
-\r
-    private long switchIdleTimeOut;\r
-    private DeserializationFactory deserializationFactory;\r
-    private SerializationFactory serializationFactory;\r
-    private TlsConfiguration tlsConfig;\r
-    private SwitchConnectionHandler switchConnectionHandler;\r
-    \r
-    /**\r
-     * @return PublishingChannelInitializer that initializes new channels\r
-     */\r
-    public TcpChannelInitializer createPublishingChannelInitializer() {\r
-        TcpChannelInitializer initializer = new TcpChannelInitializer();\r
-        initializer.setSwitchIdleTimeout(switchIdleTimeOut);\r
-        initializer.setDeserializationFactory(deserializationFactory);\r
-        initializer.setSerializationFactory(serializationFactory);\r
-        initializer.setTlsConfiguration(tlsConfig);\r
-        initializer.setSwitchConnectionHandler(switchConnectionHandler);\r
-        return initializer;\r
-    }\r
-\r
-    /**\r
-     * @return PublishingChannelInitializer that initializes new channels\r
-     */\r
-    public UdpChannelInitializer createUdpChannelInitializer() {\r
-        UdpChannelInitializer initializer = new UdpChannelInitializer();\r
-        initializer.setSwitchIdleTimeout(switchIdleTimeOut);\r
-        initializer.setDeserializationFactory(deserializationFactory);\r
-        initializer.setSerializationFactory(serializationFactory);\r
-        initializer.setSwitchConnectionHandler(switchConnectionHandler);\r
-        return initializer;\r
-    }\r
-\r
-    /**\r
-     * @param switchIdleTimeOut\r
-     */\r
-    public void setSwitchIdleTimeout(long switchIdleTimeOut) {\r
-        this.switchIdleTimeOut = switchIdleTimeOut;\r
-    }\r
-\r
-    /**\r
-     * @param deserializationFactory\r
-     */\r
-    public void setDeserializationFactory(DeserializationFactory deserializationFactory) {\r
-        this.deserializationFactory = deserializationFactory;\r
-    }\r
-\r
-    /**\r
-     * @param serializationFactory\r
-     */\r
-    public void setSerializationFactory(SerializationFactory serializationFactory) {\r
-        this.serializationFactory = serializationFactory;\r
-    }\r
-\r
-    /**\r
-     * @param tlsConfig\r
-     */\r
-    public void setTlsConfig(TlsConfiguration tlsConfig) {\r
-        this.tlsConfig = tlsConfig;\r
-    }\r
-\r
-    /**\r
-     * @param switchConnectionHandler\r
-     */\r
-    public void setSwitchConnectionHandler(SwitchConnectionHandler switchConnectionHandler) {\r
-        this.switchConnectionHandler = switchConnectionHandler;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
+import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ChannelInitializerFactory {
+
+    private long switchIdleTimeOut;
+    private DeserializationFactory deserializationFactory;
+    private SerializationFactory serializationFactory;
+    private TlsConfiguration tlsConfig;
+    private SwitchConnectionHandler switchConnectionHandler;
+    
+    /**
+     * @return PublishingChannelInitializer that initializes new channels
+     */
+    public TcpChannelInitializer createPublishingChannelInitializer() {
+        TcpChannelInitializer initializer = new TcpChannelInitializer();
+        initializer.setSwitchIdleTimeout(switchIdleTimeOut);
+        initializer.setDeserializationFactory(deserializationFactory);
+        initializer.setSerializationFactory(serializationFactory);
+        initializer.setTlsConfiguration(tlsConfig);
+        initializer.setSwitchConnectionHandler(switchConnectionHandler);
+        return initializer;
+    }
+
+    /**
+     * @return PublishingChannelInitializer that initializes new channels
+     */
+    public UdpChannelInitializer createUdpChannelInitializer() {
+        UdpChannelInitializer initializer = new UdpChannelInitializer();
+        initializer.setSwitchIdleTimeout(switchIdleTimeOut);
+        initializer.setDeserializationFactory(deserializationFactory);
+        initializer.setSerializationFactory(serializationFactory);
+        initializer.setSwitchConnectionHandler(switchConnectionHandler);
+        return initializer;
+    }
+
+    /**
+     * @param switchIdleTimeOut
+     */
+    public void setSwitchIdleTimeout(long switchIdleTimeOut) {
+        this.switchIdleTimeOut = switchIdleTimeOut;
+    }
+
+    /**
+     * @param deserializationFactory
+     */
+    public void setDeserializationFactory(DeserializationFactory deserializationFactory) {
+        this.deserializationFactory = deserializationFactory;
+    }
+
+    /**
+     * @param serializationFactory
+     */
+    public void setSerializationFactory(SerializationFactory serializationFactory) {
+        this.serializationFactory = serializationFactory;
+    }
+
+    /**
+     * @param tlsConfig
+     */
+    public void setTlsConfig(TlsConfiguration tlsConfig) {
+        this.tlsConfig = tlsConfig;
+    }
+
+    /**
+     * @param switchConnectionHandler
+     */
+    public void setSwitchConnectionHandler(SwitchConnectionHandler switchConnectionHandler) {
+        this.switchConnectionHandler = switchConnectionHandler;
+    }
 }
\ No newline at end of file
index f4240bcc8f2fc72e245c1423cbd71bc1285ede2a..670f552c64c10f0c811569c69d289eb36813ce1b 100644 (file)
@@ -1,62 +1,62 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.channel.SimpleChannelInboundHandler;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OFDatagramPacketDecoder extends SimpleChannelInboundHandler<VersionMessageUdpWrapper>{\r
-\r
-    private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketDecoder.class);\r
-    private DeserializationFactory deserializationFactory;\r
-\r
-    @Override\r
-    public void channelRead0(ChannelHandlerContext ctx, VersionMessageUdpWrapper msg)\r
-            throws Exception {\r
-        if (LOGGER.isDebugEnabled()) {\r
-                LOGGER.debug("UdpVersionMessageWrapper received");\r
-                LOGGER.debug("<< " + ByteBufUtils.byteBufToHexString(msg.getMessageBuffer()));\r
-        }\r
-        DataObject dataObject = null;\r
-        try {\r
-            dataObject = deserializationFactory.deserialize(msg.getMessageBuffer(),msg.getVersion());\r
-            if (dataObject == null) {\r
-                LOGGER.warn("Translated POJO is null");\r
-            } else {\r
-                MessageConsumer consumer = UdpConnectionMap.getMessageConsumer(msg.getAddress());\r
-                consumer.consume(dataObject);\r
-            }\r
-        } catch(Exception e) {\r
-            LOGGER.warn("Message deserialization failed");\r
-            LOGGER.warn(e.getMessage(), e);\r
-            // TODO: delegate exception to allow easier deserialization\r
-            // debugging / deserialization problem awareness\r
-        } finally {\r
-            msg.getMessageBuffer().release();\r
-        }\r
-    }\r
-\r
-    /**\r
-     * @param deserializationFactory\r
-     */\r
-    public void setDeserializationFactory(DeserializationFactory deserializationFactory) {\r
-        this.deserializationFactory = deserializationFactory;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.SimpleChannelInboundHandler;
+
+import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OFDatagramPacketDecoder extends SimpleChannelInboundHandler<VersionMessageUdpWrapper>{
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketDecoder.class);
+    private DeserializationFactory deserializationFactory;
+
+    @Override
+    public void channelRead0(ChannelHandlerContext ctx, VersionMessageUdpWrapper msg)
+            throws Exception {
+        if (LOGGER.isDebugEnabled()) {
+                LOGGER.debug("UdpVersionMessageWrapper received");
+                LOGGER.debug("<< " + ByteBufUtils.byteBufToHexString(msg.getMessageBuffer()));
+        }
+        DataObject dataObject = null;
+        try {
+            dataObject = deserializationFactory.deserialize(msg.getMessageBuffer(),msg.getVersion());
+            if (dataObject == null) {
+                LOGGER.warn("Translated POJO is null");
+            } else {
+                MessageConsumer consumer = UdpConnectionMap.getMessageConsumer(msg.getAddress());
+                consumer.consume(dataObject);
+            }
+        } catch(Exception e) {
+            LOGGER.warn("Message deserialization failed");
+            LOGGER.warn(e.getMessage(), e);
+            // TODO: delegate exception to allow easier deserialization
+            // debugging / deserialization problem awareness
+        } finally {
+            msg.getMessageBuffer().release();
+        }
+    }
+
+    /**
+     * @param deserializationFactory
+     */
+    public void setDeserializationFactory(DeserializationFactory deserializationFactory) {
+        this.deserializationFactory = deserializationFactory;
+    }
 }
\ No newline at end of file
index ab455f37923be18335579314dcea44344f088700..73a7a00e11317188b70a11c244cabdc7d3b3f955 100644 (file)
@@ -1,56 +1,56 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.UdpMessageListenerWrapper;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.channel.socket.DatagramPacket;\r
-import io.netty.handler.codec.MessageToMessageEncoder;\r
-import io.netty.util.concurrent.Future;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OFDatagramPacketEncoder extends MessageToMessageEncoder<UdpMessageListenerWrapper> {\r
-\r
-    private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketEncoder.class);\r
-    private SerializationFactory serializationFactory;\r
-\r
-    @Override\r
-    protected void encode(ChannelHandlerContext ctx,\r
-            UdpMessageListenerWrapper wrapper, List<Object> out) throws Exception {\r
-        LOGGER.trace("Encoding");\r
-        try {\r
-            ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-            serializationFactory.messageToBuffer(wrapper.getMsg().getVersion(), buffer, wrapper.getMsg());\r
-            out.add(new DatagramPacket(buffer, wrapper.getAddress()));\r
-        } catch(Exception e) {\r
-            LOGGER.warn("Message serialization failed: {}", e.getMessage());\r
-            Future<Void> newFailedFuture = ctx.newFailedFuture(e);\r
-            wrapper.getListener().operationComplete(newFailedFuture);\r
-            return;\r
-        }\r
-    }\r
-\r
-    /**\r
-     * @param serializationFactory\r
-     */\r
-    public void setSerializationFactory(SerializationFactory serializationFactory) {\r
-        this.serializationFactory = serializationFactory;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.impl.core.connection.UdpMessageListenerWrapper;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.socket.DatagramPacket;
+import io.netty.handler.codec.MessageToMessageEncoder;
+import io.netty.util.concurrent.Future;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OFDatagramPacketEncoder extends MessageToMessageEncoder<UdpMessageListenerWrapper> {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketEncoder.class);
+    private SerializationFactory serializationFactory;
+
+    @Override
+    protected void encode(ChannelHandlerContext ctx,
+            UdpMessageListenerWrapper wrapper, List<Object> out) throws Exception {
+        LOGGER.trace("Encoding");
+        try {
+            ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+            serializationFactory.messageToBuffer(wrapper.getMsg().getVersion(), buffer, wrapper.getMsg());
+            out.add(new DatagramPacket(buffer, wrapper.getAddress()));
+        } catch(Exception e) {
+            LOGGER.warn("Message serialization failed: {}", e.getMessage());
+            Future<Void> newFailedFuture = ctx.newFailedFuture(e);
+            wrapper.getListener().operationComplete(newFailedFuture);
+            return;
+        }
+    }
+
+    /**
+     * @param serializationFactory
+     */
+    public void setSerializationFactory(SerializationFactory serializationFactory) {
+        this.serializationFactory = serializationFactory;
+    }
 }
\ No newline at end of file
index 3bda7b211725e0d09650355232f3d27c27c94559..74e9c3a3287d286097ab373b8c9764da51dc967d 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.channel.socket.DatagramPacket;\r
-import io.netty.handler.codec.MessageToMessageDecoder;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterFactoryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionFacade;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OFDatagramPacketHandler extends MessageToMessageDecoder<DatagramPacket> {\r
-\r
-    private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketHandler.class);\r
-\r
-    /** Length of OpenFlow 1.3 header */\r
-    public static final byte LENGTH_OF_HEADER = 8;\r
-    private static final byte LENGTH_INDEX_IN_HEADER = 2;\r
-    private ConnectionAdapterFactory adapterFactory = new ConnectionAdapterFactoryImpl();\r
-    private SwitchConnectionHandler connectionHandler;\r
-\r
-    /**\r
-     * Default constructor\r
-     * @param sch the switchConnectionHandler that decides\r
-     * what to do with incomming message / channel\r
-     */\r
-    public OFDatagramPacketHandler(SwitchConnectionHandler sch) {\r
-        this.connectionHandler = sch;\r
-    }\r
-\r
-    @Override\r
-    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {\r
-        LOGGER.warn("Unexpected exception from downstream.", cause);\r
-        LOGGER.warn("Closing connection.");\r
-        ctx.close();\r
-    }\r
-\r
-    @Override\r
-    protected void decode(ChannelHandlerContext ctx, DatagramPacket msg,\r
-            List<Object> out) throws Exception {\r
-        LOGGER.debug("OFDatagramPacketFramer");\r
-        MessageConsumer consumer = UdpConnectionMap.getMessageConsumer(msg.sender());\r
-        if (consumer == null) {\r
-            ConnectionFacade connectionFacade =\r
-                    adapterFactory.createConnectionFacade(ctx.channel(), msg.sender());\r
-            connectionHandler.onSwitchConnected(connectionFacade);\r
-            connectionFacade.checkListeners();\r
-            UdpConnectionMap.addConnection(msg.sender(), connectionFacade);\r
-        }\r
-        ByteBuf bb = msg.content();\r
-        int readableBytes = bb.readableBytes();\r
-        if (readableBytes < LENGTH_OF_HEADER) {\r
-            if (LOGGER.isDebugEnabled()) {\r
-                LOGGER.debug("skipping bytebuf - too few bytes for header: " + readableBytes + " < " + LENGTH_OF_HEADER );\r
-                LOGGER.debug("bb: " + ByteBufUtils.byteBufToHexString(bb));\r
-            }\r
-            return;\r
-        }\r
-\r
-        int length = bb.getUnsignedShort(bb.readerIndex() + LENGTH_INDEX_IN_HEADER);\r
-        LOGGER.debug("length of actual message: {}", length);\r
-        \r
-        if (readableBytes < length) {\r
-            if (LOGGER.isDebugEnabled()) {\r
-                LOGGER.debug("skipping bytebuf - too few bytes for msg: " +\r
-                        readableBytes + " < " + length);\r
-                LOGGER.debug("bytebuffer: " + ByteBufUtils.byteBufToHexString(bb));\r
-            }\r
-            return;\r
-        }\r
-        LOGGER.debug("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1));\r
-\r
-        \r
-        byte version = bb.readByte();\r
-        if ((version == EncodeConstants.OF13_VERSION_ID) || (version == EncodeConstants.OF10_VERSION_ID)) {\r
-            LOGGER.debug("detected version: " + version);\r
-            ByteBuf messageBuffer = bb.slice();\r
-            out.add(new VersionMessageUdpWrapper(version, messageBuffer, msg.sender()));\r
-            messageBuffer.retain();\r
-        } else {\r
-            LOGGER.warn("detected version: " + version + " - currently not supported");\r
-        }\r
-        bb.skipBytes(bb.readableBytes());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.socket.DatagramPacket;
+import io.netty.handler.codec.MessageToMessageDecoder;
+
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterFactory;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterFactoryImpl;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionFacade;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OFDatagramPacketHandler extends MessageToMessageDecoder<DatagramPacket> {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketHandler.class);
+
+    /** Length of OpenFlow 1.3 header */
+    public static final byte LENGTH_OF_HEADER = 8;
+    private static final byte LENGTH_INDEX_IN_HEADER = 2;
+    private ConnectionAdapterFactory adapterFactory = new ConnectionAdapterFactoryImpl();
+    private SwitchConnectionHandler connectionHandler;
+
+    /**
+     * Default constructor
+     * @param sch the switchConnectionHandler that decides
+     * what to do with incomming message / channel
+     */
+    public OFDatagramPacketHandler(SwitchConnectionHandler sch) {
+        this.connectionHandler = sch;
+    }
+
+    @Override
+    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
+        LOGGER.warn("Unexpected exception from downstream.", cause);
+        LOGGER.warn("Closing connection.");
+        ctx.close();
+    }
+
+    @Override
+    protected void decode(ChannelHandlerContext ctx, DatagramPacket msg,
+            List<Object> out) throws Exception {
+        LOGGER.debug("OFDatagramPacketFramer");
+        MessageConsumer consumer = UdpConnectionMap.getMessageConsumer(msg.sender());
+        if (consumer == null) {
+            ConnectionFacade connectionFacade =
+                    adapterFactory.createConnectionFacade(ctx.channel(), msg.sender());
+            connectionHandler.onSwitchConnected(connectionFacade);
+            connectionFacade.checkListeners();
+            UdpConnectionMap.addConnection(msg.sender(), connectionFacade);
+        }
+        ByteBuf bb = msg.content();
+        int readableBytes = bb.readableBytes();
+        if (readableBytes < LENGTH_OF_HEADER) {
+            if (LOGGER.isDebugEnabled()) {
+                LOGGER.debug("skipping bytebuf - too few bytes for header: " + readableBytes + " < " + LENGTH_OF_HEADER );
+                LOGGER.debug("bb: " + ByteBufUtils.byteBufToHexString(bb));
+            }
+            return;
+        }
+
+        int length = bb.getUnsignedShort(bb.readerIndex() + LENGTH_INDEX_IN_HEADER);
+        LOGGER.debug("length of actual message: {}", length);
+        
+        if (readableBytes < length) {
+            if (LOGGER.isDebugEnabled()) {
+                LOGGER.debug("skipping bytebuf - too few bytes for msg: " +
+                        readableBytes + " < " + length);
+                LOGGER.debug("bytebuffer: " + ByteBufUtils.byteBufToHexString(bb));
+            }
+            return;
+        }
+        LOGGER.debug("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1));
+
+        
+        byte version = bb.readByte();
+        if ((version == EncodeConstants.OF13_VERSION_ID) || (version == EncodeConstants.OF10_VERSION_ID)) {
+            LOGGER.debug("detected version: " + version);
+            ByteBuf messageBuffer = bb.slice();
+            out.add(new VersionMessageUdpWrapper(version, messageBuffer, msg.sender()));
+            messageBuffer.retain();
+        } else {
+            LOGGER.warn("detected version: " + version + " - currently not supported");
+        }
+        bb.skipBytes(bb.readableBytes());
+    }
 }
\ No newline at end of file
index 9a9bf3c4b2f57a33a0aa90e05792f41decebd952..26dad6d1b8ad931e5df4edd76e8edb3428aaae52 100644 (file)
@@ -1,63 +1,63 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-/**\r
- * Stores names of handlers used in pipeline.\r
- * \r
- * @author michal.polkorab\r
- */\r
-public enum PipelineHandlers {\r
-\r
-    /**\r
-     * Detects switch idle state\r
-     */\r
-    IDLE_HANDLER,\r
-    /**\r
-     * Component for handling TLS frames\r
-     */\r
-    SSL_HANDLER,\r
-    /**\r
-     * Decodes incoming messages into message frames\r
-     */\r
-    OF_FRAME_DECODER,\r
-    /**\r
-     * Detects version of incoming OpenFlow Protocol message\r
-     */\r
-    OF_VERSION_DETECTOR,\r
-    /**\r
-     * Transforms OpenFlow Protocol byte messages into POJOs\r
-     */\r
-    OF_DECODER,\r
-    /**\r
-     * Transforms POJOs into OpenFlow Protocol byte messages\r
-     */\r
-    OF_ENCODER,\r
-    /**\r
-     * Delegates translated POJOs into MessageConsumer\r
-     */\r
-    DELEGATING_INBOUND_HANDLER,\r
-    /**\r
-     * Performs efficient flushing\r
-     */\r
-    CHANNEL_OUTBOUNF_QUEUE,\r
-    /**\r
-     * Decodes incoming messages into message frames\r
-     * and filters them based on version supported\r
-     */\r
-    OF_DATAGRAMPACKET_HANDLER,\r
-    /**\r
-     * Transforms OpenFlow Protocol datagram messages into POJOs\r
-     */\r
-    OF_DATAGRAMPACKET_DECODER,\r
-    /**\r
-     * Transforms POJOs into OpenFlow Protocol datagrams\r
-     */\r
-    OF_DATAGRAMPACKET_ENCODER\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+/**
+ * Stores names of handlers used in pipeline.
+ * 
+ * @author michal.polkorab
+ */
+public enum PipelineHandlers {
+
+    /**
+     * Detects switch idle state
+     */
+    IDLE_HANDLER,
+    /**
+     * Component for handling TLS frames
+     */
+    SSL_HANDLER,
+    /**
+     * Decodes incoming messages into message frames
+     */
+    OF_FRAME_DECODER,
+    /**
+     * Detects version of incoming OpenFlow Protocol message
+     */
+    OF_VERSION_DETECTOR,
+    /**
+     * Transforms OpenFlow Protocol byte messages into POJOs
+     */
+    OF_DECODER,
+    /**
+     * Transforms POJOs into OpenFlow Protocol byte messages
+     */
+    OF_ENCODER,
+    /**
+     * Delegates translated POJOs into MessageConsumer
+     */
+    DELEGATING_INBOUND_HANDLER,
+    /**
+     * Performs efficient flushing
+     */
+    CHANNEL_OUTBOUNF_QUEUE,
+    /**
+     * Decodes incoming messages into message frames
+     * and filters them based on version supported
+     */
+    OF_DATAGRAMPACKET_HANDLER,
+    /**
+     * Transforms OpenFlow Protocol datagram messages into POJOs
+     */
+    OF_DATAGRAMPACKET_DECODER,
+    /**
+     * Transforms POJOs into OpenFlow Protocol datagrams
+     */
+    OF_DATAGRAMPACKET_ENCODER
 }
\ No newline at end of file
index 2c486f0035e3377632e626bd306946f5014931c6..2c1d7899f6988d44f60b93b53a6ac2ca4d1da8fd 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.channel.Channel;\r
-import io.netty.channel.ChannelInitializer;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;\r
-import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;\r
-\r
-/**\r
- * @param <CHANNEL_TYPE> Channel type\r
- * @author michal.polkorab\r
- */\r
-public abstract class ProtocolChannelInitializer<CHANNEL_TYPE extends Channel>\r
-        extends ChannelInitializer<CHANNEL_TYPE> {\r
-\r
-    private SwitchConnectionHandler switchConnectionHandler;\r
-    private long switchIdleTimeout;\r
-    private SerializationFactory serializationFactory;\r
-    private DeserializationFactory deserializationFactory;\r
-    private TlsConfiguration tlsConfiguration;\r
-\r
-    /**\r
-     * @param switchConnectionHandler the switchConnectionHandler to set\r
-     */\r
-    public void setSwitchConnectionHandler(final SwitchConnectionHandler switchConnectionHandler) {\r
-        this.switchConnectionHandler = switchConnectionHandler;\r
-    }\r
-\r
-    /**\r
-     * @param switchIdleTimeout the switchIdleTimeout to set\r
-     */\r
-    public void setSwitchIdleTimeout(final long switchIdleTimeout) {\r
-        this.switchIdleTimeout = switchIdleTimeout;\r
-    }\r
-\r
-    /**\r
-     * @param serializationFactory\r
-     */\r
-    public void setSerializationFactory(final SerializationFactory serializationFactory) {\r
-        this.serializationFactory = serializationFactory;\r
-    }\r
-\r
-    /**\r
-     * @param deserializationFactory\r
-     */\r
-    public void setDeserializationFactory(final DeserializationFactory deserializationFactory) {\r
-        this.deserializationFactory = deserializationFactory;\r
-    }\r
-\r
-    /**\r
-     * @param tlsConfiguration\r
-     */\r
-    public void setTlsConfiguration(TlsConfiguration tlsConfiguration) {\r
-        this.tlsConfiguration = tlsConfiguration;\r
-    }\r
-\r
-    /**\r
-     * @return switch connection handler\r
-     */\r
-    public SwitchConnectionHandler getSwitchConnectionHandler() {\r
-        return switchConnectionHandler;\r
-    }\r
-\r
-    /**\r
-     * @return switch idle timeout\r
-     */\r
-    public long getSwitchIdleTimeout() {\r
-        return switchIdleTimeout;\r
-    }\r
-\r
-    /**\r
-     * @return serialization factory\r
-     */\r
-    public SerializationFactory getSerializationFactory() {\r
-        return serializationFactory;\r
-    }\r
-\r
-    /**\r
-     * @return deserialization factory\r
-     */\r
-    public DeserializationFactory getDeserializationFactory() {\r
-        return deserializationFactory;\r
-    }\r
-\r
-    /**\r
-     * @return TLS configuration\r
-     */\r
-    public TlsConfiguration getTlsConfiguration() {\r
-        return tlsConfiguration;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelInitializer;
+
+import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
+import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;
+
+/**
+ * @param <CHANNEL_TYPE> Channel type
+ * @author michal.polkorab
+ */
+public abstract class ProtocolChannelInitializer<CHANNEL_TYPE extends Channel>
+        extends ChannelInitializer<CHANNEL_TYPE> {
+
+    private SwitchConnectionHandler switchConnectionHandler;
+    private long switchIdleTimeout;
+    private SerializationFactory serializationFactory;
+    private DeserializationFactory deserializationFactory;
+    private TlsConfiguration tlsConfiguration;
+
+    /**
+     * @param switchConnectionHandler the switchConnectionHandler to set
+     */
+    public void setSwitchConnectionHandler(final SwitchConnectionHandler switchConnectionHandler) {
+        this.switchConnectionHandler = switchConnectionHandler;
+    }
+
+    /**
+     * @param switchIdleTimeout the switchIdleTimeout to set
+     */
+    public void setSwitchIdleTimeout(final long switchIdleTimeout) {
+        this.switchIdleTimeout = switchIdleTimeout;
+    }
+
+    /**
+     * @param serializationFactory
+     */
+    public void setSerializationFactory(final SerializationFactory serializationFactory) {
+        this.serializationFactory = serializationFactory;
+    }
+
+    /**
+     * @param deserializationFactory
+     */
+    public void setDeserializationFactory(final DeserializationFactory deserializationFactory) {
+        this.deserializationFactory = deserializationFactory;
+    }
+
+    /**
+     * @param tlsConfiguration
+     */
+    public void setTlsConfiguration(TlsConfiguration tlsConfiguration) {
+        this.tlsConfiguration = tlsConfiguration;
+    }
+
+    /**
+     * @return switch connection handler
+     */
+    public SwitchConnectionHandler getSwitchConnectionHandler() {
+        return switchConnectionHandler;
+    }
+
+    /**
+     * @return switch idle timeout
+     */
+    public long getSwitchIdleTimeout() {
+        return switchIdleTimeout;
+    }
+
+    /**
+     * @return serialization factory
+     */
+    public SerializationFactory getSerializationFactory() {
+        return serializationFactory;
+    }
+
+    /**
+     * @return deserialization factory
+     */
+    public DeserializationFactory getDeserializationFactory() {
+        return deserializationFactory;
+    }
+
+    /**
+     * @return TLS configuration
+     */
+    public TlsConfiguration getTlsConfiguration() {
+        return tlsConfiguration;
+    }
 }
\ No newline at end of file
index 518714403c2f3cb2d38212e05f4fb3314069c403..9ff7d65b4dcd073e7d84efd47b789da946680aeb 100644 (file)
@@ -1,32 +1,32 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.channel.socket.nio.NioDatagramChannel;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class UdpChannelInitializer extends ProtocolChannelInitializer<NioDatagramChannel> {\r
-\r
-    @Override\r
-    protected void initChannel(NioDatagramChannel ch) throws Exception {\r
-        ch.pipeline().addLast(PipelineHandlers.OF_DATAGRAMPACKET_HANDLER.name(),\r
-                new OFDatagramPacketHandler(getSwitchConnectionHandler()));\r
-        OFDatagramPacketDecoder ofDatagramPacketDecoder = new OFDatagramPacketDecoder();\r
-        ofDatagramPacketDecoder.setDeserializationFactory(getDeserializationFactory());\r
-        ch.pipeline().addLast(PipelineHandlers.OF_DATAGRAMPACKET_DECODER.name(),\r
-                ofDatagramPacketDecoder);\r
-        OFDatagramPacketEncoder ofDatagramPacketEncoder = new OFDatagramPacketEncoder();\r
-        ofDatagramPacketEncoder.setSerializationFactory(getSerializationFactory());\r
-        ch.pipeline().addLast(PipelineHandlers.OF_ENCODER.name(), ofDatagramPacketEncoder);\r
-//        connectionFacade.fireConnectionReadyNotification();\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+import io.netty.channel.socket.nio.NioDatagramChannel;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class UdpChannelInitializer extends ProtocolChannelInitializer<NioDatagramChannel> {
+
+    @Override
+    protected void initChannel(NioDatagramChannel ch) throws Exception {
+        ch.pipeline().addLast(PipelineHandlers.OF_DATAGRAMPACKET_HANDLER.name(),
+                new OFDatagramPacketHandler(getSwitchConnectionHandler()));
+        OFDatagramPacketDecoder ofDatagramPacketDecoder = new OFDatagramPacketDecoder();
+        ofDatagramPacketDecoder.setDeserializationFactory(getDeserializationFactory());
+        ch.pipeline().addLast(PipelineHandlers.OF_DATAGRAMPACKET_DECODER.name(),
+                ofDatagramPacketDecoder);
+        OFDatagramPacketEncoder ofDatagramPacketEncoder = new OFDatagramPacketEncoder();
+        ofDatagramPacketEncoder.setSerializationFactory(getSerializationFactory());
+        ch.pipeline().addLast(PipelineHandlers.OF_ENCODER.name(), ofDatagramPacketEncoder);
+//        connectionFacade.fireConnectionReadyNotification();
+    }
 }
\ No newline at end of file
index d33f3a0bb429fd256f19b126eaeea20f70d5208f..d23d5ada1c63d46ec99ba47dd64d54d6a4579de1 100644 (file)
@@ -1,62 +1,62 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-import java.net.InetSocketAddress;\r
-import java.util.Map;\r
-import java.util.concurrent.ConcurrentHashMap;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;\r
-\r
-/**\r
- * As UDP communication is handled only by one channel, it is needed\r
- * to store MessageConsumers, so that we know which consumer handles which channel\r
-\r
- * @author michal.polkorab\r
- */\r
-public final class UdpConnectionMap {\r
-\r
-    private static Map<InetSocketAddress, MessageConsumer> connectionMap = new ConcurrentHashMap<>();\r
-\r
-    private UdpConnectionMap() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * @param address sender's address\r
-     * @return corresponding MessageConsumer\r
-     */\r
-    public static MessageConsumer getMessageConsumer(InetSocketAddress address) {\r
-        if(address == null){\r
-            throw new IllegalArgumentException("Address can not be null");\r
-        }\r
-        return connectionMap.get(address);\r
-    }\r
-\r
-    /**\r
-     * @param address sender's address\r
-     * @param consumer MessageConsumer to be added / paired with specified address\r
-     */\r
-    public static void addConnection(InetSocketAddress address, MessageConsumer consumer) {\r
-        if(address == null){\r
-            throw new IllegalArgumentException("Address can not be null");\r
-        }\r
-        connectionMap.put(address, consumer);\r
-    }\r
-\r
-    /**\r
-     * @param address sender's address\r
-     */\r
-    public static void removeConnection(InetSocketAddress address) {\r
-        if(address == null){\r
-            throw new IllegalArgumentException("Address can not be null");\r
-        }\r
-        connectionMap.remove(address);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+import java.net.InetSocketAddress;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;
+
+/**
+ * As UDP communication is handled only by one channel, it is needed
+ * to store MessageConsumers, so that we know which consumer handles which channel
+
+ * @author michal.polkorab
+ */
+public final class UdpConnectionMap {
+
+    private static Map<InetSocketAddress, MessageConsumer> connectionMap = new ConcurrentHashMap<>();
+
+    private UdpConnectionMap() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * @param address sender's address
+     * @return corresponding MessageConsumer
+     */
+    public static MessageConsumer getMessageConsumer(InetSocketAddress address) {
+        if(address == null){
+            throw new IllegalArgumentException("Address can not be null");
+        }
+        return connectionMap.get(address);
+    }
+
+    /**
+     * @param address sender's address
+     * @param consumer MessageConsumer to be added / paired with specified address
+     */
+    public static void addConnection(InetSocketAddress address, MessageConsumer consumer) {
+        if(address == null){
+            throw new IllegalArgumentException("Address can not be null");
+        }
+        connectionMap.put(address, consumer);
+    }
+
+    /**
+     * @param address sender's address
+     */
+    public static void removeConnection(InetSocketAddress address) {
+        if(address == null){
+            throw new IllegalArgumentException("Address can not be null");
+        }
+        connectionMap.remove(address);
+    }
 }
\ No newline at end of file
index 2ebeec76fca26e9b5aabb782f224af156f54cb05..0d7bb4e5b13783625d9dc138184e762f2c3e9143 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.bootstrap.Bootstrap;\r
-import io.netty.channel.ChannelFuture;\r
-import io.netty.channel.ChannelOption;\r
-import io.netty.channel.EventLoopGroup;\r
-import io.netty.channel.nio.NioEventLoopGroup;\r
-import io.netty.channel.socket.nio.NioDatagramChannel;\r
-import io.netty.util.concurrent.GenericFutureListener;\r
-\r
-import java.net.InetAddress;\r
-import java.net.InetSocketAddress;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.connection.ThreadConfiguration;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import com.google.common.util.concurrent.ListenableFuture;\r
-import com.google.common.util.concurrent.SettableFuture;\r
-\r
-/**\r
- * Class implementing server over UDP for handling incoming connections.\r
- * \r
- * @author michal.polkorab\r
- */\r
-public final class UdpHandler implements ServerFacade {\r
-\r
-    private static final Logger LOGGER = LoggerFactory\r
-            .getLogger(UdpHandler.class);\r
-    private int port;\r
-    private EventLoopGroup group;\r
-    private final InetAddress startupAddress;\r
-    private final SettableFuture<Boolean> isOnlineFuture;\r
-    private UdpChannelInitializer channelInitializer;\r
-    private ThreadConfiguration threadConfig;\r
-\r
-    /**\r
-     * Constructor of UdpHandler that listens on selected port.\r
-     *\r
-     * @param port listening port of UdpHandler server\r
-     */\r
-    public UdpHandler(final int port) {\r
-        this(null, port);\r
-    }\r
-\r
-    /**\r
-     * Constructor of UdpHandler that listens on selected address and port.\r
-     * @param address listening address of UdpHandler server\r
-     * @param port listening port of UdpHandler server\r
-     */\r
-    public UdpHandler(final InetAddress address, final int port) {\r
-        this.port = port;\r
-        this.startupAddress = address;\r
-        isOnlineFuture = SettableFuture.create();\r
-    }\r
-\r
-    @Override\r
-    public void run() {\r
-        if (threadConfig != null) {\r
-            group = new NioEventLoopGroup(threadConfig.getWorkerThreadCount());\r
-        } else {\r
-            group = new NioEventLoopGroup();\r
-        }\r
-        final ChannelFuture f;\r
-        try {\r
-            Bootstrap b = new Bootstrap();\r
-            b.group(group)\r
-             .channel(NioDatagramChannel.class)\r
-             .option(ChannelOption.SO_BROADCAST, false)\r
-             .handler(channelInitializer);\r
-\r
-            if (startupAddress != null) {\r
-                f = b.bind(startupAddress.getHostAddress(), port).sync();\r
-            } else {\r
-                f = b.bind(port).sync();\r
-            }\r
-        } catch (InterruptedException e) {\r
-            LOGGER.error("Interrupted while binding port {}", port, e);\r
-            return;\r
-        }\r
-\r
-        try {\r
-            InetSocketAddress isa = (InetSocketAddress) f.channel().localAddress();\r
-            String address = isa.getHostString();\r
-\r
-            // Update port, as it may have been specified as 0\r
-            this.port = isa.getPort();\r
-\r
-            LOGGER.debug("Address from udpHandler: {}", address);\r
-            isOnlineFuture.set(true);\r
-            LOGGER.info("Switch listener started and ready to accept incoming udp connections on port: {}", port);\r
-            f.channel().closeFuture().sync();\r
-        } catch (InterruptedException e) {\r
-            LOGGER.error("Interrupted while waiting for port {} shutdown", port, e);\r
-        } finally {\r
-            shutdown();\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public ListenableFuture<Boolean> shutdown() {\r
-        final SettableFuture<Boolean> result = SettableFuture.create();\r
-        group.shutdownGracefully().addListener(new GenericFutureListener<io.netty.util.concurrent.Future<Object>>() {\r
-\r
-            @Override\r
-            public void operationComplete(\r
-                    final io.netty.util.concurrent.Future<Object> downResult) throws Exception {\r
-                result.set(downResult.isSuccess());\r
-                if (downResult.cause() != null) {\r
-                    result.setException(downResult.cause());\r
-                }\r
-            }\r
-\r
-        });\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public ListenableFuture<Boolean> getIsOnlineFuture() {\r
-        return isOnlineFuture;\r
-    }\r
-\r
-    /**\r
-     * @return the port\r
-     */\r
-    public int getPort() {\r
-        return port;\r
-    }\r
-\r
-    /**\r
-     * @param channelInitializer\r
-     */\r
-    public void setChannelInitializer(UdpChannelInitializer channelInitializer) {\r
-        this.channelInitializer = channelInitializer;\r
-    }\r
-\r
-    @Override\r
-    public void setThreadConfig(ThreadConfiguration threadConfig) {\r
-        this.threadConfig = threadConfig;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+import io.netty.bootstrap.Bootstrap;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.nio.NioDatagramChannel;
+import io.netty.util.concurrent.GenericFutureListener;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+
+import org.opendaylight.openflowjava.protocol.api.connection.ThreadConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
+
+/**
+ * Class implementing server over UDP for handling incoming connections.
+ * 
+ * @author michal.polkorab
+ */
+public final class UdpHandler implements ServerFacade {
+
+    private static final Logger LOGGER = LoggerFactory
+            .getLogger(UdpHandler.class);
+    private int port;
+    private EventLoopGroup group;
+    private final InetAddress startupAddress;
+    private final SettableFuture<Boolean> isOnlineFuture;
+    private UdpChannelInitializer channelInitializer;
+    private ThreadConfiguration threadConfig;
+
+    /**
+     * Constructor of UdpHandler that listens on selected port.
+     *
+     * @param port listening port of UdpHandler server
+     */
+    public UdpHandler(final int port) {
+        this(null, port);
+    }
+
+    /**
+     * Constructor of UdpHandler that listens on selected address and port.
+     * @param address listening address of UdpHandler server
+     * @param port listening port of UdpHandler server
+     */
+    public UdpHandler(final InetAddress address, final int port) {
+        this.port = port;
+        this.startupAddress = address;
+        isOnlineFuture = SettableFuture.create();
+    }
+
+    @Override
+    public void run() {
+        if (threadConfig != null) {
+            group = new NioEventLoopGroup(threadConfig.getWorkerThreadCount());
+        } else {
+            group = new NioEventLoopGroup();
+        }
+        final ChannelFuture f;
+        try {
+            Bootstrap b = new Bootstrap();
+            b.group(group)
+             .channel(NioDatagramChannel.class)
+             .option(ChannelOption.SO_BROADCAST, false)
+             .handler(channelInitializer);
+
+            if (startupAddress != null) {
+                f = b.bind(startupAddress.getHostAddress(), port).sync();
+            } else {
+                f = b.bind(port).sync();
+            }
+        } catch (InterruptedException e) {
+            LOGGER.error("Interrupted while binding port {}", port, e);
+            return;
+        }
+
+        try {
+            InetSocketAddress isa = (InetSocketAddress) f.channel().localAddress();
+            String address = isa.getHostString();
+
+            // Update port, as it may have been specified as 0
+            this.port = isa.getPort();
+
+            LOGGER.debug("Address from udpHandler: {}", address);
+            isOnlineFuture.set(true);
+            LOGGER.info("Switch listener started and ready to accept incoming udp connections on port: {}", port);
+            f.channel().closeFuture().sync();
+        } catch (InterruptedException e) {
+            LOGGER.error("Interrupted while waiting for port {} shutdown", port, e);
+        } finally {
+            shutdown();
+        }
+    }
+
+    @Override
+    public ListenableFuture<Boolean> shutdown() {
+        final SettableFuture<Boolean> result = SettableFuture.create();
+        group.shutdownGracefully().addListener(new GenericFutureListener<io.netty.util.concurrent.Future<Object>>() {
+
+            @Override
+            public void operationComplete(
+                    final io.netty.util.concurrent.Future<Object> downResult) throws Exception {
+                result.set(downResult.isSuccess());
+                if (downResult.cause() != null) {
+                    result.setException(downResult.cause());
+                }
+            }
+
+        });
+        return result;
+    }
+
+    @Override
+    public ListenableFuture<Boolean> getIsOnlineFuture() {
+        return isOnlineFuture;
+    }
+
+    /**
+     * @return the port
+     */
+    public int getPort() {
+        return port;
+    }
+
+    /**
+     * @param channelInitializer
+     */
+    public void setChannelInitializer(UdpChannelInitializer channelInitializer) {
+        this.channelInitializer = channelInitializer;
+    }
+
+    @Override
+    public void setThreadConfig(ThreadConfiguration threadConfig) {
+        this.threadConfig = threadConfig;
+    }
 }
\ No newline at end of file
index 087bcb6b2bd41b99af44cb88172dbc3c9ef44ded..e9a8bf98b59a0860cd2045a47337a6f212561cff 100644 (file)
@@ -1,40 +1,40 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.net.InetSocketAddress;\r
-\r
-/**\r
- * Wraps received messages (includes version) and sender address\r
\r
- * @author michal.polkorab\r
- */\r
-public class VersionMessageUdpWrapper extends VersionMessageWrapper {\r
-\r
-    private InetSocketAddress address;\r
-\r
-    /**\r
-     * @param version Openflow wire version\r
-     * @param messageBuffer ByteBuf containing binary message\r
-     * @param address sender address\r
-     */\r
-    public VersionMessageUdpWrapper(short version, ByteBuf messageBuffer, InetSocketAddress address) {\r
-        super(version, messageBuffer);\r
-        this.address = address;\r
-    }\r
-\r
-    /**\r
-     * @return sender address\r
-     */\r
-    public InetSocketAddress getAddress() {\r
-        return address;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+import io.netty.buffer.ByteBuf;
+
+import java.net.InetSocketAddress;
+
+/**
+ * Wraps received messages (includes version) and sender address
+ * @author michal.polkorab
+ */
+public class VersionMessageUdpWrapper extends VersionMessageWrapper {
+
+    private InetSocketAddress address;
+
+    /**
+     * @param version Openflow wire version
+     * @param messageBuffer ByteBuf containing binary message
+     * @param address sender address
+     */
+    public VersionMessageUdpWrapper(short version, ByteBuf messageBuffer, InetSocketAddress address) {
+        super(version, messageBuffer);
+        this.address = address;
+    }
+
+    /**
+     * @return sender address
+     */
+    public InetSocketAddress getAddress() {
+        return address;
+    }
 }
\ No newline at end of file
index 51ab4b820acc0c3dfa55012a1e79bcfd9a925e4b..ec415b389a9d54548ada7b21f2a9795842022b9b 100644 (file)
@@ -1,50 +1,50 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core.connection;\r
-\r
-import io.netty.util.concurrent.Future;\r
-import io.netty.util.concurrent.GenericFutureListener;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;\r
-\r
-/**\r
- * Wraps outgoing message and includes listener attached to this message. This object\r
- * is sent to OFEncoder. When OFEncoder fails to serialize the message,\r
- * listener is filled with exception. The exception is then delegated to upper ODL layers. \r
- * @author michal.polkorab\r
- */\r
-public class MessageListenerWrapper {\r
-\r
-    private OfHeader msg;\r
-    private GenericFutureListener<Future<Void>> listener;\r
-\r
-    /**\r
-     * @param msg outgoing message\r
-     * @param listener listener attached to channel.write(msg) Future\r
-     */\r
-    public MessageListenerWrapper(Object msg, GenericFutureListener<Future<Void>> listener) {\r
-        this.msg = (OfHeader) msg;\r
-        this.listener = listener;\r
-    }\r
-\r
-    /**\r
-     * @return outgoing message (downstream)\r
-     */\r
-    public OfHeader getMsg() {\r
-        return msg;\r
-    }\r
-\r
-    \r
-    /**\r
-     * @return listener listening on message sending success / failure\r
-     */\r
-    public GenericFutureListener<Future<Void>> getListener() {\r
-        return listener;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core.connection;
+
+import io.netty.util.concurrent.Future;
+import io.netty.util.concurrent.GenericFutureListener;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+
+/**
+ * Wraps outgoing message and includes listener attached to this message. This object
+ * is sent to OFEncoder. When OFEncoder fails to serialize the message,
+ * listener is filled with exception. The exception is then delegated to upper ODL layers. 
+ * @author michal.polkorab
+ */
+public class MessageListenerWrapper {
+
+    private OfHeader msg;
+    private GenericFutureListener<Future<Void>> listener;
+
+    /**
+     * @param msg outgoing message
+     * @param listener listener attached to channel.write(msg) Future
+     */
+    public MessageListenerWrapper(Object msg, GenericFutureListener<Future<Void>> listener) {
+        this.msg = (OfHeader) msg;
+        this.listener = listener;
+    }
+
+    /**
+     * @return outgoing message (downstream)
+     */
+    public OfHeader getMsg() {
+        return msg;
+    }
+
+    
+    /**
+     * @return listener listening on message sending success / failure
+     */
+    public GenericFutureListener<Future<Void>> getListener() {
+        return listener;
+    }
 }
\ No newline at end of file
index 56d004bdc51e13693a5888ad757ca3af4b1060db..a946cf5468be6a033272ff15c01d469e16a1d93a 100644 (file)
@@ -1,45 +1,45 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core.connection;\r
-\r
-import io.netty.util.concurrent.Future;\r
-import io.netty.util.concurrent.GenericFutureListener;\r
-\r
-import java.net.InetSocketAddress;\r
-\r
-/**\r
- * Wraps outgoing message and includes listener attached to this message. This object\r
- * is sent to OFEncoder. When OFEncoder fails to serialize the message,\r
- * listener is filled with exception. The exception is then delegated to upper ODL layers.\r
- * This object is used for UDP communication - it also carries recipient address\r
\r
- * @author michal.polkorab\r
- */\r
-public class UdpMessageListenerWrapper extends MessageListenerWrapper {\r
-\r
-    private InetSocketAddress address;\r
-\r
-    /**\r
-     * @param msg message to be sent\r
-     * @param listener listener attached to channel.write(msg) Future\r
-     * @param address recipient's address\r
-     */\r
-    public UdpMessageListenerWrapper(Object msg, GenericFutureListener<Future<Void>> listener,\r
-            InetSocketAddress address) {\r
-        super(msg, listener);\r
-        this.address = address;\r
-    }\r
-\r
-    /**\r
-     * @return recipient address\r
-     */\r
-    public InetSocketAddress getAddress() {\r
-        return address;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core.connection;
+
+import io.netty.util.concurrent.Future;
+import io.netty.util.concurrent.GenericFutureListener;
+
+import java.net.InetSocketAddress;
+
+/**
+ * Wraps outgoing message and includes listener attached to this message. This object
+ * is sent to OFEncoder. When OFEncoder fails to serialize the message,
+ * listener is filled with exception. The exception is then delegated to upper ODL layers.
+ * This object is used for UDP communication - it also carries recipient address
+ * @author michal.polkorab
+ */
+public class UdpMessageListenerWrapper extends MessageListenerWrapper {
+
+    private InetSocketAddress address;
+
+    /**
+     * @param msg message to be sent
+     * @param listener listener attached to channel.write(msg) Future
+     * @param address recipient's address
+     */
+    public UdpMessageListenerWrapper(Object msg, GenericFutureListener<Future<Void>> listener,
+            InetSocketAddress address) {
+        super(msg, listener);
+        this.address = address;
+    }
+
+    /**
+     * @return recipient address
+     */
+    public InetSocketAddress getAddress() {
+        return address;
+    }
 }
\ No newline at end of file
index cbec7394db3e51e7d8451f167a1db87a917be7b2..e946f30f19f5c759a2be8dd00e035cc4ec77fd5e 100644 (file)
@@ -1,92 +1,92 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10EnqueueActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10OutputActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetDlDstActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetDlSrcActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwDstActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwSrcActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwTosActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetTpDstActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetTpSrcActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetVlanPcpActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetVlanVidActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10StripVlanActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13CopyTtlInActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13CopyTtlOutActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13DecMplsTtlActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13DecNwTtlActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13GroupActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13OutputActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopMplsActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopPbbActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopVlanActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushMplsActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushPbbActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushVlanActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetFieldActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetMplsTtlActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetNwTtlActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetQueueActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionDeserializerRegistryHelper;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ActionDeserializerInitializer {\r
-\r
-    private ActionDeserializerInitializer() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * Registers action deserializers\r
-     * @param registry registry to be filled with deserializers\r
-     */\r
-    public static void registerDeserializers(DeserializerRegistry registry) {\r
-        // register OF v1.0 action deserializers\r
-        ActionDeserializerRegistryHelper helper = \r
-                new ActionDeserializerRegistryHelper(EncodeConstants.OF10_VERSION_ID, registry);\r
-        helper.registerDeserializer(0, new OF10OutputActionDeserializer());\r
-        helper.registerDeserializer(1, new OF10SetVlanVidActionDeserializer());\r
-        helper.registerDeserializer(2, new OF10SetVlanPcpActionDeserializer());\r
-        helper.registerDeserializer(3, new OF10StripVlanActionDeserializer());\r
-        helper.registerDeserializer(4, new OF10SetDlSrcActionDeserializer());\r
-        helper.registerDeserializer(5, new OF10SetDlDstActionDeserializer());\r
-        helper.registerDeserializer(6, new OF10SetNwSrcActionDeserializer());\r
-        helper.registerDeserializer(7, new OF10SetNwDstActionDeserializer());\r
-        helper.registerDeserializer(8, new OF10SetNwTosActionDeserializer());\r
-        helper.registerDeserializer(9, new OF10SetTpSrcActionDeserializer());\r
-        helper.registerDeserializer(10, new OF10SetTpDstActionDeserializer());\r
-        helper.registerDeserializer(11, new OF10EnqueueActionDeserializer());\r
-        // register OF v1.3 action deserializers\r
-        helper = new ActionDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);\r
-        helper.registerDeserializer(0, new OF13OutputActionDeserializer());\r
-        helper.registerDeserializer(11, new OF13CopyTtlOutActionDeserializer());\r
-        helper.registerDeserializer(12, new OF13CopyTtlInActionDeserializer());\r
-        helper.registerDeserializer(15, new OF13SetMplsTtlActionDeserializer());\r
-        helper.registerDeserializer(16, new OF13DecMplsTtlActionDeserializer());\r
-        helper.registerDeserializer(17, new OF13PushVlanActionDeserializer());\r
-        helper.registerDeserializer(18, new OF13PopVlanActionDeserializer());\r
-        helper.registerDeserializer(19, new OF13PushMplsActionDeserializer());\r
-        helper.registerDeserializer(20, new OF13PopMplsActionDeserializer());\r
-        helper.registerDeserializer(21, new OF13SetQueueActionDeserializer());\r
-        helper.registerDeserializer(22, new OF13GroupActionDeserializer());\r
-        helper.registerDeserializer(23, new OF13SetNwTtlActionDeserializer());\r
-        helper.registerDeserializer(24, new OF13DecNwTtlActionDeserializer());\r
-        helper.registerDeserializer(25, new OF13SetFieldActionDeserializer());\r
-        helper.registerDeserializer(26, new OF13PushPbbActionDeserializer());\r
-        helper.registerDeserializer(27, new OF13PopPbbActionDeserializer());\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10EnqueueActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10OutputActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetDlDstActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetDlSrcActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwDstActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwSrcActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetNwTosActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetTpDstActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetTpSrcActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetVlanPcpActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10SetVlanVidActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10StripVlanActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13CopyTtlInActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13CopyTtlOutActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13DecMplsTtlActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13DecNwTtlActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13GroupActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13OutputActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopMplsActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopPbbActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PopVlanActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushMplsActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushPbbActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13PushVlanActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetFieldActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetMplsTtlActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetNwTtlActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetQueueActionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.util.ActionDeserializerRegistryHelper;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ActionDeserializerInitializer {
+
+    private ActionDeserializerInitializer() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * Registers action deserializers
+     * @param registry registry to be filled with deserializers
+     */
+    public static void registerDeserializers(DeserializerRegistry registry) {
+        // register OF v1.0 action deserializers
+        ActionDeserializerRegistryHelper helper = 
+                new ActionDeserializerRegistryHelper(EncodeConstants.OF10_VERSION_ID, registry);
+        helper.registerDeserializer(0, new OF10OutputActionDeserializer());
+        helper.registerDeserializer(1, new OF10SetVlanVidActionDeserializer());
+        helper.registerDeserializer(2, new OF10SetVlanPcpActionDeserializer());
+        helper.registerDeserializer(3, new OF10StripVlanActionDeserializer());
+        helper.registerDeserializer(4, new OF10SetDlSrcActionDeserializer());
+        helper.registerDeserializer(5, new OF10SetDlDstActionDeserializer());
+        helper.registerDeserializer(6, new OF10SetNwSrcActionDeserializer());
+        helper.registerDeserializer(7, new OF10SetNwDstActionDeserializer());
+        helper.registerDeserializer(8, new OF10SetNwTosActionDeserializer());
+        helper.registerDeserializer(9, new OF10SetTpSrcActionDeserializer());
+        helper.registerDeserializer(10, new OF10SetTpDstActionDeserializer());
+        helper.registerDeserializer(11, new OF10EnqueueActionDeserializer());
+        // register OF v1.3 action deserializers
+        helper = new ActionDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);
+        helper.registerDeserializer(0, new OF13OutputActionDeserializer());
+        helper.registerDeserializer(11, new OF13CopyTtlOutActionDeserializer());
+        helper.registerDeserializer(12, new OF13CopyTtlInActionDeserializer());
+        helper.registerDeserializer(15, new OF13SetMplsTtlActionDeserializer());
+        helper.registerDeserializer(16, new OF13DecMplsTtlActionDeserializer());
+        helper.registerDeserializer(17, new OF13PushVlanActionDeserializer());
+        helper.registerDeserializer(18, new OF13PopVlanActionDeserializer());
+        helper.registerDeserializer(19, new OF13PushMplsActionDeserializer());
+        helper.registerDeserializer(20, new OF13PopMplsActionDeserializer());
+        helper.registerDeserializer(21, new OF13SetQueueActionDeserializer());
+        helper.registerDeserializer(22, new OF13GroupActionDeserializer());
+        helper.registerDeserializer(23, new OF13SetNwTtlActionDeserializer());
+        helper.registerDeserializer(24, new OF13DecNwTtlActionDeserializer());
+        helper.registerDeserializer(25, new OF13SetFieldActionDeserializer());
+        helper.registerDeserializer(26, new OF13PushPbbActionDeserializer());
+        helper.registerDeserializer(27, new OF13PopPbbActionDeserializer());
+    }
 }
\ No newline at end of file
index 9fcfd4d6d930a2da35701fd5ce92703d019f224c..40cae2c4bb79a9e5a815f7a088b38b8b4ea13f2f 100644 (file)
@@ -1,46 +1,46 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.ApplyActionsInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.ClearActionsInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.GoToTableInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.MeterInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.WriteActionsInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.WriteMetadataInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionDeserializerRegistryHelper;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class InstructionDeserializerInitializer {\r
-\r
-    private InstructionDeserializerInitializer() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * Registers instruction deserializers\r
-     * @param registry registry to be filled with deserializers\r
-     */\r
-    public static void registerDeserializers(DeserializerRegistry registry) {\r
-        // register OF v1.3 instruction deserializers\r
-        InstructionDeserializerRegistryHelper helper =\r
-                new InstructionDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);\r
-        helper.registerDeserializer(1, new GoToTableInstructionDeserializer());\r
-        helper.registerDeserializer(2, new WriteMetadataInstructionDeserializer());\r
-        helper.registerDeserializer(3, new WriteActionsInstructionDeserializer());\r
-        helper.registerDeserializer(4, new ApplyActionsInstructionDeserializer());\r
-        helper.registerDeserializer(5, new ClearActionsInstructionDeserializer());\r
-        helper.registerDeserializer(6, new MeterInstructionDeserializer());\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.ApplyActionsInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.ClearActionsInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.GoToTableInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.MeterInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.WriteActionsInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.instruction.WriteMetadataInstructionDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionDeserializerRegistryHelper;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class InstructionDeserializerInitializer {
+
+    private InstructionDeserializerInitializer() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * Registers instruction deserializers
+     * @param registry registry to be filled with deserializers
+     */
+    public static void registerDeserializers(DeserializerRegistry registry) {
+        // register OF v1.3 instruction deserializers
+        InstructionDeserializerRegistryHelper helper =
+                new InstructionDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);
+        helper.registerDeserializer(1, new GoToTableInstructionDeserializer());
+        helper.registerDeserializer(2, new WriteMetadataInstructionDeserializer());
+        helper.registerDeserializer(3, new WriteActionsInstructionDeserializer());
+        helper.registerDeserializer(4, new ApplyActionsInstructionDeserializer());
+        helper.registerDeserializer(5, new ClearActionsInstructionDeserializer());
+        helper.registerDeserializer(6, new MeterInstructionDeserializer());
+    }
 }
\ No newline at end of file
index 28f87a4cc402e7e35b9e86a1ecfca7d5a1d24165..46273e89de4aa483a345fd008296f68732941380 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTcpFlagDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTunnelIpv4DstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTunnelIpv4SrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpOpDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpShaDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpSpaDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpThaDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpTpaDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthDstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthSrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthTypeDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv4CodeDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv4TypeDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv6CodeDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv6TypeDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmInPhyPortDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmInPortDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpDscpDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpEcnDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpProtoDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv4DstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv4SrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6DstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6ExtHdrDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6FlabelDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdSllDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdTargetDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdTllDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6SrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMetadataDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsBosDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsLabelDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsTcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmPbbIsidDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmSctpDstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmSctpSrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTcpDstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTcpSrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTunnelIdDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpDstDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpSrcDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanPcpDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanVidDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.MatchEntryDeserializerRegistryHelper;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class MatchEntryDeserializerInitializer {\r
-\r
-    private MatchEntryDeserializerInitializer() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * Registers match entry deserializers\r
-     * @param registry registry to be filled with deserializers\r
-     */\r
-    public static void registerMatchEntryDeserializers(DeserializerRegistry registry) {\r
-        // register OpenflowBasicClass match entry deserializers\r
-        MatchEntryDeserializerRegistryHelper helper =\r
-                new MatchEntryDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID,\r
-                        OxmMatchConstants.OPENFLOW_BASIC_CLASS, registry);\r
-        helper.register(OxmMatchConstants.IN_PORT, new OxmInPortDeserializer());\r
-        helper.register(OxmMatchConstants.IN_PHY_PORT, new OxmInPhyPortDeserializer());\r
-        helper.register(OxmMatchConstants.METADATA, new OxmMetadataDeserializer());\r
-        helper.register(OxmMatchConstants.ETH_DST, new OxmEthDstDeserializer());\r
-        helper.register(OxmMatchConstants.ETH_SRC, new OxmEthSrcDeserializer());\r
-        helper.register(OxmMatchConstants.ETH_TYPE, new OxmEthTypeDeserializer());\r
-        helper.register(OxmMatchConstants.VLAN_VID, new OxmVlanVidDeserializer());\r
-        helper.register(OxmMatchConstants.VLAN_PCP, new OxmVlanPcpDeserializer());\r
-        helper.register(OxmMatchConstants.IP_DSCP, new OxmIpDscpDeserializer());\r
-        helper.register(OxmMatchConstants.IP_ECN, new OxmIpEcnDeserializer());\r
-        helper.register(OxmMatchConstants.IP_PROTO, new OxmIpProtoDeserializer());\r
-        helper.register(OxmMatchConstants.IPV4_SRC, new OxmIpv4SrcDeserializer());\r
-        helper.register(OxmMatchConstants.IPV4_DST, new OxmIpv4DstDeserializer());\r
-        helper.register(OxmMatchConstants.TCP_SRC, new OxmTcpSrcDeserializer());\r
-        helper.register(OxmMatchConstants.TCP_DST, new OxmTcpDstDeserializer());\r
-        helper.register(OxmMatchConstants.UDP_SRC, new OxmUdpSrcDeserializer());\r
-        helper.register(OxmMatchConstants.UDP_DST, new OxmUdpDstDeserializer());\r
-        helper.register(OxmMatchConstants.SCTP_SRC, new OxmSctpSrcDeserializer());\r
-        helper.register(OxmMatchConstants.SCTP_DST, new OxmSctpDstDeserializer());\r
-        helper.register(OxmMatchConstants.ICMPV4_TYPE, new OxmIcmpv4TypeDeserializer());\r
-        helper.register(OxmMatchConstants.ICMPV4_CODE, new OxmIcmpv4CodeDeserializer());\r
-        helper.register(OxmMatchConstants.ARP_OP, new OxmArpOpDeserializer());\r
-        helper.register(OxmMatchConstants.ARP_SPA, new OxmArpSpaDeserializer());\r
-        helper.register(OxmMatchConstants.ARP_TPA, new OxmArpTpaDeserializer());\r
-        helper.register(OxmMatchConstants.ARP_SHA, new OxmArpShaDeserializer());\r
-        helper.register(OxmMatchConstants.ARP_THA, new OxmArpThaDeserializer());\r
-        helper.register(OxmMatchConstants.IPV6_SRC, new OxmIpv6SrcDeserializer());\r
-        helper.register(OxmMatchConstants.IPV6_DST, new OxmIpv6DstDeserializer());\r
-        helper.register(OxmMatchConstants.IPV6_FLABEL, new OxmIpv6FlabelDeserializer());\r
-        helper.register(OxmMatchConstants.ICMPV6_TYPE, new OxmIcmpv6TypeDeserializer());\r
-        helper.register(OxmMatchConstants.ICMPV6_CODE, new OxmIcmpv6CodeDeserializer());\r
-        helper.register(OxmMatchConstants.IPV6_ND_TARGET, new OxmIpv6NdTargetDeserializer());\r
-        helper.register(OxmMatchConstants.IPV6_ND_SLL, new OxmIpv6NdSllDeserializer());\r
-        helper.register(OxmMatchConstants.IPV6_ND_TLL, new OxmIpv6NdTllDeserializer());\r
-        helper.register(OxmMatchConstants.MPLS_LABEL, new OxmMplsLabelDeserializer());\r
-        helper.register(OxmMatchConstants.MPLS_TC, new OxmMplsTcDeserializer());\r
-        helper.register(OxmMatchConstants.MPLS_BOS, new OxmMplsBosDeserializer());\r
-        helper.register(OxmMatchConstants.PBB_ISID, new OxmPbbIsidDeserializer());\r
-        helper.register(OxmMatchConstants.TUNNEL_ID, new OxmTunnelIdDeserializer());\r
-        helper.register(OxmMatchConstants.IPV6_EXTHDR, new OxmIpv6ExtHdrDeserializer());\r
-\r
-        // Register NXM1Class match entry deserializers\r
-        MatchEntryDeserializerRegistryHelper nxm1helper =\r
-                new MatchEntryDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID,\r
-                        OxmMatchConstants.NXM_1_CLASS, registry);\r
-        nxm1helper.register(OxmMatchConstants.NXM_NX_TUN_IPV4_SRC, new NxmTunnelIpv4SrcDeserializer());\r
-        nxm1helper.register(OxmMatchConstants.NXM_NX_TUN_IPV4_DST, new NxmTunnelIpv4DstDeserializer());\r
-        nxm1helper.register(OxmMatchConstants.NXM_NX_TCP_FLAG, new NxmTcpFlagDeserializer());\r
-\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTcpFlagDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTunnelIpv4DstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTunnelIpv4SrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpOpDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpShaDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpSpaDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpThaDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpTpaDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthDstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthSrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthTypeDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv4CodeDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv4TypeDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv6CodeDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIcmpv6TypeDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmInPhyPortDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmInPortDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpDscpDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpEcnDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpProtoDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv4DstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv4SrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6DstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6ExtHdrDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6FlabelDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdSllDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdTargetDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6NdTllDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6SrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMetadataDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsBosDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsLabelDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmMplsTcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmPbbIsidDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmSctpDstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmSctpSrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTcpDstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTcpSrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTunnelIdDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpDstDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpSrcDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanPcpDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanVidDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.MatchEntryDeserializerRegistryHelper;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class MatchEntryDeserializerInitializer {
+
+    private MatchEntryDeserializerInitializer() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * Registers match entry deserializers
+     * @param registry registry to be filled with deserializers
+     */
+    public static void registerMatchEntryDeserializers(DeserializerRegistry registry) {
+        // register OpenflowBasicClass match entry deserializers
+        MatchEntryDeserializerRegistryHelper helper =
+                new MatchEntryDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID,
+                        OxmMatchConstants.OPENFLOW_BASIC_CLASS, registry);
+        helper.register(OxmMatchConstants.IN_PORT, new OxmInPortDeserializer());
+        helper.register(OxmMatchConstants.IN_PHY_PORT, new OxmInPhyPortDeserializer());
+        helper.register(OxmMatchConstants.METADATA, new OxmMetadataDeserializer());
+        helper.register(OxmMatchConstants.ETH_DST, new OxmEthDstDeserializer());
+        helper.register(OxmMatchConstants.ETH_SRC, new OxmEthSrcDeserializer());
+        helper.register(OxmMatchConstants.ETH_TYPE, new OxmEthTypeDeserializer());
+        helper.register(OxmMatchConstants.VLAN_VID, new OxmVlanVidDeserializer());
+        helper.register(OxmMatchConstants.VLAN_PCP, new OxmVlanPcpDeserializer());
+        helper.register(OxmMatchConstants.IP_DSCP, new OxmIpDscpDeserializer());
+        helper.register(OxmMatchConstants.IP_ECN, new OxmIpEcnDeserializer());
+        helper.register(OxmMatchConstants.IP_PROTO, new OxmIpProtoDeserializer());
+        helper.register(OxmMatchConstants.IPV4_SRC, new OxmIpv4SrcDeserializer());
+        helper.register(OxmMatchConstants.IPV4_DST, new OxmIpv4DstDeserializer());
+        helper.register(OxmMatchConstants.TCP_SRC, new OxmTcpSrcDeserializer());
+        helper.register(OxmMatchConstants.TCP_DST, new OxmTcpDstDeserializer());
+        helper.register(OxmMatchConstants.UDP_SRC, new OxmUdpSrcDeserializer());
+        helper.register(OxmMatchConstants.UDP_DST, new OxmUdpDstDeserializer());
+        helper.register(OxmMatchConstants.SCTP_SRC, new OxmSctpSrcDeserializer());
+        helper.register(OxmMatchConstants.SCTP_DST, new OxmSctpDstDeserializer());
+        helper.register(OxmMatchConstants.ICMPV4_TYPE, new OxmIcmpv4TypeDeserializer());
+        helper.register(OxmMatchConstants.ICMPV4_CODE, new OxmIcmpv4CodeDeserializer());
+        helper.register(OxmMatchConstants.ARP_OP, new OxmArpOpDeserializer());
+        helper.register(OxmMatchConstants.ARP_SPA, new OxmArpSpaDeserializer());
+        helper.register(OxmMatchConstants.ARP_TPA, new OxmArpTpaDeserializer());
+        helper.register(OxmMatchConstants.ARP_SHA, new OxmArpShaDeserializer());
+        helper.register(OxmMatchConstants.ARP_THA, new OxmArpThaDeserializer());
+        helper.register(OxmMatchConstants.IPV6_SRC, new OxmIpv6SrcDeserializer());
+        helper.register(OxmMatchConstants.IPV6_DST, new OxmIpv6DstDeserializer());
+        helper.register(OxmMatchConstants.IPV6_FLABEL, new OxmIpv6FlabelDeserializer());
+        helper.register(OxmMatchConstants.ICMPV6_TYPE, new OxmIcmpv6TypeDeserializer());
+        helper.register(OxmMatchConstants.ICMPV6_CODE, new OxmIcmpv6CodeDeserializer());
+        helper.register(OxmMatchConstants.IPV6_ND_TARGET, new OxmIpv6NdTargetDeserializer());
+        helper.register(OxmMatchConstants.IPV6_ND_SLL, new OxmIpv6NdSllDeserializer());
+        helper.register(OxmMatchConstants.IPV6_ND_TLL, new OxmIpv6NdTllDeserializer());
+        helper.register(OxmMatchConstants.MPLS_LABEL, new OxmMplsLabelDeserializer());
+        helper.register(OxmMatchConstants.MPLS_TC, new OxmMplsTcDeserializer());
+        helper.register(OxmMatchConstants.MPLS_BOS, new OxmMplsBosDeserializer());
+        helper.register(OxmMatchConstants.PBB_ISID, new OxmPbbIsidDeserializer());
+        helper.register(OxmMatchConstants.TUNNEL_ID, new OxmTunnelIdDeserializer());
+        helper.register(OxmMatchConstants.IPV6_EXTHDR, new OxmIpv6ExtHdrDeserializer());
+
+        // Register NXM1Class match entry deserializers
+        MatchEntryDeserializerRegistryHelper nxm1helper =
+                new MatchEntryDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID,
+                        OxmMatchConstants.NXM_1_CLASS, registry);
+        nxm1helper.register(OxmMatchConstants.NXM_NX_TUN_IPV4_SRC, new NxmTunnelIpv4SrcDeserializer());
+        nxm1helper.register(OxmMatchConstants.NXM_NX_TUN_IPV4_DST, new NxmTunnelIpv4DstDeserializer());
+        nxm1helper.register(OxmMatchConstants.NXM_NX_TCP_FLAG, new NxmTcpFlagDeserializer());
+
+    }
+}
index 525f5297051dbf8afef1d28dc06d1f8ee4e6c241..c82408bf794a90f091116fc875115f4d0b7f4b8a 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.BarrierReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoRequestMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.ErrorMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FeaturesReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FlowRemovedMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.GetAsyncReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.GetConfigReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10BarrierReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10EchoReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10EchoRequestMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10ErrorMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10FeaturesReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10FlowRemovedMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10GetConfigReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10HelloMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10PacketInMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10PortStatusMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10QueueGetConfigReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10StatsReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.PacketInMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.PortStatusMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.QueueGetConfigReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.RoleReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.SimpleDeserializerRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class MessageDeserializerInitializer {\r
-\r
-    private MessageDeserializerInitializer() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * Registers message deserializers\r
-     * @param registry registry to be filled with deserializers\r
-     */\r
-    public static void registerMessageDeserializers(DeserializerRegistry registry) {\r
-        // register OF v1.0 message deserializers\r
-        SimpleDeserializerRegistryHelper helper =\r
-                new SimpleDeserializerRegistryHelper(EncodeConstants.OF10_VERSION_ID, registry);\r
-        helper.registerDeserializer(0, null, HelloMessage.class, new OF10HelloMessageFactory());\r
-        helper.registerDeserializer(1, null, ErrorMessage.class, new OF10ErrorMessageFactory());\r
-        helper.registerDeserializer(2, null, EchoRequestMessage.class, new OF10EchoRequestMessageFactory());\r
-        helper.registerDeserializer(3, null, EchoOutput.class, new OF10EchoReplyMessageFactory());\r
-        helper.registerDeserializer(6, null, GetFeaturesOutput.class, new OF10FeaturesReplyMessageFactory());\r
-        helper.registerDeserializer(8, null, GetConfigOutput.class, new OF10GetConfigReplyMessageFactory());\r
-        helper.registerDeserializer(10, null, PacketInMessage.class, new OF10PacketInMessageFactory());\r
-        helper.registerDeserializer(11, null, FlowRemovedMessage.class, new OF10FlowRemovedMessageFactory());\r
-        helper.registerDeserializer(12, null, PortStatusMessage.class, new OF10PortStatusMessageFactory());\r
-        helper.registerDeserializer(17, null, MultipartReplyMessage.class, new OF10StatsReplyMessageFactory());\r
-        helper.registerDeserializer(19, null, BarrierOutput.class, new OF10BarrierReplyMessageFactory());\r
-        helper.registerDeserializer(21, null, GetQueueConfigOutput.class, new OF10QueueGetConfigReplyMessageFactory());\r
-        // register Of v1.3 message deserializers\r
-        helper = new SimpleDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);\r
-        helper.registerDeserializer(0, null, HelloMessage.class, new HelloMessageFactory());\r
-        helper.registerDeserializer(1, null, ErrorMessage.class, new ErrorMessageFactory());\r
-        helper.registerDeserializer(2, null, EchoRequestMessage.class, new EchoRequestMessageFactory());\r
-        helper.registerDeserializer(3, null, EchoOutput.class, new EchoReplyMessageFactory());\r
-        helper.registerDeserializer(6, null, GetFeaturesOutput.class, new FeaturesReplyMessageFactory());\r
-        helper.registerDeserializer(8, null, GetConfigOutput.class, new GetConfigReplyMessageFactory());\r
-        helper.registerDeserializer(10, null, PacketInMessage.class, new PacketInMessageFactory());\r
-        helper.registerDeserializer(11, null, FlowRemovedMessage.class, new FlowRemovedMessageFactory());\r
-        helper.registerDeserializer(12, null, PortStatusMessage.class, new PortStatusMessageFactory());\r
-        helper.registerDeserializer(19, null, MultipartReplyMessage.class, new MultipartReplyMessageFactory());\r
-        helper.registerDeserializer(21, null, BarrierOutput.class, new BarrierReplyMessageFactory());\r
-        helper.registerDeserializer(23, null, GetQueueConfigOutput.class, new QueueGetConfigReplyMessageFactory());\r
-        helper.registerDeserializer(25, null, RoleRequestOutput.class, new RoleReplyMessageFactory());\r
-        helper.registerDeserializer(27, null, GetAsyncOutput.class, new GetAsyncReplyMessageFactory());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.BarrierReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoRequestMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.ErrorMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FeaturesReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FlowRemovedMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.GetAsyncReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.GetConfigReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10BarrierReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10EchoReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10EchoRequestMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10ErrorMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10FeaturesReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10FlowRemovedMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10GetConfigReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10HelloMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10PacketInMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10PortStatusMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10QueueGetConfigReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10StatsReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.PacketInMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.PortStatusMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.QueueGetConfigReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.RoleReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.SimpleDeserializerRegistryHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class MessageDeserializerInitializer {
+
+    private MessageDeserializerInitializer() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * Registers message deserializers
+     * @param registry registry to be filled with deserializers
+     */
+    public static void registerMessageDeserializers(DeserializerRegistry registry) {
+        // register OF v1.0 message deserializers
+        SimpleDeserializerRegistryHelper helper =
+                new SimpleDeserializerRegistryHelper(EncodeConstants.OF10_VERSION_ID, registry);
+        helper.registerDeserializer(0, null, HelloMessage.class, new OF10HelloMessageFactory());
+        helper.registerDeserializer(1, null, ErrorMessage.class, new OF10ErrorMessageFactory());
+        helper.registerDeserializer(2, null, EchoRequestMessage.class, new OF10EchoRequestMessageFactory());
+        helper.registerDeserializer(3, null, EchoOutput.class, new OF10EchoReplyMessageFactory());
+        helper.registerDeserializer(6, null, GetFeaturesOutput.class, new OF10FeaturesReplyMessageFactory());
+        helper.registerDeserializer(8, null, GetConfigOutput.class, new OF10GetConfigReplyMessageFactory());
+        helper.registerDeserializer(10, null, PacketInMessage.class, new OF10PacketInMessageFactory());
+        helper.registerDeserializer(11, null, FlowRemovedMessage.class, new OF10FlowRemovedMessageFactory());
+        helper.registerDeserializer(12, null, PortStatusMessage.class, new OF10PortStatusMessageFactory());
+        helper.registerDeserializer(17, null, MultipartReplyMessage.class, new OF10StatsReplyMessageFactory());
+        helper.registerDeserializer(19, null, BarrierOutput.class, new OF10BarrierReplyMessageFactory());
+        helper.registerDeserializer(21, null, GetQueueConfigOutput.class, new OF10QueueGetConfigReplyMessageFactory());
+        // register Of v1.3 message deserializers
+        helper = new SimpleDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);
+        helper.registerDeserializer(0, null, HelloMessage.class, new HelloMessageFactory());
+        helper.registerDeserializer(1, null, ErrorMessage.class, new ErrorMessageFactory());
+        helper.registerDeserializer(2, null, EchoRequestMessage.class, new EchoRequestMessageFactory());
+        helper.registerDeserializer(3, null, EchoOutput.class, new EchoReplyMessageFactory());
+        helper.registerDeserializer(6, null, GetFeaturesOutput.class, new FeaturesReplyMessageFactory());
+        helper.registerDeserializer(8, null, GetConfigOutput.class, new GetConfigReplyMessageFactory());
+        helper.registerDeserializer(10, null, PacketInMessage.class, new PacketInMessageFactory());
+        helper.registerDeserializer(11, null, FlowRemovedMessage.class, new FlowRemovedMessageFactory());
+        helper.registerDeserializer(12, null, PortStatusMessage.class, new PortStatusMessageFactory());
+        helper.registerDeserializer(19, null, MultipartReplyMessage.class, new MultipartReplyMessageFactory());
+        helper.registerDeserializer(21, null, BarrierOutput.class, new BarrierReplyMessageFactory());
+        helper.registerDeserializer(23, null, GetQueueConfigOutput.class, new QueueGetConfigReplyMessageFactory());
+        helper.registerDeserializer(25, null, RoleRequestOutput.class, new RoleReplyMessageFactory());
+        helper.registerDeserializer(27, null, GetAsyncOutput.class, new GetAsyncReplyMessageFactory());
+    }
+}
index fa110c097234f0bd96533007ad8ee4594e1da7f3..b0b4d04777f61c5899658e58790434ddea2438e9 100644 (file)
@@ -1,80 +1,80 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
-\r
-import java.util.Map;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassInitHelper;\r
-import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class TypeToClassMapInitializer {\r
-\r
-    private TypeToClassMapInitializer() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * Initializes type to class map\r
-     * @param messageClassMap\r
-     */\r
-    public static void initializeTypeToClassMap(Map<TypeToClassKey, Class<?>> messageClassMap) {\r
-        // init OF v1.0 mapping\r
-        TypeToClassInitHelper helper = \r
-                new TypeToClassInitHelper(EncodeConstants.OF10_VERSION_ID, messageClassMap);\r
-        helper.registerTypeToClass((short) 0, HelloMessage.class);\r
-        helper.registerTypeToClass((short) 1, ErrorMessage.class);\r
-        helper.registerTypeToClass((short) 2, EchoRequestMessage.class);\r
-        helper.registerTypeToClass((short) 3, EchoOutput.class);\r
-        helper.registerTypeToClass((short) 4, ExperimenterMessage.class);\r
-        helper.registerTypeToClass((short) 6, GetFeaturesOutput.class);\r
-        helper.registerTypeToClass((short) 8, GetConfigOutput.class);\r
-        helper.registerTypeToClass((short) 10, PacketInMessage.class);\r
-        helper.registerTypeToClass((short) 11, FlowRemovedMessage.class);\r
-        helper.registerTypeToClass((short) 12, PortStatusMessage.class);\r
-        helper.registerTypeToClass((short) 17, MultipartReplyMessage.class);\r
-        helper.registerTypeToClass((short) 19, BarrierOutput.class);\r
-        helper.registerTypeToClass((short) 21, GetQueueConfigOutput.class);\r
-        // init OF v1.0 mapping\r
-        helper = new TypeToClassInitHelper(EncodeConstants.OF13_VERSION_ID, messageClassMap);\r
-        helper.registerTypeToClass((short) 0, HelloMessage.class);\r
-        helper.registerTypeToClass((short) 1, ErrorMessage.class);\r
-        helper.registerTypeToClass((short) 2, EchoRequestMessage.class);\r
-        helper.registerTypeToClass((short) 3, EchoOutput.class);\r
-        helper.registerTypeToClass((short) 4, ExperimenterMessage.class);\r
-        helper.registerTypeToClass((short) 6, GetFeaturesOutput.class);\r
-        helper.registerTypeToClass((short) 8, GetConfigOutput.class);\r
-        helper.registerTypeToClass((short) 10, PacketInMessage.class);\r
-        helper.registerTypeToClass((short) 11, FlowRemovedMessage.class);\r
-        helper.registerTypeToClass((short) 12, PortStatusMessage.class);\r
-        helper.registerTypeToClass((short) 19, MultipartReplyMessage.class);\r
-        helper.registerTypeToClass((short) 21, BarrierOutput.class);\r
-        helper.registerTypeToClass((short) 23, GetQueueConfigOutput.class);\r
-        helper.registerTypeToClass((short) 25, RoleRequestOutput.class);\r
-        helper.registerTypeToClass((short) 27, GetAsyncOutput.class);\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization;
+
+import java.util.Map;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassInitHelper;
+import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class TypeToClassMapInitializer {
+
+    private TypeToClassMapInitializer() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * Initializes type to class map
+     * @param messageClassMap
+     */
+    public static void initializeTypeToClassMap(Map<TypeToClassKey, Class<?>> messageClassMap) {
+        // init OF v1.0 mapping
+        TypeToClassInitHelper helper = 
+                new TypeToClassInitHelper(EncodeConstants.OF10_VERSION_ID, messageClassMap);
+        helper.registerTypeToClass((short) 0, HelloMessage.class);
+        helper.registerTypeToClass((short) 1, ErrorMessage.class);
+        helper.registerTypeToClass((short) 2, EchoRequestMessage.class);
+        helper.registerTypeToClass((short) 3, EchoOutput.class);
+        helper.registerTypeToClass((short) 4, ExperimenterMessage.class);
+        helper.registerTypeToClass((short) 6, GetFeaturesOutput.class);
+        helper.registerTypeToClass((short) 8, GetConfigOutput.class);
+        helper.registerTypeToClass((short) 10, PacketInMessage.class);
+        helper.registerTypeToClass((short) 11, FlowRemovedMessage.class);
+        helper.registerTypeToClass((short) 12, PortStatusMessage.class);
+        helper.registerTypeToClass((short) 17, MultipartReplyMessage.class);
+        helper.registerTypeToClass((short) 19, BarrierOutput.class);
+        helper.registerTypeToClass((short) 21, GetQueueConfigOutput.class);
+        // init OF v1.0 mapping
+        helper = new TypeToClassInitHelper(EncodeConstants.OF13_VERSION_ID, messageClassMap);
+        helper.registerTypeToClass((short) 0, HelloMessage.class);
+        helper.registerTypeToClass((short) 1, ErrorMessage.class);
+        helper.registerTypeToClass((short) 2, EchoRequestMessage.class);
+        helper.registerTypeToClass((short) 3, EchoOutput.class);
+        helper.registerTypeToClass((short) 4, ExperimenterMessage.class);
+        helper.registerTypeToClass((short) 6, GetFeaturesOutput.class);
+        helper.registerTypeToClass((short) 8, GetConfigOutput.class);
+        helper.registerTypeToClass((short) 10, PacketInMessage.class);
+        helper.registerTypeToClass((short) 11, FlowRemovedMessage.class);
+        helper.registerTypeToClass((short) 12, PortStatusMessage.class);
+        helper.registerTypeToClass((short) 19, MultipartReplyMessage.class);
+        helper.registerTypeToClass((short) 21, BarrierOutput.class);
+        helper.registerTypeToClass((short) 23, GetQueueConfigOutput.class);
+        helper.registerTypeToClass((short) 25, RoleRequestOutput.class);
+        helper.registerTypeToClass((short) 27, GetAsyncOutput.class);
+    }
+}
index 4ff7c307c3c0e64c201a569c80adbf5f84b595c9..9dbd57905327097e1bf4526128e199a42cc5bb00 100644 (file)
@@ -1,38 +1,38 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractActionDeserializer implements OFDeserializer<Action>,\r
-        HeaderDeserializer<Action> {\r
-\r
-    @Override\r
-    public Action deserializeHeader(ByteBuf input) {\r
-        ActionBuilder actionBuilder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        actionBuilder.setType(getType());\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        return actionBuilder.build();\r
-    }\r
-\r
-    protected abstract Class<? extends ActionBase> getType();\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractActionDeserializer implements OFDeserializer<Action>,
+        HeaderDeserializer<Action> {
+
+    @Override
+    public Action deserializeHeader(ByteBuf input) {
+        ActionBuilder actionBuilder = new ActionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        actionBuilder.setType(getType());
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        return actionBuilder.build();
+    }
+
+    protected abstract Class<? extends ActionBase> getType();
+
+}
index 0fae6a619daf5fca81c0a4a38b870e52658e3474..cddf6f2d19418cec7228da05e1c8994cf5a0370c 100644 (file)
@@ -1,38 +1,38 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractEthertypeActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        builder.setType(getType());\r
-        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        EthertypeActionBuilder etherType = new EthertypeActionBuilder();\r
-        etherType.setEthertype(new EtherType(input.readUnsignedShort()));\r
-        builder.addAugmentation(EthertypeAction.class, etherType.build());\r
-        input.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);\r
-        return builder.build();\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractEthertypeActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        builder.setType(getType());
+        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        EthertypeActionBuilder etherType = new EthertypeActionBuilder();
+        etherType.setEthertype(new EtherType(input.readUnsignedShort()));
+        builder.addAugmentation(EthertypeAction.class, etherType.build());
+        input.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
+        return builder.build();
+    }
+}
index b295ec3c437ec2b15cd70c17a5a130b31caf5cb8..664dfbe321c2a84284501cfcbc6233094aa7c584 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractHeaderActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(getType());\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        input.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);\r
-        return builder.build();\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractHeaderActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(getType());
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        input.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
+        return builder.build();
+    }
+}
index 058d0870434c9b7410bad6f8e71404de6ddb9778..97c10e5c353a2d935af7c68236438e33eaf817dc 100644 (file)
@@ -1,45 +1,45 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yangtools.yang.binding.Augmentation;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractIpAddressActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(final ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(getType());\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.addAugmentation(IpAddressAction.class,\r
-                createNwAddressAugmentationAndPad(input));\r
-        return builder.build();\r
-    }\r
-\r
-    private static Augmentation<Action> createNwAddressAugmentationAndPad(final ByteBuf input) {\r
-        IpAddressActionBuilder ipBuilder = new IpAddressActionBuilder();\r
-        ipBuilder.setIpAddress(new Ipv4Address(ByteBufUtils.readIpv4Address(input)));\r
-        return ipBuilder.build();\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractIpAddressActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(final ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(getType());
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.addAugmentation(IpAddressAction.class,
+                createNwAddressAugmentationAndPad(input));
+        return builder.build();
+    }
+
+    private static Augmentation<Action> createNwAddressAugmentationAndPad(final ByteBuf input) {
+        IpAddressActionBuilder ipBuilder = new IpAddressActionBuilder();
+        ipBuilder.setIpAddress(new Ipv4Address(ByteBufUtils.readIpv4Address(input)));
+        return ipBuilder.build();
+    }
+
+}
index 14a1c843aca6be3dafbd8ac7662cab5be2ed1a85..cdbc69e23db29af46c830b1750f4cee1951cb985 100644 (file)
@@ -1,46 +1,46 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractMacAddressActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(getType());\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.addAugmentation(DlAddressAction.class, createDlAugmentationAndPad(input));\r
-        return builder.build();\r
-    }\r
-\r
-    private static DlAddressAction createDlAugmentationAndPad(ByteBuf input) {\r
-        DlAddressActionBuilder dlBuilder = new DlAddressActionBuilder();\r
-        byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];\r
-        input.readBytes(address);\r
-        dlBuilder.setDlAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));\r
-        input.skipBytes(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION);\r
-        return dlBuilder.build();\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractMacAddressActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(getType());
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.addAugmentation(DlAddressAction.class, createDlAugmentationAndPad(input));
+        return builder.build();
+    }
+
+    private static DlAddressAction createDlAugmentationAndPad(ByteBuf input) {
+        DlAddressActionBuilder dlBuilder = new DlAddressActionBuilder();
+        byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
+        input.readBytes(address);
+        dlBuilder.setDlAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));
+        input.skipBytes(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION);
+        return dlBuilder.build();
+    }
+}
index c284fc5e6616b42d2da486cb544b1b4f0929e7a5..9c7476d5263c6ba756f07a04a84396415ece08f9 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractPortActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(getType());\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        createPortAugmentation(input, builder);\r
-        input.skipBytes(ActionConstants.PADDING_IN_TP_PORT_ACTION);\r
-        return builder.build();\r
-    }\r
-\r
-    protected static void createPortAugmentation(ByteBuf input, ActionBuilder actionBuilder) {\r
-        PortActionBuilder portBuilder = new PortActionBuilder();\r
-        portBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));\r
-        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractPortActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(getType());
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        createPortAugmentation(input, builder);
+        input.skipBytes(ActionConstants.PADDING_IN_TP_PORT_ACTION);
+        return builder.build();
+    }
+
+    protected static void createPortAugmentation(ByteBuf input, ActionBuilder actionBuilder) {
+        PortActionBuilder portBuilder = new PortActionBuilder();
+        portBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
+        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+    }
+}
index 41c989eba357cb12fcac740e6cd67ef10f10ebf6..9316971e96c69742b5c2a97d3e64e252bfe30d81 100644 (file)
@@ -1,47 +1,47 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10EnqueueActionDeserializer extends OF10AbstractPortActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(getType());\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        createPortAugmentation(input, builder);\r
-        input.skipBytes(ActionConstants.PADDING_IN_ENQUEUE_ACTION);\r
-        QueueIdActionBuilder queueBuilder = new QueueIdActionBuilder();\r
-        queueBuilder.setQueueId(input.readUnsignedInt());\r
-        builder.addAugmentation(QueueIdAction.class, queueBuilder.build());\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return Enqueue.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10EnqueueActionDeserializer extends OF10AbstractPortActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(getType());
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        createPortAugmentation(input, builder);
+        input.skipBytes(ActionConstants.PADDING_IN_ENQUEUE_ACTION);
+        QueueIdActionBuilder queueBuilder = new QueueIdActionBuilder();
+        queueBuilder.setQueueId(input.readUnsignedInt());
+        builder.addAugmentation(QueueIdAction.class, queueBuilder.build());
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return Enqueue.class;
+    }
+
+}
index cfbcbe27ba3c0f7d00c25cdb2f52113857eecae9..64707081d0b66ef45e6fc78883efb265da8e2bb5 100644 (file)
@@ -1,45 +1,45 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10OutputActionDeserializer extends OF10AbstractPortActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(getType());\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        createPortAugmentation(input, builder);\r
-        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
-        maxLen.setMaxLength(input.readUnsignedShort());\r
-        builder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return Output.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10OutputActionDeserializer extends OF10AbstractPortActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(getType());
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        createPortAugmentation(input, builder);
+        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+        maxLen.setMaxLength(input.readUnsignedShort());
+        builder.addAugmentation(MaxLengthAction.class, maxLen.build());
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return Output.class;
+    }
+
+}
index 2cdc5d0d541e46714eb1e7e7c7813f7bfd8546d1..95762dc1a857e887ea6ba9ecaf508bd2b07af03b 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetDlDstActionDeserializer extends OF10AbstractMacAddressActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetDlDst.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetDlDstActionDeserializer extends OF10AbstractMacAddressActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetDlDst.class;
+    }
+
+}
index 34b16b4b8b7c0ed7b06d81f588f7bf47f197f10c..9d3d9c8036d69dbf9d9896194c8818718ec24d40 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetDlSrcActionDeserializer extends OF10AbstractMacAddressActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetDlSrc.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetDlSrcActionDeserializer extends OF10AbstractMacAddressActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetDlSrc.class;
+    }
+
+}
index c41021d82dc8a2e8781915805ff25213dc11aba4..97e1c6bb298c172fedc0ffe876db27ee910defe7 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwDstActionDeserializer extends OF10AbstractIpAddressActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetNwDst.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwDstActionDeserializer extends OF10AbstractIpAddressActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetNwDst.class;
+    }
+
+}
index 31550133e9c0f652d6ad5a3047604de60ae61c50..55d1e76df980b787c249c7b34b71400ff55a2450 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwSrcActionDeserializer extends OF10AbstractIpAddressActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetNwSrc.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwSrcActionDeserializer extends OF10AbstractIpAddressActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetNwSrc.class;
+    }
+
+}
index 7058911732bb275ce9432db5743ba83240148691..925ecfec368e402f90ef10122a25b8b123b02615 100644 (file)
@@ -1,46 +1,46 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwTosActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(getType());\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        NwTosActionBuilder tosBuilder = new NwTosActionBuilder();\r
-        tosBuilder.setNwTos(input.readUnsignedByte());\r
-        builder.addAugmentation(NwTosAction.class, tosBuilder.build());\r
-        input.skipBytes(ActionConstants.PADDING_IN_SET_NW_TOS_ACTION);\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetNwTos.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwTosActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(getType());
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        NwTosActionBuilder tosBuilder = new NwTosActionBuilder();
+        tosBuilder.setNwTos(input.readUnsignedByte());
+        builder.addAugmentation(NwTosAction.class, tosBuilder.build());
+        input.skipBytes(ActionConstants.PADDING_IN_SET_NW_TOS_ACTION);
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetNwTos.class;
+    }
+
+}
index 96a41ffdf46775e809555562fdc44aed05e03808..0bb20dbf529ecf93f19c2175502da39644973b5e 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetTpDstActionDeserializer extends OF10AbstractPortActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetTpDst.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetTpDstActionDeserializer extends OF10AbstractPortActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetTpDst.class;
+    }
+
+}
index 31271a4a865f2ece9780239115f670fe1bb3015e..3fce85bd26731f4f1fac5f27910738994fe00cb1 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetTpSrcActionDeserializer extends OF10AbstractPortActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetTpSrc.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetTpSrcActionDeserializer extends OF10AbstractPortActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetTpSrc.class;
+    }
+
+}
index cb888a4c697490378065606200b2e4261bf4c58a..ac5115527105c8aaef19748332a8da88cc44d1e4 100644 (file)
@@ -1,46 +1,46 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetVlanPcpActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(getType());\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        VlanPcpActionBuilder vlanBuilder = new VlanPcpActionBuilder();\r
-        vlanBuilder.setVlanPcp(input.readUnsignedByte());\r
-        input.skipBytes(ActionConstants.PADDING_IN_SET_VLAN_PCP_ACTION);\r
-        builder.addAugmentation(VlanPcpAction.class, vlanBuilder.build());\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetVlanPcp.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetVlanPcpActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(getType());
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        VlanPcpActionBuilder vlanBuilder = new VlanPcpActionBuilder();
+        vlanBuilder.setVlanPcp(input.readUnsignedByte());
+        input.skipBytes(ActionConstants.PADDING_IN_SET_VLAN_PCP_ACTION);
+        builder.addAugmentation(VlanPcpAction.class, vlanBuilder.build());
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetVlanPcp.class;
+    }
+
+}
index 4fb33a735da9aa1ee5e4e23bed5ef267e50d85ea..623341a9b4ec3a7831d21d15fe46d103166ac709 100644 (file)
@@ -1,46 +1,46 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetVlanVidActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(getType());\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        VlanVidActionBuilder vlanBuilder = new VlanVidActionBuilder();\r
-        vlanBuilder.setVlanVid(input.readUnsignedShort());\r
-        input.skipBytes(ActionConstants.PADDING_IN_SET_VLAN_VID_ACTION);\r
-        builder.addAugmentation(VlanVidAction.class, vlanBuilder.build());\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetVlanVid.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetVlanVidActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(getType());
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        VlanVidActionBuilder vlanBuilder = new VlanVidActionBuilder();
+        vlanBuilder.setVlanVid(input.readUnsignedShort());
+        input.skipBytes(ActionConstants.PADDING_IN_SET_VLAN_VID_ACTION);
+        builder.addAugmentation(VlanVidAction.class, vlanBuilder.build());
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetVlanVid.class;
+    }
+
+}
index bb5c4a48c6589f0d64c8f4635f078d0a029b3e7a..dea7afa531a10409aee29fd5b139379cb98938b0 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10StripVlanActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return StripVlan.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10StripVlanActionDeserializer extends AbstractHeaderActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return StripVlan.class;
+    }
+
+}
index e56c5818d0a28523f8b30f197eb9416adb0c28ce..a869084d9e577c622e781bbe463a3271b1ab4768 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13CopyTtlInActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return CopyTtlIn.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13CopyTtlInActionDeserializer extends AbstractHeaderActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return CopyTtlIn.class;
+    }
+
+}
index 731a82ad1411f1ede708c7955f42d89da633333b..b066b2159f82df4b6be692c9660dd473c06b0df8 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13CopyTtlOutActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return CopyTtlOut.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13CopyTtlOutActionDeserializer extends AbstractHeaderActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return CopyTtlOut.class;
+    }
+
+}
index bab50a98137479fe25f5d64d39794102f155faae..6467e1e6dec6c31e4600fa066d260dc1ca6192c7 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13DecMplsTtlActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return DecMplsTtl.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13DecMplsTtlActionDeserializer extends AbstractHeaderActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return DecMplsTtl.class;
+    }
+
+}
index 8f112ff2f283c761fcafe088e44713a0088d293d..f920f577466db92ca17544d464d3f76e236dc3eb 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13DecNwTtlActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return DecNwTtl.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13DecNwTtlActionDeserializer extends AbstractHeaderActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return DecNwTtl.class;
+    }
+
+}
index ab186fa8e3bd5206ef2a95d82d60a9975c007874..dbf147d299fc61464fd9665b6a2feeb7d267faa7 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13GroupActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        builder.setType(getType());\r
-        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        GroupIdActionBuilder group = new GroupIdActionBuilder();\r
-        group.setGroupId(input.readUnsignedInt());\r
-        builder.addAugmentation(GroupIdAction.class, group.build());\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return Group.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13GroupActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        builder.setType(getType());
+        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        GroupIdActionBuilder group = new GroupIdActionBuilder();
+        group.setGroupId(input.readUnsignedInt());
+        builder.addAugmentation(GroupIdAction.class, group.build());
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return Group.class;
+    }
+
+}
index e47980f4a2d1e1afa857748d2e7d0bf12d99ae54..9e9d54f30edc869d1cb1bef2e37c4fa76d454318 100644 (file)
@@ -1,51 +1,51 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13OutputActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        builder.setType(getType());\r
-        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        PortActionBuilder port = new PortActionBuilder();\r
-        port.setPort(new PortNumber(input.readUnsignedInt()));\r
-        builder.addAugmentation(PortAction.class, port.build());\r
-        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
-        maxLen.setMaxLength(input.readUnsignedShort());\r
-        builder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
-        input.skipBytes(ActionConstants.OUTPUT_PADDING);\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return Output.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13OutputActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        builder.setType(getType());
+        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        PortActionBuilder port = new PortActionBuilder();
+        port.setPort(new PortNumber(input.readUnsignedInt()));
+        builder.addAugmentation(PortAction.class, port.build());
+        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+        maxLen.setMaxLength(input.readUnsignedShort());
+        builder.addAugmentation(MaxLengthAction.class, maxLen.build());
+        input.skipBytes(ActionConstants.OUTPUT_PADDING);
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return Output.class;
+    }
+
+}
index 408e5b308a67871f1de499937240653858cfc407..218bedbb8a6c3d79bba86e54553a51d17c3d3757 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopMplsActionDeserializer extends AbstractEthertypeActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return PopMpls.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopMplsActionDeserializer extends AbstractEthertypeActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return PopMpls.class;
+    }
+
+}
index 99ec038014c34d1a5288d1eb164d431458670169..7ba8e3242d71fdb737e2978b43aae716e2816360 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopPbbActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return PopPbb.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopPbbActionDeserializer extends AbstractHeaderActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return PopPbb.class;
+    }
+
+}
index e31a9bfeeb5604636f6d57e8f0fcb0a02b1718f8..69543ede1ab2240afa4f7e87c0974f2811e7e9d5 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopVlanActionDeserializer extends AbstractHeaderActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return PopVlan.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopVlanActionDeserializer extends AbstractHeaderActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return PopVlan.class;
+    }
+
+}
index 121e1e96ec62c2136dd86bbd61bd14ee1396e4d9..38ac182117d226b6835c2286040fdda8549349c9 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushMplsActionDeserializer extends AbstractEthertypeActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return PushMpls.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushMplsActionDeserializer extends AbstractEthertypeActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return PushMpls.class;
+    }
+
+}
index 6a44f04f649d68e4b6160d05c40d7032fb78582a..40cf71dc9b517f8c0f3052461e4d70a5a91ff177 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushPbbActionDeserializer extends AbstractEthertypeActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return PushPbb.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushPbbActionDeserializer extends AbstractEthertypeActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return PushPbb.class;
+    }
+
+}
index eb0b059d3e5b74005d2154f6858450588005fd2b..8b9bbdda1e54221e5c24b656d03b63fb417569bd 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushVlanActionDeserializer extends AbstractEthertypeActionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return PushVlan.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushVlanActionDeserializer extends AbstractEthertypeActionDeserializer {
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return PushVlan.class;
+    }
+
+}
index 0182e8c774a8b69b9b679fb6c662b83d805613fd..190c3b807b433ee082ee8094f3d0c3be99109429 100644 (file)
@@ -1,78 +1,78 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetFieldActionDeserializer extends AbstractActionDeserializer\r
-        implements DeserializerRegistryInjector {\r
-\r
-    private DeserializerRegistry registry;\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        builder.setType(getType());\r
-        int startIndex = input.readerIndex();\r
-        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();\r
-        int oxmClass = input.getUnsignedShort(input.readerIndex());\r
-        // get oxm_field & hasMask byte and extract the field value\r
-        int oxmField = input.getUnsignedByte(input.readerIndex()\r
-                + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;\r
-        MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
-                oxmClass, oxmField);\r
-        if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {\r
-            long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES\r
-                    + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);\r
-            key.setExperimenterId(expId);\r
-        }\r
-        OFDeserializer<MatchEntries> matchDeserializer = registry.getDeserializer(key);\r
-        List<MatchEntries> entry = new ArrayList<>();\r
-        entry.add(matchDeserializer.deserialize(input));\r
-        matchEntries.setMatchEntries(entry);\r
-        builder.addAugmentation(OxmFieldsAction.class, matchEntries.build());\r
-        int paddingRemainder = (input.readerIndex() - startIndex) % EncodeConstants.PADDING;\r
-        if (paddingRemainder != 0) {\r
-            input.skipBytes(EncodeConstants.PADDING - paddingRemainder);\r
-        }\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetField.class;\r
-    }\r
-\r
-    @Override\r
-    public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {\r
-        this.registry = deserializerRegistry;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetFieldActionDeserializer extends AbstractActionDeserializer
+        implements DeserializerRegistryInjector {
+
+    private DeserializerRegistry registry;
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        builder.setType(getType());
+        int startIndex = input.readerIndex();
+        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();
+        int oxmClass = input.getUnsignedShort(input.readerIndex());
+        // get oxm_field & hasMask byte and extract the field value
+        int oxmField = input.getUnsignedByte(input.readerIndex()
+                + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
+        MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+                oxmClass, oxmField);
+        if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
+            long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES
+                    + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+            key.setExperimenterId(expId);
+        }
+        OFDeserializer<MatchEntries> matchDeserializer = registry.getDeserializer(key);
+        List<MatchEntries> entry = new ArrayList<>();
+        entry.add(matchDeserializer.deserialize(input));
+        matchEntries.setMatchEntries(entry);
+        builder.addAugmentation(OxmFieldsAction.class, matchEntries.build());
+        int paddingRemainder = (input.readerIndex() - startIndex) % EncodeConstants.PADDING;
+        if (paddingRemainder != 0) {
+            input.skipBytes(EncodeConstants.PADDING - paddingRemainder);
+        }
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetField.class;
+    }
+
+    @Override
+    public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+        this.registry = deserializerRegistry;
+    }
+
+}
index 158776406f3b194f3234632fb37a212bb9a6b522..0a22ae7314c6239b6cc410c0efa394a384f9739f 100644 (file)
@@ -1,45 +1,45 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetMplsTtlActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        builder.setType(getType());\r
-        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        MplsTtlActionBuilder mplsTtl = new MplsTtlActionBuilder();\r
-        mplsTtl.setMplsTtl(input.readUnsignedByte());\r
-        builder.addAugmentation(MplsTtlAction.class, mplsTtl.build());\r
-        input.skipBytes(ActionConstants.SET_MPLS_TTL_PADDING);\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetMplsTtl.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetMplsTtlActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        builder.setType(getType());
+        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        MplsTtlActionBuilder mplsTtl = new MplsTtlActionBuilder();
+        mplsTtl.setMplsTtl(input.readUnsignedByte());
+        builder.addAugmentation(MplsTtlAction.class, mplsTtl.build());
+        input.skipBytes(ActionConstants.SET_MPLS_TTL_PADDING);
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetMplsTtl.class;
+    }
+
+}
index a9a08aa69328d4dd2f6775d5b00f4baf305c7689..f247c3a7eb8351bec79e2902bab0ffe3a5649873 100644 (file)
@@ -1,45 +1,45 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetNwTtlActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        builder.setType(getType());\r
-        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();\r
-        nwTtl.setNwTtl(input.readUnsignedByte());\r
-        builder.addAugmentation(NwTtlAction.class, nwTtl.build());\r
-        input.skipBytes(ActionConstants.SET_NW_TTL_PADDING);\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetNwTtl.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetNwTtlActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        builder.setType(getType());
+        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();
+        nwTtl.setNwTtl(input.readUnsignedByte());
+        builder.addAugmentation(NwTtlAction.class, nwTtl.build());
+        input.skipBytes(ActionConstants.SET_NW_TTL_PADDING);
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetNwTtl.class;
+    }
+
+}
index 0e68c0b0de428b0e3941cff18d58cdd0ef81aba4..1df22b1b7de0dc1fd3c40ec1be54234992615300 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetQueueActionDeserializer extends AbstractActionDeserializer {\r
-\r
-    @Override\r
-    public Action deserialize(ByteBuf input) {\r
-        ActionBuilder builder = new ActionBuilder();\r
-        builder.setType(getType());\r
-        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        QueueIdActionBuilder queueId = new QueueIdActionBuilder();\r
-        queueId.setQueueId(input.readUnsignedInt());\r
-        builder.addAugmentation(QueueIdAction.class, queueId.build());\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends ActionBase> getType() {\r
-        return SetQueue.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetQueueActionDeserializer extends AbstractActionDeserializer {
+
+    @Override
+    public Action deserialize(ByteBuf input) {
+        ActionBuilder builder = new ActionBuilder();
+        builder.setType(getType());
+        input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        QueueIdActionBuilder queueId = new QueueIdActionBuilder();
+        queueId.setQueueId(input.readUnsignedInt());
+        builder.addAugmentation(QueueIdAction.class, queueId.build());
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends ActionBase> getType() {
+        return SetQueue.class;
+    }
+
+}
index 97db922ac2c37331899db41c26a64763a1c62093..269976ffa7da4db72c40b4fdd5e77f49139c7128 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.util.ExperimenterDeserializerKeyFactory;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterMessageFactory implements OFDeserializer<ExperimenterMessage>,\r
-        DeserializerRegistryInjector {\r
-\r
-    /** Experimenter ID index after version, message type and length were read */\r
-    private static final byte EXPERIMENTER_ID_INDEX = 4;\r
-    private DeserializerRegistry deserializerRegistry;\r
-\r
-    @Override\r
-    public ExperimenterMessage deserialize(ByteBuf message) {\r
-        long expId = message.getUnsignedInt(message.readerIndex() + EXPERIMENTER_ID_INDEX);\r
-        OFDeserializer<ExperimenterMessage> deserializer = deserializerRegistry.getDeserializer(\r
-                ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(\r
-                        EncodeConstants.OF13_VERSION_ID, expId));\r
-        return deserializer.deserialize(message);\r
-    }\r
-\r
-    @Override\r
-    public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {\r
-        this.deserializerRegistry = deserializerRegistry;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.util.ExperimenterDeserializerKeyFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterMessageFactory implements OFDeserializer<ExperimenterMessage>,
+        DeserializerRegistryInjector {
+
+    /** Experimenter ID index after version, message type and length were read */
+    private static final byte EXPERIMENTER_ID_INDEX = 4;
+    private DeserializerRegistry deserializerRegistry;
+
+    @Override
+    public ExperimenterMessage deserialize(ByteBuf message) {
+        long expId = message.getUnsignedInt(message.readerIndex() + EXPERIMENTER_ID_INDEX);
+        OFDeserializer<ExperimenterMessage> deserializer = deserializerRegistry.getDeserializer(
+                ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
+                        EncodeConstants.OF13_VERSION_ID, expId));
+        return deserializer.deserialize(message);
+    }
+
+    @Override
+    public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+        this.deserializerRegistry = deserializerRegistry;
+    }
 }
\ No newline at end of file
index 7c42153862f87894333e1da881bb2ae9b6a25696..be6d0004d52ba064df3fa2c935a65a016213020c 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.util.ExperimenterDeserializerKeyFactory;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class VendorMessageFactory implements OFDeserializer<ExperimenterMessage>,\r
-        DeserializerRegistryInjector {\r
-\r
-    private static final byte VENDOR_ID_INDEX = 8;\r
-    private DeserializerRegistry deserializerRegistry;\r
-\r
-    @Override\r
-    public ExperimenterMessage deserialize(ByteBuf message) {\r
-        long expId = message.getUnsignedInt(message.readerIndex() + VENDOR_ID_INDEX);\r
-        OFDeserializer<ExperimenterMessage> deserializer = deserializerRegistry.getDeserializer(\r
-                ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(\r
-                        EncodeConstants.OF10_VERSION_ID, expId));\r
-        return deserializer.deserialize(message);\r
-    }\r
-\r
-    @Override\r
-    public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {\r
-        this.deserializerRegistry = deserializerRegistry;\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.util.ExperimenterDeserializerKeyFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class VendorMessageFactory implements OFDeserializer<ExperimenterMessage>,
+        DeserializerRegistryInjector {
+
+    private static final byte VENDOR_ID_INDEX = 8;
+    private DeserializerRegistry deserializerRegistry;
+
+    @Override
+    public ExperimenterMessage deserialize(ByteBuf message) {
+        long expId = message.getUnsignedInt(message.readerIndex() + VENDOR_ID_INDEX);
+        OFDeserializer<ExperimenterMessage> deserializer = deserializerRegistry.getDeserializer(
+                ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
+                        EncodeConstants.OF10_VERSION_ID, expId));
+        return deserializer.deserialize(message);
+    }
+
+    @Override
+    public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+        this.deserializerRegistry = deserializerRegistry;
+    }
 }
\ No newline at end of file
index 3f4126ba34773496c2d4c6d23f16d9521f63e03c..78d868a05f8126a6edb5ebd0ca6b3ddf3a7e992d 100644 (file)
@@ -1,65 +1,65 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMaker;\r
-import org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMakerFactory;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ListDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractActionInstructionDeserializer extends AbstractInstructionDeserializer\r
-        implements DeserializerRegistryInjector {\r
-\r
-    private DeserializerRegistry registry;\r
-\r
-    @Override\r
-    public Instruction deserialize(ByteBuf input) {\r
-        InstructionBuilder builder = new InstructionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(getType());\r
-        int instructionLength = input.readUnsignedShort();\r
-        input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);\r
-        ActionsInstructionBuilder actionsBuilder = new ActionsInstructionBuilder();\r
-        int length = instructionLength - InstructionConstants.STANDARD_INSTRUCTION_LENGTH;\r
-        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        List<Action> actions = ListDeserializer.deserializeList(\r
-                EncodeConstants.OF13_VERSION_ID, length, input, keyMaker, getRegistry());\r
-        actionsBuilder.setAction(actions);\r
-        builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());\r
-        return builder.build();\r
-    }\r
-\r
-    protected abstract Class<? extends InstructionBase> getType();\r
-\r
-    protected DeserializerRegistry getRegistry() {\r
-        return registry;\r
-    }\r
-\r
-    @Override\r
-    public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {\r
-        this.registry = deserializerRegistry;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMaker;
+import org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMakerFactory;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.ListDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractActionInstructionDeserializer extends AbstractInstructionDeserializer
+        implements DeserializerRegistryInjector {
+
+    private DeserializerRegistry registry;
+
+    @Override
+    public Instruction deserialize(ByteBuf input) {
+        InstructionBuilder builder = new InstructionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(getType());
+        int instructionLength = input.readUnsignedShort();
+        input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
+        ActionsInstructionBuilder actionsBuilder = new ActionsInstructionBuilder();
+        int length = instructionLength - InstructionConstants.STANDARD_INSTRUCTION_LENGTH;
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        List<Action> actions = ListDeserializer.deserializeList(
+                EncodeConstants.OF13_VERSION_ID, length, input, keyMaker, getRegistry());
+        actionsBuilder.setAction(actions);
+        builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());
+        return builder.build();
+    }
+
+    protected abstract Class<? extends InstructionBase> getType();
+
+    protected DeserializerRegistry getRegistry() {
+        return registry;
+    }
+
+    @Override
+    public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+        this.registry = deserializerRegistry;
+    }
+}
index f15409f3ee57ab1c31e1260375ee275573cb1e57..38a66452df30e183c855be184cc126be89e0133f 100644 (file)
@@ -1,66 +1,66 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractInstructionDeserializer implements OFDeserializer<Instruction>,\r
-        HeaderDeserializer<Instruction> {\r
-\r
-    @Override\r
-    public Instruction deserializeHeader(ByteBuf rawMessage) {\r
-        InstructionBuilder builder = processHeader(rawMessage);\r
-        rawMessage.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        return builder.build();\r
-    }\r
-\r
-    protected InstructionBuilder processHeader(ByteBuf input) {\r
-        InstructionBuilder builder = new InstructionBuilder();\r
-        int type = input.readUnsignedShort();\r
-        switch (type) {\r
-        case 1:\r
-            builder.setType(GotoTable.class);\r
-            break;\r
-        case 2:\r
-            builder.setType(WriteMetadata.class);\r
-            break;\r
-        case 3:\r
-            builder.setType(WriteActions.class);\r
-            break;\r
-        case 4:\r
-            builder.setType(ApplyActions.class);\r
-            break;\r
-        case 5:\r
-            builder.setType(ClearActions.class);\r
-            break;\r
-        case 6:\r
-            builder.setType(Meter.class);\r
-            break;\r
-        default:\r
-            throw new IllegalStateException("Unknown instruction type received, type: " + type);\r
-        }\r
-        return builder;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractInstructionDeserializer implements OFDeserializer<Instruction>,
+        HeaderDeserializer<Instruction> {
+
+    @Override
+    public Instruction deserializeHeader(ByteBuf rawMessage) {
+        InstructionBuilder builder = processHeader(rawMessage);
+        rawMessage.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        return builder.build();
+    }
+
+    protected InstructionBuilder processHeader(ByteBuf input) {
+        InstructionBuilder builder = new InstructionBuilder();
+        int type = input.readUnsignedShort();
+        switch (type) {
+        case 1:
+            builder.setType(GotoTable.class);
+            break;
+        case 2:
+            builder.setType(WriteMetadata.class);
+            break;
+        case 3:
+            builder.setType(WriteActions.class);
+            break;
+        case 4:
+            builder.setType(ApplyActions.class);
+            break;
+        case 5:
+            builder.setType(ClearActions.class);
+            break;
+        case 6:
+            builder.setType(Meter.class);
+            break;
+        default:
+            throw new IllegalStateException("Unknown instruction type received, type: " + type);
+        }
+        return builder;
+    }
+}
index 7b6319c90794419261afcf234b2df7668a04404e..c55aaceac484a8c3373c484afec6572eb060e41a 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ApplyActionsInstructionDeserializer extends AbstractActionInstructionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends InstructionBase> getType() {\r
-        return ApplyActions.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ApplyActionsInstructionDeserializer extends AbstractActionInstructionDeserializer {
+
+    @Override
+    protected Class<? extends InstructionBase> getType() {
+        return ApplyActions.class;
+    }
+
+}
index cc2ef5e839a3cebf4516542fcc583fd156e90fb1..9fd7cec90981649cf87e51cae22f8e5425c5e3af 100644 (file)
@@ -1,42 +1,42 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ClearActionsInstructionDeserializer extends AbstractInstructionDeserializer {\r
-\r
-    @Override\r
-    public Instruction deserialize(ByteBuf input) {\r
-        InstructionBuilder builder = super.processHeader(input);\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);\r
-        ActionsInstructionBuilder actionsBuilder = \r
-                new ActionsInstructionBuilder();\r
-        List<Action> actions = new ArrayList<>();\r
-        actionsBuilder.setAction(actions);\r
-        builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());\r
-        return builder.build();\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ClearActionsInstructionDeserializer extends AbstractInstructionDeserializer {
+
+    @Override
+    public Instruction deserialize(ByteBuf input) {
+        InstructionBuilder builder = super.processHeader(input);
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
+        ActionsInstructionBuilder actionsBuilder = 
+                new ActionsInstructionBuilder();
+        List<Action> actions = new ArrayList<>();
+        actionsBuilder.setAction(actions);
+        builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());
+        return builder.build();
+    }
 }
\ No newline at end of file
index 21af10fb623e49f50ede206358187425722f91d2..317e69c2a45d87f651591baec473c104abcae8f0 100644 (file)
@@ -1,39 +1,39 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class GoToTableInstructionDeserializer extends AbstractInstructionDeserializer {\r
-\r
-    @Override\r
-    public Instruction deserialize(ByteBuf input) {\r
-        InstructionBuilder builder = new InstructionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(GotoTable.class);\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        TableIdInstructionBuilder tableBuilder = new TableIdInstructionBuilder();\r
-        tableBuilder.setTableId(input.readUnsignedByte());\r
-        builder.addAugmentation(TableIdInstruction.class, tableBuilder.build());\r
-        input.skipBytes(InstructionConstants.PADDING_IN_GOTO_TABLE);\r
-        return builder.build();\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class GoToTableInstructionDeserializer extends AbstractInstructionDeserializer {
+
+    @Override
+    public Instruction deserialize(ByteBuf input) {
+        InstructionBuilder builder = new InstructionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(GotoTable.class);
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        TableIdInstructionBuilder tableBuilder = new TableIdInstructionBuilder();
+        tableBuilder.setTableId(input.readUnsignedByte());
+        builder.addAugmentation(TableIdInstruction.class, tableBuilder.build());
+        input.skipBytes(InstructionConstants.PADDING_IN_GOTO_TABLE);
+        return builder.build();
+    }
+}
index ebd626d379fd4b17833576692d100d2784f48d4e..1021987fb669172411ab5e39c9c7aa86789da211 100644 (file)
@@ -1,38 +1,38 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MeterInstructionDeserializer extends AbstractInstructionDeserializer {\r
-\r
-    @Override\r
-    public Instruction deserialize(ByteBuf input) {\r
-        InstructionBuilder builder = new InstructionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(Meter.class);\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        MeterIdInstructionBuilder meterBuilder = new MeterIdInstructionBuilder();\r
-        meterBuilder.setMeterId(input.readUnsignedInt());\r
-        builder.addAugmentation(MeterIdInstruction.class, meterBuilder.build());\r
-        return builder.build();\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MeterInstructionDeserializer extends AbstractInstructionDeserializer {
+
+    @Override
+    public Instruction deserialize(ByteBuf input) {
+        InstructionBuilder builder = new InstructionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(Meter.class);
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        MeterIdInstructionBuilder meterBuilder = new MeterIdInstructionBuilder();
+        meterBuilder.setMeterId(input.readUnsignedInt());
+        builder.addAugmentation(MeterIdInstruction.class, meterBuilder.build());
+        return builder.build();
+    }
+
+}
index 311e5ea7ebbe49f8b9a4e525c31406595881f1d1..c60532b083e4c06819ed4097efb45a0cad036234 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class WriteActionsInstructionDeserializer extends AbstractActionInstructionDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends InstructionBase> getType() {\r
-        return WriteActions.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class WriteActionsInstructionDeserializer extends AbstractActionInstructionDeserializer {
+
+    @Override
+    protected Class<? extends InstructionBase> getType() {
+        return WriteActions.class;
+    }
+
+}
index 419dc974d2ca256c90dcceefe9a3fdd44bc9ada7..9412413bd450f5b3b4b0e11be3c5cec453794651 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class WriteMetadataInstructionDeserializer extends AbstractInstructionDeserializer {\r
-\r
-    @Override\r
-    public Instruction deserialize(ByteBuf input) {\r
-        InstructionBuilder builder = new InstructionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setType(WriteMetadata.class);\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        input.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA);\r
-        MetadataInstructionBuilder metadataBuilder = new MetadataInstructionBuilder();\r
-        byte[] metadata = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
-        input.readBytes(metadata);\r
-        metadataBuilder.setMetadata(metadata);\r
-        byte[] metadataMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
-        input.readBytes(metadataMask);\r
-        metadataBuilder.setMetadataMask(metadataMask);\r
-        builder.addAugmentation(MetadataInstruction.class, metadataBuilder.build());\r
-        return builder.build();\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class WriteMetadataInstructionDeserializer extends AbstractInstructionDeserializer {
+
+    @Override
+    public Instruction deserialize(ByteBuf input) {
+        InstructionBuilder builder = new InstructionBuilder();
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setType(WriteMetadata.class);
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        input.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA);
+        MetadataInstructionBuilder metadataBuilder = new MetadataInstructionBuilder();
+        byte[] metadata = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+        input.readBytes(metadata);
+        metadataBuilder.setMetadata(metadata);
+        byte[] metadataMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+        input.readBytes(metadataMask);
+        metadataBuilder.setMetadataMask(metadataMask);
+        builder.addAugmentation(MetadataInstruction.class, metadataBuilder.build());
+        return builder.build();
+    }
+}
index 9d7329fb606d3f897c667c3998d295ff4ecc07ab..510b5da330cd86163afecacbc8664e58dc294553 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmIpv4AddressDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(final ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addIpv4AddressAugmentation(builder, input);\r
-        if (builder.isHasMask()) {\r
-            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_INT_IN_BYTES);\r
-        }\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addIpv4AddressAugmentation(final MatchEntriesBuilder builder, final ByteBuf input) {\r
-        Ipv4AddressMatchEntryBuilder ipv4AddressBuilder = new Ipv4AddressMatchEntryBuilder();\r
-        ipv4AddressBuilder.setIpv4Address(new Ipv4Address(ByteBufUtils.readIpv4Address(input)));\r
-        builder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4AddressBuilder.build());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmIpv4AddressDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(final ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addIpv4AddressAugmentation(builder, input);
+        if (builder.isHasMask()) {
+            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_INT_IN_BYTES);
+        }
+        return builder.build();
+    }
+
+    private static void addIpv4AddressAugmentation(final MatchEntriesBuilder builder, final ByteBuf input) {
+        Ipv4AddressMatchEntryBuilder ipv4AddressBuilder = new Ipv4AddressMatchEntryBuilder();
+        ipv4AddressBuilder.setIpv4Address(new Ipv4Address(ByteBufUtils.readIpv4Address(input)));
+        builder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4AddressBuilder.build());
+    }
+}
index d6c4d2b1dcead906a401260fcd4cc156490b4fe1..ca5ac7ead3bf59a3affd0d58705573deb0b2b540 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmIpv6AddressDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(final ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addIpv6AddressAugmentation(builder, input);\r
-        if (builder.isHasMask()) {\r
-            OxmMaskDeserializer.addMaskAugmentation(builder, input,\r
-                    EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES);\r
-        }\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addIpv6AddressAugmentation(final MatchEntriesBuilder builder, final ByteBuf input) {\r
-        Ipv6AddressMatchEntryBuilder ipv6AddressBuilder = new Ipv6AddressMatchEntryBuilder();\r
-        ipv6AddressBuilder.setIpv6Address(new Ipv6Address(ByteBufUtils.readIpv6Address(input)));\r
-        builder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6AddressBuilder.build());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmIpv6AddressDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(final ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addIpv6AddressAugmentation(builder, input);
+        if (builder.isHasMask()) {
+            OxmMaskDeserializer.addMaskAugmentation(builder, input,
+                    EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES);
+        }
+        return builder.build();
+    }
+
+    private static void addIpv6AddressAugmentation(final MatchEntriesBuilder builder, final ByteBuf input) {
+        Ipv6AddressMatchEntryBuilder ipv6AddressBuilder = new Ipv6AddressMatchEntryBuilder();
+        ipv6AddressBuilder.setIpv6Address(new Ipv6Address(ByteBufUtils.readIpv6Address(input)));
+        builder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6AddressBuilder.build());
+    }
+}
index 32383b2f089fdd8d82ad9538020e510899463b76..aa4b588468c457c79edccb14ebe993d46244990f 100644 (file)
@@ -1,45 +1,45 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmMacAddressDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addMacAddressAugmentation(builder, input);\r
-        if (builder.isHasMask()) {\r
-            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.MAC_ADDRESS_LENGTH);\r
-        }\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addMacAddressAugmentation(MatchEntriesBuilder builder, ByteBuf input) {\r
-        MacAddressMatchEntryBuilder macAddress = new MacAddressMatchEntryBuilder();\r
-        byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];\r
-        input.readBytes(address);\r
-        macAddress.setMacAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));\r
-        builder.addAugmentation(MacAddressMatchEntry.class, macAddress.build());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmMacAddressDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addMacAddressAugmentation(builder, input);
+        if (builder.isHasMask()) {
+            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.MAC_ADDRESS_LENGTH);
+        }
+        return builder.build();
+    }
+
+    private static void addMacAddressAugmentation(MatchEntriesBuilder builder, ByteBuf input) {
+        MacAddressMatchEntryBuilder macAddress = new MacAddressMatchEntryBuilder();
+        byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
+        input.readBytes(address);
+        macAddress.setMacAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));
+        builder.addAugmentation(MacAddressMatchEntry.class, macAddress.build());
+    }
+}
index d512b59e570b663d9626fecac42225cde06267e0..1d737b093bfc57e1673d3108d8ba70548b37ac66 100644 (file)
@@ -1,64 +1,64 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmMatchEntryDeserializer implements HeaderDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserializeHeader(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        return builder.build();\r
-    }\r
-\r
-    /**\r
-     * @return oxm_field class\r
-     */\r
-    protected abstract Class<? extends MatchField> getOxmField();\r
-\r
-    /**\r
-     * @return oxm_class class\r
-     */\r
-    protected abstract Class<? extends OxmClassBase> getOxmClass();\r
-\r
-    /**\r
-     * Prepares match entry header - sets oxm_class, oxm_field, hasMask\r
-     *  + sets the buffer.readerIndex() to the end of match entry \r
-     *  - where augmentation starts\r
-     * @param oxmClass oxm class type\r
-     * @param oxmField oxm field type\r
-     * @param input input bytebuf\r
-     * @return MatchEntriesBuilder which can be filled with MatchEntry augmentation\r
-     */\r
-    protected MatchEntriesBuilder processHeader(Class<? extends OxmClassBase> oxmClass,\r
-            Class<? extends MatchField> oxmField, ByteBuf input) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(oxmClass);\r
-        // skip oxm_class (provided)\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        builder.setOxmMatchField(oxmField);\r
-        boolean hasMask = (input.readUnsignedByte() & 1) != 0;\r
-        builder.setHasMask(hasMask);\r
-        // skip match entry length - not needed\r
-        input.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);\r
-        return builder;\r
-    }\r
-    \r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmMatchEntryDeserializer implements HeaderDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserializeHeader(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        return builder.build();
+    }
+
+    /**
+     * @return oxm_field class
+     */
+    protected abstract Class<? extends MatchField> getOxmField();
+
+    /**
+     * @return oxm_class class
+     */
+    protected abstract Class<? extends OxmClassBase> getOxmClass();
+
+    /**
+     * Prepares match entry header - sets oxm_class, oxm_field, hasMask
+     *  + sets the buffer.readerIndex() to the end of match entry 
+     *  - where augmentation starts
+     * @param oxmClass oxm class type
+     * @param oxmField oxm field type
+     * @param input input bytebuf
+     * @return MatchEntriesBuilder which can be filled with MatchEntry augmentation
+     */
+    protected MatchEntriesBuilder processHeader(Class<? extends OxmClassBase> oxmClass,
+            Class<? extends MatchField> oxmField, ByteBuf input) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(oxmClass);
+        // skip oxm_class (provided)
+        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        builder.setOxmMatchField(oxmField);
+        boolean hasMask = (input.readUnsignedByte() & 1) != 0;
+        builder.setHasMask(hasMask);
+        // skip match entry length - not needed
+        input.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+        return builder;
+    }
+    
+}
index d38b82ed0a058f7714b2e4d5c66c8fc60719b3fd..4de031f7078bc21fb665a32b3db3a5be5aae7539 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmMetadataDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addMetadataAugmentation(builder, input);\r
-        if (builder.isHasMask()) {\r
-            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_LONG_IN_BYTES);\r
-        }\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addMetadataAugmentation(MatchEntriesBuilder builder, ByteBuf input) {\r
-        MetadataMatchEntryBuilder metadata = new MetadataMatchEntryBuilder();\r
-        byte[] metadataBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
-        input.readBytes(metadataBytes);\r
-        metadata.setMetadata(metadataBytes);\r
-        builder.addAugmentation(MetadataMatchEntry.class, metadata.build());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmMetadataDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addMetadataAugmentation(builder, input);
+        if (builder.isHasMask()) {
+            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_LONG_IN_BYTES);
+        }
+        return builder.build();
+    }
+
+    private static void addMetadataAugmentation(MatchEntriesBuilder builder, ByteBuf input) {
+        MetadataMatchEntryBuilder metadata = new MetadataMatchEntryBuilder();
+        byte[] metadataBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+        input.readBytes(metadataBytes);
+        metadata.setMetadata(metadataBytes);
+        builder.addAugmentation(MetadataMatchEntry.class, metadata.build());
+    }
+}
index 43203006678ccae5470a2aecdebc0f5614d50e14..0b3530db2f69e89a15016c4e464524b1166a5fd4 100644 (file)
@@ -1,38 +1,38 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmPortDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addPortAugmentation(builder, input);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addPortAugmentation(MatchEntriesBuilder builder, ByteBuf input) {\r
-        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new PortNumber(input.readUnsignedShort()));\r
-        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmPortDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addPortAugmentation(builder, input);
+        return builder.build();
+    }
+
+    private static void addPortAugmentation(MatchEntriesBuilder builder, ByteBuf input) {
+        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new PortNumber(input.readUnsignedShort()));
+        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+    }
+}
index bd88623c22b7ca551ebf70a2edb7057e2bccd5c5..35895a9bb5e7ed0139bf1f0bda4aaed7de14a072 100644 (file)
@@ -1,34 +1,34 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractOxmPortNumberDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        PortNumberMatchEntryBuilder port = new PortNumberMatchEntryBuilder();\r
-        port.setPortNumber(new PortNumber(input.readUnsignedInt()));\r
-        builder.addAugmentation(PortNumberMatchEntry.class, port.build());\r
-        return builder.build();\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractOxmPortNumberDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        PortNumberMatchEntryBuilder port = new PortNumberMatchEntryBuilder();
+        port.setPortNumber(new PortNumber(input.readUnsignedInt()));
+        builder.addAugmentation(PortNumberMatchEntry.class, port.build());
+        return builder.build();
+    }
+}
index 41fde20695d3ba6755669d79ae1ffbb4371477aa..7a28723867ceaed4be08a91c5bddef790e617b2e 100644 (file)
@@ -1,53 +1,53 @@
-/*\r
- * Copyright (C) 2014 Red Hat, Inc.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcpFlagMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpFlag;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-/**\r
- * @author brent.salisbury\r
- *\r
- */\r
-public class NxmTcpFlagDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-    private static final Logger logger = LoggerFactory.getLogger(NxmTcpFlagDeserializer.class);\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addTcpFlagAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addTcpFlagAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
-        TcpFlagMatchEntryBuilder tcpFlagMatchEntryBuilder = new TcpFlagMatchEntryBuilder();\r
-        tcpFlagMatchEntryBuilder.setTcpFlag(input.readUnsignedShort());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return TcpFlag.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return Nxm1Class.class;\r
-    }\r
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcpFlagMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpFlag;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author brent.salisbury
+ *
+ */
+public class NxmTcpFlagDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+    private static final Logger logger = LoggerFactory.getLogger(NxmTcpFlagDeserializer.class);
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addTcpFlagAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addTcpFlagAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+        TcpFlagMatchEntryBuilder tcpFlagMatchEntryBuilder = new TcpFlagMatchEntryBuilder();
+        tcpFlagMatchEntryBuilder.setTcpFlag(input.readUnsignedShort());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return TcpFlag.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return Nxm1Class.class;
+    }
 }
\ No newline at end of file
index c2532ab0232e140b5d94195c0822a5e7c43ccaa6..2d4383982f9144ee45e0ed1fb3eb935d18160d18 100644 (file)
@@ -1,51 +1,51 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpOpDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addArpOpAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addArpOpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
-        OpCodeMatchEntryBuilder opcodeBuilder = new OpCodeMatchEntryBuilder();\r
-        opcodeBuilder.setOpCode(input.readUnsignedShort());\r
-        builder.addAugmentation(OpCodeMatchEntry.class, opcodeBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return ArpOp.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpOpDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addArpOpAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addArpOpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+        OpCodeMatchEntryBuilder opcodeBuilder = new OpCodeMatchEntryBuilder();
+        opcodeBuilder.setOpCode(input.readUnsignedShort());
+        builder.addAugmentation(OpCodeMatchEntry.class, opcodeBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return ArpOp.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 09744acabace97b7c3a78112f621e426e5ef9f03..b26b9e3a041ce9a8b93891fbce7371fb233aba1c 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpShaDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return ArpSha.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpShaDeserializer extends AbstractOxmMacAddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return ArpSha.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 8d99b44d634940e556da16741ad59db0d47e59a8..cb83cb2489918eb98750ec5c469886b622af3511 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpSpaDeserializer extends AbstractOxmIpv4AddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return ArpSpa.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpSpaDeserializer extends AbstractOxmIpv4AddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return ArpSpa.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index cba0642e14f054894150a08e5c7ac0dc747d5f05..69ce30a8f9b3414c380afe5d6d0103c1ea57bd42 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpThaDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return ArpTha.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpThaDeserializer extends AbstractOxmMacAddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return ArpTha.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index dddb3ef4dc4c399c9cd671137a4a37d263666306..dd7b27c9c23aef603f5ff4f92acabf37c5c59589 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpTpaDeserializer extends AbstractOxmIpv4AddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return ArpTpa.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpTpaDeserializer extends AbstractOxmIpv4AddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return ArpTpa.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 257fde06ab43ebbfa7b89ef017c9b6ec4bd4b507..9e1e6e20a1a1a9f364d6c2417939e8b9f1a3958c 100644 (file)
@@ -1,31 +1,31 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthDstDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return EthDst.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthDstDeserializer extends AbstractOxmMacAddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return EthDst.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+
+}
index ebcd01f825467f13822258fcd71d56d1ac57ba49..3302a650020e171658e34ff868ac5dbe6a0cddb8 100644 (file)
@@ -1,31 +1,31 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthSrcDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return EthSrc.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthSrcDeserializer extends AbstractOxmMacAddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return EthSrc.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+
+}
index ce4ea0c46b214a72ebddf8d777332227efa5b5a4..94d08706f989771a409cd49c8dfc8b79d9493057 100644 (file)
@@ -1,52 +1,52 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthTypeDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addEthTypeAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addEthTypeAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
-        EthTypeMatchEntryBuilder ethertypeBuilder = new EthTypeMatchEntryBuilder();\r
-        ethertypeBuilder.setEthType(new EtherType(input.readUnsignedShort()));\r
-        builder.addAugmentation(EthTypeMatchEntry.class, ethertypeBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return EthType.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthTypeDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addEthTypeAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addEthTypeAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+        EthTypeMatchEntryBuilder ethertypeBuilder = new EthTypeMatchEntryBuilder();
+        ethertypeBuilder.setEthType(new EtherType(input.readUnsignedShort()));
+        builder.addAugmentation(EthTypeMatchEntry.class, ethertypeBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return EthType.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index c0df85bd778d6ee3fcfa09655e1c86388ef2a338..8ac68433dd039b96aef4153e752b982830a060ce 100644 (file)
@@ -1,53 +1,53 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4CodeDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addIcmpv4CodeAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addIcmpv4CodeAugmentation(ByteBuf input,\r
-            MatchEntriesBuilder builder) {\r
-        Icmpv4CodeMatchEntryBuilder icmpv4CodeBuilder = new Icmpv4CodeMatchEntryBuilder();\r
-        icmpv4CodeBuilder.setIcmpv4Code(input.readUnsignedByte());\r
-        builder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4CodeBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Icmpv4Code.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4CodeDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addIcmpv4CodeAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addIcmpv4CodeAugmentation(ByteBuf input,
+            MatchEntriesBuilder builder) {
+        Icmpv4CodeMatchEntryBuilder icmpv4CodeBuilder = new Icmpv4CodeMatchEntryBuilder();
+        icmpv4CodeBuilder.setIcmpv4Code(input.readUnsignedByte());
+        builder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4CodeBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Icmpv4Code.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+
+}
index 05f81a3f3e8bebe6f2517955e1b678e16a525506..4134bb1c12e2676351b6be9ca8e27ec770c049b6 100644 (file)
@@ -1,52 +1,52 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4TypeDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addIcmpv4TypeAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addIcmpv4TypeAugmentation(ByteBuf input,\r
-            MatchEntriesBuilder builder) {\r
-        Icmpv4TypeMatchEntryBuilder icmpv4TypeBuilder = new Icmpv4TypeMatchEntryBuilder();\r
-        icmpv4TypeBuilder.setIcmpv4Type(input.readUnsignedByte());\r
-        builder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4TypeBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Icmpv4Type.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4TypeDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addIcmpv4TypeAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addIcmpv4TypeAugmentation(ByteBuf input,
+            MatchEntriesBuilder builder) {
+        Icmpv4TypeMatchEntryBuilder icmpv4TypeBuilder = new Icmpv4TypeMatchEntryBuilder();
+        icmpv4TypeBuilder.setIcmpv4Type(input.readUnsignedByte());
+        builder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4TypeBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Icmpv4Type.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 930a4b3155bf197f280e2a529e598ffa5cbc0ca8..7cc38f19319c262c3956c137b11efd38f6b8a4b1 100644 (file)
@@ -1,52 +1,52 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6CodeDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addIcmpv6CodeAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addIcmpv6CodeAugmentation(ByteBuf input,\r
-            MatchEntriesBuilder builder) {\r
-        Icmpv6CodeMatchEntryBuilder icmpv6CodeBuilder = new Icmpv6CodeMatchEntryBuilder();\r
-        icmpv6CodeBuilder.setIcmpv6Code(input.readUnsignedByte());\r
-        builder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6CodeBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Icmpv6Code.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6CodeDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addIcmpv6CodeAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addIcmpv6CodeAugmentation(ByteBuf input,
+            MatchEntriesBuilder builder) {
+        Icmpv6CodeMatchEntryBuilder icmpv6CodeBuilder = new Icmpv6CodeMatchEntryBuilder();
+        icmpv6CodeBuilder.setIcmpv6Code(input.readUnsignedByte());
+        builder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6CodeBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Icmpv6Code.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 11f9336c0c6787c29d8ea900c6674dc705a6a923..de155fcbc57445a17c05a2a042f5a7ec3c545382 100644 (file)
@@ -1,47 +1,47 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6TypeDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        Icmpv6TypeMatchEntryBuilder icmpv6TypeBuilder = new Icmpv6TypeMatchEntryBuilder();\r
-        icmpv6TypeBuilder.setIcmpv6Type(input.readUnsignedByte());\r
-        builder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6TypeBuilder.build());\r
-        return builder.build();\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Icmpv6Type.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6TypeDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        Icmpv6TypeMatchEntryBuilder icmpv6TypeBuilder = new Icmpv6TypeMatchEntryBuilder();
+        icmpv6TypeBuilder.setIcmpv6Type(input.readUnsignedByte());
+        builder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6TypeBuilder.build());
+        return builder.build();
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Icmpv6Type.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index d96857968221bc922bbc7c93662dd6d209ee686f..54b826f887653a69f345ad8a897532f7e6f9d6f2 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmInPhyPortDeserializer extends AbstractOxmPortNumberDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return InPhyPort.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmInPhyPortDeserializer extends AbstractOxmPortNumberDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return InPhyPort.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 4f9af4fa05087211c2d1a75d73ecdc5833ff39e7..342d2a33ca08e8a463dd3a265aa01709b1542fa0 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmInPortDeserializer extends AbstractOxmPortNumberDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return InPort.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmInPortDeserializer extends AbstractOxmPortNumberDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return InPort.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index eb92d143bb445fe3bdfca8640cd894b4a251f6f2..e4880ba9d59cfc4e4c2a91bbb99edd7bf32002a6 100644 (file)
@@ -1,52 +1,52 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpDscpDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addIpDscpAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addIpDscpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
-        DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();\r
-        dscpBuilder.setDscp(new Dscp(input.readUnsignedByte()));\r
-        builder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return IpDscp.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpDscpDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addIpDscpAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addIpDscpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+        DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();
+        dscpBuilder.setDscp(new Dscp(input.readUnsignedByte()));
+        builder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return IpDscp.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 7a534756a4e5d21ce40596fc05f4b1e543882657..150c6dc6b17436c4124ec542b102954db69a06b7 100644 (file)
@@ -1,51 +1,51 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpEcnDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addIpEcnAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addIpEcnAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
-        EcnMatchEntryBuilder ecnBuilder = new EcnMatchEntryBuilder();\r
-        ecnBuilder.setEcn(input.readUnsignedByte());\r
-        builder.addAugmentation(EcnMatchEntry.class, ecnBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return IpEcn.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpEcnDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addIpEcnAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addIpEcnAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+        EcnMatchEntryBuilder ecnBuilder = new EcnMatchEntryBuilder();
+        ecnBuilder.setEcn(input.readUnsignedByte());
+        builder.addAugmentation(EcnMatchEntry.class, ecnBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return IpEcn.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index f99ecba856c04788e125e2d08f72f2d5527df113..9e67af39cd4c871787dfe41cd0d95d1c9ac83efc 100644 (file)
@@ -1,51 +1,51 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpProtoDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addIpProtoAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addIpProtoAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
-        ProtocolNumberMatchEntryBuilder protoNumberBuilder = new ProtocolNumberMatchEntryBuilder();\r
-        protoNumberBuilder.setProtocolNumber(input.readUnsignedByte());\r
-        builder.addAugmentation(ProtocolNumberMatchEntry.class, protoNumberBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return IpProto.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpProtoDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addIpProtoAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addIpProtoAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+        ProtocolNumberMatchEntryBuilder protoNumberBuilder = new ProtocolNumberMatchEntryBuilder();
+        protoNumberBuilder.setProtocolNumber(input.readUnsignedByte());
+        builder.addAugmentation(ProtocolNumberMatchEntry.class, protoNumberBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return IpProto.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index ae63c9d67a3ddbdf153531cf95f39ddb4be435e1..9939fed95ed7cfb24b6d75fe903f29f612b0f544 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4DstDeserializer extends AbstractOxmIpv4AddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Ipv4Dst.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4DstDeserializer extends AbstractOxmIpv4AddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Ipv4Dst.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index b03ca0013d10a4401d6f0c5cbd3d59b587fd2f29..a84b2fa3c3365359430e7b7d4c9b44df23626d3e 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4SrcDeserializer extends AbstractOxmIpv4AddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Ipv4Src.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4SrcDeserializer extends AbstractOxmIpv4AddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Ipv4Src.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index f4170d8c4512dcc503fce67bd91225c97ed1100c..11b5cc3ac7e47ebe1b4ba9b59927ea69fd14bddc 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6DstDeserializer extends AbstractOxmIpv6AddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Ipv6Dst.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6DstDeserializer extends AbstractOxmIpv6AddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Ipv6Dst.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 26f7f8399be71f5f4cfc4fc73ca75d7f14630f0d..7267333cac94c8990407ba42ed15f9247b433c16 100644 (file)
@@ -1,67 +1,67 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6ExtHdrDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addIpv6ExtHdrAugmentation(input, builder);\r
-        if (builder.isHasMask()) {\r
-            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        }\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addIpv6ExtHdrAugmentation(ByteBuf input,\r
-            MatchEntriesBuilder builder) {\r
-        PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();\r
-        int bitmap = input.readUnsignedShort();\r
-        final Boolean nonext = ((bitmap) & (1<<0)) != 0;\r
-        final Boolean esp = ((bitmap) & (1<<1)) != 0;\r
-        final Boolean auth = ((bitmap) & (1<<2)) != 0;\r
-        final Boolean dest = ((bitmap) & (1<<3)) != 0;\r
-        final Boolean frag = ((bitmap) & (1<<4)) != 0;\r
-        final Boolean router = ((bitmap) & (1<<5)) != 0;\r
-        final Boolean hop = ((bitmap) & (1<<6)) != 0;\r
-        final Boolean unrep = ((bitmap) & (1<<7)) != 0;\r
-        final Boolean unseq = ((bitmap) & (1<<8)) != 0;\r
-        pseudoBuilder.setPseudoField(new Ipv6ExthdrFlags(auth, dest, esp, frag, hop, nonext, router, unrep, unseq));\r
-        builder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Ipv6Exthdr.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6ExtHdrDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addIpv6ExtHdrAugmentation(input, builder);
+        if (builder.isHasMask()) {
+            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        }
+        return builder.build();
+    }
+
+    private static void addIpv6ExtHdrAugmentation(ByteBuf input,
+            MatchEntriesBuilder builder) {
+        PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();
+        int bitmap = input.readUnsignedShort();
+        final Boolean nonext = ((bitmap) & (1<<0)) != 0;
+        final Boolean esp = ((bitmap) & (1<<1)) != 0;
+        final Boolean auth = ((bitmap) & (1<<2)) != 0;
+        final Boolean dest = ((bitmap) & (1<<3)) != 0;
+        final Boolean frag = ((bitmap) & (1<<4)) != 0;
+        final Boolean router = ((bitmap) & (1<<5)) != 0;
+        final Boolean hop = ((bitmap) & (1<<6)) != 0;
+        final Boolean unrep = ((bitmap) & (1<<7)) != 0;
+        final Boolean unseq = ((bitmap) & (1<<8)) != 0;
+        pseudoBuilder.setPseudoField(new Ipv6ExthdrFlags(auth, dest, esp, frag, hop, nonext, router, unrep, unseq));
+        builder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Ipv6Exthdr.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
 }
\ No newline at end of file
index bcb7643e74834baac51089b8b6b04155368a71c6..15c8aa07bdb40a8adbd0e4260d11732719da8bda 100644 (file)
@@ -1,58 +1,58 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6FlabelDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addIpv6FlabelAugmentation(input, builder);\r
-        if (builder.isHasMask()) {\r
-            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_INT_IN_BYTES);\r
-        }\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addIpv6FlabelAugmentation(ByteBuf input,\r
-            MatchEntriesBuilder builder) {\r
-        Ipv6FlabelMatchEntryBuilder ipv6FlabelBuilder = new Ipv6FlabelMatchEntryBuilder();\r
-        ipv6FlabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(input.readUnsignedInt()));\r
-        builder.addAugmentation(Ipv6FlabelMatchEntry.class, ipv6FlabelBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Ipv6Flabel.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6FlabelDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addIpv6FlabelAugmentation(input, builder);
+        if (builder.isHasMask()) {
+            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_INT_IN_BYTES);
+        }
+        return builder.build();
+    }
+
+    private static void addIpv6FlabelAugmentation(ByteBuf input,
+            MatchEntriesBuilder builder) {
+        Ipv6FlabelMatchEntryBuilder ipv6FlabelBuilder = new Ipv6FlabelMatchEntryBuilder();
+        ipv6FlabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(input.readUnsignedInt()));
+        builder.addAugmentation(Ipv6FlabelMatchEntry.class, ipv6FlabelBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Ipv6Flabel.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+
+}
index 9e9c5ab4b50daa325d03ff432cc18f289ecc1b16..3ca7b686626eb68c0c77572ffcc4ed82537b57a0 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdSllDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Ipv6NdSll.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdSllDeserializer extends AbstractOxmMacAddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Ipv6NdSll.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 01c7dc8cfe1439c0f2d4dc871a6e94a64387e7cb..5b2543c1f2407d1075a99453172aa69c7477cac0 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdTargetDeserializer extends AbstractOxmIpv6AddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Ipv6NdTarget.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdTargetDeserializer extends AbstractOxmIpv6AddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Ipv6NdTarget.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 9b7f4b801c7f2632378c2e14dc00b99b737aaeaa..fabc8d45b4976e8e64370f63ce0d5ea3547210f1 100644 (file)
@@ -1,31 +1,31 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdTllDeserializer extends AbstractOxmMacAddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Ipv6NdTll.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdTllDeserializer extends AbstractOxmMacAddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Ipv6NdTll.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+
+}
index bb7942a0d8a70027c710b10432e9729a3a70bfa8..59152b45eef0e1c9974318ec94dcd657ed47c089 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6SrcDeserializer extends AbstractOxmIpv6AddressDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Ipv6Src.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6SrcDeserializer extends AbstractOxmIpv6AddressDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Ipv6Src.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 728d42fa7cc86474e664cf2b01c07c97eeffd164..ff8b7ff08280a7dc1fe984f27b8ac63a1726a547 100644 (file)
@@ -1,40 +1,40 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class OxmMaskDeserializer {\r
-\r
-    private OxmMaskDeserializer() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * Appends mask to match entry (match entry builder)\r
-     * @param builder builder which the mask will append to\r
-     * @param input input ByteBuf\r
-     * @param matchEntryLength mask length\r
-     */\r
-    public static void addMaskAugmentation(MatchEntriesBuilder builder, ByteBuf input,\r
-            int matchEntryLength) {\r
-        MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-        byte[] mask = new byte[matchEntryLength];\r
-        input.readBytes(mask);\r
-        maskBuilder.setMask(mask);\r
-        builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class OxmMaskDeserializer {
+
+    private OxmMaskDeserializer() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * Appends mask to match entry (match entry builder)
+     * @param builder builder which the mask will append to
+     * @param input input ByteBuf
+     * @param matchEntryLength mask length
+     */
+    public static void addMaskAugmentation(MatchEntriesBuilder builder, ByteBuf input,
+            int matchEntryLength) {
+        MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+        byte[] mask = new byte[matchEntryLength];
+        input.readBytes(mask);
+        maskBuilder.setMask(mask);
+        builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+    }
+}
index b5dcf47cb7b0ddde547741306523f58394c87b48..ae34635bdefc2bcade1e0b88821e71a39398a7a4 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMetadataDeserializer extends AbstractOxmMetadataDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return Metadata.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMetadataDeserializer extends AbstractOxmMetadataDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return Metadata.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 3fbd2ea0992de0f9b20b6484ddc84b2f399b78f8..65ebac39671c5afff621537fc9d640d2d428dccc 100644 (file)
@@ -1,57 +1,57 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsBosDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addMplsBosDeserializer(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-\r
-    private static void addMplsBosDeserializer(ByteBuf input,\r
-            MatchEntriesBuilder builder) {\r
-        BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();\r
-        if (input.readUnsignedByte() != 0) {\r
-            bosBuilder.setBos(true);\r
-        } else {\r
-            bosBuilder.setBos(false);\r
-        }\r
-        builder.addAugmentation(BosMatchEntry.class, bosBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return MplsBos.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsBosDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addMplsBosDeserializer(input, builder);
+        return builder.build();
+    }
+
+
+    private static void addMplsBosDeserializer(ByteBuf input,
+            MatchEntriesBuilder builder) {
+        BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();
+        if (input.readUnsignedByte() != 0) {
+            bosBuilder.setBos(true);
+        } else {
+            bosBuilder.setBos(false);
+        }
+        builder.addAugmentation(BosMatchEntry.class, bosBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return MplsBos.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index fdc657a8c838914bea8367c2802e21ce908a28f4..d7c4fe4fa611b36d4aa5b5e5c5f55edf61acad10 100644 (file)
@@ -1,52 +1,52 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsLabelDeserializer extends AbstractOxmMatchEntryDeserializer\r
-implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addMplsLabelAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addMplsLabelAugmentation(ByteBuf input,\r
-            MatchEntriesBuilder builder) {\r
-        MplsLabelMatchEntryBuilder mplsLabelBuilder = new MplsLabelMatchEntryBuilder();\r
-        mplsLabelBuilder.setMplsLabel(input.readUnsignedInt());\r
-        builder.addAugmentation(MplsLabelMatchEntry.class, mplsLabelBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return MplsLabel.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsLabelDeserializer extends AbstractOxmMatchEntryDeserializer
+implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addMplsLabelAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addMplsLabelAugmentation(ByteBuf input,
+            MatchEntriesBuilder builder) {
+        MplsLabelMatchEntryBuilder mplsLabelBuilder = new MplsLabelMatchEntryBuilder();
+        mplsLabelBuilder.setMplsLabel(input.readUnsignedInt());
+        builder.addAugmentation(MplsLabelMatchEntry.class, mplsLabelBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return MplsLabel.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index f7a063393bfb2e8d084d5bf5c074b5e05e393dde..10cb8d28df19b5f0820922434292b28250b1d818 100644 (file)
@@ -1,52 +1,52 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsTcDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addMplsTcAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addMplsTcAugmentation(ByteBuf input,\r
-            MatchEntriesBuilder builder) {\r
-        TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();\r
-        tcBuilder.setTc(input.readUnsignedByte());\r
-        builder.addAugmentation(TcMatchEntry.class, tcBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return MplsTc.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsTcDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addMplsTcAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addMplsTcAugmentation(ByteBuf input,
+            MatchEntriesBuilder builder) {
+        TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();
+        tcBuilder.setTc(input.readUnsignedByte());
+        builder.addAugmentation(TcMatchEntry.class, tcBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return MplsTc.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
 }
\ No newline at end of file
index f6378763a9f3ae63fedd221f18b322afc44bd604..e400ba36246827f7ea7a6ea3ae6485316e6ee14b 100644 (file)
@@ -1,57 +1,57 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmPbbIsidDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addPbbIsidAugmentation(input, builder);\r
-        if (builder.isHasMask()) {\r
-            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_3_BYTES);\r
-        }\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addPbbIsidAugmentation(ByteBuf input,\r
-            MatchEntriesBuilder builder) {\r
-        IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();\r
-        Integer isid = input.readUnsignedMedium();\r
-        isidBuilder.setIsid(isid.longValue());\r
-        builder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return PbbIsid.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmPbbIsidDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addPbbIsidAugmentation(input, builder);
+        if (builder.isHasMask()) {
+            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_3_BYTES);
+        }
+        return builder.build();
+    }
+
+    private static void addPbbIsidAugmentation(ByteBuf input,
+            MatchEntriesBuilder builder) {
+        IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();
+        Integer isid = input.readUnsignedMedium();
+        isidBuilder.setIsid(isid.longValue());
+        builder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return PbbIsid.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
 }
\ No newline at end of file
index e608ea6301b33be72b93f8359b34f1b323147ee0..0985b75236439106a6d8c8daea8fd536ac1d7533 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpDstDeserializer extends AbstractOxmPortDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return SctpDst.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpDstDeserializer extends AbstractOxmPortDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return SctpDst.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 03e9bf9108d47d1e04e46dfa7f695ee4d2bcbfe6..087e86b0dc8ff0a726fb1f93428bb0efd2166977 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpSrcDeserializer extends AbstractOxmPortDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return SctpSrc.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpSrcDeserializer extends AbstractOxmPortDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return SctpSrc.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 3a2f1612fcb8c9594f04ad450ff209de5554c4bc..1ab75029909cf4883087add68a0facda28bd3578 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpDstDeserializer extends AbstractOxmPortDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return TcpDst.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpDstDeserializer extends AbstractOxmPortDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return TcpDst.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 5d2134318e354494407fb5854b8fe1c76922f099..e1509dc70fc5cd8db44427de3c430cdc99a77198 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpSrcDeserializer extends AbstractOxmPortDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return TcpSrc.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpSrcDeserializer extends AbstractOxmPortDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return TcpSrc.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index bba63ca54eccf3df257a733c5bded691e856a764..84a407af6c3440e9209494e11c14ce70cc9ee0d0 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTunnelIdDeserializer extends AbstractOxmMetadataDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return TunnelId.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTunnelIdDeserializer extends AbstractOxmMetadataDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return TunnelId.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 201266e1eb29798618bda95c469a18394eace296..01d37bebeba326a748d071cd7659335f2d7adec0 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpDstDeserializer extends AbstractOxmPortDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return UdpDst.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpDstDeserializer extends AbstractOxmPortDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return UdpDst.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 626d9d40999765b7a48a905871a228f59b96baad..d4da07527ab98070f26d264aaee6d322cb15c2ab 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpSrcDeserializer extends AbstractOxmPortDeserializer {\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return UdpSrc.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpSrcDeserializer extends AbstractOxmPortDeserializer {
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return UdpSrc.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 0600d2961719367e49498f399a451102750e98e8..332fa751976f1932ad52fa6e97393a9b6d057d16 100644 (file)
@@ -1,51 +1,51 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanPcpDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addVlanPcpAugmentation(input, builder);\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addVlanPcpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
-        VlanPcpMatchEntryBuilder vlanPcpBuilder = new VlanPcpMatchEntryBuilder();\r
-        vlanPcpBuilder.setVlanPcp(input.readUnsignedByte());\r
-        builder.addAugmentation(VlanPcpMatchEntry.class, vlanPcpBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return VlanPcp.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanPcpDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addVlanPcpAugmentation(input, builder);
+        return builder.build();
+    }
+
+    private static void addVlanPcpAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+        VlanPcpMatchEntryBuilder vlanPcpBuilder = new VlanPcpMatchEntryBuilder();
+        vlanPcpBuilder.setVlanPcp(input.readUnsignedByte());
+        builder.addAugmentation(VlanPcpMatchEntry.class, vlanPcpBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return VlanPcp.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index 7ba99e2b71c85d061155f00050fed6e3f0115d7b..0508dbaba5ff7e96c6c1e84cbafd37a6b8bae8cb 100644 (file)
@@ -1,57 +1,57 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanVidDeserializer extends AbstractOxmMatchEntryDeserializer\r
-        implements OFDeserializer<MatchEntries> {\r
-\r
-    @Override\r
-    public MatchEntries deserialize(ByteBuf input) {\r
-        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);\r
-        addVlanVidAugmentation(input, builder);\r
-        if (builder.isHasMask()) {\r
-            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-        }\r
-        return builder.build();\r
-    }\r
-\r
-    private static void addVlanVidAugmentation(ByteBuf input, MatchEntriesBuilder builder) {\r
-        VlanVidMatchEntryBuilder vlanVidBuilder = new VlanVidMatchEntryBuilder();\r
-        int vidEntryValue = input.readUnsignedShort();\r
-        vlanVidBuilder.setCfiBit((vidEntryValue & (1 << 12)) != 0); // cfi is 13-th bit\r
-        vlanVidBuilder.setVlanVid(vidEntryValue & ((1 << 12) - 1)); // value without 13-th bit\r
-        builder.addAugmentation(VlanVidMatchEntry.class, vlanVidBuilder.build());\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends MatchField> getOxmField() {\r
-        return VlanVid.class;\r
-    }\r
-\r
-    @Override\r
-    protected Class<? extends OxmClassBase> getOxmClass() {\r
-        return OpenflowBasicClass.class;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanVidDeserializer extends AbstractOxmMatchEntryDeserializer
+        implements OFDeserializer<MatchEntries> {
+
+    @Override
+    public MatchEntries deserialize(ByteBuf input) {
+        MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
+        addVlanVidAugmentation(input, builder);
+        if (builder.isHasMask()) {
+            OxmMaskDeserializer.addMaskAugmentation(builder, input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+        }
+        return builder.build();
+    }
+
+    private static void addVlanVidAugmentation(ByteBuf input, MatchEntriesBuilder builder) {
+        VlanVidMatchEntryBuilder vlanVidBuilder = new VlanVidMatchEntryBuilder();
+        int vidEntryValue = input.readUnsignedShort();
+        vlanVidBuilder.setCfiBit((vidEntryValue & (1 << 12)) != 0); // cfi is 13-th bit
+        vlanVidBuilder.setVlanVid(vidEntryValue & ((1 << 12) - 1)); // value without 13-th bit
+        builder.addAugmentation(VlanVidMatchEntry.class, vlanVidBuilder.build());
+    }
+
+    @Override
+    protected Class<? extends MatchField> getOxmField() {
+        return VlanVid.class;
+    }
+
+    @Override
+    protected Class<? extends OxmClassBase> getOxmClass() {
+        return OpenflowBasicClass.class;
+    }
+}
index d3e74b5c8b1a5156ccb534041341e22ad4074acd..51539db5fc1f76a5bdd234e2cbe40aeab3f6a1b0 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10EnqueueActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10OutputActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetDlDstActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetDlSrcActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwDstActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwSrcActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwTosActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetTpDstActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetTpSrcActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetVlanPcpActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetVlanVidActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10StripVlanActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13CopyTtlInActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13CopyTtlOutActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13DecMplsTtlActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13DecNwTtlActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13GroupActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13OutputActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopMplsActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopPbbActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopVlanActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushMplsActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushPbbActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushVlanActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetFieldActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetMplsTtlActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetNwTtlActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetQueueActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionSerializerRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;\r
-\r
-/**\r
- * Initializes serializer registry with action serializers\r
- * @author michal.polkorab\r
- */\r
-public final class ActionsInitializer {\r
-\r
-    private ActionsInitializer() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * Registers action serializers into provided registry\r
-     * @param serializerRegistry registry to be initialized with action serializers\r
-     */\r
-    public static void registerActionSerializers(SerializerRegistry serializerRegistry) {\r
-        // register OF v1.0 action serializers\r
-        ActionSerializerRegistryHelper helper = new ActionSerializerRegistryHelper(\r
-                EncodeConstants.OF10_VERSION_ID, serializerRegistry);\r
-        helper.registerSerializer(Output.class, new OF10OutputActionSerializer());\r
-        helper.registerSerializer(SetVlanVid.class, new OF10SetVlanVidActionSerializer());\r
-        helper.registerSerializer(SetVlanPcp.class, new OF10SetVlanPcpActionSerializer());\r
-        helper.registerSerializer(StripVlan.class, new OF10StripVlanActionSerializer());\r
-        helper.registerSerializer(SetDlSrc.class, new OF10SetDlSrcActionSerializer());\r
-        helper.registerSerializer(SetDlDst.class, new OF10SetDlDstActionSerializer());\r
-        helper.registerSerializer(SetNwSrc.class, new OF10SetNwSrcActionSerializer());\r
-        helper.registerSerializer(SetNwDst.class, new OF10SetNwDstActionSerializer());\r
-        helper.registerSerializer(SetNwTos.class, new OF10SetNwTosActionSerializer());\r
-        helper.registerSerializer(SetTpSrc.class, new OF10SetTpSrcActionSerializer());\r
-        helper.registerSerializer(SetTpDst.class, new OF10SetTpDstActionSerializer());\r
-        helper.registerSerializer(Enqueue.class, new OF10EnqueueActionSerializer());\r
-        // register OF v1.0 action serializers\r
-        helper = new ActionSerializerRegistryHelper(\r
-                EncodeConstants.OF13_VERSION_ID, serializerRegistry);\r
-        helper.registerSerializer(Output.class, new OF13OutputActionSerializer());\r
-        helper.registerSerializer(CopyTtlOut.class, new OF13CopyTtlOutActionSerializer());\r
-        helper.registerSerializer(CopyTtlIn.class, new OF13CopyTtlInActionSerializer());\r
-        helper.registerSerializer(SetMplsTtl.class, new OF13SetMplsTtlActionSerializer());\r
-        helper.registerSerializer(DecMplsTtl.class, new OF13DecMplsTtlActionSerializer());\r
-        helper.registerSerializer(PushVlan.class, new OF13PushVlanActionSerializer());\r
-        helper.registerSerializer(PopVlan.class, new OF13PopVlanActionSerializer());\r
-        helper.registerSerializer(PushMpls.class, new OF13PushMplsActionSerializer());\r
-        helper.registerSerializer(PopMpls.class, new OF13PopMplsActionSerializer());\r
-        helper.registerSerializer(SetQueue.class, new OF13SetQueueActionSerializer());\r
-        helper.registerSerializer(Group.class, new OF13GroupActionSerializer());\r
-        helper.registerSerializer(SetNwTtl.class, new OF13SetNwTtlActionSerializer());\r
-        helper.registerSerializer(DecNwTtl.class, new OF13DecNwTtlActionSerializer());\r
-        helper.registerSerializer(SetField.class, new OF13SetFieldActionSerializer());\r
-        helper.registerSerializer(PushPbb.class, new OF13PushPbbActionSerializer());\r
-        helper.registerSerializer(PopPbb.class, new OF13PopPbbActionSerializer());\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10EnqueueActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10OutputActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetDlDstActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetDlSrcActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwDstActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwSrcActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetNwTosActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetTpDstActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetTpSrcActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetVlanPcpActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10SetVlanVidActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF10StripVlanActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13CopyTtlInActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13CopyTtlOutActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13DecMplsTtlActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13DecNwTtlActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13GroupActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13OutputActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopMplsActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopPbbActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PopVlanActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushMplsActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushPbbActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13PushVlanActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetFieldActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetMplsTtlActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetNwTtlActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.action.OF13SetQueueActionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.util.ActionSerializerRegistryHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;
+
+/**
+ * Initializes serializer registry with action serializers
+ * @author michal.polkorab
+ */
+public final class ActionsInitializer {
+
+    private ActionsInitializer() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * Registers action serializers into provided registry
+     * @param serializerRegistry registry to be initialized with action serializers
+     */
+    public static void registerActionSerializers(SerializerRegistry serializerRegistry) {
+        // register OF v1.0 action serializers
+        ActionSerializerRegistryHelper helper = new ActionSerializerRegistryHelper(
+                EncodeConstants.OF10_VERSION_ID, serializerRegistry);
+        helper.registerSerializer(Output.class, new OF10OutputActionSerializer());
+        helper.registerSerializer(SetVlanVid.class, new OF10SetVlanVidActionSerializer());
+        helper.registerSerializer(SetVlanPcp.class, new OF10SetVlanPcpActionSerializer());
+        helper.registerSerializer(StripVlan.class, new OF10StripVlanActionSerializer());
+        helper.registerSerializer(SetDlSrc.class, new OF10SetDlSrcActionSerializer());
+        helper.registerSerializer(SetDlDst.class, new OF10SetDlDstActionSerializer());
+        helper.registerSerializer(SetNwSrc.class, new OF10SetNwSrcActionSerializer());
+        helper.registerSerializer(SetNwDst.class, new OF10SetNwDstActionSerializer());
+        helper.registerSerializer(SetNwTos.class, new OF10SetNwTosActionSerializer());
+        helper.registerSerializer(SetTpSrc.class, new OF10SetTpSrcActionSerializer());
+        helper.registerSerializer(SetTpDst.class, new OF10SetTpDstActionSerializer());
+        helper.registerSerializer(Enqueue.class, new OF10EnqueueActionSerializer());
+        // register OF v1.0 action serializers
+        helper = new ActionSerializerRegistryHelper(
+                EncodeConstants.OF13_VERSION_ID, serializerRegistry);
+        helper.registerSerializer(Output.class, new OF13OutputActionSerializer());
+        helper.registerSerializer(CopyTtlOut.class, new OF13CopyTtlOutActionSerializer());
+        helper.registerSerializer(CopyTtlIn.class, new OF13CopyTtlInActionSerializer());
+        helper.registerSerializer(SetMplsTtl.class, new OF13SetMplsTtlActionSerializer());
+        helper.registerSerializer(DecMplsTtl.class, new OF13DecMplsTtlActionSerializer());
+        helper.registerSerializer(PushVlan.class, new OF13PushVlanActionSerializer());
+        helper.registerSerializer(PopVlan.class, new OF13PopVlanActionSerializer());
+        helper.registerSerializer(PushMpls.class, new OF13PushMplsActionSerializer());
+        helper.registerSerializer(PopMpls.class, new OF13PopMplsActionSerializer());
+        helper.registerSerializer(SetQueue.class, new OF13SetQueueActionSerializer());
+        helper.registerSerializer(Group.class, new OF13GroupActionSerializer());
+        helper.registerSerializer(SetNwTtl.class, new OF13SetNwTtlActionSerializer());
+        helper.registerSerializer(DecNwTtl.class, new OF13DecNwTtlActionSerializer());
+        helper.registerSerializer(SetField.class, new OF13SetFieldActionSerializer());
+        helper.registerSerializer(PushPbb.class, new OF13PushPbbActionSerializer());
+        helper.registerSerializer(PopPbb.class, new OF13PopPbbActionSerializer());
+    }
 }
\ No newline at end of file
index f60898ed0ac3e4366ee418e7b325417ba4bcea24..46674e52ca276440582aeae0a3a8580eef5307b0 100644 (file)
@@ -1,52 +1,52 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ApplyActionsInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ClearActionsInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.GoToTableInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.MeterInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteActionsInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteMetadataInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionSerializerRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class InstructionsInitializer {\r
-\r
-    private InstructionsInitializer() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * Registers instruction serializers into provided registry\r
-     * @param serializerRegistry registry to be initialized with instruction serializers\r
-     */\r
-    public static void registerInstructionSerializers(SerializerRegistry serializerRegistry) {\r
-        // register OF v1.3 instruction serializers\r
-        InstructionSerializerRegistryHelper helper= new InstructionSerializerRegistryHelper(\r
-                EncodeConstants.OF13_VERSION_ID, serializerRegistry);\r
-        helper.registerSerializer(GotoTable.class, new GoToTableInstructionSerializer());\r
-        helper.registerSerializer(WriteMetadata.class, new WriteMetadataInstructionSerializer());\r
-        helper.registerSerializer(WriteActions.class, new WriteActionsInstructionSerializer());\r
-        helper.registerSerializer(ApplyActions.class, new ApplyActionsInstructionSerializer());\r
-        helper.registerSerializer(ClearActions.class, new ClearActionsInstructionSerializer());\r
-        helper.registerSerializer(Meter.class, new MeterInstructionSerializer());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ApplyActionsInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.ClearActionsInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.GoToTableInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.MeterInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteActionsInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.instruction.WriteMetadataInstructionSerializer;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionSerializerRegistryHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class InstructionsInitializer {
+
+    private InstructionsInitializer() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * Registers instruction serializers into provided registry
+     * @param serializerRegistry registry to be initialized with instruction serializers
+     */
+    public static void registerInstructionSerializers(SerializerRegistry serializerRegistry) {
+        // register OF v1.3 instruction serializers
+        InstructionSerializerRegistryHelper helper= new InstructionSerializerRegistryHelper(
+                EncodeConstants.OF13_VERSION_ID, serializerRegistry);
+        helper.registerSerializer(GotoTable.class, new GoToTableInstructionSerializer());
+        helper.registerSerializer(WriteMetadata.class, new WriteMetadataInstructionSerializer());
+        helper.registerSerializer(WriteActions.class, new WriteActionsInstructionSerializer());
+        helper.registerSerializer(ApplyActions.class, new ApplyActionsInstructionSerializer());
+        helper.registerSerializer(ClearActions.class, new ClearActionsInstructionSerializer());
+        helper.registerSerializer(Meter.class, new MeterInstructionSerializer());
+    }
+}
index 4889fcbd252885553774128e9cf3c44fcd7c941d..884617facbed7c9560ffd5001ec8c11a2869737c 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTcpFlagSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTunnelIpv4DstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTunnelIpv4SrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpOpSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpThaSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpTpaSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthDstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthSrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthTypeSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4CodeSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4TypeSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6CodeSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6TypeSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPhyPortSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPortSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpDscpSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpEcnSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpProtoSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4DstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4SrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6DstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6ExtHdrSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6FlabelSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdSllSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTargetSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTllSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6SrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMetadataSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsBosSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsLabelSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsTcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmPbbIsidSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpDstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpSrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpDstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpSrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTunnelIdSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpDstSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpSrcSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanPcpSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanVidSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.MatchEntrySerializerRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpFlag;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-\r
-/**\r
- * Initializes serializer registry with match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public final class MatchEntriesInitializer {\r
-\r
-    private MatchEntriesInitializer() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * Registers match entry serializers into provided registry\r
-     * @param serializerRegistry registry to be initialized with match entry serializers\r
-     */\r
-    public static void registerMatchEntrySerializers(SerializerRegistry serializerRegistry) {\r
-        // register OF v1.3 OpenflowBasicClass match entry serializers\r
-        Class<OpenflowBasicClass> oxmClass = OpenflowBasicClass.class;\r
-        MatchEntrySerializerRegistryHelper<OpenflowBasicClass> helper =\r
-                new MatchEntrySerializerRegistryHelper<>(EncodeConstants.OF13_VERSION_ID,\r
-                        oxmClass, serializerRegistry);\r
-        helper.registerSerializer(InPort.class, new OxmInPortSerializer());\r
-        helper.registerSerializer(InPhyPort.class, new OxmInPhyPortSerializer());\r
-        helper.registerSerializer(Metadata.class, new OxmMetadataSerializer());\r
-        helper.registerSerializer(EthDst.class, new OxmEthDstSerializer());\r
-        helper.registerSerializer(EthSrc.class, new OxmEthSrcSerializer());\r
-        helper.registerSerializer(EthType.class, new OxmEthTypeSerializer());\r
-        helper.registerSerializer(VlanVid.class, new OxmVlanVidSerializer());\r
-        helper.registerSerializer(VlanPcp.class, new OxmVlanPcpSerializer());\r
-        helper.registerSerializer(IpDscp.class, new OxmIpDscpSerializer());\r
-        helper.registerSerializer(IpEcn.class, new OxmIpEcnSerializer());\r
-        helper.registerSerializer(IpProto.class, new OxmIpProtoSerializer());\r
-        helper.registerSerializer(Ipv4Src.class, new OxmIpv4SrcSerializer());\r
-        helper.registerSerializer(Ipv4Dst.class, new OxmIpv4DstSerializer());\r
-        helper.registerSerializer(TcpSrc.class, new OxmTcpSrcSerializer());\r
-        helper.registerSerializer(TcpDst.class, new OxmTcpDstSerializer());\r
-        helper.registerSerializer(UdpSrc.class, new OxmUdpSrcSerializer());\r
-        helper.registerSerializer(UdpDst.class, new OxmUdpDstSerializer());\r
-        helper.registerSerializer(SctpSrc.class, new OxmSctpSrcSerializer());\r
-        helper.registerSerializer(SctpDst.class, new OxmSctpDstSerializer());\r
-        helper.registerSerializer(Icmpv4Type.class, new OxmIcmpv4TypeSerializer());\r
-        helper.registerSerializer(Icmpv4Code.class, new OxmIcmpv4CodeSerializer());\r
-        helper.registerSerializer(ArpOp.class, new OxmArpOpSerializer());\r
-        helper.registerSerializer(ArpSpa.class, new OxmArpSpaSerializer());\r
-        helper.registerSerializer(ArpTpa.class, new OxmArpTpaSerializer());\r
-        helper.registerSerializer(ArpSha.class, new OxmArpShaSerializer());\r
-        helper.registerSerializer(ArpTha.class, new OxmArpThaSerializer());\r
-        helper.registerSerializer(Ipv6Src.class, new OxmIpv6SrcSerializer());\r
-        helper.registerSerializer(Ipv6Dst.class, new OxmIpv6DstSerializer());\r
-        helper.registerSerializer(Ipv6Flabel.class, new OxmIpv6FlabelSerializer());\r
-        helper.registerSerializer(Icmpv6Type.class, new OxmIcmpv6TypeSerializer());\r
-        helper.registerSerializer(Icmpv6Code.class, new OxmIcmpv6CodeSerializer());\r
-        helper.registerSerializer(Ipv6NdTarget.class, new OxmIpv6NdTargetSerializer());\r
-        helper.registerSerializer(Ipv6NdSll.class, new OxmIpv6NdSllSerializer());\r
-        helper.registerSerializer(Ipv6NdTll.class, new OxmIpv6NdTllSerializer());\r
-        helper.registerSerializer(MplsLabel.class, new OxmMplsLabelSerializer());\r
-        helper.registerSerializer(MplsTc.class, new OxmMplsTcSerializer());\r
-        helper.registerSerializer(MplsBos.class, new OxmMplsBosSerializer());\r
-        helper.registerSerializer(PbbIsid.class, new OxmPbbIsidSerializer());\r
-        helper.registerSerializer(TunnelId.class, new OxmTunnelIdSerializer());\r
-        helper.registerSerializer(Ipv6Exthdr.class, new OxmIpv6ExtHdrSerializer());\r
-\r
-        // Register OpenFlow NXM1Class match entry serializer\r
-        Class<Nxm1Class> nxm1Class = Nxm1Class.class;\r
-        MatchEntrySerializerRegistryHelper<Nxm1Class> nxm1RegistryHelper =\r
-                new MatchEntrySerializerRegistryHelper<>(EncodeConstants.OF13_VERSION_ID,\r
-                        nxm1Class, serializerRegistry);\r
-        nxm1RegistryHelper.registerSerializer(TunnelIpv4Dst.class, new NxmTunnelIpv4DstSerializer());\r
-        nxm1RegistryHelper.registerSerializer(TunnelIpv4Src.class, new NxmTunnelIpv4SrcSerializer());\r
-        nxm1RegistryHelper.registerSerializer(TcpFlag.class, new NxmTcpFlagSerializer());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTcpFlagSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTunnelIpv4DstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTunnelIpv4SrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpOpSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpThaSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpTpaSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthDstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthSrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthTypeSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4CodeSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4TypeSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6CodeSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6TypeSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPhyPortSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPortSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpDscpSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpEcnSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpProtoSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4DstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4SrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6DstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6ExtHdrSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6FlabelSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdSllSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTargetSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTllSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6SrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMetadataSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsBosSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsLabelSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsTcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmPbbIsidSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpDstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpSrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpDstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpSrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTunnelIdSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpDstSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpSrcSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanPcpSerializer;
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanVidSerializer;
+import org.opendaylight.openflowjava.protocol.impl.util.MatchEntrySerializerRegistryHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpFlag;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+
+/**
+ * Initializes serializer registry with match entry serializers
+ * @author michal.polkorab
+ */
+public final class MatchEntriesInitializer {
+
+    private MatchEntriesInitializer() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * Registers match entry serializers into provided registry
+     * @param serializerRegistry registry to be initialized with match entry serializers
+     */
+    public static void registerMatchEntrySerializers(SerializerRegistry serializerRegistry) {
+        // register OF v1.3 OpenflowBasicClass match entry serializers
+        Class<OpenflowBasicClass> oxmClass = OpenflowBasicClass.class;
+        MatchEntrySerializerRegistryHelper<OpenflowBasicClass> helper =
+                new MatchEntrySerializerRegistryHelper<>(EncodeConstants.OF13_VERSION_ID,
+                        oxmClass, serializerRegistry);
+        helper.registerSerializer(InPort.class, new OxmInPortSerializer());
+        helper.registerSerializer(InPhyPort.class, new OxmInPhyPortSerializer());
+        helper.registerSerializer(Metadata.class, new OxmMetadataSerializer());
+        helper.registerSerializer(EthDst.class, new OxmEthDstSerializer());
+        helper.registerSerializer(EthSrc.class, new OxmEthSrcSerializer());
+        helper.registerSerializer(EthType.class, new OxmEthTypeSerializer());
+        helper.registerSerializer(VlanVid.class, new OxmVlanVidSerializer());
+        helper.registerSerializer(VlanPcp.class, new OxmVlanPcpSerializer());
+        helper.registerSerializer(IpDscp.class, new OxmIpDscpSerializer());
+        helper.registerSerializer(IpEcn.class, new OxmIpEcnSerializer());
+        helper.registerSerializer(IpProto.class, new OxmIpProtoSerializer());
+        helper.registerSerializer(Ipv4Src.class, new OxmIpv4SrcSerializer());
+        helper.registerSerializer(Ipv4Dst.class, new OxmIpv4DstSerializer());
+        helper.registerSerializer(TcpSrc.class, new OxmTcpSrcSerializer());
+        helper.registerSerializer(TcpDst.class, new OxmTcpDstSerializer());
+        helper.registerSerializer(UdpSrc.class, new OxmUdpSrcSerializer());
+        helper.registerSerializer(UdpDst.class, new OxmUdpDstSerializer());
+        helper.registerSerializer(SctpSrc.class, new OxmSctpSrcSerializer());
+        helper.registerSerializer(SctpDst.class, new OxmSctpDstSerializer());
+        helper.registerSerializer(Icmpv4Type.class, new OxmIcmpv4TypeSerializer());
+        helper.registerSerializer(Icmpv4Code.class, new OxmIcmpv4CodeSerializer());
+        helper.registerSerializer(ArpOp.class, new OxmArpOpSerializer());
+        helper.registerSerializer(ArpSpa.class, new OxmArpSpaSerializer());
+        helper.registerSerializer(ArpTpa.class, new OxmArpTpaSerializer());
+        helper.registerSerializer(ArpSha.class, new OxmArpShaSerializer());
+        helper.registerSerializer(ArpTha.class, new OxmArpThaSerializer());
+        helper.registerSerializer(Ipv6Src.class, new OxmIpv6SrcSerializer());
+        helper.registerSerializer(Ipv6Dst.class, new OxmIpv6DstSerializer());
+        helper.registerSerializer(Ipv6Flabel.class, new OxmIpv6FlabelSerializer());
+        helper.registerSerializer(Icmpv6Type.class, new OxmIcmpv6TypeSerializer());
+        helper.registerSerializer(Icmpv6Code.class, new OxmIcmpv6CodeSerializer());
+        helper.registerSerializer(Ipv6NdTarget.class, new OxmIpv6NdTargetSerializer());
+        helper.registerSerializer(Ipv6NdSll.class, new OxmIpv6NdSllSerializer());
+        helper.registerSerializer(Ipv6NdTll.class, new OxmIpv6NdTllSerializer());
+        helper.registerSerializer(MplsLabel.class, new OxmMplsLabelSerializer());
+        helper.registerSerializer(MplsTc.class, new OxmMplsTcSerializer());
+        helper.registerSerializer(MplsBos.class, new OxmMplsBosSerializer());
+        helper.registerSerializer(PbbIsid.class, new OxmPbbIsidSerializer());
+        helper.registerSerializer(TunnelId.class, new OxmTunnelIdSerializer());
+        helper.registerSerializer(Ipv6Exthdr.class, new OxmIpv6ExtHdrSerializer());
+
+        // Register OpenFlow NXM1Class match entry serializer
+        Class<Nxm1Class> nxm1Class = Nxm1Class.class;
+        MatchEntrySerializerRegistryHelper<Nxm1Class> nxm1RegistryHelper =
+                new MatchEntrySerializerRegistryHelper<>(EncodeConstants.OF13_VERSION_ID,
+                        nxm1Class, serializerRegistry);
+        nxm1RegistryHelper.registerSerializer(TunnelIpv4Dst.class, new NxmTunnelIpv4DstSerializer());
+        nxm1RegistryHelper.registerSerializer(TunnelIpv4Src.class, new NxmTunnelIpv4SrcSerializer());
+        nxm1RegistryHelper.registerSerializer(TcpFlag.class, new NxmTcpFlagSerializer());
+    }
+}
index 70db90bed8df50a4018fa1666e4d9cab44df99c3..c3610c13fef5188889ac9a39eda51d572a935704 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.BarrierInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.EchoInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.EchoReplyInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.ExperimenterInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.FlowModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetAsyncRequestMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetConfigInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetFeaturesInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetQueueConfigInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GroupModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.HelloInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MeterModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10BarrierInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10FlowModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10HelloInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10PacketOutInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10PortModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10QueueGetConfigInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.PacketOutInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.PortModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.RoleRequestInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.SetAsyncInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.SetConfigMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.TableModInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.CommonMessageRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class MessageFactoryInitializer {\r
-\r
-    private MessageFactoryInitializer() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * Registers message serializers into provided registry\r
-     * @param serializerRegistry registry to be initialized with message serializers\r
-     */\r
-    public static void registerMessageSerializers(SerializerRegistry serializerRegistry) {\r
-        // register OF v1.0 message serializers\r
-        short version = EncodeConstants.OF10_VERSION_ID;\r
-        CommonMessageRegistryHelper registryHelper = new CommonMessageRegistryHelper(version, serializerRegistry);\r
-        registryHelper.registerSerializer(BarrierInput.class, new OF10BarrierInputMessageFactory());\r
-        registryHelper.registerSerializer(EchoInput.class, new EchoInputMessageFactory());\r
-        registryHelper.registerSerializer(EchoReplyInput.class, new EchoReplyInputMessageFactory());\r
-        registryHelper.registerSerializer(ExperimenterInput.class, new ExperimenterInputMessageFactory());\r
-        registryHelper.registerSerializer(FlowModInput.class, new OF10FlowModInputMessageFactory());\r
-        registryHelper.registerSerializer(GetConfigInput.class, new GetConfigInputMessageFactory());\r
-        registryHelper.registerSerializer(GetFeaturesInput.class, new GetFeaturesInputMessageFactory());\r
-        registryHelper.registerSerializer(GetQueueConfigInput.class, new OF10QueueGetConfigInputMessageFactory());\r
-        registryHelper.registerSerializer(HelloInput.class, new OF10HelloInputMessageFactory());\r
-        registryHelper.registerSerializer(MultipartRequestInput.class, new OF10StatsRequestInputFactory());\r
-        registryHelper.registerSerializer(PacketOutInput.class, new OF10PacketOutInputMessageFactory());\r
-        registryHelper.registerSerializer(PortModInput.class, new OF10PortModInputMessageFactory());\r
-        registryHelper.registerSerializer(SetConfigInput.class, new SetConfigMessageFactory());\r
-        // register OF v1.3 message serializers\r
-        version = EncodeConstants.OF13_VERSION_ID;\r
-        registryHelper = new CommonMessageRegistryHelper(version, serializerRegistry);\r
-        registryHelper.registerSerializer(BarrierInput.class, new BarrierInputMessageFactory());\r
-        registryHelper.registerSerializer(EchoInput.class, new EchoInputMessageFactory());\r
-        registryHelper.registerSerializer(EchoReplyInput.class, new EchoReplyInputMessageFactory());\r
-        registryHelper.registerSerializer(ExperimenterInput.class, new ExperimenterInputMessageFactory());\r
-        registryHelper.registerSerializer(FlowModInput.class, new FlowModInputMessageFactory());\r
-        registryHelper.registerSerializer(GetAsyncInput.class, new GetAsyncRequestMessageFactory());\r
-        registryHelper.registerSerializer(GetConfigInput.class, new GetConfigInputMessageFactory());\r
-        registryHelper.registerSerializer(GetFeaturesInput.class, new GetFeaturesInputMessageFactory());\r
-        registryHelper.registerSerializer(GetQueueConfigInput.class, new GetQueueConfigInputMessageFactory());\r
-        registryHelper.registerSerializer(GroupModInput.class, new GroupModInputMessageFactory());\r
-        registryHelper.registerSerializer(HelloInput.class, new HelloInputMessageFactory());\r
-        registryHelper.registerSerializer(MeterModInput.class, new MeterModInputMessageFactory());\r
-        registryHelper.registerSerializer(MultipartRequestInput.class, new MultipartRequestInputFactory());\r
-        registryHelper.registerSerializer(PacketOutInput.class, new PacketOutInputMessageFactory());\r
-        registryHelper.registerSerializer(PortModInput.class, new PortModInputMessageFactory());\r
-        registryHelper.registerSerializer(RoleRequestInput.class, new RoleRequestInputMessageFactory());\r
-        registryHelper.registerSerializer(SetAsyncInput.class, new SetAsyncInputMessageFactory());\r
-        registryHelper.registerSerializer( SetConfigInput.class, new SetConfigMessageFactory());\r
-        registryHelper.registerSerializer(TableModInput.class, new TableModInputMessageFactory());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.BarrierInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.EchoInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.EchoReplyInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.ExperimenterInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.FlowModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetAsyncRequestMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetConfigInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetFeaturesInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GetQueueConfigInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.GroupModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.HelloInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MeterModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10BarrierInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10FlowModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10HelloInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10PacketOutInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10PortModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10QueueGetConfigInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.PacketOutInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.PortModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.RoleRequestInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.SetAsyncInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.SetConfigMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.TableModInputMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.CommonMessageRegistryHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class MessageFactoryInitializer {
+
+    private MessageFactoryInitializer() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * Registers message serializers into provided registry
+     * @param serializerRegistry registry to be initialized with message serializers
+     */
+    public static void registerMessageSerializers(SerializerRegistry serializerRegistry) {
+        // register OF v1.0 message serializers
+        short version = EncodeConstants.OF10_VERSION_ID;
+        CommonMessageRegistryHelper registryHelper = new CommonMessageRegistryHelper(version, serializerRegistry);
+        registryHelper.registerSerializer(BarrierInput.class, new OF10BarrierInputMessageFactory());
+        registryHelper.registerSerializer(EchoInput.class, new EchoInputMessageFactory());
+        registryHelper.registerSerializer(EchoReplyInput.class, new EchoReplyInputMessageFactory());
+        registryHelper.registerSerializer(ExperimenterInput.class, new ExperimenterInputMessageFactory());
+        registryHelper.registerSerializer(FlowModInput.class, new OF10FlowModInputMessageFactory());
+        registryHelper.registerSerializer(GetConfigInput.class, new GetConfigInputMessageFactory());
+        registryHelper.registerSerializer(GetFeaturesInput.class, new GetFeaturesInputMessageFactory());
+        registryHelper.registerSerializer(GetQueueConfigInput.class, new OF10QueueGetConfigInputMessageFactory());
+        registryHelper.registerSerializer(HelloInput.class, new OF10HelloInputMessageFactory());
+        registryHelper.registerSerializer(MultipartRequestInput.class, new OF10StatsRequestInputFactory());
+        registryHelper.registerSerializer(PacketOutInput.class, new OF10PacketOutInputMessageFactory());
+        registryHelper.registerSerializer(PortModInput.class, new OF10PortModInputMessageFactory());
+        registryHelper.registerSerializer(SetConfigInput.class, new SetConfigMessageFactory());
+        // register OF v1.3 message serializers
+        version = EncodeConstants.OF13_VERSION_ID;
+        registryHelper = new CommonMessageRegistryHelper(version, serializerRegistry);
+        registryHelper.registerSerializer(BarrierInput.class, new BarrierInputMessageFactory());
+        registryHelper.registerSerializer(EchoInput.class, new EchoInputMessageFactory());
+        registryHelper.registerSerializer(EchoReplyInput.class, new EchoReplyInputMessageFactory());
+        registryHelper.registerSerializer(ExperimenterInput.class, new ExperimenterInputMessageFactory());
+        registryHelper.registerSerializer(FlowModInput.class, new FlowModInputMessageFactory());
+        registryHelper.registerSerializer(GetAsyncInput.class, new GetAsyncRequestMessageFactory());
+        registryHelper.registerSerializer(GetConfigInput.class, new GetConfigInputMessageFactory());
+        registryHelper.registerSerializer(GetFeaturesInput.class, new GetFeaturesInputMessageFactory());
+        registryHelper.registerSerializer(GetQueueConfigInput.class, new GetQueueConfigInputMessageFactory());
+        registryHelper.registerSerializer(GroupModInput.class, new GroupModInputMessageFactory());
+        registryHelper.registerSerializer(HelloInput.class, new HelloInputMessageFactory());
+        registryHelper.registerSerializer(MeterModInput.class, new MeterModInputMessageFactory());
+        registryHelper.registerSerializer(MultipartRequestInput.class, new MultipartRequestInputFactory());
+        registryHelper.registerSerializer(PacketOutInput.class, new PacketOutInputMessageFactory());
+        registryHelper.registerSerializer(PortModInput.class, new PortModInputMessageFactory());
+        registryHelper.registerSerializer(RoleRequestInput.class, new RoleRequestInputMessageFactory());
+        registryHelper.registerSerializer(SetAsyncInput.class, new SetAsyncInputMessageFactory());
+        registryHelper.registerSerializer( SetConfigInput.class, new SetConfigMessageFactory());
+        registryHelper.registerSerializer(TableModInput.class, new TableModInputMessageFactory());
+    }
+}
index 8babf5721ab997a2509d17d33027f38af78e5048..0ab4415902e0764620f95c1becd43fc0caab46d2 100644 (file)
@@ -1,47 +1,47 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractActionSerializer implements OFSerializer<Action>,\r
-        HeaderSerializer<Action>{\r
-\r
-    @Override\r
-    public void serialize(Action input, ByteBuf outBuffer) {\r
-        outBuffer.writeShort(getType());\r
-        outBuffer.writeShort(getLength());\r
-    }\r
-\r
-    @Override\r
-    public void serializeHeader(Action input, ByteBuf outBuffer) {\r
-        outBuffer.writeShort(getType());\r
-        outBuffer.writeShort(ActionConstants.ACTION_IDS_LENGTH);\r
-    }\r
-\r
-    /**\r
-     * @return numeric representation of action type\r
-     */\r
-    protected abstract int getType();\r
-\r
-    /**\r
-     * @return action length\r
-     */\r
-    protected abstract int getLength();\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractActionSerializer implements OFSerializer<Action>,
+        HeaderSerializer<Action>{
+
+    @Override
+    public void serialize(Action input, ByteBuf outBuffer) {
+        outBuffer.writeShort(getType());
+        outBuffer.writeShort(getLength());
+    }
+
+    @Override
+    public void serializeHeader(Action input, ByteBuf outBuffer) {
+        outBuffer.writeShort(getType());
+        outBuffer.writeShort(ActionConstants.ACTION_IDS_LENGTH);
+    }
+
+    /**
+     * @return numeric representation of action type
+     */
+    protected abstract int getType();
+
+    /**
+     * @return action length
+     */
+    protected abstract int getLength();
+
+}
index 9c4117a4b6cc8c392e4dd5294f269968b0f45046..33858e336e46f04ac4acbca5acdd020390e8ed69 100644 (file)
@@ -1,35 +1,35 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractEthertypeActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        EthertypeAction ethertype = action.getAugmentation(EthertypeAction.class);\r
-        outBuffer.writeShort(ethertype.getEthertype().getValue());\r
-        outBuffer.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractEthertypeActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        EthertypeAction ethertype = action.getAugmentation(EthertypeAction.class);
+        outBuffer.writeShort(ethertype.getEthertype().getValue());
+        outBuffer.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+}
index aa82f49ef051a1519237db3267e6cef0dfffba52..335d19e498d9e0cea10879157dd558bc5d28e06c 100644 (file)
@@ -1,32 +1,32 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractHeaderActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        outBuffer.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractHeaderActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        outBuffer.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+}
index d7bf73aa6db140e2a6aa87599da85394937dadfa..fd7c4b5f158cc4526dccf4544ba75e94a83e4981 100644 (file)
@@ -1,32 +1,32 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractIpAddressActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(final Action action, final ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        Iterable<String> addressGroups = ByteBufUtils.DOT_SPLITTER\r
-                .split(action.getAugmentation(IpAddressAction.class).getIpAddress().getValue());\r
-        for (String group : addressGroups) {\r
-            outBuffer.writeByte(Short.parseShort(group));\r
-        }\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractIpAddressActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(final Action action, final ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        Iterable<String> addressGroups = ByteBufUtils.DOT_SPLITTER
+                .split(action.getAugmentation(IpAddressAction.class).getIpAddress().getValue());
+        for (String group : addressGroups) {
+            outBuffer.writeByte(Short.parseShort(group));
+        }
+    }
+}
index f8c4735245a9af980a910b0637082f36ab5c07dc..770d1892b463d83b29418b564739e0e6b6dcdf29 100644 (file)
@@ -1,32 +1,32 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractMacAddressActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        outBuffer.writeBytes(ByteBufUtils.macAddressToBytes(action\r
-                .getAugmentation(DlAddressAction.class).getDlAddress().getValue()));\r
-        outBuffer.writeZero(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION);\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractMacAddressActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        outBuffer.writeBytes(ByteBufUtils.macAddressToBytes(action
+                .getAugmentation(DlAddressAction.class).getDlAddress().getValue()));
+        outBuffer.writeZero(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION);
+    }
+
+}
index a02df47ea07697f9d943313f4a365535477fb025..194669a8d8c3a4a340fc724e92af46b6a5806055 100644 (file)
@@ -1,30 +1,30 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class OF10AbstractPortActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        PortAction port = action.getAugmentation(PortAction.class);\r
-        outBuffer.writeShort(port.getPort().getValue().intValue());\r
-        outBuffer.writeZero(ActionConstants.PADDING_IN_TP_PORT_ACTION);\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class OF10AbstractPortActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        PortAction port = action.getAugmentation(PortAction.class);
+        outBuffer.writeShort(port.getPort().getValue().intValue());
+        outBuffer.writeZero(ActionConstants.PADDING_IN_TP_PORT_ACTION);
+    }
+}
index dfc797683f1e2a87c666058560e9cd16013bc6b7..59ec7d61a41b3e1e375dd36568240f22d6c8c092 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10EnqueueActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        PortAction port = action.getAugmentation(PortAction.class);\r
-        outBuffer.writeShort(port.getPort().getValue().intValue());\r
-        outBuffer.writeZero(ActionConstants.PADDING_IN_ENQUEUE_ACTION);\r
-        QueueIdAction queueId = action.getAugmentation(QueueIdAction.class);\r
-        outBuffer.writeInt(queueId.getQueueId().intValue());\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.ENQUEUE_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.LARGER_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10EnqueueActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        PortAction port = action.getAugmentation(PortAction.class);
+        outBuffer.writeShort(port.getPort().getValue().intValue());
+        outBuffer.writeZero(ActionConstants.PADDING_IN_ENQUEUE_ACTION);
+        QueueIdAction queueId = action.getAugmentation(QueueIdAction.class);
+        outBuffer.writeInt(queueId.getQueueId().intValue());
+    }
+
+    @Override
+    protected int getType() {
+        return ActionConstants.ENQUEUE_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.LARGER_ACTION_LENGTH;
+    }
+
+}
index b6231cd4d9c5ab38d57578ae9f1b243836d516b9..38e45587822ce439b0a49013f53ed09fbf426777 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10OutputActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        PortAction port = action.getAugmentation(PortAction.class);\r
-        outBuffer.writeShort(port.getPort().getValue().intValue());\r
-        MaxLengthAction maxlength = action.getAugmentation(MaxLengthAction.class);\r
-        outBuffer.writeShort(maxlength.getMaxLength());\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.OUTPUT_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10OutputActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        PortAction port = action.getAugmentation(PortAction.class);
+        outBuffer.writeShort(port.getPort().getValue().intValue());
+        MaxLengthAction maxlength = action.getAugmentation(MaxLengthAction.class);
+        outBuffer.writeShort(maxlength.getMaxLength());
+    }
+
+    @Override
+    protected int getType() {
+        return ActionConstants.OUTPUT_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+
+}
index 2e013323527037ea7e557258dab06d37c0e84f70..b174b0f92f2bf72ec18d335f6e995c844c57efca 100644 (file)
@@ -1,29 +1,29 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetDlDstActionSerializer extends OF10AbstractMacAddressActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_DL_DST_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.LARGER_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetDlDstActionSerializer extends OF10AbstractMacAddressActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_DL_DST_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.LARGER_ACTION_LENGTH;
+    }
+
+}
index 623767c7eca6207c1e9497542d3faa8942cacdd7..e9f002da517ab9292272aeca2fcd12f32fef9f10 100644 (file)
@@ -1,29 +1,29 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetDlSrcActionSerializer extends OF10AbstractMacAddressActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_DL_SRC_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.LARGER_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetDlSrcActionSerializer extends OF10AbstractMacAddressActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_DL_SRC_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.LARGER_ACTION_LENGTH;
+    }
+
+}
index 35a85611a2b2771bffa508ab1d7aa90d8ddaeb06..2494ced3fcfdd3a32acbcfd0da94627f82e9fc11 100644 (file)
@@ -1,29 +1,29 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwDstActionSerializer extends OF10AbstractIpAddressActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_NW_DST_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwDstActionSerializer extends OF10AbstractIpAddressActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_NW_DST_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+
+}
index c4f259a73852845650baa993aa6065f74bb57e62..b708b163b84d6588e36e000d2155de21a7638009 100644 (file)
@@ -1,27 +1,27 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwSrcActionSerializer extends OF10AbstractIpAddressActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_NW_SRC_CODE;\r
-    }\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwSrcActionSerializer extends OF10AbstractIpAddressActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_NW_SRC_CODE;
+    }
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+}
index 0d668248898d86159fbd99d49d3ba64ce3834780..c75335c2f967f719325bd2f73479027fc380dde0 100644 (file)
@@ -1,40 +1,40 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetNwTosActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        outBuffer.writeByte(action.getAugmentation(NwTosAction.class).getNwTos());\r
-        outBuffer.writeZero(ActionConstants.PADDING_IN_SET_NW_TOS_ACTION);\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_NW_TOS_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetNwTosActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        outBuffer.writeByte(action.getAugmentation(NwTosAction.class).getNwTos());
+        outBuffer.writeZero(ActionConstants.PADDING_IN_SET_NW_TOS_ACTION);
+    }
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_NW_TOS_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+
+}
index 3000de797a9d6e69a9541d6d7649a8f90838dbd7..929db82b87a1285d4cc7f4468376893e7a733db8 100644 (file)
@@ -1,29 +1,29 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetTpDstActionSerializer extends OF10AbstractPortActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_TP_DST_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetTpDstActionSerializer extends OF10AbstractPortActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_TP_DST_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+
+}
index 0280145c2b8db47a8ab573dcdea6989bfadaf8c1..7c062eaef3b6117ebd66ad678c93661875140b4a 100644 (file)
@@ -1,29 +1,29 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetTpSrcActionSerializer extends OF10AbstractPortActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_TP_SRC_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetTpSrcActionSerializer extends OF10AbstractPortActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_TP_SRC_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+
+}
index 29fdafe0072cb473a8a2075fc04923582a884ec4..973d026c725b9f81338aee23ed102b9d46f25cf9 100644 (file)
@@ -1,40 +1,40 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetVlanPcpActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        outBuffer.writeByte(action.getAugmentation(VlanPcpAction.class).getVlanPcp());\r
-        outBuffer.writeZero(ActionConstants.PADDING_IN_SET_VLAN_PCP_ACTION);\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_VLAN_PCP_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetVlanPcpActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        outBuffer.writeByte(action.getAugmentation(VlanPcpAction.class).getVlanPcp());
+        outBuffer.writeZero(ActionConstants.PADDING_IN_SET_VLAN_PCP_ACTION);
+    }
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_VLAN_PCP_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+
+}
index e788f8d49504de60f1c69c40e60563a596303ceb..afe000c9f3a245bb085b68ea7a3c6de48a57cca1 100644 (file)
@@ -1,40 +1,40 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10SetVlanVidActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        outBuffer.writeShort(action.getAugmentation(VlanVidAction.class).getVlanVid());\r
-        outBuffer.writeZero(ActionConstants.PADDING_IN_SET_VLAN_VID_ACTION);\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_VLAN_VID_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10SetVlanVidActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        outBuffer.writeShort(action.getAugmentation(VlanVidAction.class).getVlanVid());
+        outBuffer.writeZero(ActionConstants.PADDING_IN_SET_VLAN_VID_ACTION);
+    }
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_VLAN_VID_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+
+}
index 4bfc2c16db5a9f60c40d733c494f69a14fceba26..d3903233a87707883e6a0ff889a19156565c08d1 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10StripVlanActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.STRIP_VLAN_CODE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10StripVlanActionSerializer extends AbstractHeaderActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.STRIP_VLAN_CODE;
+    }
+
+}
index 69d70e59c3a6ed954603d25c5457561bc0dd5c64..59020cd1493a4b9c4592ed7bfb78d6810193b3e1 100644 (file)
@@ -1,24 +1,24 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13CopyTtlInActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.COPY_TTL_IN_CODE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13CopyTtlInActionSerializer extends AbstractHeaderActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.COPY_TTL_IN_CODE;
+    }
+
+}
index a5b3059a0f953ee03620ced65a69aa4e1c4434f1..da6cf05870f2d3473b6413f01a34f36c1e584c6f 100644 (file)
@@ -1,24 +1,24 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13CopyTtlOutActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.COPY_TTL_OUT_CODE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13CopyTtlOutActionSerializer extends AbstractHeaderActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.COPY_TTL_OUT_CODE;
+    }
+
+}
index 9f6f741b2ccfe70611282171427ecdff0a4bf152..6d7be2776962fa5ef9e9e7da39c8cb37e1c4173d 100644 (file)
@@ -1,24 +1,24 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13DecMplsTtlActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.DEC_MPLS_TTL_CODE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13DecMplsTtlActionSerializer extends AbstractHeaderActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.DEC_MPLS_TTL_CODE;
+    }
+
+}
index f1610b76e8181252502e9e04bd1c41c4547c6349..d1f4436971cb80ca46fe0fb764575ee6435c6d0b 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13DecNwTtlActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.DEC_NW_TTL_CODE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13DecNwTtlActionSerializer extends AbstractHeaderActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.DEC_NW_TTL_CODE;
+    }
+
+}
index a36fa55451adb3cdc7215809b52aaa02ad0d880a..6e87760a0b50ba096f9a07147590090f8edbd08c 100644 (file)
@@ -1,40 +1,40 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13GroupActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        GroupIdAction groupId = action.getAugmentation(GroupIdAction.class);\r
-        outBuffer.writeInt(groupId.getGroupId().intValue());\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.GROUP_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13GroupActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        GroupIdAction groupId = action.getAugmentation(GroupIdAction.class);
+        outBuffer.writeInt(groupId.getGroupId().intValue());
+    }
+
+    @Override
+    protected int getType() {
+        return ActionConstants.GROUP_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+
+}
index 2ac79f7dc1985302d90de1ae3c5713a497efe82a..0b6c56586612ec54df7949ae46d9ef8315c7110c 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13OutputActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        PortAction port = action.getAugmentation(PortAction.class);\r
-        outBuffer.writeInt(port.getPort().getValue().intValue());\r
-        MaxLengthAction maxlength = action.getAugmentation(MaxLengthAction.class);\r
-        outBuffer.writeShort(maxlength.getMaxLength());\r
-        outBuffer.writeZero(ActionConstants.OUTPUT_PADDING);\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.OUTPUT_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.LARGER_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13OutputActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        PortAction port = action.getAugmentation(PortAction.class);
+        outBuffer.writeInt(port.getPort().getValue().intValue());
+        MaxLengthAction maxlength = action.getAugmentation(MaxLengthAction.class);
+        outBuffer.writeShort(maxlength.getMaxLength());
+        outBuffer.writeZero(ActionConstants.OUTPUT_PADDING);
+    }
+
+    @Override
+    protected int getType() {
+        return ActionConstants.OUTPUT_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.LARGER_ACTION_LENGTH;
+    }
+
+}
index bd3fac22f3159f6812c48daefc2d0cf2d2fe6253..2857b4a00c9e0e6a874e9487e773fbde545ed978 100644 (file)
@@ -1,24 +1,24 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopMplsActionSerializer extends AbstractEthertypeActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.POP_MPLS_CODE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopMplsActionSerializer extends AbstractEthertypeActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.POP_MPLS_CODE;
+    }
+
+}
index ecf8bea51e0a81bcda9deac0b18e92f473aa3ced..8187f226f6565344695128b123b77f4f6b8b2381 100644 (file)
@@ -1,24 +1,24 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopPbbActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.POP_PBB_CODE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopPbbActionSerializer extends AbstractHeaderActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.POP_PBB_CODE;
+    }
+
+}
index 960e5fb3dd125ef38a86b7c85506c6459dc563fe..39ffd1a57fb557ad667a972748ea9eba27eadcfd 100644 (file)
@@ -1,24 +1,24 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PopVlanActionSerializer extends AbstractHeaderActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.POP_VLAN_CODE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PopVlanActionSerializer extends AbstractHeaderActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.POP_VLAN_CODE;
+    }
+
+}
index ca992eecf4e0716c0af460ba3431f955d4f54fbc..8c2bd764beb03fbd09e1d0c0085cca1cc4b2b2ce 100644 (file)
@@ -1,24 +1,24 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushMplsActionSerializer extends AbstractEthertypeActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.PUSH_MPLS_CODE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushMplsActionSerializer extends AbstractEthertypeActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.PUSH_MPLS_CODE;
+    }
+
+}
index 746c2b4e894b7386bdc9952bfb9ad9fe6c5534d1..732a73cf12465092dbcc3c52f9111be2ac244b51 100644 (file)
@@ -1,24 +1,24 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushPbbActionSerializer extends AbstractEthertypeActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.PUSH_PBB_CODE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushPbbActionSerializer extends AbstractEthertypeActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.PUSH_PBB_CODE;
+    }
+
+}
index 71795ec67d0037714f57ed7a6462bf1c07d64e5c..1dedb85bc2a2330490f3dcd212e74df0d054d827 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13PushVlanActionSerializer extends AbstractEthertypeActionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.PUSH_VLAN_CODE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13PushVlanActionSerializer extends AbstractEthertypeActionSerializer {
+
+    @Override
+    protected int getType() {
+        return ActionConstants.PUSH_VLAN_CODE;
+    }
+
+}
index 6b56fd09f687c4b048fef3f56ea8bfd9731c1d01..65eefec9de5d1ae19bd5ad014877b10423d7f63c 100644 (file)
@@ -1,71 +1,71 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetFieldActionSerializer implements OFSerializer<Action>,\r
-        HeaderSerializer<Action>, SerializerRegistryInjector {\r
-\r
-    private SerializerRegistry registry;\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        int startIndex = outBuffer.writerIndex();\r
-        outBuffer.writeShort(ActionConstants.SET_FIELD_CODE);\r
-        int lengthIndex = outBuffer.writerIndex();\r
-        outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
-        OxmFieldsAction oxmField = action.getAugmentation(OxmFieldsAction.class);\r
-        MatchEntries entry = oxmField.getMatchEntries().get(0);\r
-        MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(\r
-                EncodeConstants.OF13_VERSION_ID, entry.getOxmClass(), entry.getOxmMatchField());\r
-        if (entry.getOxmClass().equals(ExperimenterClass.class)) {\r
-            key.setExperimenterId(entry.getAugmentation(ExperimenterIdMatchEntry.class)\r
-                    .getExperimenter().getValue());\r
-        } else {\r
-            key.setExperimenterId(null);\r
-        }\r
-        OFSerializer<MatchEntries> serializer = registry.getSerializer(key);\r
-        serializer.serialize(entry, outBuffer);\r
-        int paddingRemainder = (outBuffer.writerIndex() - startIndex) % EncodeConstants.PADDING;\r
-        if (paddingRemainder != 0) {\r
-            outBuffer.writeZero(EncodeConstants.PADDING - paddingRemainder);\r
-        }\r
-        outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);\r
-    }\r
-\r
-    @Override\r
-    public void serializeHeader(Action input, ByteBuf outBuffer) {\r
-        outBuffer.writeShort(ActionConstants.SET_FIELD_CODE);\r
-        outBuffer.writeShort(ActionConstants.ACTION_IDS_LENGTH);\r
-    }\r
-\r
-    @Override\r
-    public void injectSerializerRegistry(SerializerRegistry serializerRegistry) {\r
-        registry = serializerRegistry;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetFieldActionSerializer implements OFSerializer<Action>,
+        HeaderSerializer<Action>, SerializerRegistryInjector {
+
+    private SerializerRegistry registry;
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        int startIndex = outBuffer.writerIndex();
+        outBuffer.writeShort(ActionConstants.SET_FIELD_CODE);
+        int lengthIndex = outBuffer.writerIndex();
+        outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
+        OxmFieldsAction oxmField = action.getAugmentation(OxmFieldsAction.class);
+        MatchEntries entry = oxmField.getMatchEntries().get(0);
+        MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(
+                EncodeConstants.OF13_VERSION_ID, entry.getOxmClass(), entry.getOxmMatchField());
+        if (entry.getOxmClass().equals(ExperimenterClass.class)) {
+            key.setExperimenterId(entry.getAugmentation(ExperimenterIdMatchEntry.class)
+                    .getExperimenter().getValue());
+        } else {
+            key.setExperimenterId(null);
+        }
+        OFSerializer<MatchEntries> serializer = registry.getSerializer(key);
+        serializer.serialize(entry, outBuffer);
+        int paddingRemainder = (outBuffer.writerIndex() - startIndex) % EncodeConstants.PADDING;
+        if (paddingRemainder != 0) {
+            outBuffer.writeZero(EncodeConstants.PADDING - paddingRemainder);
+        }
+        outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);
+    }
+
+    @Override
+    public void serializeHeader(Action input, ByteBuf outBuffer) {
+        outBuffer.writeShort(ActionConstants.SET_FIELD_CODE);
+        outBuffer.writeShort(ActionConstants.ACTION_IDS_LENGTH);
+    }
+
+    @Override
+    public void injectSerializerRegistry(SerializerRegistry serializerRegistry) {
+        registry = serializerRegistry;
+    }
+
+}
index 480bc931d65a901790cf540985f7aef34ae0921b..aacebf2f7c83b05f8a62ddbacb8a43fc703c4613 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetMplsTtlActionSerializer extends AbstractActionSerializer {\r
-\r
-\r
-    \r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        MplsTtlAction mplsTtl = action.getAugmentation(MplsTtlAction.class);\r
-        outBuffer.writeByte(mplsTtl.getMplsTtl());\r
-        outBuffer.writeZero(ActionConstants.SET_MPLS_TTL_PADDING);\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_MPLS_TTL_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetMplsTtlActionSerializer extends AbstractActionSerializer {
+
+
+    
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        MplsTtlAction mplsTtl = action.getAugmentation(MplsTtlAction.class);
+        outBuffer.writeByte(mplsTtl.getMplsTtl());
+        outBuffer.writeZero(ActionConstants.SET_MPLS_TTL_PADDING);
+    }
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_MPLS_TTL_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+
+}
index b30cf5d5e3a293f85012a3b71d1389f990e7d70c..70796dc50406a3522ce480c78f4db38448a6b8c5 100644 (file)
@@ -1,41 +1,41 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetNwTtlActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        NwTtlAction nwTtl = action.getAugmentation(NwTtlAction.class);\r
-        outBuffer.writeByte(nwTtl.getNwTtl());\r
-        outBuffer.writeZero(ActionConstants.SET_NW_TTL_PADDING);\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_NW_TTL_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetNwTtlActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        NwTtlAction nwTtl = action.getAugmentation(NwTtlAction.class);
+        outBuffer.writeByte(nwTtl.getNwTtl());
+        outBuffer.writeZero(ActionConstants.SET_NW_TTL_PADDING);
+    }
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_NW_TTL_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+
+}
index c11d14fb670e12099c9e140d3ccbaa3f287064f1..4586b926f8c2584bb5012ea03cd6acf5be2a94cd 100644 (file)
@@ -1,40 +1,40 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.action;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13SetQueueActionSerializer extends AbstractActionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Action action, ByteBuf outBuffer) {\r
-        super.serialize(action, outBuffer);\r
-        QueueIdAction queueId = action.getAugmentation(QueueIdAction.class);\r
-        outBuffer.writeInt(queueId.getQueueId().intValue());\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return ActionConstants.SET_QUEUE_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getLength() {\r
-        return ActionConstants.GENERAL_ACTION_LENGTH;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.action;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13SetQueueActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        QueueIdAction queueId = action.getAugmentation(QueueIdAction.class);
+        outBuffer.writeInt(queueId.getQueueId().intValue());
+    }
+
+    @Override
+    protected int getType() {
+        return ActionConstants.SET_QUEUE_CODE;
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
+
+}
index 4b381d3b9c086343317f841522a1f3c91c6ae1a6..217fb120c33188e642ac23c3ba22a0f89179f7d9 100644 (file)
@@ -1,64 +1,64 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMaker;\r
-import org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMakerFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ListSerializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractActionInstructionSerializer extends AbstractInstructionSerializer\r
-        implements SerializerRegistryInjector {\r
-\r
-    private static final TypeKeyMaker<Action> ACTION_KEY_MAKER =\r
-            TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-\r
-    private SerializerRegistry registry;\r
-\r
-    @Override\r
-    public void serialize(final Instruction instruction, final ByteBuf outBuffer) {\r
-        int startIndex = outBuffer.writerIndex();\r
-        outBuffer.writeShort(getType());\r
-        if (instruction.getAugmentation(ActionsInstruction.class) != null) {\r
-            List<Action> actions = instruction.getAugmentation(ActionsInstruction.class).getAction();\r
-            int lengthIndex = outBuffer.writerIndex();\r
-            outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
-            outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);\r
-            ListSerializer.serializeList(actions, ACTION_KEY_MAKER, getRegistry(), outBuffer);\r
-            int instructionLength = outBuffer.writerIndex() - startIndex;\r
-            outBuffer.setShort(lengthIndex, instructionLength);\r
-        } else {\r
-            outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);\r
-            outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);\r
-        }\r
-    }\r
-\r
-    protected SerializerRegistry getRegistry() {\r
-        return registry;\r
-    }\r
-\r
-    @Override\r
-    public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {\r
-        registry = serializerRegistry;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMaker;
+import org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMakerFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.ListSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractActionInstructionSerializer extends AbstractInstructionSerializer
+        implements SerializerRegistryInjector {
+
+    private static final TypeKeyMaker<Action> ACTION_KEY_MAKER =
+            TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+
+    private SerializerRegistry registry;
+
+    @Override
+    public void serialize(final Instruction instruction, final ByteBuf outBuffer) {
+        int startIndex = outBuffer.writerIndex();
+        outBuffer.writeShort(getType());
+        if (instruction.getAugmentation(ActionsInstruction.class) != null) {
+            List<Action> actions = instruction.getAugmentation(ActionsInstruction.class).getAction();
+            int lengthIndex = outBuffer.writerIndex();
+            outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
+            outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
+            ListSerializer.serializeList(actions, ACTION_KEY_MAKER, getRegistry(), outBuffer);
+            int instructionLength = outBuffer.writerIndex() - startIndex;
+            outBuffer.setShort(lengthIndex, instructionLength);
+        } else {
+            outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);
+            outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
+        }
+    }
+
+    protected SerializerRegistry getRegistry() {
+        return registry;
+    }
+
+    @Override
+    public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+        registry = serializerRegistry;
+    }
+}
index f672016e8b85d5412c9299795d2c6aed679a2c22..c5d3331733c5841c98d360be6b8118311a2939ef 100644 (file)
@@ -1,36 +1,36 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class AbstractInstructionSerializer implements OFSerializer<Instruction>,\r
-        HeaderSerializer<Instruction> {\r
-\r
-    @Override\r
-    public void serializeHeader(Instruction input, ByteBuf outBuffer) {\r
-        outBuffer.writeShort(getType());\r
-        outBuffer.writeShort(InstructionConstants.INSTRUCTION_IDS_LENGTH);\r
-    }\r
-\r
-    /**\r
-     * @return numeric representation of action type\r
-     */\r
-    protected abstract int getType();\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class AbstractInstructionSerializer implements OFSerializer<Instruction>,
+        HeaderSerializer<Instruction> {
+
+    @Override
+    public void serializeHeader(Instruction input, ByteBuf outBuffer) {
+        outBuffer.writeShort(getType());
+        outBuffer.writeShort(InstructionConstants.INSTRUCTION_IDS_LENGTH);
+    }
+
+    /**
+     * @return numeric representation of action type
+     */
+    protected abstract int getType();
+
+}
index f2f4c27139e3969f9200a4c1b36a77d4304e2b3a..2aaae19ba71ca4442d7fe9811d29286b5278d4b8 100644 (file)
@@ -1,24 +1,24 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ApplyActionsInstructionSerializer extends AbstractActionInstructionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return InstructionConstants.APPLY_ACTIONS_TYPE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ApplyActionsInstructionSerializer extends AbstractActionInstructionSerializer {
+
+    @Override
+    protected int getType() {
+        return InstructionConstants.APPLY_ACTIONS_TYPE;
+    }
+
+}
index 85e27d234933d0008c243c588a3aa6d4d1fc13e5..00162502e9b530b6305df73f02890ca4f46a0899 100644 (file)
@@ -1,24 +1,24 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ClearActionsInstructionSerializer extends AbstractActionInstructionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return InstructionConstants.CLEAR_ACTIONS_TYPE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ClearActionsInstructionSerializer extends AbstractActionInstructionSerializer {
+
+    @Override
+    protected int getType() {
+        return InstructionConstants.CLEAR_ACTIONS_TYPE;
+    }
+
+}
index 3c65edffacd49fc9047f8dc10a71af32034809f3..9e18a12f29d1a3148449eecd22f700e7ebd375a3 100644 (file)
@@ -1,36 +1,36 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class GoToTableInstructionSerializer extends AbstractInstructionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Instruction instruction, ByteBuf outBuffer) {\r
-        outBuffer.writeShort(getType());\r
-        outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);\r
-        outBuffer.writeByte(instruction.getAugmentation(TableIdInstruction.class).getTableId());\r
-        outBuffer.writeZero(InstructionConstants.PADDING_IN_GOTO_TABLE);\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return InstructionConstants.GOTO_TABLE_TYPE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class GoToTableInstructionSerializer extends AbstractInstructionSerializer {
+
+    @Override
+    public void serialize(Instruction instruction, ByteBuf outBuffer) {
+        outBuffer.writeShort(getType());
+        outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);
+        outBuffer.writeByte(instruction.getAugmentation(TableIdInstruction.class).getTableId());
+        outBuffer.writeZero(InstructionConstants.PADDING_IN_GOTO_TABLE);
+    }
+
+    @Override
+    protected int getType() {
+        return InstructionConstants.GOTO_TABLE_TYPE;
+    }
+
+}
index c171f50f1352351ca4df5cdd3d951ae2516b47c7..5a8f5ab8115363adce0772375c9185d631557673 100644 (file)
@@ -1,36 +1,36 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MeterInstructionSerializer extends AbstractInstructionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Instruction instruction, ByteBuf outBuffer) {\r
-        outBuffer.writeShort(getType());\r
-        outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);\r
-        outBuffer.writeInt(instruction.\r
-                getAugmentation(MeterIdInstruction.class).getMeterId().intValue());\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return InstructionConstants.METER_TYPE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MeterInstructionSerializer extends AbstractInstructionSerializer {
+
+    @Override
+    public void serialize(Instruction instruction, ByteBuf outBuffer) {
+        outBuffer.writeShort(getType());
+        outBuffer.writeShort(InstructionConstants.STANDARD_INSTRUCTION_LENGTH);
+        outBuffer.writeInt(instruction.
+                getAugmentation(MeterIdInstruction.class).getMeterId().intValue());
+    }
+
+    @Override
+    protected int getType() {
+        return InstructionConstants.METER_TYPE;
+    }
+
+}
index f4de32c4133f625b972e8196fcf008ef954044cd..10e20504a4cd2ff643eaa75f6358b2fd98b2be91 100644 (file)
@@ -1,24 +1,24 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class WriteActionsInstructionSerializer extends AbstractActionInstructionSerializer {\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return InstructionConstants.WRITE_ACTIONS_TYPE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class WriteActionsInstructionSerializer extends AbstractActionInstructionSerializer {
+
+    @Override
+    protected int getType() {
+        return InstructionConstants.WRITE_ACTIONS_TYPE;
+    }
+
+}
index 6c16ea39ffff02d25e3ae26ec1dc39567417437f..43d3e27ab9d9cc040941bc7dc86784cc31c71407 100644 (file)
@@ -1,38 +1,38 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class WriteMetadataInstructionSerializer extends AbstractInstructionSerializer {\r
-\r
-    @Override\r
-    public void serialize(Instruction instruction, ByteBuf outBuffer) {\r
-        outBuffer.writeShort(getType());\r
-        outBuffer.writeShort(InstructionConstants.WRITE_METADATA_LENGTH);\r
-        outBuffer.writeZero(InstructionConstants.PADDING_IN_WRITE_METADATA);\r
-        MetadataInstruction metadata = instruction.getAugmentation(MetadataInstruction.class);\r
-        outBuffer.writeBytes(metadata.getMetadata());\r
-        outBuffer.writeBytes(metadata.getMetadataMask());\r
-    }\r
-\r
-    @Override\r
-    protected int getType() {\r
-        return InstructionConstants.WRITE_METADATA_TYPE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class WriteMetadataInstructionSerializer extends AbstractInstructionSerializer {
+
+    @Override
+    public void serialize(Instruction instruction, ByteBuf outBuffer) {
+        outBuffer.writeShort(getType());
+        outBuffer.writeShort(InstructionConstants.WRITE_METADATA_LENGTH);
+        outBuffer.writeZero(InstructionConstants.PADDING_IN_WRITE_METADATA);
+        MetadataInstruction metadata = instruction.getAugmentation(MetadataInstruction.class);
+        outBuffer.writeBytes(metadata.getMetadata());
+        outBuffer.writeBytes(metadata.getMetadataMask());
+    }
+
+    @Override
+    protected int getType() {
+        return InstructionConstants.WRITE_METADATA_TYPE;
+    }
+
+}
index 1d1907afecde2e252b65d068d4d43ca0735ecf9b..4ce543e66b28028e99b7cb41d6ba0ba1d347f29f 100644 (file)
@@ -1,37 +1,37 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for Ipv4 address based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmIpv4AddressSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        writeIpv4Address(entry, outBuffer);\r
-        writeMask(entry, outBuffer, getValueLength());\r
-    }\r
-\r
-    private static void writeIpv4Address(final MatchEntries entry, final ByteBuf out) {\r
-        Iterable<String> addressGroups = ByteBufUtils.DOT_SPLITTER\r
-                .split(entry.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address().getValue());\r
-        for (String group : addressGroups) {\r
-            out.writeByte(Short.parseShort(group));\r
-        }\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for Ipv4 address based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmIpv4AddressSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        writeIpv4Address(entry, outBuffer);
+        writeMask(entry, outBuffer, getValueLength());
+    }
+
+    private static void writeIpv4Address(final MatchEntries entry, final ByteBuf out) {
+        Iterable<String> addressGroups = ByteBufUtils.DOT_SPLITTER
+                .split(entry.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address().getValue());
+        for (String group : addressGroups) {
+            out.writeByte(Short.parseShort(group));
+        }
+    }
+
+}
index c83f9d904a68464140ce792377f4ba7004edcbeb..496505b89cb3e999f04bf25e100997c33a40933e 100644 (file)
@@ -1,83 +1,83 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-import com.google.common.collect.Lists;\r
-\r
-/**\r
- * Parent for Ipv6 address based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmIpv6AddressSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        String textAddress = entry.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address().getValue();\r
-        List<String> address;\r
-        if (textAddress.equals("::")) {\r
-            String[] tmp = new String[EncodeConstants.GROUPS_IN_IPV6_ADDRESS];\r
-            Arrays.fill(tmp, "0");\r
-            address = Arrays.asList(tmp);\r
-        } else {\r
-            address = parseIpv6Address(Lists.newArrayList(ByteBufUtils.COLON_SPLITTER.split(textAddress)));\r
-        }\r
-        for (String group : address) {\r
-            outBuffer.writeShort(Integer.parseInt(group, 16));\r
-        }\r
-        writeMask(entry, outBuffer, getValueLength());\r
-    }\r
-\r
-    private static List<String> parseIpv6Address(final List<String> addressGroups) {\r
-        int countEmpty = 0;\r
-        for (String group : addressGroups) {\r
-            if (group.equals("")) {\r
-                countEmpty++;\r
-            }\r
-        }\r
-        List<String> ready = new ArrayList<>(EncodeConstants.GROUPS_IN_IPV6_ADDRESS);\r
-        switch (countEmpty) {\r
-        case 0:\r
-            ready = addressGroups;\r
-            break;\r
-        case 1:\r
-            int zerosToBePushed = EncodeConstants.GROUPS_IN_IPV6_ADDRESS - addressGroups.size() + 1;\r
-            for (String group : addressGroups) {\r
-                if (group.equals("")) {\r
-                    for (int j = 0; j < zerosToBePushed; j++) {\r
-                        ready.add("0");\r
-                    }\r
-                } else {\r
-                    ready.add(group);\r
-                }\r
-            }\r
-            break;\r
-        case 2:\r
-            String[] tmp = new String[EncodeConstants.GROUPS_IN_IPV6_ADDRESS];\r
-            Arrays.fill(tmp, "0");\r
-            tmp[EncodeConstants.GROUPS_IN_IPV6_ADDRESS - 1] =\r
-                    addressGroups.get(addressGroups.size() - 1);\r
-            ready = Arrays.asList(tmp);\r
-            break;\r
-        default:\r
-            throw new IllegalStateException("Incorrect ipv6 address");\r
-        }\r
-        return ready;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Parent for Ipv6 address based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmIpv6AddressSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        String textAddress = entry.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address().getValue();
+        List<String> address;
+        if (textAddress.equals("::")) {
+            String[] tmp = new String[EncodeConstants.GROUPS_IN_IPV6_ADDRESS];
+            Arrays.fill(tmp, "0");
+            address = Arrays.asList(tmp);
+        } else {
+            address = parseIpv6Address(Lists.newArrayList(ByteBufUtils.COLON_SPLITTER.split(textAddress)));
+        }
+        for (String group : address) {
+            outBuffer.writeShort(Integer.parseInt(group, 16));
+        }
+        writeMask(entry, outBuffer, getValueLength());
+    }
+
+    private static List<String> parseIpv6Address(final List<String> addressGroups) {
+        int countEmpty = 0;
+        for (String group : addressGroups) {
+            if (group.equals("")) {
+                countEmpty++;
+            }
+        }
+        List<String> ready = new ArrayList<>(EncodeConstants.GROUPS_IN_IPV6_ADDRESS);
+        switch (countEmpty) {
+        case 0:
+            ready = addressGroups;
+            break;
+        case 1:
+            int zerosToBePushed = EncodeConstants.GROUPS_IN_IPV6_ADDRESS - addressGroups.size() + 1;
+            for (String group : addressGroups) {
+                if (group.equals("")) {
+                    for (int j = 0; j < zerosToBePushed; j++) {
+                        ready.add("0");
+                    }
+                } else {
+                    ready.add(group);
+                }
+            }
+            break;
+        case 2:
+            String[] tmp = new String[EncodeConstants.GROUPS_IN_IPV6_ADDRESS];
+            Arrays.fill(tmp, "0");
+            tmp[EncodeConstants.GROUPS_IN_IPV6_ADDRESS - 1] =
+                    addressGroups.get(addressGroups.size() - 1);
+            ready = Arrays.asList(tmp);
+            break;
+        default:
+            throw new IllegalStateException("Incorrect ipv6 address");
+        }
+        return ready;
+    }
+}
index 847a04091c0ef1500c79c69ce88fef436afcadcd..51b62df958af2c9bc86d08993b7f5ec9204aefe3 100644 (file)
@@ -1,29 +1,29 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for MAC address based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmMacAddressSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        String macAddress = entry.getAugmentation(MacAddressMatchEntry.class).getMacAddress().getValue();\r
-        outBuffer.writeBytes(ByteBufUtils.macAddressToBytes(macAddress)); // 48 b + mask [OF 1.3.2 spec]\r
-        writeMask(entry, outBuffer, getValueLength());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for MAC address based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmMacAddressSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        String macAddress = entry.getAugmentation(MacAddressMatchEntry.class).getMacAddress().getValue();
+        outBuffer.writeBytes(ByteBufUtils.macAddressToBytes(macAddress)); // 48 b + mask [OF 1.3.2 spec]
+        writeMask(entry, outBuffer, getValueLength());
+    }
+}
index 8b84a88c26ef513e7b2bd6bda856404a14a2da1f..5c6696475089db3577705bffcffad4624cb5f823 100644 (file)
@@ -1,73 +1,73 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for all match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmMatchEntrySerializer\r
-    implements OFSerializer<MatchEntries>, HeaderSerializer<MatchEntries>{\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        serializeHeader(entry, outBuffer);\r
-    }\r
-\r
-    @Override\r
-    public void serializeHeader(MatchEntries entry, ByteBuf outBuffer) {\r
-        outBuffer.writeShort(getOxmClassCode());\r
-        writeOxmFieldAndLength(outBuffer, getOxmFieldCode(), entry.isHasMask(),\r
-                getValueLength());\r
-    }\r
-\r
-    protected static void writeMask(MatchEntries entry, ByteBuf out, int length) {\r
-        if (entry.isHasMask()) {\r
-            byte[] mask = entry.getAugmentation(MaskMatchEntry.class).getMask();\r
-            if (mask != null && mask.length != length) {\r
-                throw new IllegalArgumentException("incorrect length of mask: "+\r
-                        mask.length + ", expected: " + length);\r
-            }\r
-            out.writeBytes(mask);\r
-        }\r
-    }\r
-\r
-    protected static void writeOxmFieldAndLength(ByteBuf out, int fieldValue, boolean hasMask, int lengthArg) {\r
-        int fieldAndMask = fieldValue << 1;\r
-        int length = lengthArg;\r
-        if (hasMask) {\r
-            fieldAndMask |= 1;\r
-            length *= 2;\r
-        }\r
-        out.writeByte(fieldAndMask);\r
-        out.writeByte(length);\r
-    }\r
-\r
-    /**\r
-     * @return numeric representation of oxm_field\r
-     */\r
-    protected abstract int getOxmFieldCode();\r
-\r
-    /**\r
-     * @return numeric representation of oxm_class\r
-     */\r
-    protected abstract int getOxmClassCode();\r
-\r
-    /**\r
-     * @return match entry value length (without mask length)\r
-     */\r
-    protected abstract int getValueLength();\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for all match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmMatchEntrySerializer
+    implements OFSerializer<MatchEntries>, HeaderSerializer<MatchEntries>{
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        serializeHeader(entry, outBuffer);
+    }
+
+    @Override
+    public void serializeHeader(MatchEntries entry, ByteBuf outBuffer) {
+        outBuffer.writeShort(getOxmClassCode());
+        writeOxmFieldAndLength(outBuffer, getOxmFieldCode(), entry.isHasMask(),
+                getValueLength());
+    }
+
+    protected static void writeMask(MatchEntries entry, ByteBuf out, int length) {
+        if (entry.isHasMask()) {
+            byte[] mask = entry.getAugmentation(MaskMatchEntry.class).getMask();
+            if (mask != null && mask.length != length) {
+                throw new IllegalArgumentException("incorrect length of mask: "+
+                        mask.length + ", expected: " + length);
+            }
+            out.writeBytes(mask);
+        }
+    }
+
+    protected static void writeOxmFieldAndLength(ByteBuf out, int fieldValue, boolean hasMask, int lengthArg) {
+        int fieldAndMask = fieldValue << 1;
+        int length = lengthArg;
+        if (hasMask) {
+            fieldAndMask |= 1;
+            length *= 2;
+        }
+        out.writeByte(fieldAndMask);
+        out.writeByte(length);
+    }
+
+    /**
+     * @return numeric representation of oxm_field
+     */
+    protected abstract int getOxmFieldCode();
+
+    /**
+     * @return numeric representation of oxm_class
+     */
+    protected abstract int getOxmClassCode();
+
+    /**
+     * @return match entry value length (without mask length)
+     */
+    protected abstract int getValueLength();
+
+}
index 0218beb8faea8b75b41d68699b9659b998099721..b3fedcc665575e1b45d57f7109aee91e483f047c 100644 (file)
@@ -1,27 +1,27 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for metadata based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmMetadataSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeBytes(entry.getAugmentation(MetadataMatchEntry.class).getMetadata());\r
-        writeMask(entry, outBuffer, getValueLength());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for metadata based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmMetadataSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeBytes(entry.getAugmentation(MetadataMatchEntry.class).getMetadata());
+        writeMask(entry, outBuffer, getValueLength());
+    }
+}
index ce972033408a9423698590830b4929f5e01abf26..394d8c405358c2feeb53359fd5368a9775c9d332 100644 (file)
@@ -1,26 +1,26 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for port(32-bit) based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmPortNumberSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeInt(entry.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for port(32-bit) based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmPortNumberSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeInt(entry.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
+    }
+}
index b1c4671cde8f3ee88e72e7bad730e18c38b95aad..9dd6a55f63b5f0a38dd8b0b103a384f6de42557c 100644 (file)
@@ -1,26 +1,26 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Parent for port(16-bit) based match entry serializers\r
- * @author michal.polkorab\r
- */\r
-public abstract class AbstractOxmPortSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeShort(entry.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Parent for port(16-bit) based match entry serializers
+ * @author michal.polkorab
+ */
+public abstract class AbstractOxmPortSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeShort(entry.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+    }
+}
index d59e16f344b2b9b93a42c04240b5540a5df2433b..7d963b8b2ee8c0347be7fa5e8d16f360bfe53bda 100644 (file)
@@ -1,46 +1,46 @@
-/*\r
- * Copyright (C) 2014 Red Hat, Inc.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcpFlagMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-/**\r
- * @author brent.salisbury\r
- *\r
- */\r
-public class NxmTcpFlagSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    private static final Logger logger = LoggerFactory.getLogger(NxmTcpFlagSerializer.class);\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeShort(entry.getAugmentation(TcpFlagMatchEntry.class).getTcpFlag());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.NXM_1_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.NXM_NX_TCP_FLAG;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
-    }\r
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcpFlagMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author brent.salisbury
+ *
+ */
+public class NxmTcpFlagSerializer extends AbstractOxmMatchEntrySerializer {
+
+    private static final Logger logger = LoggerFactory.getLogger(NxmTcpFlagSerializer.class);
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeShort(entry.getAugmentation(TcpFlagMatchEntry.class).getTcpFlag());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.NXM_1_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.NXM_NX_TCP_FLAG;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+    }
 }
\ No newline at end of file
index 4520d9c73a84af7bd898a1ff594216aeb7fdddc1..1a37f2844f74da384273fdc5573ce331648761c0 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpOpSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeShort(entry.getAugmentation(OpCodeMatchEntry.class).getOpCode());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ARP_OP;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpOpSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeShort(entry.getAugmentation(OpCodeMatchEntry.class).getOpCode());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ARP_OP;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+    }
+}
index 8836d0ea23e26e0cd8b845c87cb6edd5baff2bfd..d4e8c3c04df83e7720bff6b0493ac52a9c817fb4 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpShaSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ARP_SHA;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.MAC_ADDRESS_LENGTH;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpShaSerializer extends AbstractOxmMacAddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ARP_SHA;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.MAC_ADDRESS_LENGTH;
+    }
+}
index bad5995f06aa54907646dbb4133de22fd62c89ea..505cf05211597247a3b8967e33bb119f11baaac6 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpSpaSerializer extends AbstractOxmIpv4AddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ARP_SPA;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpSpaSerializer extends AbstractOxmIpv4AddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ARP_SPA;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+    }
+}
index 637ca04310c45519842df8e02a9c01ad062ea51a..531b21c64894f73df43312471449121a3ecee64d 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpThaSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ARP_THA;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.MAC_ADDRESS_LENGTH;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpThaSerializer extends AbstractOxmMacAddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ARP_THA;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.MAC_ADDRESS_LENGTH;
+    }
+}
index 25e6417f75e7cae85db0edc1f77894a092f6c55d..ec6ee771efcd80365befa0216ccd2b8daf9d5f7c 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpTpaSerializer extends AbstractOxmIpv4AddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ARP_TPA;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpTpaSerializer extends AbstractOxmIpv4AddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ARP_TPA;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+    }
+}
index 8ac6b9d67f710dbf4aac434b70a32b6ce380be6b..c6c07bade3660eb1ed4bc3a4cae2242ff9e8eec4 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthDstSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ETH_DST;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.MAC_ADDRESS_LENGTH;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthDstSerializer extends AbstractOxmMacAddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ETH_DST;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.MAC_ADDRESS_LENGTH;
+    }
+}
index 74d75304a0ffe51d8bd57a74ddecd901ba983c41..5a2df0a85b9c46cb3252f00121eaac5d752bf30b 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthSrcSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.MAC_ADDRESS_LENGTH;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ETH_SRC;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthSrcSerializer extends AbstractOxmMacAddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.MAC_ADDRESS_LENGTH;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ETH_SRC;
+    }
+}
index 70bf999a07034518d009f077fb5b5e06ab203ebf..6bd7b5752cba06b62298c811a31111725a19aad5 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthTypeSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeShort(entry.getAugmentation(EthTypeMatchEntry.class).getEthType().getValue().shortValue());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ETH_TYPE;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthTypeSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeShort(entry.getAugmentation(EthTypeMatchEntry.class).getEthType().getValue().shortValue());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ETH_TYPE;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+    }
+}
index 82722fc540b46992617b7820ad3315d90e9935be..664b68b0df679fd3e1688ec3956471d2e9dd6a61 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4CodeSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeByte(entry.getAugmentation(Icmpv4CodeMatchEntry.class).getIcmpv4Code());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ICMPV4_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4CodeSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeByte(entry.getAugmentation(Icmpv4CodeMatchEntry.class).getIcmpv4Code());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ICMPV4_CODE;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+    }
+}
index a5f367fb8f80f16cfc53b6dfc0d5a5ece68ca1fd..6ae6dfaa57ac4e2b5def45fc0e738ed6d0f3e25d 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4TypeSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeByte(entry.getAugmentation(Icmpv4TypeMatchEntry.class).getIcmpv4Type());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ICMPV4_TYPE;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4TypeSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeByte(entry.getAugmentation(Icmpv4TypeMatchEntry.class).getIcmpv4Type());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ICMPV4_TYPE;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+    }
+}
index 303b116e9011d82d85754505acd3f37863d7dd0a..7e38d36f1e67992f54181baa011c623a5a560d38 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6CodeSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeByte(entry.getAugmentation(Icmpv6CodeMatchEntry.class).getIcmpv6Code());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ICMPV6_CODE;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6CodeSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeByte(entry.getAugmentation(Icmpv6CodeMatchEntry.class).getIcmpv6Code());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ICMPV6_CODE;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+    }
+}
index feafa96279a9aad6782673a2c1abd9b4925cc929..adc06c22c33c38ce132211c0095e61c101529a6d 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6TypeSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeByte(entry.getAugmentation(Icmpv6TypeMatchEntry.class).getIcmpv6Type());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.ICMPV6_TYPE;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6TypeSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeByte(entry.getAugmentation(Icmpv6TypeMatchEntry.class).getIcmpv6Type());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.ICMPV6_TYPE;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+    }
+}
index 2aba7e8cca7b10a20ff86c45f9596a0cdd865842..7e6d7a86b162857f2c5f81bea4bc68c31d8f52d6 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmInPhyPortSerializer extends AbstractOxmPortNumberSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IN_PHY_PORT;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmInPhyPortSerializer extends AbstractOxmPortNumberSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IN_PHY_PORT;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+    }
+}
index 2c9550774010d72e7370b4995c88d24a690917fa..7a3422e0848df30babeb2d028d74693645eec1ce 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmInPortSerializer extends AbstractOxmPortNumberSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IN_PORT;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmInPortSerializer extends AbstractOxmPortNumberSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IN_PORT;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+    }
+}
index dc1ba5ec809945c72ae7504d60cab2b9fc05b22e..d2cb041687b06bd3dbb20ea801b0792d526c4ac3 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpDscpSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeByte(entry.getAugmentation(DscpMatchEntry.class).getDscp().getValue());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IP_DSCP;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpDscpSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeByte(entry.getAugmentation(DscpMatchEntry.class).getDscp().getValue());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IP_DSCP;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+    }
+}
index 65bea29755bc25417e1f4dfc15a3e70d647cd412..3270eeeac8987d96a7a4ffba3baa0b74ae135022 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpEcnSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeByte(entry.getAugmentation(EcnMatchEntry.class).getEcn());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IP_ECN;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpEcnSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeByte(entry.getAugmentation(EcnMatchEntry.class).getEcn());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IP_ECN;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+    }
+}
index 7193f504cb840e86769459337ae7479895d89022..d24c0f8754761b0e95fcdd7f4adc00b2ae8cf025 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpProtoSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeByte(entry.getAugmentation(ProtocolNumberMatchEntry.class).getProtocolNumber());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IP_PROTO;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpProtoSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeByte(entry.getAugmentation(ProtocolNumberMatchEntry.class).getProtocolNumber());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IP_PROTO;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+    }
+}
index df717c18073f3d20a5ac4b6ac2d4ea0c32e16c9e..a7d23c940e55167ddc6e3bb4d0b9611cfa6f3beb 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4DstSerializer extends AbstractOxmIpv4AddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IPV4_DST;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4DstSerializer extends AbstractOxmIpv4AddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IPV4_DST;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+    }
+}
index 2c92d022eae8f5cf8b0597f581400e5462f524cc..4b8ddbc773e94d3eacd7a6267d96387641c43af6 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4SrcSerializer extends AbstractOxmIpv4AddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IPV4_SRC;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4SrcSerializer extends AbstractOxmIpv4AddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IPV4_SRC;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+    }
+}
index 4d6299efb5d81a3dc0a2734d15a7e3a573c8f6c3..cc892b8d7b1f6547ede5d674a3f4e4d14ef9a3de 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6DstSerializer extends AbstractOxmIpv6AddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IPV6_DST;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6DstSerializer extends AbstractOxmIpv6AddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IPV6_DST;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;
+    }
+}
index 4852a4fa2fe1666f17b267cdb194e1df9ffbfd44..fa7ef802bd65312969eed5e0c79002bea07ce45b 100644 (file)
@@ -1,57 +1,57 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6ExtHdrSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        Ipv6ExthdrFlags pseudoField = entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField();\r
-        int bitmap = ByteBufUtils.fillBitMask(0,\r
-                pseudoField.isNonext(),\r
-                pseudoField.isEsp(),\r
-                pseudoField.isAuth(),\r
-                pseudoField.isDest(),\r
-                pseudoField.isFrag(),\r
-                pseudoField.isRouter(),\r
-                pseudoField.isHop(),\r
-                pseudoField.isUnrep(),\r
-                pseudoField.isUnseq());\r
-        outBuffer.writeShort(bitmap);\r
-        writeMask(entry, outBuffer, getValueLength());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IPV6_EXTHDR;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6ExtHdrSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        Ipv6ExthdrFlags pseudoField = entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField();
+        int bitmap = ByteBufUtils.fillBitMask(0,
+                pseudoField.isNonext(),
+                pseudoField.isEsp(),
+                pseudoField.isAuth(),
+                pseudoField.isDest(),
+                pseudoField.isFrag(),
+                pseudoField.isRouter(),
+                pseudoField.isHop(),
+                pseudoField.isUnrep(),
+                pseudoField.isUnseq());
+        outBuffer.writeShort(bitmap);
+        writeMask(entry, outBuffer, getValueLength());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IPV6_EXTHDR;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+    }
+}
index 1e049929b210b1c4b996e59fee11f4bfc907b947..bb6c04509f9b23e088379717498f6847c41b415a 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6FlabelSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeInt(entry.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());\r
-        writeMask(entry, outBuffer, getValueLength());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IPV6_FLABEL;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6FlabelSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeInt(entry.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());
+        writeMask(entry, outBuffer, getValueLength());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IPV6_FLABEL;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+    }
+}
index fed6402f13aa01aea27574ead72186e459b2ba6f..f5952b8b2352624d223dd1f28379b73c38aa3946 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdSllSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.MAC_ADDRESS_LENGTH;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IPV6_ND_SLL;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdSllSerializer extends AbstractOxmMacAddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.MAC_ADDRESS_LENGTH;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IPV6_ND_SLL;
+    }
+}
index 9037ee6fa9a5c4c0e7ff61cf624d78d6ed5e7f48..a8f32b117e0c8303bd3ea749942c6ddb6c285d10 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdTargetSerializer extends AbstractOxmIpv6AddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IPV6_ND_TARGET;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdTargetSerializer extends AbstractOxmIpv6AddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IPV6_ND_TARGET;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;
+    }
+}
index c0864da95adec52f568a7fc1428c3867c5c328f1..e215a2f3f33142745e1025ccf3a62a97ad2a2980 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdTllSerializer extends AbstractOxmMacAddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IPV6_ND_TLL;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.MAC_ADDRESS_LENGTH;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdTllSerializer extends AbstractOxmMacAddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IPV6_ND_TLL;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.MAC_ADDRESS_LENGTH;
+    }
+}
index 7057fe307a58793718ee112832d86869470709c2..9aeca979be82244c772dd0b8036b25ec7040d556 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6SrcSerializer extends AbstractOxmIpv6AddressSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.IPV6_SRC;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6SrcSerializer extends AbstractOxmIpv6AddressSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.IPV6_SRC;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;
+    }
+}
index 6b0e27dea9b5141a462c4a49bd17d4d78e38986f..09099c54d7307704550c3d07ccad65afae6b97b9 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMetadataSerializer extends AbstractOxmMetadataSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.METADATA;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_LONG_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMetadataSerializer extends AbstractOxmMetadataSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.METADATA;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+    }
+}
index 12f2ec63ac59dd3d32eac48e1ba440fd069bad32..52e41c93ddd153404c6bc801e709d8f75d73ad1c 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsBosSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeBoolean(entry.getAugmentation(BosMatchEntry.class).isBos().booleanValue());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.MPLS_BOS;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsBosSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeBoolean(entry.getAugmentation(BosMatchEntry.class).isBos().booleanValue());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.MPLS_BOS;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+    }
+}
index c27936a573050473659e358fb51812ebff93ead6..85ec956b4e7d867acab43cc26e17b18e83488f8d 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsLabelSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeInt(entry.getAugmentation(MplsLabelMatchEntry.class).getMplsLabel().intValue());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.MPLS_LABEL;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_INT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsLabelSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeInt(entry.getAugmentation(MplsLabelMatchEntry.class).getMplsLabel().intValue());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.MPLS_LABEL;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+    }
+}
index 7a80f40e9b7fe57f7980b3472ad5e2562c15da2b..ff2b6fe404b8f766dc0120b3641160916e51d735 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsTcSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeByte(entry.getAugmentation(TcMatchEntry.class).getTc());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.MPLS_TC;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsTcSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeByte(entry.getAugmentation(TcMatchEntry.class).getTc());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.MPLS_TC;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+    }
+}
index ca740dd52ef2d448a80c3db75d12f49ee4fd6523..96c24a681fae9f5df09c86faf23fd5de9847ec68 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmPbbIsidSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeMedium(entry.getAugmentation(IsidMatchEntry.class).getIsid().intValue());\r
-        writeMask(entry, outBuffer, getValueLength());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.PBB_ISID;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_3_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmPbbIsidSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeMedium(entry.getAugmentation(IsidMatchEntry.class).getIsid().intValue());
+        writeMask(entry, outBuffer, getValueLength());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.PBB_ISID;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_3_BYTES;
+    }
+}
index 9327b566144ee6cdc0f2d01ca560604750a3f148..4e3e273876dcfb8037e82ffb2f990af6b8ed7fbe 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpDstSerializer extends AbstractOxmPortSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.SCTP_DST;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpDstSerializer extends AbstractOxmPortSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.SCTP_DST;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+    }
+}
index 1d50c383915628870e98e15fa971a20aba432c19..96629ff14fd6dca56f69440cd6d0ad832cb4459a 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpSrcSerializer extends AbstractOxmPortSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.SCTP_SRC;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpSrcSerializer extends AbstractOxmPortSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.SCTP_SRC;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+    }
+}
index 22b5093ad4ecad3bffc7134f638bd19a8f1b92b3..c7b42281428b6bc911d47c7e2cc2421ca3dffb53 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpDstSerializer extends AbstractOxmPortSerializer{\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.TCP_DST;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpDstSerializer extends AbstractOxmPortSerializer{
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.TCP_DST;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+    }
+}
index e7bcfd6e11429abb259fd90529b3846474bb2b27..0a8a01e743bebc29a814330ca32c848cfa1d3f4e 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpSrcSerializer extends AbstractOxmPortSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.TCP_SRC;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpSrcSerializer extends AbstractOxmPortSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.TCP_SRC;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+    }
+}
index 033f7f7953e538d3f713b08265b5042033d7ec72..035bb7ffbfdbbb310bf3ae01f526c7f02d9f76e6 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTunnelIdSerializer extends AbstractOxmMetadataSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.TUNNEL_ID;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_LONG_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTunnelIdSerializer extends AbstractOxmMetadataSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.TUNNEL_ID;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+    }
+}
index 5f110390dd510a203847ab1dfa25f5bb97430b82..bd4e705f860a9ced53c400e508d20a41e4c124e6 100644 (file)
@@ -1,33 +1,33 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpDstSerializer extends AbstractOxmPortSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.UDP_DST;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpDstSerializer extends AbstractOxmPortSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.UDP_DST;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+    }
+}
index 2e091b44c3bc46d08cd6418e7eca37aab32b185c..5929909a113a23b3b2c9cb2f0f1476e478b90b9b 100644 (file)
@@ -1,34 +1,34 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpSrcSerializer extends AbstractOxmPortSerializer {\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.UDP_SRC;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpSrcSerializer extends AbstractOxmPortSerializer {
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.UDP_SRC;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+    }
+
+}
index ba181fa0f51a652a0f7759adbdeb2473200349f3..ad7e964398784507d6e80c2112ba787d21bf4419 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanPcpSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        outBuffer.writeByte(entry.getAugmentation(VlanPcpMatchEntry.class).getVlanPcp().byteValue());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.VLAN_PCP;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanPcpSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        outBuffer.writeByte(entry.getAugmentation(VlanPcpMatchEntry.class).getVlanPcp().byteValue());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.VLAN_PCP;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+    }
+
+}
index 775b91a8a355f37ba7234ea9182fb6f594277fc8..975cc3d048bfe7cba18a68a1a17b6c4ee779f185 100644 (file)
@@ -1,52 +1,52 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanVidSerializer extends AbstractOxmMatchEntrySerializer {\r
-\r
-    @Override\r
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
-        super.serialize(entry, outBuffer);\r
-        VlanVidMatchEntry vlanVid = entry.getAugmentation(VlanVidMatchEntry.class);\r
-        int vlanVidValue = vlanVid.getVlanVid();\r
-        if (vlanVid.isCfiBit()) {\r
-            short cfi = 1 << 12; // 13-th bit\r
-            vlanVidValue = vlanVidValue | cfi;\r
-        }\r
-\r
-        outBuffer.writeShort(vlanVidValue);\r
-        writeMask(entry, outBuffer, getValueLength());\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmClassCode() {\r
-        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
-    }\r
-\r
-    @Override\r
-    protected int getOxmFieldCode() {\r
-        return OxmMatchConstants.VLAN_VID;\r
-    }\r
-\r
-    @Override\r
-    protected int getValueLength() {\r
-        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanVidSerializer extends AbstractOxmMatchEntrySerializer {
+
+    @Override
+    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+        super.serialize(entry, outBuffer);
+        VlanVidMatchEntry vlanVid = entry.getAugmentation(VlanVidMatchEntry.class);
+        int vlanVidValue = vlanVid.getVlanVid();
+        if (vlanVid.isCfiBit()) {
+            short cfi = 1 << 12; // 13-th bit
+            vlanVidValue = vlanVidValue | cfi;
+        }
+
+        outBuffer.writeShort(vlanVidValue);
+        writeMask(entry, outBuffer, getValueLength());
+    }
+
+    @Override
+    protected int getOxmClassCode() {
+        return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+    }
+
+    @Override
+    protected int getOxmFieldCode() {
+        return OxmMatchConstants.VLAN_VID;
+    }
+
+    @Override
+    protected int getValueLength() {
+        return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+    }
+
+}
index 490251ccb8a107b6baf2f51a368df5fdfa95280b..05812e8b3c20df0d04df1a96a5101279594a98c8 100644 (file)
@@ -1,35 +1,35 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <T> type the key maker is based on \r
- */\r
-public abstract class AbstractCodeKeyMaker implements CodeKeyMaker {\r
-\r
-    private short version;\r
-\r
-    /**\r
-     * @param version openflow wire version\r
-     */\r
-    public AbstractCodeKeyMaker(short version) {\r
-        this.version = version;\r
-        \r
-    }\r
-\r
-    /**\r
-     * @return the version\r
-     */\r
-    public short getVersion() {\r
-        return version;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+
+/**
+ * @author michal.polkorab
+ * @param <T> type the key maker is based on 
+ */
+public abstract class AbstractCodeKeyMaker implements CodeKeyMaker {
+
+    private short version;
+
+    /**
+     * @param version openflow wire version
+     */
+    public AbstractCodeKeyMaker(short version) {
+        this.version = version;
+        
+    }
+
+    /**
+     * @return the version
+     */
+    public short getVersion() {
+        return version;
+    }
+
+}
index 3a804afc45c7eeb1b5ea64f6248500bdce257efd..f2e736facf7f0a4ce893d3a655ac8b0c0186dda8 100644 (file)
@@ -1,35 +1,35 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <T> type the key maker is based on \r
- */\r
-public abstract class AbstractTypeKeyMaker<T> implements TypeKeyMaker<T> {\r
-\r
-    private short version;\r
-\r
-    /**\r
-     * @param version openflow wire version\r
-     */\r
-    public AbstractTypeKeyMaker(short version) {\r
-        this.version = version;\r
-        \r
-    }\r
-\r
-    /**\r
-     * @return the version\r
-     */\r
-    public short getVersion() {\r
-        return version;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+
+/**
+ * @author michal.polkorab
+ * @param <T> type the key maker is based on 
+ */
+public abstract class AbstractTypeKeyMaker<T> implements TypeKeyMaker<T> {
+
+    private short version;
+
+    /**
+     * @param version openflow wire version
+     */
+    public AbstractTypeKeyMaker(short version) {
+        this.version = version;
+        
+    }
+
+    /**
+     * @return the version
+     */
+    public short getVersion() {
+        return version;
+    }
+
+}
index cb7b051e9c7c535700a5bade4eb9b64b6e887d06..d05b8cd8055602153ff19469de0705baed68c083 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ActionConstants {\r
-\r
-    /** Openflow v1.0 & v1.3 OFPAT_OUTPUT code */\r
-    public static final byte OUTPUT_CODE = 0;\r
-    /** Openflow v1.0 OFPAT_SET_VLAN_VID code */\r
-    public static final byte SET_VLAN_VID_CODE = 1;\r
-    /** Openflow v1.0 OFPAT_SET_VLAN_PCP code */\r
-    public static final byte SET_VLAN_PCP_CODE = 2;\r
-    /** Openflow v1.0 OFPAT_STRIP_VLAN code */\r
-    public static final byte STRIP_VLAN_CODE = 3;\r
-    /** Openflow v1.0 OFPAT_SET_DL_SRC code */\r
-    public static final byte SET_DL_SRC_CODE = 4;\r
-    /** Openflow v1.0 OFPAT_SET_DL_DST code */\r
-    public static final byte SET_DL_DST_CODE = 5;\r
-    /** Openflow v1.0 OFPAT_SET_NW_SRC code */\r
-    public static final byte SET_NW_SRC_CODE = 6;\r
-    /** Openflow v1.0 OFPAT_SET_NW_DST code */\r
-    public static final byte SET_NW_DST_CODE = 7;\r
-    /** Openflow v1.0 OFPAT_SET_NW_TOS code */\r
-    public static final byte SET_NW_TOS_CODE = 8;\r
-    /** Openflow v1.0 OFPAT_SET_TP_SRC code */\r
-    public static final byte SET_TP_SRC_CODE = 9;\r
-    /** Openflow v1.0 OFPAT_SET_TP_DST code */\r
-    public static final byte SET_TP_DST_CODE = 10;\r
-    /** Openflow v1.0 OFPAT_ENQUEUE code */\r
-    public static final byte ENQUEUE_CODE = 11;\r
-    /** Openflow v1.3 OFPAT_COPY_TTL_OUT code */\r
-    public static final byte COPY_TTL_OUT_CODE = 11;\r
-    /** Openflow v1.3 OFPAT_COPY_TTL_IN code */\r
-    public static final byte COPY_TTL_IN_CODE = 12;\r
-    /** Openflow v1.3 OFPAT_SET_MPLS_TTL code */\r
-    public static final byte SET_MPLS_TTL_CODE = 15;\r
-    /** Openflow v1.3 OFPAT_DEC_MPLS_TTL code */\r
-    public static final byte DEC_MPLS_TTL_CODE = 16;\r
-    /** Openflow v1.3 OFPAT_PUSH_VLAN code */\r
-    public static final byte PUSH_VLAN_CODE = 17;\r
-    /** Openflow v1.3 OFPAT_POP_VLAN code */\r
-    public static final byte POP_VLAN_CODE = 18;\r
-    /** Openflow v1.3 OFPAT_PUSH_MPLS code */\r
-    public static final byte PUSH_MPLS_CODE = 19;\r
-    /** Openflow v1.3 OFPAT_POP_MPLS code */\r
-    public static final byte POP_MPLS_CODE = 20;\r
-    /** Openflow v1.3 OFPAT_SET_QUEUE code */\r
-    public static final byte SET_QUEUE_CODE = 21;\r
-    /** Openflow v1.3 OFPAT_GROUP code */\r
-    public static final byte GROUP_CODE = 22;\r
-    /** Openflow v1.3 OFPAT_SET_NW_TTL code */\r
-    public static final byte SET_NW_TTL_CODE = 23;\r
-    /** Openflow v1.3 OFPAT_DEC_NW_TTL code */\r
-    public static final byte DEC_NW_TTL_CODE = 24;\r
-    /** Openflow v1.3 OFPAT_SET_FIELD code */\r
-    public static final int SET_FIELD_CODE = 25;\r
-    /** Openflow v1.3 OFPAT_PUSH_PBB code */\r
-    public static final byte PUSH_PBB_CODE = 26;\r
-    /** Openflow v1.3 OFPAT_POP_PBB code */\r
-    public static final byte POP_PBB_CODE = 27;\r
-\r
-    /** Padding in OFPAT_OUTPUT (OF v1.3) */\r
-    public static final byte OUTPUT_PADDING = 6;\r
-    /** Padding in OFPAT_SET_VLAN_VID (OF v1.3) */\r
-    public static final byte PADDING_IN_SET_VLAN_VID_ACTION = 2;\r
-    /** Padding in OFPAT_SET_VLAN_PCP (OF v1.3) */\r
-    public static final byte PADDING_IN_SET_VLAN_PCP_ACTION = 3;\r
-    /** Padding in OFPAT_SET_NW_TOS (OF v1.3) */\r
-    public static final byte PADDING_IN_SET_NW_TOS_ACTION = 3;\r
-    /** Padding in OFPAT_ENQUEUE (OF v1.3) */\r
-    public static final int PADDING_IN_ENQUEUE_ACTION = 6;\r
-    /** Padding in OFPAT_SET_MPLS_TTL (OF v1.3) */\r
-    public static final byte SET_MPLS_TTL_PADDING = 3;\r
-    /** Padding in OFPAT_SET_NW_TTL (OF v1.3) */\r
-    public static final byte SET_NW_TTL_PADDING = 3;\r
-    /** Padding in OFPAT_SET_DL_SRC and OFPAT_SET_DL_DST (OF v1.3) */\r
-    public static final byte PADDING_IN_DL_ADDRESS_ACTION = 6;\r
-    /** Padding in OFPAT_SET_TP_SRC and OFPAT_SET_TP_DST (OF v1.3) */\r
-    public static final byte PADDING_IN_TP_PORT_ACTION = 2;\r
-    /** Padding in action header (OF v1.3) */\r
-    public static final byte PADDING_IN_ACTION_HEADER = 4;\r
-    /** Padding in OFPAT_PUSH_VLAN, OFPAT_PUSH_MPLS, OFPAT_POP_MPLS\r
-     *  and OFPAT_PUSH_PBB (OF v1.3) */\r
-    public static final byte ETHERTYPE_ACTION_PADDING = 2;\r
-\r
-    /** Most common action length */\r
-    public static final byte GENERAL_ACTION_LENGTH = 8;\r
-    /** Action larger than GENERAL_ACTION_LENGTH - currently\r
-     *  only 16 bytes long actions for both OF v1.0 & v1.3*/\r
-    public static final byte LARGER_ACTION_LENGTH = 16;\r
-    /** Action header size */\r
-    public static final byte ACTION_IDS_LENGTH = 4;\r
-\r
-    private ActionConstants() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ActionConstants {
+
+    /** Openflow v1.0 & v1.3 OFPAT_OUTPUT code */
+    public static final byte OUTPUT_CODE = 0;
+    /** Openflow v1.0 OFPAT_SET_VLAN_VID code */
+    public static final byte SET_VLAN_VID_CODE = 1;
+    /** Openflow v1.0 OFPAT_SET_VLAN_PCP code */
+    public static final byte SET_VLAN_PCP_CODE = 2;
+    /** Openflow v1.0 OFPAT_STRIP_VLAN code */
+    public static final byte STRIP_VLAN_CODE = 3;
+    /** Openflow v1.0 OFPAT_SET_DL_SRC code */
+    public static final byte SET_DL_SRC_CODE = 4;
+    /** Openflow v1.0 OFPAT_SET_DL_DST code */
+    public static final byte SET_DL_DST_CODE = 5;
+    /** Openflow v1.0 OFPAT_SET_NW_SRC code */
+    public static final byte SET_NW_SRC_CODE = 6;
+    /** Openflow v1.0 OFPAT_SET_NW_DST code */
+    public static final byte SET_NW_DST_CODE = 7;
+    /** Openflow v1.0 OFPAT_SET_NW_TOS code */
+    public static final byte SET_NW_TOS_CODE = 8;
+    /** Openflow v1.0 OFPAT_SET_TP_SRC code */
+    public static final byte SET_TP_SRC_CODE = 9;
+    /** Openflow v1.0 OFPAT_SET_TP_DST code */
+    public static final byte SET_TP_DST_CODE = 10;
+    /** Openflow v1.0 OFPAT_ENQUEUE code */
+    public static final byte ENQUEUE_CODE = 11;
+    /** Openflow v1.3 OFPAT_COPY_TTL_OUT code */
+    public static final byte COPY_TTL_OUT_CODE = 11;
+    /** Openflow v1.3 OFPAT_COPY_TTL_IN code */
+    public static final byte COPY_TTL_IN_CODE = 12;
+    /** Openflow v1.3 OFPAT_SET_MPLS_TTL code */
+    public static final byte SET_MPLS_TTL_CODE = 15;
+    /** Openflow v1.3 OFPAT_DEC_MPLS_TTL code */
+    public static final byte DEC_MPLS_TTL_CODE = 16;
+    /** Openflow v1.3 OFPAT_PUSH_VLAN code */
+    public static final byte PUSH_VLAN_CODE = 17;
+    /** Openflow v1.3 OFPAT_POP_VLAN code */
+    public static final byte POP_VLAN_CODE = 18;
+    /** Openflow v1.3 OFPAT_PUSH_MPLS code */
+    public static final byte PUSH_MPLS_CODE = 19;
+    /** Openflow v1.3 OFPAT_POP_MPLS code */
+    public static final byte POP_MPLS_CODE = 20;
+    /** Openflow v1.3 OFPAT_SET_QUEUE code */
+    public static final byte SET_QUEUE_CODE = 21;
+    /** Openflow v1.3 OFPAT_GROUP code */
+    public static final byte GROUP_CODE = 22;
+    /** Openflow v1.3 OFPAT_SET_NW_TTL code */
+    public static final byte SET_NW_TTL_CODE = 23;
+    /** Openflow v1.3 OFPAT_DEC_NW_TTL code */
+    public static final byte DEC_NW_TTL_CODE = 24;
+    /** Openflow v1.3 OFPAT_SET_FIELD code */
+    public static final int SET_FIELD_CODE = 25;
+    /** Openflow v1.3 OFPAT_PUSH_PBB code */
+    public static final byte PUSH_PBB_CODE = 26;
+    /** Openflow v1.3 OFPAT_POP_PBB code */
+    public static final byte POP_PBB_CODE = 27;
+
+    /** Padding in OFPAT_OUTPUT (OF v1.3) */
+    public static final byte OUTPUT_PADDING = 6;
+    /** Padding in OFPAT_SET_VLAN_VID (OF v1.3) */
+    public static final byte PADDING_IN_SET_VLAN_VID_ACTION = 2;
+    /** Padding in OFPAT_SET_VLAN_PCP (OF v1.3) */
+    public static final byte PADDING_IN_SET_VLAN_PCP_ACTION = 3;
+    /** Padding in OFPAT_SET_NW_TOS (OF v1.3) */
+    public static final byte PADDING_IN_SET_NW_TOS_ACTION = 3;
+    /** Padding in OFPAT_ENQUEUE (OF v1.3) */
+    public static final int PADDING_IN_ENQUEUE_ACTION = 6;
+    /** Padding in OFPAT_SET_MPLS_TTL (OF v1.3) */
+    public static final byte SET_MPLS_TTL_PADDING = 3;
+    /** Padding in OFPAT_SET_NW_TTL (OF v1.3) */
+    public static final byte SET_NW_TTL_PADDING = 3;
+    /** Padding in OFPAT_SET_DL_SRC and OFPAT_SET_DL_DST (OF v1.3) */
+    public static final byte PADDING_IN_DL_ADDRESS_ACTION = 6;
+    /** Padding in OFPAT_SET_TP_SRC and OFPAT_SET_TP_DST (OF v1.3) */
+    public static final byte PADDING_IN_TP_PORT_ACTION = 2;
+    /** Padding in action header (OF v1.3) */
+    public static final byte PADDING_IN_ACTION_HEADER = 4;
+    /** Padding in OFPAT_PUSH_VLAN, OFPAT_PUSH_MPLS, OFPAT_POP_MPLS
+     *  and OFPAT_PUSH_PBB (OF v1.3) */
+    public static final byte ETHERTYPE_ACTION_PADDING = 2;
+
+    /** Most common action length */
+    public static final byte GENERAL_ACTION_LENGTH = 8;
+    /** Action larger than GENERAL_ACTION_LENGTH - currently
+     *  only 16 bytes long actions for both OF v1.0 & v1.3*/
+    public static final byte LARGER_ACTION_LENGTH = 16;
+    /** Action header size */
+    public static final byte ACTION_IDS_LENGTH = 4;
+
+    private ActionConstants() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+}
index a3fb7113869bc82ff791ea816ace4a0785dcb42d..2f48763a2ce8bb226d28054ec1126e108eb001ed 100644 (file)
@@ -1,42 +1,42 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionDeserializerRegistryHelper {\r
-\r
-    private short version;\r
-    private DeserializerRegistry registry;\r
-\r
-    /**\r
-     * @param version wire protocol version\r
-     * @param deserializerRegistry registry to be filled with message deserializers\r
-     */\r
-    public ActionDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {\r
-        this.version = version;\r
-        this.registry = deserializerRegistry;\r
-    }\r
-\r
-    /**\r
-     * @param code code / value to distinguish between deserializers\r
-     * @param deserializer deserializer instance\r
-     * @param deserializedObjectClass class of object that will be deserialized\r
-     *  by given deserializer\r
-     */\r
-    public void registerDeserializer(int code, OFGeneralDeserializer deserializer) {\r
-        registry.registerDeserializer(new ActionDeserializerKey(version, code,\r
-                null), deserializer);\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionDeserializerRegistryHelper {
+
+    private short version;
+    private DeserializerRegistry registry;
+
+    /**
+     * @param version wire protocol version
+     * @param deserializerRegistry registry to be filled with message deserializers
+     */
+    public ActionDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {
+        this.version = version;
+        this.registry = deserializerRegistry;
+    }
+
+    /**
+     * @param code code / value to distinguish between deserializers
+     * @param deserializer deserializer instance
+     * @param deserializedObjectClass class of object that will be deserialized
+     *  by given deserializer
+     */
+    public void registerDeserializer(int code, OFGeneralDeserializer deserializer) {
+        registry.registerDeserializer(new ActionDeserializerKey(version, code,
+                null), deserializer);
+    }
+}
index d941f547d95955d6ad56fafd4e3c76ad62eae576..912ec8b75ca25719960413cf4c233ded10001136 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public class ActionSerializerRegistryHelper {\r
-\r
-    private short version;\r
-    private SerializerRegistry serializerRegistry;\r
-\r
-    /**\r
-     * @param version Openflow wire version\r
-     * @param objectType\r
-     * @param serializerRegistry\r
-     */\r
-    public ActionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {\r
-        this.version = version;\r
-        this.serializerRegistry = serializerRegistry;\r
-    }\r
-\r
-    /**\r
-     * Registers given serializer\r
-     * @param actionType\r
-     * @param serializer\r
-     */\r
-    public <TYPE extends ActionBase> void registerSerializer(Class<TYPE> actionType,\r
-            OFGeneralSerializer serializer) {\r
-        serializerRegistry.registerSerializer(new ActionSerializerKey<>(version,\r
-                actionType, null), serializer);\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;
+
+/**
+ * @author michal.polkorab
+ */
+public class ActionSerializerRegistryHelper {
+
+    private short version;
+    private SerializerRegistry serializerRegistry;
+
+    /**
+     * @param version Openflow wire version
+     * @param objectType
+     * @param serializerRegistry
+     */
+    public ActionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {
+        this.version = version;
+        this.serializerRegistry = serializerRegistry;
+    }
+
+    /**
+     * Registers given serializer
+     * @param actionType
+     * @param serializer
+     */
+    public <TYPE extends ActionBase> void registerSerializer(Class<TYPE> actionType,
+            OFGeneralSerializer serializer) {
+        serializerRegistry.registerSerializer(new ActionSerializerKey<>(version,
+                actionType, null), serializer);
+    }
 }
\ No newline at end of file
index 52c2a4de4c1d148fed606fd787b8b765f5c1a172..f5be1f6c4040e5107b08ba0b0ee25dc141748b1b 100644 (file)
@@ -1,26 +1,26 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public interface CodeKeyMaker {\r
-\r
-    /**\r
-     * @param input buffer that will be the needed data gathered from\r
-     * @return key for deserializer lookup\r
-     */\r
-    abstract MessageCodeKey make(ByteBuf input);\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+
+import io.netty.buffer.ByteBuf;
+
+/**
+ * @author michal.polkorab
+ */
+public interface CodeKeyMaker {
+
+    /**
+     * @param input buffer that will be the needed data gathered from
+     * @return key for deserializer lookup
+     */
+    abstract MessageCodeKey make(ByteBuf input);
+
+}
index 9b21226b629e042ac18f99993796907997dc7aef..7713e355e4d30a5ca6b0d297c51dbb400f0d583b 100644 (file)
@@ -1,90 +1,90 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class CodeKeyMakerFactory {\r
-\r
-    /**\r
-     * @param version\r
-     * @return\r
-     */\r
-    public static CodeKeyMaker createMatchEntriesKeyMaker(short version) {\r
-        return new AbstractCodeKeyMaker(version) {\r
-            @Override\r
-            public MessageCodeKey make(ByteBuf input) {\r
-                int oxmClass = input.getUnsignedShort(input.readerIndex());\r
-                int oxmField = input.getUnsignedByte(input.readerIndex()\r
-                        + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;\r
-                MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(getVersion(),\r
-                        oxmClass, oxmField);\r
-                if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {\r
-                    long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES\r
-                            + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);\r
-                    key.setExperimenterId(expId);\r
-                    return key;\r
-                }\r
-                key.setExperimenterId(null);\r
-                return key;\r
-            }\r
-        };\r
-    }\r
-\r
-    /**\r
-     * @param version\r
-     * @return\r
-     */\r
-    public static CodeKeyMaker createActionsKeyMaker(short version) {\r
-        return new AbstractCodeKeyMaker(version) {\r
-            @Override\r
-            public MessageCodeKey make(ByteBuf input) {\r
-                int type = input.getUnsignedShort(input.readerIndex());\r
-                if (type == EncodeConstants.EXPERIMENTER_VALUE) {\r
-                    Long expId = input.getUnsignedInt(input.readerIndex()\r
-                            + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-                    return new ExperimenterActionDeserializerKey(getVersion(), expId);\r
-                }\r
-                ActionDeserializerKey actionDeserializerKey = new ActionDeserializerKey(getVersion(), type, null);\r
-                return actionDeserializerKey;\r
-            }\r
-        };\r
-    }\r
-\r
-    /**\r
-     * @param version\r
-     * @return\r
-     */\r
-    public static CodeKeyMaker createInstructionsKeyMaker(short version) {\r
-        return new AbstractCodeKeyMaker(version) {\r
-            @Override\r
-            public MessageCodeKey make(ByteBuf input) {\r
-                int type = input.getUnsignedShort(input.readerIndex());\r
-                if (type == EncodeConstants.EXPERIMENTER_VALUE) {\r
-                    Long expId = input.getUnsignedInt(input.readerIndex()\r
-                            + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
-                    return new ExperimenterInstructionDeserializerKey(getVersion(), expId);\r
-                }\r
-                return new InstructionDeserializerKey(getVersion(), type, null);\r
-            }\r
-        };\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class CodeKeyMakerFactory {
+
+    /**
+     * @param version
+     * @return
+     */
+    public static CodeKeyMaker createMatchEntriesKeyMaker(short version) {
+        return new AbstractCodeKeyMaker(version) {
+            @Override
+            public MessageCodeKey make(ByteBuf input) {
+                int oxmClass = input.getUnsignedShort(input.readerIndex());
+                int oxmField = input.getUnsignedByte(input.readerIndex()
+                        + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
+                MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(getVersion(),
+                        oxmClass, oxmField);
+                if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
+                    long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES
+                            + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+                    key.setExperimenterId(expId);
+                    return key;
+                }
+                key.setExperimenterId(null);
+                return key;
+            }
+        };
+    }
+
+    /**
+     * @param version
+     * @return
+     */
+    public static CodeKeyMaker createActionsKeyMaker(short version) {
+        return new AbstractCodeKeyMaker(version) {
+            @Override
+            public MessageCodeKey make(ByteBuf input) {
+                int type = input.getUnsignedShort(input.readerIndex());
+                if (type == EncodeConstants.EXPERIMENTER_VALUE) {
+                    Long expId = input.getUnsignedInt(input.readerIndex()
+                            + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+                    return new ExperimenterActionDeserializerKey(getVersion(), expId);
+                }
+                ActionDeserializerKey actionDeserializerKey = new ActionDeserializerKey(getVersion(), type, null);
+                return actionDeserializerKey;
+            }
+        };
+    }
+
+    /**
+     * @param version
+     * @return
+     */
+    public static CodeKeyMaker createInstructionsKeyMaker(short version) {
+        return new AbstractCodeKeyMaker(version) {
+            @Override
+            public MessageCodeKey make(ByteBuf input) {
+                int type = input.getUnsignedShort(input.readerIndex());
+                if (type == EncodeConstants.EXPERIMENTER_VALUE) {
+                    Long expId = input.getUnsignedInt(input.readerIndex()
+                            + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+                    return new ExperimenterInstructionDeserializerKey(getVersion(), expId);
+                }
+                return new InstructionDeserializerKey(getVersion(), type, null);
+            }
+        };
+    }
+}
index 0ce8d54e5eaeafa64ca3c12c49a504a0b1c22c17..35cfef7905fce00a4cf4ee6da5768354fba4265b 100644 (file)
@@ -1,39 +1,39 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class CommonMessageRegistryHelper {\r
-\r
-    private short version;\r
-    private SerializerRegistry serializerRegistry;\r
-\r
-    /**\r
-     * @param version\r
-     * @param serializerRegistry\r
-     */\r
-    public CommonMessageRegistryHelper(short version, SerializerRegistry serializerRegistry) {\r
-        this.version = version;\r
-        this.serializerRegistry = serializerRegistry;\r
-    }\r
-\r
-    /**\r
-     * @param msgType\r
-     * @param serializer\r
-     */\r
-    public void registerSerializer(Class<?> msgType, OFGeneralSerializer serializer) {\r
-        serializerRegistry.registerSerializer(new MessageTypeKey<>(version, msgType), serializer);\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class CommonMessageRegistryHelper {
+
+    private short version;
+    private SerializerRegistry serializerRegistry;
+
+    /**
+     * @param version
+     * @param serializerRegistry
+     */
+    public CommonMessageRegistryHelper(short version, SerializerRegistry serializerRegistry) {
+        this.version = version;
+        this.serializerRegistry = serializerRegistry;
+    }
+
+    /**
+     * @param msgType
+     * @param serializer
+     */
+    public void registerSerializer(Class<?> msgType, OFGeneralSerializer serializer) {
+        serializerRegistry.registerSerializer(new MessageTypeKey<>(version, msgType), serializer);
+    }
+}
index 2476c4e90a41e0f35d802506c73c552db46c7aa3..7d9479a12111f030ff89df246edccca088857b7c 100644 (file)
@@ -1,48 +1,48 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class InstructionConstants {\r
-\r
-    /** Openflow v1.3 OFPIT_GOTO_TABLE code */\r
-    public static final byte GOTO_TABLE_TYPE = 1;\r
-    /** Openflow v1.3 OFPIT_WRITE_METADATA code */\r
-    public static final byte WRITE_METADATA_TYPE = 2;\r
-    /** Openflow v1.3 OFPIT_WRITE_ACTIONS code */\r
-    public static final byte WRITE_ACTIONS_TYPE = 3;\r
-    /** Openflow v1.3 OFPIT_APPLY_ACTIONS code */\r
-    public static final byte APPLY_ACTIONS_TYPE = 4;\r
-    /** Openflow v1.3 OFPIT_CLEAR_ACTIONS code */\r
-    public static final byte CLEAR_ACTIONS_TYPE = 5;\r
-    /** Openflow v1.3 OFPIT_METER code */\r
-    public static final byte METER_TYPE = 6;\r
-\r
-    /** PADDING in OFPIT_GOTO_TABLE */\r
-    public static final byte PADDING_IN_GOTO_TABLE = 3;\r
-    /** PADDING in OFPIT_WRITE_METADATA */\r
-    public static final byte PADDING_IN_WRITE_METADATA = 4;\r
-    /** PADDING in OFPIT_WRITE_ACTIONS, OFPIT_APPLY_ACTIONS\r
-     *  and OFPIT_CLEAR_ACTIONS */\r
-    public static final byte PADDING_IN_ACTIONS_INSTRUCTION = 4;\r
-\r
-    /** Openflow v1.3 header length (padded) */\r
-    public static final byte STANDARD_INSTRUCTION_LENGTH = 8;\r
-    /** Openflow v1.3 OFPIT_WRITE_METADATA length */\r
-    public static final byte WRITE_METADATA_LENGTH = 24;\r
-    /** Openflow v1.3 header length (only type and length fields) */\r
-    public static final byte INSTRUCTION_IDS_LENGTH = 4;\r
-\r
-    private InstructionConstants() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class InstructionConstants {
+
+    /** Openflow v1.3 OFPIT_GOTO_TABLE code */
+    public static final byte GOTO_TABLE_TYPE = 1;
+    /** Openflow v1.3 OFPIT_WRITE_METADATA code */
+    public static final byte WRITE_METADATA_TYPE = 2;
+    /** Openflow v1.3 OFPIT_WRITE_ACTIONS code */
+    public static final byte WRITE_ACTIONS_TYPE = 3;
+    /** Openflow v1.3 OFPIT_APPLY_ACTIONS code */
+    public static final byte APPLY_ACTIONS_TYPE = 4;
+    /** Openflow v1.3 OFPIT_CLEAR_ACTIONS code */
+    public static final byte CLEAR_ACTIONS_TYPE = 5;
+    /** Openflow v1.3 OFPIT_METER code */
+    public static final byte METER_TYPE = 6;
+
+    /** PADDING in OFPIT_GOTO_TABLE */
+    public static final byte PADDING_IN_GOTO_TABLE = 3;
+    /** PADDING in OFPIT_WRITE_METADATA */
+    public static final byte PADDING_IN_WRITE_METADATA = 4;
+    /** PADDING in OFPIT_WRITE_ACTIONS, OFPIT_APPLY_ACTIONS
+     *  and OFPIT_CLEAR_ACTIONS */
+    public static final byte PADDING_IN_ACTIONS_INSTRUCTION = 4;
+
+    /** Openflow v1.3 header length (padded) */
+    public static final byte STANDARD_INSTRUCTION_LENGTH = 8;
+    /** Openflow v1.3 OFPIT_WRITE_METADATA length */
+    public static final byte WRITE_METADATA_LENGTH = 24;
+    /** Openflow v1.3 header length (only type and length fields) */
+    public static final byte INSTRUCTION_IDS_LENGTH = 4;
+
+    private InstructionConstants() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+}
index 2b4ea9dac124cf5584956ca9beeeea13ca8e6ccd..44a6a884fe741ce06d2eeaa4c140acc284334827 100644 (file)
@@ -1,42 +1,42 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class InstructionDeserializerRegistryHelper {\r
-\r
-    private short version;\r
-    private DeserializerRegistry registry;\r
-\r
-    /**\r
-     * @param version wire protocol version\r
-     * @param deserializerRegistry registry to be filled with message deserializers\r
-     */\r
-    public InstructionDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {\r
-        this.version = version;\r
-        this.registry = deserializerRegistry;\r
-    }\r
-\r
-    /**\r
-     * @param code code / value to distinguish between deserializers\r
-     * @param deserializer deserializer instance\r
-     * @param deserializedObjectClass class of object that will be deserialized\r
-     *  by given deserializer\r
-     */\r
-    public void registerDeserializer(int code, OFGeneralDeserializer deserializer) {\r
-        registry.registerDeserializer(new InstructionDeserializerKey(version, code,\r
-                null), deserializer);\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class InstructionDeserializerRegistryHelper {
+
+    private short version;
+    private DeserializerRegistry registry;
+
+    /**
+     * @param version wire protocol version
+     * @param deserializerRegistry registry to be filled with message deserializers
+     */
+    public InstructionDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {
+        this.version = version;
+        this.registry = deserializerRegistry;
+    }
+
+    /**
+     * @param code code / value to distinguish between deserializers
+     * @param deserializer deserializer instance
+     * @param deserializedObjectClass class of object that will be deserialized
+     *  by given deserializer
+     */
+    public void registerDeserializer(int code, OFGeneralDeserializer deserializer) {
+        registry.registerDeserializer(new InstructionDeserializerKey(version, code,
+                null), deserializer);
+    }
+}
index 3ee13cb8e9dbb1d6bba0154b41f66158bb59eb5a..f89fd0a1a6d853c9c8c8dfc97c4464b1213b43bc 100644 (file)
@@ -1,42 +1,42 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- */\r
-public class InstructionSerializerRegistryHelper {\r
-\r
-    private short version;\r
-    private SerializerRegistry serializerRegistry;\r
-\r
-    /**\r
-     * @param version Openflow wire version\r
-     * @param serializerRegistry\r
-     */\r
-    public InstructionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {\r
-        this.version = version;\r
-        this.serializerRegistry = serializerRegistry;\r
-    }\r
-\r
-    /**\r
-     * Registers given serializer\r
-     * @param instructionType \r
-     * @param serializer\r
-     */\r
-    public <TYPE extends InstructionBase> void registerSerializer(Class<TYPE> instructionType,\r
-            OFGeneralSerializer serializer) {\r
-        serializerRegistry.registerSerializer(new InstructionSerializerKey<>(version,\r
-                instructionType, null), serializer);\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
+
+/**
+ * @author michal.polkorab
+ */
+public class InstructionSerializerRegistryHelper {
+
+    private short version;
+    private SerializerRegistry serializerRegistry;
+
+    /**
+     * @param version Openflow wire version
+     * @param serializerRegistry
+     */
+    public InstructionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {
+        this.version = version;
+        this.serializerRegistry = serializerRegistry;
+    }
+
+    /**
+     * Registers given serializer
+     * @param instructionType 
+     * @param serializer
+     */
+    public <TYPE extends InstructionBase> void registerSerializer(Class<TYPE> instructionType,
+            OFGeneralSerializer serializer) {
+        serializerRegistry.registerSerializer(new InstructionSerializerKey<>(version,
+                instructionType, null), serializer);
+    }
 }
\ No newline at end of file
index 6e32f86fa712bc33292947794b3a6f7eb00dfcfc..93d3c3e282b616a3fffd41445ce81ec5a83e01ae 100644 (file)
@@ -1,78 +1,78 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public final class ListDeserializer {\r
-\r
-    private ListDeserializer() {\r
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");\r
-    }\r
-\r
-    /**\r
-     * Deserializes items into list\r
-     * @param version openflow wire version\r
-     * @param length length of list in ByteBuf (bytes)\r
-     * @param input input buffer\r
-     * @param keyMaker creates keys for deserializer lookup\r
-     * @param registry stores deserializers\r
-     * @return list of items\r
-     */\r
-    public static <E extends DataObject> List<E> deserializeList(short version, int length,\r
-            ByteBuf input, CodeKeyMaker keyMaker, DeserializerRegistry registry) {\r
-        List<E> items = null;\r
-        if (input.readableBytes() > 0) {\r
-            items = new ArrayList<>();\r
-            int startIndex = input.readerIndex();\r
-            while ((input.readerIndex() - startIndex) < length){\r
-                OFDeserializer<E> deserializer = registry.getDeserializer(keyMaker.make(input));\r
-                E item = deserializer.deserialize(input);\r
-                items.add(item);\r
-            }\r
-        }\r
-        return items;\r
-    }\r
-\r
-    /**\r
-     * Deserializes headers of items into list\r
-     * @param version openflow wire version\r
-     * @param length length of list in ByteBuf (bytes)\r
-     * @param input input buffer\r
-     * @param keyMaker creates keys for deserializer lookup\r
-     * @param registry stores deserializers\r
-     * @return list of items\r
-     */\r
-    public static <E extends DataObject> List<E> deserializeHeaders(short version, int length,\r
-            ByteBuf input, CodeKeyMaker keyMaker, DeserializerRegistry registry) {\r
-        List<E> items = null;\r
-        if (input.readableBytes() > 0) {\r
-            items = new ArrayList<>();\r
-            int startIndex = input.readerIndex();\r
-            while ((input.readerIndex() - startIndex) < length){\r
-                HeaderDeserializer<E> deserializer = registry.getDeserializer(keyMaker.make(input));\r
-                E item = deserializer.deserializeHeader(input);\r
-                items.add(item);\r
-            }\r
-        }\r
-        return items;\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public final class ListDeserializer {
+
+    private ListDeserializer() {
+        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
+    }
+
+    /**
+     * Deserializes items into list
+     * @param version openflow wire version
+     * @param length length of list in ByteBuf (bytes)
+     * @param input input buffer
+     * @param keyMaker creates keys for deserializer lookup
+     * @param registry stores deserializers
+     * @return list of items
+     */
+    public static <E extends DataObject> List<E> deserializeList(short version, int length,
+            ByteBuf input, CodeKeyMaker keyMaker, DeserializerRegistry registry) {
+        List<E> items = null;
+        if (input.readableBytes() > 0) {
+            items = new ArrayList<>();
+            int startIndex = input.readerIndex();
+            while ((input.readerIndex() - startIndex) < length){
+                OFDeserializer<E> deserializer = registry.getDeserializer(keyMaker.make(input));
+                E item = deserializer.deserialize(input);
+                items.add(item);
+            }
+        }
+        return items;
+    }
+
+    /**
+     * Deserializes headers of items into list
+     * @param version openflow wire version
+     * @param length length of list in ByteBuf (bytes)
+     * @param input input buffer
+     * @param keyMaker creates keys for deserializer lookup
+     * @param registry stores deserializers
+     * @return list of items
+     */
+    public static <E extends DataObject> List<E> deserializeHeaders(short version, int length,
+            ByteBuf input, CodeKeyMaker keyMaker, DeserializerRegistry registry) {
+        List<E> items = null;
+        if (input.readableBytes() > 0) {
+            items = new ArrayList<>();
+            int startIndex = input.readerIndex();
+            while ((input.readerIndex() - startIndex) < length){
+                HeaderDeserializer<E> deserializer = registry.getDeserializer(keyMaker.make(input));
+                E item = deserializer.deserializeHeader(input);
+                items.add(item);
+            }
+        }
+        return items;
+    }
+}
index 58a963525cd4bd532f557da792465b6d5b30cc0f..f085377f1bf80ff0e15a5e6e4ef29bef8e287124 100644 (file)
@@ -1,61 +1,61 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * Serializes list items and their headers\r
- * @author michal.polkorab\r
- * @param <E> \r
- */\r
-public abstract class ListSerializer {\r
-\r
-    /**\r
-     * Serializes item list\r
-     * @param list list of items to be serialized\r
-     * @param keyMaker creates key for registry lookup\r
-     * @param registry stores serializers\r
-     * @param outBuffer output buffer\r
-     */\r
-    public static <E extends DataObject> void serializeList(List<E> list,\r
-            TypeKeyMaker<E> keyMaker, SerializerRegistry registry, ByteBuf outBuffer) {\r
-        if (list != null) {\r
-            for (E item : list) {\r
-                OFSerializer<E> serializer = registry.getSerializer(keyMaker.make(item));\r
-                serializer.serialize(item, outBuffer);\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Serializes headers of items in list\r
-     * @param list list of items to be serialized\r
-     * @param keyMaker creates key for registry lookup\r
-     * @param registry stores serializers\r
-     * @param outBuffer output buffer\r
-     */\r
-    public static <E extends DataObject> void serializeHeaderList(List<E> list,\r
-            TypeKeyMaker<E> keyMaker, SerializerRegistry registry, ByteBuf outBuffer) {\r
-        if (list != null) {\r
-            for (E item : list) {\r
-                HeaderSerializer<E> serializer = registry.getSerializer(keyMaker.make(item));\r
-                serializer.serializeHeader(item, outBuffer);\r
-            }\r
-        }\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * Serializes list items and their headers
+ * @author michal.polkorab
+ * @param <E> 
+ */
+public abstract class ListSerializer {
+
+    /**
+     * Serializes item list
+     * @param list list of items to be serialized
+     * @param keyMaker creates key for registry lookup
+     * @param registry stores serializers
+     * @param outBuffer output buffer
+     */
+    public static <E extends DataObject> void serializeList(List<E> list,
+            TypeKeyMaker<E> keyMaker, SerializerRegistry registry, ByteBuf outBuffer) {
+        if (list != null) {
+            for (E item : list) {
+                OFSerializer<E> serializer = registry.getSerializer(keyMaker.make(item));
+                serializer.serialize(item, outBuffer);
+            }
+        }
+    }
+
+    /**
+     * Serializes headers of items in list
+     * @param list list of items to be serialized
+     * @param keyMaker creates key for registry lookup
+     * @param registry stores serializers
+     * @param outBuffer output buffer
+     */
+    public static <E extends DataObject> void serializeHeaderList(List<E> list,
+            TypeKeyMaker<E> keyMaker, SerializerRegistry registry, ByteBuf outBuffer) {
+        if (list != null) {
+            for (E item : list) {
+                HeaderSerializer<E> serializer = registry.getSerializer(keyMaker.make(item));
+                serializer.serializeHeader(item, outBuffer);
+            }
+        }
+    }
+
+}
index e9e1c10ef5ddbb864da303fa8d89306ad6336711..e666f11ebff668f8b15c7a0f25639e42f3895867 100644 (file)
@@ -1,47 +1,47 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MatchEntryDeserializerRegistryHelper {\r
-\r
-    private short version;\r
-    private DeserializerRegistry registry;\r
-    private int oxmClass;\r
-\r
-    /**\r
-     * @param version wire protocol version\r
-     * @param oxmClass oxm_class that will be used for match entry deserializer\r
-     *  registration\r
-     * @param deserializerRegistry registry to be filled with message deserializers\r
-     */\r
-    public MatchEntryDeserializerRegistryHelper(short version, int oxmClass,\r
-            DeserializerRegistry deserializerRegistry) {\r
-        this.version = version;\r
-        this.oxmClass = oxmClass;\r
-        this.registry = deserializerRegistry;\r
-    }\r
-\r
-    /**\r
-     * Registers match entry deserializer under provided oxmfield ()\r
-     * @param oxmField oxm_field value/code\r
-     * @param deserializer deserializer instance\r
-     */\r
-    public void register(int oxmField, OFGeneralDeserializer deserializer) {\r
-        MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(version, oxmClass, oxmField);\r
-        key.setExperimenterId(null);\r
-        registry.registerDeserializer(key, deserializer);\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MatchEntryDeserializerRegistryHelper {
+
+    private short version;
+    private DeserializerRegistry registry;
+    private int oxmClass;
+
+    /**
+     * @param version wire protocol version
+     * @param oxmClass oxm_class that will be used for match entry deserializer
+     *  registration
+     * @param deserializerRegistry registry to be filled with message deserializers
+     */
+    public MatchEntryDeserializerRegistryHelper(short version, int oxmClass,
+            DeserializerRegistry deserializerRegistry) {
+        this.version = version;
+        this.oxmClass = oxmClass;
+        this.registry = deserializerRegistry;
+    }
+
+    /**
+     * Registers match entry deserializer under provided oxmfield ()
+     * @param oxmField oxm_field value/code
+     * @param deserializer deserializer instance
+     */
+    public void register(int oxmField, OFGeneralDeserializer deserializer) {
+        MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(version, oxmClass, oxmField);
+        key.setExperimenterId(null);
+        registry.registerDeserializer(key, deserializer);
+    }
 }
\ No newline at end of file
index 0bbd6ab9532b07b575342b1b4173a7ac3b0997d4..e3f49e30661eb0e4be07420b660baca06810cd7a 100644 (file)
@@ -1,49 +1,49 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <OXM_CLASS> OXM class\r
- */\r
-public class MatchEntrySerializerRegistryHelper<OXM_CLASS extends OxmClassBase> {\r
-\r
-    private short version;\r
-    private Class<OXM_CLASS> generalClass;\r
-    private SerializerRegistry serializerRegistry;\r
-\r
-    /**\r
-     * @param version Openflow wire version\r
-     * @param generalClass\r
-     * @param serializerRegistry\r
-     */\r
-    public MatchEntrySerializerRegistryHelper(short version, Class<OXM_CLASS> generalClass,\r
-            SerializerRegistry serializerRegistry) {\r
-        this.version = version;\r
-        this.generalClass = generalClass;\r
-        this.serializerRegistry = serializerRegistry;\r
-    }\r
-\r
-    /**\r
-     * Registers given serializer\r
-     * @param specificClass \r
-     * @param serializer \r
-     */\r
-    public <OXM_FIELD extends MatchField> void registerSerializer(\r
-            Class<OXM_FIELD> specificClass, OFGeneralSerializer serializer) {\r
-        MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(version, generalClass, specificClass);\r
-        key.setExperimenterId(null);\r
-        serializerRegistry.registerSerializer(key, serializer);\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
+
+/**
+ * @author michal.polkorab
+ * @param <OXM_CLASS> OXM class
+ */
+public class MatchEntrySerializerRegistryHelper<OXM_CLASS extends OxmClassBase> {
+
+    private short version;
+    private Class<OXM_CLASS> generalClass;
+    private SerializerRegistry serializerRegistry;
+
+    /**
+     * @param version Openflow wire version
+     * @param generalClass
+     * @param serializerRegistry
+     */
+    public MatchEntrySerializerRegistryHelper(short version, Class<OXM_CLASS> generalClass,
+            SerializerRegistry serializerRegistry) {
+        this.version = version;
+        this.generalClass = generalClass;
+        this.serializerRegistry = serializerRegistry;
+    }
+
+    /**
+     * Registers given serializer
+     * @param specificClass 
+     * @param serializer 
+     */
+    public <OXM_FIELD extends MatchField> void registerSerializer(
+            Class<OXM_FIELD> specificClass, OFGeneralSerializer serializer) {
+        MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(version, generalClass, specificClass);
+        key.setExperimenterId(null);
+        serializerRegistry.registerSerializer(key, serializer);
+    }
+}
index 78f27eac865b1a2f7afbdf02836ed651dc5f5c80..9a608b2d103e8c246bdb2bff6ac73b3faaed057c 100644 (file)
@@ -1,76 +1,76 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;\r
-\r
-/**\r
- * Used for common structures translation / conversion\r
- * \r
- * @author michal.polkorab\r
- */\r
-public abstract class OpenflowUtils {\r
-\r
-    /**\r
-     * Creates PortState (OF v1.0) from input\r
-     * @param input value read from buffer\r
-     * @return port state\r
-     */\r
-    public static PortStateV10 createPortState(long input){\r
-        final Boolean psLinkDown = ((input) & (1<<0)) != 0;\r
-        final Boolean psBlocked = ((input) & (1<<1)) != 0;\r
-        final Boolean psLive = ((input) & (1<<2)) != 0;\r
-        final Boolean psStpListen = ((input) & (1<<8)) == 0;\r
-        final Boolean psStpLearn = ((input) & (1<<8)) != 0;\r
-        final Boolean psStpForward = ((input) & (1<<9)) != 0; // equals 2 << 8\r
-        final Boolean psStpBlock = (((input) & (1<<9)) != 0) && (((input) & (1<<8)) != 0); // equals 3 << 8\r
-        final Boolean psStpMask = ((input) & (1<<10)) != 0; // equals 4 << 8\r
-        return new PortStateV10(psBlocked, psLinkDown, psLive, psStpBlock, psStpForward, psStpLearn, psStpListen, psStpMask);\r
-    }\r
-\r
-    /**\r
-     * Creates PortConfig (OF v1.0) from input\r
-     * @param input value read from buffer\r
-     * @return port state\r
-     */\r
-    public static PortConfigV10 createPortConfig(long input){\r
-        final Boolean pcPortDown = ((input) & (1<<0)) != 0;\r
-        final Boolean pcNoStp = ((input) & (1<<1)) != 0;\r
-        final Boolean pcNoRecv = ((input) & (1<<2)) != 0;\r
-        final Boolean pcNoRecvStp = ((input) & (1<<3)) != 0;\r
-        final Boolean pcNoFlood = ((input) & (1<<4)) != 0;\r
-        final Boolean pcNoFwd  = ((input) & (1<<5)) != 0;\r
-        final Boolean pcNoPacketIn = ((input) & (1<<6)) != 0;\r
-        return new PortConfigV10(pcNoFlood, pcNoFwd, pcNoPacketIn, pcNoRecv, pcNoRecvStp, pcNoStp, pcPortDown);\r
-    }\r
-\r
-    /**\r
-     * Creates PortFeatures (OF v1.0) from input\r
-     * @param input value read from buffer\r
-     * @return port state\r
-     */\r
-    public static PortFeaturesV10 createPortFeatures(long input){\r
-        final Boolean pf10mbHd = ((input) & (1<<0)) != 0;\r
-        final Boolean pf10mbFd = ((input) & (1<<1)) != 0;\r
-        final Boolean pf100mbHd = ((input) & (1<<2)) != 0;\r
-        final Boolean pf100mbFd = ((input) & (1<<3)) != 0;\r
-        final Boolean pf1gbHd = ((input) & (1<<4)) != 0;\r
-        final Boolean pf1gbFd = ((input) & (1<<5)) != 0;\r
-        final Boolean pf10gbFd = ((input) & (1<<6)) != 0;\r
-        final Boolean pfCopper = ((input) & (1<<7)) != 0;\r
-        final Boolean pfFiber = ((input) & (1<<8)) != 0;\r
-        final Boolean pfAutoneg = ((input) & (1<<9)) != 0;\r
-        final Boolean pfPause = ((input) & (1<<10)) != 0;\r
-        final Boolean pfPauseAsym = ((input) & (1<<11)) != 0;\r
-        return new PortFeaturesV10(pf100mbFd, pf100mbHd, pf10gbFd, pf10mbFd, pf10mbHd,\r
-                pf1gbFd, pf1gbHd, pfAutoneg, pfCopper, pfFiber, pfPause, pfPauseAsym);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;
+
+/**
+ * Used for common structures translation / conversion
+ * 
+ * @author michal.polkorab
+ */
+public abstract class OpenflowUtils {
+
+    /**
+     * Creates PortState (OF v1.0) from input
+     * @param input value read from buffer
+     * @return port state
+     */
+    public static PortStateV10 createPortState(long input){
+        final Boolean psLinkDown = ((input) & (1<<0)) != 0;
+        final Boolean psBlocked = ((input) & (1<<1)) != 0;
+        final Boolean psLive = ((input) & (1<<2)) != 0;
+        final Boolean psStpListen = ((input) & (1<<8)) == 0;
+        final Boolean psStpLearn = ((input) & (1<<8)) != 0;
+        final Boolean psStpForward = ((input) & (1<<9)) != 0; // equals 2 << 8
+        final Boolean psStpBlock = (((input) & (1<<9)) != 0) && (((input) & (1<<8)) != 0); // equals 3 << 8
+        final Boolean psStpMask = ((input) & (1<<10)) != 0; // equals 4 << 8
+        return new PortStateV10(psBlocked, psLinkDown, psLive, psStpBlock, psStpForward, psStpLearn, psStpListen, psStpMask);
+    }
+
+    /**
+     * Creates PortConfig (OF v1.0) from input
+     * @param input value read from buffer
+     * @return port state
+     */
+    public static PortConfigV10 createPortConfig(long input){
+        final Boolean pcPortDown = ((input) & (1<<0)) != 0;
+        final Boolean pcNoStp = ((input) & (1<<1)) != 0;
+        final Boolean pcNoRecv = ((input) & (1<<2)) != 0;
+        final Boolean pcNoRecvStp = ((input) & (1<<3)) != 0;
+        final Boolean pcNoFlood = ((input) & (1<<4)) != 0;
+        final Boolean pcNoFwd  = ((input) & (1<<5)) != 0;
+        final Boolean pcNoPacketIn = ((input) & (1<<6)) != 0;
+        return new PortConfigV10(pcNoFlood, pcNoFwd, pcNoPacketIn, pcNoRecv, pcNoRecvStp, pcNoStp, pcPortDown);
+    }
+
+    /**
+     * Creates PortFeatures (OF v1.0) from input
+     * @param input value read from buffer
+     * @return port state
+     */
+    public static PortFeaturesV10 createPortFeatures(long input){
+        final Boolean pf10mbHd = ((input) & (1<<0)) != 0;
+        final Boolean pf10mbFd = ((input) & (1<<1)) != 0;
+        final Boolean pf100mbHd = ((input) & (1<<2)) != 0;
+        final Boolean pf100mbFd = ((input) & (1<<3)) != 0;
+        final Boolean pf1gbHd = ((input) & (1<<4)) != 0;
+        final Boolean pf1gbFd = ((input) & (1<<5)) != 0;
+        final Boolean pf10gbFd = ((input) & (1<<6)) != 0;
+        final Boolean pfCopper = ((input) & (1<<7)) != 0;
+        final Boolean pfFiber = ((input) & (1<<8)) != 0;
+        final Boolean pfAutoneg = ((input) & (1<<9)) != 0;
+        final Boolean pfPause = ((input) & (1<<10)) != 0;
+        final Boolean pfPauseAsym = ((input) & (1<<11)) != 0;
+        return new PortFeaturesV10(pf100mbFd, pf100mbHd, pf10gbFd, pf10mbFd, pf10mbHd,
+                pf1gbFd, pf1gbHd, pfAutoneg, pfCopper, pfFiber, pfPause, pfPauseAsym);
+    }
 }
\ No newline at end of file
index 0fc660835421ece6b210c2e1da381c61e2ab8912..7c9ec2b53bcf88e438d9771b715491bd9ab2dff5 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class SimpleDeserializerRegistryHelper {\r
-\r
-    private short version;\r
-    private DeserializerRegistry registry;\r
-\r
-    /**\r
-     * @param version wire protocol version\r
-     * @param deserializerRegistry registry to be filled with message deserializers\r
-     */\r
-    public SimpleDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {\r
-        this.version = version;\r
-        this.registry = deserializerRegistry;\r
-    }\r
-\r
-    /**\r
-     * @param code code / value to distinguish between deserializers\r
-     * @param experimenterID TODO\r
-     * @param deserializedObjectClass class of object that will be deserialized\r
-     *  by given deserializer\r
-     * @param deserializer deserializer instance\r
-     */\r
-    public void registerDeserializer(int code,\r
-            Long experimenterID, Class<?> deserializedObjectClass, OFGeneralDeserializer deserializer) {\r
-        registry.registerDeserializer(new MessageCodeKey(version, code,\r
-                deserializedObjectClass), deserializer);\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class SimpleDeserializerRegistryHelper {
+
+    private short version;
+    private DeserializerRegistry registry;
+
+    /**
+     * @param version wire protocol version
+     * @param deserializerRegistry registry to be filled with message deserializers
+     */
+    public SimpleDeserializerRegistryHelper(short version, DeserializerRegistry deserializerRegistry) {
+        this.version = version;
+        this.registry = deserializerRegistry;
+    }
+
+    /**
+     * @param code code / value to distinguish between deserializers
+     * @param experimenterID TODO
+     * @param deserializedObjectClass class of object that will be deserialized
+     *  by given deserializer
+     * @param deserializer deserializer instance
+     */
+    public void registerDeserializer(int code,
+            Long experimenterID, Class<?> deserializedObjectClass, OFGeneralDeserializer deserializer) {
+        registry.registerDeserializer(new MessageCodeKey(version, code,
+                deserializedObjectClass), deserializer);
+    }
+}
index a9dab19e0e028b2963c157689d7f9640304b09ae..02b0307b93959899dabb939f981360df573fe7bc 100644 (file)
@@ -1,26 +1,26 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @param <T> \r
- */\r
-public interface TypeKeyMaker<T> {\r
-\r
-    /**\r
-     * @param entry\r
-     * @return key that will be used for serializer lookup in \r
-     * the serializer registry\r
-     */\r
-    abstract MessageTypeKey<?> make(T entry);\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+
+/**
+ * @author michal.polkorab
+ * @param <T> 
+ */
+public interface TypeKeyMaker<T> {
+
+    /**
+     * @param entry
+     * @return key that will be used for serializer lookup in 
+     * the serializer registry
+     */
+    abstract MessageTypeKey<?> make(T entry);
+
+}
index 1d3875df7a6f7f36a55d29940fa8e4ee92341650..2c5b7def13768eb0ca2b572282163ac20c7b3723 100644 (file)
@@ -1,92 +1,92 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * Creates KeyMakers\r
- * @author michal.polkorab\r
- */\r
-public abstract class TypeKeyMakerFactory {\r
-\r
-    /**\r
-     * @param version openflow wire version that shall be used\r
-     *  in lookup key\r
-     * @return lookup key\r
-     */\r
-    public static TypeKeyMaker<MatchEntries> createMatchEntriesKeyMaker(short version) {\r
-        return new AbstractTypeKeyMaker<MatchEntries>(version) {\r
-            @Override\r
-            public MatchEntrySerializerKey<?, ?> make(MatchEntries entry) {\r
-                MatchEntrySerializerKey<?, ?> key;\r
-                key = new MatchEntrySerializerKey<>(getVersion(), entry.getOxmClass(),\r
-                        entry.getOxmMatchField());\r
-                if (entry.getOxmClass().equals(ExperimenterClass.class)) {\r
-                    key.setExperimenterId(entry.getAugmentation(ExperimenterIdMatchEntry.class)\r
-                            .getExperimenter().getValue());\r
-                    return key;\r
-                }\r
-                key.setExperimenterId(null);\r
-                return key;\r
-            }\r
-        };\r
-    }\r
-\r
-    /**\r
-     * @param version openflow wire version that shall be used\r
-     *  in lookup key\r
-     * @return lookup key\r
-     */\r
-    public static TypeKeyMaker<Action> createActionKeyMaker(short version) {\r
-        return new AbstractTypeKeyMaker<Action>(version) {\r
-            @Override\r
-            public MessageTypeKey<?> make(Action entry) {\r
-                if (entry.getType().equals(Experimenter.class)) {\r
-                    return new ExperimenterActionSerializerKey(getVersion(),\r
-                            entry.getAugmentation(ExperimenterIdAction.class).getExperimenter().getValue(), entry.getAugmentation(ExperimenterIdAction.class).getSubType());\r
-                }\r
-                return new ActionSerializerKey<>(getVersion(), entry.getType(), null);\r
-            }\r
-        };\r
-    }\r
-\r
-    /**\r
-     * @param version openflow wire version that shall be used\r
-     *  in lookup key\r
-     * @return lookup key\r
-     */\r
-    public static TypeKeyMaker<Instruction> createInstructionKeyMaker(short version) {\r
-        return new AbstractTypeKeyMaker<Instruction>(version) {\r
-            @Override\r
-            public MessageTypeKey<?> make(Instruction entry) {\r
-                if (entry.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common\r
-                        .instruction.rev130731.Experimenter.class)) {\r
-                    return new ExperimenterInstructionSerializerKey(getVersion(),\r
-                            entry.getAugmentation(ExperimenterIdInstruction.class)\r
-                            .getExperimenter().getValue());\r
-                }\r
-                return new InstructionSerializerKey<>(getVersion(), entry.getType(), null);\r
-            }\r
-        };\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * Creates KeyMakers
+ * @author michal.polkorab
+ */
+public abstract class TypeKeyMakerFactory {
+
+    /**
+     * @param version openflow wire version that shall be used
+     *  in lookup key
+     * @return lookup key
+     */
+    public static TypeKeyMaker<MatchEntries> createMatchEntriesKeyMaker(short version) {
+        return new AbstractTypeKeyMaker<MatchEntries>(version) {
+            @Override
+            public MatchEntrySerializerKey<?, ?> make(MatchEntries entry) {
+                MatchEntrySerializerKey<?, ?> key;
+                key = new MatchEntrySerializerKey<>(getVersion(), entry.getOxmClass(),
+                        entry.getOxmMatchField());
+                if (entry.getOxmClass().equals(ExperimenterClass.class)) {
+                    key.setExperimenterId(entry.getAugmentation(ExperimenterIdMatchEntry.class)
+                            .getExperimenter().getValue());
+                    return key;
+                }
+                key.setExperimenterId(null);
+                return key;
+            }
+        };
+    }
+
+    /**
+     * @param version openflow wire version that shall be used
+     *  in lookup key
+     * @return lookup key
+     */
+    public static TypeKeyMaker<Action> createActionKeyMaker(short version) {
+        return new AbstractTypeKeyMaker<Action>(version) {
+            @Override
+            public MessageTypeKey<?> make(Action entry) {
+                if (entry.getType().equals(Experimenter.class)) {
+                    return new ExperimenterActionSerializerKey(getVersion(),
+                            entry.getAugmentation(ExperimenterIdAction.class).getExperimenter().getValue(), entry.getAugmentation(ExperimenterIdAction.class).getSubType());
+                }
+                return new ActionSerializerKey<>(getVersion(), entry.getType(), null);
+            }
+        };
+    }
+
+    /**
+     * @param version openflow wire version that shall be used
+     *  in lookup key
+     * @return lookup key
+     */
+    public static TypeKeyMaker<Instruction> createInstructionKeyMaker(short version) {
+        return new AbstractTypeKeyMaker<Instruction>(version) {
+            @Override
+            public MessageTypeKey<?> make(Instruction entry) {
+                if (entry.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
+                        .instruction.rev130731.Experimenter.class)) {
+                    return new ExperimenterInstructionSerializerKey(getVersion(),
+                            entry.getAugmentation(ExperimenterIdInstruction.class)
+                            .getExperimenter().getValue());
+                }
+                return new InstructionSerializerKey<>(getVersion(), entry.getType(), null);
+            }
+        };
+    }
+}
index abf7695d6f93207ec64d0e349be96b9e40803f2a..0484ea83c0c4bc8953686960cfce1c71b67f93bd 100644 (file)
@@ -1,40 +1,40 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import java.util.Map;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class TypeToClassInitHelper {\r
-\r
-    private short version;\r
-    private Map<TypeToClassKey, Class<?>> messageClassMap;\r
-\r
-    /**\r
-     * Constructor\r
-     * @param version protocol wire version\r
-     * @param messageClassMap map which stores type to class mapping\r
-     */\r
-    public TypeToClassInitHelper(short version, Map<TypeToClassKey, \r
-            Class<?>> messageClassMap) {\r
-        this.version = version;\r
-        this.messageClassMap = messageClassMap;\r
-    }\r
-\r
-    /**\r
-     * Registers Class int the type to class mapping\r
-     * @param type code value for message type / class\r
-     * @param clazz corresponding code -> class\r
-     */\r
-    public void registerTypeToClass(short type, Class<?> clazz) {\r
-        messageClassMap.put(new TypeToClassKey(version, type), clazz);\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import java.util.Map;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class TypeToClassInitHelper {
+
+    private short version;
+    private Map<TypeToClassKey, Class<?>> messageClassMap;
+
+    /**
+     * Constructor
+     * @param version protocol wire version
+     * @param messageClassMap map which stores type to class mapping
+     */
+    public TypeToClassInitHelper(short version, Map<TypeToClassKey, 
+            Class<?>> messageClassMap) {
+        this.version = version;
+        this.messageClassMap = messageClassMap;
+    }
+
+    /**
+     * Registers Class int the type to class mapping
+     * @param type code value for message type / class
+     * @param clazz corresponding code -> class
+     */
+    public void registerTypeToClass(short type, Class<?> clazz) {
+        messageClassMap.put(new TypeToClassKey(version, type), clazz);
+    }
+}
index 098f932259dd7ae0d9ee41bf527d6463abe1e381..0f6b9cafb5f3e0319649a1a4ba739209ba643266 100644 (file)
@@ -1,57 +1,57 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class TypeToClassKey {\r
-\r
-    private short version;\r
-    private int type;\r
-\r
-    /**\r
-     * Constructor\r
-     * @param version wire protocol version\r
-     * @param type message type / code\r
-     */\r
-    public TypeToClassKey(short version, int type) {\r
-        this.version = version;\r
-        this.type = type;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = 1;\r
-        result = prime * result + type;\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (obj == null) {\r
-            return false;\r
-        }\r
-        if (getClass() != obj.getClass()) {\r
-            return false;\r
-        }\r
-        TypeToClassKey other = (TypeToClassKey) obj;\r
-        if (type != other.type) {\r
-            return false;\r
-        }\r
-        if (version != other.version) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class TypeToClassKey {
+
+    private short version;
+    private int type;
+
+    /**
+     * Constructor
+     * @param version wire protocol version
+     * @param type message type / code
+     */
+    public TypeToClassKey(short version, int type) {
+        this.version = version;
+        this.type = type;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + type;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        TypeToClassKey other = (TypeToClassKey) obj;
+        if (type != other.type) {
+            return false;
+        }
+        if (version != other.version) {
+            return false;
+        }
+        return true;
+    }
 }
\ No newline at end of file
index c5f187293b9e843a239f24dd0981aba7b9574ece..aea5890e3483fd2e2925cac3d1edc8496f60984d 100644 (file)
@@ -1,84 +1,84 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.statistics;\r
-\r
-import java.util.concurrent.atomic.AtomicLong;\r
-/**\r
- * Counts statistics\r
- * \r
- * @author madamjak\r
- */\r
-public class Counter {\r
-\r
-    private AtomicLong counterValue;\r
-    private AtomicLong counterLastReadValue;\r
-\r
-    /**\r
-     * Default constructor\r
-     */\r
-    public Counter() {\r
-        counterValue = new AtomicLong(0L);\r
-        counterLastReadValue = new AtomicLong(0L);\r
-    }\r
-\r
-    /**\r
-     * Increment current counter value\r
-     */\r
-    public void incrementCounter(){\r
-        counterValue.incrementAndGet();\r
-    }\r
-\r
-    /**\r
-     * return the last read value of counter. This value can be set during the reading of current counter value, \r
-     *      for detail see method getCounterValue(boolean modifyLastReadValue).\r
-     * @return the counterLastReadValue\r
-     */\r
-    public long getCounterLastReadValue() {\r
-        return counterLastReadValue.get();\r
-    }\r
-\r
-    /**\r
-     * get current value of counter and rewrite CounterLastReadValue by current value\r
-     * @return  the current value of counter\r
-     */\r
-    public long getCounterValue() {\r
-        return getCounterValue(true);\r
-    }\r
-\r
-    /**\r
-     * get current counter value\r
-     * @param modifyLastReadValue\r
-     *      true - CounterLastReadValue will be rewritten by current CounterValue\r
-     *      false - no change CounterLastReadValue\r
-     * @return the current value of counter\r
-     */\r
-    public long getCounterValue(boolean modifyLastReadValue) {\r
-        if(modifyLastReadValue){\r
-            counterLastReadValue.set(counterValue.get());\r
-        }\r
-        return counterValue.get();\r
-    }\r
-\r
-    /**\r
-     * set current counter value and CounterLastReadValue to 0 (zero)\r
-     */\r
-    public void reset(){\r
-        counterValue.set(0l);\r
-        counterLastReadValue.set(0l);\r
-    }\r
-\r
-    /**\r
-     * @return last and current count for specified statistic\r
-     */\r
-    public String getStat() {\r
-        long cntPrevVal = getCounterLastReadValue();\r
-        long cntCurValue = getCounterValue();\r
-        return String.format("+%d | %d",cntCurValue-cntPrevVal,cntCurValue);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.statistics;
+
+import java.util.concurrent.atomic.AtomicLong;
+/**
+ * Counts statistics
+ * 
+ * @author madamjak
+ */
+public class Counter {
+
+    private AtomicLong counterValue;
+    private AtomicLong counterLastReadValue;
+
+    /**
+     * Default constructor
+     */
+    public Counter() {
+        counterValue = new AtomicLong(0L);
+        counterLastReadValue = new AtomicLong(0L);
+    }
+
+    /**
+     * Increment current counter value
+     */
+    public void incrementCounter(){
+        counterValue.incrementAndGet();
+    }
+
+    /**
+     * return the last read value of counter. This value can be set during the reading of current counter value, 
+     *      for detail see method getCounterValue(boolean modifyLastReadValue).
+     * @return the counterLastReadValue
+     */
+    public long getCounterLastReadValue() {
+        return counterLastReadValue.get();
+    }
+
+    /**
+     * get current value of counter and rewrite CounterLastReadValue by current value
+     * @return  the current value of counter
+     */
+    public long getCounterValue() {
+        return getCounterValue(true);
+    }
+
+    /**
+     * get current counter value
+     * @param modifyLastReadValue
+     *      true - CounterLastReadValue will be rewritten by current CounterValue
+     *      false - no change CounterLastReadValue
+     * @return the current value of counter
+     */
+    public long getCounterValue(boolean modifyLastReadValue) {
+        if(modifyLastReadValue){
+            counterLastReadValue.set(counterValue.get());
+        }
+        return counterValue.get();
+    }
+
+    /**
+     * set current counter value and CounterLastReadValue to 0 (zero)
+     */
+    public void reset(){
+        counterValue.set(0l);
+        counterLastReadValue.set(0l);
+    }
+
+    /**
+     * @return last and current count for specified statistic
+     */
+    public String getStat() {
+        long cntPrevVal = getCounterLastReadValue();
+        long cntCurValue = getCounterValue();
+        return String.format("+%d | %d",cntCurValue-cntPrevVal,cntCurValue);
+    }
 }
\ No newline at end of file
index 0dd7faad41adb44eeb361d66ef68478b91918c71..b021745da2e923e37fc73403c1b68e12d07074a9 100644 (file)
@@ -1,53 +1,53 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.statistics;\r
-\r
-/**\r
- * Enumeration of events to be counted with StatisticsCounters\r
- * @author madamjak\r
- *\r
- */\r
-public enum CounterEventTypes {\r
-    /**\r
-     * enter message to OFJ and pass to downstream\r
-     */\r
-    DS_ENTERED_OFJAVA,\r
-    /**\r
-     * flow-mod is entered\r
-     */\r
-    DS_FLOW_MODS_ENTERED,\r
-    /**\r
-     * encode message successfully\r
-     */\r
-    DS_ENCODE_SUCCESS,\r
-    /**\r
-     * fail encode message\r
-     */\r
-    DS_ENCODE_FAIL,\r
-    /**\r
-     * flow-mod encoded and sent to downstream\r
-     */\r
-    DS_FLOW_MODS_SENT,\r
-    /**\r
-     * receive message and pass to upstream\r
-     */\r
-    US_RECEIVED_IN_OFJAVA,\r
-    /**\r
-     * decode message successfully\r
-     */\r
-    US_DECODE_SUCCESS,\r
-    /**\r
-     * fail decode message\r
-     */\r
-    US_DECODE_FAIL,\r
-    /**\r
-     * pass message to consumer (end of upstream)\r
-     */\r
-    US_MESSAGE_PASS;\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.statistics;
+
+/**
+ * Enumeration of events to be counted with StatisticsCounters
+ * @author madamjak
+ *
+ */
+public enum CounterEventTypes {
+    /**
+     * enter message to OFJ and pass to downstream
+     */
+    DS_ENTERED_OFJAVA,
+    /**
+     * flow-mod is entered
+     */
+    DS_FLOW_MODS_ENTERED,
+    /**
+     * encode message successfully
+     */
+    DS_ENCODE_SUCCESS,
+    /**
+     * fail encode message
+     */
+    DS_ENCODE_FAIL,
+    /**
+     * flow-mod encoded and sent to downstream
+     */
+    DS_FLOW_MODS_SENT,
+    /**
+     * receive message and pass to upstream
+     */
+    US_RECEIVED_IN_OFJAVA,
+    /**
+     * decode message successfully
+     */
+    US_DECODE_SUCCESS,
+    /**
+     * fail decode message
+     */
+    US_DECODE_FAIL,
+    /**
+     * pass message to consumer (end of upstream)
+     */
+    US_MESSAGE_PASS;
 }
\ No newline at end of file
index 75e1faac930a58477cb72dce459628a5d5edc4b7..fff5292a6d4d9147663c0b4e47dc199fe2604a01 100644 (file)
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">\r
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">\r
-\r
-    <appender name="console" class="org.apache.log4j.ConsoleAppender">\r
-        <layout class="org.apache.log4j.PatternLayout">\r
-            <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />\r
-        </layout>\r
-    </appender>\r
-\r
-    <logger name="org.opendaylight.openflowjava.statistics" additivity="false">\r
-        <level value="DEBUG" />\r
-        <appender-ref ref="console" />\r
-    </logger>\r
-    <logger name="org.opendaylight.openflowjava.protocol.impl" additivity="false">\r
-        <level value="DEBUG" />\r
-        <appender-ref ref="console" />\r
-    </logger>\r
-    <logger name="org.opendaylight.openflowjava.protocol.impl.clients" additivity="false">\r
-        <level value="DEBUG" />\r
-        <appender-ref ref="console" />\r
-    </logger>\r
-\r
-    <root>\r
-        <priority value="INFO" />\r
-        <appender-ref ref="console" />\r
-    </root>\r
-</log4j:configuration>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+    <appender name="console" class="org.apache.log4j.ConsoleAppender">
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />
+        </layout>
+    </appender>
+
+    <logger name="org.opendaylight.openflowjava.statistics" additivity="false">
+        <level value="DEBUG" />
+        <appender-ref ref="console" />
+    </logger>
+    <logger name="org.opendaylight.openflowjava.protocol.impl" additivity="false">
+        <level value="DEBUG" />
+        <appender-ref ref="console" />
+    </logger>
+    <logger name="org.opendaylight.openflowjava.protocol.impl.clients" additivity="false">
+        <level value="DEBUG" />
+        <appender-ref ref="console" />
+    </logger>
+
+    <root>
+        <priority value="INFO" />
+        <appender-ref ref="console" />
+    </root>
+</log4j:configuration>
index 3baeb944d28e871f94e58c4027f61d61d25c1288..7ab8bfcc758f75700a97237d662c88e7886548e4 100644 (file)
@@ -1,88 +1,88 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core;\r
-\r
-import static org.mockito.Mockito.times;\r
-import static org.mockito.Mockito.verify;\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.util.concurrent.Future;\r
-import io.netty.util.concurrent.GenericFutureListener;\r
-\r
-import java.net.InetSocketAddress;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.UdpMessageListenerWrapper;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OFDatagramPacketEncoderTest {\r
-\r
-    @Mock ChannelHandlerContext ctx;\r
-    @Mock GenericFutureListener<Future<Void>> listener;\r
-    @Mock SerializationFactory factory;\r
-\r
-    private UdpMessageListenerWrapper wrapper;\r
-    private InetSocketAddress address = new InetSocketAddress("10.0.0.1", 6653);\r
-    private List<Object> out;\r
-\r
-    /**\r
-     * Initializes mocks and other objects\r
-     * @param version openflow protocol wire version\r
-     */\r
-    public void startUp(Short version) {\r
-        MockitoAnnotations.initMocks(this);\r
-        out = new ArrayList<>();\r
-        HelloInputBuilder builder = new HelloInputBuilder();\r
-        builder.setVersion(version);\r
-        HelloInput hello = builder.build();\r
-        wrapper = new UdpMessageListenerWrapper(hello, listener, address);\r
-    }\r
-\r
-    /**\r
-     * Tests encoding\r
-     */\r
-    @Test\r
-    public void testCorrectEncode() {\r
-        startUp((short) EncodeConstants.OF13_VERSION_ID);\r
-        OFDatagramPacketEncoder encoder = new OFDatagramPacketEncoder();\r
-        encoder.setSerializationFactory(factory);\r
-        try {\r
-            encoder.encode(ctx, wrapper, out);\r
-        } catch (Exception e) {\r
-            Assert.fail();\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Tests encoding\r
-     */\r
-    @Test\r
-    public void testIncorrectEncode() {\r
-        startUp(null);\r
-        OFDatagramPacketEncoder encoder = new OFDatagramPacketEncoder();\r
-        encoder.setSerializationFactory(factory);\r
-        try {\r
-            encoder.encode(ctx, wrapper, out);\r
-        } catch (Exception e) {\r
-            verify(wrapper, times(1)).getListener();\r
-            Assert.assertEquals("List should be empty", 0, out.size());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.util.concurrent.Future;
+import io.netty.util.concurrent.GenericFutureListener;
+
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.UdpMessageListenerWrapper;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OFDatagramPacketEncoderTest {
+
+    @Mock ChannelHandlerContext ctx;
+    @Mock GenericFutureListener<Future<Void>> listener;
+    @Mock SerializationFactory factory;
+
+    private UdpMessageListenerWrapper wrapper;
+    private InetSocketAddress address = new InetSocketAddress("10.0.0.1", 6653);
+    private List<Object> out;
+
+    /**
+     * Initializes mocks and other objects
+     * @param version openflow protocol wire version
+     */
+    public void startUp(Short version) {
+        MockitoAnnotations.initMocks(this);
+        out = new ArrayList<>();
+        HelloInputBuilder builder = new HelloInputBuilder();
+        builder.setVersion(version);
+        HelloInput hello = builder.build();
+        wrapper = new UdpMessageListenerWrapper(hello, listener, address);
+    }
+
+    /**
+     * Tests encoding
+     */
+    @Test
+    public void testCorrectEncode() {
+        startUp((short) EncodeConstants.OF13_VERSION_ID);
+        OFDatagramPacketEncoder encoder = new OFDatagramPacketEncoder();
+        encoder.setSerializationFactory(factory);
+        try {
+            encoder.encode(ctx, wrapper, out);
+        } catch (Exception e) {
+            Assert.fail();
+        }
+    }
+
+    /**
+     * Tests encoding
+     */
+    @Test
+    public void testIncorrectEncode() {
+        startUp(null);
+        OFDatagramPacketEncoder encoder = new OFDatagramPacketEncoder();
+        encoder.setSerializationFactory(factory);
+        try {
+            encoder.encode(ctx, wrapper, out);
+        } catch (Exception e) {
+            verify(wrapper, times(1)).getListener();
+            Assert.assertEquals("List should be empty", 0, out.size());
+        }
+    }
 }
\ No newline at end of file
index cf50b62693cf56104ae4ccd93d73b531e9ff6e9f..0b001d9b3c202b428a008b6c3dc226e3cffa33b0 100644 (file)
@@ -1,55 +1,55 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core.connection;\r
-\r
-import io.netty.channel.Channel;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ChannelOutboundQueue;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ChannelOutboundQueueTest {\r
-\r
-    @Mock Channel channel;\r
-\r
-    /**\r
-     * Initialize mocks\r
-     */\r
-    public ChannelOutboundQueueTest() {\r
-        MockitoAnnotations.initMocks(this);\r
-    }\r
-\r
-    /**\r
-     * Test incorrect queue creation handling\r
-     */\r
-    @Test(expected=IllegalArgumentException.class)\r
-    public void testIncorrectQueueCreation() {\r
-        new ChannelOutboundQueue(channel, 0, null);\r
-    }\r
-\r
-    /**\r
-     * Test correct enqueue handling\r
-     */\r
-    @Test\r
-    public void testEnqueue() {\r
-        ChannelOutboundQueue queue = new ChannelOutboundQueue(channel, 1, null);\r
-        boolean enqueued;\r
-        enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));\r
-        Assert.assertTrue("Enqueue problem", enqueued);\r
-        enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));\r
-        Assert.assertFalse("Enqueue problem", enqueued);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core.connection;
+
+import io.netty.channel.Channel;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ChannelOutboundQueue;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ChannelOutboundQueueTest {
+
+    @Mock Channel channel;
+
+    /**
+     * Initialize mocks
+     */
+    public ChannelOutboundQueueTest() {
+        MockitoAnnotations.initMocks(this);
+    }
+
+    /**
+     * Test incorrect queue creation handling
+     */
+    @Test(expected=IllegalArgumentException.class)
+    public void testIncorrectQueueCreation() {
+        new ChannelOutboundQueue(channel, 0, null);
+    }
+
+    /**
+     * Test correct enqueue handling
+     */
+    @Test
+    public void testEnqueue() {
+        ChannelOutboundQueue queue = new ChannelOutboundQueue(channel, 1, null);
+        boolean enqueued;
+        enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));
+        Assert.assertTrue("Enqueue problem", enqueued);
+        enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));
+        Assert.assertFalse("Enqueue problem", enqueued);
+    }
 }
\ No newline at end of file
index 77d9e912de57f32df9273365e1c9227f1b18f9e8..c9f52772c3dbb6534c51c5bc1c9e82b6e1cad1d6 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core.connection;\r
-\r
-import static org.mockito.Matchers.any;\r
-import static org.mockito.Mockito.times;\r
-import static org.mockito.Mockito.verify;\r
-import static org.mockito.Mockito.when;\r
-import io.netty.channel.ChannelFuture;\r
-import io.netty.channel.ChannelPipeline;\r
-import io.netty.channel.socket.SocketChannel;\r
-\r
-import java.net.InetSocketAddress;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.api.connection.ConnectionReadyListener;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.RpcResponseKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolListener;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEventBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEvent;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEventBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-import com.google.common.cache.Cache;\r
-import com.google.common.cache.CacheBuilder;\r
-import com.google.common.cache.RemovalListener;\r
-import com.google.common.cache.RemovalNotification;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @author madamjak\r
- *\r
- */\r
-public class ConnectionAdapterImplTest {\r
-\r
-    private static final int RPC_RESPONSE_EXPIRATION = 1;\r
-    private static final RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>> REMOVAL_LISTENER =\r
-            new RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>>() {\r
-        @Override\r
-        public void onRemoval(\r
-                final RemovalNotification<RpcResponseKey, ResponseExpectedRpcListener<?>> notification) {\r
-            notification.getValue().discard();\r
-        }\r
-    };\r
-\r
-    @Mock SocketChannel channel;\r
-    @Mock ChannelPipeline pipeline;\r
-    @Mock OpenflowProtocolListener messageListener;\r
-    @Mock SystemNotificationsListener systemListener;\r
-    @Mock ConnectionReadyListener readyListener;\r
-    @Mock Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> mockCache;\r
-    @Mock ChannelFuture channelFuture;\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 
-    private ConnectionAdapterImpl adapter;\r
-    private Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> cache;\r
-\r
-    /**\r
-     * Initializes ConnectionAdapter\r
-     */\r
-    @Before\r
-    public void setUp() {\r
-        MockitoAnnotations.initMocks(this);\r
-        when(channel.pipeline()).thenReturn(pipeline);\r
-        adapter = new ConnectionAdapterImpl(channel, InetSocketAddress.createUnresolved("10.0.0.1", 6653));\r
-        adapter.setMessageListener(messageListener);\r
-        adapter.setSystemListener(systemListener);\r
-        adapter.setConnectionReadyListener(readyListener);\r
-        cache = CacheBuilder.newBuilder().concurrencyLevel(1).expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)\r
-                .removalListener(REMOVAL_LISTENER).build();\r
+package org.opendaylight.openflowjava.protocol.impl.core.connection;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.socket.SocketChannel;
+
+import java.net.InetSocketAddress;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.connection.ConnectionReadyListener;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterImpl;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.RpcResponseKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEventBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEvent;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEventBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
+
+/**
+ * @author michal.polkorab
+ * @author madamjak
+ *
+ */
+public class ConnectionAdapterImplTest {
+
+    private static final int RPC_RESPONSE_EXPIRATION = 1;
+    private static final RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>> REMOVAL_LISTENER =
+            new RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>>() {
+        @Override
+        public void onRemoval(
+                final RemovalNotification<RpcResponseKey, ResponseExpectedRpcListener<?>> notification) {
+            notification.getValue().discard();
+        }
+    };
+
+    @Mock SocketChannel channel;
+    @Mock ChannelPipeline pipeline;
+    @Mock OpenflowProtocolListener messageListener;
+    @Mock SystemNotificationsListener systemListener;
+    @Mock ConnectionReadyListener readyListener;
+    @Mock Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> mockCache;
+    @Mock ChannelFuture channelFuture;
+
+    private ConnectionAdapterImpl adapter;
+    private Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> cache;
+
+    /**
+     * Initializes ConnectionAdapter
+     */
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        when(channel.pipeline()).thenReturn(pipeline);
+        adapter = new ConnectionAdapterImpl(channel, InetSocketAddress.createUnresolved("10.0.0.1", 6653));
+        adapter.setMessageListener(messageListener);
+        adapter.setSystemListener(systemListener);
+        adapter.setConnectionReadyListener(readyListener);
+        cache = CacheBuilder.newBuilder().concurrencyLevel(1).expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)
+                .removalListener(REMOVAL_LISTENER).build();
         adapter.setResponseCache(cache);
         when(channel.disconnect()).thenReturn(channelFuture);
-    }\r
-\r
-    /**\r
-     * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with notifications\r
-     */\r
-    @Test\r
-    public void testConsume() {\r
-        DataObject message = new EchoRequestMessageBuilder().build();\r
-        adapter.consume(message);\r
-        verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);\r
-        message = new ErrorMessageBuilder().build();\r
-        adapter.consume(message);\r
-        verify(messageListener, times(1)).onErrorMessage((ErrorMessage) message);\r
-        message = new ExperimenterMessageBuilder().build();\r
-        adapter.consume(message);\r
-        verify(messageListener, times(1)).onExperimenterMessage((ExperimenterMessage) message);\r
-        message = new FlowRemovedMessageBuilder().build();\r
-        adapter.consume(message);\r
-        verify(messageListener, times(1)).onFlowRemovedMessage((FlowRemovedMessage) message);\r
-        message = new HelloMessageBuilder().build();\r
-        adapter.consume(message);\r
-        verify(messageListener, times(1)).onHelloMessage((HelloMessage) message);\r
-        message = new MultipartReplyMessageBuilder().build();\r
-        adapter.consume(message);\r
-        verify(messageListener, times(1)).onMultipartReplyMessage((MultipartReplyMessage) message);\r
-        message = new PacketInMessageBuilder().build();\r
-        adapter.consume(message);\r
-        verify(messageListener, times(1)).onPacketInMessage((PacketInMessage) message);\r
-        message = new PortStatusMessageBuilder().build();\r
-        adapter.consume(message);\r
-        verify(messageListener, times(1)).onPortStatusMessage((PortStatusMessage) message);\r
-        message = new SwitchIdleEventBuilder().build();\r
-        adapter.consume(message);\r
-        verify(systemListener, times(1)).onSwitchIdleEvent((SwitchIdleEvent) message);\r
-        message = new DisconnectEventBuilder().build();\r
-        adapter.consume(message);\r
-        verify(systemListener, times(1)).onDisconnectEvent((DisconnectEvent) message);\r
-        message = new EchoRequestMessageBuilder().build();\r
-        adapter.consume(message);\r
-        verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);\r
-    }\r
-\r
-    /**\r
-     * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with unexpected rpc\r
-     */\r
-    @Test\r
-    public void testConsume2() {\r
-        adapter.setResponseCache(mockCache);\r
-        BarrierOutputBuilder barrierBuilder = new BarrierOutputBuilder();\r
-        barrierBuilder.setXid(42L);\r
-        BarrierOutput barrier = barrierBuilder.build();\r
-        adapter.consume(barrier);\r
-        verify(mockCache, times(1)).getIfPresent(any(RpcResponseKey.class));\r
-    }\r
-\r
-    /**\r
-     * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with expected rpc\r
-     */\r
-    @Test\r
-    public void testConsume3() {\r
-        BarrierInputBuilder inputBuilder = new BarrierInputBuilder();\r
-        inputBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);\r
-        inputBuilder.setXid(42L);\r
-        BarrierInput barrierInput = inputBuilder.build();\r
-        RpcResponseKey key = new RpcResponseKey(42L, "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput");\r
-        ResponseExpectedRpcListener<OfHeader> listener = new ResponseExpectedRpcListener<>(barrierInput,\r
-                "failure", mockCache, key);\r
-        cache.put(key, listener);\r
-        BarrierOutputBuilder barrierBuilder = new BarrierOutputBuilder();\r
-        barrierBuilder.setXid(42L);\r
-        BarrierOutput barrierOutput = barrierBuilder.build();\r
-        adapter.consume(barrierOutput);\r
-        ResponseExpectedRpcListener<?> ifPresent = cache.getIfPresent(key);\r
-        Assert.assertNull("Listener was not discarded", ifPresent);\r
+    }
+
+    /**
+     * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with notifications
+     */
+    @Test
+    public void testConsume() {
+        DataObject message = new EchoRequestMessageBuilder().build();
+        adapter.consume(message);
+        verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);
+        message = new ErrorMessageBuilder().build();
+        adapter.consume(message);
+        verify(messageListener, times(1)).onErrorMessage((ErrorMessage) message);
+        message = new ExperimenterMessageBuilder().build();
+        adapter.consume(message);
+        verify(messageListener, times(1)).onExperimenterMessage((ExperimenterMessage) message);
+        message = new FlowRemovedMessageBuilder().build();
+        adapter.consume(message);
+        verify(messageListener, times(1)).onFlowRemovedMessage((FlowRemovedMessage) message);
+        message = new HelloMessageBuilder().build();
+        adapter.consume(message);
+        verify(messageListener, times(1)).onHelloMessage((HelloMessage) message);
+        message = new MultipartReplyMessageBuilder().build();
+        adapter.consume(message);
+        verify(messageListener, times(1)).onMultipartReplyMessage((MultipartReplyMessage) message);
+        message = new PacketInMessageBuilder().build();
+        adapter.consume(message);
+        verify(messageListener, times(1)).onPacketInMessage((PacketInMessage) message);
+        message = new PortStatusMessageBuilder().build();
+        adapter.consume(message);
+        verify(messageListener, times(1)).onPortStatusMessage((PortStatusMessage) message);
+        message = new SwitchIdleEventBuilder().build();
+        adapter.consume(message);
+        verify(systemListener, times(1)).onSwitchIdleEvent((SwitchIdleEvent) message);
+        message = new DisconnectEventBuilder().build();
+        adapter.consume(message);
+        verify(systemListener, times(1)).onDisconnectEvent((DisconnectEvent) message);
+        message = new EchoRequestMessageBuilder().build();
+        adapter.consume(message);
+        verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);
+    }
+
+    /**
+     * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with unexpected rpc
+     */
+    @Test
+    public void testConsume2() {
+        adapter.setResponseCache(mockCache);
+        BarrierOutputBuilder barrierBuilder = new BarrierOutputBuilder();
+        barrierBuilder.setXid(42L);
+        BarrierOutput barrier = barrierBuilder.build();
+        adapter.consume(barrier);
+        verify(mockCache, times(1)).getIfPresent(any(RpcResponseKey.class));
+    }
+
+    /**
+     * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with expected rpc
+     */
+    @Test
+    public void testConsume3() {
+        BarrierInputBuilder inputBuilder = new BarrierInputBuilder();
+        inputBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
+        inputBuilder.setXid(42L);
+        BarrierInput barrierInput = inputBuilder.build();
+        RpcResponseKey key = new RpcResponseKey(42L, "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput");
+        ResponseExpectedRpcListener<OfHeader> listener = new ResponseExpectedRpcListener<>(barrierInput,
+                "failure", mockCache, key);
+        cache.put(key, listener);
+        BarrierOutputBuilder barrierBuilder = new BarrierOutputBuilder();
+        barrierBuilder.setXid(42L);
+        BarrierOutput barrierOutput = barrierBuilder.build();
+        adapter.consume(barrierOutput);
+        ResponseExpectedRpcListener<?> ifPresent = cache.getIfPresent(key);
+        Assert.assertNull("Listener was not discarded", ifPresent);
     }
     /**
      * Test IsAlive method
index 18992b6263f3ccfed7c971c67363c9e15a594059..3be4ba4f38bbb42ad991d536d6850cbeb673d5c1 100644 (file)
@@ -1,36 +1,36 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core.connection;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageListenerWrapper;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MessageListenerWrapperTest {\r
-\r
-    /**\r
-     * Test MessageListenerWrapper creation\r
-     */\r
-    @Test\r
-    public void test() {\r
-        HelloInputBuilder builder = new HelloInputBuilder();\r
-        HelloInput hello = builder.build();\r
-        SimpleRpcListener listener = new SimpleRpcListener(hello, "Error");\r
-        MessageListenerWrapper wrapper = new MessageListenerWrapper(hello, listener);\r
-        Assert.assertEquals("Wrong message", hello, wrapper.getMsg());\r
-        Assert.assertEquals("Wrong listener", listener, wrapper.getListener());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core.connection;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageListenerWrapper;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MessageListenerWrapperTest {
+
+    /**
+     * Test MessageListenerWrapper creation
+     */
+    @Test
+    public void test() {
+        HelloInputBuilder builder = new HelloInputBuilder();
+        HelloInput hello = builder.build();
+        SimpleRpcListener listener = new SimpleRpcListener(hello, "Error");
+        MessageListenerWrapper wrapper = new MessageListenerWrapper(hello, listener);
+        Assert.assertEquals("Wrong message", hello, wrapper.getMsg());
+        Assert.assertEquals("Wrong listener", listener, wrapper.getListener());
+    }
 }
\ No newline at end of file
index 32b6b93189c4a187a8691a762d129fcdbdeeac90..ec57cb8f738f37a892493adb0e492ee5191ec172 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core.connection;\r
-\r
-import static org.junit.Assert.fail;\r
-\r
-import java.util.Collections;\r
-import java.util.concurrent.ExecutionException;\r
-import java.util.concurrent.TimeUnit;\r
-import java.util.concurrent.TimeoutException;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.controller.sal.common.util.Rpcs;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.AbstractRpcListener;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.RpcResponseKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;\r
-import org.opendaylight.yangtools.yang.common.RpcError;\r
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;\r
-import org.opendaylight.yangtools.yang.common.RpcResult;\r
-\r
-import com.google.common.cache.Cache;\r
-import com.google.common.cache.CacheBuilder;\r
-import com.google.common.cache.RemovalListener;\r
-import com.google.common.cache.RemovalNotification;\r
-import com.google.common.util.concurrent.SettableFuture;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ResponseExpectedRpcListenerTest {\r
-\r
-    private static final RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>> REMOVAL_LISTENER =\r
-            new RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>>() {\r
-        @Override\r
-        public void onRemoval(\r
-                final RemovalNotification<RpcResponseKey, ResponseExpectedRpcListener<?>> notification) {\r
-            notification.getValue().discard();\r
-        }\r
-    };\r
-    private static final int RPC_RESPONSE_EXPIRATION = 1;\r
-    private Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> responseCache  = CacheBuilder.newBuilder()\r
-            .concurrencyLevel(1)\r
-            .expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)\r
-            .removalListener(REMOVAL_LISTENER).build();\r
-\r
-    /**\r
-     * Test object creation\r
-     */\r
-    @Test(expected=NullPointerException.class)\r
-    public void testCreation() {\r
-        RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());\r
-        new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", null, key);\r
-    }\r
-\r
-    /**\r
-     * Test object creation\r
-     */\r
-    @Test(expected=NullPointerException.class)\r
-    public void testCreation2() {\r
-        new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, null);\r
-    }\r
-\r
-    /**\r
-     * Test object creation\r
-     */\r
-    @Test\r
-    public void testDiscard() {\r
-        RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());\r
-        ResponseExpectedRpcListener<OfHeader> listener =\r
-                new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);\r
-        listener.discard();\r
-        RpcError rpcError = AbstractRpcListener.buildRpcError("Failed to send message",\r
-                ErrorSeverity.ERROR, "check switch connection", new TimeoutException("Request timed out"));\r
-        SettableFuture<RpcResult<?>> result = SettableFuture.create();\r
-        result.set(Rpcs.getRpcResult(false, null, Collections.singletonList(rpcError)));\r
-        try {\r
-            Assert.assertEquals("Wrong result", result.get().getErrors().iterator().next().getMessage(),\r
-                    listener.getResult().get().getErrors().iterator().next().getMessage());\r
-            Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());\r
-            Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());\r
-        } catch (InterruptedException | ExecutionException e) {\r
-            fail("Problem accessing result");\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Test object creation\r
-     */\r
-    @Test\r
-    public void testCompleted() {\r
-        RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());\r
-        ResponseExpectedRpcListener<OfHeader> listener =\r
-                new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);\r
-        BarrierInputBuilder barrierBuilder = new BarrierInputBuilder();\r
-        BarrierInput barrierInput = barrierBuilder.build();\r
-        listener.completed(barrierInput);\r
-        SettableFuture<RpcResult<?>> result = SettableFuture.create();\r
-        result.set(Rpcs.getRpcResult(true, barrierInput, Collections.<RpcError>emptyList()));\r
-        try {\r
-            Assert.assertEquals("Wrong result", result.get().getErrors(), listener.getResult().get().getErrors());\r
-            Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());\r
-            Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());\r
-        } catch (InterruptedException | ExecutionException e) {\r
-            fail("Problem accessing result");\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Test object creation\r
-     */\r
-    @Test\r
-    public void testOperationSuccessful() {\r
-        RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());\r
-        ResponseExpectedRpcListener<OfHeader> listener =\r
-                new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);\r
-        listener.operationSuccessful();\r
-        ResponseExpectedRpcListener<?> present = responseCache.getIfPresent(key);\r
-        Assert.assertEquals(present, listener);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core.connection;
+
+import static org.junit.Assert.fail;
+
+import java.util.Collections;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.AbstractRpcListener;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.RpcResponseKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
+import com.google.common.util.concurrent.SettableFuture;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ResponseExpectedRpcListenerTest {
+
+    private static final RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>> REMOVAL_LISTENER =
+            new RemovalListener<RpcResponseKey, ResponseExpectedRpcListener<?>>() {
+        @Override
+        public void onRemoval(
+                final RemovalNotification<RpcResponseKey, ResponseExpectedRpcListener<?>> notification) {
+            notification.getValue().discard();
+        }
+    };
+    private static final int RPC_RESPONSE_EXPIRATION = 1;
+    private Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> responseCache  = CacheBuilder.newBuilder()
+            .concurrencyLevel(1)
+            .expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)
+            .removalListener(REMOVAL_LISTENER).build();
+
+    /**
+     * Test object creation
+     */
+    @Test(expected=NullPointerException.class)
+    public void testCreation() {
+        RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());
+        new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", null, key);
+    }
+
+    /**
+     * Test object creation
+     */
+    @Test(expected=NullPointerException.class)
+    public void testCreation2() {
+        new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, null);
+    }
+
+    /**
+     * Test object creation
+     */
+    @Test
+    public void testDiscard() {
+        RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());
+        ResponseExpectedRpcListener<OfHeader> listener =
+                new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);
+        listener.discard();
+        RpcError rpcError = AbstractRpcListener.buildRpcError("Failed to send message",
+                ErrorSeverity.ERROR, "check switch connection", new TimeoutException("Request timed out"));
+        SettableFuture<RpcResult<?>> result = SettableFuture.create();
+        result.set(Rpcs.getRpcResult(false, null, Collections.singletonList(rpcError)));
+        try {
+            Assert.assertEquals("Wrong result", result.get().getErrors().iterator().next().getMessage(),
+                    listener.getResult().get().getErrors().iterator().next().getMessage());
+            Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());
+            Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());
+        } catch (InterruptedException | ExecutionException e) {
+            fail("Problem accessing result");
+        }
+    }
+
+    /**
+     * Test object creation
+     */
+    @Test
+    public void testCompleted() {
+        RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());
+        ResponseExpectedRpcListener<OfHeader> listener =
+                new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);
+        BarrierInputBuilder barrierBuilder = new BarrierInputBuilder();
+        BarrierInput barrierInput = barrierBuilder.build();
+        listener.completed(barrierInput);
+        SettableFuture<RpcResult<?>> result = SettableFuture.create();
+        result.set(Rpcs.getRpcResult(true, barrierInput, Collections.<RpcError>emptyList()));
+        try {
+            Assert.assertEquals("Wrong result", result.get().getErrors(), listener.getResult().get().getErrors());
+            Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());
+            Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());
+        } catch (InterruptedException | ExecutionException e) {
+            fail("Problem accessing result");
+        }
+    }
+
+    /**
+     * Test object creation
+     */
+    @Test
+    public void testOperationSuccessful() {
+        RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());
+        ResponseExpectedRpcListener<OfHeader> listener =
+                new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);
+        listener.operationSuccessful();
+        ResponseExpectedRpcListener<?> present = responseCache.getIfPresent(key);
+        Assert.assertEquals(present, listener);
+    }
 }
\ No newline at end of file
index d5a7499c9306228f7943ef0ffa44a8f1e7ce1e10..fff2ea0215ccf1a859cac7a86e0753fc7ccd40d7 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core.connection;\r
-\r
-import static org.junit.Assert.fail;\r
-import static org.mockito.Mockito.times;\r
-import static org.mockito.Mockito.verify;\r
-import static org.mockito.Mockito.when;\r
-import io.netty.util.concurrent.Future;\r
-\r
-import java.util.Collections;\r
-import java.util.concurrent.ExecutionException;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.controller.sal.common.util.Rpcs;\r
-import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;\r
-import org.opendaylight.yangtools.yang.common.RpcError;\r
-import org.opendaylight.yangtools.yang.common.RpcResult;\r
-\r
-import com.google.common.util.concurrent.SettableFuture;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class SimpleRpcListenerTest {\r
-\r
-    @Mock Future<Void> future;\r
-\r
-    /**\r
-     * Initializes mocks\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        MockitoAnnotations.initMocks(this);\r
-    }\r
-\r
-    /**\r
-     * Test SimpleRpcListener creation\r
-     */\r
-    @Test\r
-    public void test() {\r
-        SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");\r
-        Assert.assertEquals("Wrong message", "MESSAGE", listener.takeMessage());\r
-        Assert.assertEquals("Wrong message", listener, listener.takeListener());\r
-    }\r
-\r
-    /**\r
-     * Test rpc success\r
-     */\r
-    @Test\r
-    public void testSuccessfulRpc() {\r
-        SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");\r
-        listener.operationSuccessful();\r
-        SettableFuture<RpcResult<?>> result = SettableFuture.create();\r
-        result.set(Rpcs.getRpcResult(true, null, Collections.<RpcError>emptyList()));\r
-        try {\r
-            Assert.assertEquals("Wrong result", result.get().getErrors(), listener.getResult().get().getErrors());\r
-            Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());\r
-            Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());\r
-        } catch (InterruptedException | ExecutionException e) {\r
-            fail("Problem accessing result");\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Test rpc success\r
-     */\r
-    @Test\r
-    public void testOperationComplete() {\r
-        when(future.isSuccess()).thenReturn(false);\r
-        SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");\r
-        listener.operationComplete(future);\r
-        verify(future, times(1)).cause();\r
-        try {\r
-            Assert.assertEquals("Wrong result", 1, listener.getResult().get().getErrors().size());\r
-        } catch (InterruptedException | ExecutionException e) {\r
-            Assert.fail();\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Test rpc success\r
-     */\r
-    @Test\r
-    public void testOperationComplete2() {\r
-        when(future.isSuccess()).thenReturn(true);\r
-        SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");\r
-        listener.operationComplete(future);\r
-        verify(future, times(0)).cause();\r
-        try {\r
-            Assert.assertEquals("Wrong result", 0, listener.getResult().get().getErrors().size());\r
-            Assert.assertEquals("Wrong result", true, listener.getResult().get().isSuccessful());\r
-        } catch (InterruptedException | ExecutionException e) {\r
-            Assert.fail();\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core.connection;
+
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import io.netty.util.concurrent.Future;
+
+import java.util.Collections;
+import java.util.concurrent.ExecutionException;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.openflowjava.protocol.impl.core.connection.SimpleRpcListener;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import com.google.common.util.concurrent.SettableFuture;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class SimpleRpcListenerTest {
+
+    @Mock Future<Void> future;
+
+    /**
+     * Initializes mocks
+     */
+    @Before
+    public void startUp() {
+        MockitoAnnotations.initMocks(this);
+    }
+
+    /**
+     * Test SimpleRpcListener creation
+     */
+    @Test
+    public void test() {
+        SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+        Assert.assertEquals("Wrong message", "MESSAGE", listener.takeMessage());
+        Assert.assertEquals("Wrong message", listener, listener.takeListener());
+    }
+
+    /**
+     * Test rpc success
+     */
+    @Test
+    public void testSuccessfulRpc() {
+        SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+        listener.operationSuccessful();
+        SettableFuture<RpcResult<?>> result = SettableFuture.create();
+        result.set(Rpcs.getRpcResult(true, null, Collections.<RpcError>emptyList()));
+        try {
+            Assert.assertEquals("Wrong result", result.get().getErrors(), listener.getResult().get().getErrors());
+            Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());
+            Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());
+        } catch (InterruptedException | ExecutionException e) {
+            fail("Problem accessing result");
+        }
+    }
+
+    /**
+     * Test rpc success
+     */
+    @Test
+    public void testOperationComplete() {
+        when(future.isSuccess()).thenReturn(false);
+        SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+        listener.operationComplete(future);
+        verify(future, times(1)).cause();
+        try {
+            Assert.assertEquals("Wrong result", 1, listener.getResult().get().getErrors().size());
+        } catch (InterruptedException | ExecutionException e) {
+            Assert.fail();
+        }
+    }
+
+    /**
+     * Test rpc success
+     */
+    @Test
+    public void testOperationComplete2() {
+        when(future.isSuccess()).thenReturn(true);
+        SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+        listener.operationComplete(future);
+        verify(future, times(0)).cause();
+        try {
+            Assert.assertEquals("Wrong result", 0, listener.getResult().get().getErrors().size());
+            Assert.assertEquals("Wrong result", true, listener.getResult().get().isSuccessful());
+        } catch (InterruptedException | ExecutionException e) {
+            Assert.fail();
+        }
+    }
 }
\ No newline at end of file
index 0c792fa2641af365736da3df016a273a16bb490b..8fa76e8049bf096a542a9fa5da32a51b47fd4e60 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.core.connection;\r
-\r
-import java.net.InetAddress;\r
-import java.net.UnknownHostException;\r
-import java.util.concurrent.ExecutionException;\r
-import java.util.concurrent.TimeUnit;\r
-import java.util.concurrent.TimeoutException;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;\r
-import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;\r
-import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.core.SwitchConnectionProviderImpl;\r
-import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.TransportProtocol;\r
-\r
-import com.google.common.util.concurrent.ListenableFuture;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class SwitchConnectionProviderImplTest {\r
-\r
-    @Mock SwitchConnectionHandler handler;\r
-\r
-    private static final int SWITCH_IDLE_TIMEOUT = 2000;\r
-    private static final int WAIT_TIMEOUT = 2000;\r
-    private InetAddress startupAddress;\r
-    private TlsConfiguration tlsConfiguration;\r
-    private SwitchConnectionProviderImpl provider;\r
-    private ConnectionConfigurationImpl config;\r
-\r
-    /**\r
-     * Creates new {@link SwitchConnectionProvider} instance for each test\r
-     * @param protocol communication protocol\r
-     */\r
-    public void startUp(TransportProtocol protocol) {\r
-        MockitoAnnotations.initMocks(this);\r
-        config = null;\r
-        if (protocol != null) {\r
-            createConfig(protocol);\r
-        }\r
-        provider = new SwitchConnectionProviderImpl();\r
-    }\r
-\r
-    private void createConfig(TransportProtocol protocol) {\r
-        try {\r
-            startupAddress = InetAddress.getLocalHost();\r
-        } catch (UnknownHostException e) {\r
-            e.printStackTrace();\r
-        }\r
-        tlsConfiguration = null;\r
-        if (protocol.equals(TransportProtocol.TLS)) {\r
-            tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS,\r
-                    "/selfSignedSwitch", PathType.CLASSPATH, KeystoreType.JKS,\r
-                    "/selfSignedController", PathType.CLASSPATH) ;\r
-        }\r
-        config = new ConnectionConfigurationImpl(startupAddress, 0, tlsConfiguration, SWITCH_IDLE_TIMEOUT);\r
-        config.setTransferProtocol(protocol);\r
-    }\r
-\r
-    /**\r
-     * Tests provider startup - without configuration and {@link SwitchConnectionHandler}\r
-     */\r
-    @Test\r
-    public void testStartup1() {\r
-        provider = new SwitchConnectionProviderImpl();\r
-        ListenableFuture<Boolean> future = provider.startup();\r
-        try {\r
-            future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);\r
-        } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
-            Assert.assertEquals("Wrong state", "java.lang.NullPointerException", e.getMessage());\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Tests provider startup - without configuration\r
-     */\r
-    @Test\r
-    public void testStartup2() {\r
-        startUp(null);\r
-        provider.setSwitchConnectionHandler(handler);\r
-        ListenableFuture<Boolean> future = provider.startup();\r
-        try {\r
-            future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);\r
-        } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
-            Assert.assertEquals("Wrong state", "java.lang.NullPointerException", e.getMessage());\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Tests provider startup - without {@link SwitchConnectionHandler}\r
-     */\r
-    @Test\r
-    public void testStartup3() {\r
-        startUp(TransportProtocol.TCP);\r
-        provider.setConfiguration(config);\r
-        ListenableFuture<Boolean> future = provider.startup();\r
-        try {\r
-            future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);\r
-        } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
-            Assert.assertEquals("Wrong state", "java.lang.IllegalStateException:"\r
-                    + " SwitchConnectionHandler is not set", e.getMessage());\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Tests correct provider startup - over TCP\r
-     */\r
-    @Test\r
-    public void testStartup4() {\r
-        startUp(TransportProtocol.TCP);\r
-        provider.setConfiguration(config);\r
-        provider.setSwitchConnectionHandler(handler);\r
-        try {\r
-            Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));\r
-        } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
-            Assert.fail();\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Tests correct provider startup - over TLS\r
-     */\r
-    @Test\r
-    public void testStartup5() {\r
-        startUp(TransportProtocol.TLS);\r
-        provider.setConfiguration(config);\r
-        provider.setSwitchConnectionHandler(handler);\r
-        try {\r
-            Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));\r
-        } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
-            Assert.fail();\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Tests correct provider startup - over UDP\r
-     */\r
-    @Test\r
-    public void testStartup6() {\r
-        startUp(TransportProtocol.UDP);\r
-        provider.setConfiguration(config);\r
-        provider.setSwitchConnectionHandler(handler);\r
-        try {\r
-            Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));\r
-        } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
-            Assert.fail();\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Tests correct provider shutdown\r
-     */\r
-    @Test\r
-    public void testShutdown() {\r
-        startUp(TransportProtocol.TCP);\r
-        provider.setConfiguration(config);\r
-        provider.setSwitchConnectionHandler(handler);\r
-        try {\r
-            Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));\r
-            Assert.assertTrue("Failed to stop", provider.shutdown().get(5 * WAIT_TIMEOUT, TimeUnit.MILLISECONDS));\r
-        } catch (InterruptedException | ExecutionException | TimeoutException e) {\r
-            e.printStackTrace();\r
-        }\r
-    }\r
-\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core.connection;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
+import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
+import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl;
+import org.opendaylight.openflowjava.protocol.impl.core.SwitchConnectionProviderImpl;
+import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.TransportProtocol;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class SwitchConnectionProviderImplTest {
+
+    @Mock SwitchConnectionHandler handler;
+
+    private static final int SWITCH_IDLE_TIMEOUT = 2000;
+    private static final int WAIT_TIMEOUT = 2000;
+    private InetAddress startupAddress;
+    private TlsConfiguration tlsConfiguration;
+    private SwitchConnectionProviderImpl provider;
+    private ConnectionConfigurationImpl config;
+
+    /**
+     * Creates new {@link SwitchConnectionProvider} instance for each test
+     * @param protocol communication protocol
+     */
+    public void startUp(TransportProtocol protocol) {
+        MockitoAnnotations.initMocks(this);
+        config = null;
+        if (protocol != null) {
+            createConfig(protocol);
+        }
+        provider = new SwitchConnectionProviderImpl();
+    }
+
+    private void createConfig(TransportProtocol protocol) {
+        try {
+            startupAddress = InetAddress.getLocalHost();
+        } catch (UnknownHostException e) {
+            e.printStackTrace();
+        }
+        tlsConfiguration = null;
+        if (protocol.equals(TransportProtocol.TLS)) {
+            tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS,
+                    "/selfSignedSwitch", PathType.CLASSPATH, KeystoreType.JKS,
+                    "/selfSignedController", PathType.CLASSPATH) ;
+        }
+        config = new ConnectionConfigurationImpl(startupAddress, 0, tlsConfiguration, SWITCH_IDLE_TIMEOUT);
+        config.setTransferProtocol(protocol);
+    }
+
+    /**
+     * Tests provider startup - without configuration and {@link SwitchConnectionHandler}
+     */
+    @Test
+    public void testStartup1() {
+        provider = new SwitchConnectionProviderImpl();
+        ListenableFuture<Boolean> future = provider.startup();
+        try {
+            future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
+        } catch (InterruptedException | ExecutionException | TimeoutException e) {
+            Assert.assertEquals("Wrong state", "java.lang.NullPointerException", e.getMessage());
+        }
+    }
+
+    /**
+     * Tests provider startup - without configuration
+     */
+    @Test
+    public void testStartup2() {
+        startUp(null);
+        provider.setSwitchConnectionHandler(handler);
+        ListenableFuture<Boolean> future = provider.startup();
+        try {
+            future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
+        } catch (InterruptedException | ExecutionException | TimeoutException e) {
+            Assert.assertEquals("Wrong state", "java.lang.NullPointerException", e.getMessage());
+        }
+    }
+
+    /**
+     * Tests provider startup - without {@link SwitchConnectionHandler}
+     */
+    @Test
+    public void testStartup3() {
+        startUp(TransportProtocol.TCP);
+        provider.setConfiguration(config);
+        ListenableFuture<Boolean> future = provider.startup();
+        try {
+            future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
+        } catch (InterruptedException | ExecutionException | TimeoutException e) {
+            Assert.assertEquals("Wrong state", "java.lang.IllegalStateException:"
+                    + " SwitchConnectionHandler is not set", e.getMessage());
+        }
+    }
+
+    /**
+     * Tests correct provider startup - over TCP
+     */
+    @Test
+    public void testStartup4() {
+        startUp(TransportProtocol.TCP);
+        provider.setConfiguration(config);
+        provider.setSwitchConnectionHandler(handler);
+        try {
+            Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+        } catch (InterruptedException | ExecutionException | TimeoutException e) {
+            Assert.fail();
+        }
+    }
+
+    /**
+     * Tests correct provider startup - over TLS
+     */
+    @Test
+    public void testStartup5() {
+        startUp(TransportProtocol.TLS);
+        provider.setConfiguration(config);
+        provider.setSwitchConnectionHandler(handler);
+        try {
+            Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+        } catch (InterruptedException | ExecutionException | TimeoutException e) {
+            Assert.fail();
+        }
+    }
+
+    /**
+     * Tests correct provider startup - over UDP
+     */
+    @Test
+    public void testStartup6() {
+        startUp(TransportProtocol.UDP);
+        provider.setConfiguration(config);
+        provider.setSwitchConnectionHandler(handler);
+        try {
+            Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+        } catch (InterruptedException | ExecutionException | TimeoutException e) {
+            Assert.fail();
+        }
+    }
+
+    /**
+     * Tests correct provider shutdown
+     */
+    @Test
+    public void testShutdown() {
+        startUp(TransportProtocol.TCP);
+        provider.setConfiguration(config);
+        provider.setSwitchConnectionHandler(handler);
+        try {
+            Assert.assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+            Assert.assertTrue("Failed to stop", provider.shutdown().get(5 * WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+        } catch (InterruptedException | ExecutionException | TimeoutException e) {
+            e.printStackTrace();
+        }
+    }
+
 }
\ No newline at end of file
index d456332b55eee37f35246b63c878a1c2870e2340..965e299b1d1a18e29e814420a9ab4803ac9eb092 100644 (file)
@@ -1,56 +1,56 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class DeserializationFactoryTest {\r
-\r
-    /**\r
-     * Test deserializer lookup & deserialization\r
-     */\r
-    @Test\r
-    public void test() {\r
-        DeserializerRegistryImpl registry = new DeserializerRegistryImpl();\r
-        registry.init();\r
-        DeserializationFactory factory = new DeserializationFactory();\r
-        factory.setRegistry(registry);\r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        buffer.writeByte(0);\r
-        buffer.writeShort(EncodeConstants.OFHEADER_SIZE);\r
-        buffer.writeInt(1234);\r
-        factory.deserialize(buffer, EncodeConstants.OF13_VERSION_ID);\r
-        assertEquals("Deserialization failed", 0, buffer.readableBytes());\r
-    }\r
-\r
-    /**\r
-     * Test deserializer lookup & deserialization\r
-     */\r
-    @Test(expected=NullPointerException.class)\r
-    public void testNotExistingDeserializer() {\r
-        DeserializerRegistryImpl registry = new DeserializerRegistryImpl();\r
-        registry.init();\r
-        DeserializationFactory factory = new DeserializationFactory();\r
-        factory.setRegistry(registry);\r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        buffer.writeByte(0);\r
-        buffer.writeShort(EncodeConstants.OFHEADER_SIZE);\r
-        buffer.writeInt(1234);\r
-        factory.deserialize(buffer, (short) 0);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization;
+
+import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class DeserializationFactoryTest {
+
+    /**
+     * Test deserializer lookup & deserialization
+     */
+    @Test
+    public void test() {
+        DeserializerRegistryImpl registry = new DeserializerRegistryImpl();
+        registry.init();
+        DeserializationFactory factory = new DeserializationFactory();
+        factory.setRegistry(registry);
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        buffer.writeByte(0);
+        buffer.writeShort(EncodeConstants.OFHEADER_SIZE);
+        buffer.writeInt(1234);
+        factory.deserialize(buffer, EncodeConstants.OF13_VERSION_ID);
+        assertEquals("Deserialization failed", 0, buffer.readableBytes());
+    }
+
+    /**
+     * Test deserializer lookup & deserialization
+     */
+    @Test(expected=NullPointerException.class)
+    public void testNotExistingDeserializer() {
+        DeserializerRegistryImpl registry = new DeserializerRegistryImpl();
+        registry.init();
+        DeserializationFactory factory = new DeserializationFactory();
+        factory.setRegistry(registry);
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        buffer.writeByte(0);
+        buffer.writeShort(EncodeConstants.OFHEADER_SIZE);
+        buffer.writeInt(1234);
+        factory.deserialize(buffer, (short) 0);
+    }
 }
\ No newline at end of file
index fb65cee64a3f4c1deeb5d6c76fb2e9075639a300..65395c16422112585ab1f244f00d57acc6e5337c 100644 (file)
@@ -1,81 +1,81 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class TypeToClassMapInitializerTest {\r
-\r
-    private Map<TypeToClassKey, Class<?>> messageClassMap;\r
-\r
-    /**\r
-     * Tests correct map initialization\r
-     */\r
-    @Test\r
-    public void test() {\r
-        messageClassMap = new HashMap<>();\r
-        TypeToClassMapInitializer.initializeTypeToClassMap(messageClassMap);\r
-        short version = EncodeConstants.OF10_VERSION_ID;\r
-        assertEquals("Wrong class", HelloMessage.class, messageClassMap.get(new TypeToClassKey(version, 0)));\r
-        assertEquals("Wrong class", ErrorMessage.class, messageClassMap.get(new TypeToClassKey(version, 1)));\r
-        assertEquals("Wrong class", EchoRequestMessage.class, messageClassMap.get(new TypeToClassKey(version, 2)));\r
-        assertEquals("Wrong class", EchoOutput.class, messageClassMap.get(new TypeToClassKey(version, 3)));\r
-        assertEquals("Wrong class", ExperimenterMessage.class, messageClassMap.get(new TypeToClassKey(version, 4)));\r
-        assertEquals("Wrong class", GetFeaturesOutput.class, messageClassMap.get(new TypeToClassKey(version, 6)));\r
-        assertEquals("Wrong class", GetConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 8)));\r
-        assertEquals("Wrong class", PacketInMessage.class, messageClassMap.get(new TypeToClassKey(version, 10)));\r
-        assertEquals("Wrong class", FlowRemovedMessage.class, messageClassMap.get(new TypeToClassKey(version, 11)));\r
-        assertEquals("Wrong class", PortStatusMessage.class, messageClassMap.get(new TypeToClassKey(version, 12)));\r
-        assertEquals("Wrong class", MultipartReplyMessage.class, messageClassMap.get(new TypeToClassKey(version, 17)));\r
-        assertEquals("Wrong class", BarrierOutput.class, messageClassMap.get(new TypeToClassKey(version, 19)));\r
-        assertEquals("Wrong class", GetQueueConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 21)));\r
-        version = EncodeConstants.OF13_VERSION_ID;\r
-        assertEquals("Wrong class", HelloMessage.class, messageClassMap.get(new TypeToClassKey(version, 0)));\r
-        assertEquals("Wrong class", ErrorMessage.class, messageClassMap.get(new TypeToClassKey(version, 1)));\r
-        assertEquals("Wrong class", EchoRequestMessage.class, messageClassMap.get(new TypeToClassKey(version, 2)));\r
-        assertEquals("Wrong class", EchoOutput.class, messageClassMap.get(new TypeToClassKey(version, 3)));\r
-        assertEquals("Wrong class", ExperimenterMessage.class, messageClassMap.get(new TypeToClassKey(version, 4)));\r
-        assertEquals("Wrong class", GetFeaturesOutput.class, messageClassMap.get(new TypeToClassKey(version, 6)));\r
-        assertEquals("Wrong class", GetConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 8)));\r
-        assertEquals("Wrong class", PacketInMessage.class, messageClassMap.get(new TypeToClassKey(version, 10)));\r
-        assertEquals("Wrong class", FlowRemovedMessage.class, messageClassMap.get(new TypeToClassKey(version, 11)));\r
-        assertEquals("Wrong class", PortStatusMessage.class, messageClassMap.get(new TypeToClassKey(version, 12)));\r
-        assertEquals("Wrong class", MultipartReplyMessage.class, messageClassMap.get(new TypeToClassKey(version, 19)));\r
-        assertEquals("Wrong class", BarrierOutput.class, messageClassMap.get(new TypeToClassKey(version, 21)));\r
-        assertEquals("Wrong class", GetQueueConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 23)));\r
-        assertEquals("Wrong class", RoleRequestOutput.class, messageClassMap.get(new TypeToClassKey(version, 25)));\r
-        assertEquals("Wrong class", GetAsyncOutput.class, messageClassMap.get(new TypeToClassKey(version, 27)));\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class TypeToClassMapInitializerTest {
+
+    private Map<TypeToClassKey, Class<?>> messageClassMap;
+
+    /**
+     * Tests correct map initialization
+     */
+    @Test
+    public void test() {
+        messageClassMap = new HashMap<>();
+        TypeToClassMapInitializer.initializeTypeToClassMap(messageClassMap);
+        short version = EncodeConstants.OF10_VERSION_ID;
+        assertEquals("Wrong class", HelloMessage.class, messageClassMap.get(new TypeToClassKey(version, 0)));
+        assertEquals("Wrong class", ErrorMessage.class, messageClassMap.get(new TypeToClassKey(version, 1)));
+        assertEquals("Wrong class", EchoRequestMessage.class, messageClassMap.get(new TypeToClassKey(version, 2)));
+        assertEquals("Wrong class", EchoOutput.class, messageClassMap.get(new TypeToClassKey(version, 3)));
+        assertEquals("Wrong class", ExperimenterMessage.class, messageClassMap.get(new TypeToClassKey(version, 4)));
+        assertEquals("Wrong class", GetFeaturesOutput.class, messageClassMap.get(new TypeToClassKey(version, 6)));
+        assertEquals("Wrong class", GetConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 8)));
+        assertEquals("Wrong class", PacketInMessage.class, messageClassMap.get(new TypeToClassKey(version, 10)));
+        assertEquals("Wrong class", FlowRemovedMessage.class, messageClassMap.get(new TypeToClassKey(version, 11)));
+        assertEquals("Wrong class", PortStatusMessage.class, messageClassMap.get(new TypeToClassKey(version, 12)));
+        assertEquals("Wrong class", MultipartReplyMessage.class, messageClassMap.get(new TypeToClassKey(version, 17)));
+        assertEquals("Wrong class", BarrierOutput.class, messageClassMap.get(new TypeToClassKey(version, 19)));
+        assertEquals("Wrong class", GetQueueConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 21)));
+        version = EncodeConstants.OF13_VERSION_ID;
+        assertEquals("Wrong class", HelloMessage.class, messageClassMap.get(new TypeToClassKey(version, 0)));
+        assertEquals("Wrong class", ErrorMessage.class, messageClassMap.get(new TypeToClassKey(version, 1)));
+        assertEquals("Wrong class", EchoRequestMessage.class, messageClassMap.get(new TypeToClassKey(version, 2)));
+        assertEquals("Wrong class", EchoOutput.class, messageClassMap.get(new TypeToClassKey(version, 3)));
+        assertEquals("Wrong class", ExperimenterMessage.class, messageClassMap.get(new TypeToClassKey(version, 4)));
+        assertEquals("Wrong class", GetFeaturesOutput.class, messageClassMap.get(new TypeToClassKey(version, 6)));
+        assertEquals("Wrong class", GetConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 8)));
+        assertEquals("Wrong class", PacketInMessage.class, messageClassMap.get(new TypeToClassKey(version, 10)));
+        assertEquals("Wrong class", FlowRemovedMessage.class, messageClassMap.get(new TypeToClassKey(version, 11)));
+        assertEquals("Wrong class", PortStatusMessage.class, messageClassMap.get(new TypeToClassKey(version, 12)));
+        assertEquals("Wrong class", MultipartReplyMessage.class, messageClassMap.get(new TypeToClassKey(version, 19)));
+        assertEquals("Wrong class", BarrierOutput.class, messageClassMap.get(new TypeToClassKey(version, 21)));
+        assertEquals("Wrong class", GetQueueConfigOutput.class, messageClassMap.get(new TypeToClassKey(version, 23)));
+        assertEquals("Wrong class", RoleRequestOutput.class, messageClassMap.get(new TypeToClassKey(version, 25)));
+        assertEquals("Wrong class", GetAsyncOutput.class, messageClassMap.get(new TypeToClassKey(version, 27)));
+    }
 }
\ No newline at end of file
index ac1676424c1f4426992177f94295889351d5c843..b05730f288b142100a02b006eb22276adf55a15a 100644 (file)
@@ -1,59 +1,59 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import static org.mockito.Matchers.any;\r
-import static org.mockito.Mockito.when;\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterMessageFactoryTest {\r
-\r
-    @Mock DeserializerRegistry registry;\r
-    @Mock OFDeserializer<ExperimenterMessage> deserializer;\r
-    @Mock ExperimenterMessage message;\r
-\r
-    /**\r
-     * Initializes mocks\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        MockitoAnnotations.initMocks(this);\r
-    }\r
-\r
-    /**\r
-     * Test deserializer lookup correctness\r
-     */\r
-    @Test\r
-    public void test() {\r
-        when(registry.getDeserializer(any(ExperimenterIdDeserializerKey.class))).thenReturn(deserializer);\r
-        when(deserializer.deserialize(any(ByteBuf.class))).thenReturn(message);\r
-        \r
-        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 02 03 00 00 00 10");\r
-        ExperimenterMessageFactory factory = new ExperimenterMessageFactory();\r
-        factory.injectDeserializerRegistry(registry);\r
-        ExperimenterMessage deserializedMessage = factory.deserialize(buffer);\r
-        Assert.assertEquals("Wrong return value", message, deserializedMessage);\r
-        Assert.assertEquals("ByteBuf index moved", 0, buffer.readerIndex());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.when;
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterMessageFactoryTest {
+
+    @Mock DeserializerRegistry registry;
+    @Mock OFDeserializer<ExperimenterMessage> deserializer;
+    @Mock ExperimenterMessage message;
+
+    /**
+     * Initializes mocks
+     */
+    @Before
+    public void startUp() {
+        MockitoAnnotations.initMocks(this);
+    }
+
+    /**
+     * Test deserializer lookup correctness
+     */
+    @Test
+    public void test() {
+        when(registry.getDeserializer(any(ExperimenterIdDeserializerKey.class))).thenReturn(deserializer);
+        when(deserializer.deserialize(any(ByteBuf.class))).thenReturn(message);
+        
+        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 02 03 00 00 00 10");
+        ExperimenterMessageFactory factory = new ExperimenterMessageFactory();
+        factory.injectDeserializerRegistry(registry);
+        ExperimenterMessage deserializedMessage = factory.deserialize(buffer);
+        Assert.assertEquals("Wrong return value", message, deserializedMessage);
+        Assert.assertEquals("ByteBuf index moved", 0, buffer.readerIndex());
+    }
 }
\ No newline at end of file
index d5a1c779468703a293481e6fb273398eaccbbbe2..0e8813eafc9fd70f37e8b8b15482bf22b40ebd28 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.math.BigInteger;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDescCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueueCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDesc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.MultipartReplyQueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTable;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10StatsReplyMessageFactoryTest {\r
-\r
-    private OFDeserializer<MultipartReplyMessage> statsFactory;\r
-\r
-    /**\r
-     * Initializes deserializer registry and lookups correct deserializer\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        DeserializerRegistry registry = new DeserializerRegistryImpl();\r
-        registry.init();\r
-        statsFactory = registry.getDeserializer(\r
-                new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 17, MultipartReplyMessage.class));\r
-    }\r
-\r
-    /**\r
-     * Testing OF10StatsReplyMessageFactory (Desc) for correct deserialization\r
-     */\r
-    @Test\r
-    public void testDesc() {\r
-        final int DESC_STR_LEN = 256;\r
-        final int SERIAL_NUM_LEN = 32;\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 00 00 00");\r
-        \r
-        String mfrDesc = "Manufacturer description";\r
-        byte[] mfrDescBytes = new byte[256];\r
-        mfrDescBytes = mfrDesc.getBytes();\r
-        bb.writeBytes(mfrDescBytes);\r
-        bb.writeZero(DESC_STR_LEN - mfrDescBytes.length);\r
-        \r
-        String hwDesc = "Hardware description";\r
-        byte[] hwDescBytes = new byte[256];\r
-        hwDescBytes = hwDesc.getBytes();\r
-        bb.writeBytes(hwDescBytes);\r
-        bb.writeZero(DESC_STR_LEN - hwDescBytes.length);\r
-        \r
-        String swDesc = "Software description";\r
-        byte[] swDescBytes = new byte[256];\r
-        swDescBytes = swDesc.getBytes();\r
-        bb.writeBytes(swDescBytes);\r
-        bb.writeZero(DESC_STR_LEN - swDescBytes.length);\r
-        \r
-        String serialNum = "SN0123456789";\r
-        byte[] serialNumBytes = new byte[32];\r
-        serialNumBytes = serialNum.getBytes();\r
-        bb.writeBytes(serialNumBytes);\r
-        bb.writeZero(SERIAL_NUM_LEN - serialNumBytes.length);\r
-        \r
-        String dpDesc = "switch3 in room 3120";\r
-        byte[] dpDescBytes = new byte[256];\r
-        dpDescBytes = dpDesc.getBytes();\r
-        bb.writeBytes(dpDescBytes);\r
-        bb.writeZero(DESC_STR_LEN - dpDescBytes.length);\r
-        \r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
-        \r
-        BufferHelper.checkHeaderV10(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 0, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());\r
-        MultipartReplyDescCase messageCase = (MultipartReplyDescCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyDesc message = messageCase.getMultipartReplyDesc();\r
-        Assert.assertEquals("Wrong mfrDesc", "Manufacturer description", message.getMfrDesc());\r
-        Assert.assertEquals("Wrong hwDesc", "Hardware description", message.getHwDesc());\r
-        Assert.assertEquals("Wrong swDesc", "Software description", message.getSwDesc());\r
-        Assert.assertEquals("Wrong serialNum", "SN0123456789", message.getSerialNum());\r
-        Assert.assertEquals("Wrong dpDesc", "switch3 in room 3120", message.getDpDesc());\r
-        Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
-    }\r
-    \r
-    /**\r
-     * Testing OF10StatsReplyMessageFactory (Flow) for correct deserialization\r
-     */\r
-    @Test\r
-    public void testFlow() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 68 01 00 "\r
-                + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
-                + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
-                + "00 00 00 02 00 00 00 03 00 04 00 05 00 06 00 00 00 00 00 00 "\r
-                + "FF 01 02 03 04 05 06 07 FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 "\r
-                + "00 00 00 08 00 01 00 02 00 01 00 08 00 03 00 00");\r
-        \r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
-\r
-        BufferHelper.checkHeaderV10(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());\r
-        MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyFlow message = messageCase.getMultipartReplyFlow();\r
-        Assert.assertEquals("Wrong tableId", 1, message.getFlowStats().get(0).getTableId().intValue());\r
-        Assert.assertEquals("Wrong durationSec", 2, message.getFlowStats().get(0).getDurationSec().intValue());\r
-        Assert.assertEquals("Wrong durationNsec", 3, message.getFlowStats().get(0).getDurationNsec().intValue());\r
-        Assert.assertEquals("Wrong priority", 4, message.getFlowStats().get(0).getPriority().intValue());\r
-        Assert.assertEquals("Wrong idleTimeOut", 5, message.getFlowStats().get(0).getIdleTimeout().intValue());\r
-        Assert.assertEquals("Wrong hardTimeOut", 6, message.getFlowStats().get(0).getHardTimeout().intValue());\r
-        Assert.assertEquals("Wrong cookie",\r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
-                message.getFlowStats().get(0).getCookie());\r
-        Assert.assertEquals("Wrong packetCount",\r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
-                message.getFlowStats().get(0).getPacketCount());\r
-        Assert.assertEquals("Wrong byteCount",\r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
-                message.getFlowStats().get(0).getByteCount());\r
-        Action action1 = message.getFlowStats().get(0).getAction().get(0);\r
-        Assert.assertEquals("Wrong action type", Output.class, action1.getType());\r
-        Assert.assertEquals("Wrong action port", 1, action1.getAugmentation(PortAction.class)\r
-                .getPort().getValue().intValue());\r
-        Assert.assertEquals("Wrong action port", 2, action1.getAugmentation(MaxLengthAction.class)\r
-                .getMaxLength().intValue());\r
-        Action action2 = message.getFlowStats().get(0).getAction().get(1);\r
-        Assert.assertEquals("Wrong action type", SetVlanVid.class, action2.getType());\r
-        Assert.assertEquals("Wrong action port", 3, action2.getAugmentation(VlanVidAction.class)\r
-                .getVlanVid().intValue());\r
-        Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
-    }\r
-    \r
-    /**\r
-     * Testing OF10StatsReplyMessageFactory (Aggregate) for correct deserialization\r
-     */\r
-    @Test\r
-    public void testAggregate() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 "\r
-                + "FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 00 00 00 30 00 00 00 00");\r
-        \r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
-\r
-        BufferHelper.checkHeaderV10(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 0x02, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());\r
-        MultipartReplyAggregateCase messageCase = (MultipartReplyAggregateCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyAggregate message = messageCase.getMultipartReplyAggregate();\r
-        Assert.assertEquals("Wrong packet-count",\r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
-                message.getPacketCount());\r
-        Assert.assertEquals("Wrong byte-count",\r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
-                message.getByteCount());\r
-        Assert.assertEquals("Wrong flow-count", 48, message.getFlowCount().intValue());\r
-        Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
-    }\r
-    \r
-    /**\r
-     * Testing OF10StatsReplyMessageFactory (Table) for correct deserialization\r
-     */\r
-    @Test\r
-    public void testTable() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 "\r
-                + "08 00 00 00 4A 41 4D 45 53 20 42 4F 4E 44 00 00 00 00 00 00 00 00 00 "\r
-                + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
-                + "00 00 00 30 00 00 00 10 FF 01 01 01 01 01 01 01 FF 01 01 01 01 01 01 00");\r
-\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
-\r
-        BufferHelper.checkHeaderV10(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 0x03, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-\r
-        MultipartReplyTableCase messageCase = (MultipartReplyTableCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyTable message = messageCase.getMultipartReplyTable();\r
-        Assert.assertEquals("Wrong tableId", 8, message.getTableStats().get(0).getTableId().intValue());\r
-        Assert.assertEquals("Wrong name", "JAMES BOND", message.getTableStats().get(0).getName());\r
-        Assert.assertEquals("Wrong wildcards", new FlowWildcardsV10(false, false, false, false, false, false, false,\r
-                false, false, false), message.getTableStats().get(0).getWildcards());\r
-        Assert.assertEquals("Wrong src-mask", 32, message.getTableStats().get(0).getNwSrcMask().intValue());\r
-        Assert.assertEquals("Wrong dst-mask", 32, message.getTableStats().get(0).getNwDstMask().intValue());\r
-        Assert.assertEquals("Wrong max-entries", 48, message.getTableStats().get(0).getMaxEntries().longValue());\r
-        Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());\r
-        Assert.assertEquals("Wrong lookupCount", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
-                message.getTableStats().get(0).getLookupCount());\r
-        Assert.assertEquals("Wrong matchedCount", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00}), \r
-                message.getTableStats().get(0).getMatchedCount());\r
-        Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
-    }\r
-    \r
-    /**\r
-     * Testing OF10StatsReplyMessageFactory (Port) for correct deserialization\r
-     */\r
-    @Test\r
-    public void testPort() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 "\r
-                + "00 FF 00 00 00 00 00 00 "\r
-                + "FF 01 01 01 01 01 01 01 FF 02 02 02 02 02 02 02 "\r
-                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
-                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
-                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
-                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
-                + "FF 02 03 02 03 02 03 02");\r
-\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
-\r
-        BufferHelper.checkHeaderV10(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 0x04, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyPortStatsCase messageCase = (MultipartReplyPortStatsCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyPortStats message = messageCase.getMultipartReplyPortStats();\r
-        Assert.assertEquals("Wrong portNo", 255, message.getPortStats().get(0).getPortNo().intValue());\r
-        Assert.assertEquals("Wrong rxPackets", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
-                message.getPortStats().get(0).getRxPackets());\r
-        Assert.assertEquals("Wrong txPackets", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
-                message.getPortStats().get(0).getTxPackets());\r
-        Assert.assertEquals("Wrong rxBytes", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getPortStats().get(0).getRxBytes());\r
-        Assert.assertEquals("Wrong txBytes", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getPortStats().get(0).getTxBytes());\r
-        Assert.assertEquals("Wrong rxDropped", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getPortStats().get(0).getRxDropped());\r
-        Assert.assertEquals("Wrong txDropped", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getPortStats().get(0).getTxDropped());\r
-        Assert.assertEquals("Wrong rxErrors", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getPortStats().get(0).getRxErrors());\r
-        Assert.assertEquals("Wrong txErrors", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getPortStats().get(0).getTxErrors());\r
-        Assert.assertEquals("Wrong rxFrameErr", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getPortStats().get(0).getRxFrameErr());\r
-        Assert.assertEquals("Wrong rxOverErr", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getPortStats().get(0).getRxOverErr());\r
-        Assert.assertEquals("Wrong rxCrcErr", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getPortStats().get(0).getRxCrcErr());\r
-        Assert.assertEquals("Wrong collisions", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getPortStats().get(0).getCollisions());\r
-        Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
-    }\r
-    \r
-    /**\r
-     * Testing OF10StatsReplyMessageFactory (Queue) for correct deserialization\r
-     */\r
-    @Test\r
-    public void testQueue() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 05 00 00 "\r
-                + "00 FF 00 00 00 00 00 10 "\r
-                + "FF 02 03 02 03 02 03 02 "\r
-                + "FF 02 02 02 02 02 02 02 "\r
-                + "FF 02 03 02 03 02 03 02");\r
-\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);\r
-\r
-        BufferHelper.checkHeaderV10(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 0x05, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyQueueCase messageCase = (MultipartReplyQueueCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyQueue message = messageCase.getMultipartReplyQueue();\r
-        Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());\r
-        Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());\r
-        Assert.assertEquals("Wrong txBytes", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getQueueStats().get(0).getTxBytes());\r
-        Assert.assertEquals("Wrong txPackets", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
-                message.getQueueStats().get(0).getTxPackets());\r
-        Assert.assertEquals("Wrong txErrors", \r
-                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
-                message.getQueueStats().get(0).getTxErrors());\r
-        Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
+
+import io.netty.buffer.ByteBuf;
+
+import java.math.BigInteger;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDescCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueueCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.MultipartReplyQueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTable;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10StatsReplyMessageFactoryTest {
+
+    private OFDeserializer<MultipartReplyMessage> statsFactory;
+
+    /**
+     * Initializes deserializer registry and lookups correct deserializer
+     */
+    @Before
+    public void startUp() {
+        DeserializerRegistry registry = new DeserializerRegistryImpl();
+        registry.init();
+        statsFactory = registry.getDeserializer(
+                new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 17, MultipartReplyMessage.class));
+    }
+
+    /**
+     * Testing OF10StatsReplyMessageFactory (Desc) for correct deserialization
+     */
+    @Test
+    public void testDesc() {
+        final int DESC_STR_LEN = 256;
+        final int SERIAL_NUM_LEN = 32;
+        ByteBuf bb = BufferHelper.buildBuffer("00 00 00 00");
+        
+        String mfrDesc = "Manufacturer description";
+        byte[] mfrDescBytes = new byte[256];
+        mfrDescBytes = mfrDesc.getBytes();
+        bb.writeBytes(mfrDescBytes);
+        bb.writeZero(DESC_STR_LEN - mfrDescBytes.length);
+        
+        String hwDesc = "Hardware description";
+        byte[] hwDescBytes = new byte[256];
+        hwDescBytes = hwDesc.getBytes();
+        bb.writeBytes(hwDescBytes);
+        bb.writeZero(DESC_STR_LEN - hwDescBytes.length);
+        
+        String swDesc = "Software description";
+        byte[] swDescBytes = new byte[256];
+        swDescBytes = swDesc.getBytes();
+        bb.writeBytes(swDescBytes);
+        bb.writeZero(DESC_STR_LEN - swDescBytes.length);
+        
+        String serialNum = "SN0123456789";
+        byte[] serialNumBytes = new byte[32];
+        serialNumBytes = serialNum.getBytes();
+        bb.writeBytes(serialNumBytes);
+        bb.writeZero(SERIAL_NUM_LEN - serialNumBytes.length);
+        
+        String dpDesc = "switch3 in room 3120";
+        byte[] dpDescBytes = new byte[256];
+        dpDescBytes = dpDesc.getBytes();
+        bb.writeBytes(dpDescBytes);
+        bb.writeZero(DESC_STR_LEN - dpDescBytes.length);
+        
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+        
+        BufferHelper.checkHeaderV10(builtByFactory);
+        Assert.assertEquals("Wrong type", 0, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());
+        MultipartReplyDescCase messageCase = (MultipartReplyDescCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyDesc message = messageCase.getMultipartReplyDesc();
+        Assert.assertEquals("Wrong mfrDesc", "Manufacturer description", message.getMfrDesc());
+        Assert.assertEquals("Wrong hwDesc", "Hardware description", message.getHwDesc());
+        Assert.assertEquals("Wrong swDesc", "Software description", message.getSwDesc());
+        Assert.assertEquals("Wrong serialNum", "SN0123456789", message.getSerialNum());
+        Assert.assertEquals("Wrong dpDesc", "switch3 in room 3120", message.getDpDesc());
+        Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+    }
+    
+    /**
+     * Testing OF10StatsReplyMessageFactory (Flow) for correct deserialization
+     */
+    @Test
+    public void testFlow() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 68 01 00 "
+                + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
+                + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
+                + "00 00 00 02 00 00 00 03 00 04 00 05 00 06 00 00 00 00 00 00 "
+                + "FF 01 02 03 04 05 06 07 FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 "
+                + "00 00 00 08 00 01 00 02 00 01 00 08 00 03 00 00");
+        
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+
+        BufferHelper.checkHeaderV10(builtByFactory);
+        Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());
+        MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
+        Assert.assertEquals("Wrong tableId", 1, message.getFlowStats().get(0).getTableId().intValue());
+        Assert.assertEquals("Wrong durationSec", 2, message.getFlowStats().get(0).getDurationSec().intValue());
+        Assert.assertEquals("Wrong durationNsec", 3, message.getFlowStats().get(0).getDurationNsec().intValue());
+        Assert.assertEquals("Wrong priority", 4, message.getFlowStats().get(0).getPriority().intValue());
+        Assert.assertEquals("Wrong idleTimeOut", 5, message.getFlowStats().get(0).getIdleTimeout().intValue());
+        Assert.assertEquals("Wrong hardTimeOut", 6, message.getFlowStats().get(0).getHardTimeout().intValue());
+        Assert.assertEquals("Wrong cookie",
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), 
+                message.getFlowStats().get(0).getCookie());
+        Assert.assertEquals("Wrong packetCount",
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), 
+                message.getFlowStats().get(0).getPacketCount());
+        Assert.assertEquals("Wrong byteCount",
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), 
+                message.getFlowStats().get(0).getByteCount());
+        Action action1 = message.getFlowStats().get(0).getAction().get(0);
+        Assert.assertEquals("Wrong action type", Output.class, action1.getType());
+        Assert.assertEquals("Wrong action port", 1, action1.getAugmentation(PortAction.class)
+                .getPort().getValue().intValue());
+        Assert.assertEquals("Wrong action port", 2, action1.getAugmentation(MaxLengthAction.class)
+                .getMaxLength().intValue());
+        Action action2 = message.getFlowStats().get(0).getAction().get(1);
+        Assert.assertEquals("Wrong action type", SetVlanVid.class, action2.getType());
+        Assert.assertEquals("Wrong action port", 3, action2.getAugmentation(VlanVidAction.class)
+                .getVlanVid().intValue());
+        Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+    }
+    
+    /**
+     * Testing OF10StatsReplyMessageFactory (Aggregate) for correct deserialization
+     */
+    @Test
+    public void testAggregate() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 "
+                + "FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 00 00 00 30 00 00 00 00");
+        
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+
+        BufferHelper.checkHeaderV10(builtByFactory);
+        Assert.assertEquals("Wrong type", 0x02, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());
+        MultipartReplyAggregateCase messageCase = (MultipartReplyAggregateCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyAggregate message = messageCase.getMultipartReplyAggregate();
+        Assert.assertEquals("Wrong packet-count",
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), 
+                message.getPacketCount());
+        Assert.assertEquals("Wrong byte-count",
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), 
+                message.getByteCount());
+        Assert.assertEquals("Wrong flow-count", 48, message.getFlowCount().intValue());
+        Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+    }
+    
+    /**
+     * Testing OF10StatsReplyMessageFactory (Table) for correct deserialization
+     */
+    @Test
+    public void testTable() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 "
+                + "08 00 00 00 4A 41 4D 45 53 20 42 4F 4E 44 00 00 00 00 00 00 00 00 00 "
+                + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
+                + "00 00 00 30 00 00 00 10 FF 01 01 01 01 01 01 01 FF 01 01 01 01 01 01 00");
+
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+
+        BufferHelper.checkHeaderV10(builtByFactory);
+        Assert.assertEquals("Wrong type", 0x03, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+
+        MultipartReplyTableCase messageCase = (MultipartReplyTableCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyTable message = messageCase.getMultipartReplyTable();
+        Assert.assertEquals("Wrong tableId", 8, message.getTableStats().get(0).getTableId().intValue());
+        Assert.assertEquals("Wrong name", "JAMES BOND", message.getTableStats().get(0).getName());
+        Assert.assertEquals("Wrong wildcards", new FlowWildcardsV10(false, false, false, false, false, false, false,
+                false, false, false), message.getTableStats().get(0).getWildcards());
+        Assert.assertEquals("Wrong src-mask", 32, message.getTableStats().get(0).getNwSrcMask().intValue());
+        Assert.assertEquals("Wrong dst-mask", 32, message.getTableStats().get(0).getNwDstMask().intValue());
+        Assert.assertEquals("Wrong max-entries", 48, message.getTableStats().get(0).getMaxEntries().longValue());
+        Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());
+        Assert.assertEquals("Wrong lookupCount", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), 
+                message.getTableStats().get(0).getLookupCount());
+        Assert.assertEquals("Wrong matchedCount", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00}), 
+                message.getTableStats().get(0).getMatchedCount());
+        Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+    }
+    
+    /**
+     * Testing OF10StatsReplyMessageFactory (Port) for correct deserialization
+     */
+    @Test
+    public void testPort() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 "
+                + "00 FF 00 00 00 00 00 00 "
+                + "FF 01 01 01 01 01 01 01 FF 02 02 02 02 02 02 02 "
+                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "
+                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "
+                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "
+                + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "
+                + "FF 02 03 02 03 02 03 02");
+
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+
+        BufferHelper.checkHeaderV10(builtByFactory);
+        Assert.assertEquals("Wrong type", 0x04, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyPortStatsCase messageCase = (MultipartReplyPortStatsCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyPortStats message = messageCase.getMultipartReplyPortStats();
+        Assert.assertEquals("Wrong portNo", 255, message.getPortStats().get(0).getPortNo().intValue());
+        Assert.assertEquals("Wrong rxPackets", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), 
+                message.getPortStats().get(0).getRxPackets());
+        Assert.assertEquals("Wrong txPackets", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), 
+                message.getPortStats().get(0).getTxPackets());
+        Assert.assertEquals("Wrong rxBytes", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getPortStats().get(0).getRxBytes());
+        Assert.assertEquals("Wrong txBytes", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getPortStats().get(0).getTxBytes());
+        Assert.assertEquals("Wrong rxDropped", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getPortStats().get(0).getRxDropped());
+        Assert.assertEquals("Wrong txDropped", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getPortStats().get(0).getTxDropped());
+        Assert.assertEquals("Wrong rxErrors", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getPortStats().get(0).getRxErrors());
+        Assert.assertEquals("Wrong txErrors", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getPortStats().get(0).getTxErrors());
+        Assert.assertEquals("Wrong rxFrameErr", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getPortStats().get(0).getRxFrameErr());
+        Assert.assertEquals("Wrong rxOverErr", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getPortStats().get(0).getRxOverErr());
+        Assert.assertEquals("Wrong rxCrcErr", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getPortStats().get(0).getRxCrcErr());
+        Assert.assertEquals("Wrong collisions", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getPortStats().get(0).getCollisions());
+        Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+    }
+    
+    /**
+     * Testing OF10StatsReplyMessageFactory (Queue) for correct deserialization
+     */
+    @Test
+    public void testQueue() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 05 00 00 "
+                + "00 FF 00 00 00 00 00 10 "
+                + "FF 02 03 02 03 02 03 02 "
+                + "FF 02 02 02 02 02 02 02 "
+                + "FF 02 03 02 03 02 03 02");
+
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
+
+        BufferHelper.checkHeaderV10(builtByFactory);
+        Assert.assertEquals("Wrong type", 0x05, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyQueueCase messageCase = (MultipartReplyQueueCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyQueue message = messageCase.getMultipartReplyQueue();
+        Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());
+        Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());
+        Assert.assertEquals("Wrong txBytes", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getQueueStats().get(0).getTxBytes());
+        Assert.assertEquals("Wrong txPackets", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), 
+                message.getQueueStats().get(0).getTxPackets());
+        Assert.assertEquals("Wrong txErrors", 
+                new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), 
+                message.getQueueStats().get(0).getTxErrors());
+        Assert.assertTrue("Unread data", bb.readableBytes() == 0);
+    }
+
+}
index d293efcb2749707d27e5b441893123af145e997b..0c9707caa548b2984cff82a1ab8e757f4234022c 100644 (file)
@@ -1,48 +1,48 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class VendorMessageFactoryTest {\r
-\r
-    @Mock DeserializerRegistry registry;\r
-    @Mock ExperimenterMessageFactory deserializer;\r
-\r
-    /**\r
-     * Tests {@link VendorMessageFactory#deserialize(ByteBuf)}\r
-     */\r
-    @Test\r
-    public void test() {\r
-        Mockito.when(registry.getDeserializer(Matchers.any(MessageCodeKey.class))).thenReturn(deserializer);\r
-        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("04 04 00 10 01 02 03 04 FF FF FF FF 80 00 00 00");\r
-        VendorMessageFactory factory = new VendorMessageFactory();\r
-        factory.injectDeserializerRegistry(registry);\r
-        factory.deserialize(buffer);\r
-\r
-        Mockito.verify(deserializer, Mockito.times(1)).deserialize(buffer);\r
-        Assert.assertEquals("Buffer index modified", 16, buffer.readableBytes());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class VendorMessageFactoryTest {
+
+    @Mock DeserializerRegistry registry;
+    @Mock ExperimenterMessageFactory deserializer;
+
+    /**
+     * Tests {@link VendorMessageFactory#deserialize(ByteBuf)}
+     */
+    @Test
+    public void test() {
+        Mockito.when(registry.getDeserializer(Matchers.any(MessageCodeKey.class))).thenReturn(deserializer);
+        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("04 04 00 10 01 02 03 04 FF FF FF FF 80 00 00 00");
+        VendorMessageFactory factory = new VendorMessageFactory();
+        factory.injectDeserializerRegistry(registry);
+        factory.deserialize(buffer);
+
+        Mockito.verify(deserializer, Mockito.times(1)).deserialize(buffer);
+        Assert.assertEquals("Buffer index modified", 16, buffer.readableBytes());
+    }
 }
\ No newline at end of file
index 6e4de3f9271df006c907d11f505c75fa446aeb02..28fecce1448c5294dc2923b715ac966e5091e7aa 100644 (file)
@@ -1,53 +1,53 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class MultipartReplyExperimenterTest {\r
-\r
-    @Mock DeserializerRegistry registry;\r
-\r
-    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testMultipartReplyExperimenter() {\r
-        factory.injectDeserializerRegistry(registry);\r
-        ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "\r
-                                            + "00 00 00 01 00 00 00 02"); // expID, expType\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-\r
-        Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class));\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class MultipartReplyExperimenterTest {
+
+    @Mock DeserializerRegistry registry;
+
+    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testMultipartReplyExperimenter() {
+        factory.injectDeserializerRegistry(registry);
+        ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "
+                                            + "00 00 00 01 00 00 00 02"); // expID, expType
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+
+        Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class));
+    }
 }
\ No newline at end of file
index ecb206e4daa7d5753c7b38bb7da655ad018b02bb..d1c5e35f50394d02f3e7a0d070ce1a6ecd8cd1d6 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.math.BigInteger;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartReplyFlowTest {\r
-\r
-    private OFDeserializer<MultipartReplyMessage> factory;\r
-\r
-    /**\r
-     * Initializes deserializer registry and lookups correct deserializer\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        DeserializerRegistry registry = new DeserializerRegistryImpl();\r
-        registry.init();\r
-        factory = registry.getDeserializer(\r
-                new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 19, MultipartReplyMessage.class));\r
-    }\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testEmptyMultipartReplyFlowBody(){\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00");\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyFlow message = messageCase.getMultipartReplyFlow();\r
-        Assert.assertEquals("Wrong flow stats size", 0, message.getFlowStats().size());\r
-    }\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testMultipartReplyFlowBody(){\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 "+\r
-                                              // first flow stat\r
-                                              "00 48 08 00 "+ // length, tableId, padding\r
-                                              "00 00 00 09 "+//durationSec\r
-                                              "00 00 00 07 "+//durationNsec\r
-                                              "00 0C 00 0E 00 0F 00 1F "+//priority, idleTimeout, hardTimeout, flags\r
-                                              "00 00 00 00 "+//pad_02\r
-                                              "FF 01 01 01 01 01 01 01 "+//cookie\r
-                                              "EF 01 01 01 01 01 01 01 "+//packetCount\r
-                                              "7F 01 01 01 01 01 01 01 "+//byteCount\r
-                                              "00 01 00 04 00 00 00 00 "+//empty match\r
-                                              "00 01 00 08 06 00 00 00 "+\r
-                                              "00 01 00 08 06 00 00 00 "+\r
-                                              // second flow stat\r
-                                              "00 48 08 00 "+ // length, tableId, padding\r
-                                              "00 00 00 09 "+//durationSec\r
-                                              "00 00 00 07 "+//durationNsec\r
-                                              "00 0C 00 0E 00 0F 00 00 "+//priority, idleTimeout, hardTimeout, flags\r
-                                              "00 00 00 00 "+//pad_02\r
-                                              "FF 01 01 01 01 01 01 01 "+//cookie\r
-                                              "EF 01 01 01 01 01 01 01 "+//packetCount\r
-                                              "7F 01 01 01 01 01 01 01 "+//byteCount\r
-                                              "00 01 00 04 00 00 00 00 "+//empty match\r
-                                              "00 01 00 08 06 00 00 00 "+\r
-                                              "00 01 00 08 06 00 00 00");\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyFlow message = messageCase.getMultipartReplyFlow();\r
-        Assert.assertEquals("Wrong flow stats size", 2, message.getFlowStats().size());\r
-        FlowStats flowStats1 = message.getFlowStats().get(0);\r
-        Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());\r
-        Assert.assertEquals("Wrong durationSec", 9, flowStats1.getDurationSec().intValue());\r
-        Assert.assertEquals("Wrong durationNsec", 7, flowStats1.getDurationNsec().intValue());\r
-        Assert.assertEquals("Wrong priority", 12, flowStats1.getPriority().intValue());\r
-        Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());\r
-        Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());\r
-        Assert.assertEquals("Wrong flags", new FlowModFlags(true, true, true, true, true), flowStats1.getFlags());\r
-        Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01,\r
-                0x01, 0x01, 0x01}), flowStats1.getCookie());\r
-        Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01,\r
-                0x01, 0x01, 0x01, 0x01}), flowStats1.getPacketCount());\r
-        Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01,\r
-                0x01, 0x01, 0x01, 0x01}), flowStats1.getByteCount());\r
-        Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());\r
-        flowStats1 = message.getFlowStats().get(1);\r
-        Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());\r
-        Assert.assertEquals("Wrong durationSec", 9, flowStats1.getDurationSec().intValue());\r
-        Assert.assertEquals("Wrong durationNsec", 7, flowStats1.getDurationNsec().intValue());\r
-        Assert.assertEquals("Wrong priority", 12, flowStats1.getPriority().intValue());\r
-        Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());\r
-        Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());\r
-        Assert.assertEquals("Wrong flags", new FlowModFlags(false, false, false, false, false), flowStats1.getFlags());\r
-        Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01,\r
-                0x01, 0x01, 0x01}), flowStats1.getCookie());\r
-        Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01,\r
-                0x01, 0x01, 0x01, 0x01}), flowStats1.getPacketCount());\r
-        Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01,\r
-                0x01, 0x01, 0x01, 0x01}), flowStats1.getByteCount());\r
-        Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import java.math.BigInteger;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartReplyFlowTest {
+
+    private OFDeserializer<MultipartReplyMessage> factory;
+
+    /**
+     * Initializes deserializer registry and lookups correct deserializer
+     */
+    @Before
+    public void startUp() {
+        DeserializerRegistry registry = new DeserializerRegistryImpl();
+        registry.init();
+        factory = registry.getDeserializer(
+                new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 19, MultipartReplyMessage.class));
+    }
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testEmptyMultipartReplyFlowBody(){
+        ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00");
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
+        Assert.assertEquals("Wrong flow stats size", 0, message.getFlowStats().size());
+    }
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testMultipartReplyFlowBody(){
+        ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 "+
+                                              // first flow stat
+                                              "00 48 08 00 "+ // length, tableId, padding
+                                              "00 00 00 09 "+//durationSec
+                                              "00 00 00 07 "+//durationNsec
+                                              "00 0C 00 0E 00 0F 00 1F "+//priority, idleTimeout, hardTimeout, flags
+                                              "00 00 00 00 "+//pad_02
+                                              "FF 01 01 01 01 01 01 01 "+//cookie
+                                              "EF 01 01 01 01 01 01 01 "+//packetCount
+                                              "7F 01 01 01 01 01 01 01 "+//byteCount
+                                              "00 01 00 04 00 00 00 00 "+//empty match
+                                              "00 01 00 08 06 00 00 00 "+
+                                              "00 01 00 08 06 00 00 00 "+
+                                              // second flow stat
+                                              "00 48 08 00 "+ // length, tableId, padding
+                                              "00 00 00 09 "+//durationSec
+                                              "00 00 00 07 "+//durationNsec
+                                              "00 0C 00 0E 00 0F 00 00 "+//priority, idleTimeout, hardTimeout, flags
+                                              "00 00 00 00 "+//pad_02
+                                              "FF 01 01 01 01 01 01 01 "+//cookie
+                                              "EF 01 01 01 01 01 01 01 "+//packetCount
+                                              "7F 01 01 01 01 01 01 01 "+//byteCount
+                                              "00 01 00 04 00 00 00 00 "+//empty match
+                                              "00 01 00 08 06 00 00 00 "+
+                                              "00 01 00 08 06 00 00 00");
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
+        Assert.assertEquals("Wrong flow stats size", 2, message.getFlowStats().size());
+        FlowStats flowStats1 = message.getFlowStats().get(0);
+        Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());
+        Assert.assertEquals("Wrong durationSec", 9, flowStats1.getDurationSec().intValue());
+        Assert.assertEquals("Wrong durationNsec", 7, flowStats1.getDurationNsec().intValue());
+        Assert.assertEquals("Wrong priority", 12, flowStats1.getPriority().intValue());
+        Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());
+        Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());
+        Assert.assertEquals("Wrong flags", new FlowModFlags(true, true, true, true, true), flowStats1.getFlags());
+        Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01,
+                0x01, 0x01, 0x01}), flowStats1.getCookie());
+        Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01,
+                0x01, 0x01, 0x01, 0x01}), flowStats1.getPacketCount());
+        Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01,
+                0x01, 0x01, 0x01, 0x01}), flowStats1.getByteCount());
+        Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());
+        flowStats1 = message.getFlowStats().get(1);
+        Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());
+        Assert.assertEquals("Wrong durationSec", 9, flowStats1.getDurationSec().intValue());
+        Assert.assertEquals("Wrong durationNsec", 7, flowStats1.getDurationNsec().intValue());
+        Assert.assertEquals("Wrong priority", 12, flowStats1.getPriority().intValue());
+        Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());
+        Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());
+        Assert.assertEquals("Wrong flags", new FlowModFlags(false, false, false, false, false), flowStats1.getFlags());
+        Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01,
+                0x01, 0x01, 0x01}), flowStats1.getCookie());
+        Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01,
+                0x01, 0x01, 0x01, 0x01}), flowStats1.getPacketCount());
+        Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01,
+                0x01, 0x01, 0x01, 0x01}), flowStats1.getByteCount());
+        Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());
+    }
 }
\ No newline at end of file
index 906d87fd8b224826739681e8bc8d0815c5234861..5ac385c750f2fc9f459b12331b6bd0cc3b51e0d6 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupTypes;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartReplyGroupFeaturesTest {\r
-\r
-    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testMultipartReplyGroupFeatures() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+\r
-                                              "00 00 00 0F "+// types\r
-                                              "00 00 00 0F "+// capabilities\r
-                                              "00 00 00 01 "+// max groups\r
-                                              "00 00 00 02 "+// max groups\r
-                                              "00 00 00 03 "+// max groups\r
-                                              "00 00 00 04 "+// max groups\r
-                                              "0F FF 98 01 "+// actions bitmap (all actions included)\r
-                                              "00 00 00 00 "+// actions bitmap (no actions included)\r
-                                              "00 00 00 00 "+// actions bitmap (no actions included)\r
-                                              "00 00 00 00"// actions bitmap (no actions included)\r
-                                              );\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyGroupFeaturesCase messageCase =\r
-                (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();\r
-        Assert.assertEquals("Wrong group types", new GroupTypes(true, true, true, true), message.getTypes());\r
-        Assert.assertEquals("Wrong capabilities", new GroupCapabilities(true, true, true, true),\r
-                message.getCapabilities());\r
-        Assert.assertEquals("Wrong max groups", 1, message.getMaxGroups().get(0).intValue());\r
-        Assert.assertEquals("Wrong max groups", 2, message.getMaxGroups().get(1).intValue());\r
-        Assert.assertEquals("Wrong max groups", 3, message.getMaxGroups().get(2).intValue());\r
-        Assert.assertEquals("Wrong max groups", 4, message.getMaxGroups().get(3).intValue());\r
-        Assert.assertEquals("Wrong actions bitmap", new ActionType(true, true, true, true, false, true, true, true, true,\r
-                true, true, true, true, true, true, true, true), message.getActionsBitmap().get(0));\r
-        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,\r
-                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(1));\r
-        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,\r
-                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(2));\r
-        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,\r
-                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(3));\r
-    }\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     * (with different group types and capabilities)\r
-     */\r
-    @Test\r
-    public void testMultipartReplyGroupFeatures2() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+\r
-                                              "00 00 00 00 "+// types\r
-                                              "00 00 00 00 "+// capabilities\r
-                                              "00 00 00 01 "+// max groups\r
-                                              "00 00 00 02 "+// max groups\r
-                                              "00 00 00 03 "+// max groups\r
-                                              "00 00 00 04 "+// max groups\r
-                                              "00 00 00 00 "+// actions bitmap (all actions included)\r
-                                              "00 00 00 00 "+// actions bitmap (no actions included)\r
-                                              "00 00 00 00 "+// actions bitmap (no actions included)\r
-                                              "00 00 00 00"// actions bitmap (no actions included)\r
-                                              );\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyGroupFeaturesCase messageCase =\r
-                (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();\r
-        Assert.assertEquals("Wrong group types", new GroupTypes(false, false, false, false), message.getTypes());\r
-        Assert.assertEquals("Wrong capabilities", new GroupCapabilities(false, false, false, false),\r
-                message.getCapabilities());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupTypes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartReplyGroupFeaturesTest {
+
+    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testMultipartReplyGroupFeatures() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+
+                                              "00 00 00 0F "+// types
+                                              "00 00 00 0F "+// capabilities
+                                              "00 00 00 01 "+// max groups
+                                              "00 00 00 02 "+// max groups
+                                              "00 00 00 03 "+// max groups
+                                              "00 00 00 04 "+// max groups
+                                              "0F FF 98 01 "+// actions bitmap (all actions included)
+                                              "00 00 00 00 "+// actions bitmap (no actions included)
+                                              "00 00 00 00 "+// actions bitmap (no actions included)
+                                              "00 00 00 00"// actions bitmap (no actions included)
+                                              );
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyGroupFeaturesCase messageCase =
+                (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
+        Assert.assertEquals("Wrong group types", new GroupTypes(true, true, true, true), message.getTypes());
+        Assert.assertEquals("Wrong capabilities", new GroupCapabilities(true, true, true, true),
+                message.getCapabilities());
+        Assert.assertEquals("Wrong max groups", 1, message.getMaxGroups().get(0).intValue());
+        Assert.assertEquals("Wrong max groups", 2, message.getMaxGroups().get(1).intValue());
+        Assert.assertEquals("Wrong max groups", 3, message.getMaxGroups().get(2).intValue());
+        Assert.assertEquals("Wrong max groups", 4, message.getMaxGroups().get(3).intValue());
+        Assert.assertEquals("Wrong actions bitmap", new ActionType(true, true, true, true, false, true, true, true, true,
+                true, true, true, true, true, true, true, true), message.getActionsBitmap().get(0));
+        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,
+                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(1));
+        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,
+                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(2));
+        Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false,
+                false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(3));
+    }
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     * (with different group types and capabilities)
+     */
+    @Test
+    public void testMultipartReplyGroupFeatures2() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 08 00 01 00 00 00 00 "+
+                                              "00 00 00 00 "+// types
+                                              "00 00 00 00 "+// capabilities
+                                              "00 00 00 01 "+// max groups
+                                              "00 00 00 02 "+// max groups
+                                              "00 00 00 03 "+// max groups
+                                              "00 00 00 04 "+// max groups
+                                              "00 00 00 00 "+// actions bitmap (all actions included)
+                                              "00 00 00 00 "+// actions bitmap (no actions included)
+                                              "00 00 00 00 "+// actions bitmap (no actions included)
+                                              "00 00 00 00"// actions bitmap (no actions included)
+                                              );
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyGroupFeaturesCase messageCase =
+                (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
+        Assert.assertEquals("Wrong group types", new GroupTypes(false, false, false, false), message.getTypes());
+        Assert.assertEquals("Wrong capabilities", new GroupCapabilities(false, false, false, false),
+                message.getCapabilities());
+    }
 }
\ No newline at end of file
index 208bea1939232702c671091dd3206caaa1247316..453c755dc5ec62137236224566ef58617287f184 100644 (file)
@@ -1,80 +1,80 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandTypeBitmap;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.features._case.MultipartReplyMeterFeatures;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartReplyMeterFeaturesTest {\r
-\r
-    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testMultipartReplyMeterFeatures(){\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+\r
-                                              "00 00 00 0A " + // maxMeter\r
-                                              "00 00 00 06 " + // bandTypes\r
-                                              "00 00 00 0F " + // capabilities\r
-                                              "07 08 00 00" // maxBands, maxColor, padding\r
-                                              );\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyMeterFeaturesCase messageCase = (MultipartReplyMeterFeaturesCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyMeterFeatures message = messageCase.getMultipartReplyMeterFeatures();\r
-        Assert.assertEquals("Wrong maxMeter", 10, message.getMaxMeter().intValue());\r
-        Assert.assertEquals("Wrong bandTypes", new MeterBandTypeBitmap(true, true), message.getBandTypes());\r
-        Assert.assertEquals("Wrong capabilities", new MeterFlags(true, true, true, true), message.getCapabilities());\r
-        Assert.assertEquals("Wrong maxBands", 7, message.getMaxBands().intValue());\r
-        Assert.assertEquals("Wrong maxColor", 8, message.getMaxColor().intValue());\r
-    }\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testMultipartReplyMeterFeatures2(){\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+\r
-                                              "00 00 00 09 " + // maxMeter\r
-                                              "00 00 00 00 " + // bandTypes\r
-                                              "00 00 00 00 " + // capabilities\r
-                                              "03 04 00 00" // maxBands, maxColor, padding\r
-                                              );\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyMeterFeaturesCase messageCase = (MultipartReplyMeterFeaturesCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyMeterFeatures message = messageCase.getMultipartReplyMeterFeatures();\r
-        Assert.assertEquals("Wrong maxMeter", 9, message.getMaxMeter().intValue());\r
-        Assert.assertEquals("Wrong bandTypes", new MeterBandTypeBitmap(false, false), message.getBandTypes());\r
-        Assert.assertEquals("Wrong capabilities", new MeterFlags(false, false, false, false), message.getCapabilities());\r
-        Assert.assertEquals("Wrong maxBands", 3, message.getMaxBands().intValue());\r
-        Assert.assertEquals("Wrong maxColor", 4, message.getMaxColor().intValue());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandTypeBitmap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.features._case.MultipartReplyMeterFeatures;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartReplyMeterFeaturesTest {
+
+    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testMultipartReplyMeterFeatures(){
+        ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+
+                                              "00 00 00 0A " + // maxMeter
+                                              "00 00 00 06 " + // bandTypes
+                                              "00 00 00 0F " + // capabilities
+                                              "07 08 00 00" // maxBands, maxColor, padding
+                                              );
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyMeterFeaturesCase messageCase = (MultipartReplyMeterFeaturesCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyMeterFeatures message = messageCase.getMultipartReplyMeterFeatures();
+        Assert.assertEquals("Wrong maxMeter", 10, message.getMaxMeter().intValue());
+        Assert.assertEquals("Wrong bandTypes", new MeterBandTypeBitmap(true, true), message.getBandTypes());
+        Assert.assertEquals("Wrong capabilities", new MeterFlags(true, true, true, true), message.getCapabilities());
+        Assert.assertEquals("Wrong maxBands", 7, message.getMaxBands().intValue());
+        Assert.assertEquals("Wrong maxColor", 8, message.getMaxColor().intValue());
+    }
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testMultipartReplyMeterFeatures2(){
+        ByteBuf bb = BufferHelper.buildBuffer("00 0B 00 01 00 00 00 00 "+
+                                              "00 00 00 09 " + // maxMeter
+                                              "00 00 00 00 " + // bandTypes
+                                              "00 00 00 00 " + // capabilities
+                                              "03 04 00 00" // maxBands, maxColor, padding
+                                              );
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyMeterFeaturesCase messageCase = (MultipartReplyMeterFeaturesCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyMeterFeatures message = messageCase.getMultipartReplyMeterFeatures();
+        Assert.assertEquals("Wrong maxMeter", 9, message.getMaxMeter().intValue());
+        Assert.assertEquals("Wrong bandTypes", new MeterBandTypeBitmap(false, false), message.getBandTypes());
+        Assert.assertEquals("Wrong capabilities", new MeterFlags(false, false, false, false), message.getCapabilities());
+        Assert.assertEquals("Wrong maxBands", 3, message.getMaxBands().intValue());
+        Assert.assertEquals("Wrong maxColor", 4, message.getMaxColor().intValue());
+    }
 }
\ No newline at end of file
index 139ea08af1506ebb07736720f05b2b9c0894efe5..f397831dba108c2a56809d2ed9e1eb2c58c7fc4a 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortDescCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.MultipartReplyPortDesc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.Ports;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartReplyPortDescTest {\r
-\r
-    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testEmptyMultipartReplyPortDesc() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 00 00 00 00 00");\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyPortDescCase messageCase = (MultipartReplyPortDescCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyPortDesc message = messageCase.getMultipartReplyPortDesc();\r
-        Assert.assertEquals("Wrong table features size", 0, message.getPorts().size());\r
-    }\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testMultipartReplyPortDesc() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 00 00 00 00 00 " +\r
-                                              // first port desc\r
-                                              "00 01 02 03 00 00 00 00 " + // portNo, padding\r
-                                              "08 00 27 00 B0 EB 00 00 " + // mac address, padding\r
-                                              "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 " + // name\r
-                                              "00 00 00 65 " + //port config\r
-                                              "00 00 00 07 " + //port state\r
-                                              "00 00 00 81 " + //current features\r
-                                              "00 00 FF FF " + //advertised features\r
-                                              "00 00 C1 89 " + //supported features\r
-                                              "00 00 C5 8D " + //peer features\r
-                                              "00 00 00 81 " + //curr speed\r
-                                              "00 00 00 80 " + //max speed\r
-                                              // second port desc\r
-                                              "00 00 00 01 00 00 00 00 " + // portNo, padding\r
-                                              "08 00 27 00 B0 EB 00 00 " + // mac address, padding\r
-                                              "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 " + // name\r
-                                              "00 00 00 00 " + //port config\r
-                                              "00 00 00 00 " + //port state\r
-                                              "00 00 00 00 " + //current features\r
-                                              "00 00 00 00 " + //advertised features\r
-                                              "00 00 00 00 " + //supported features\r
-                                              "00 00 00 00 " + //peer features\r
-                                              "00 00 00 05 " + //curr speed\r
-                                              "00 00 00 06" //max speed\r
-                                              );\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyPortDescCase messageCase = (MultipartReplyPortDescCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyPortDesc message = messageCase.getMultipartReplyPortDesc();\r
-        Assert.assertEquals("Wrong port desc size", 2, message.getPorts().size());\r
-        Ports port = message.getPorts().get(0);\r
-        Assert.assertEquals("Wrong portNo", 66051L, port.getPortNo().longValue());\r
-        Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"), port.getHwAddr());\r
-        Assert.assertEquals("Wrong portName", "Opendaylight", port.getName());\r
-        Assert.assertEquals("Wrong portConfig", new PortConfig(true, true, true, true), port.getConfig());\r
-        Assert.assertEquals("Wrong portState", new PortState(true, true, true), port.getState());\r
-        Assert.assertEquals("Wrong currentFeatures", new PortFeatures(false, false, false, false, false, true,\r
-                false, false, false, true, false, false, false, false, false, false), port.getCurrentFeatures());\r
-        Assert.assertEquals("Wrong advertisedFeatures",  new PortFeatures(true, true, true, true, true, true,\r
-                true, true, true, true, true, true, true, true, true, true), port.getAdvertisedFeatures());\r
-        Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(true, true, false, false, false, true,\r
-                false, false, false, true, false, false, false, false, true, true), port.getSupportedFeatures());\r
-        Assert.assertEquals("Wrong peerFeatures", new PortFeatures(true, true, true, false, false, true, false,\r
-                false, false, true, false, false, false, true, true, true), port.getPeerFeatures());\r
-        Assert.assertEquals("Wrong currSpeed", 129L, port.getCurrSpeed().longValue());\r
-        Assert.assertEquals("Wrong maxSpeed", 128L, port.getMaxSpeed().longValue());\r
-        port = message.getPorts().get(1);\r
-        Assert.assertEquals("Wrong portNo", 1L, port.getPortNo().longValue());\r
-        Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"), port.getHwAddr());\r
-        Assert.assertEquals("Wrong portName", "Opendaylight", port.getName());\r
-        Assert.assertEquals("Wrong portConfig", new PortConfig(false, false, false, false), port.getConfig());\r
-        Assert.assertEquals("Wrong portState", new PortState(false, false, false), port.getState());\r
-        Assert.assertEquals("Wrong currentFeatures", new PortFeatures(false, false, false, false, false, false, false,\r
-                false, false, false, false, false, false, false, false, false), port.getCurrentFeatures());\r
-        Assert.assertEquals("Wrong advertisedFeatures",  new PortFeatures(false, false, false, false, false, false, false,\r
-                false, false, false, false, false, false, false, false, false), port.getAdvertisedFeatures());\r
-        Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(false, false, false, false, false, false, false,\r
-                false, false, false, false, false, false, false, false, false), port.getSupportedFeatures());\r
-        Assert.assertEquals("Wrong peerFeatures", new PortFeatures(false, false, false, false, false, false, false,\r
-                false, false, false, false, false, false, false, false, false), port.getPeerFeatures());\r
-        Assert.assertEquals("Wrong currSpeed", 5L, port.getCurrSpeed().longValue());\r
-        Assert.assertEquals("Wrong maxSpeed", 6L, port.getMaxSpeed().longValue());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortDescCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.MultipartReplyPortDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.Ports;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartReplyPortDescTest {
+
+    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testEmptyMultipartReplyPortDesc() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 00 00 00 00 00");
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyPortDescCase messageCase = (MultipartReplyPortDescCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyPortDesc message = messageCase.getMultipartReplyPortDesc();
+        Assert.assertEquals("Wrong table features size", 0, message.getPorts().size());
+    }
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testMultipartReplyPortDesc() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 0D 00 00 00 00 00 00 " +
+                                              // first port desc
+                                              "00 01 02 03 00 00 00 00 " + // portNo, padding
+                                              "08 00 27 00 B0 EB 00 00 " + // mac address, padding
+                                              "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 " + // name
+                                              "00 00 00 65 " + //port config
+                                              "00 00 00 07 " + //port state
+                                              "00 00 00 81 " + //current features
+                                              "00 00 FF FF " + //advertised features
+                                              "00 00 C1 89 " + //supported features
+                                              "00 00 C5 8D " + //peer features
+                                              "00 00 00 81 " + //curr speed
+                                              "00 00 00 80 " + //max speed
+                                              // second port desc
+                                              "00 00 00 01 00 00 00 00 " + // portNo, padding
+                                              "08 00 27 00 B0 EB 00 00 " + // mac address, padding
+                                              "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 " + // name
+                                              "00 00 00 00 " + //port config
+                                              "00 00 00 00 " + //port state
+                                              "00 00 00 00 " + //current features
+                                              "00 00 00 00 " + //advertised features
+                                              "00 00 00 00 " + //supported features
+                                              "00 00 00 00 " + //peer features
+                                              "00 00 00 05 " + //curr speed
+                                              "00 00 00 06" //max speed
+                                              );
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 13, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyPortDescCase messageCase = (MultipartReplyPortDescCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyPortDesc message = messageCase.getMultipartReplyPortDesc();
+        Assert.assertEquals("Wrong port desc size", 2, message.getPorts().size());
+        Ports port = message.getPorts().get(0);
+        Assert.assertEquals("Wrong portNo", 66051L, port.getPortNo().longValue());
+        Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"), port.getHwAddr());
+        Assert.assertEquals("Wrong portName", "Opendaylight", port.getName());
+        Assert.assertEquals("Wrong portConfig", new PortConfig(true, true, true, true), port.getConfig());
+        Assert.assertEquals("Wrong portState", new PortState(true, true, true), port.getState());
+        Assert.assertEquals("Wrong currentFeatures", new PortFeatures(false, false, false, false, false, true,
+                false, false, false, true, false, false, false, false, false, false), port.getCurrentFeatures());
+        Assert.assertEquals("Wrong advertisedFeatures",  new PortFeatures(true, true, true, true, true, true,
+                true, true, true, true, true, true, true, true, true, true), port.getAdvertisedFeatures());
+        Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(true, true, false, false, false, true,
+                false, false, false, true, false, false, false, false, true, true), port.getSupportedFeatures());
+        Assert.assertEquals("Wrong peerFeatures", new PortFeatures(true, true, true, false, false, true, false,
+                false, false, true, false, false, false, true, true, true), port.getPeerFeatures());
+        Assert.assertEquals("Wrong currSpeed", 129L, port.getCurrSpeed().longValue());
+        Assert.assertEquals("Wrong maxSpeed", 128L, port.getMaxSpeed().longValue());
+        port = message.getPorts().get(1);
+        Assert.assertEquals("Wrong portNo", 1L, port.getPortNo().longValue());
+        Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"), port.getHwAddr());
+        Assert.assertEquals("Wrong portName", "Opendaylight", port.getName());
+        Assert.assertEquals("Wrong portConfig", new PortConfig(false, false, false, false), port.getConfig());
+        Assert.assertEquals("Wrong portState", new PortState(false, false, false), port.getState());
+        Assert.assertEquals("Wrong currentFeatures", new PortFeatures(false, false, false, false, false, false, false,
+                false, false, false, false, false, false, false, false, false), port.getCurrentFeatures());
+        Assert.assertEquals("Wrong advertisedFeatures",  new PortFeatures(false, false, false, false, false, false, false,
+                false, false, false, false, false, false, false, false, false), port.getAdvertisedFeatures());
+        Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(false, false, false, false, false, false, false,
+                false, false, false, false, false, false, false, false, false), port.getSupportedFeatures());
+        Assert.assertEquals("Wrong peerFeatures", new PortFeatures(false, false, false, false, false, false, false,
+                false, false, false, false, false, false, false, false, false), port.getPeerFeatures());
+        Assert.assertEquals("Wrong currSpeed", 5L, port.getCurrSpeed().longValue());
+        Assert.assertEquals("Wrong maxSpeed", 6L, port.getMaxSpeed().longValue());
+    }
 }
\ No newline at end of file
index 64ad0970ed17c54be8ac463a95802d52f2e9f7b5..2b223ca248e0d27a16cb9b0022c56b31bd80986b 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeatures;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeatures;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartReplyTableFeaturesTest {\r
-\r
-    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testEmptyMultipartReplyTableFeatures() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00");\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();\r
-        Assert.assertEquals("Wrong table features size", 0, message.getTableFeatures().size());\r
-    }\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testMultipartReplyTableFeatures() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00 "+\r
-                                              // first table feature\r
-                                              "00 40 01 00 00 00 00 00 "+// length, tableId, padding\r
-                                              "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00 "+\r
-                                              "00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name\r
-                                              "00 00 00 00 00 00 00 01 "+// metadata match\r
-                                              "00 00 00 00 00 00 00 02 "+// metadata write\r
-                                              "00 00 00 00 "+// config\r
-                                              "00 00 00 2A "+// max entries\r
-                                              // second table feature\r
-                                              "00 40 02 00 00 00 00 00 "+// length, tableId, padding\r
-                                              "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00"\r
-                                              + " 00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name\r
-                                              "00 00 00 00 00 00 00 03 "+// metadata match\r
-                                              "00 00 00 00 00 00 00 04 "+// metadata write\r
-                                              "00 00 00 03 "+// config\r
-                                              "00 00 00 2B"  // max entries\r
-                                              );\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();\r
-        Assert.assertEquals("Wrong table features size", 2, message.getTableFeatures().size());\r
-        TableFeatures feature = message.getTableFeatures().get(0);\r
-        Assert.assertEquals("Wrong table id", 1, feature.getTableId().intValue());\r
-        Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());\r
-        Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 1}, feature.getMetadataMatch());\r
-        Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 2}, feature.getMetadataWrite());\r
-        Assert.assertEquals("Wrong config", false, feature.getConfig().isOFPTCDEPRECATEDMASK());\r
-        Assert.assertEquals("Wrong max entries", 42, feature.getMaxEntries().intValue());\r
-        feature = message.getTableFeatures().get(1);\r
-        Assert.assertEquals("Wrong table id", 2, feature.getTableId().intValue());\r
-        Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());\r
-        Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 3}, feature.getMetadataMatch());\r
-        Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 4}, feature.getMetadataWrite());\r
-        Assert.assertEquals("Wrong config", true, feature.getConfig().isOFPTCDEPRECATEDMASK());\r
-        Assert.assertEquals("Wrong max entries", 43, feature.getMaxEntries().intValue());\r
-    }\r
-\r
-    /**\r
-     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void testMultipartReplyTableFeatures2() {\r
-        ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00 "+\r
-                                              "00 B0 01 00 00 00 00 00 "+// length, tableId, padding\r
-                                              "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00 "+\r
-                                              "00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name\r
-                                              "00 00 00 00 00 00 00 01 "+// metadata match\r
-                                              "00 00 00 00 00 00 00 02 "+// metadata write\r
-                                              "00 00 00 00 "+// config\r
-                                              "00 00 00 2A "+// max entries\r
-                                              "00 00 00 04 00 00 00 00 "+\r
-                                              "00 01 00 04 00 00 00 00 "+\r
-                                              "00 02 00 08 01 02 03 04 "+\r
-                                              "00 03 00 07 05 06 07 00 "+\r
-                                              "00 04 00 04 00 00 00 00 "+\r
-                                              "00 05 00 04 00 00 00 00 "+\r
-                                              "00 06 00 04 00 00 00 00 "+\r
-                                              "00 07 00 04 00 00 00 00 "+\r
-                                              "00 08 00 04 00 00 00 00 "+\r
-                                              "00 0A 00 04 00 00 00 00 "+\r
-                                              "00 0C 00 04 00 00 00 00 "+\r
-                                              "00 0D 00 04 00 00 00 00 "+\r
-                                              "00 0E 00 04 00 00 00 00 "+\r
-                                              "00 0F 00 04 00 00 00 00"\r
-                                              );\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();\r
-        MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();\r
-        Assert.assertEquals("Wrong table features size", 1, message.getTableFeatures().size());\r
-        TableFeatures feature = message.getTableFeatures().get(0);\r
-        Assert.assertEquals("Wrong table id", 1, feature.getTableId().intValue());\r
-        Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());\r
-        Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 1}, feature.getMetadataMatch());\r
-        Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 2}, feature.getMetadataWrite());\r
-        Assert.assertEquals("Wrong config", false, feature.getConfig().isOFPTCDEPRECATEDMASK());\r
-        Assert.assertEquals("Wrong max entries", 42, feature.getMaxEntries().intValue());\r
-        Assert.assertEquals("Wrong properties size", 14, feature.getTableFeatureProperties().size());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONS,\r
-                feature.getTableFeatureProperties().get(0).getType());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS,\r
-                feature.getTableFeatureProperties().get(1).getType());\r
-        TableFeatureProperties property = feature.getTableFeatureProperties().get(2);\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLES,\r
-                property.getType());\r
-        List<NextTableIds> tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class)\r
-                .getNextTableIds();\r
-        Assert.assertEquals("Wrong next table id size", 4, tableIds.size());\r
-        Assert.assertEquals("Wrong next table id", 1, tableIds.get(0).getTableId().intValue());\r
-        Assert.assertEquals("Wrong next table id", 2, tableIds.get(1).getTableId().intValue());\r
-        Assert.assertEquals("Wrong next table id", 3, tableIds.get(2).getTableId().intValue());\r
-        Assert.assertEquals("Wrong next table id", 4, tableIds.get(3).getTableId().intValue());\r
-        property = feature.getTableFeatureProperties().get(3);\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLESMISS,\r
-                property.getType());\r
-        tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class)\r
-                .getNextTableIds();\r
-        Assert.assertEquals("Wrong next table id size", 3, tableIds.size());\r
-        Assert.assertEquals("Wrong next table id", 5, tableIds.get(0).getTableId().intValue());\r
-        Assert.assertEquals("Wrong next table id", 6, tableIds.get(1).getTableId().intValue());\r
-        Assert.assertEquals("Wrong next table id", 7, tableIds.get(2).getTableId().intValue());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONS,\r
-                feature.getTableFeatureProperties().get(4).getType());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,\r
-                feature.getTableFeatureProperties().get(5).getType());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONS,\r
-                feature.getTableFeatureProperties().get(6).getType());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,\r
-                feature.getTableFeatureProperties().get(7).getType());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTMATCH,\r
-                feature.getTableFeatureProperties().get(8).getType());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWILDCARDS,\r
-                feature.getTableFeatureProperties().get(9).getType());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELD,\r
-                feature.getTableFeatureProperties().get(10).getType());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS,\r
-                feature.getTableFeatureProperties().get(11).getType());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELD,\r
-                feature.getTableFeatureProperties().get(12).getType());\r
-        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS,\r
-                feature.getTableFeatureProperties().get(13).getType());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartReplyTableFeaturesTest {
+
+    private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testEmptyMultipartReplyTableFeatures() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00");
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();
+        Assert.assertEquals("Wrong table features size", 0, message.getTableFeatures().size());
+    }
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testMultipartReplyTableFeatures() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00 "+
+                                              // first table feature
+                                              "00 40 01 00 00 00 00 00 "+// length, tableId, padding
+                                              "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00 "+
+                                              "00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name
+                                              "00 00 00 00 00 00 00 01 "+// metadata match
+                                              "00 00 00 00 00 00 00 02 "+// metadata write
+                                              "00 00 00 00 "+// config
+                                              "00 00 00 2A "+// max entries
+                                              // second table feature
+                                              "00 40 02 00 00 00 00 00 "+// length, tableId, padding
+                                              "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00"
+                                              + " 00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name
+                                              "00 00 00 00 00 00 00 03 "+// metadata match
+                                              "00 00 00 00 00 00 00 04 "+// metadata write
+                                              "00 00 00 03 "+// config
+                                              "00 00 00 2B"  // max entries
+                                              );
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();
+        Assert.assertEquals("Wrong table features size", 2, message.getTableFeatures().size());
+        TableFeatures feature = message.getTableFeatures().get(0);
+        Assert.assertEquals("Wrong table id", 1, feature.getTableId().intValue());
+        Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());
+        Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 1}, feature.getMetadataMatch());
+        Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 2}, feature.getMetadataWrite());
+        Assert.assertEquals("Wrong config", false, feature.getConfig().isOFPTCDEPRECATEDMASK());
+        Assert.assertEquals("Wrong max entries", 42, feature.getMaxEntries().intValue());
+        feature = message.getTableFeatures().get(1);
+        Assert.assertEquals("Wrong table id", 2, feature.getTableId().intValue());
+        Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());
+        Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 3}, feature.getMetadataMatch());
+        Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 4}, feature.getMetadataWrite());
+        Assert.assertEquals("Wrong config", true, feature.getConfig().isOFPTCDEPRECATEDMASK());
+        Assert.assertEquals("Wrong max entries", 43, feature.getMaxEntries().intValue());
+    }
+
+    /**
+     * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void testMultipartReplyTableFeatures2() {
+        ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00 "+
+                                              "00 B0 01 00 00 00 00 00 "+// length, tableId, padding
+                                              "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00 "+
+                                              "00 00 00 00 00 00 00 00 00 00 00 00 00 "+// name
+                                              "00 00 00 00 00 00 00 01 "+// metadata match
+                                              "00 00 00 00 00 00 00 02 "+// metadata write
+                                              "00 00 00 00 "+// config
+                                              "00 00 00 2A "+// max entries
+                                              "00 00 00 04 00 00 00 00 "+
+                                              "00 01 00 04 00 00 00 00 "+
+                                              "00 02 00 08 01 02 03 04 "+
+                                              "00 03 00 07 05 06 07 00 "+
+                                              "00 04 00 04 00 00 00 00 "+
+                                              "00 05 00 04 00 00 00 00 "+
+                                              "00 06 00 04 00 00 00 00 "+
+                                              "00 07 00 04 00 00 00 00 "+
+                                              "00 08 00 04 00 00 00 00 "+
+                                              "00 0A 00 04 00 00 00 00 "+
+                                              "00 0C 00 04 00 00 00 00 "+
+                                              "00 0D 00 04 00 00 00 00 "+
+                                              "00 0E 00 04 00 00 00 00 "+
+                                              "00 0F 00 04 00 00 00 00"
+                                              );
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
+        MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();
+        MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();
+        Assert.assertEquals("Wrong table features size", 1, message.getTableFeatures().size());
+        TableFeatures feature = message.getTableFeatures().get(0);
+        Assert.assertEquals("Wrong table id", 1, feature.getTableId().intValue());
+        Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());
+        Assert.assertArrayEquals("Wrong metadata match", new byte[]{0, 0, 0, 0, 0, 0, 0, 1}, feature.getMetadataMatch());
+        Assert.assertArrayEquals("Wrong metadata write", new byte[]{0, 0, 0, 0, 0, 0, 0, 2}, feature.getMetadataWrite());
+        Assert.assertEquals("Wrong config", false, feature.getConfig().isOFPTCDEPRECATEDMASK());
+        Assert.assertEquals("Wrong max entries", 42, feature.getMaxEntries().intValue());
+        Assert.assertEquals("Wrong properties size", 14, feature.getTableFeatureProperties().size());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONS,
+                feature.getTableFeatureProperties().get(0).getType());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS,
+                feature.getTableFeatureProperties().get(1).getType());
+        TableFeatureProperties property = feature.getTableFeatureProperties().get(2);
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLES,
+                property.getType());
+        List<NextTableIds> tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class)
+                .getNextTableIds();
+        Assert.assertEquals("Wrong next table id size", 4, tableIds.size());
+        Assert.assertEquals("Wrong next table id", 1, tableIds.get(0).getTableId().intValue());
+        Assert.assertEquals("Wrong next table id", 2, tableIds.get(1).getTableId().intValue());
+        Assert.assertEquals("Wrong next table id", 3, tableIds.get(2).getTableId().intValue());
+        Assert.assertEquals("Wrong next table id", 4, tableIds.get(3).getTableId().intValue());
+        property = feature.getTableFeatureProperties().get(3);
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLESMISS,
+                property.getType());
+        tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class)
+                .getNextTableIds();
+        Assert.assertEquals("Wrong next table id size", 3, tableIds.size());
+        Assert.assertEquals("Wrong next table id", 5, tableIds.get(0).getTableId().intValue());
+        Assert.assertEquals("Wrong next table id", 6, tableIds.get(1).getTableId().intValue());
+        Assert.assertEquals("Wrong next table id", 7, tableIds.get(2).getTableId().intValue());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONS,
+                feature.getTableFeatureProperties().get(4).getType());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,
+                feature.getTableFeatureProperties().get(5).getType());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONS,
+                feature.getTableFeatureProperties().get(6).getType());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,
+                feature.getTableFeatureProperties().get(7).getType());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTMATCH,
+                feature.getTableFeatureProperties().get(8).getType());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWILDCARDS,
+                feature.getTableFeatureProperties().get(9).getType());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELD,
+                feature.getTableFeatureProperties().get(10).getType());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS,
+                feature.getTableFeatureProperties().get(11).getType());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELD,
+                feature.getTableFeatureProperties().get(12).getType());
+        Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS,
+                feature.getTableFeatureProperties().get(13).getType());
+    }
 }
\ No newline at end of file
index 6ef4153d28ec78ae401abe70e9ce0e963f6fe385..0df462fee0fe79d7f35b4a21a0035a4460fbffbd 100644 (file)
@@ -1,52 +1,52 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10StatsReplyMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class OF10StatsReplyExperimenterTest {\r
-\r
-    @Mock DeserializerRegistry registry;\r
-\r
-    /**\r
-     * Tests {@link OF10StatsReplyMessageFactory} for experimenter body translation\r
-     */\r
-    @Test\r
-    public void test() {\r
-        OF10StatsReplyMessageFactory factory = new OF10StatsReplyMessageFactory();\r
-        factory.injectDeserializerRegistry(registry);\r
-\r
-        ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "\r
-                                            + "00 00 00 01"); // expID\r
-        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);\r
-\r
-        BufferHelper.checkHeaderV10(builtByFactory);\r
-        Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());\r
-        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());\r
-        Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class));\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10StatsReplyMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class OF10StatsReplyExperimenterTest {
+
+    @Mock DeserializerRegistry registry;
+
+    /**
+     * Tests {@link OF10StatsReplyMessageFactory} for experimenter body translation
+     */
+    @Test
+    public void test() {
+        OF10StatsReplyMessageFactory factory = new OF10StatsReplyMessageFactory();
+        factory.injectDeserializerRegistry(registry);
+
+        ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "
+                                            + "00 00 00 01"); // expID
+        MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
+
+        BufferHelper.checkHeaderV10(builtByFactory);
+        Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());
+        Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
+        Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class));
+    }
 }
\ No newline at end of file
index dcfbe924261c71b1a0624862caa4c9c6d326429a..b7a76b4262b43f0404e1be367aa90b892f4b8ec1 100644 (file)
@@ -1,65 +1,65 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class AbstractInstructionDeserializerTest {\r
-\r
-    /**\r
-     * Tests {@link AbstractInstructionDeserializer#deserializeHeader(ByteBuf)} with different\r
-     * instruction types\r
-     */\r
-    @Test(expected=IllegalStateException.class)\r
-    public void test() {\r
-        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 00 04");\r
-        GoToTableInstructionDeserializer deserializer = new GoToTableInstructionDeserializer();\r
-        Instruction instruction = deserializer.deserializeHeader(buffer);\r
-        Assert.assertEquals("Wrong type", GotoTable.class, instruction.getType());\r
-\r
-        buffer = ByteBufUtils.hexStringToByteBuf("00 02 00 04");\r
-        instruction = deserializer.deserializeHeader(buffer);\r
-        Assert.assertEquals("Wrong type", WriteMetadata.class, instruction.getType());\r
-\r
-        buffer = ByteBufUtils.hexStringToByteBuf("00 03 00 04");\r
-        instruction = deserializer.deserializeHeader(buffer);\r
-        Assert.assertEquals("Wrong type", WriteActions.class, instruction.getType());\r
-\r
-        buffer = ByteBufUtils.hexStringToByteBuf("00 04 00 04");\r
-        instruction = deserializer.deserializeHeader(buffer);\r
-        Assert.assertEquals("Wrong type", ApplyActions.class, instruction.getType());\r
-\r
-        buffer = ByteBufUtils.hexStringToByteBuf("00 05 00 04");\r
-        instruction = deserializer.deserializeHeader(buffer);\r
-        Assert.assertEquals("Wrong type", ClearActions.class, instruction.getType());\r
-\r
-        buffer = ByteBufUtils.hexStringToByteBuf("00 06 00 04");\r
-        instruction = deserializer.deserializeHeader(buffer);\r
-        Assert.assertEquals("Wrong type", Meter.class, instruction.getType());\r
-\r
-        buffer = ByteBufUtils.hexStringToByteBuf("00 00 00 04");\r
-        instruction = deserializer.deserializeHeader(buffer);\r
-        // exception expected\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.instruction;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class AbstractInstructionDeserializerTest {
+
+    /**
+     * Tests {@link AbstractInstructionDeserializer#deserializeHeader(ByteBuf)} with different
+     * instruction types
+     */
+    @Test(expected=IllegalStateException.class)
+    public void test() {
+        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 00 04");
+        GoToTableInstructionDeserializer deserializer = new GoToTableInstructionDeserializer();
+        Instruction instruction = deserializer.deserializeHeader(buffer);
+        Assert.assertEquals("Wrong type", GotoTable.class, instruction.getType());
+
+        buffer = ByteBufUtils.hexStringToByteBuf("00 02 00 04");
+        instruction = deserializer.deserializeHeader(buffer);
+        Assert.assertEquals("Wrong type", WriteMetadata.class, instruction.getType());
+
+        buffer = ByteBufUtils.hexStringToByteBuf("00 03 00 04");
+        instruction = deserializer.deserializeHeader(buffer);
+        Assert.assertEquals("Wrong type", WriteActions.class, instruction.getType());
+
+        buffer = ByteBufUtils.hexStringToByteBuf("00 04 00 04");
+        instruction = deserializer.deserializeHeader(buffer);
+        Assert.assertEquals("Wrong type", ApplyActions.class, instruction.getType());
+
+        buffer = ByteBufUtils.hexStringToByteBuf("00 05 00 04");
+        instruction = deserializer.deserializeHeader(buffer);
+        Assert.assertEquals("Wrong type", ClearActions.class, instruction.getType());
+
+        buffer = ByteBufUtils.hexStringToByteBuf("00 06 00 04");
+        instruction = deserializer.deserializeHeader(buffer);
+        Assert.assertEquals("Wrong type", Meter.class, instruction.getType());
+
+        buffer = ByteBufUtils.hexStringToByteBuf("00 00 00 04");
+        instruction = deserializer.deserializeHeader(buffer);
+        // exception expected
+    }
 }
\ No newline at end of file
index 49b11872931ff30e5141d7522f75ba60149ec618..3b464f397f118e94313e14a67b5601c38491d5ae 100644 (file)
@@ -1,49 +1,49 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6ExtHdrDeserializerTest {\r
-\r
-    /**\r
-     * Tests {@link OxmIpv6ExtHdrDeserializer#deserialize(ByteBuf)}\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ByteBuf buffer = BufferHelper.buildBuffer("80 00 4E 02 01 FF");\r
-\r
-        buffer.skipBytes(4); // skip XID\r
-        OxmIpv6ExtHdrDeserializer deserializer = new OxmIpv6ExtHdrDeserializer();\r
-        MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
-        Assert.assertEquals("Wrong entry value",\r
-                new Ipv6ExthdrFlags(true, true, true, true, true, true, true, true, true),\r
-                entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField());\r
-        Assert.assertEquals("Wrong entry mask", null, entry.getAugmentation(MaskMatchEntry.class));\r
-        Assert.assertTrue("Unread data", buffer.readableBytes() == 0);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6ExtHdrDeserializerTest {
+
+    /**
+     * Tests {@link OxmIpv6ExtHdrDeserializer#deserialize(ByteBuf)}
+     */
+    @Test
+    public void test() {
+        ByteBuf buffer = BufferHelper.buildBuffer("80 00 4E 02 01 FF");
+
+        buffer.skipBytes(4); // skip XID
+        OxmIpv6ExtHdrDeserializer deserializer = new OxmIpv6ExtHdrDeserializer();
+        MatchEntries entry = deserializer.deserialize(buffer);
+
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+        Assert.assertEquals("Wrong entry value",
+                new Ipv6ExthdrFlags(true, true, true, true, true, true, true, true, true),
+                entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField());
+        Assert.assertEquals("Wrong entry mask", null, entry.getAugmentation(MaskMatchEntry.class));
+        Assert.assertTrue("Unread data", buffer.readableBytes() == 0);
+    }
 }
\ No newline at end of file
index 9b0d1a4d6688a4bfa9aaebfa8b2615ce43fc2948..2c29dce18e7a8a4ef0c13c447f62504eb7ff7e00 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6FlabelDeserializerTest {\r
-\r
-    /**\r
-     * Tests {@link OxmIpv6FlabelDeserializer#deserialize(ByteBuf)}\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ByteBuf buffer = BufferHelper.buildBuffer("80 00 38 04 00 00 00 02");\r
-\r
-        buffer.skipBytes(4); // skip XID\r
-        OxmIpv6FlabelDeserializer deserializer = new OxmIpv6FlabelDeserializer();\r
-        MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv6Flabel.class, entry.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 2, \r
-                entry.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6FlabelDeserializerTest {
+
+    /**
+     * Tests {@link OxmIpv6FlabelDeserializer#deserialize(ByteBuf)}
+     */
+    @Test
+    public void test() {
+        ByteBuf buffer = BufferHelper.buildBuffer("80 00 38 04 00 00 00 02");
+
+        buffer.skipBytes(4); // skip XID
+        OxmIpv6FlabelDeserializer deserializer = new OxmIpv6FlabelDeserializer();
+        MatchEntries entry = deserializer.deserialize(buffer);
+
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv6Flabel.class, entry.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+        Assert.assertEquals("Wrong entry value", 2, 
+                entry.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());
+    }
 }
\ No newline at end of file
index 0cf62839914dbdf82f1cfb4922d8c356bb8db290..d0983876460a026d46661ca102262fdce12bda5f 100644 (file)
@@ -1,45 +1,45 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMetadataDeserializerTest {\r
-\r
-    /**\r
-     * Tests {@link OxmMetadataDeserializer#deserialize(ByteBuf)}\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ByteBuf buffer = BufferHelper.buildBuffer("80 00 04 08 00 00 00 00 00 00 00 03");\r
-\r
-        buffer.skipBytes(4); // skip XID\r
-        OxmMetadataDeserializer deserializer = new OxmMetadataDeserializer();\r
-        MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Metadata.class, entry.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
-        Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 03"), \r
-                entry.getAugmentation(MetadataMatchEntry.class).getMetadata());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMetadataDeserializerTest {
+
+    /**
+     * Tests {@link OxmMetadataDeserializer#deserialize(ByteBuf)}
+     */
+    @Test
+    public void test() {
+        ByteBuf buffer = BufferHelper.buildBuffer("80 00 04 08 00 00 00 00 00 00 00 03");
+
+        buffer.skipBytes(4); // skip XID
+        OxmMetadataDeserializer deserializer = new OxmMetadataDeserializer();
+        MatchEntries entry = deserializer.deserialize(buffer);
+
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Metadata.class, entry.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+        Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 03"), 
+                entry.getAugmentation(MetadataMatchEntry.class).getMetadata());
+    }
 }
\ No newline at end of file
index e8a379c7f46bc1b77d8f2d88b3d5c7a19a865078..728260e2504cd667bc1924be01e9c12abb07027e 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsBosDeserializerTest {\r
-\r
-    /**\r
-     * Tests {@link OxmMplsBosDeserializer#deserialize(ByteBuf)}\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ByteBuf buffer = BufferHelper.buildBuffer("80 00 48 01 00");\r
-\r
-        buffer.skipBytes(4); // skip XID\r
-        OxmMplsBosDeserializer deserializer = new OxmMplsBosDeserializer();\r
-        MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", MplsBos.class, entry.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", false, entry.getAugmentation(BosMatchEntry.class).isBos());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsBosDeserializerTest {
+
+    /**
+     * Tests {@link OxmMplsBosDeserializer#deserialize(ByteBuf)}
+     */
+    @Test
+    public void test() {
+        ByteBuf buffer = BufferHelper.buildBuffer("80 00 48 01 00");
+
+        buffer.skipBytes(4); // skip XID
+        OxmMplsBosDeserializer deserializer = new OxmMplsBosDeserializer();
+        MatchEntries entry = deserializer.deserialize(buffer);
+
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+        Assert.assertEquals("Wrong entry field", MplsBos.class, entry.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+        Assert.assertEquals("Wrong entry value", false, entry.getAugmentation(BosMatchEntry.class).isBos());
+    }
 }
\ No newline at end of file
index b33c8a26b15da9e642551edc01a1748cd3655be2..ab3e125e7069bfa8ddc65fba49c2db31ca6878c6 100644 (file)
@@ -1,43 +1,43 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmPbbIsidDeserializerTest {\r
-\r
-    /**\r
-     * Tests {@link OxmPbbIsidDeserializer#deserialize(ByteBuf)}\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ByteBuf buffer = BufferHelper.buildBuffer("80 00 4A 03 00 00 02");\r
-\r
-        buffer.skipBytes(4); // skip XID\r
-        OxmPbbIsidDeserializer deserializer = new OxmPbbIsidDeserializer();\r
-        MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", PbbIsid.class, entry.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 2, entry.getAugmentation(IsidMatchEntry.class).getIsid().intValue());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmPbbIsidDeserializerTest {
+
+    /**
+     * Tests {@link OxmPbbIsidDeserializer#deserialize(ByteBuf)}
+     */
+    @Test
+    public void test() {
+        ByteBuf buffer = BufferHelper.buildBuffer("80 00 4A 03 00 00 02");
+
+        buffer.skipBytes(4); // skip XID
+        OxmPbbIsidDeserializer deserializer = new OxmPbbIsidDeserializer();
+        MatchEntries entry = deserializer.deserialize(buffer);
+
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+        Assert.assertEquals("Wrong entry field", PbbIsid.class, entry.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+        Assert.assertEquals("Wrong entry value", 2, entry.getAugmentation(IsidMatchEntry.class).getIsid().intValue());
+    }
 }
\ No newline at end of file
index a51cc1226be3830187f746f13e2f105370bef337..e765ba65a2635fe4e1c1ebcfe3d21a5d099d339a 100644 (file)
@@ -1,46 +1,46 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.match;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanVidDeserializerTest {\r
-\r
-    /**\r
-     * Tests {@link OxmVlanVidDeserializer#deserialize(ByteBuf)}\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ByteBuf buffer = BufferHelper.buildBuffer("80 00 0C 02 20 0A");\r
-\r
-        buffer.skipBytes(4); // skip XID\r
-        OxmVlanVidDeserializer deserializer = new OxmVlanVidDeserializer();\r
-        MatchEntries entry = deserializer.deserialize(buffer);\r
-\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", VlanVid.class, entry.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 10,\r
-                entry.getAugmentation(VlanVidMatchEntry.class).getVlanVid().intValue());\r
-        Assert.assertEquals("Wrong entry value", false, \r
-                entry.getAugmentation(VlanVidMatchEntry.class).isCfiBit());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanVidDeserializerTest {
+
+    /**
+     * Tests {@link OxmVlanVidDeserializer#deserialize(ByteBuf)}
+     */
+    @Test
+    public void test() {
+        ByteBuf buffer = BufferHelper.buildBuffer("80 00 0C 02 20 0A");
+
+        buffer.skipBytes(4); // skip XID
+        OxmVlanVidDeserializer deserializer = new OxmVlanVidDeserializer();
+        MatchEntries entry = deserializer.deserialize(buffer);
+
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+        Assert.assertEquals("Wrong entry field", VlanVid.class, entry.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+        Assert.assertEquals("Wrong entry value", 10,
+                entry.getAugmentation(VlanVidMatchEntry.class).getVlanVid().intValue());
+        Assert.assertEquals("Wrong entry value", false, 
+                entry.getAugmentation(VlanVidMatchEntry.class).isCfiBit());
+    }
 }
\ No newline at end of file
index 28add5c658bc9a777c970bf86aa307a8977edabd..3ffbca70489bc1616c95ffd60a48a7e2270aaf7f 100644 (file)
@@ -1,60 +1,60 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class SerializationFactoryTest {\r
-\r
-    /**\r
-     * Test serializer lookup & serialization\r
-     */\r
-    @Test\r
-    public void test() {\r
-        SerializerRegistry registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        SerializationFactory factory = new SerializationFactory();\r
-        factory.setSerializerTable(registry);\r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        HelloInputBuilder helloBuilder = new HelloInputBuilder();\r
-        helloBuilder.setVersion((short) EncodeConstants.OF10_VERSION_ID);\r
-        helloBuilder.setXid(123456L);\r
-        helloBuilder.setElements(null);\r
-        factory.messageToBuffer(EncodeConstants.OF10_VERSION_ID, buffer, helloBuilder.build());\r
-        assertEquals("Serialization failed", EncodeConstants.OFHEADER_SIZE, buffer.readableBytes());\r
-    }\r
-\r
-    /**\r
-     * Test serializer not found scenario\r
-     */\r
-    @Test(expected=IllegalStateException.class)\r
-    public void testNotExistingSerializer() {\r
-        SerializerRegistry registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        SerializationFactory factory = new SerializationFactory();\r
-        factory.setSerializerTable(registry);\r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        HelloInputBuilder helloBuilder = new HelloInputBuilder();\r
-        helloBuilder.setVersion((short) EncodeConstants.OF10_VERSION_ID);\r
-        helloBuilder.setXid(123456L);\r
-        helloBuilder.setElements(null);\r
-        factory.messageToBuffer((short) 0, buffer, helloBuilder.build());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization;
+
+import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class SerializationFactoryTest {
+
+    /**
+     * Test serializer lookup & serialization
+     */
+    @Test
+    public void test() {
+        SerializerRegistry registry = new SerializerRegistryImpl();
+        registry.init();
+        SerializationFactory factory = new SerializationFactory();
+        factory.setSerializerTable(registry);
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        HelloInputBuilder helloBuilder = new HelloInputBuilder();
+        helloBuilder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
+        helloBuilder.setXid(123456L);
+        helloBuilder.setElements(null);
+        factory.messageToBuffer(EncodeConstants.OF10_VERSION_ID, buffer, helloBuilder.build());
+        assertEquals("Serialization failed", EncodeConstants.OFHEADER_SIZE, buffer.readableBytes());
+    }
+
+    /**
+     * Test serializer not found scenario
+     */
+    @Test(expected=IllegalStateException.class)
+    public void testNotExistingSerializer() {
+        SerializerRegistry registry = new SerializerRegistryImpl();
+        registry.init();
+        SerializationFactory factory = new SerializationFactory();
+        factory.setSerializerTable(registry);
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        HelloInputBuilder helloBuilder = new HelloInputBuilder();
+        helloBuilder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
+        helloBuilder.setXid(123456L);
+        helloBuilder.setElements(null);
+        factory.messageToBuffer((short) 0, buffer, helloBuilder.build());
+    }
 }
\ No newline at end of file
index 17b3f7addbb6814de34e73d00867340071c36c5e..77cc5c32d2e88eb9e69669ba80fabb938c0d88ba 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.MockitoAnnotations;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterInputMessageFactoryTest {\r
-\r
-    @Mock SerializerRegistry registry;\r
-    @Mock OFSerializer<ExperimenterInput> serializer;\r
-    private OFSerializer<ExperimenterInput> expFactory;\r
-\r
-    /**\r
-     * Sets up ExperimenterInputMessageFactory\r
-     * @param real true if setup should use real registry, false when mock is desired\r
-     */\r
-    public void startUp(boolean real) {\r
-        MockitoAnnotations.initMocks(this);\r
-        expFactory = new ExperimenterInputMessageFactory();\r
-        if (real) {\r
-            SerializerRegistry realRegistry = new SerializerRegistryImpl();\r
-            realRegistry.init();\r
-            ((SerializerRegistryInjector) expFactory).injectSerializerRegistry(realRegistry);\r
-        } else {\r
-            ((SerializerRegistryInjector) expFactory).injectSerializerRegistry(registry);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Testing of {@link ExperimenterInputMessageFactory} for correct serializer\r
-     * lookup and serialization\r
-     * @throws Exception \r
-     */\r
-    @Test(expected=IllegalStateException.class)\r
-    public void testV10Real() throws Exception {\r
-        startUp(true);\r
-        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setExperimenter(new ExperimenterId(42L));\r
-        ExperimenterInput input = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        expFactory.serialize(input, out);\r
-    }\r
-\r
-    /**\r
-     * Testing of {@link ExperimenterInputMessageFactory} for correct serializer\r
-     * lookup and serialization\r
-     * @throws Exception \r
-     */\r
-    @Test(expected=IllegalStateException.class)\r
-    public void testV13Real() throws Exception {\r
-        startUp(true);\r
-        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
-        builder.setExperimenter(new ExperimenterId(42L));\r
-        ExperimenterInput input = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        expFactory.serialize(input, out);\r
-    }\r
-\r
-    /**\r
-     * Testing of {@link ExperimenterInputMessageFactory} for correct serializer\r
-     * lookup and serialization\r
-     * @throws Exception \r
-     */\r
-    @Test\r
-    public void testV10() throws Exception {\r
-        startUp(false);\r
-        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setExperimenter(new ExperimenterId(42L));\r
-        ExperimenterInput input = builder.build();\r
-\r
-        Mockito.when(registry.getSerializer(\r
-                (ExperimenterIdSerializerKey<?>) Matchers.any())).thenReturn(serializer);\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        expFactory.serialize(input, out);\r
-    }\r
-\r
-    /**\r
-     * Testing of {@link ExperimenterInputMessageFactory} for correct serializer\r
-     * lookup and serialization\r
-     * @throws Exception \r
-     */\r
-    @Test\r
-    public void testV13() throws Exception {\r
-        startUp(false);\r
-        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
-        builder.setExperimenter(new ExperimenterId(42L));\r
-        ExperimenterInput input = builder.build();\r
-\r
-        Mockito.when(registry.getSerializer(\r
-                (ExperimenterIdSerializerKey<?>) Matchers.any())).thenReturn(serializer);\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        expFactory.serialize(input, out);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Test;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterInputMessageFactoryTest {
+
+    @Mock SerializerRegistry registry;
+    @Mock OFSerializer<ExperimenterInput> serializer;
+    private OFSerializer<ExperimenterInput> expFactory;
+
+    /**
+     * Sets up ExperimenterInputMessageFactory
+     * @param real true if setup should use real registry, false when mock is desired
+     */
+    public void startUp(boolean real) {
+        MockitoAnnotations.initMocks(this);
+        expFactory = new ExperimenterInputMessageFactory();
+        if (real) {
+            SerializerRegistry realRegistry = new SerializerRegistryImpl();
+            realRegistry.init();
+            ((SerializerRegistryInjector) expFactory).injectSerializerRegistry(realRegistry);
+        } else {
+            ((SerializerRegistryInjector) expFactory).injectSerializerRegistry(registry);
+        }
+    }
+
+    /**
+     * Testing of {@link ExperimenterInputMessageFactory} for correct serializer
+     * lookup and serialization
+     * @throws Exception 
+     */
+    @Test(expected=IllegalStateException.class)
+    public void testV10Real() throws Exception {
+        startUp(true);
+        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+        builder.setExperimenter(new ExperimenterId(42L));
+        ExperimenterInput input = builder.build();
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        expFactory.serialize(input, out);
+    }
+
+    /**
+     * Testing of {@link ExperimenterInputMessageFactory} for correct serializer
+     * lookup and serialization
+     * @throws Exception 
+     */
+    @Test(expected=IllegalStateException.class)
+    public void testV13Real() throws Exception {
+        startUp(true);
+        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+        builder.setExperimenter(new ExperimenterId(42L));
+        ExperimenterInput input = builder.build();
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        expFactory.serialize(input, out);
+    }
+
+    /**
+     * Testing of {@link ExperimenterInputMessageFactory} for correct serializer
+     * lookup and serialization
+     * @throws Exception 
+     */
+    @Test
+    public void testV10() throws Exception {
+        startUp(false);
+        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+        builder.setExperimenter(new ExperimenterId(42L));
+        ExperimenterInput input = builder.build();
+
+        Mockito.when(registry.getSerializer(
+                (ExperimenterIdSerializerKey<?>) Matchers.any())).thenReturn(serializer);
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        expFactory.serialize(input, out);
+    }
+
+    /**
+     * Testing of {@link ExperimenterInputMessageFactory} for correct serializer
+     * lookup and serialization
+     * @throws Exception 
+     */
+    @Test
+    public void testV13() throws Exception {
+        startUp(false);
+        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+        builder.setExperimenter(new ExperimenterId(42L));
+        ExperimenterInput input = builder.build();
+
+        Mockito.when(registry.getSerializer(
+                (ExperimenterIdSerializerKey<?>) Matchers.any())).thenReturn(serializer);
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        expFactory.serialize(input, out);
+    }
 }
\ No newline at end of file
index 9e38a5c656aafe47a36108c065a2d8e010369b5b..cfb64acce1ced6282a762d6901612a21b1248484 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.v10.grouping.MatchV10Builder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestDescCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.desc._case.MultipartRequestDescBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10StatsRequestInputFactoryTest {\r
-\r
-    private SerializerRegistry registry;\r
-    private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
-    /**\r
-     * Initializes serializer registry and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        multipartFactory = registry.getSerializer(\r
-                new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, MultipartRequestInput.class));\r
-    }\r
-\r
-    /**\r
-     * Testing OF10StatsRequestInputFactory (Desc) for correct serialization\r
-     * @throws Exception\r
-     */\r
-    @Test\r
-    public void testDesc() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPDESC);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestDescCaseBuilder caseBuilder = new MultipartRequestDescCaseBuilder();\r
-        MultipartRequestDescBuilder descBuilder = new MultipartRequestDescBuilder();\r
-        caseBuilder.setMultipartRequestDesc(descBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-        \r
-        BufferHelper.checkHeaderV10(out, (byte) 16, 12);\r
-        Assert.assertEquals("Wrong type", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
-    \r
-    /**\r
-     * Testing OF10StatsRequestInputFactory (Flow) for correct serialization\r
-     * @throws Exception\r
-     */\r
-    @Test\r
-    public void testFlow() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPFLOW);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();\r
-        MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();\r
-        MatchV10Builder matchBuilder = new MatchV10Builder();\r
-        matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true,\r
-                true, true, true, true));\r
-        matchBuilder.setNwSrcMask((short) 8);\r
-        matchBuilder.setNwDstMask((short) 16);\r
-        matchBuilder.setInPort(51);\r
-        matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));\r
-        matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));\r
-        matchBuilder.setDlVlan(52);\r
-        matchBuilder.setDlVlanPcp((short) 53);\r
-        matchBuilder.setDlType(54);\r
-        matchBuilder.setNwTos((short) 55);\r
-        matchBuilder.setNwProto((short) 56);\r
-        matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));\r
-        matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));\r
-        matchBuilder.setTpSrc(57);\r
-        matchBuilder.setTpDst(58);\r
-        flowBuilder.setMatchV10(matchBuilder.build());\r
-        flowBuilder.setTableId((short) 1);\r
-        flowBuilder.setOutPort(42L);\r
-        caseBuilder.setMultipartRequestFlow(flowBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-        \r
-        BufferHelper.checkHeaderV10(out, (byte) 16, 56);\r
-        Assert.assertEquals("Wrong type", 1, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong wildcards", 3414271, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong in-port", 51, out.readUnsignedShort());\r
-        byte[] dlSrc = new byte[6];\r
-        out.readBytes(dlSrc);\r
-        Assert.assertEquals("Wrong dl-src", "00:01:02:03:04:05", ByteBufUtils.macAddressToString(dlSrc));\r
-        byte[] dlDst = new byte[6];\r
-        out.readBytes(dlDst);\r
-        Assert.assertEquals("Wrong dl-dst", "05:04:03:02:01:00", ByteBufUtils.macAddressToString(dlDst));\r
-        Assert.assertEquals("Wrong dl-vlan", 52, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong dl-vlan-pcp", 53, out.readUnsignedByte());\r
-        out.skipBytes(1);\r
-        Assert.assertEquals("Wrong dl-type", 54, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong nw-tos", 55, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong nw-proto", 56, out.readUnsignedByte());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong nw-src", 167772161, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong nw-dst", 167772162, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong tp-src", 57, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong tp-dst", 58, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong table-id", 1, out.readUnsignedByte());\r
-        out.skipBytes(1);\r
-        Assert.assertEquals("Wrong out-port", 42, out.readUnsignedShort());\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
-    \r
-    /**\r
-     * Testing OF10StatsRequestInputFactory (Aggregate) for correct serialization\r
-     * @throws Exception\r
-     */\r
-    @Test\r
-    public void testAggregate() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPAGGREGATE);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();\r
-        MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();\r
-        MatchV10Builder matchBuilder = new MatchV10Builder();\r
-        matchBuilder.setWildcards(new FlowWildcardsV10(false, false, false, false,\r
-                false, false, false, false, false, false));\r
-        matchBuilder.setNwSrcMask((short) 32);\r
-        matchBuilder.setNwDstMask((short) 32);\r
-        matchBuilder.setInPort(51);\r
-        matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));\r
-        matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));\r
-        matchBuilder.setDlVlan(52);\r
-        matchBuilder.setDlVlanPcp((short) 53);\r
-        matchBuilder.setDlType(54);\r
-        matchBuilder.setNwTos((short) 55);\r
-        matchBuilder.setNwProto((short) 56);\r
-        matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));\r
-        matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));\r
-        matchBuilder.setTpSrc(57);\r
-        matchBuilder.setTpDst(58);\r
-        flowBuilder.setMatchV10(matchBuilder.build());\r
-        flowBuilder.setTableId((short) 42);\r
-        flowBuilder.setOutPort(6653L);\r
-        caseBuilder.setMultipartRequestFlow(flowBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-        \r
-        BufferHelper.checkHeaderV10(out, (byte) 16, 56);\r
-        Assert.assertEquals("Wrong type", 2, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong wildcards", 0, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong in-port", 51, out.readUnsignedShort());\r
-        byte[] dlSrc = new byte[6];\r
-        out.readBytes(dlSrc);\r
-        Assert.assertEquals("Wrong dl-src", "00:01:02:03:04:05", ByteBufUtils.macAddressToString(dlSrc));\r
-        byte[] dlDst = new byte[6];\r
-        out.readBytes(dlDst);\r
-        Assert.assertEquals("Wrong dl-dst", "05:04:03:02:01:00", ByteBufUtils.macAddressToString(dlDst));\r
-        Assert.assertEquals("Wrong dl-vlan", 52, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong dl-vlan-pcp", 53, out.readUnsignedByte());\r
-        out.skipBytes(1);\r
-        Assert.assertEquals("Wrong dl-type", 54, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong nw-tos", 55, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong nw-proto", 56, out.readUnsignedByte());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong nw-src", 167772161, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong nw-dst", 167772162, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong tp-src", 57, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong tp-dst", 58, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong table-id", 42, out.readUnsignedByte());\r
-        out.skipBytes(1);\r
-        Assert.assertEquals("Wrong out-port", 6653, out.readUnsignedShort());\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
-    \r
-    /**\r
-     * Testing OF10StatsRequestInputFactory (Table) for correct serialization\r
-     * @throws Exception\r
-     */\r
-    @Test\r
-    public void testTable() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPTABLE);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestTableCaseBuilder caseBuilder = new MultipartRequestTableCaseBuilder();\r
-        MultipartRequestTableBuilder tableBuilder = new MultipartRequestTableBuilder();\r
-        caseBuilder.setMultipartRequestTable(tableBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-        \r
-        BufferHelper.checkHeaderV10(out, (byte) 16, 12);\r
-        Assert.assertEquals("Wrong type", 3, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
-    \r
-    /**\r
-     * Testing OF10StatsRequestInputFactory (Port) for correct serialization\r
-     * @throws Exception\r
-     */\r
-    @Test\r
-    public void testPort() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPPORTSTATS);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();\r
-        MultipartRequestPortStatsBuilder portBuilder = new MultipartRequestPortStatsBuilder();\r
-        portBuilder.setPortNo(15L);\r
-        caseBuilder.setMultipartRequestPortStats(portBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-        \r
-        BufferHelper.checkHeaderV10(out, (byte) 16, 20);\r
-        Assert.assertEquals("Wrong type", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong port-no", 15, out.readUnsignedShort());\r
-        out.skipBytes(6);\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Testing OF10StatsRequestInputFactory (Queue) for correct serialization\r
-     * @throws Exception\r
-     */\r
-    @Test\r
-    public void testQueue() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPQUEUE);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();\r
-        MultipartRequestQueueBuilder queueBuilder = new MultipartRequestQueueBuilder();\r
-        queueBuilder.setPortNo(15L);\r
-        queueBuilder.setQueueId(16L);\r
-        caseBuilder.setMultipartRequestQueue(queueBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-        \r
-        BufferHelper.checkHeaderV10(out, (byte) 16, 20);\r
-        Assert.assertEquals("Wrong type", 5, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong port-no", 15, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong queue-id", 16, out.readUnsignedInt());\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.v10.grouping.MatchV10Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestDescCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.desc._case.MultipartRequestDescBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10StatsRequestInputFactoryTest {
+
+    private SerializerRegistry registry;
+    private OFSerializer<MultipartRequestInput> multipartFactory;
+
+    /**
+     * Initializes serializer registry and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+        multipartFactory = registry.getSerializer(
+                new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, MultipartRequestInput.class));
+    }
+
+    /**
+     * Testing OF10StatsRequestInputFactory (Desc) for correct serialization
+     * @throws Exception
+     */
+    @Test
+    public void testDesc() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+        builder.setType(MultipartType.OFPMPDESC);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestDescCaseBuilder caseBuilder = new MultipartRequestDescCaseBuilder();
+        MultipartRequestDescBuilder descBuilder = new MultipartRequestDescBuilder();
+        caseBuilder.setMultipartRequestDesc(descBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+        
+        BufferHelper.checkHeaderV10(out, (byte) 16, 12);
+        Assert.assertEquals("Wrong type", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        Assert.assertTrue("Unread data", out.readableBytes() == 0);
+    }
+    
+    /**
+     * Testing OF10StatsRequestInputFactory (Flow) for correct serialization
+     * @throws Exception
+     */
+    @Test
+    public void testFlow() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+        builder.setType(MultipartType.OFPMPFLOW);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
+        MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();
+        MatchV10Builder matchBuilder = new MatchV10Builder();
+        matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true,
+                true, true, true, true));
+        matchBuilder.setNwSrcMask((short) 8);
+        matchBuilder.setNwDstMask((short) 16);
+        matchBuilder.setInPort(51);
+        matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));
+        matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));
+        matchBuilder.setDlVlan(52);
+        matchBuilder.setDlVlanPcp((short) 53);
+        matchBuilder.setDlType(54);
+        matchBuilder.setNwTos((short) 55);
+        matchBuilder.setNwProto((short) 56);
+        matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));
+        matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));
+        matchBuilder.setTpSrc(57);
+        matchBuilder.setTpDst(58);
+        flowBuilder.setMatchV10(matchBuilder.build());
+        flowBuilder.setTableId((short) 1);
+        flowBuilder.setOutPort(42L);
+        caseBuilder.setMultipartRequestFlow(flowBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+        
+        BufferHelper.checkHeaderV10(out, (byte) 16, 56);
+        Assert.assertEquals("Wrong type", 1, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong wildcards", 3414271, out.readUnsignedInt());
+        Assert.assertEquals("Wrong in-port", 51, out.readUnsignedShort());
+        byte[] dlSrc = new byte[6];
+        out.readBytes(dlSrc);
+        Assert.assertEquals("Wrong dl-src", "00:01:02:03:04:05", ByteBufUtils.macAddressToString(dlSrc));
+        byte[] dlDst = new byte[6];
+        out.readBytes(dlDst);
+        Assert.assertEquals("Wrong dl-dst", "05:04:03:02:01:00", ByteBufUtils.macAddressToString(dlDst));
+        Assert.assertEquals("Wrong dl-vlan", 52, out.readUnsignedShort());
+        Assert.assertEquals("Wrong dl-vlan-pcp", 53, out.readUnsignedByte());
+        out.skipBytes(1);
+        Assert.assertEquals("Wrong dl-type", 54, out.readUnsignedShort());
+        Assert.assertEquals("Wrong nw-tos", 55, out.readUnsignedByte());
+        Assert.assertEquals("Wrong nw-proto", 56, out.readUnsignedByte());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong nw-src", 167772161, out.readUnsignedInt());
+        Assert.assertEquals("Wrong nw-dst", 167772162, out.readUnsignedInt());
+        Assert.assertEquals("Wrong tp-src", 57, out.readUnsignedShort());
+        Assert.assertEquals("Wrong tp-dst", 58, out.readUnsignedShort());
+        Assert.assertEquals("Wrong table-id", 1, out.readUnsignedByte());
+        out.skipBytes(1);
+        Assert.assertEquals("Wrong out-port", 42, out.readUnsignedShort());
+        Assert.assertTrue("Unread data", out.readableBytes() == 0);
+    }
+    
+    /**
+     * Testing OF10StatsRequestInputFactory (Aggregate) for correct serialization
+     * @throws Exception
+     */
+    @Test
+    public void testAggregate() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+        builder.setType(MultipartType.OFPMPAGGREGATE);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
+        MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();
+        MatchV10Builder matchBuilder = new MatchV10Builder();
+        matchBuilder.setWildcards(new FlowWildcardsV10(false, false, false, false,
+                false, false, false, false, false, false));
+        matchBuilder.setNwSrcMask((short) 32);
+        matchBuilder.setNwDstMask((short) 32);
+        matchBuilder.setInPort(51);
+        matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));
+        matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));
+        matchBuilder.setDlVlan(52);
+        matchBuilder.setDlVlanPcp((short) 53);
+        matchBuilder.setDlType(54);
+        matchBuilder.setNwTos((short) 55);
+        matchBuilder.setNwProto((short) 56);
+        matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));
+        matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));
+        matchBuilder.setTpSrc(57);
+        matchBuilder.setTpDst(58);
+        flowBuilder.setMatchV10(matchBuilder.build());
+        flowBuilder.setTableId((short) 42);
+        flowBuilder.setOutPort(6653L);
+        caseBuilder.setMultipartRequestFlow(flowBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+        
+        BufferHelper.checkHeaderV10(out, (byte) 16, 56);
+        Assert.assertEquals("Wrong type", 2, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong wildcards", 0, out.readUnsignedInt());
+        Assert.assertEquals("Wrong in-port", 51, out.readUnsignedShort());
+        byte[] dlSrc = new byte[6];
+        out.readBytes(dlSrc);
+        Assert.assertEquals("Wrong dl-src", "00:01:02:03:04:05", ByteBufUtils.macAddressToString(dlSrc));
+        byte[] dlDst = new byte[6];
+        out.readBytes(dlDst);
+        Assert.assertEquals("Wrong dl-dst", "05:04:03:02:01:00", ByteBufUtils.macAddressToString(dlDst));
+        Assert.assertEquals("Wrong dl-vlan", 52, out.readUnsignedShort());
+        Assert.assertEquals("Wrong dl-vlan-pcp", 53, out.readUnsignedByte());
+        out.skipBytes(1);
+        Assert.assertEquals("Wrong dl-type", 54, out.readUnsignedShort());
+        Assert.assertEquals("Wrong nw-tos", 55, out.readUnsignedByte());
+        Assert.assertEquals("Wrong nw-proto", 56, out.readUnsignedByte());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong nw-src", 167772161, out.readUnsignedInt());
+        Assert.assertEquals("Wrong nw-dst", 167772162, out.readUnsignedInt());
+        Assert.assertEquals("Wrong tp-src", 57, out.readUnsignedShort());
+        Assert.assertEquals("Wrong tp-dst", 58, out.readUnsignedShort());
+        Assert.assertEquals("Wrong table-id", 42, out.readUnsignedByte());
+        out.skipBytes(1);
+        Assert.assertEquals("Wrong out-port", 6653, out.readUnsignedShort());
+        Assert.assertTrue("Unread data", out.readableBytes() == 0);
+    }
+    
+    /**
+     * Testing OF10StatsRequestInputFactory (Table) for correct serialization
+     * @throws Exception
+     */
+    @Test
+    public void testTable() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+        builder.setType(MultipartType.OFPMPTABLE);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestTableCaseBuilder caseBuilder = new MultipartRequestTableCaseBuilder();
+        MultipartRequestTableBuilder tableBuilder = new MultipartRequestTableBuilder();
+        caseBuilder.setMultipartRequestTable(tableBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+        
+        BufferHelper.checkHeaderV10(out, (byte) 16, 12);
+        Assert.assertEquals("Wrong type", 3, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        Assert.assertTrue("Unread data", out.readableBytes() == 0);
+    }
+    
+    /**
+     * Testing OF10StatsRequestInputFactory (Port) for correct serialization
+     * @throws Exception
+     */
+    @Test
+    public void testPort() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+        builder.setType(MultipartType.OFPMPPORTSTATS);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
+        MultipartRequestPortStatsBuilder portBuilder = new MultipartRequestPortStatsBuilder();
+        portBuilder.setPortNo(15L);
+        caseBuilder.setMultipartRequestPortStats(portBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+        
+        BufferHelper.checkHeaderV10(out, (byte) 16, 20);
+        Assert.assertEquals("Wrong type", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong port-no", 15, out.readUnsignedShort());
+        out.skipBytes(6);
+        Assert.assertTrue("Unread data", out.readableBytes() == 0);
+    }
+
+    /**
+     * Testing OF10StatsRequestInputFactory (Queue) for correct serialization
+     * @throws Exception
+     */
+    @Test
+    public void testQueue() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+        builder.setType(MultipartType.OFPMPQUEUE);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
+        MultipartRequestQueueBuilder queueBuilder = new MultipartRequestQueueBuilder();
+        queueBuilder.setPortNo(15L);
+        queueBuilder.setQueueId(16L);
+        caseBuilder.setMultipartRequestQueue(queueBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+        
+        BufferHelper.checkHeaderV10(out, (byte) 16, 20);
+        Assert.assertEquals("Wrong type", 5, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong port-no", 15, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong queue-id", 16, out.readUnsignedInt());
+        Assert.assertTrue("Unread data", out.readableBytes() == 0);
+    }
 }
\ No newline at end of file
index df1c3455479d52bac84d2ea8258362fde6cb4e7a..c14e4dc30e9f9c782f9eef081b4d28dc6dfd2667 100644 (file)
@@ -1,57 +1,57 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class VendorInputMessageFactoryTest {\r
-\r
-    @Mock SerializerRegistry registry;\r
-    @Mock ExperimenterInputMessageFactory serializer;\r
-\r
-    /**\r
-     * Tests {@link VendorInputMessageFactory#serialize(ExperimenterInput, ByteBuf)}\r
-     */\r
-    @Test\r
-    public void test() {\r
-        Mockito.when(registry.getSerializer((MessageTypeKey<?>) Matchers.any(MessageTypeKey.class)))\r
-            .thenReturn(serializer);\r
-        VendorInputMessageFactory factory = new VendorInputMessageFactory();\r
-        factory.injectSerializerRegistry(registry);\r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
-        builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);\r
-        builder.setXid(12345L);\r
-        builder.setExperimenter(new ExperimenterId(42L));\r
-        builder.setExpType(84L);\r
-        ExperimenterInput experimenterInput = builder.build();\r
-\r
-        factory.serialize(experimenterInput, buffer);\r
-        Mockito.verify(serializer, Mockito.times(1)).serialize(experimenterInput, buffer);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class VendorInputMessageFactoryTest {
+
+    @Mock SerializerRegistry registry;
+    @Mock ExperimenterInputMessageFactory serializer;
+
+    /**
+     * Tests {@link VendorInputMessageFactory#serialize(ExperimenterInput, ByteBuf)}
+     */
+    @Test
+    public void test() {
+        Mockito.when(registry.getSerializer((MessageTypeKey<?>) Matchers.any(MessageTypeKey.class)))
+            .thenReturn(serializer);
+        VendorInputMessageFactory factory = new VendorInputMessageFactory();
+        factory.injectSerializerRegistry(registry);
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
+        builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
+        builder.setXid(12345L);
+        builder.setExperimenter(new ExperimenterId(42L));
+        builder.setExpType(84L);
+        ExperimenterInput experimenterInput = builder.build();
+
+        factory.serialize(experimenterInput, buffer);
+        Mockito.verify(serializer, Mockito.times(1)).serialize(experimenterInput, buffer);
+    }
 }
\ No newline at end of file
index b5b93b89c73f49745ac40141de5392fd61576728..4b4760376a5c2ce6bd43665800f497f34c8f7871 100644 (file)
@@ -1,79 +1,79 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequest;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequestBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class MultipartRequestExperimenterTest {\r
-\r
-    @Mock SerializerRegistry mockRegistry;\r
-    @Mock OFSerializer<MultipartRequestExperimenterCase> serializer;\r
-\r
-    /**\r
-     * Testing OF10StatsRequestInputFactory (Experimenter) for correct serialization\r
-     * @throws Exception\r
-     */\r
-    @Test\r
-    public void testExperimenter() throws Exception {\r
-        Mockito.when(mockRegistry.getSerializer(Matchers.any(ExperimenterIdSerializerKey.class)))\r
-            .thenReturn(serializer);\r
-        MultipartRequestInputFactory multipartFactory = new MultipartRequestInputFactory();\r
-        multipartFactory.injectSerializerRegistry(mockRegistry);\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPEXPERIMENTER);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();\r
-        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
-        ExperimenterIdMultipartRequestBuilder expIdBuilder = new ExperimenterIdMultipartRequestBuilder();\r
-        expIdBuilder.setExperimenter(new ExperimenterId(42L));\r
-        expBuilder.addAugmentation(ExperimenterIdMultipartRequest.class, expIdBuilder.build());\r
-        caseBuilder.setMultipartRequestExperimenter(expBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-\r
-        BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
-        Assert.assertEquals("Wrong type", 65535, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        Mockito.verify(serializer, Mockito.times(1)).serialize(Matchers.any(MultipartRequestExperimenterCase.class), Matchers.any(ByteBuf.class));\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequestBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class MultipartRequestExperimenterTest {
+
+    @Mock SerializerRegistry mockRegistry;
+    @Mock OFSerializer<MultipartRequestExperimenterCase> serializer;
+
+    /**
+     * Testing OF10StatsRequestInputFactory (Experimenter) for correct serialization
+     * @throws Exception
+     */
+    @Test
+    public void testExperimenter() throws Exception {
+        Mockito.when(mockRegistry.getSerializer(Matchers.any(ExperimenterIdSerializerKey.class)))
+            .thenReturn(serializer);
+        MultipartRequestInputFactory multipartFactory = new MultipartRequestInputFactory();
+        multipartFactory.injectSerializerRegistry(mockRegistry);
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+        builder.setType(MultipartType.OFPMPEXPERIMENTER);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();
+        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();
+        ExperimenterIdMultipartRequestBuilder expIdBuilder = new ExperimenterIdMultipartRequestBuilder();
+        expIdBuilder.setExperimenter(new ExperimenterId(42L));
+        expBuilder.addAugmentation(ExperimenterIdMultipartRequest.class, expIdBuilder.build());
+        caseBuilder.setMultipartRequestExperimenter(expBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+
+        BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+        Assert.assertEquals("Wrong type", 65535, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        Mockito.verify(serializer, Mockito.times(1)).serialize(Matchers.any(MultipartRequestExperimenterCase.class), Matchers.any(ByteBuf.class));
+    }
 }
\ No newline at end of file
index db068d71964c2889b82187e6efec3391bf783bcd..b747e3e7abd9cafc27438051be225a981010b9c5 100644 (file)
@@ -1,77 +1,77 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group.desc._case.MultipartRequestGroupDescBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartRequestGroupDescTest {\r
-\r
-    private SerializerRegistry registry;\r
-    private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
-    /**\r
-     * Initializes serializer registry and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        multipartFactory = registry.getSerializer(\r
-                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
-    }\r
-\r
-    /**\r
-     * Tests {@link MultipartRequestInputFactory} - GroupDesc case\r
-     * @throws Exception \r
-     */\r
-    @Test\r
-    public void test() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPGROUPDESC);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestGroupDescCaseBuilder caseBuilder = new MultipartRequestGroupDescCaseBuilder();\r
-        MultipartRequestGroupDescBuilder descBuilder = new MultipartRequestGroupDescBuilder();\r
-        descBuilder.setEmpty(true);\r
-        caseBuilder.setMultipartRequestGroupDesc(descBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-\r
-        BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
-        Assert.assertEquals("Wrong type", 7, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        out.skipBytes(4); // skip padding\r
-        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group.desc._case.MultipartRequestGroupDescBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartRequestGroupDescTest {
+
+    private SerializerRegistry registry;
+    private OFSerializer<MultipartRequestInput> multipartFactory;
+
+    /**
+     * Initializes serializer registry and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+        multipartFactory = registry.getSerializer(
+                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+    }
+
+    /**
+     * Tests {@link MultipartRequestInputFactory} - GroupDesc case
+     * @throws Exception 
+     */
+    @Test
+    public void test() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+        builder.setType(MultipartType.OFPMPGROUPDESC);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestGroupDescCaseBuilder caseBuilder = new MultipartRequestGroupDescCaseBuilder();
+        MultipartRequestGroupDescBuilder descBuilder = new MultipartRequestGroupDescBuilder();
+        descBuilder.setEmpty(true);
+        caseBuilder.setMultipartRequestGroupDesc(descBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+
+        BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+        Assert.assertEquals("Wrong type", 7, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        out.skipBytes(4); // skip padding
+        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
+    }
 }
\ No newline at end of file
index 2097974ac9565b514927782d6671df6455fbe238..ff0012e0c8b0c81f28474c85a380016155f5a8c1 100644 (file)
@@ -1,77 +1,77 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupFeaturesCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group.features._case.MultipartRequestGroupFeaturesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartRequestGroupFeaturesTest {\r
-\r
-    private SerializerRegistry registry;\r
-    private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
-    /**\r
-     * Initializes serializer registry and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        multipartFactory = registry.getSerializer(\r
-                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
-    }\r
-\r
-    /**\r
-     * Tests {@link MultipartRequestInputFactory} - GroupFeatures case\r
-     * @throws Exception \r
-     */\r
-    @Test\r
-    public void test() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPGROUPFEATURES);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestGroupFeaturesCaseBuilder caseBuilder = new MultipartRequestGroupFeaturesCaseBuilder();\r
-        MultipartRequestGroupFeaturesBuilder featuresBuilder = new MultipartRequestGroupFeaturesBuilder();\r
-        featuresBuilder.setEmpty(true);\r
-        caseBuilder.setMultipartRequestGroupFeatures(featuresBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-\r
-        BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
-        Assert.assertEquals("Wrong type", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        out.skipBytes(4); // skip padding\r
-        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupFeaturesCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group.features._case.MultipartRequestGroupFeaturesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartRequestGroupFeaturesTest {
+
+    private SerializerRegistry registry;
+    private OFSerializer<MultipartRequestInput> multipartFactory;
+
+    /**
+     * Initializes serializer registry and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+        multipartFactory = registry.getSerializer(
+                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+    }
+
+    /**
+     * Tests {@link MultipartRequestInputFactory} - GroupFeatures case
+     * @throws Exception 
+     */
+    @Test
+    public void test() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+        builder.setType(MultipartType.OFPMPGROUPFEATURES);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestGroupFeaturesCaseBuilder caseBuilder = new MultipartRequestGroupFeaturesCaseBuilder();
+        MultipartRequestGroupFeaturesBuilder featuresBuilder = new MultipartRequestGroupFeaturesBuilder();
+        featuresBuilder.setEmpty(true);
+        caseBuilder.setMultipartRequestGroupFeatures(featuresBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+
+        BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+        Assert.assertEquals("Wrong type", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        out.skipBytes(4); // skip padding
+        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
+    }
 }
\ No newline at end of file
index 3eb74b1b353843af93301196a9227d12ca8227aa..7f04ba49ef13bf4a75d1f8500c36633e841c2b7d 100644 (file)
@@ -1,77 +1,77 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterFeaturesCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.features._case.MultipartRequestMeterFeaturesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartRequestMeterFeaturesTest {\r
-\r
-    private SerializerRegistry registry;\r
-    private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
-    /**\r
-     * Initializes serializer registry and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        multipartFactory = registry.getSerializer(\r
-                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
-    }\r
-\r
-    /**\r
-     * Tests {@link MultipartRequestInputFactory} - MeterFeatures case\r
-     * @throws Exception \r
-     */\r
-    @Test\r
-    public void test() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPMETERFEATURES);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestMeterFeaturesCaseBuilder caseBuilder = new MultipartRequestMeterFeaturesCaseBuilder();\r
-        MultipartRequestMeterFeaturesBuilder featuresBuilder = new MultipartRequestMeterFeaturesBuilder();\r
-        featuresBuilder.setEmpty(true);\r
-        caseBuilder.setMultipartRequestMeterFeatures(featuresBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-\r
-        BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
-        Assert.assertEquals("Wrong type", 11, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        out.skipBytes(4); // skip padding\r
-        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterFeaturesCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.features._case.MultipartRequestMeterFeaturesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartRequestMeterFeaturesTest {
+
+    private SerializerRegistry registry;
+    private OFSerializer<MultipartRequestInput> multipartFactory;
+
+    /**
+     * Initializes serializer registry and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+        multipartFactory = registry.getSerializer(
+                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+    }
+
+    /**
+     * Tests {@link MultipartRequestInputFactory} - MeterFeatures case
+     * @throws Exception 
+     */
+    @Test
+    public void test() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+        builder.setType(MultipartType.OFPMPMETERFEATURES);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestMeterFeaturesCaseBuilder caseBuilder = new MultipartRequestMeterFeaturesCaseBuilder();
+        MultipartRequestMeterFeaturesBuilder featuresBuilder = new MultipartRequestMeterFeaturesBuilder();
+        featuresBuilder.setEmpty(true);
+        caseBuilder.setMultipartRequestMeterFeatures(featuresBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+
+        BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+        Assert.assertEquals("Wrong type", 11, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        out.skipBytes(4); // skip padding
+        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
+    }
 }
\ No newline at end of file
index 2172e8227ad1146efd0917fc384e345b0568dd82..fd8365d211990773c56565c8f7e4245476d3d5c2 100644 (file)
@@ -1,77 +1,77 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortDescCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.desc._case.MultipartRequestPortDescBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartRequestPortDescTest {\r
-\r
-    private SerializerRegistry registry;\r
-    private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
-    /**\r
-     * Initializes serializer registry and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        multipartFactory = registry.getSerializer(\r
-                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
-    }\r
-\r
-    /**\r
-     * Tests {@link MultipartRequestInputFactory} - PortDesc case\r
-     * @throws Exception \r
-     */\r
-    @Test\r
-    public void test() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPPORTDESC);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestPortDescCaseBuilder caseBuilder = new MultipartRequestPortDescCaseBuilder();\r
-        MultipartRequestPortDescBuilder descBuilder = new MultipartRequestPortDescBuilder();\r
-        descBuilder.setEmpty(true);\r
-        caseBuilder.setMultipartRequestPortDesc(descBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-\r
-        BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
-        Assert.assertEquals("Wrong type", 13, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        out.skipBytes(4); // skip padding\r
-        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortDescCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.desc._case.MultipartRequestPortDescBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartRequestPortDescTest {
+
+    private SerializerRegistry registry;
+    private OFSerializer<MultipartRequestInput> multipartFactory;
+
+    /**
+     * Initializes serializer registry and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+        multipartFactory = registry.getSerializer(
+                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+    }
+
+    /**
+     * Tests {@link MultipartRequestInputFactory} - PortDesc case
+     * @throws Exception 
+     */
+    @Test
+    public void test() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+        builder.setType(MultipartType.OFPMPPORTDESC);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestPortDescCaseBuilder caseBuilder = new MultipartRequestPortDescCaseBuilder();
+        MultipartRequestPortDescBuilder descBuilder = new MultipartRequestPortDescBuilder();
+        descBuilder.setEmpty(true);
+        caseBuilder.setMultipartRequestPortDesc(descBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+
+        BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+        Assert.assertEquals("Wrong type", 13, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        out.skipBytes(4); // skip padding
+        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
+    }
 }
\ No newline at end of file
index 86f0fef411a609c619f2e7e768309de2f6c670a3..6ece76796290c1ff8a71fbf057d5ee4bf4081ed8 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import java.math.BigInteger;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactoryTest;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeaturePropertyBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdTableFeaturePropertyBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeaturePropertyBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeaturePropertyBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeaturePropertyBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIdsBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeaturesBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class MultipartRequestTableFeaturesTest {\r
-\r
-    private static final byte PADDING_IN_MULTIPART_REQUEST_MESSAGE =\r
-            MultipartRequestInputFactoryTest.PADDING_IN_MULTIPART_REQUEST_MESSAGE;\r
-    private SerializerRegistry registry;\r
-    private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
-    @Mock SerializerRegistry mockRegistry;\r
-    @Mock OFSerializer<TableFeatureProperties> serializer;\r
-\r
-    /**\r
-     * Initializes serializer registry and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        Mockito.when(mockRegistry.getSerializer((MessageTypeKey<?>)Matchers.any()))\r
-        .thenReturn(serializer);\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        multipartFactory = registry.getSerializer(\r
-                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
-    }\r
-\r
-    /**\r
-     * @throws Exception\r
-     * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO\r
-     */\r
-    @Test\r
-    public void testMultipartRequestTableFeaturesMessageFactory() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
-        builder.setType(MultipartType.forValue(12));\r
-        builder.setFlags(new MultipartRequestFlags(true));\r
-        MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();\r
-        MultipartRequestTableFeaturesBuilder featuresBuilder = new MultipartRequestTableFeaturesBuilder();\r
-        List<TableFeatures> tableFeaturesList = new ArrayList<>();\r
-        TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();\r
-        tableFeaturesBuilder.setTableId((short) 8);\r
-        tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");\r
-        tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));\r
-        tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));\r
-        tableFeaturesBuilder.setConfig(new TableConfig(true));\r
-        tableFeaturesBuilder.setMaxEntries(65L);\r
-        List<TableFeatureProperties> properties = new ArrayList<>();\r
-        TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLES);\r
-        NextTableRelatedTableFeaturePropertyBuilder nextPropBuilder =\r
-                new NextTableRelatedTableFeaturePropertyBuilder();\r
-        List<NextTableIds> nextIds = new ArrayList<>();\r
-        nextIds.add(new NextTableIdsBuilder().setTableId((short) 1).build());\r
-        nextIds.add(new NextTableIdsBuilder().setTableId((short) 2).build());\r
-        nextPropBuilder.setNextTableIds(nextIds);\r
-        propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS);\r
-        nextPropBuilder = new NextTableRelatedTableFeaturePropertyBuilder();\r
-        nextIds = new ArrayList<>();\r
-        nextPropBuilder.setNextTableIds(nextIds);\r
-        propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONS);\r
-        InstructionRelatedTableFeaturePropertyBuilder insPropBuilder =\r
-                new InstructionRelatedTableFeaturePropertyBuilder();\r
-        List<Instruction> insIds = new ArrayList<>();\r
-        InstructionBuilder insBuilder = new InstructionBuilder();\r
-        insBuilder.setType(WriteActions.class);\r
-        insIds.add(insBuilder.build());\r
-        insBuilder = new InstructionBuilder();\r
-        insBuilder.setType(GotoTable.class);\r
-        insIds.add(insBuilder.build());\r
-        insPropBuilder.setInstruction(insIds);\r
-        propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS);\r
-        insPropBuilder = new InstructionRelatedTableFeaturePropertyBuilder();\r
-        insIds = new ArrayList<>();\r
-        insBuilder = new InstructionBuilder();\r
-        insBuilder.setType(WriteMetadata.class);\r
-        insIds.add(insBuilder.build());\r
-        insBuilder = new InstructionBuilder();\r
-        insBuilder.setType(ApplyActions.class);\r
-        insIds.add(insBuilder.build());\r
-        insBuilder = new InstructionBuilder();\r
-        insBuilder.setType(Meter.class);\r
-        insIds.add(insBuilder.build());\r
-        insBuilder = new InstructionBuilder();\r
-        insBuilder.setType(ClearActions.class);\r
-        insIds.add(insBuilder.build());\r
-        insBuilder = new InstructionBuilder();\r
-        insBuilder.setType(GotoTable.class);\r
-        insIds.add(insBuilder.build());\r
-        insPropBuilder.setInstruction(insIds);\r
-        propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        tableFeaturesBuilder.setTableFeatureProperties(properties);\r
-        tableFeaturesList.add(tableFeaturesBuilder.build());\r
-        tableFeaturesBuilder = new TableFeaturesBuilder();\r
-        tableFeaturesBuilder.setTableId((short) 8);\r
-        tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");\r
-        tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));\r
-        tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));\r
-        tableFeaturesBuilder.setConfig(new TableConfig(true));\r
-        tableFeaturesBuilder.setMaxEntries(67L);\r
-        properties = new ArrayList<>();\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONS);\r
-        ActionRelatedTableFeaturePropertyBuilder actBuilder = new ActionRelatedTableFeaturePropertyBuilder();\r
-        List<Action> actions = new ArrayList<>();\r
-        ActionBuilder actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Output.class);\r
-        actions.add(actionBuilder.build());\r
-        actBuilder.setAction(actions);\r
-        propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS);\r
-        actBuilder = new ActionRelatedTableFeaturePropertyBuilder();\r
-        actions = new ArrayList<>();\r
-        actBuilder.setAction(actions);\r
-        propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONS);\r
-        actBuilder = new ActionRelatedTableFeaturePropertyBuilder();\r
-        actions = new ArrayList<>();\r
-        actBuilder.setAction(actions);\r
-        propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS);\r
-        actBuilder = new ActionRelatedTableFeaturePropertyBuilder();\r
-        actions = new ArrayList<>();\r
-        actBuilder.setAction(actions);\r
-        propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTMATCH);\r
-        OxmRelatedTableFeaturePropertyBuilder oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
-        List<MatchEntries> entries = new ArrayList<>();\r
-        MatchEntriesBuilder entriesBuilder = new MatchEntriesBuilder();\r
-        entriesBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entriesBuilder.setOxmMatchField(InPhyPort.class);\r
-        entriesBuilder.setHasMask(false);\r
-        entries.add(entriesBuilder.build());\r
-        entriesBuilder = new MatchEntriesBuilder();\r
-        entriesBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entriesBuilder.setOxmMatchField(InPort.class);\r
-        entriesBuilder.setHasMask(false);\r
-        entries.add(entriesBuilder.build());\r
-        oxmBuilder.setMatchEntries(entries);\r
-        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTWILDCARDS);\r
-        oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
-        entries = new ArrayList<>();\r
-        oxmBuilder.setMatchEntries(entries);\r
-        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELD);\r
-        oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
-        entries = new ArrayList<>();\r
-        oxmBuilder.setMatchEntries(entries);\r
-        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS);\r
-        oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
-        entries = new ArrayList<>();\r
-        oxmBuilder.setMatchEntries(entries);\r
-        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD);\r
-        oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
-        entries = new ArrayList<>();\r
-        entriesBuilder = new MatchEntriesBuilder();\r
-        entriesBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entriesBuilder.setOxmMatchField(IpProto.class);\r
-        entriesBuilder.setHasMask(false);\r
-        entries.add(entriesBuilder.build());\r
-        entriesBuilder = new MatchEntriesBuilder();\r
-        entriesBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entriesBuilder.setOxmMatchField(IpEcn.class);\r
-        entriesBuilder.setHasMask(false);\r
-        entries.add(entriesBuilder.build());\r
-        oxmBuilder.setMatchEntries(entries);\r
-        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS);\r
-        oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
-        entries = new ArrayList<>();\r
-        oxmBuilder.setMatchEntries(entries);\r
-        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        tableFeaturesBuilder.setTableFeatureProperties(properties);\r
-        tableFeaturesList.add(tableFeaturesBuilder.build());\r
-        featuresBuilder.setTableFeatures(tableFeaturesList);\r
-        caseBuilder.setMultipartRequestTableFeatures(featuresBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-\r
-        BufferHelper.checkHeaderV13(out, (byte) 18, 296);\r
-        Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());\r
-        out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);\r
-        Assert.assertEquals("Wrong length", 120, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());\r
-        out.skipBytes(5);\r
-        Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",\r
-                ByteBufUtils.decodeNullTerminatedString(out, 32));\r
-        byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
-        out.readBytes(metadataMatch);\r
-        Assert.assertArrayEquals("Wrong metadata-match",\r
-                new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);\r
-        byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
-        out.readBytes(metadataWrite);\r
-        Assert.assertArrayEquals("Wrong metadata-write",\r
-                new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);\r
-        Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong max-entries", 65, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong property type", 2, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 6, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong next-registry-id", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong next-registry-id", 2, out.readUnsignedByte());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong property type", 3, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong property type", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong property type", 1, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 24, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong length", 160, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());\r
-        out.skipBytes(5);\r
-        Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",\r
-                ByteBufUtils.decodeNullTerminatedString(out, 32));\r
-        metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
-        out.readBytes(metadataMatch);\r
-        Assert.assertArrayEquals("Wrong metadata-match",\r
-                new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);\r
-        metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
-        out.readBytes(metadataWrite);\r
-        Assert.assertArrayEquals("Wrong metadata-write",\r
-                new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);\r
-        Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong max-entries", 67, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong property type", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property type", 5, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong property type", 6, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong property type", 7, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong property type", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match field&mask", 2, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match field&mask", 0, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong property type", 10, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong property type", 12, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong property type", 13, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong property type", 14, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match field&mask", 20, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match field&mask", 18, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong property type", 15, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * @throws Exception\r
-     * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO\r
-     */\r
-    @Test\r
-    public void testMultipartRequestTableFeaturesExperimenter() throws Exception {\r
-        MultipartRequestInputFactory factory = new MultipartRequestInputFactory();\r
-        factory.injectSerializerRegistry(mockRegistry);\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
-        builder.setType(MultipartType.forValue(12));\r
-        builder.setFlags(new MultipartRequestFlags(true));\r
-        MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();\r
-        MultipartRequestTableFeaturesBuilder featuresBuilder = new MultipartRequestTableFeaturesBuilder();\r
-        List<TableFeatures> tableFeaturesList = new ArrayList<>();\r
-        TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();\r
-        tableFeaturesBuilder.setTableId((short) 8);\r
-        tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");\r
-        tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));\r
-        tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));\r
-        tableFeaturesBuilder.setConfig(new TableConfig(true));\r
-        tableFeaturesBuilder.setMaxEntries(65L);\r
-        List<TableFeatureProperties> properties = new ArrayList<>();\r
-        TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);\r
-        ExperimenterIdTableFeaturePropertyBuilder expBuilder = new ExperimenterIdTableFeaturePropertyBuilder();\r
-        expBuilder.setExperimenter(new ExperimenterId(42L));\r
-        propBuilder.addAugmentation(ExperimenterIdTableFeatureProperty.class, expBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);\r
-        expBuilder = new ExperimenterIdTableFeaturePropertyBuilder();\r
-        expBuilder.setExperimenter(new ExperimenterId(43L));\r
-        propBuilder.addAugmentation(ExperimenterIdTableFeatureProperty.class, expBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        tableFeaturesBuilder.setTableFeatureProperties(properties);\r
-        tableFeaturesList.add(tableFeaturesBuilder.build());\r
-        featuresBuilder.setTableFeatures(tableFeaturesList);\r
-        caseBuilder.setMultipartRequestTableFeatures(featuresBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        factory.serialize(message, out);\r
-\r
-        BufferHelper.checkHeaderV13(out, (byte) 18, 80);\r
-        Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());\r
-        out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);\r
-        Assert.assertEquals("Wrong length", 64, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());\r
-        out.skipBytes(5);\r
-        Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",\r
-                ByteBufUtils.decodeNullTerminatedString(out, 32));\r
-        byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
-        out.readBytes(metadataMatch);\r
-        Assert.assertArrayEquals("Wrong metadata-match",\r
-                new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);\r
-        byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];\r
-        out.readBytes(metadataWrite);\r
-        Assert.assertArrayEquals("Wrong metadata-write",\r
-                new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);\r
-        Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong max-entries", 65, out.readUnsignedInt());\r
-        Mockito.verify(serializer, Mockito.times(2)).serialize(Matchers.any(TableFeatureProperties.class),\r
-                Matchers.any(ByteBuf.class));\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactoryTest;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeaturePropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdTableFeaturePropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeaturePropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeaturePropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeaturePropertyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIdsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class MultipartRequestTableFeaturesTest {
+
+    private static final byte PADDING_IN_MULTIPART_REQUEST_MESSAGE =
+            MultipartRequestInputFactoryTest.PADDING_IN_MULTIPART_REQUEST_MESSAGE;
+    private SerializerRegistry registry;
+    private OFSerializer<MultipartRequestInput> multipartFactory;
+
+    @Mock SerializerRegistry mockRegistry;
+    @Mock OFSerializer<TableFeatureProperties> serializer;
+
+    /**
+     * Initializes serializer registry and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        Mockito.when(mockRegistry.getSerializer((MessageTypeKey<?>)Matchers.any()))
+        .thenReturn(serializer);
+        registry = new SerializerRegistryImpl();
+        registry.init();
+        multipartFactory = registry.getSerializer(
+                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+    }
+
+    /**
+     * @throws Exception
+     * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+     */
+    @Test
+    public void testMultipartRequestTableFeaturesMessageFactory() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+        builder.setType(MultipartType.forValue(12));
+        builder.setFlags(new MultipartRequestFlags(true));
+        MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
+        MultipartRequestTableFeaturesBuilder featuresBuilder = new MultipartRequestTableFeaturesBuilder();
+        List<TableFeatures> tableFeaturesList = new ArrayList<>();
+        TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();
+        tableFeaturesBuilder.setTableId((short) 8);
+        tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
+        tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));
+        tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));
+        tableFeaturesBuilder.setConfig(new TableConfig(true));
+        tableFeaturesBuilder.setMaxEntries(65L);
+        List<TableFeatureProperties> properties = new ArrayList<>();
+        TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLES);
+        NextTableRelatedTableFeaturePropertyBuilder nextPropBuilder =
+                new NextTableRelatedTableFeaturePropertyBuilder();
+        List<NextTableIds> nextIds = new ArrayList<>();
+        nextIds.add(new NextTableIdsBuilder().setTableId((short) 1).build());
+        nextIds.add(new NextTableIdsBuilder().setTableId((short) 2).build());
+        nextPropBuilder.setNextTableIds(nextIds);
+        propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS);
+        nextPropBuilder = new NextTableRelatedTableFeaturePropertyBuilder();
+        nextIds = new ArrayList<>();
+        nextPropBuilder.setNextTableIds(nextIds);
+        propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONS);
+        InstructionRelatedTableFeaturePropertyBuilder insPropBuilder =
+                new InstructionRelatedTableFeaturePropertyBuilder();
+        List<Instruction> insIds = new ArrayList<>();
+        InstructionBuilder insBuilder = new InstructionBuilder();
+        insBuilder.setType(WriteActions.class);
+        insIds.add(insBuilder.build());
+        insBuilder = new InstructionBuilder();
+        insBuilder.setType(GotoTable.class);
+        insIds.add(insBuilder.build());
+        insPropBuilder.setInstruction(insIds);
+        propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS);
+        insPropBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
+        insIds = new ArrayList<>();
+        insBuilder = new InstructionBuilder();
+        insBuilder.setType(WriteMetadata.class);
+        insIds.add(insBuilder.build());
+        insBuilder = new InstructionBuilder();
+        insBuilder.setType(ApplyActions.class);
+        insIds.add(insBuilder.build());
+        insBuilder = new InstructionBuilder();
+        insBuilder.setType(Meter.class);
+        insIds.add(insBuilder.build());
+        insBuilder = new InstructionBuilder();
+        insBuilder.setType(ClearActions.class);
+        insIds.add(insBuilder.build());
+        insBuilder = new InstructionBuilder();
+        insBuilder.setType(GotoTable.class);
+        insIds.add(insBuilder.build());
+        insPropBuilder.setInstruction(insIds);
+        propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());
+        properties.add(propBuilder.build());
+        tableFeaturesBuilder.setTableFeatureProperties(properties);
+        tableFeaturesList.add(tableFeaturesBuilder.build());
+        tableFeaturesBuilder = new TableFeaturesBuilder();
+        tableFeaturesBuilder.setTableId((short) 8);
+        tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
+        tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));
+        tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));
+        tableFeaturesBuilder.setConfig(new TableConfig(true));
+        tableFeaturesBuilder.setMaxEntries(67L);
+        properties = new ArrayList<>();
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONS);
+        ActionRelatedTableFeaturePropertyBuilder actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
+        List<Action> actions = new ArrayList<>();
+        ActionBuilder actionBuilder = new ActionBuilder();
+        actionBuilder.setType(Output.class);
+        actions.add(actionBuilder.build());
+        actBuilder.setAction(actions);
+        propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS);
+        actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
+        actions = new ArrayList<>();
+        actBuilder.setAction(actions);
+        propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONS);
+        actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
+        actions = new ArrayList<>();
+        actBuilder.setAction(actions);
+        propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS);
+        actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
+        actions = new ArrayList<>();
+        actBuilder.setAction(actions);
+        propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTMATCH);
+        OxmRelatedTableFeaturePropertyBuilder oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+        List<MatchEntries> entries = new ArrayList<>();
+        MatchEntriesBuilder entriesBuilder = new MatchEntriesBuilder();
+        entriesBuilder.setOxmClass(OpenflowBasicClass.class);
+        entriesBuilder.setOxmMatchField(InPhyPort.class);
+        entriesBuilder.setHasMask(false);
+        entries.add(entriesBuilder.build());
+        entriesBuilder = new MatchEntriesBuilder();
+        entriesBuilder.setOxmClass(OpenflowBasicClass.class);
+        entriesBuilder.setOxmMatchField(InPort.class);
+        entriesBuilder.setHasMask(false);
+        entries.add(entriesBuilder.build());
+        oxmBuilder.setMatchEntries(entries);
+        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTWILDCARDS);
+        oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+        entries = new ArrayList<>();
+        oxmBuilder.setMatchEntries(entries);
+        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELD);
+        oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+        entries = new ArrayList<>();
+        oxmBuilder.setMatchEntries(entries);
+        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS);
+        oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+        entries = new ArrayList<>();
+        oxmBuilder.setMatchEntries(entries);
+        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD);
+        oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+        entries = new ArrayList<>();
+        entriesBuilder = new MatchEntriesBuilder();
+        entriesBuilder.setOxmClass(OpenflowBasicClass.class);
+        entriesBuilder.setOxmMatchField(IpProto.class);
+        entriesBuilder.setHasMask(false);
+        entries.add(entriesBuilder.build());
+        entriesBuilder = new MatchEntriesBuilder();
+        entriesBuilder.setOxmClass(OpenflowBasicClass.class);
+        entriesBuilder.setOxmMatchField(IpEcn.class);
+        entriesBuilder.setHasMask(false);
+        entries.add(entriesBuilder.build());
+        oxmBuilder.setMatchEntries(entries);
+        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS);
+        oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
+        entries = new ArrayList<>();
+        oxmBuilder.setMatchEntries(entries);
+        propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
+        properties.add(propBuilder.build());
+        tableFeaturesBuilder.setTableFeatureProperties(properties);
+        tableFeaturesList.add(tableFeaturesBuilder.build());
+        featuresBuilder.setTableFeatures(tableFeaturesList);
+        caseBuilder.setMultipartRequestTableFeatures(featuresBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+
+        BufferHelper.checkHeaderV13(out, (byte) 18, 296);
+        Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());
+        out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
+        Assert.assertEquals("Wrong length", 120, out.readUnsignedShort());
+        Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());
+        out.skipBytes(5);
+        Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",
+                ByteBufUtils.decodeNullTerminatedString(out, 32));
+        byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+        out.readBytes(metadataMatch);
+        Assert.assertArrayEquals("Wrong metadata-match",
+                new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);
+        byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+        out.readBytes(metadataWrite);
+        Assert.assertArrayEquals("Wrong metadata-write",
+                new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);
+        Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());
+        Assert.assertEquals("Wrong max-entries", 65, out.readUnsignedInt());
+        Assert.assertEquals("Wrong property type", 2, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 6, out.readUnsignedShort());
+        Assert.assertEquals("Wrong next-registry-id", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong next-registry-id", 2, out.readUnsignedByte());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong property type", 3, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong property type", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong property type", 1, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 24, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong length", 160, out.readUnsignedShort());
+        Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());
+        out.skipBytes(5);
+        Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",
+                ByteBufUtils.decodeNullTerminatedString(out, 32));
+        metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+        out.readBytes(metadataMatch);
+        Assert.assertArrayEquals("Wrong metadata-match",
+                new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);
+        metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+        out.readBytes(metadataWrite);
+        Assert.assertArrayEquals("Wrong metadata-write",
+                new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);
+        Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());
+        Assert.assertEquals("Wrong max-entries", 67, out.readUnsignedInt());
+        Assert.assertEquals("Wrong property type", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property type", 5, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong property type", 6, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong property type", 7, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong property type", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match field&mask", 2, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match field&mask", 0, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong property type", 10, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong property type", 12, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong property type", 13, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong property type", 14, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match field&mask", 20, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match field&mask", 18, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong property type", 15, out.readUnsignedShort());
+        Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertTrue("Unread data", out.readableBytes() == 0);
+    }
+
+    /**
+     * @throws Exception
+     * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+     */
+    @Test
+    public void testMultipartRequestTableFeaturesExperimenter() throws Exception {
+        MultipartRequestInputFactory factory = new MultipartRequestInputFactory();
+        factory.injectSerializerRegistry(mockRegistry);
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+        builder.setType(MultipartType.forValue(12));
+        builder.setFlags(new MultipartRequestFlags(true));
+        MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
+        MultipartRequestTableFeaturesBuilder featuresBuilder = new MultipartRequestTableFeaturesBuilder();
+        List<TableFeatures> tableFeaturesList = new ArrayList<>();
+        TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();
+        tableFeaturesBuilder.setTableId((short) 8);
+        tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
+        tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));
+        tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));
+        tableFeaturesBuilder.setConfig(new TableConfig(true));
+        tableFeaturesBuilder.setMaxEntries(65L);
+        List<TableFeatureProperties> properties = new ArrayList<>();
+        TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);
+        ExperimenterIdTableFeaturePropertyBuilder expBuilder = new ExperimenterIdTableFeaturePropertyBuilder();
+        expBuilder.setExperimenter(new ExperimenterId(42L));
+        propBuilder.addAugmentation(ExperimenterIdTableFeatureProperty.class, expBuilder.build());
+        properties.add(propBuilder.build());
+        propBuilder = new TableFeaturePropertiesBuilder();
+        propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);
+        expBuilder = new ExperimenterIdTableFeaturePropertyBuilder();
+        expBuilder.setExperimenter(new ExperimenterId(43L));
+        propBuilder.addAugmentation(ExperimenterIdTableFeatureProperty.class, expBuilder.build());
+        properties.add(propBuilder.build());
+        tableFeaturesBuilder.setTableFeatureProperties(properties);
+        tableFeaturesList.add(tableFeaturesBuilder.build());
+        featuresBuilder.setTableFeatures(tableFeaturesList);
+        caseBuilder.setMultipartRequestTableFeatures(featuresBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        factory.serialize(message, out);
+
+        BufferHelper.checkHeaderV13(out, (byte) 18, 80);
+        Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());
+        out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
+        Assert.assertEquals("Wrong length", 64, out.readUnsignedShort());
+        Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());
+        out.skipBytes(5);
+        Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",
+                ByteBufUtils.decodeNullTerminatedString(out, 32));
+        byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+        out.readBytes(metadataMatch);
+        Assert.assertArrayEquals("Wrong metadata-match",
+                new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);
+        byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+        out.readBytes(metadataWrite);
+        Assert.assertArrayEquals("Wrong metadata-write",
+                new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);
+        Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());
+        Assert.assertEquals("Wrong max-entries", 65, out.readUnsignedInt());
+        Mockito.verify(serializer, Mockito.times(2)).serialize(Matchers.any(TableFeatureProperties.class),
+                Matchers.any(ByteBuf.class));
+    }
 }
\ No newline at end of file
index 8ffcdd7d8de51f3b0f8818f2e06cf9c5b0c7adc6..724b55e5e65575d276a8998838d5a2961957b765 100644 (file)
@@ -1,77 +1,77 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MultipartRequestTableTest {\r
-\r
-    private SerializerRegistry registry;\r
-    private OFSerializer<MultipartRequestInput> multipartFactory;\r
-\r
-    /**\r
-     * Initializes serializer registry and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        multipartFactory = registry.getSerializer(\r
-                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));\r
-    }\r
-\r
-    /**\r
-     * Tests {@link MultipartRequestInputFactory} - Table case\r
-     * @throws Exception \r
-     */\r
-    @Test\r
-    public void test() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPTABLE);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestTableCaseBuilder caseBuilder = new MultipartRequestTableCaseBuilder();\r
-        MultipartRequestTableBuilder tablesBuilder = new MultipartRequestTableBuilder();\r
-        tablesBuilder.setEmpty(true);\r
-        caseBuilder.setMultipartRequestTable(tablesBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-\r
-        BufferHelper.checkHeaderV13(out, (byte) 18, 16);\r
-        Assert.assertEquals("Wrong type", 3, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        out.skipBytes(4); // skip padding\r
-        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MultipartRequestTableTest {
+
+    private SerializerRegistry registry;
+    private OFSerializer<MultipartRequestInput> multipartFactory;
+
+    /**
+     * Initializes serializer registry and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+        multipartFactory = registry.getSerializer(
+                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
+    }
+
+    /**
+     * Tests {@link MultipartRequestInputFactory} - Table case
+     * @throws Exception 
+     */
+    @Test
+    public void test() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
+        builder.setType(MultipartType.OFPMPTABLE);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestTableCaseBuilder caseBuilder = new MultipartRequestTableCaseBuilder();
+        MultipartRequestTableBuilder tablesBuilder = new MultipartRequestTableBuilder();
+        tablesBuilder.setEmpty(true);
+        caseBuilder.setMultipartRequestTable(tablesBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+
+        BufferHelper.checkHeaderV13(out, (byte) 18, 16);
+        Assert.assertEquals("Wrong type", 3, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        out.skipBytes(4); // skip padding
+        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
+    }
 }
\ No newline at end of file
index 448c5298f957ac1243601f0d5a79467453b70693..2831e6d5987721454eb6c1cb274550484e3e63de 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.v10.grouping.MatchV10Builder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10StatsRequestAggregateTest {\r
-\r
-    private SerializerRegistry registry;\r
-    private OFSerializer<MultipartRequestInput> statsFactory;\r
-\r
-    /**\r
-     * Initializes serializer registry and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        statsFactory = registry.getSerializer(\r
-                new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, MultipartRequestInput.class));\r
-    }\r
-\r
-    /**\r
-     * Tests {@link OF10StatsRequestInputFactory} for correct serialization\r
-     * @throws Exception \r
-     */\r
-    @Test\r
-    public void test() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPAGGREGATE);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();\r
-        MultipartRequestAggregateBuilder aggBuilder = new MultipartRequestAggregateBuilder();\r
-        MatchV10Builder matchBuilder = new MatchV10Builder();\r
-        matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true,\r
-                true, true, true, true));\r
-        matchBuilder.setNwSrcMask((short) 8);\r
-        matchBuilder.setNwDstMask((short) 16);\r
-        matchBuilder.setInPort(51);\r
-        matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));\r
-        matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));\r
-        matchBuilder.setDlVlan(52);\r
-        matchBuilder.setDlVlanPcp((short) 53);\r
-        matchBuilder.setDlType(54);\r
-        matchBuilder.setNwTos((short) 55);\r
-        matchBuilder.setNwProto((short) 56);\r
-        matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));\r
-        matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));\r
-        matchBuilder.setTpSrc(57);\r
-        matchBuilder.setTpDst(58);\r
-        aggBuilder.setMatchV10(matchBuilder.build());\r
-        aggBuilder.setTableId((short) 5);\r
-        aggBuilder.setOutPort(42L);\r
-        caseBuilder.setMultipartRequestAggregate(aggBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        statsFactory.serialize(message, out);\r
-\r
-        BufferHelper.checkHeaderV10(out, (byte) 16, 56);\r
-        Assert.assertEquals("Wrong type", 2, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        out.skipBytes(40); // skip match check\r
-        Assert.assertEquals("Wrong table-id", 5, out.readUnsignedByte());\r
-        out.skipBytes(1);\r
-        Assert.assertEquals("Wrong out port", 42, out.readUnsignedShort());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.v10.grouping.MatchV10Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10StatsRequestAggregateTest {
+
+    private SerializerRegistry registry;
+    private OFSerializer<MultipartRequestInput> statsFactory;
+
+    /**
+     * Initializes serializer registry and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+        statsFactory = registry.getSerializer(
+                new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, MultipartRequestInput.class));
+    }
+
+    /**
+     * Tests {@link OF10StatsRequestInputFactory} for correct serialization
+     * @throws Exception 
+     */
+    @Test
+    public void test() throws Exception {
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+        builder.setType(MultipartType.OFPMPAGGREGATE);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
+        MultipartRequestAggregateBuilder aggBuilder = new MultipartRequestAggregateBuilder();
+        MatchV10Builder matchBuilder = new MatchV10Builder();
+        matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true,
+                true, true, true, true));
+        matchBuilder.setNwSrcMask((short) 8);
+        matchBuilder.setNwDstMask((short) 16);
+        matchBuilder.setInPort(51);
+        matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));
+        matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));
+        matchBuilder.setDlVlan(52);
+        matchBuilder.setDlVlanPcp((short) 53);
+        matchBuilder.setDlType(54);
+        matchBuilder.setNwTos((short) 55);
+        matchBuilder.setNwProto((short) 56);
+        matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));
+        matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));
+        matchBuilder.setTpSrc(57);
+        matchBuilder.setTpDst(58);
+        aggBuilder.setMatchV10(matchBuilder.build());
+        aggBuilder.setTableId((short) 5);
+        aggBuilder.setOutPort(42L);
+        caseBuilder.setMultipartRequestAggregate(aggBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        statsFactory.serialize(message, out);
+
+        BufferHelper.checkHeaderV10(out, (byte) 16, 56);
+        Assert.assertEquals("Wrong type", 2, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        out.skipBytes(40); // skip match check
+        Assert.assertEquals("Wrong table-id", 5, out.readUnsignedByte());
+        out.skipBytes(1);
+        Assert.assertEquals("Wrong out port", 42, out.readUnsignedShort());
+    }
 }
\ No newline at end of file
index b26d4ffe6dafd6d64d4e8060c5f33d9aa8d58c4c..00a76683f64e2a8fc9d90afeec3810582d60e1c4 100644 (file)
@@ -1,79 +1,79 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Matchers;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequest;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequestBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class OF10StatsRequestExperimenterTest {\r
-\r
-    @Mock SerializerRegistry mockRegistry;\r
-    @Mock OFSerializer<MultipartRequestExperimenterCase> serializer;\r
-\r
-    /**\r
-     * Testing OF10StatsRequestInputFactory (Experimenter) for correct serialization\r
-     * @throws Exception\r
-     */\r
-    @Test\r
-    public void testExperimenter() throws Exception {\r
-        Mockito.when(mockRegistry.getSerializer(Matchers.any(ExperimenterIdSerializerKey.class)))\r
-            .thenReturn(serializer);\r
-        OF10StatsRequestInputFactory multipartFactory = new OF10StatsRequestInputFactory();\r
-        multipartFactory.injectSerializerRegistry(mockRegistry);\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPEXPERIMENTER);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();\r
-        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
-        ExperimenterIdMultipartRequestBuilder expIdBuilder = new ExperimenterIdMultipartRequestBuilder();\r
-        expIdBuilder.setExperimenter(new ExperimenterId(42L));\r
-        expBuilder.addAugmentation(ExperimenterIdMultipartRequest.class, expIdBuilder.build());\r
-        caseBuilder.setMultipartRequestExperimenter(expBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-\r
-        BufferHelper.checkHeaderV10(out, (byte) 16, 12);\r
-        Assert.assertEquals("Wrong type", 65535, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        Mockito.verify(serializer, Mockito.times(1)).serialize(Matchers.any(MultipartRequestExperimenterCase.class), Matchers.any(ByteBuf.class));\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.OF10StatsRequestInputFactory;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMultipartRequestBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class OF10StatsRequestExperimenterTest {
+
+    @Mock SerializerRegistry mockRegistry;
+    @Mock OFSerializer<MultipartRequestExperimenterCase> serializer;
+
+    /**
+     * Testing OF10StatsRequestInputFactory (Experimenter) for correct serialization
+     * @throws Exception
+     */
+    @Test
+    public void testExperimenter() throws Exception {
+        Mockito.when(mockRegistry.getSerializer(Matchers.any(ExperimenterIdSerializerKey.class)))
+            .thenReturn(serializer);
+        OF10StatsRequestInputFactory multipartFactory = new OF10StatsRequestInputFactory();
+        multipartFactory.injectSerializerRegistry(mockRegistry);
+        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
+        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+        builder.setType(MultipartType.OFPMPEXPERIMENTER);
+        builder.setFlags(new MultipartRequestFlags(false));
+        MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();
+        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();
+        ExperimenterIdMultipartRequestBuilder expIdBuilder = new ExperimenterIdMultipartRequestBuilder();
+        expIdBuilder.setExperimenter(new ExperimenterId(42L));
+        expBuilder.addAugmentation(ExperimenterIdMultipartRequest.class, expIdBuilder.build());
+        caseBuilder.setMultipartRequestExperimenter(expBuilder.build());
+        builder.setMultipartRequestBody(caseBuilder.build());
+        MultipartRequestInput message = builder.build();
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        multipartFactory.serialize(message, out);
+
+        BufferHelper.checkHeaderV10(out, (byte) 16, 12);
+        Assert.assertEquals("Wrong type", 65535, out.readUnsignedShort());
+        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
+        Mockito.verify(serializer, Mockito.times(1)).serialize(Matchers.any(MultipartRequestExperimenterCase.class), Matchers.any(ByteBuf.class));
+    }
 }
\ No newline at end of file
index 78b15e9ec4bead9a3339577b6241a16523b78d6a..1f1c8bf88305363faec106f423c69637543ea8cb 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpOpSerializerTest {\r
-\r
-    OxmArpOpSerializer serializer = new OxmArpOpSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareArpOpMatchEntry(1402);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 1402, buffer.readUnsignedShort());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareArpOpHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_OP, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareArpOpMatchEntry(int value) {\r
-        MatchEntriesBuilder builder = prepareArpOpHeader(false);\r
-        OpCodeMatchEntryBuilder opBuilder = new OpCodeMatchEntryBuilder();\r
-        opBuilder.setOpCode(value);\r
-        builder.addAugmentation(OpCodeMatchEntry.class, opBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareArpOpHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(ArpOp.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_OP, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpOpSerializerTest {
+
+    OxmArpOpSerializer serializer = new OxmArpOpSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareArpOpMatchEntry(1402);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 1402, buffer.readUnsignedShort());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareArpOpHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_OP, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareArpOpMatchEntry(int value) {
+        MatchEntriesBuilder builder = prepareArpOpHeader(false);
+        OpCodeMatchEntryBuilder opBuilder = new OpCodeMatchEntryBuilder();
+        opBuilder.setOpCode(value);
+        builder.addAugmentation(OpCodeMatchEntry.class, opBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareArpOpHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(ArpOp.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_OP, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index c23b9dbda24d387b6b3bcadadf11d958180a4ffe..b0dc9276a7dd2bce3c7afb37b2d660f7b7ac19cd 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpShaSerializerTest {\r
-\r
-    OxmArpThaSerializer serializer = new OxmArpThaSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[6];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        \r
-        byte[] address = new byte[6];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);\r
-        byte[] tmp = new byte[6];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_THA, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress(value));\r
-        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(ArpTha.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_THA, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpShaSerializerTest {
+
+    OxmArpThaSerializer serializer = new OxmArpThaSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[6];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        
+        byte[] address = new byte[6];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);
+        byte[] tmp = new byte[6];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_THA, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress(value));
+        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(ArpTha.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_THA, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index 7af95a1b71194fa6935fe9869baea55313997214..83d6afe7b0c8ae3db9dfbc4509f7c6d8a0028aa8 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpSpaSerializerTest {\r
-\r
-    OxmArpSpaSerializer serializer = new OxmArpSpaSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[4];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        \r
-        byte[] address = new byte[4];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);\r
-        byte[] tmp = new byte[4];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_SPA, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{15, 15, 0, 0});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();\r
-        addressBuilder.setIpv4Address(new Ipv4Address(value));\r
-        builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(ArpSpa.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_SPA, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpSpaSerializerTest {
+
+    OxmArpSpaSerializer serializer = new OxmArpSpaSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[4];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        
+        byte[] address = new byte[4];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);
+        byte[] tmp = new byte[4];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_SPA, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{15, 15, 0, 0});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();
+        addressBuilder.setIpv4Address(new Ipv4Address(value));
+        builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(ArpSpa.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_SPA, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index 714d69732e6cff8cd6755875486a7f1d8351b925..cc0f5d4c4cbd39d485bd8aed4012fb1ba1908c0b 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpThaSerializerTest {\r
-\r
-    OxmArpShaSerializer serializer = new OxmArpShaSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[6];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        \r
-        byte[] address = new byte[6];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);\r
-        byte[] tmp = new byte[6];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_SHA, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress(value));\r
-        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(ArpSha.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_SHA, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpThaSerializerTest {
+
+    OxmArpShaSerializer serializer = new OxmArpShaSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[6];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        
+        byte[] address = new byte[6];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);
+        byte[] tmp = new byte[6];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_SHA, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress(value));
+        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(ArpSha.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_SHA, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index 8a68a4c4f4a97e169307cc536e06633729f6d51c..90b5139547d65f389f4991cb4ad57b7d6332ed76 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmArpTpaSerializerTest {\r
-\r
-    OxmArpTpaSerializer serializer = new OxmArpTpaSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[4];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        \r
-        byte[] address = new byte[4];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);\r
-        byte[] tmp = new byte[4];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_TPA, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{15, 15, 0, 0});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();\r
-        addressBuilder.setIpv4Address(new Ipv4Address(value));\r
-        builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(ArpTpa.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_TPA, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmArpTpaSerializerTest {
+
+    OxmArpTpaSerializer serializer = new OxmArpTpaSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[4];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        
+        byte[] address = new byte[4];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);
+        byte[] tmp = new byte[4];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ARP_TPA, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{15, 15, 0, 0});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();
+        addressBuilder.setIpv4Address(new Ipv4Address(value));
+        builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(ArpTpa.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_TPA, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index 3f0d6837ecf944b12658029eab69dc32afb6f032..3a34fdde2059c2bf9c8b610d64e408e610e2973e 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthDstSerializerTest {\r
-\r
-    OxmEthDstSerializer serializer = new OxmEthDstSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[6];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        \r
-        byte[] address = new byte[6];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);\r
-        byte[] tmp = new byte[6];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_DST, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress(value));\r
-        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(EthDst.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_DST, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthDstSerializerTest {
+
+    OxmEthDstSerializer serializer = new OxmEthDstSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[6];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        
+        byte[] address = new byte[6];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);
+        byte[] tmp = new byte[6];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_DST, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress(value));
+        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(EthDst.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_DST, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index 4aed8e13f59352e8ddc00633bb9a03b799321b76..984899c1f229ab6f3e06e73b5908462c5d179456 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthSrcSerializerTest {\r
-\r
-    OxmEthSrcSerializer serializer = new OxmEthSrcSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[6];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        \r
-        byte[] address = new byte[6];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);\r
-        byte[] tmp = new byte[6];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_SRC, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress(value));\r
-        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(EthSrc.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_SRC, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthSrcSerializerTest {
+
+    OxmEthSrcSerializer serializer = new OxmEthSrcSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[6];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        
+        byte[] address = new byte[6];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address);
+        byte[] tmp = new byte[6];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_SRC, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress(value));
+        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(EthSrc.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_SRC, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", 2 * EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index 23f32491a38419b07aa3b4b7d343e1b31b0137d6..ae82abc926cf66dc7cb299879ba90a4a221b8ff0 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmEthTypeSerializerTest {\r
-\r
-    OxmEthTypeSerializer serializer = new OxmEthTypeSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareEthTypeMatchEntry(65535);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 65535, buffer.readUnsignedShort());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareEthTypeHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_TYPE, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    \r
-    private static MatchEntriesBuilder prepareEthTypeMatchEntry(int type) {\r
-        MatchEntriesBuilder builder = prepareEthTypeHeader(false);\r
-        EthTypeMatchEntryBuilder typeBuilder = new EthTypeMatchEntryBuilder();\r
-        typeBuilder.setEthType(new EtherType(type));\r
-        builder.addAugmentation(EthTypeMatchEntry.class, typeBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareEthTypeHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(EthType.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_TYPE, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmEthTypeSerializerTest {
+
+    OxmEthTypeSerializer serializer = new OxmEthTypeSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareEthTypeMatchEntry(65535);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 65535, buffer.readUnsignedShort());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareEthTypeHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ETH_TYPE, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+    }
+
+    
+    private static MatchEntriesBuilder prepareEthTypeMatchEntry(int type) {
+        MatchEntriesBuilder builder = prepareEthTypeHeader(false);
+        EthTypeMatchEntryBuilder typeBuilder = new EthTypeMatchEntryBuilder();
+        typeBuilder.setEthType(new EtherType(type));
+        builder.addAugmentation(EthTypeMatchEntry.class, typeBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareEthTypeHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(EthType.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_TYPE, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 69dbad6c7d42f1a897b95dc6b0f475866f95bcc1..ec559978f5b954cedc0756c8ef6a4f7813f31a68 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4CodeSerializerTest {\r
-\r
-    OxmIcmpv4CodeSerializer serializer = new OxmIcmpv4CodeSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareIcmpv4CodeMatchEntry((short) 200);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 200, buffer.readUnsignedByte());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareIcmpv4CodeHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV4_CODE, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    \r
-    private static MatchEntriesBuilder prepareIcmpv4CodeMatchEntry(short value) {\r
-        MatchEntriesBuilder builder = prepareIcmpv4CodeHeader(false);\r
-        Icmpv4CodeMatchEntryBuilder icmpv4Builder = new Icmpv4CodeMatchEntryBuilder();\r
-        icmpv4Builder.setIcmpv4Code(value);\r
-        builder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4Builder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareIcmpv4CodeHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(Icmpv4Code.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV4_CODE, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4CodeSerializerTest {
+
+    OxmIcmpv4CodeSerializer serializer = new OxmIcmpv4CodeSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareIcmpv4CodeMatchEntry((short) 200);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 200, buffer.readUnsignedByte());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareIcmpv4CodeHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV4_CODE, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+    }
+
+    
+    private static MatchEntriesBuilder prepareIcmpv4CodeMatchEntry(short value) {
+        MatchEntriesBuilder builder = prepareIcmpv4CodeHeader(false);
+        Icmpv4CodeMatchEntryBuilder icmpv4Builder = new Icmpv4CodeMatchEntryBuilder();
+        icmpv4Builder.setIcmpv4Code(value);
+        builder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4Builder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareIcmpv4CodeHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(Icmpv4Code.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV4_CODE, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 3b9d21097547ed5f033062ae948f0a181a96f01a..1c0c08ba7ac7c46385804ede5f4243b73bdaf483 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv4TypeSerializerTest {\r
-\r
-    OxmIcmpv4TypeSerializer serializer = new OxmIcmpv4TypeSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareIcmpv4TypeMatchEntry((short) 128);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 128, buffer.readUnsignedByte());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareIcmpv4TypeHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV4_TYPE, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    \r
-    private static MatchEntriesBuilder prepareIcmpv4TypeMatchEntry(short value) {\r
-        MatchEntriesBuilder builder = prepareIcmpv4TypeHeader(false);\r
-        Icmpv4TypeMatchEntryBuilder icmpv4Builder = new Icmpv4TypeMatchEntryBuilder();\r
-        icmpv4Builder.setIcmpv4Type(value);\r
-        builder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4Builder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareIcmpv4TypeHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(Icmpv4Type.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV4_TYPE, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv4TypeSerializerTest {
+
+    OxmIcmpv4TypeSerializer serializer = new OxmIcmpv4TypeSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareIcmpv4TypeMatchEntry((short) 128);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 128, buffer.readUnsignedByte());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareIcmpv4TypeHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV4_TYPE, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+    }
+
+    
+    private static MatchEntriesBuilder prepareIcmpv4TypeMatchEntry(short value) {
+        MatchEntriesBuilder builder = prepareIcmpv4TypeHeader(false);
+        Icmpv4TypeMatchEntryBuilder icmpv4Builder = new Icmpv4TypeMatchEntryBuilder();
+        icmpv4Builder.setIcmpv4Type(value);
+        builder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4Builder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareIcmpv4TypeHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(Icmpv4Type.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV4_TYPE, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index ed3089c0514f5e39697f0828f71cac9ed2ffe729..f45254417333a6eaf7bf969e0b036586518aaaf5 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6CodeSerializerTest {\r
-\r
-    OxmIcmpv6CodeSerializer serializer = new OxmIcmpv6CodeSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareIcmpv6CodeMatchEntry((short) 101);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 101, buffer.readUnsignedByte());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareIcmpv6CodeHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV6_CODE, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareIcmpv6CodeMatchEntry(short value) {\r
-        MatchEntriesBuilder builder = prepareIcmpv6CodeHeader(false);\r
-        Icmpv6CodeMatchEntryBuilder icmpv6Builder = new Icmpv6CodeMatchEntryBuilder();\r
-        icmpv6Builder.setIcmpv6Code(value);\r
-        builder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6Builder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareIcmpv6CodeHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(Icmpv6Code.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV6_CODE, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6CodeSerializerTest {
+
+    OxmIcmpv6CodeSerializer serializer = new OxmIcmpv6CodeSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareIcmpv6CodeMatchEntry((short) 101);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 101, buffer.readUnsignedByte());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareIcmpv6CodeHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV6_CODE, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareIcmpv6CodeMatchEntry(short value) {
+        MatchEntriesBuilder builder = prepareIcmpv6CodeHeader(false);
+        Icmpv6CodeMatchEntryBuilder icmpv6Builder = new Icmpv6CodeMatchEntryBuilder();
+        icmpv6Builder.setIcmpv6Code(value);
+        builder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6Builder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareIcmpv6CodeHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(Icmpv6Code.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV6_CODE, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 2c2a60ea07e6f4995a7870e8baf0425a9806463e..1c4240ad3b206419ecfa6b92d123775717961802 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIcmpv6TypeSerializerTest {\r
-\r
-    OxmIcmpv6TypeSerializer serializer = new OxmIcmpv6TypeSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareIcmpv6TypeMatchEntry((short) 123);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 123, buffer.readUnsignedByte());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareIcmpv6TypeHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV6_TYPE, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    \r
-    private static MatchEntriesBuilder prepareIcmpv6TypeMatchEntry(short value) {\r
-        MatchEntriesBuilder builder = prepareIcmpv6TypeHeader(false);\r
-        Icmpv6TypeMatchEntryBuilder icmpv6Builder = new Icmpv6TypeMatchEntryBuilder();\r
-        icmpv6Builder.setIcmpv6Type(value);\r
-        builder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6Builder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareIcmpv6TypeHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(Icmpv6Type.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV6_TYPE, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIcmpv6TypeSerializerTest {
+
+    OxmIcmpv6TypeSerializer serializer = new OxmIcmpv6TypeSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareIcmpv6TypeMatchEntry((short) 123);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 123, buffer.readUnsignedByte());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareIcmpv6TypeHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.ICMPV6_TYPE, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+    }
+
+    
+    private static MatchEntriesBuilder prepareIcmpv6TypeMatchEntry(short value) {
+        MatchEntriesBuilder builder = prepareIcmpv6TypeHeader(false);
+        Icmpv6TypeMatchEntryBuilder icmpv6Builder = new Icmpv6TypeMatchEntryBuilder();
+        icmpv6Builder.setIcmpv6Type(value);
+        builder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6Builder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareIcmpv6TypeHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(Icmpv6Type.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV6_TYPE, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 34d9a9f2a8c1b24e67225d4d41c369bf1c0499e9..0373589c5bd49abba8a37a40f0f27bce33a4ed35 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpDscpSerializerTest {\r
-\r
-    OxmIpDscpSerializer serializer = new OxmIpDscpSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareIpDscpMatchEntry((short) 58);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 58, buffer.readUnsignedByte());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareIpDscpHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.IP_DSCP, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareIpDscpMatchEntry(short value) {\r
-        MatchEntriesBuilder builder = prepareIpDscpHeader(false);\r
-        DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();\r
-        dscpBuilder.setDscp(new Dscp(value));\r
-        builder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareIpDscpHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(IpDscp.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.IP_DSCP, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpDscpSerializerTest {
+
+    OxmIpDscpSerializer serializer = new OxmIpDscpSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareIpDscpMatchEntry((short) 58);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 58, buffer.readUnsignedByte());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareIpDscpHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.IP_DSCP, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareIpDscpMatchEntry(short value) {
+        MatchEntriesBuilder builder = prepareIpDscpHeader(false);
+        DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();
+        dscpBuilder.setDscp(new Dscp(value));
+        builder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareIpDscpHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(IpDscp.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.IP_DSCP, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index fbeb425ae9bf40b00c87c6d6b41ca3f00ba974dd..2672e8070efe1ad216d858389a755beb77615aeb 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpProtoSerializerTest {\r
-\r
-    OxmIpProtoSerializer serializer = new OxmIpProtoSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry((short) 123);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 123, buffer.readUnsignedByte());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.IP_PROTO, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(short value) {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        ProtocolNumberMatchEntryBuilder protoBuilder = new ProtocolNumberMatchEntryBuilder();\r
-        protoBuilder.setProtocolNumber(value);\r
-        builder.addAugmentation(ProtocolNumberMatchEntry.class, protoBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(IpProto.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.IP_PROTO, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpProtoSerializerTest {
+
+    OxmIpProtoSerializer serializer = new OxmIpProtoSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMatchEntry((short) 123);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 123, buffer.readUnsignedByte());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.IP_PROTO, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(short value) {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        ProtocolNumberMatchEntryBuilder protoBuilder = new ProtocolNumberMatchEntryBuilder();
+        protoBuilder.setProtocolNumber(value);
+        builder.addAugmentation(ProtocolNumberMatchEntry.class, protoBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(IpProto.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.IP_PROTO, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 00c3dc871ac37cb36a75f3b23b63b52555d79767..69499578c286f3465896d8321b5e36597df83f09 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4DstSerializerTest {\r
-\r
-    OxmIpv4DstSerializer serializer = new OxmIpv4DstSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[4];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        \r
-        byte[] address = new byte[4];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);\r
-        byte[] tmp = new byte[4];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.IPV4_DST, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{15, 15, 0, 0});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();\r
-        addressBuilder.setIpv4Address(new Ipv4Address(value));\r
-        builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(Ipv4Dst.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_DST, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4DstSerializerTest {
+
+    OxmIpv4DstSerializer serializer = new OxmIpv4DstSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[4];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        
+        byte[] address = new byte[4];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);
+        byte[] tmp = new byte[4];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.IPV4_DST, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{15, 15, 0, 0});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();
+        addressBuilder.setIpv4Address(new Ipv4Address(value));
+        builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(Ipv4Dst.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_DST, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index 5b2834b9c205426c42ee4231def5b74aaf20bcf3..69866caa3a264e675ce6b2f7bc97129224459df7 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv4SrcSerializerTest {\r
-\r
-    OxmIpv4SrcSerializer serializer = new OxmIpv4SrcSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[4];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        \r
-        byte[] address = new byte[4];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);\r
-        byte[] tmp = new byte[4];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.IPV4_SRC, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{15, 15, 0, 0});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();\r
-        addressBuilder.setIpv4Address(new Ipv4Address(value));\r
-        builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(Ipv4Src.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_SRC, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv4SrcSerializerTest {
+
+    OxmIpv4SrcSerializer serializer = new OxmIpv4SrcSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, "10.0.0.1");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[4];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(true, "120.121.122.0");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        
+        byte[] address = new byte[4];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address);
+        byte[] tmp = new byte[4];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.IPV4_SRC, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{15, 15, 0, 0});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        Ipv4AddressMatchEntryBuilder addressBuilder = new Ipv4AddressMatchEntryBuilder();
+        addressBuilder.setIpv4Address(new Ipv4Address(value));
+        builder.addAugmentation(Ipv4AddressMatchEntry.class, addressBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(Ipv4Src.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_SRC, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index 1983b1d96677b4269d843288db7c057492e41616..0924f100062a7ba6c5252c40a8902c09133f606b 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6ExtHdrSerializerTest {\r
-\r
-    OxmIpv6ExtHdrSerializer serializer = new OxmIpv6ExtHdrSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = prepareIpv6ExtHdrMatchEntry(false,\r
-                new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true));\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 358, buffer.readUnsignedShort());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareIpv6ExtHdrMatchEntry(true,\r
-                new Ipv6ExthdrFlags(false, true, false, true, false, true, false, true, false));\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertEquals("Wrong value", 153, buffer.readUnsignedShort());\r
-        byte[] tmp = new byte[2];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{0, 15}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_EXTHDR, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    \r
-    private static MatchEntriesBuilder prepareIpv6ExtHdrMatchEntry(boolean hasMask, Ipv6ExthdrFlags flags) {\r
-        MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{0, 15});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();\r
-        pseudoBuilder.setPseudoField(flags);\r
-        builder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareIpv6ExtHdrHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(Ipv6Exthdr.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_EXTHDR, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6ExtHdrSerializerTest {
+
+    OxmIpv6ExtHdrSerializer serializer = new OxmIpv6ExtHdrSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = prepareIpv6ExtHdrMatchEntry(false,
+                new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true));
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 358, buffer.readUnsignedShort());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = prepareIpv6ExtHdrMatchEntry(true,
+                new Ipv6ExthdrFlags(false, true, false, true, false, true, false, true, false));
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertEquals("Wrong value", 153, buffer.readUnsignedShort());
+        byte[] tmp = new byte[2];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{0, 15}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_EXTHDR, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+    }
+
+    
+    private static MatchEntriesBuilder prepareIpv6ExtHdrMatchEntry(boolean hasMask, Ipv6ExthdrFlags flags) {
+        MatchEntriesBuilder builder = prepareIpv6ExtHdrHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{0, 15});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();
+        pseudoBuilder.setPseudoField(flags);
+        builder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareIpv6ExtHdrHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(Ipv6Exthdr.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_EXTHDR, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index a3e4ff63a9490699dc0252c575f0a027ee055180..52df5db11f89eac82b480c54327a8e361b595ab5 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdSllSerializerTest {\r
-\r
-    OxmIpv6NdSllSerializer serializer = new OxmIpv6NdSllSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[6];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_ND_SLL, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress(value));\r
-        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(Ipv6NdSll.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_ND_SLL, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdSllSerializerTest {
+
+    OxmIpv6NdSllSerializer serializer = new OxmIpv6NdSllSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[6];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_ND_SLL, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress(value));
+        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(Ipv6NdSll.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_ND_SLL, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 017652d91bd6bd63fc71f64b9104651f54508dc9..6c6e8d311daf47f3fe3265d4107451d5f9eed054 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmIpv6NdTllSerializerTest {\r
-\r
-    OxmIpv6NdTllSerializer serializer = new OxmIpv6NdTllSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[6];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_ND_TLL, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress(value));\r
-        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(Ipv6NdTll.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_ND_TLL, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmIpv6NdTllSerializerTest {
+
+    OxmIpv6NdTllSerializer serializer = new OxmIpv6NdTllSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05");
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[6];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.IPV6_ND_TLL, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.MAC_ADDRESS_LENGTH, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, String value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{15, 15, 0, 0, 10, 10});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress(value));
+        builder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(Ipv6NdTll.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_ND_TLL, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index e8e53f174ae3a7fa0dee1ce2e275bf61f3c2c388..fbe202dc721d4559dedc585110f869c21bb51408 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMetadataSerializerTest {\r
-\r
-    OxmMetadataSerializer serializer = new OxmMetadataSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, new byte[]{0, 1, 2, 3, 4, 5, 6, 7});\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[8];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5, 6, 7}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(true, new byte[]{8, 9, 10, 11, 12, 13, 14, 15});\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        \r
-        byte[] address = new byte[8];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{8, 9, 10, 11, 12, 13, 14, 15}, address);\r
-        byte[] tmp = new byte[8];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{30, 30, 25, 25, 15, 15, 0, 0}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.METADATA, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, byte[] value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{30, 30, 25, 25, 15, 15, 0, 0});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();\r
-        metadataBuilder.setMetadata(value);\r
-        builder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(Metadata.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.METADATA, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMetadataSerializerTest {
+
+    OxmMetadataSerializer serializer = new OxmMetadataSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, new byte[]{0, 1, 2, 3, 4, 5, 6, 7});
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[8];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5, 6, 7}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(true, new byte[]{8, 9, 10, 11, 12, 13, 14, 15});
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        
+        byte[] address = new byte[8];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{8, 9, 10, 11, 12, 13, 14, 15}, address);
+        byte[] tmp = new byte[8];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{30, 30, 25, 25, 15, 15, 0, 0}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.METADATA, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, byte[] value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{30, 30, 25, 25, 15, 15, 0, 0});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();
+        metadataBuilder.setMetadata(value);
+        builder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(Metadata.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.METADATA, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index 27c5d504f7455bf73c67ce5f48f60c2995670a55..6c22ec4ae5a57789f4bbea9f5e8b3c2862bab974 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsBosSerializerTest {\r
-\r
-    OxmMplsBosSerializer serializer = new OxmMplsBosSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMplsBosMatchEntry(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 1, buffer.readUnsignedByte());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareMplsBosHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_BOS, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    \r
-    private static MatchEntriesBuilder prepareMplsBosMatchEntry(boolean bos) {\r
-        MatchEntriesBuilder builder = prepareMplsBosHeader(false);\r
-        BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();\r
-        bosBuilder.setBos(bos);\r
-        builder.addAugmentation(BosMatchEntry.class, bosBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMplsBosHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(MplsBos.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_BOS, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsBosSerializerTest {
+
+    OxmMplsBosSerializer serializer = new OxmMplsBosSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMplsBosMatchEntry(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 1, buffer.readUnsignedByte());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareMplsBosHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_BOS, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+    }
+
+    
+    private static MatchEntriesBuilder prepareMplsBosMatchEntry(boolean bos) {
+        MatchEntriesBuilder builder = prepareMplsBosHeader(false);
+        BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();
+        bosBuilder.setBos(bos);
+        builder.addAugmentation(BosMatchEntry.class, bosBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareMplsBosHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(MplsBos.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_BOS, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 77e07f8a3632cb08f3ec6203dde246c217125146..c20890b93820fc937c5897afaf5db13d66b3b8ed 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsLabelSerializerTest {\r
-\r
-    OxmMplsLabelSerializer serializer = new OxmMplsLabelSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMplsLabelMatchEntry(168535);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 168535, buffer.readUnsignedInt());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareMplsLabelHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_LABEL, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMplsLabelMatchEntry(long label) {\r
-        MatchEntriesBuilder builder = prepareMplsLabelHeader(false);\r
-        MplsLabelMatchEntryBuilder labelBuilder = new MplsLabelMatchEntryBuilder();\r
-        labelBuilder.setMplsLabel(label);\r
-        builder.addAugmentation(MplsLabelMatchEntry.class, labelBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMplsLabelHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(MplsLabel.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_LABEL, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsLabelSerializerTest {
+
+    OxmMplsLabelSerializer serializer = new OxmMplsLabelSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMplsLabelMatchEntry(168535);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 168535, buffer.readUnsignedInt());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareMplsLabelHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_LABEL, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMplsLabelMatchEntry(long label) {
+        MatchEntriesBuilder builder = prepareMplsLabelHeader(false);
+        MplsLabelMatchEntryBuilder labelBuilder = new MplsLabelMatchEntryBuilder();
+        labelBuilder.setMplsLabel(label);
+        builder.addAugmentation(MplsLabelMatchEntry.class, labelBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareMplsLabelHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(MplsLabel.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_LABEL, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 8a387b6ca5a4ac9e838e706dbd18879f75ff1f12..d851b755866566a4e990ec39881c40dbf1b7ed65 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmMplsTcSerializerTest {\r
-\r
-    OxmMplsTcSerializer serializer = new OxmMplsTcSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMplsTcMatchEntry((short) 16);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 16, buffer.readUnsignedByte());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareMplsTcHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_TC, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMplsTcMatchEntry(short value) {\r
-        MatchEntriesBuilder builder = prepareMplsTcHeader(false);\r
-        TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();\r
-        tcBuilder.setTc(value);\r
-        builder.addAugmentation(TcMatchEntry.class, tcBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMplsTcHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(MplsTc.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_TC, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmMplsTcSerializerTest {
+
+    OxmMplsTcSerializer serializer = new OxmMplsTcSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMplsTcMatchEntry((short) 16);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 16, buffer.readUnsignedByte());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareMplsTcHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.MPLS_TC, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMplsTcMatchEntry(short value) {
+        MatchEntriesBuilder builder = prepareMplsTcHeader(false);
+        TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();
+        tcBuilder.setTc(value);
+        builder.addAugmentation(TcMatchEntry.class, tcBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareMplsTcHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(MplsTc.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_TC, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 974ecb76c457b13fe6540ad05bef144cf73a0608..f2cbf8976fe35054be196556d0719b634d29b5c1 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmPbbIsidSerializerTest {\r
-\r
-    OxmPbbIsidSerializer serializer = new OxmPbbIsidSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = preparePbbIsidMatchEntry(false, 12345);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 12345, buffer.readUnsignedMedium());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = preparePbbIsidMatchEntry(true, 6789);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertEquals("Wrong value", 6789, buffer.readUnsignedMedium());\r
-        byte[] tmp = new byte[3];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{0, 15, 10}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = preparePbbIsidHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = preparePbbIsidHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.PBB_ISID, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_3_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    \r
-    private static MatchEntriesBuilder preparePbbIsidMatchEntry(boolean hasMask, long value) {\r
-        MatchEntriesBuilder builder = preparePbbIsidHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{0, 15, 10});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();\r
-        isidBuilder.setIsid(value);\r
-        builder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder preparePbbIsidHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(PbbIsid.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.PBB_ISID, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_3_BYTES, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_3_BYTES, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmPbbIsidSerializerTest {
+
+    OxmPbbIsidSerializer serializer = new OxmPbbIsidSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = preparePbbIsidMatchEntry(false, 12345);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 12345, buffer.readUnsignedMedium());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = preparePbbIsidMatchEntry(true, 6789);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertEquals("Wrong value", 6789, buffer.readUnsignedMedium());
+        byte[] tmp = new byte[3];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{0, 15, 10}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = preparePbbIsidHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = preparePbbIsidHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.PBB_ISID, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_3_BYTES, serializer.getValueLength());
+    }
+
+    
+    private static MatchEntriesBuilder preparePbbIsidMatchEntry(boolean hasMask, long value) {
+        MatchEntriesBuilder builder = preparePbbIsidHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{0, 15, 10});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();
+        isidBuilder.setIsid(value);
+        builder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder preparePbbIsidHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(PbbIsid.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.PBB_ISID, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_3_BYTES, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_3_BYTES, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index 606696c80bc5c6a7d3017eb56d63c278da914a6e..e56c5c0d849b5ac8350a0d83406f50d41a0bc918 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpDstSerializerTest {\r
-\r
-    OxmSctpDstSerializer serializer = new OxmSctpDstSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(4096);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 4096, buffer.readUnsignedShort());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.SCTP_DST, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new PortNumber(value));\r
-        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(SctpDst.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.SCTP_DST, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpDstSerializerTest {
+
+    OxmSctpDstSerializer serializer = new OxmSctpDstSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMatchEntry(4096);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 4096, buffer.readUnsignedShort());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.SCTP_DST, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(int value) {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new PortNumber(value));
+        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(SctpDst.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.SCTP_DST, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index a28c60fe5aef3f8cc0b715f26ad4b710eb00e075..6c3890c46a5890a8838e325fd507f0321061f904 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmSctpSrcSerializerTest {\r
-\r
-    OxmSctpSrcSerializer serializer = new OxmSctpSrcSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(4096);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 4096, buffer.readUnsignedShort());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.SCTP_SRC, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new PortNumber(value));\r
-        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(SctpSrc.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.SCTP_SRC, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmSctpSrcSerializerTest {
+
+    OxmSctpSrcSerializer serializer = new OxmSctpSrcSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMatchEntry(4096);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 4096, buffer.readUnsignedShort());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.SCTP_SRC, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(int value) {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new PortNumber(value));
+        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(SctpSrc.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.SCTP_SRC, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index fb56055462540d0d0edb073ce4e821f2e9051671..b912aed3d2d1b95e6a1513a373b0e3092ec0f35b 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpDstSerializerTest {\r
-\r
-    OxmTcpDstSerializer serializer = new OxmTcpDstSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(4096);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 4096, buffer.readUnsignedShort());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.TCP_DST, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new PortNumber(value));\r
-        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(TcpDst.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.TCP_DST, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpDstSerializerTest {
+
+    OxmTcpDstSerializer serializer = new OxmTcpDstSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMatchEntry(4096);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 4096, buffer.readUnsignedShort());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.TCP_DST, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(int value) {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new PortNumber(value));
+        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(TcpDst.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.TCP_DST, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 9e5326400eed72f8574e049e1bd334c1e4ecbfb2..c156b2f5106f1adf85bb1fdd058e274146e5b251 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTcpSrcSerializerTest {\r
-\r
-    OxmTcpSrcSerializer serializer = new OxmTcpSrcSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(512);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 512, buffer.readUnsignedShort());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.TCP_SRC, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new PortNumber(value));\r
-        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(TcpSrc.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.TCP_SRC, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTcpSrcSerializerTest {
+
+    OxmTcpSrcSerializer serializer = new OxmTcpSrcSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMatchEntry(512);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 512, buffer.readUnsignedShort());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.TCP_SRC, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(int value) {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new PortNumber(value));
+        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(TcpSrc.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.TCP_SRC, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index cd4029ec6eb36702f2aa162478e4f0ce79bcc2fe..35f2986e84d8dcb3d31a83638720fe2232134e5d 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmTunnelIdSerializerTest {\r
-\r
-    OxmTunnelIdSerializer serializer = new OxmTunnelIdSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(false, new byte[]{0, 1, 2, 3, 4, 5, 6, 7});\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        byte[] address = new byte[8];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5, 6, 7}, address);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithMask() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(true, new byte[]{8, 9, 10, 11, 12, 13, 14, 15});\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        \r
-        byte[] address = new byte[8];\r
-        buffer.readBytes(address);\r
-        Assert.assertArrayEquals("Wrong address", new byte[]{8, 9, 10, 11, 12, 13, 14, 15}, address);\r
-        byte[] tmp = new byte[8];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{30, 30, 25, 25, 15, 15, 0, 0}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.TUNNEL_ID, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, byte[] value) {\r
-        MatchEntriesBuilder builder = prepareHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{30, 30, 25, 25, 15, 15, 0, 0});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();\r
-        metadataBuilder.setMetadata(value);\r
-        builder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(TunnelId.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.TUNNEL_ID, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmTunnelIdSerializerTest {
+
+    OxmTunnelIdSerializer serializer = new OxmTunnelIdSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(false, new byte[]{0, 1, 2, 3, 4, 5, 6, 7});
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        byte[] address = new byte[8];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5, 6, 7}, address);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithMask() {
+        MatchEntriesBuilder builder = prepareMatchEntry(true, new byte[]{8, 9, 10, 11, 12, 13, 14, 15});
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        
+        byte[] address = new byte[8];
+        buffer.readBytes(address);
+        Assert.assertArrayEquals("Wrong address", new byte[]{8, 9, 10, 11, 12, 13, 14, 15}, address);
+        byte[] tmp = new byte[8];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{30, 30, 25, 25, 15, 15, 0, 0}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.TUNNEL_ID, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, byte[] value) {
+        MatchEntriesBuilder builder = prepareHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{30, 30, 25, 25, 15, 15, 0, 0});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();
+        metadataBuilder.setMetadata(value);
+        builder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(TunnelId.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.TUNNEL_ID, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index 4cf555881370d7cde587db908b26b95ddcb14ff6..1cafb4919d5a17c644a0b705282534ba97cabca9 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpDstSerializerTest {\r
-\r
-    OxmUdpDstSerializer serializer = new OxmUdpDstSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(2048);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 2048, buffer.readUnsignedShort());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.UDP_DST, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new PortNumber(value));\r
-        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(UdpDst.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.UDP_DST, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpDstSerializerTest {
+
+    OxmUdpDstSerializer serializer = new OxmUdpDstSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMatchEntry(2048);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 2048, buffer.readUnsignedShort());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.UDP_DST, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(int value) {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new PortNumber(value));
+        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(UdpDst.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.UDP_DST, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 7348307d5509b491068833a05f8654bb2691db6a..d4989830efa84727faf86aef9f1fb29a70966dfc 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmUdpSrcSerializerTest {\r
-\r
-    OxmUdpSrcSerializer serializer = new OxmUdpSrcSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareMatchEntry(1024);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 1024, buffer.readUnsignedShort());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.UDP_SRC, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareMatchEntry(int value) {\r
-        MatchEntriesBuilder builder = prepareHeader(false);\r
-        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new PortNumber(value));\r
-        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(UdpSrc.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.UDP_SRC, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmUdpSrcSerializerTest {
+
+    OxmUdpSrcSerializer serializer = new OxmUdpSrcSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareMatchEntry(1024);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 1024, buffer.readUnsignedShort());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.UDP_SRC, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareMatchEntry(int value) {
+        MatchEntriesBuilder builder = prepareHeader(false);
+        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new PortNumber(value));
+        builder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(UdpSrc.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.UDP_SRC, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 0ce0f64a1c90b5b601d2c2d46f7d925f5911e6c0..ba08ad08ee2147fd1e44b31dcdc31807a88b1785 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanPcpSerializerTest {\r
-\r
-    OxmVlanPcpSerializer serializer = new OxmVlanPcpSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerialize() {\r
-        MatchEntriesBuilder builder = prepareVlanPcpMatchEntry((short) 42);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 42, buffer.readUnsignedByte());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeader() {\r
-        MatchEntriesBuilder builder = prepareVlanPcpHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.VLAN_PCP, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareVlanPcpMatchEntry(short value) {\r
-        MatchEntriesBuilder builder = prepareVlanPcpHeader(false);\r
-        VlanPcpMatchEntryBuilder pcpBuilder = new VlanPcpMatchEntryBuilder();\r
-        pcpBuilder.setVlanPcp(value);\r
-        builder.addAugmentation(VlanPcpMatchEntry.class, pcpBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareVlanPcpHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(VlanPcp.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.VLAN_PCP, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanPcpSerializerTest {
+
+    OxmVlanPcpSerializer serializer = new OxmVlanPcpSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerialize() {
+        MatchEntriesBuilder builder = prepareVlanPcpMatchEntry((short) 42);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 42, buffer.readUnsignedByte());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeader() {
+        MatchEntriesBuilder builder = prepareVlanPcpHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.VLAN_PCP, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareVlanPcpMatchEntry(short value) {
+        MatchEntriesBuilder builder = prepareVlanPcpHeader(false);
+        VlanPcpMatchEntryBuilder pcpBuilder = new VlanPcpMatchEntryBuilder();
+        pcpBuilder.setVlanPcp(value);
+        builder.addAugmentation(VlanPcpMatchEntry.class, pcpBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareVlanPcpHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(VlanPcp.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.VLAN_PCP, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+    }
 }
\ No newline at end of file
index 3e9bf62cffc6a52d97506a77f855398e12199123..f0ae6dea9a3982ac8541096aed1c43a2f7bcd82c 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OxmVlanVidSerializerTest {\r
-\r
-    OxmVlanVidSerializer serializer = new OxmVlanVidSerializer();\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithCfiBitSet() {\r
-        MatchEntriesBuilder builder = prepareVlanVidMatchEntry(false, true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertEquals("Wrong value", 4596, buffer.readUnsignedShort());\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct serialization\r
-     */\r
-    @Test\r
-    public void testSerializeWithoutCfiBitSet() {\r
-        MatchEntriesBuilder builder = prepareVlanVidMatchEntry(true, false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serialize(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertEquals("Wrong value", 500, buffer.readUnsignedShort());\r
-        byte[] tmp = new byte[2];\r
-        buffer.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15}, tmp);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithoutMask() {\r
-        MatchEntriesBuilder builder = prepareVlanVidHeader(false);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, false);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct header serialization\r
-     */\r
-    @Test\r
-    public void testSerializeHeaderWithMask() {\r
-        MatchEntriesBuilder builder = prepareVlanVidHeader(true);\r
-        \r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        serializer.serializeHeader(builder.build(), buffer);\r
-\r
-        checkHeader(buffer, true);\r
-        assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-class return value\r
-     */\r
-    @Test\r
-    public void testGetOxmClassCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct oxm-field return value\r
-     */\r
-    @Test\r
-    public void getOxmFieldCode() {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.VLAN_VID, serializer.getOxmFieldCode());\r
-    }\r
-\r
-    /**\r
-     * Test correct value length return value\r
-     */\r
-    @Test\r
-    public void testGetValueLength() {\r
-        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareVlanVidMatchEntry(boolean hasMask, boolean cfiBit) {\r
-        MatchEntriesBuilder builder = prepareVlanVidHeader(hasMask);\r
-        if (hasMask) {\r
-            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-            maskBuilder.setMask(new byte[]{15, 15});\r
-            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        }\r
-        VlanVidMatchEntryBuilder vlanBuilder = new VlanVidMatchEntryBuilder();\r
-        vlanBuilder.setVlanVid(500);\r
-        vlanBuilder.setCfiBit(cfiBit);\r
-        builder.addAugmentation(VlanVidMatchEntry.class, vlanBuilder.build());\r
-        return builder;\r
-    }\r
-\r
-    private static MatchEntriesBuilder prepareVlanVidHeader(boolean hasMask) {\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(VlanVid.class);\r
-        builder.setHasMask(hasMask);\r
-        return builder;\r
-    }\r
-\r
-    private static void checkHeader(ByteBuf buffer, boolean hasMask) {\r
-        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());\r
-        short fieldAndMask = buffer.readUnsignedByte();\r
-        assertEquals("Wrong oxm-field", OxmMatchConstants.VLAN_VID, fieldAndMask >>> 1);\r
-        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);\r
-        if (hasMask) {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());\r
-        } else {\r
-            assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());\r
-        }\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.match;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OxmVlanVidSerializerTest {
+
+    OxmVlanVidSerializer serializer = new OxmVlanVidSerializer();
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithCfiBitSet() {
+        MatchEntriesBuilder builder = prepareVlanVidMatchEntry(false, true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertEquals("Wrong value", 4596, buffer.readUnsignedShort());
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct serialization
+     */
+    @Test
+    public void testSerializeWithoutCfiBitSet() {
+        MatchEntriesBuilder builder = prepareVlanVidMatchEntry(true, false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serialize(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertEquals("Wrong value", 500, buffer.readUnsignedShort());
+        byte[] tmp = new byte[2];
+        buffer.readBytes(tmp);
+        Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15}, tmp);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithoutMask() {
+        MatchEntriesBuilder builder = prepareVlanVidHeader(false);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, false);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct header serialization
+     */
+    @Test
+    public void testSerializeHeaderWithMask() {
+        MatchEntriesBuilder builder = prepareVlanVidHeader(true);
+        
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        serializer.serializeHeader(builder.build(), buffer);
+
+        checkHeader(buffer, true);
+        assertTrue("Unexpected data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Test correct oxm-class return value
+     */
+    @Test
+    public void testGetOxmClassCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, serializer.getOxmClassCode());
+    }
+
+    /**
+     * Test correct oxm-field return value
+     */
+    @Test
+    public void getOxmFieldCode() {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.VLAN_VID, serializer.getOxmFieldCode());
+    }
+
+    /**
+     * Test correct value length return value
+     */
+    @Test
+    public void testGetValueLength() {
+        assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+    }
+
+    private static MatchEntriesBuilder prepareVlanVidMatchEntry(boolean hasMask, boolean cfiBit) {
+        MatchEntriesBuilder builder = prepareVlanVidHeader(hasMask);
+        if (hasMask) {
+            MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+            maskBuilder.setMask(new byte[]{15, 15});
+            builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        }
+        VlanVidMatchEntryBuilder vlanBuilder = new VlanVidMatchEntryBuilder();
+        vlanBuilder.setVlanVid(500);
+        vlanBuilder.setCfiBit(cfiBit);
+        builder.addAugmentation(VlanVidMatchEntry.class, vlanBuilder.build());
+        return builder;
+    }
+
+    private static MatchEntriesBuilder prepareVlanVidHeader(boolean hasMask) {
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(VlanVid.class);
+        builder.setHasMask(hasMask);
+        return builder;
+    }
+
+    private static void checkHeader(ByteBuf buffer, boolean hasMask) {
+        assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort());
+        short fieldAndMask = buffer.readUnsignedByte();
+        assertEquals("Wrong oxm-field", OxmMatchConstants.VLAN_VID, fieldAndMask >>> 1);
+        assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
+        if (hasMask) {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+        } else {
+            assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+        }
+    }
 }
\ No newline at end of file
index e0dfb8f70d1261ede3a73b9da076a12da6b5c01c..d7d29d842fcd675424f67d48fe445993b437af45 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.action.AbstractActionDeserializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ActionsDeserializerTest {\r
-\r
-    private static final Logger LOGGER = LoggerFactory\r
-            .getLogger(ActionsDeserializerTest.class);\r
-    private DeserializerRegistry registry;\r
-\r
-    /**\r
-     * Initializes deserializer registry and lookups correct deserializer\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new DeserializerRegistryImpl();\r
-        registry.init();\r
-    }\r
-\r
-    /**\r
-     * Testing actions deserialization\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ByteBuf message = BufferHelper.buildBuffer("00 00 00 10 00 00 00 01 00 02 00 00 00 00 00 00 "\r
-                + "00 0B 00 08 00 00 00 00 "\r
-                + "00 0C 00 08 00 00 00 00 "\r
-                + "00 0F 00 08 03 00 00 00 "\r
-                + "00 10 00 08 00 00 00 00 "\r
-                + "00 11 00 08 00 04 00 00 "\r
-                + "00 12 00 08 00 00 00 00 "\r
-                + "00 13 00 08 00 05 00 00 "\r
-                + "00 14 00 08 00 06 00 00 "\r
-                + "00 15 00 08 00 00 00 07 "\r
-                + "00 16 00 08 00 00 00 08 "\r
-                + "00 17 00 08 09 00 00 00 "\r
-                + "00 18 00 08 00 00 00 00 "\r
-                + "00 19 00 10 80 00 02 04 00 00 00 0B 00 00 00 00 "\r
-                + "00 1A 00 08 00 0A 00 00 "\r
-                + "00 1B 00 08 00 00 00 00");\r
-        \r
-        message.skipBytes(4); // skip XID\r
-        LOGGER.info("bytes: " + message.readableBytes());\r
-        \r
-        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,\r
-                message.readableBytes(), message, keyMaker, registry);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.Output", actions.get(0).getType().getName());\r
-        Assert.assertEquals("Wrong action port", 1,\r
-                actions.get(0).getAugmentation(PortAction.class).getPort().getValue().intValue());\r
-        Assert.assertEquals("Wrong action max-length", 2,\r
-                actions.get(0).getAugmentation(MaxLengthAction.class).getMaxLength().intValue());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.CopyTtlOut", actions.get(1).getType().getName());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.CopyTtlIn", actions.get(2).getType().getName());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.SetMplsTtl", actions.get(3).getType().getName());\r
-        Assert.assertEquals("Wrong action value", 3,\r
-                actions.get(3).getAugmentation(MplsTtlAction.class).getMplsTtl().shortValue());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.DecMplsTtl", actions.get(4).getType().getName());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.PushVlan", actions.get(5).getType().getName());\r
-        Assert.assertEquals("Wrong action value", 4,\r
-                actions.get(5).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.PopVlan", actions.get(6).getType().getName());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.PushMpls", actions.get(7).getType().getName());\r
-        Assert.assertEquals("Wrong action value", 5,\r
-                actions.get(7).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.PopMpls", actions.get(8).getType().getName());\r
-        Assert.assertEquals("Wrong action value", 6,\r
-                actions.get(8).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.SetQueue", actions.get(9).getType().getName());\r
-        Assert.assertEquals("Wrong action value", 7,\r
-                actions.get(9).getAugmentation(QueueIdAction.class).getQueueId().intValue());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.Group", actions.get(10).getType().getName());\r
-        Assert.assertEquals("Wrong action value", 8,\r
-                actions.get(10).getAugmentation(GroupIdAction.class).getGroupId().intValue());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.SetNwTtl", actions.get(11).getType().getName());\r
-        Assert.assertEquals("Wrong action value", 9,\r
-                actions.get(11).getAugmentation(NwTtlAction.class).getNwTtl().intValue());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.DecNwTtl", actions.get(12).getType().getName());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.SetField", actions.get(13).getType().getName());\r
-        List<MatchEntries> entries = actions.get(13).getAugmentation(OxmFieldsAction.class).getMatchEntries();\r
-        Assert.assertEquals("Wrong number of fields", 1, entries.size());\r
-        Assert.assertEquals("Wrong match entry class", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow."\r
-                + "oxm.rev130731.OpenflowBasicClass", entries.get(0).getOxmClass().getName());\r
-        Assert.assertEquals("Wrong match entry field", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow."\r
-                + "oxm.rev130731.InPhyPort", entries.get(0).getOxmMatchField().getName());\r
-        Assert.assertEquals("Wrong match entry mask", false, entries.get(0).isHasMask());\r
-        Assert.assertEquals("Wrong match entry value", 11, \r
-                entries.get(0).getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.PushPbb", actions.get(14).getType().getName());\r
-        Assert.assertEquals("Wrong action value", 10,\r
-                actions.get(14).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.PopPbb", actions.get(15).getType().getName());\r
-        Assert.assertTrue("Unread data in message", message.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Tests {@link AbstractActionDeserializer#deserializeHeader(ByteBuf)}\r
-     */\r
-    @Test\r
-    public void testDeserializeHeader() {\r
-        ByteBuf message = BufferHelper.buildBuffer("00 00 00 04 00 19 00 04");\r
-\r
-        message.skipBytes(4); // skip XID\r
-        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        List<Action> actions = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID,\r
-                message.readableBytes(), message, keyMaker, registry);\r
-\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.Output", actions.get(0).getType().getName());\r
-        Assert.assertEquals("Wrong action port", null, actions.get(0).getAugmentation(PortAction.class));\r
-        Assert.assertEquals("Wrong action max-length", null, actions.get(0).getAugmentation(MaxLengthAction.class));\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."\r
-                + "openflow.common.action.rev130731.SetField", actions.get(1).getType().getName());\r
-        Assert.assertEquals("Wrong action oxm field", null, actions.get(1).getAugmentation(OxmFieldsAction.class));\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.action.AbstractActionDeserializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ActionsDeserializerTest {
+
+    private static final Logger LOGGER = LoggerFactory
+            .getLogger(ActionsDeserializerTest.class);
+    private DeserializerRegistry registry;
+
+    /**
+     * Initializes deserializer registry and lookups correct deserializer
+     */
+    @Before
+    public void startUp() {
+        registry = new DeserializerRegistryImpl();
+        registry.init();
+    }
+
+    /**
+     * Testing actions deserialization
+     */
+    @Test
+    public void test() {
+        ByteBuf message = BufferHelper.buildBuffer("00 00 00 10 00 00 00 01 00 02 00 00 00 00 00 00 "
+                + "00 0B 00 08 00 00 00 00 "
+                + "00 0C 00 08 00 00 00 00 "
+                + "00 0F 00 08 03 00 00 00 "
+                + "00 10 00 08 00 00 00 00 "
+                + "00 11 00 08 00 04 00 00 "
+                + "00 12 00 08 00 00 00 00 "
+                + "00 13 00 08 00 05 00 00 "
+                + "00 14 00 08 00 06 00 00 "
+                + "00 15 00 08 00 00 00 07 "
+                + "00 16 00 08 00 00 00 08 "
+                + "00 17 00 08 09 00 00 00 "
+                + "00 18 00 08 00 00 00 00 "
+                + "00 19 00 10 80 00 02 04 00 00 00 0B 00 00 00 00 "
+                + "00 1A 00 08 00 0A 00 00 "
+                + "00 1B 00 08 00 00 00 00");
+        
+        message.skipBytes(4); // skip XID
+        LOGGER.info("bytes: " + message.readableBytes());
+        
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,
+                message.readableBytes(), message, keyMaker, registry);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.Output", actions.get(0).getType().getName());
+        Assert.assertEquals("Wrong action port", 1,
+                actions.get(0).getAugmentation(PortAction.class).getPort().getValue().intValue());
+        Assert.assertEquals("Wrong action max-length", 2,
+                actions.get(0).getAugmentation(MaxLengthAction.class).getMaxLength().intValue());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.CopyTtlOut", actions.get(1).getType().getName());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.CopyTtlIn", actions.get(2).getType().getName());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.SetMplsTtl", actions.get(3).getType().getName());
+        Assert.assertEquals("Wrong action value", 3,
+                actions.get(3).getAugmentation(MplsTtlAction.class).getMplsTtl().shortValue());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.DecMplsTtl", actions.get(4).getType().getName());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.PushVlan", actions.get(5).getType().getName());
+        Assert.assertEquals("Wrong action value", 4,
+                actions.get(5).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.PopVlan", actions.get(6).getType().getName());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.PushMpls", actions.get(7).getType().getName());
+        Assert.assertEquals("Wrong action value", 5,
+                actions.get(7).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.PopMpls", actions.get(8).getType().getName());
+        Assert.assertEquals("Wrong action value", 6,
+                actions.get(8).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.SetQueue", actions.get(9).getType().getName());
+        Assert.assertEquals("Wrong action value", 7,
+                actions.get(9).getAugmentation(QueueIdAction.class).getQueueId().intValue());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.Group", actions.get(10).getType().getName());
+        Assert.assertEquals("Wrong action value", 8,
+                actions.get(10).getAugmentation(GroupIdAction.class).getGroupId().intValue());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.SetNwTtl", actions.get(11).getType().getName());
+        Assert.assertEquals("Wrong action value", 9,
+                actions.get(11).getAugmentation(NwTtlAction.class).getNwTtl().intValue());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.DecNwTtl", actions.get(12).getType().getName());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.SetField", actions.get(13).getType().getName());
+        List<MatchEntries> entries = actions.get(13).getAugmentation(OxmFieldsAction.class).getMatchEntries();
+        Assert.assertEquals("Wrong number of fields", 1, entries.size());
+        Assert.assertEquals("Wrong match entry class", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow."
+                + "oxm.rev130731.OpenflowBasicClass", entries.get(0).getOxmClass().getName());
+        Assert.assertEquals("Wrong match entry field", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow."
+                + "oxm.rev130731.InPhyPort", entries.get(0).getOxmMatchField().getName());
+        Assert.assertEquals("Wrong match entry mask", false, entries.get(0).isHasMask());
+        Assert.assertEquals("Wrong match entry value", 11, 
+                entries.get(0).getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.PushPbb", actions.get(14).getType().getName());
+        Assert.assertEquals("Wrong action value", 10,
+                actions.get(14).getAugmentation(EthertypeAction.class).getEthertype().getValue().intValue());
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.PopPbb", actions.get(15).getType().getName());
+        Assert.assertTrue("Unread data in message", message.readableBytes() == 0);
+    }
+
+    /**
+     * Tests {@link AbstractActionDeserializer#deserializeHeader(ByteBuf)}
+     */
+    @Test
+    public void testDeserializeHeader() {
+        ByteBuf message = BufferHelper.buildBuffer("00 00 00 04 00 19 00 04");
+
+        message.skipBytes(4); // skip XID
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        List<Action> actions = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID,
+                message.readableBytes(), message, keyMaker, registry);
+
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.Output", actions.get(0).getType().getName());
+        Assert.assertEquals("Wrong action port", null, actions.get(0).getAugmentation(PortAction.class));
+        Assert.assertEquals("Wrong action max-length", null, actions.get(0).getAugmentation(MaxLengthAction.class));
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight."
+                + "openflow.common.action.rev130731.SetField", actions.get(1).getType().getName());
+        Assert.assertEquals("Wrong action oxm field", null, actions.get(1).getAugmentation(OxmFieldsAction.class));
+    }
+}
index 06bbf1e4ba0c9c643da18a729a184ad456ca584c..fcae5712f7867d79baeb58d56b0c465afce3bca8 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class CodeKeyMakerFactoryTest {\r
-\r
-    /**\r
-     * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testMatchEntriesKeyMaker() {\r
-        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
-        ByteBuf buffer = BufferHelper.buildBuffer("80 00 00 04 00 00 00 01");\r
-        buffer.skipBytes(4); // skip XID\r
-        MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
-        Assert.assertNotNull("Null key", codeKey);\r
-        Assert.assertEquals("Wrong key", new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
-                        32768, 0), codeKey);\r
-        Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());\r
-    }\r
-\r
-    /**\r
-     * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testExperimenterMatchEntriesKeyMaker() {\r
-        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
-        ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 04 00 00 00 01");\r
-        buffer.skipBytes(4); // skip XID\r
-        MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
-        Assert.assertNotNull("Null key", codeKey);\r
-        MatchEntryDeserializerKey comparationKey = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 65535, 0);\r
-        comparationKey.setExperimenterId(1L);\r
-        Assert.assertEquals("Wrong key", comparationKey, codeKey);\r
-        Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());\r
-    }\r
-\r
-    /**\r
-     * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testActionKeyMaker() {\r
-        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
-        ByteBuf buffer = BufferHelper.buildBuffer("00 00 00 10 00 00 00 01 00 02 00 00 00 00 00 00");\r
-        buffer.skipBytes(4); // skip XID\r
-        MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
-        Assert.assertNotNull("Null key", codeKey);\r
-        Assert.assertEquals("Wrong key", new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
-                        0, null), codeKey);\r
-        Assert.assertEquals("Buffer index modified", 16, buffer.readableBytes());\r
-    }\r
-\r
-    /**\r
-     * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testExperimenterActionKeyMaker() {\r
-        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
-        ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 08 00 00 00 01");\r
-        buffer.skipBytes(4); // skip XID\r
-        MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
-        Assert.assertNotNull("Null key", codeKey);\r
-        Assert.assertEquals("Wrong key", new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
-                        65535, 1L), codeKey);\r
-        Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());\r
-    }\r
-\r
-    /**\r
-     * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testInstructionKeyMaker() {\r
-        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
-        ByteBuf buffer = BufferHelper.buildBuffer("00 00 00 08");\r
-        buffer.skipBytes(4); // skip XID\r
-        MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
-        Assert.assertNotNull("Null key", codeKey);\r
-        Assert.assertEquals("Wrong key", new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
-                        0, null), codeKey);\r
-        Assert.assertEquals("Buffer index modified", 4, buffer.readableBytes());\r
-    }\r
-\r
-    /**\r
-     * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testExperimenterInstructionKeyMaker() {\r
-        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null key maker", keyMaker);\r
-\r
-        ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 08 00 00 00 01");\r
-        buffer.skipBytes(4); // skip XID\r
-        MessageCodeKey codeKey = keyMaker.make(buffer);\r
-\r
-        Assert.assertNotNull("Null key", codeKey);\r
-        Assert.assertEquals("Wrong key", new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
-                        65535, 1L), codeKey);\r
-        Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class CodeKeyMakerFactoryTest {
+
+    /**
+     * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+     */
+    @Test
+    public void testMatchEntriesKeyMaker() {
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null key maker", keyMaker);
+
+        ByteBuf buffer = BufferHelper.buildBuffer("80 00 00 04 00 00 00 01");
+        buffer.skipBytes(4); // skip XID
+        MessageCodeKey codeKey = keyMaker.make(buffer);
+
+        Assert.assertNotNull("Null key", codeKey);
+        Assert.assertEquals("Wrong key", new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+                        32768, 0), codeKey);
+        Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());
+    }
+
+    /**
+     * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+     */
+    @Test
+    public void testExperimenterMatchEntriesKeyMaker() {
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null key maker", keyMaker);
+
+        ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 04 00 00 00 01");
+        buffer.skipBytes(4); // skip XID
+        MessageCodeKey codeKey = keyMaker.make(buffer);
+
+        Assert.assertNotNull("Null key", codeKey);
+        MatchEntryDeserializerKey comparationKey = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 65535, 0);
+        comparationKey.setExperimenterId(1L);
+        Assert.assertEquals("Wrong key", comparationKey, codeKey);
+        Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());
+    }
+
+    /**
+     * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}
+     */
+    @Test
+    public void testActionKeyMaker() {
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null key maker", keyMaker);
+
+        ByteBuf buffer = BufferHelper.buildBuffer("00 00 00 10 00 00 00 01 00 02 00 00 00 00 00 00");
+        buffer.skipBytes(4); // skip XID
+        MessageCodeKey codeKey = keyMaker.make(buffer);
+
+        Assert.assertNotNull("Null key", codeKey);
+        Assert.assertEquals("Wrong key", new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+                        0, null), codeKey);
+        Assert.assertEquals("Buffer index modified", 16, buffer.readableBytes());
+    }
+
+    /**
+     * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}
+     */
+    @Test
+    public void testExperimenterActionKeyMaker() {
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null key maker", keyMaker);
+
+        ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 08 00 00 00 01");
+        buffer.skipBytes(4); // skip XID
+        MessageCodeKey codeKey = keyMaker.make(buffer);
+
+        Assert.assertNotNull("Null key", codeKey);
+        Assert.assertEquals("Wrong key", new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+                        65535, 1L), codeKey);
+        Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());
+    }
+
+    /**
+     * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}
+     */
+    @Test
+    public void testInstructionKeyMaker() {
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null key maker", keyMaker);
+
+        ByteBuf buffer = BufferHelper.buildBuffer("00 00 00 08");
+        buffer.skipBytes(4); // skip XID
+        MessageCodeKey codeKey = keyMaker.make(buffer);
+
+        Assert.assertNotNull("Null key", codeKey);
+        Assert.assertEquals("Wrong key", new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+                        0, null), codeKey);
+        Assert.assertEquals("Buffer index modified", 4, buffer.readableBytes());
+    }
+
+    /**
+     * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}
+     */
+    @Test
+    public void testExperimenterInstructionKeyMaker() {
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null key maker", keyMaker);
+
+        ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 08 00 00 00 01");
+        buffer.skipBytes(4); // skip XID
+        MessageCodeKey codeKey = keyMaker.make(buffer);
+
+        Assert.assertNotNull("Null key", codeKey);
+        Assert.assertEquals("Wrong key", new InstructionDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+                        65535, 1L), codeKey);
+        Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());
+    }
 }
\ No newline at end of file
index 112437b58c3cb3e5e6c76b812aaec8228850452d..adb6941ee89c9ae389d26607c8c4927c22634635 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class InstructionsDeserializerTest {\r
-\r
-\r
-    private DeserializerRegistry registry;\r
-\r
-    /**\r
-     * Initializes deserializer registry and lookups correct deserializer\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new DeserializerRegistryImpl();\r
-        registry.init();\r
-    }\r
-\r
-    /**\r
-     * Testing instructions translation\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ByteBuf message = BufferHelper.buildBuffer("00 01 00 08 0A 00 00 00 00 02 00 18 00 00 00 00 "\r
-                + "00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 30 00 05 00 08 00 00 00 00 00 06 00 08 "\r
-                + "00 01 02 03 00 03 00 20 00 00 00 00 00 00 00 10 00 00 00 25 00 35 00 00 00 00 00 00 "\r
-                + "00 16 00 08 00 00 00 50 00 04 00 18 00 00 00 00 00 15 00 08 00 00 00 25 00 0F 00 08 05 00 00 00");\r
-        \r
-        message.skipBytes(4); // skip XID\r
-        \r
-        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        List<Instruction> instructions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,\r
-                message.readableBytes(), message, keyMaker, registry);\r
-        Instruction i1 = instructions.get(0);\r
-        Assert.assertEquals("Wrong type - i1", "org.opendaylight.yang.gen.v1.urn."\r
-                + "opendaylight.openflow.common.instruction.rev130731.GotoTable", i1.getType().getName());\r
-        Assert.assertEquals("Wrong table-id - i1", 10, i1.getAugmentation(TableIdInstruction.class).getTableId().intValue());\r
-        Instruction i2 = instructions.get(1);\r
-        Assert.assertEquals("Wrong type - i2", "org.opendaylight.yang.gen.v1.urn."\r
-                + "opendaylight.openflow.common.instruction.rev130731.WriteMetadata", i2.getType().getName());\r
-        Assert.assertArrayEquals("Wrong metadata - i2", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 20"),\r
-                i2.getAugmentation(MetadataInstruction.class).getMetadata());\r
-        Assert.assertArrayEquals("Wrong metadata-mask - i2", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 30"),\r
-                i2.getAugmentation(MetadataInstruction.class).getMetadataMask());\r
-        Instruction i3 = instructions.get(2);\r
-        Assert.assertEquals("Wrong type - i3", "org.opendaylight.yang.gen.v1.urn."\r
-                + "opendaylight.openflow.common.instruction.rev130731.ClearActions", i3.getType().getName());\r
-        Assert.assertEquals("Wrong instructions - i3", 0, i3.getAugmentation(ActionsInstruction.class).getAction().size());\r
-        Instruction i4 = instructions.get(3);\r
-        Assert.assertEquals("Wrong type - i4", "org.opendaylight.yang.gen.v1.urn."\r
-                + "opendaylight.openflow.common.instruction.rev130731.Meter", i4.getType().getName());\r
-        Assert.assertEquals("Wrong meterId - i4", 66051, i4.getAugmentation(MeterIdInstruction.class).getMeterId().intValue());\r
-        Instruction i5 = instructions.get(4);\r
-        Assert.assertEquals("Wrong type - i5", "org.opendaylight.yang.gen.v1.urn."\r
-                + "opendaylight.openflow.common.instruction.rev130731.WriteActions", i5.getType().getName());\r
-        Assert.assertEquals("Wrong instructions - i5", 2, i5.getAugmentation(ActionsInstruction.class).getAction().size());\r
-        Action action1 = i5.getAugmentation(ActionsInstruction.class).getAction().get(0);\r
-        Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output",\r
-                action1.getType().getName());\r
-        Assert.assertEquals("Wrong action", 37, action1.getAugmentation(PortAction.class).getPort().getValue().intValue());\r
-        Assert.assertEquals("Wrong action", 53, action1.getAugmentation(MaxLengthAction.class).getMaxLength().intValue());\r
-        Action action2 = i5.getAugmentation(ActionsInstruction.class).getAction().get(1);\r
-        Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group",\r
-                action2.getType().getName());\r
-        Assert.assertEquals("Wrong action", 80, action2.getAugmentation(GroupIdAction.class).getGroupId().intValue());\r
-        Instruction i6 = instructions.get(5);\r
-        Assert.assertEquals("Wrong type - i6", "org.opendaylight.yang.gen.v1.urn."\r
-                + "opendaylight.openflow.common.instruction.rev130731.ApplyActions", i6.getType().getName());\r
-        Assert.assertEquals("Wrong instructions - i6", 2, i6.getAugmentation(ActionsInstruction.class).getAction().size());\r
-        action1 = i6.getAugmentation(ActionsInstruction.class).getAction().get(0);\r
-        Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue",\r
-                action1.getType().getName());\r
-        Assert.assertEquals("Wrong action", 37, action1.getAugmentation(QueueIdAction.class).getQueueId().intValue());\r
-        action2 = i6.getAugmentation(ActionsInstruction.class).getAction().get(1);\r
-        Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl",\r
-                action2.getType().getName());\r
-        Assert.assertEquals("Wrong action", 5, action2.getAugmentation(MplsTtlAction.class).getMplsTtl().intValue());\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class InstructionsDeserializerTest {
+
+
+    private DeserializerRegistry registry;
+
+    /**
+     * Initializes deserializer registry and lookups correct deserializer
+     */
+    @Before
+    public void startUp() {
+        registry = new DeserializerRegistryImpl();
+        registry.init();
+    }
+
+    /**
+     * Testing instructions translation
+     */
+    @Test
+    public void test() {
+        ByteBuf message = BufferHelper.buildBuffer("00 01 00 08 0A 00 00 00 00 02 00 18 00 00 00 00 "
+                + "00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 30 00 05 00 08 00 00 00 00 00 06 00 08 "
+                + "00 01 02 03 00 03 00 20 00 00 00 00 00 00 00 10 00 00 00 25 00 35 00 00 00 00 00 00 "
+                + "00 16 00 08 00 00 00 50 00 04 00 18 00 00 00 00 00 15 00 08 00 00 00 25 00 0F 00 08 05 00 00 00");
+        
+        message.skipBytes(4); // skip XID
+        
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        List<Instruction> instructions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,
+                message.readableBytes(), message, keyMaker, registry);
+        Instruction i1 = instructions.get(0);
+        Assert.assertEquals("Wrong type - i1", "org.opendaylight.yang.gen.v1.urn."
+                + "opendaylight.openflow.common.instruction.rev130731.GotoTable", i1.getType().getName());
+        Assert.assertEquals("Wrong table-id - i1", 10, i1.getAugmentation(TableIdInstruction.class).getTableId().intValue());
+        Instruction i2 = instructions.get(1);
+        Assert.assertEquals("Wrong type - i2", "org.opendaylight.yang.gen.v1.urn."
+                + "opendaylight.openflow.common.instruction.rev130731.WriteMetadata", i2.getType().getName());
+        Assert.assertArrayEquals("Wrong metadata - i2", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 20"),
+                i2.getAugmentation(MetadataInstruction.class).getMetadata());
+        Assert.assertArrayEquals("Wrong metadata-mask - i2", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 30"),
+                i2.getAugmentation(MetadataInstruction.class).getMetadataMask());
+        Instruction i3 = instructions.get(2);
+        Assert.assertEquals("Wrong type - i3", "org.opendaylight.yang.gen.v1.urn."
+                + "opendaylight.openflow.common.instruction.rev130731.ClearActions", i3.getType().getName());
+        Assert.assertEquals("Wrong instructions - i3", 0, i3.getAugmentation(ActionsInstruction.class).getAction().size());
+        Instruction i4 = instructions.get(3);
+        Assert.assertEquals("Wrong type - i4", "org.opendaylight.yang.gen.v1.urn."
+                + "opendaylight.openflow.common.instruction.rev130731.Meter", i4.getType().getName());
+        Assert.assertEquals("Wrong meterId - i4", 66051, i4.getAugmentation(MeterIdInstruction.class).getMeterId().intValue());
+        Instruction i5 = instructions.get(4);
+        Assert.assertEquals("Wrong type - i5", "org.opendaylight.yang.gen.v1.urn."
+                + "opendaylight.openflow.common.instruction.rev130731.WriteActions", i5.getType().getName());
+        Assert.assertEquals("Wrong instructions - i5", 2, i5.getAugmentation(ActionsInstruction.class).getAction().size());
+        Action action1 = i5.getAugmentation(ActionsInstruction.class).getAction().get(0);
+        Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output",
+                action1.getType().getName());
+        Assert.assertEquals("Wrong action", 37, action1.getAugmentation(PortAction.class).getPort().getValue().intValue());
+        Assert.assertEquals("Wrong action", 53, action1.getAugmentation(MaxLengthAction.class).getMaxLength().intValue());
+        Action action2 = i5.getAugmentation(ActionsInstruction.class).getAction().get(1);
+        Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group",
+                action2.getType().getName());
+        Assert.assertEquals("Wrong action", 80, action2.getAugmentation(GroupIdAction.class).getGroupId().intValue());
+        Instruction i6 = instructions.get(5);
+        Assert.assertEquals("Wrong type - i6", "org.opendaylight.yang.gen.v1.urn."
+                + "opendaylight.openflow.common.instruction.rev130731.ApplyActions", i6.getType().getName());
+        Assert.assertEquals("Wrong instructions - i6", 2, i6.getAugmentation(ActionsInstruction.class).getAction().size());
+        action1 = i6.getAugmentation(ActionsInstruction.class).getAction().get(0);
+        Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue",
+                action1.getType().getName());
+        Assert.assertEquals("Wrong action", 37, action1.getAugmentation(QueueIdAction.class).getQueueId().intValue());
+        action2 = i6.getAugmentation(ActionsInstruction.class).getAction().get(1);
+        Assert.assertEquals("Wrong action", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl",
+                action2.getType().getName());
+        Assert.assertEquals("Wrong action", 5, action2.getAugmentation(MplsTtlAction.class).getMplsTtl().intValue());
+    }
+
+}
index 446533a9570b5924da61fe97aee994fd4729a502..fb622cd858666db9f404e6cf4bf8be9735e6ffc6 100644 (file)
@@ -1,58 +1,58 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import java.util.List;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Mock;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class ListDeserializerTest {\r
-\r
-    @Mock CodeKeyMaker keyMaker;\r
-    @Mock DeserializerRegistry registry;\r
-\r
-    /**\r
-     * Tests {@link ListDeserializer#deserializeList(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        List<DataObject> list = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,\r
-                42, buffer, keyMaker, registry);\r
-\r
-        Assert.assertNull("List is not null", list);\r
-    }\r
-\r
-    /**\r
-     * Tests {@link ListDeserializer#deserializeHeaders(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}\r
-     */\r
-    @Test\r
-    public void test2() {\r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        List<DataObject> list = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID,\r
-                42, buffer, keyMaker, registry);\r
-\r
-        Assert.assertNull("List is not null", list);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import java.util.List;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ListDeserializerTest {
+
+    @Mock CodeKeyMaker keyMaker;
+    @Mock DeserializerRegistry registry;
+
+    /**
+     * Tests {@link ListDeserializer#deserializeList(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}
+     */
+    @Test
+    public void test() {
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        List<DataObject> list = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,
+                42, buffer, keyMaker, registry);
+
+        Assert.assertNull("List is not null", list);
+    }
+
+    /**
+     * Tests {@link ListDeserializer#deserializeHeaders(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}
+     */
+    @Test
+    public void test2() {
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        List<DataObject> list = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID,
+                42, buffer, keyMaker, registry);
+
+        Assert.assertNull("List is not null", list);
+    }
 }
\ No newline at end of file
index f314a3ae722ec3d60c8bcff0f726ac22aff25f36..15c367ad35b0d0c8f1fbbdbdf433799a9f5df0b8 100644 (file)
@@ -1,45 +1,45 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.PooledByteBufAllocator;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Mock;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class ListSerializerTest {\r
-\r
-    @Mock TypeKeyMaker<Action> keyMaker;\r
-    @Mock SerializerRegistry registry;\r
-\r
-    /**\r
-     * Tests {@link ListSerializer#serializeHeaderList(List, TypeKeyMaker, SerializerRegistry, ByteBuf)}\r
-     * with null List\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();\r
-        ListSerializer.serializeHeaderList(null, keyMaker, registry, buffer);\r
-\r
-        Assert.assertEquals("Data written to buffer", 0, buffer.readableBytes());\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.PooledByteBufAllocator;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ListSerializerTest {
+
+    @Mock TypeKeyMaker<Action> keyMaker;
+    @Mock SerializerRegistry registry;
+
+    /**
+     * Tests {@link ListSerializer#serializeHeaderList(List, TypeKeyMaker, SerializerRegistry, ByteBuf)}
+     * with null List
+     */
+    @Test
+    public void test() {
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+        ListSerializer.serializeHeaderList(null, keyMaker, registry, buffer);
+
+        Assert.assertEquals("Data written to buffer", 0, buffer.readableBytes());
+    }
 }
\ No newline at end of file
index 36d9a9ce8be68c37aff873a00122bbdc7382a13b..a3ad2abbdbfa02d807c65fa91f58260e7a1b87db 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.StandardMatchType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.Match;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class MatchDeserializerTest {\r
-\r
-    private OFDeserializer<Match> matchDeserializer;\r
-    private DeserializerRegistry registry;\r
-\r
-    /**\r
-     * Initializes deserializer registry and lookups correct deserializer\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new DeserializerRegistryImpl();\r
-        registry.init();\r
-        matchDeserializer = registry.getDeserializer(\r
-                new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,\r
-                        EncodeConstants.EMPTY_VALUE, Match.class));\r
-    }\r
-\r
-    /**\r
-     * Testing Ipv4 address deserialization\r
-     */\r
-    @Test\r
-    public void testIpv4Address() {\r
-        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 18 04 00 01 02 03");\r
-\r
-        MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
-                0x8000, 12);\r
-        key.setExperimenterId(null);\r
-        OFDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);\r
-        MatchEntries entry = entryDeserializer.deserialize(buffer);\r
-        Assert.assertEquals("Wrong Ipv4 address format", new Ipv4Address("0.1.2.3"),\r
-                entry.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
-    }\r
-    \r
-    /**\r
-     * Testing Ipv6 address deserialization\r
-     */\r
-    @Test\r
-    public void testIpv6Address() {\r
-        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 34 10 00 00 00 01 00 02 00 03 00 04 00 05 00 06 0F 07");\r
-        \r
-        MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
-                0x8000, 26);\r
-        key.setExperimenterId(null);\r
-        OFDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);\r
-        MatchEntries entry = entryDeserializer.deserialize(buffer);\r
-        Assert.assertEquals("Wrong Ipv6 address format", new Ipv6Address("0000:0001:0002:0003:0004:0005:0006:0F07"),\r
-                entry.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
-    }\r
-    \r
-    /**\r
-     * Testing match deserialization\r
-     */\r
-    @Test\r
-    public void testMatch() {\r
-        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 01 AC "\r
-                + "80 00 00 04 00 00 00 01 "\r
-                + "80 00 02 04 00 00 00 02 "\r
-                + "80 00 05 10 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 04 "\r
-                + "80 00 07 0C 00 00 00 00 00 05 00 00 00 00 00 06 "\r
-                + "80 00 09 0C 00 00 00 00 00 07 00 00 00 00 00 08 "\r
-                + "80 00 0A 02 00 09 "\r
-                + "80 00 0D 04 00 0A 00 0B "\r
-                + "80 00 0E 01 0C "\r
-                + "80 00 10 01 0D "\r
-                + "80 00 12 01 0E "\r
-                + "80 00 14 01 0F "\r
-                + "80 00 17 08 0A 00 00 01 00 00 FF 00 "\r
-                + "80 00 19 08 0A 00 00 02 00 00 00 FF "\r
-                + "80 00 1A 02 00 03 "\r
-                + "80 00 1C 02 00 04 "\r
-                + "80 00 1E 02 00 05 "\r
-                + "80 00 20 02 00 06 "\r
-                + "80 00 22 02 00 07 "\r
-                + "80 00 24 02 00 08 "\r
-                + "80 00 26 01 05 "\r
-                + "80 00 28 01 07 "\r
-                + "80 00 2A 02 00 10 "\r
-                + "80 00 2D 08 0A 00 00 09 00 00 FF 00 "\r
-                + "80 00 2F 08 0A 00 00 0A 00 00 00 FF "\r
-                + "80 00 31 0C 00 00 00 00 00 01 00 00 00 00 00 03 "\r
-                + "80 00 33 0C 00 00 00 00 00 02 00 00 00 00 00 04 "\r
-                + "80 00 35 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 "\r
-                +             "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 "\r
-                + "80 00 37 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 "\r
-                +             "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 "\r
-                + "80 00 39 08 00 00 00 02 00 00 00 03 "\r
-                + "80 00 3A 01 15 "\r
-                + "80 00 3C 01 17 "\r
-                + "80 00 3E 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 " //ipv6ndtarget\r
-                + "80 00 40 06 00 05 00 00 00 01 "\r
-                + "80 00 42 06 00 05 00 00 00 02 "\r
-                + "80 00 44 04 00 00 02 03 "\r
-                + "80 00 46 01 03 "\r
-                + "80 00 48 01 01 "\r
-                + "80 00 4B 06 00 00 02 00 00 01 "\r
-                + "80 00 4D 10 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 FF "\r
-                + "80 00 4F 04 00 00 03 04 "\r
-                + "00 00 00 00");\r
-\r
-        Match match = matchDeserializer.deserialize(buffer);\r
-        Assert.assertEquals("Wrong match type", OxmMatchType.class, match.getType());\r
-        Assert.assertEquals("Wrong match entries size", 40, match.getMatchEntries().size());\r
-        List<MatchEntries> entries = match.getMatchEntries();\r
-        MatchEntries entry0 = entries.get(0);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry0.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", InPort.class, entry0.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry0.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 1,\r
-                entry0.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());\r
-        MatchEntries entry1 = entries.get(1);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry1.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", InPhyPort.class, entry1.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry1.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 2,\r
-                entry1.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());\r
-        MatchEntries entry2 = entries.get(2);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry2.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Metadata.class, entry2.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry2.isHasMask());\r
-        Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 03"), \r
-                entry2.getAugmentation(MetadataMatchEntry.class).getMetadata());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 04"), \r
-                entry2.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry3 = entries.get(3);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry3.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", EthDst.class, entry3.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry3.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:05"), \r
-                entry3.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 06"), \r
-                entry3.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry4 = entries.get(4);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry4.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", EthSrc.class, entry4.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry4.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:07"), \r
-                entry4.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 08"), \r
-                entry4.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry5 = entries.get(5);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry5.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", EthType.class, entry5.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry5.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 9,\r
-                entry5.getAugmentation(EthTypeMatchEntry.class).getEthType().getValue().intValue());\r
-        MatchEntries entry6 = entries.get(6);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry6.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", VlanVid.class, entry6.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry6.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 10,\r
-                entry6.getAugmentation(VlanVidMatchEntry.class).getVlanVid().intValue());\r
-        Assert.assertEquals("Wrong entry value", false, \r
-                entry6.getAugmentation(VlanVidMatchEntry.class).isCfiBit());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 0B"), \r
-                entry6.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry7 = entries.get(7);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry7.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", VlanPcp.class, entry7.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry7.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 12,\r
-                entry7.getAugmentation(VlanPcpMatchEntry.class).getVlanPcp().intValue());\r
-        MatchEntries entry8 = entries.get(8);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry8.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", IpDscp.class, entry8.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry8.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 13,\r
-                entry8.getAugmentation(DscpMatchEntry.class).getDscp().getValue().intValue());\r
-        MatchEntries entry9 = entries.get(9);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry9.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", IpEcn.class, entry9.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry9.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 14,\r
-                entry9.getAugmentation(EcnMatchEntry.class).getEcn().intValue());\r
-        MatchEntries entry10 = entries.get(10);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry10.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", IpProto.class, entry10.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry10.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 15,\r
-                entry10.getAugmentation(ProtocolNumberMatchEntry.class).getProtocolNumber().intValue());\r
-        MatchEntries entry11 = entries.get(11);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry11.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv4Src.class, entry11.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry11.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.1"),\r
-                entry11.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"), \r
-                entry11.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry12 = entries.get(12);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry12.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv4Dst.class, entry12.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry12.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.2"),\r
-                entry12.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"), \r
-                entry12.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry13 = entries.get(13);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry13.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", TcpSrc.class, entry13.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry13.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 3,\r
-                entry13.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
-        MatchEntries entry14 = entries.get(14);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry14.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", TcpDst.class, entry14.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry14.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 4,\r
-                entry14.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
-        MatchEntries entry15 = entries.get(15);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry15.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", UdpSrc.class, entry15.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry15.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 5,\r
-                entry15.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
-        MatchEntries entry16 = entries.get(16);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry16.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", UdpDst.class, entry16.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry16.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 6,\r
-                entry16.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
-        MatchEntries entry17 = entries.get(17);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry17.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", SctpSrc.class, entry17.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry17.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 7,\r
-                entry17.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
-        MatchEntries entry18 = entries.get(18);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry18.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", SctpDst.class, entry18.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry18.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 8,\r
-                entry18.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
-        MatchEntries entry19 = entries.get(19);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry19.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Icmpv4Type.class, entry19.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry19.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 5,\r
-                entry19.getAugmentation(Icmpv4TypeMatchEntry.class).getIcmpv4Type().intValue());\r
-        MatchEntries entry20 = entries.get(20);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry20.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Icmpv4Code.class, entry20.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry20.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 7,\r
-                entry20.getAugmentation(Icmpv4CodeMatchEntry.class).getIcmpv4Code().intValue());\r
-        MatchEntries entry21 = entries.get(21);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry21.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", ArpOp.class, entry21.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry21.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 16,\r
-                entry21.getAugmentation(OpCodeMatchEntry.class).getOpCode().intValue());\r
-        MatchEntries entry22 = entries.get(22);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry22.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", ArpSpa.class, entry22.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry22.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.9"),\r
-                entry22.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"), \r
-                entry22.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry23 = entries.get(23);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry23.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", ArpTpa.class, entry23.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry23.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.10"),\r
-                entry23.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"), \r
-                entry23.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry24 = entries.get(24);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry24.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", ArpSha.class, entry24.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry24.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:01"), \r
-                entry24.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 03"), \r
-                entry24.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry25 = entries.get(25);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry25.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", ArpTha.class, entry25.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry25.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:02"), \r
-                entry25.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 04"), \r
-                entry25.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry26 = entries.get(26);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry26.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv6Src.class, entry26.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry26.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0015"), \r
-                entry26.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
-        Assert.assertArrayEquals("Wrong entry mask",\r
-                ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16"), \r
-                entry26.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry27 = entries.get(27);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry27.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv6Dst.class, entry27.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry27.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0017"), \r
-                entry27.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
-        Assert.assertArrayEquals("Wrong entry mask",\r
-                ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18"), \r
-                entry27.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry28 = entries.get(28);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry28.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv6Flabel.class, entry28.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry28.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 2, \r
-                entry28.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 03"),\r
-                entry28.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry29 = entries.get(29);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry29.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Icmpv6Type.class, entry29.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry29.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 21, \r
-                entry29.getAugmentation(Icmpv6TypeMatchEntry.class).getIcmpv6Type().intValue());\r
-        MatchEntries entry30 = entries.get(30);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry30.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Icmpv6Code.class, entry30.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry30.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 23, \r
-                entry30.getAugmentation(Icmpv6CodeMatchEntry.class).getIcmpv6Code().intValue());\r
-        MatchEntries entry31 = entries.get(31);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry31.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv6NdTarget.class, entry31.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry31.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0020"), \r
-                entry31.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
-        MatchEntries entry32 = entries.get(32);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry32.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv6NdSll.class, entry32.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry32.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:01"), \r
-                entry32.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
-        MatchEntries entry33 = entries.get(33);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry33.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv6NdTll.class, entry33.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry33.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:02"),\r
-                entry33.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
-        MatchEntries entry34 = entries.get(34);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry34.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", MplsLabel.class, entry34.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry34.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 515,\r
-                entry34.getAugmentation(MplsLabelMatchEntry.class).getMplsLabel().intValue());\r
-        MatchEntries entry35 = entries.get(35);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry35.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", MplsTc.class, entry35.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry35.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 3,\r
-                entry35.getAugmentation(TcMatchEntry.class).getTc().intValue());\r
-        MatchEntries entry36 = entries.get(36);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry36.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", MplsBos.class, entry36.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry36.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", true,\r
-                entry36.getAugmentation(BosMatchEntry.class).isBos());\r
-        MatchEntries entry37 = entries.get(37);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry37.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", PbbIsid.class, entry37.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry37.isHasMask());\r
-        Assert.assertEquals("Wrong entry value", 2,\r
-                entry37.getAugmentation(IsidMatchEntry.class).getIsid().intValue());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 01"),\r
-                entry37.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry38 = entries.get(38);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry38.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", TunnelId.class, entry38.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry38.isHasMask());\r
-        Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 07"),\r
-                entry38.getAugmentation(MetadataMatchEntry.class).getMetadata());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 FF"),\r
-                entry38.getAugmentation(MaskMatchEntry.class).getMask());\r
-        MatchEntries entry39 = entries.get(39);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry39.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry39.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", true, entry39.isHasMask());\r
-        Assert.assertEquals("Wrong entry value",\r
-                new Ipv6ExthdrFlags(false, false, false, false, false, false, false, false, false),\r
-                entry39.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField());\r
-        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("03 04"),\r
-                entry39.getAugmentation(MaskMatchEntry.class).getMask());\r
-        Assert.assertTrue("Unread data", buffer.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Testing header deserialization\r
-     */\r
-    @Test\r
-    public void testHeaders() {\r
-        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 18 04 00 01 02 03");\r
-\r
-        MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,\r
-                0x8000, 12);\r
-        key.setExperimenterId(null);\r
-        HeaderDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);\r
-        MatchEntries entry = entryDeserializer.deserializeHeader(buffer);\r
-        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());\r
-        Assert.assertEquals("Wrong entry field", Ipv4Dst.class, entry.getOxmMatchField());\r
-        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());\r
-        Assert.assertEquals("Wrong Ipv4 address", null, entry.getAugmentation(Ipv4AddressMatchEntry.class));\r
-    }\r
-\r
-    /**\r
-     * Testing standard match type\r
-     */\r
-    @Test\r
-    public void testStandardMatch() {\r
-        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 00 00 10 80 00 04 08 00 00 00 00 00 00 00 01");\r
-\r
-        Match match = matchDeserializer.deserialize(buffer);\r
-\r
-        Assert.assertEquals("Wrong match type", StandardMatchType.class, match.getType());\r
-        Assert.assertEquals("Wrong match entries size", 1, match.getMatchEntries().size());\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.StandardMatchType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class MatchDeserializerTest {
+
+    private OFDeserializer<Match> matchDeserializer;
+    private DeserializerRegistry registry;
+
+    /**
+     * Initializes deserializer registry and lookups correct deserializer
+     */
+    @Before
+    public void startUp() {
+        registry = new DeserializerRegistryImpl();
+        registry.init();
+        matchDeserializer = registry.getDeserializer(
+                new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,
+                        EncodeConstants.EMPTY_VALUE, Match.class));
+    }
+
+    /**
+     * Testing Ipv4 address deserialization
+     */
+    @Test
+    public void testIpv4Address() {
+        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 18 04 00 01 02 03");
+
+        MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+                0x8000, 12);
+        key.setExperimenterId(null);
+        OFDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);
+        MatchEntries entry = entryDeserializer.deserialize(buffer);
+        Assert.assertEquals("Wrong Ipv4 address format", new Ipv4Address("0.1.2.3"),
+                entry.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());
+    }
+    
+    /**
+     * Testing Ipv6 address deserialization
+     */
+    @Test
+    public void testIpv6Address() {
+        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 34 10 00 00 00 01 00 02 00 03 00 04 00 05 00 06 0F 07");
+        
+        MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+                0x8000, 26);
+        key.setExperimenterId(null);
+        OFDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);
+        MatchEntries entry = entryDeserializer.deserialize(buffer);
+        Assert.assertEquals("Wrong Ipv6 address format", new Ipv6Address("0000:0001:0002:0003:0004:0005:0006:0F07"),
+                entry.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());
+    }
+    
+    /**
+     * Testing match deserialization
+     */
+    @Test
+    public void testMatch() {
+        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 01 AC "
+                + "80 00 00 04 00 00 00 01 "
+                + "80 00 02 04 00 00 00 02 "
+                + "80 00 05 10 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 04 "
+                + "80 00 07 0C 00 00 00 00 00 05 00 00 00 00 00 06 "
+                + "80 00 09 0C 00 00 00 00 00 07 00 00 00 00 00 08 "
+                + "80 00 0A 02 00 09 "
+                + "80 00 0D 04 00 0A 00 0B "
+                + "80 00 0E 01 0C "
+                + "80 00 10 01 0D "
+                + "80 00 12 01 0E "
+                + "80 00 14 01 0F "
+                + "80 00 17 08 0A 00 00 01 00 00 FF 00 "
+                + "80 00 19 08 0A 00 00 02 00 00 00 FF "
+                + "80 00 1A 02 00 03 "
+                + "80 00 1C 02 00 04 "
+                + "80 00 1E 02 00 05 "
+                + "80 00 20 02 00 06 "
+                + "80 00 22 02 00 07 "
+                + "80 00 24 02 00 08 "
+                + "80 00 26 01 05 "
+                + "80 00 28 01 07 "
+                + "80 00 2A 02 00 10 "
+                + "80 00 2D 08 0A 00 00 09 00 00 FF 00 "
+                + "80 00 2F 08 0A 00 00 0A 00 00 00 FF "
+                + "80 00 31 0C 00 00 00 00 00 01 00 00 00 00 00 03 "
+                + "80 00 33 0C 00 00 00 00 00 02 00 00 00 00 00 04 "
+                + "80 00 35 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 "
+                +             "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 "
+                + "80 00 37 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 "
+                +             "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 "
+                + "80 00 39 08 00 00 00 02 00 00 00 03 "
+                + "80 00 3A 01 15 "
+                + "80 00 3C 01 17 "
+                + "80 00 3E 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 " //ipv6ndtarget
+                + "80 00 40 06 00 05 00 00 00 01 "
+                + "80 00 42 06 00 05 00 00 00 02 "
+                + "80 00 44 04 00 00 02 03 "
+                + "80 00 46 01 03 "
+                + "80 00 48 01 01 "
+                + "80 00 4B 06 00 00 02 00 00 01 "
+                + "80 00 4D 10 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 FF "
+                + "80 00 4F 04 00 00 03 04 "
+                + "00 00 00 00");
+
+        Match match = matchDeserializer.deserialize(buffer);
+        Assert.assertEquals("Wrong match type", OxmMatchType.class, match.getType());
+        Assert.assertEquals("Wrong match entries size", 40, match.getMatchEntries().size());
+        List<MatchEntries> entries = match.getMatchEntries();
+        MatchEntries entry0 = entries.get(0);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry0.getOxmClass());
+        Assert.assertEquals("Wrong entry field", InPort.class, entry0.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry0.isHasMask());
+        Assert.assertEquals("Wrong entry value", 1,
+                entry0.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
+        MatchEntries entry1 = entries.get(1);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry1.getOxmClass());
+        Assert.assertEquals("Wrong entry field", InPhyPort.class, entry1.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry1.isHasMask());
+        Assert.assertEquals("Wrong entry value", 2,
+                entry1.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
+        MatchEntries entry2 = entries.get(2);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry2.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Metadata.class, entry2.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry2.isHasMask());
+        Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 03"), 
+                entry2.getAugmentation(MetadataMatchEntry.class).getMetadata());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 04"), 
+                entry2.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry3 = entries.get(3);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry3.getOxmClass());
+        Assert.assertEquals("Wrong entry field", EthDst.class, entry3.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry3.isHasMask());
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:05"), 
+                entry3.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 06"), 
+                entry3.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry4 = entries.get(4);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry4.getOxmClass());
+        Assert.assertEquals("Wrong entry field", EthSrc.class, entry4.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry4.isHasMask());
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:07"), 
+                entry4.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 08"), 
+                entry4.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry5 = entries.get(5);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry5.getOxmClass());
+        Assert.assertEquals("Wrong entry field", EthType.class, entry5.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry5.isHasMask());
+        Assert.assertEquals("Wrong entry value", 9,
+                entry5.getAugmentation(EthTypeMatchEntry.class).getEthType().getValue().intValue());
+        MatchEntries entry6 = entries.get(6);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry6.getOxmClass());
+        Assert.assertEquals("Wrong entry field", VlanVid.class, entry6.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry6.isHasMask());
+        Assert.assertEquals("Wrong entry value", 10,
+                entry6.getAugmentation(VlanVidMatchEntry.class).getVlanVid().intValue());
+        Assert.assertEquals("Wrong entry value", false, 
+                entry6.getAugmentation(VlanVidMatchEntry.class).isCfiBit());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 0B"), 
+                entry6.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry7 = entries.get(7);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry7.getOxmClass());
+        Assert.assertEquals("Wrong entry field", VlanPcp.class, entry7.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry7.isHasMask());
+        Assert.assertEquals("Wrong entry value", 12,
+                entry7.getAugmentation(VlanPcpMatchEntry.class).getVlanPcp().intValue());
+        MatchEntries entry8 = entries.get(8);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry8.getOxmClass());
+        Assert.assertEquals("Wrong entry field", IpDscp.class, entry8.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry8.isHasMask());
+        Assert.assertEquals("Wrong entry value", 13,
+                entry8.getAugmentation(DscpMatchEntry.class).getDscp().getValue().intValue());
+        MatchEntries entry9 = entries.get(9);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry9.getOxmClass());
+        Assert.assertEquals("Wrong entry field", IpEcn.class, entry9.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry9.isHasMask());
+        Assert.assertEquals("Wrong entry value", 14,
+                entry9.getAugmentation(EcnMatchEntry.class).getEcn().intValue());
+        MatchEntries entry10 = entries.get(10);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry10.getOxmClass());
+        Assert.assertEquals("Wrong entry field", IpProto.class, entry10.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry10.isHasMask());
+        Assert.assertEquals("Wrong entry value", 15,
+                entry10.getAugmentation(ProtocolNumberMatchEntry.class).getProtocolNumber().intValue());
+        MatchEntries entry11 = entries.get(11);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry11.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv4Src.class, entry11.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry11.isHasMask());
+        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.1"),
+                entry11.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"), 
+                entry11.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry12 = entries.get(12);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry12.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv4Dst.class, entry12.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry12.isHasMask());
+        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.2"),
+                entry12.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"), 
+                entry12.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry13 = entries.get(13);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry13.getOxmClass());
+        Assert.assertEquals("Wrong entry field", TcpSrc.class, entry13.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry13.isHasMask());
+        Assert.assertEquals("Wrong entry value", 3,
+                entry13.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+        MatchEntries entry14 = entries.get(14);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry14.getOxmClass());
+        Assert.assertEquals("Wrong entry field", TcpDst.class, entry14.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry14.isHasMask());
+        Assert.assertEquals("Wrong entry value", 4,
+                entry14.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+        MatchEntries entry15 = entries.get(15);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry15.getOxmClass());
+        Assert.assertEquals("Wrong entry field", UdpSrc.class, entry15.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry15.isHasMask());
+        Assert.assertEquals("Wrong entry value", 5,
+                entry15.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+        MatchEntries entry16 = entries.get(16);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry16.getOxmClass());
+        Assert.assertEquals("Wrong entry field", UdpDst.class, entry16.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry16.isHasMask());
+        Assert.assertEquals("Wrong entry value", 6,
+                entry16.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+        MatchEntries entry17 = entries.get(17);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry17.getOxmClass());
+        Assert.assertEquals("Wrong entry field", SctpSrc.class, entry17.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry17.isHasMask());
+        Assert.assertEquals("Wrong entry value", 7,
+                entry17.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+        MatchEntries entry18 = entries.get(18);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry18.getOxmClass());
+        Assert.assertEquals("Wrong entry field", SctpDst.class, entry18.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry18.isHasMask());
+        Assert.assertEquals("Wrong entry value", 8,
+                entry18.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());
+        MatchEntries entry19 = entries.get(19);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry19.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Icmpv4Type.class, entry19.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry19.isHasMask());
+        Assert.assertEquals("Wrong entry value", 5,
+                entry19.getAugmentation(Icmpv4TypeMatchEntry.class).getIcmpv4Type().intValue());
+        MatchEntries entry20 = entries.get(20);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry20.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Icmpv4Code.class, entry20.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry20.isHasMask());
+        Assert.assertEquals("Wrong entry value", 7,
+                entry20.getAugmentation(Icmpv4CodeMatchEntry.class).getIcmpv4Code().intValue());
+        MatchEntries entry21 = entries.get(21);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry21.getOxmClass());
+        Assert.assertEquals("Wrong entry field", ArpOp.class, entry21.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry21.isHasMask());
+        Assert.assertEquals("Wrong entry value", 16,
+                entry21.getAugmentation(OpCodeMatchEntry.class).getOpCode().intValue());
+        MatchEntries entry22 = entries.get(22);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry22.getOxmClass());
+        Assert.assertEquals("Wrong entry field", ArpSpa.class, entry22.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry22.isHasMask());
+        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.9"),
+                entry22.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"), 
+                entry22.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry23 = entries.get(23);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry23.getOxmClass());
+        Assert.assertEquals("Wrong entry field", ArpTpa.class, entry23.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry23.isHasMask());
+        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.10"),
+                entry23.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"), 
+                entry23.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry24 = entries.get(24);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry24.getOxmClass());
+        Assert.assertEquals("Wrong entry field", ArpSha.class, entry24.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry24.isHasMask());
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:01"), 
+                entry24.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 03"), 
+                entry24.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry25 = entries.get(25);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry25.getOxmClass());
+        Assert.assertEquals("Wrong entry field", ArpTha.class, entry25.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry25.isHasMask());
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:02"), 
+                entry25.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 04"), 
+                entry25.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry26 = entries.get(26);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry26.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv6Src.class, entry26.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry26.isHasMask());
+        Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0015"), 
+                entry26.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());
+        Assert.assertArrayEquals("Wrong entry mask",
+                ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16"), 
+                entry26.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry27 = entries.get(27);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry27.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv6Dst.class, entry27.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry27.isHasMask());
+        Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0017"), 
+                entry27.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());
+        Assert.assertArrayEquals("Wrong entry mask",
+                ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18"), 
+                entry27.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry28 = entries.get(28);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry28.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv6Flabel.class, entry28.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry28.isHasMask());
+        Assert.assertEquals("Wrong entry value", 2, 
+                entry28.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 03"),
+                entry28.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry29 = entries.get(29);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry29.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Icmpv6Type.class, entry29.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry29.isHasMask());
+        Assert.assertEquals("Wrong entry value", 21, 
+                entry29.getAugmentation(Icmpv6TypeMatchEntry.class).getIcmpv6Type().intValue());
+        MatchEntries entry30 = entries.get(30);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry30.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Icmpv6Code.class, entry30.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry30.isHasMask());
+        Assert.assertEquals("Wrong entry value", 23, 
+                entry30.getAugmentation(Icmpv6CodeMatchEntry.class).getIcmpv6Code().intValue());
+        MatchEntries entry31 = entries.get(31);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry31.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv6NdTarget.class, entry31.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry31.isHasMask());
+        Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0020"), 
+                entry31.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());
+        MatchEntries entry32 = entries.get(32);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry32.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv6NdSll.class, entry32.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry32.isHasMask());
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:01"), 
+                entry32.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+        MatchEntries entry33 = entries.get(33);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry33.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv6NdTll.class, entry33.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry33.isHasMask());
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:02"),
+                entry33.getAugmentation(MacAddressMatchEntry.class).getMacAddress());
+        MatchEntries entry34 = entries.get(34);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry34.getOxmClass());
+        Assert.assertEquals("Wrong entry field", MplsLabel.class, entry34.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry34.isHasMask());
+        Assert.assertEquals("Wrong entry value", 515,
+                entry34.getAugmentation(MplsLabelMatchEntry.class).getMplsLabel().intValue());
+        MatchEntries entry35 = entries.get(35);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry35.getOxmClass());
+        Assert.assertEquals("Wrong entry field", MplsTc.class, entry35.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry35.isHasMask());
+        Assert.assertEquals("Wrong entry value", 3,
+                entry35.getAugmentation(TcMatchEntry.class).getTc().intValue());
+        MatchEntries entry36 = entries.get(36);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry36.getOxmClass());
+        Assert.assertEquals("Wrong entry field", MplsBos.class, entry36.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry36.isHasMask());
+        Assert.assertEquals("Wrong entry value", true,
+                entry36.getAugmentation(BosMatchEntry.class).isBos());
+        MatchEntries entry37 = entries.get(37);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry37.getOxmClass());
+        Assert.assertEquals("Wrong entry field", PbbIsid.class, entry37.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry37.isHasMask());
+        Assert.assertEquals("Wrong entry value", 2,
+                entry37.getAugmentation(IsidMatchEntry.class).getIsid().intValue());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 01"),
+                entry37.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry38 = entries.get(38);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry38.getOxmClass());
+        Assert.assertEquals("Wrong entry field", TunnelId.class, entry38.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry38.isHasMask());
+        Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 07"),
+                entry38.getAugmentation(MetadataMatchEntry.class).getMetadata());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 FF"),
+                entry38.getAugmentation(MaskMatchEntry.class).getMask());
+        MatchEntries entry39 = entries.get(39);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry39.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry39.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", true, entry39.isHasMask());
+        Assert.assertEquals("Wrong entry value",
+                new Ipv6ExthdrFlags(false, false, false, false, false, false, false, false, false),
+                entry39.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField());
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("03 04"),
+                entry39.getAugmentation(MaskMatchEntry.class).getMask());
+        Assert.assertTrue("Unread data", buffer.readableBytes() == 0);
+    }
+
+    /**
+     * Testing header deserialization
+     */
+    @Test
+    public void testHeaders() {
+        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 18 04 00 01 02 03");
+
+        MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+                0x8000, 12);
+        key.setExperimenterId(null);
+        HeaderDeserializer<MatchEntries> entryDeserializer = registry.getDeserializer(key);
+        MatchEntries entry = entryDeserializer.deserializeHeader(buffer);
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
+        Assert.assertEquals("Wrong entry field", Ipv4Dst.class, entry.getOxmMatchField());
+        Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
+        Assert.assertEquals("Wrong Ipv4 address", null, entry.getAugmentation(Ipv4AddressMatchEntry.class));
+    }
+
+    /**
+     * Testing standard match type
+     */
+    @Test
+    public void testStandardMatch() {
+        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 00 00 10 80 00 04 08 00 00 00 00 00 00 00 01");
+
+        Match match = matchDeserializer.deserialize(buffer);
+
+        Assert.assertEquals("Wrong match type", StandardMatchType.class, match.getType());
+        Assert.assertEquals("Wrong match entries size", 1, match.getMatchEntries().size());
+    }
 }
\ No newline at end of file
index 100f38c0283b068fab48392e88993f1d2500f3ef..3e83bf4b6ef85651f8331af002dc8a2edf248c75 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10ActionsDeserializerTest {\r
-\r
-    private DeserializerRegistry registry;\r
-\r
-    /**\r
-     * Initializes deserializer registry and lookups correct deserializer\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new DeserializerRegistryImpl();\r
-        registry.init();\r
-    }\r
-\r
-    /**\r
-     * Testing correct deserialization of actions (OF v1.0)\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ByteBuf message = BufferHelper.buildBuffer("00 00 00 08 00 10 20 00 "\r
-                + "00 01 00 08 10 10 00 00 "\r
-                + "00 02 00 08 25 00 00 00 "\r
-                + "00 03 00 08 00 00 00 00 "\r
-                + "00 04 00 10 01 02 03 04 05 06 00 00 00 00 00 00 "\r
-                + "00 05 00 10 02 03 04 05 06 07 00 00 00 00 00 00 "\r
-                + "00 06 00 08 0A 00 00 01 "\r
-                + "00 07 00 08 0B 00 00 02 "\r
-                + "00 08 00 08 01 00 00 00 "\r
-                + "00 09 00 08 00 02 00 00 "\r
-                + "00 0A 00 08 00 03 00 00 "\r
-                + "00 0B 00 10 00 04 00 00 00 00 00 00 00 00 00 30");\r
-        \r
-        message.skipBytes(4); // skip XID\r
-        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF10_VERSION_ID);\r
-        List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF10_VERSION_ID,\r
-                message.readableBytes(), message, keyMaker, registry);\r
-        Assert.assertEquals("Wrong number of actions", 12, actions.size());\r
-        Action action1 = actions.get(0);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.Output", action1.getType().getName());\r
-        Assert.assertEquals("Wrong port", 16,\r
-                action1.getAugmentation(PortAction.class).getPort().getValue().intValue());\r
-        Assert.assertEquals("Wrong max-length", 8192,\r
-                action1.getAugmentation(MaxLengthAction.class).getMaxLength().intValue());\r
-        Action action2 = actions.get(1);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.SetVlanVid", action2.getType().getName());\r
-        Assert.assertEquals("Wrong vlan-vid", 4112,\r
-                action2.getAugmentation(VlanVidAction.class).getVlanVid().intValue());\r
-        Action action3 = actions.get(2);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.SetVlanPcp", action3.getType().getName());\r
-        Assert.assertEquals("Wrong vlan-pcp", 37,\r
-                action3.getAugmentation(VlanPcpAction.class).getVlanPcp().intValue());\r
-        Action action4 = actions.get(3);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.StripVlan", action4.getType().getName());\r
-        Action action5 = actions.get(4);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.SetDlSrc", action5.getType().getName());\r
-        Assert.assertArrayEquals("Wrong dl-src", ByteBufUtils.macAddressToBytes("01:02:03:04:05:06"),\r
-                ByteBufUtils.macAddressToBytes(action5.getAugmentation(DlAddressAction.class).getDlAddress().getValue()));\r
-        Action action6 = actions.get(5);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.SetDlDst", action6.getType().getName());\r
-        Assert.assertArrayEquals("Wrong dl-dst", ByteBufUtils.macAddressToBytes("02:03:04:05:06:07"), \r
-                ByteBufUtils.macAddressToBytes(action6.getAugmentation(DlAddressAction.class).getDlAddress().getValue()));\r
-        Action action7 = actions.get(6);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.SetNwSrc", action7.getType().getName());\r
-        Assert.assertEquals("Wrong nw-src", new Ipv4Address("10.0.0.1"),\r
-                action7.getAugmentation(IpAddressAction.class).getIpAddress());\r
-        Action action8 = actions.get(7);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.SetNwDst", action8.getType().getName());\r
-        Assert.assertEquals("Wrong nw-dst", new Ipv4Address("11.0.0.2"),\r
-                action8.getAugmentation(IpAddressAction.class).getIpAddress());\r
-        Action action9 = actions.get(8);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.SetNwTos", action9.getType().getName());\r
-        Assert.assertEquals("Wrong nw-tos", 1, action9.getAugmentation(NwTosAction.class).getNwTos().intValue());\r
-        Action action10 = actions.get(9);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.SetTpSrc", action10.getType().getName());\r
-        Assert.assertEquals("Wrong port", 2, action10.getAugmentation(PortAction.class)\r
-                .getPort().getValue().intValue());\r
-        Action action11 = actions.get(10);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.SetTpDst", action11.getType().getName());\r
-        Assert.assertEquals("Wrong port", 3, action11.getAugmentation(PortAction.class)\r
-                .getPort().getValue().intValue());\r
-        Action action12 = actions.get(11);\r
-        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
-                + ".openflow.common.action.rev130731.Enqueue", action12.getType().getName());\r
-        Assert.assertEquals("Wrong port", 4, action12.getAugmentation(PortAction.class)\r
-                .getPort().getValue().intValue());\r
-        Assert.assertEquals("Wrong queue-id", 48,\r
-                action12.getAugmentation(QueueIdAction.class).getQueueId().intValue());\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10ActionsDeserializerTest {
+
+    private DeserializerRegistry registry;
+
+    /**
+     * Initializes deserializer registry and lookups correct deserializer
+     */
+    @Before
+    public void startUp() {
+        registry = new DeserializerRegistryImpl();
+        registry.init();
+    }
+
+    /**
+     * Testing correct deserialization of actions (OF v1.0)
+     */
+    @Test
+    public void test() {
+        ByteBuf message = BufferHelper.buildBuffer("00 00 00 08 00 10 20 00 "
+                + "00 01 00 08 10 10 00 00 "
+                + "00 02 00 08 25 00 00 00 "
+                + "00 03 00 08 00 00 00 00 "
+                + "00 04 00 10 01 02 03 04 05 06 00 00 00 00 00 00 "
+                + "00 05 00 10 02 03 04 05 06 07 00 00 00 00 00 00 "
+                + "00 06 00 08 0A 00 00 01 "
+                + "00 07 00 08 0B 00 00 02 "
+                + "00 08 00 08 01 00 00 00 "
+                + "00 09 00 08 00 02 00 00 "
+                + "00 0A 00 08 00 03 00 00 "
+                + "00 0B 00 10 00 04 00 00 00 00 00 00 00 00 00 30");
+        
+        message.skipBytes(4); // skip XID
+        CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF10_VERSION_ID);
+        List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF10_VERSION_ID,
+                message.readableBytes(), message, keyMaker, registry);
+        Assert.assertEquals("Wrong number of actions", 12, actions.size());
+        Action action1 = actions.get(0);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.Output", action1.getType().getName());
+        Assert.assertEquals("Wrong port", 16,
+                action1.getAugmentation(PortAction.class).getPort().getValue().intValue());
+        Assert.assertEquals("Wrong max-length", 8192,
+                action1.getAugmentation(MaxLengthAction.class).getMaxLength().intValue());
+        Action action2 = actions.get(1);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.SetVlanVid", action2.getType().getName());
+        Assert.assertEquals("Wrong vlan-vid", 4112,
+                action2.getAugmentation(VlanVidAction.class).getVlanVid().intValue());
+        Action action3 = actions.get(2);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.SetVlanPcp", action3.getType().getName());
+        Assert.assertEquals("Wrong vlan-pcp", 37,
+                action3.getAugmentation(VlanPcpAction.class).getVlanPcp().intValue());
+        Action action4 = actions.get(3);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.StripVlan", action4.getType().getName());
+        Action action5 = actions.get(4);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.SetDlSrc", action5.getType().getName());
+        Assert.assertArrayEquals("Wrong dl-src", ByteBufUtils.macAddressToBytes("01:02:03:04:05:06"),
+                ByteBufUtils.macAddressToBytes(action5.getAugmentation(DlAddressAction.class).getDlAddress().getValue()));
+        Action action6 = actions.get(5);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.SetDlDst", action6.getType().getName());
+        Assert.assertArrayEquals("Wrong dl-dst", ByteBufUtils.macAddressToBytes("02:03:04:05:06:07"), 
+                ByteBufUtils.macAddressToBytes(action6.getAugmentation(DlAddressAction.class).getDlAddress().getValue()));
+        Action action7 = actions.get(6);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.SetNwSrc", action7.getType().getName());
+        Assert.assertEquals("Wrong nw-src", new Ipv4Address("10.0.0.1"),
+                action7.getAugmentation(IpAddressAction.class).getIpAddress());
+        Action action8 = actions.get(7);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.SetNwDst", action8.getType().getName());
+        Assert.assertEquals("Wrong nw-dst", new Ipv4Address("11.0.0.2"),
+                action8.getAugmentation(IpAddressAction.class).getIpAddress());
+        Action action9 = actions.get(8);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.SetNwTos", action9.getType().getName());
+        Assert.assertEquals("Wrong nw-tos", 1, action9.getAugmentation(NwTosAction.class).getNwTos().intValue());
+        Action action10 = actions.get(9);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.SetTpSrc", action10.getType().getName());
+        Assert.assertEquals("Wrong port", 2, action10.getAugmentation(PortAction.class)
+                .getPort().getValue().intValue());
+        Action action11 = actions.get(10);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.SetTpDst", action11.getType().getName());
+        Assert.assertEquals("Wrong port", 3, action11.getAugmentation(PortAction.class)
+                .getPort().getValue().intValue());
+        Action action12 = actions.get(11);
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"
+                + ".openflow.common.action.rev130731.Enqueue", action12.getType().getName());
+        Assert.assertEquals("Wrong port", 4, action12.getAugmentation(PortAction.class)
+                .getPort().getValue().intValue());
+        Assert.assertEquals("Wrong queue-id", 48,
+                action12.getAugmentation(QueueIdAction.class).getQueueId().intValue());
+    }
+
+}
index 4a80e8c325f8c25ed9e4331953fc999d5c0d9a53..3b72cb4d1b05218cfb284477a421fbe90d653bc9 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10ActionsSerializerTest {\r
-\r
-    private SerializerRegistry registry;\r
-\r
-    /**\r
-     * Initializes serializer table and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-    }\r
-\r
-    /**\r
-     * Testing correct serialization of actions (OF v1.0) \r
-     */\r
-    @Test\r
-    public void test() {\r
-        List<Action> actions = new ArrayList<>();\r
-        ActionBuilder actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Output.class);\r
-        PortActionBuilder portBuilder = new PortActionBuilder();\r
-        portBuilder.setPort(new PortNumber(42L));\r
-        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
-        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
-        maxLen.setMaxLength(32);\r
-        actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetVlanVid.class);\r
-        VlanVidActionBuilder vlanBuilder = new VlanVidActionBuilder();\r
-        vlanBuilder.setVlanVid(15);\r
-        actionBuilder.addAugmentation(VlanVidAction.class, vlanBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetVlanPcp.class);\r
-        VlanPcpActionBuilder pcpBuilder = new VlanPcpActionBuilder();\r
-        pcpBuilder.setVlanPcp((short) 16);\r
-        actionBuilder.addAugmentation(VlanPcpAction.class, pcpBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(StripVlan.class);\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetDlSrc.class);\r
-        DlAddressActionBuilder dlBuilder = new DlAddressActionBuilder();\r
-        dlBuilder.setDlAddress(new MacAddress("00:00:00:02:03:04"));\r
-        actionBuilder.addAugmentation(DlAddressAction.class, dlBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetDlDst.class);\r
-        dlBuilder = new DlAddressActionBuilder();\r
-        dlBuilder.setDlAddress(new MacAddress("00:00:00:01:02:03"));\r
-        actionBuilder.addAugmentation(DlAddressAction.class, dlBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetNwSrc.class);\r
-        IpAddressActionBuilder ipBuilder = new IpAddressActionBuilder();\r
-        ipBuilder.setIpAddress(new Ipv4Address("10.0.0.1"));\r
-        actionBuilder.addAugmentation(IpAddressAction.class, ipBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetNwDst.class);\r
-        ipBuilder = new IpAddressActionBuilder();\r
-        ipBuilder.setIpAddress(new Ipv4Address("10.0.0.3"));\r
-        actionBuilder.addAugmentation(IpAddressAction.class, ipBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetNwTos.class);\r
-        NwTosActionBuilder tosBuilder = new NwTosActionBuilder();\r
-        tosBuilder.setNwTos((short) 204);\r
-        actionBuilder.addAugmentation(NwTosAction.class, tosBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetTpSrc.class);\r
-        portBuilder = new PortActionBuilder();\r
-        portBuilder.setPort(new PortNumber(6653L));\r
-        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetTpDst.class);\r
-        portBuilder = new PortActionBuilder();\r
-        portBuilder.setPort(new PortNumber(6633L));\r
-        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Enqueue.class);\r
-        portBuilder = new PortActionBuilder();\r
-        portBuilder.setPort(new PortNumber(6613L));\r
-        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
-        QueueIdActionBuilder queueBuilder = new QueueIdActionBuilder();\r
-        queueBuilder.setQueueId(400L);\r
-        actionBuilder.addAugmentation(QueueIdAction.class, queueBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        ListSerializer.serializeList(actions, TypeKeyMakerFactory\r
-                .createActionKeyMaker(EncodeConstants.OF10_VERSION_ID), registry, out);\r
-        \r
-        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong port", 42, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong max-length", 32, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action type", 1, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong vlan-vid", 15, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 2, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong vlan-pcp", 16, out.readUnsignedByte());\r
-        out.skipBytes(3);\r
-        Assert.assertEquals("Wrong action type", 3, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
-        byte[] data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];\r
-        out.readBytes(data);\r
-        Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:02:03:04"), data);\r
-        out.skipBytes(6);\r
-        Assert.assertEquals("Wrong action type", 5, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
-        data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];\r
-        out.readBytes(data);\r
-        Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:01:02:03"), data);\r
-        out.skipBytes(6);\r
-        Assert.assertEquals("Wrong action type", 6, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong ip-address(4)", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong action type", 7, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong ip-address(4)", 3, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong action type", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong nw-tos", 204, out.readUnsignedByte());\r
-        out.skipBytes(3);\r
-        Assert.assertEquals("Wrong action type", 9, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong port", 6653, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 10, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong port", 6633, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong port", 6613, out.readUnsignedShort());\r
-        out.skipBytes(6);\r
-        Assert.assertEquals("Wrong queue-id", 400, out.readUnsignedInt());\r
-        Assert.assertTrue("Written more bytes than needed", out.readableBytes() == 0);\r
-    }\r
-    \r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10ActionsSerializerTest {
+
+    private SerializerRegistry registry;
+
+    /**
+     * Initializes serializer table and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+    }
+
+    /**
+     * Testing correct serialization of actions (OF v1.0) 
+     */
+    @Test
+    public void test() {
+        List<Action> actions = new ArrayList<>();
+        ActionBuilder actionBuilder = new ActionBuilder();
+        actionBuilder.setType(Output.class);
+        PortActionBuilder portBuilder = new PortActionBuilder();
+        portBuilder.setPort(new PortNumber(42L));
+        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+        maxLen.setMaxLength(32);
+        actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetVlanVid.class);
+        VlanVidActionBuilder vlanBuilder = new VlanVidActionBuilder();
+        vlanBuilder.setVlanVid(15);
+        actionBuilder.addAugmentation(VlanVidAction.class, vlanBuilder.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetVlanPcp.class);
+        VlanPcpActionBuilder pcpBuilder = new VlanPcpActionBuilder();
+        pcpBuilder.setVlanPcp((short) 16);
+        actionBuilder.addAugmentation(VlanPcpAction.class, pcpBuilder.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(StripVlan.class);
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetDlSrc.class);
+        DlAddressActionBuilder dlBuilder = new DlAddressActionBuilder();
+        dlBuilder.setDlAddress(new MacAddress("00:00:00:02:03:04"));
+        actionBuilder.addAugmentation(DlAddressAction.class, dlBuilder.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetDlDst.class);
+        dlBuilder = new DlAddressActionBuilder();
+        dlBuilder.setDlAddress(new MacAddress("00:00:00:01:02:03"));
+        actionBuilder.addAugmentation(DlAddressAction.class, dlBuilder.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetNwSrc.class);
+        IpAddressActionBuilder ipBuilder = new IpAddressActionBuilder();
+        ipBuilder.setIpAddress(new Ipv4Address("10.0.0.1"));
+        actionBuilder.addAugmentation(IpAddressAction.class, ipBuilder.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetNwDst.class);
+        ipBuilder = new IpAddressActionBuilder();
+        ipBuilder.setIpAddress(new Ipv4Address("10.0.0.3"));
+        actionBuilder.addAugmentation(IpAddressAction.class, ipBuilder.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetNwTos.class);
+        NwTosActionBuilder tosBuilder = new NwTosActionBuilder();
+        tosBuilder.setNwTos((short) 204);
+        actionBuilder.addAugmentation(NwTosAction.class, tosBuilder.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetTpSrc.class);
+        portBuilder = new PortActionBuilder();
+        portBuilder.setPort(new PortNumber(6653L));
+        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetTpDst.class);
+        portBuilder = new PortActionBuilder();
+        portBuilder.setPort(new PortNumber(6633L));
+        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(Enqueue.class);
+        portBuilder = new PortActionBuilder();
+        portBuilder.setPort(new PortNumber(6613L));
+        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+        QueueIdActionBuilder queueBuilder = new QueueIdActionBuilder();
+        queueBuilder.setQueueId(400L);
+        actionBuilder.addAugmentation(QueueIdAction.class, queueBuilder.build());
+        actions.add(actionBuilder.build());
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        ListSerializer.serializeList(actions, TypeKeyMakerFactory
+                .createActionKeyMaker(EncodeConstants.OF10_VERSION_ID), registry, out);
+        
+        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong port", 42, out.readUnsignedShort());
+        Assert.assertEquals("Wrong max-length", 32, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action type", 1, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong vlan-vid", 15, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 2, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong vlan-pcp", 16, out.readUnsignedByte());
+        out.skipBytes(3);
+        Assert.assertEquals("Wrong action type", 3, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+        byte[] data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
+        out.readBytes(data);
+        Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:02:03:04"), data);
+        out.skipBytes(6);
+        Assert.assertEquals("Wrong action type", 5, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+        data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
+        out.readBytes(data);
+        Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:01:02:03"), data);
+        out.skipBytes(6);
+        Assert.assertEquals("Wrong action type", 6, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());
+        Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());
+        Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());
+        Assert.assertEquals("Wrong ip-address(4)", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong action type", 7, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());
+        Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());
+        Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());
+        Assert.assertEquals("Wrong ip-address(4)", 3, out.readUnsignedByte());
+        Assert.assertEquals("Wrong action type", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong nw-tos", 204, out.readUnsignedByte());
+        out.skipBytes(3);
+        Assert.assertEquals("Wrong action type", 9, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong port", 6653, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 10, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong port", 6633, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+        Assert.assertEquals("Wrong port", 6613, out.readUnsignedShort());
+        out.skipBytes(6);
+        Assert.assertEquals("Wrong queue-id", 400, out.readUnsignedInt());
+        Assert.assertTrue("Written more bytes than needed", out.readableBytes() == 0);
+    }
+    
 }
\ No newline at end of file
index f801dee381f041ac61f91d76859a45caa20ed2fe..4f01fd20c832d56da540b79f746ded049c1f2d91 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * \r
- */\r
-public class OF13ActionsSerializerTest {\r
-\r
-    private SerializerRegistry registry;\r
-\r
-    /**\r
-     * Initializes serializer table and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-    }\r
-\r
-    /**\r
-     * Testing correct serialization of actions\r
-     */\r
-    @Test\r
-    public void test() {\r
-        List<Action> actions = new ArrayList<>();\r
-        ActionBuilder actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Output.class);\r
-        PortActionBuilder port = new PortActionBuilder();\r
-        port.setPort(new PortNumber(42L));\r
-        actionBuilder.addAugmentation(PortAction.class, port.build());\r
-        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
-        maxLen.setMaxLength(52);\r
-        actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(CopyTtlOut.class);\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(CopyTtlIn.class);\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetMplsTtl.class);\r
-        MplsTtlActionBuilder mplsTtl = new MplsTtlActionBuilder();\r
-        mplsTtl.setMplsTtl((short) 4);\r
-        actionBuilder.addAugmentation(MplsTtlAction.class, mplsTtl.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(DecMplsTtl.class);\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PushVlan.class);\r
-        EthertypeActionBuilder etherType = new EthertypeActionBuilder();\r
-        etherType.setEthertype(new EtherType(16));\r
-        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PopVlan.class);\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PushMpls.class);\r
-        etherType = new EthertypeActionBuilder();\r
-        etherType.setEthertype(new EtherType(17));\r
-        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PopMpls.class);\r
-        etherType = new EthertypeActionBuilder();\r
-        etherType.setEthertype(new EtherType(18));\r
-        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetQueue.class);\r
-        QueueIdActionBuilder queueId = new QueueIdActionBuilder();\r
-        queueId.setQueueId(1234L);\r
-        actionBuilder.addAugmentation(QueueIdAction.class, queueId.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Group.class);\r
-        GroupIdActionBuilder group = new GroupIdActionBuilder();\r
-        group.setGroupId(555L);\r
-        actionBuilder.addAugmentation(GroupIdAction.class, group.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetNwTtl.class);\r
-        NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();\r
-        nwTtl.setNwTtl((short) 8);\r
-        actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(DecNwTtl.class);\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetField.class);\r
-        OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();\r
-        List<MatchEntries> entries = new ArrayList<>();\r
-        MatchEntriesBuilder matchBuilder = new MatchEntriesBuilder();\r
-        matchBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        matchBuilder.setOxmMatchField(InPort.class);\r
-        matchBuilder.setHasMask(false);\r
-        PortNumberMatchEntryBuilder portBuilder = new PortNumberMatchEntryBuilder();\r
-        portBuilder.setPortNumber(new PortNumber(1L));\r
-        matchBuilder.addAugmentation(PortNumberMatchEntry.class, portBuilder.build());\r
-        entries.add(matchBuilder.build());\r
-        matchEntries.setMatchEntries(entries);\r
-        actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PushPbb.class);\r
-        etherType = new EthertypeActionBuilder();\r
-        etherType.setEthertype(new EtherType(19));\r
-        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PopPbb.class);\r
-        actions.add(actionBuilder.build());\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        ListSerializer.serializeList(actions, TypeKeyMakerFactory\r
-                .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);\r
-        \r
-        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action port", 42, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong action max-length", 52, out.readUnsignedShort());\r
-        out.skipBytes(6);\r
-        Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 12, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 15, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action mpls-ttl", 4, out.readUnsignedByte());\r
-        out.skipBytes(3);\r
-        Assert.assertEquals("Wrong action type", 16, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action ethertype", 16, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 18, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 19, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action ethertype", 17, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 20, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action ethertype", 18, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 21, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action queue-id", 1234, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong action type", 22, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action group", 555, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action nw-ttl", 8, out.readUnsignedByte());\r
-        out.skipBytes(3);\r
-        Assert.assertEquals("Wrong action type", 24, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 25, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & mask", 0, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 1, out.readUnsignedInt());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 26, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action ethertype", 19, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Testing correct serialization of actions\r
-     */\r
-    @Test\r
-    public void testHeaders() {\r
-        List<Action> actions = new ArrayList<>();\r
-        ActionBuilder actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Output.class);\r
-        PortActionBuilder port = new PortActionBuilder();\r
-        port.setPort(new PortNumber(42L));\r
-        actionBuilder.addAugmentation(PortAction.class, port.build());\r
-        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
-        maxLen.setMaxLength(52);\r
-        actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetField.class);\r
-        OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();\r
-        List<MatchEntries> entries = new ArrayList<>();\r
-        MatchEntriesBuilder matchBuilder = new MatchEntriesBuilder();\r
-        matchBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        matchBuilder.setOxmMatchField(InPort.class);\r
-        matchBuilder.setHasMask(false);\r
-        PortNumberMatchEntryBuilder portBuilder = new PortNumberMatchEntryBuilder();\r
-        portBuilder.setPortNumber(new PortNumber(1L));\r
-        matchBuilder.addAugmentation(PortNumberMatchEntry.class, portBuilder.build());\r
-        entries.add(matchBuilder.build());\r
-        matchEntries.setMatchEntries(entries);\r
-        actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());\r
-        actions.add(actionBuilder.build());\r
-\r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        ListSerializer.serializeHeaderList(actions, TypeKeyMakerFactory\r
-                .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);\r
-\r
-        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action type", 25, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ * 
+ */
+public class OF13ActionsSerializerTest {
+
+    private SerializerRegistry registry;
+
+    /**
+     * Initializes serializer table and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+    }
+
+    /**
+     * Testing correct serialization of actions
+     */
+    @Test
+    public void test() {
+        List<Action> actions = new ArrayList<>();
+        ActionBuilder actionBuilder = new ActionBuilder();
+        actionBuilder.setType(Output.class);
+        PortActionBuilder port = new PortActionBuilder();
+        port.setPort(new PortNumber(42L));
+        actionBuilder.addAugmentation(PortAction.class, port.build());
+        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+        maxLen.setMaxLength(52);
+        actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(CopyTtlOut.class);
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(CopyTtlIn.class);
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetMplsTtl.class);
+        MplsTtlActionBuilder mplsTtl = new MplsTtlActionBuilder();
+        mplsTtl.setMplsTtl((short) 4);
+        actionBuilder.addAugmentation(MplsTtlAction.class, mplsTtl.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(DecMplsTtl.class);
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PushVlan.class);
+        EthertypeActionBuilder etherType = new EthertypeActionBuilder();
+        etherType.setEthertype(new EtherType(16));
+        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PopVlan.class);
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PushMpls.class);
+        etherType = new EthertypeActionBuilder();
+        etherType.setEthertype(new EtherType(17));
+        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PopMpls.class);
+        etherType = new EthertypeActionBuilder();
+        etherType.setEthertype(new EtherType(18));
+        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetQueue.class);
+        QueueIdActionBuilder queueId = new QueueIdActionBuilder();
+        queueId.setQueueId(1234L);
+        actionBuilder.addAugmentation(QueueIdAction.class, queueId.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(Group.class);
+        GroupIdActionBuilder group = new GroupIdActionBuilder();
+        group.setGroupId(555L);
+        actionBuilder.addAugmentation(GroupIdAction.class, group.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetNwTtl.class);
+        NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();
+        nwTtl.setNwTtl((short) 8);
+        actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(DecNwTtl.class);
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetField.class);
+        OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();
+        List<MatchEntries> entries = new ArrayList<>();
+        MatchEntriesBuilder matchBuilder = new MatchEntriesBuilder();
+        matchBuilder.setOxmClass(OpenflowBasicClass.class);
+        matchBuilder.setOxmMatchField(InPort.class);
+        matchBuilder.setHasMask(false);
+        PortNumberMatchEntryBuilder portBuilder = new PortNumberMatchEntryBuilder();
+        portBuilder.setPortNumber(new PortNumber(1L));
+        matchBuilder.addAugmentation(PortNumberMatchEntry.class, portBuilder.build());
+        entries.add(matchBuilder.build());
+        matchEntries.setMatchEntries(entries);
+        actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PushPbb.class);
+        etherType = new EthertypeActionBuilder();
+        etherType.setEthertype(new EtherType(19));
+        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PopPbb.class);
+        actions.add(actionBuilder.build());
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        ListSerializer.serializeList(actions, TypeKeyMakerFactory
+                .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);
+        
+        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action port", 42, out.readUnsignedInt());
+        Assert.assertEquals("Wrong action max-length", 52, out.readUnsignedShort());
+        out.skipBytes(6);
+        Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 12, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 15, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action mpls-ttl", 4, out.readUnsignedByte());
+        out.skipBytes(3);
+        Assert.assertEquals("Wrong action type", 16, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action ethertype", 16, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 18, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 19, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action ethertype", 17, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 20, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action ethertype", 18, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 21, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action queue-id", 1234, out.readUnsignedInt());
+        Assert.assertEquals("Wrong action type", 22, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action group", 555, out.readUnsignedInt());
+        Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action nw-ttl", 8, out.readUnsignedByte());
+        out.skipBytes(3);
+        Assert.assertEquals("Wrong action type", 24, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 25, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & mask", 0, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 1, out.readUnsignedInt());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 26, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action ethertype", 19, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertTrue("Unread data", out.readableBytes() == 0);
+    }
+
+    /**
+     * Testing correct serialization of actions
+     */
+    @Test
+    public void testHeaders() {
+        List<Action> actions = new ArrayList<>();
+        ActionBuilder actionBuilder = new ActionBuilder();
+        actionBuilder.setType(Output.class);
+        PortActionBuilder port = new PortActionBuilder();
+        port.setPort(new PortNumber(42L));
+        actionBuilder.addAugmentation(PortAction.class, port.build());
+        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+        maxLen.setMaxLength(52);
+        actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetField.class);
+        OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();
+        List<MatchEntries> entries = new ArrayList<>();
+        MatchEntriesBuilder matchBuilder = new MatchEntriesBuilder();
+        matchBuilder.setOxmClass(OpenflowBasicClass.class);
+        matchBuilder.setOxmMatchField(InPort.class);
+        matchBuilder.setHasMask(false);
+        PortNumberMatchEntryBuilder portBuilder = new PortNumberMatchEntryBuilder();
+        portBuilder.setPortNumber(new PortNumber(1L));
+        matchBuilder.addAugmentation(PortNumberMatchEntry.class, portBuilder.build());
+        entries.add(matchBuilder.build());
+        matchEntries.setMatchEntries(entries);
+        actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());
+        actions.add(actionBuilder.build());
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        ListSerializer.serializeHeaderList(actions, TypeKeyMakerFactory
+                .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);
+
+        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action type", 25, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());
+        Assert.assertTrue("Unread data", out.readableBytes() == 0);
+    }
 }
\ No newline at end of file
index 902f8b5819fe638ce21843fa5686018e429ef7d3..68fe7510699f15cbab71a5d751cf3ad8d857352f 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13InstructionsSerializerTest {\r
-\r
-    private SerializerRegistry registry;\r
-\r
-    /**\r
-     * Initializes serializer table and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-    }\r
-\r
-    /**\r
-     * Testing instructions translation\r
-     */\r
-    @Test\r
-    public void test() {\r
-        List<Instruction> instructions = new ArrayList<>();\r
-        // Goto_table instruction\r
-        InstructionBuilder builder = new InstructionBuilder();\r
-        builder.setType(GotoTable.class);\r
-        TableIdInstructionBuilder tableIdBuilder = new TableIdInstructionBuilder();\r
-        tableIdBuilder.setTableId((short) 5);\r
-        builder.addAugmentation(TableIdInstruction.class, tableIdBuilder.build());\r
-        instructions.add(builder.build());\r
-        builder = new InstructionBuilder();\r
-        // Write_metadata instruction\r
-        builder.setType(WriteMetadata.class);\r
-        MetadataInstructionBuilder metaBuilder = new MetadataInstructionBuilder();\r
-        metaBuilder.setMetadata(ByteBufUtils.hexStringToBytes("00 01 02 03 04 05 06 07"));\r
-        metaBuilder.setMetadataMask(ByteBufUtils.hexStringToBytes("07 06 05 04 03 02 01 00"));\r
-        builder.addAugmentation(MetadataInstruction.class, metaBuilder.build());\r
-        instructions.add(builder.build());\r
-        // Clear_actions instruction\r
-        builder = new InstructionBuilder();\r
-        builder.setType(ClearActions.class);\r
-        instructions.add(builder.build());\r
-        // Meter instruction\r
-        builder = new InstructionBuilder();\r
-        builder.setType(Meter.class);\r
-        MeterIdInstructionBuilder meterBuilder = new MeterIdInstructionBuilder();\r
-        meterBuilder.setMeterId(42L);\r
-        builder.addAugmentation(MeterIdInstruction.class, meterBuilder.build());\r
-        instructions.add(builder.build());\r
-        // Write_actions instruction\r
-        builder = new InstructionBuilder();\r
-        builder.setType(WriteActions.class);\r
-        ActionsInstructionBuilder actionsBuilder = new ActionsInstructionBuilder();\r
-        List<Action> actions = new ArrayList<>();\r
-        ActionBuilder actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Output.class);\r
-        PortActionBuilder portBuilder = new PortActionBuilder();\r
-        portBuilder.setPort(new PortNumber(45L));\r
-        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
-        MaxLengthActionBuilder maxBuilder = new MaxLengthActionBuilder();\r
-        maxBuilder.setMaxLength(55);\r
-        actionBuilder.addAugmentation(MaxLengthAction.class, maxBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetNwTtl.class);\r
-        NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();\r
-        nwTtl.setNwTtl((short) 64);\r
-        actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());\r
-        actions.add(actionBuilder.build());\r
-        actionsBuilder.setAction(actions);\r
-        builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());\r
-        instructions.add(builder.build());\r
-        // Apply_actions instruction\r
-        builder = new InstructionBuilder();\r
-        builder.setType(ApplyActions.class);\r
-        actionsBuilder = new ActionsInstructionBuilder();\r
-        actions = new ArrayList<>();\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PushVlan.class);\r
-        EthertypeActionBuilder ethertypeBuilder = new EthertypeActionBuilder();\r
-        ethertypeBuilder.setEthertype(new EtherType(14));\r
-        actionBuilder.addAugmentation(EthertypeAction.class, ethertypeBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PopPbb.class);\r
-        actions.add(actionBuilder.build());\r
-        actionsBuilder.setAction(actions);\r
-        builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());\r
-        instructions.add(builder.build());\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        ListSerializer.serializeList(instructions, TypeKeyMakerFactory\r
-                .createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);\r
-        \r
-        Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction table-id", 5, out.readUnsignedByte());\r
-        out.skipBytes(3);\r
-        Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        byte[] actual = new byte[8];\r
-        out.readBytes(actual);\r
-        Assert.assertEquals("Wrong instruction metadata", "00 01 02 03 04 05 06 07",\r
-                ByteBufUtils.bytesToHexString(actual));\r
-        actual = new byte[8];\r
-        out.readBytes(actual);\r
-        Assert.assertEquals("Wrong instruction metadata-mask", "07 06 05 04 03 02 01 00",\r
-                ByteBufUtils.bytesToHexString(actual));\r
-        Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction meter-id", 42, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 32, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action type", 45, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong action type", 55, out.readUnsignedShort());\r
-        out.skipBytes(6);\r
-        Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action type", 64, out.readUnsignedByte());\r
-        out.skipBytes(3);\r
-        Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action ethertype", 14, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertTrue("Not all data were read", out.readableBytes() == 0);\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13InstructionsSerializerTest {
+
+    private SerializerRegistry registry;
+
+    /**
+     * Initializes serializer table and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+    }
+
+    /**
+     * Testing instructions translation
+     */
+    @Test
+    public void test() {
+        List<Instruction> instructions = new ArrayList<>();
+        // Goto_table instruction
+        InstructionBuilder builder = new InstructionBuilder();
+        builder.setType(GotoTable.class);
+        TableIdInstructionBuilder tableIdBuilder = new TableIdInstructionBuilder();
+        tableIdBuilder.setTableId((short) 5);
+        builder.addAugmentation(TableIdInstruction.class, tableIdBuilder.build());
+        instructions.add(builder.build());
+        builder = new InstructionBuilder();
+        // Write_metadata instruction
+        builder.setType(WriteMetadata.class);
+        MetadataInstructionBuilder metaBuilder = new MetadataInstructionBuilder();
+        metaBuilder.setMetadata(ByteBufUtils.hexStringToBytes("00 01 02 03 04 05 06 07"));
+        metaBuilder.setMetadataMask(ByteBufUtils.hexStringToBytes("07 06 05 04 03 02 01 00"));
+        builder.addAugmentation(MetadataInstruction.class, metaBuilder.build());
+        instructions.add(builder.build());
+        // Clear_actions instruction
+        builder = new InstructionBuilder();
+        builder.setType(ClearActions.class);
+        instructions.add(builder.build());
+        // Meter instruction
+        builder = new InstructionBuilder();
+        builder.setType(Meter.class);
+        MeterIdInstructionBuilder meterBuilder = new MeterIdInstructionBuilder();
+        meterBuilder.setMeterId(42L);
+        builder.addAugmentation(MeterIdInstruction.class, meterBuilder.build());
+        instructions.add(builder.build());
+        // Write_actions instruction
+        builder = new InstructionBuilder();
+        builder.setType(WriteActions.class);
+        ActionsInstructionBuilder actionsBuilder = new ActionsInstructionBuilder();
+        List<Action> actions = new ArrayList<>();
+        ActionBuilder actionBuilder = new ActionBuilder();
+        actionBuilder.setType(Output.class);
+        PortActionBuilder portBuilder = new PortActionBuilder();
+        portBuilder.setPort(new PortNumber(45L));
+        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+        MaxLengthActionBuilder maxBuilder = new MaxLengthActionBuilder();
+        maxBuilder.setMaxLength(55);
+        actionBuilder.addAugmentation(MaxLengthAction.class, maxBuilder.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetNwTtl.class);
+        NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();
+        nwTtl.setNwTtl((short) 64);
+        actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());
+        actions.add(actionBuilder.build());
+        actionsBuilder.setAction(actions);
+        builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());
+        instructions.add(builder.build());
+        // Apply_actions instruction
+        builder = new InstructionBuilder();
+        builder.setType(ApplyActions.class);
+        actionsBuilder = new ActionsInstructionBuilder();
+        actions = new ArrayList<>();
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PushVlan.class);
+        EthertypeActionBuilder ethertypeBuilder = new EthertypeActionBuilder();
+        ethertypeBuilder.setEthertype(new EtherType(14));
+        actionBuilder.addAugmentation(EthertypeAction.class, ethertypeBuilder.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PopPbb.class);
+        actions.add(actionBuilder.build());
+        actionsBuilder.setAction(actions);
+        builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());
+        instructions.add(builder.build());
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        ListSerializer.serializeList(instructions, TypeKeyMakerFactory
+                .createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);
+        
+        Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction table-id", 5, out.readUnsignedByte());
+        out.skipBytes(3);
+        Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());
+        out.skipBytes(4);
+        byte[] actual = new byte[8];
+        out.readBytes(actual);
+        Assert.assertEquals("Wrong instruction metadata", "00 01 02 03 04 05 06 07",
+                ByteBufUtils.bytesToHexString(actual));
+        actual = new byte[8];
+        out.readBytes(actual);
+        Assert.assertEquals("Wrong instruction metadata-mask", "07 06 05 04 03 02 01 00",
+                ByteBufUtils.bytesToHexString(actual));
+        Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction meter-id", 42, out.readUnsignedInt());
+        Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 32, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action type", 45, out.readUnsignedInt());
+        Assert.assertEquals("Wrong action type", 55, out.readUnsignedShort());
+        out.skipBytes(6);
+        Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action type", 64, out.readUnsignedByte());
+        out.skipBytes(3);
+        Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action ethertype", 14, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertTrue("Not all data were read", out.readableBytes() == 0);
+    }
+
+}
index 6ed7c7e7ddfbe671f1f64951107267b98a856e0e..e607d0fce8ff1f187c6737b573ec429cb568d9a0 100644 (file)
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.Match;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.MatchBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13MatchSerializer02Test {\r
-\r
-    private SerializerRegistry registry;\r
-    private OFSerializer<Match> matchSerializer;\r
-\r
-    /**\r
-     * Initializes serializer table and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        matchSerializer = registry.getSerializer(\r
-                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class));\r
-    }\r
-\r
-    /**\r
-     * Testing serialization of match\r
-     */\r
-    @Test\r
-    public void testEmptyMatch() {\r
-        MatchBuilder builder = new MatchBuilder();\r
-        builder.setType(OxmMatchType.class);\r
-        Match match = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        matchSerializer.serialize(match, out);\r
-        \r
-        Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match length", 4, out.readUnsignedShort());\r
-        Assert.assertTrue("Wrong padding", out.readableBytes() == 4);\r
-    }\r
-    \r
-    /**\r
-     * Testing serialization of match\r
-     */\r
-    @Test\r
-    public void test() {\r
-        MatchBuilder builder = new MatchBuilder();\r
-        builder.setType(OxmMatchType.class);\r
-        List<MatchEntries> entries = new ArrayList<>();\r
-        MatchEntriesBuilder entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(InPort.class);\r
-        entryBuilder.setHasMask(false);\r
-        PortNumberMatchEntryBuilder portNumberBuilder = new PortNumberMatchEntryBuilder();\r
-        portNumberBuilder.setPortNumber(new PortNumber(42L));\r
-        entryBuilder.addAugmentation(PortNumberMatchEntry.class, portNumberBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(InPhyPort.class);\r
-        entryBuilder.setHasMask(false);\r
-        portNumberBuilder = new PortNumberMatchEntryBuilder();\r
-        portNumberBuilder.setPortNumber(new PortNumber(43L));\r
-        entryBuilder.addAugmentation(PortNumberMatchEntry.class, portNumberBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Metadata.class);\r
-        entryBuilder.setHasMask(true);\r
-        MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();\r
-        metadataBuilder.setMetadata(new byte[]{0,0,0,0,0,0,0,1});\r
-        entryBuilder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());\r
-        MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,2});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(EthDst.class);\r
-        entryBuilder.setHasMask(true);\r
-        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress("01:00:03:00:00:06"));\r
-        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,0,0,0,5});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(EthSrc.class);\r
-        entryBuilder.setHasMask(true);\r
-        macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress("04:00:02:00:00:08"));\r
-        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,0,0,0,2});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(EthType.class);\r
-        entryBuilder.setHasMask(false);\r
-        EthTypeMatchEntryBuilder ethBuilder = new EthTypeMatchEntryBuilder();\r
-        ethBuilder.setEthType(new EtherType(46));\r
-        entryBuilder.addAugmentation(EthTypeMatchEntry.class, ethBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(VlanVid.class);\r
-        entryBuilder.setHasMask(true);\r
-        VlanVidMatchEntryBuilder vidBuilder = new VlanVidMatchEntryBuilder();\r
-        vidBuilder.setCfiBit(true);\r
-        vidBuilder.setVlanVid(45);\r
-        entryBuilder.addAugmentation(VlanVidMatchEntry.class, vidBuilder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,9});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(VlanPcp.class);\r
-        entryBuilder.setHasMask(false);\r
-        VlanPcpMatchEntryBuilder pcpBuilder = new VlanPcpMatchEntryBuilder();\r
-        pcpBuilder.setVlanPcp((short) 14);\r
-        entryBuilder.addAugmentation(VlanPcpMatchEntry.class, pcpBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(IpDscp.class);\r
-        entryBuilder.setHasMask(false);\r
-        DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();\r
-        dscpBuilder.setDscp(new Dscp((short) 48));\r
-        entryBuilder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(IpEcn.class);\r
-        entryBuilder.setHasMask(false);\r
-        EcnMatchEntryBuilder ecnBuilder = new EcnMatchEntryBuilder();\r
-        ecnBuilder.setEcn((short) 49);\r
-        entryBuilder.addAugmentation(EcnMatchEntry.class, ecnBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(IpProto.class);\r
-        entryBuilder.setHasMask(false);\r
-        ProtocolNumberMatchEntryBuilder protoBuilder = new ProtocolNumberMatchEntryBuilder();\r
-        protoBuilder.setProtocolNumber((short) 50);\r
-        entryBuilder.addAugmentation(ProtocolNumberMatchEntry.class, protoBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Ipv4Src.class);\r
-        entryBuilder.setHasMask(true);\r
-        Ipv4AddressMatchEntryBuilder ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
-        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.1"));\r
-        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,0,14});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Ipv4Dst.class);\r
-        entryBuilder.setHasMask(true);\r
-        ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
-        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.2"));\r
-        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,0,15});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(TcpSrc.class);\r
-        entryBuilder.setHasMask(false);\r
-        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
-                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6653));\r
-        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(TcpDst.class);\r
-        entryBuilder.setHasMask(false);\r
-        portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
-                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6654));\r
-        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(UdpSrc.class);\r
-        entryBuilder.setHasMask(false);\r
-        portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
-                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6655));\r
-        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(UdpDst.class);\r
-        entryBuilder.setHasMask(false);\r
-        portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
-                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6656));\r
-        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(SctpSrc.class);\r
-        entryBuilder.setHasMask(false);\r
-        portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
-                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6657));\r
-        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(SctpDst.class);\r
-        entryBuilder.setHasMask(false);\r
-        portBuilder = new PortMatchEntryBuilder();\r
-        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
-                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6658));\r
-        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Icmpv4Type.class);\r
-        entryBuilder.setHasMask(false);\r
-        Icmpv4TypeMatchEntryBuilder icmpv4typeBuilder = new Icmpv4TypeMatchEntryBuilder();\r
-        icmpv4typeBuilder.setIcmpv4Type((short) 51);\r
-        entryBuilder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4typeBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Icmpv4Code.class);\r
-        entryBuilder.setHasMask(false);\r
-        Icmpv4CodeMatchEntryBuilder icmpv4CodeBuilder = new Icmpv4CodeMatchEntryBuilder();\r
-        icmpv4CodeBuilder.setIcmpv4Code((short) 52);\r
-        entryBuilder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4CodeBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(ArpOp.class);\r
-        entryBuilder.setHasMask(false);\r
-        OpCodeMatchEntryBuilder opBuilder = new OpCodeMatchEntryBuilder();\r
-        opBuilder.setOpCode(53);\r
-        entryBuilder.addAugmentation(OpCodeMatchEntry.class, opBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(ArpSpa.class);\r
-        entryBuilder.setHasMask(true);\r
-        ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
-        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.4"));\r
-        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,0,16});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(ArpTpa.class);\r
-        entryBuilder.setHasMask(true);\r
-        ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
-        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.5"));\r
-        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,0,17});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(ArpSha.class);\r
-        entryBuilder.setHasMask(true);\r
-        macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress("00:01:02:03:04:05"));\r
-        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,4,0,0,6});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(ArpTha.class);\r
-        entryBuilder.setHasMask(true);\r
-        macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress("00:00:00:00:00:03"));\r
-        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,6,0,0,4});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Ipv6Src.class);\r
-        entryBuilder.setHasMask(true);\r
-        Ipv6AddressMatchEntryBuilder ipv6Builder = new Ipv6AddressMatchEntryBuilder();\r
-        ipv6Builder.setIpv6Address(new Ipv6Address("0:0:0:0:0:0:0:1"));\r
-        entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Ipv6Dst.class);\r
-        entryBuilder.setHasMask(true);\r
-        ipv6Builder = new Ipv6AddressMatchEntryBuilder();\r
-        ipv6Builder.setIpv6Address(new Ipv6Address("0:0:1:0:1:0:0:1"));\r
-        entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Ipv6Flabel.class);\r
-        entryBuilder.setHasMask(true);\r
-        Ipv6FlabelMatchEntryBuilder flabelBuilder = new Ipv6FlabelMatchEntryBuilder();\r
-        flabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(58L));\r
-        entryBuilder.addAugmentation(Ipv6FlabelMatchEntry.class, flabelBuilder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,1,0,2});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Icmpv6Type.class);\r
-        entryBuilder.setHasMask(false);\r
-        Icmpv6TypeMatchEntryBuilder icmpv6TypeBuilder = new Icmpv6TypeMatchEntryBuilder();\r
-        icmpv6TypeBuilder.setIcmpv6Type((short) 59);\r
-        entryBuilder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6TypeBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Icmpv6Code.class);\r
-        entryBuilder.setHasMask(false);\r
-        Icmpv6CodeMatchEntryBuilder icmpv6CodeBuilder = new Icmpv6CodeMatchEntryBuilder();\r
-        icmpv6CodeBuilder.setIcmpv6Code((short) 60);\r
-        entryBuilder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6CodeBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Ipv6NdTarget.class);\r
-        entryBuilder.setHasMask(false);\r
-        ipv6Builder = new Ipv6AddressMatchEntryBuilder();\r
-        ipv6Builder.setIpv6Address(new Ipv6Address("F:0:0::0:0:0:1"));\r
-        entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Ipv6NdSll.class);\r
-        entryBuilder.setHasMask(false);\r
-        macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress("01:00:03:00:00:06"));\r
-        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Ipv6NdTll.class);\r
-        entryBuilder.setHasMask(false);\r
-        macBuilder = new MacAddressMatchEntryBuilder();\r
-        macBuilder.setMacAddress(new MacAddress("04:00:02:00:00:08"));\r
-        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(MplsLabel.class);\r
-        entryBuilder.setHasMask(false);\r
-        MplsLabelMatchEntryBuilder labelBuilder = new MplsLabelMatchEntryBuilder();\r
-        labelBuilder.setMplsLabel(61L);\r
-        entryBuilder.addAugmentation(MplsLabelMatchEntry.class, labelBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(MplsTc.class);\r
-        entryBuilder.setHasMask(false);\r
-        TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();\r
-        tcBuilder.setTc((short) 62);\r
-        entryBuilder.addAugmentation(TcMatchEntry.class, tcBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(MplsBos.class);\r
-        entryBuilder.setHasMask(false);\r
-        BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();\r
-        bosBuilder.setBos(true);\r
-        entryBuilder.addAugmentation(BosMatchEntry.class, bosBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        \r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(PbbIsid.class);\r
-        entryBuilder.setHasMask(true);\r
-        IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();\r
-        isidBuilder.setIsid(64L);\r
-        entryBuilder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,1,2});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        \r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(TunnelId.class);\r
-        entryBuilder.setHasMask(true);\r
-        metadataBuilder = new MetadataMatchEntryBuilder();\r
-        metadataBuilder.setMetadata(new byte[]{0,0,0,0,0,0,0,1});\r
-        entryBuilder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,2});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        \r
-        entryBuilder = new MatchEntriesBuilder();\r
-        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        entryBuilder.setOxmMatchField(Ipv6Exthdr.class);\r
-        entryBuilder.setHasMask(true);\r
-        PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();\r
-        pseudoBuilder.setPseudoField(new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true));\r
-        entryBuilder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());\r
-        maskBuilder = new MaskMatchEntryBuilder();\r
-        maskBuilder.setMask(new byte[]{0,2});\r
-        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
-        entries.add(entryBuilder.build());\r
-        \r
-        \r
-        \r
-        builder.setMatchEntries(entries);\r
-        Match match = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        matchSerializer.serialize(match, out);\r
-        \r
-        Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match length", 428, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 0, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 42, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 2, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 43, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 5, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 1L, out.readLong());\r
-        Assert.assertEquals("Wrong match entry mask", 2L, out.readLong());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 7, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
-        byte[] array = new byte[6];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{1,0,3,0,0,6}, array);\r
-        array = new byte[6];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,5}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 9, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
-        array = new byte[6];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{4,0,2,0,0,8}, array);\r
-        array = new byte[6];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,2}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 10, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 46, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 13, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 4141, out.readUnsignedShort());\r
-        array = new byte[2];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,9}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 14, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 14, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 16, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 48, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 18, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 49, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 20, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 50, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 23, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
-        array = new byte[4];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,1}, array);\r
-        array = new byte[4];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,14}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 25, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
-        array = new byte[4];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,2}, array);\r
-        array = new byte[4];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,15}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 26, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 6653, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 28, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 6654, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 30, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 6655, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 32, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 6656, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 34, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 6657, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 36, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 6658, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 38, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 51, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 40, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 52, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 42, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 53, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 45, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
-        array = new byte[4];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,4}, array);\r
-        array = new byte[4];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,16}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 47, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
-        array = new byte[4];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,5}, array);\r
-        array = new byte[4];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,17}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 49, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
-        array = new byte[6];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,1,2,3,4,5}, array);\r
-        array = new byte[6];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,4,0,0,6}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 51, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
-        array = new byte[6];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,3}, array);\r
-        array = new byte[6];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,6,0,0,4}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 53, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 32, out.readUnsignedByte());\r
-        array = new byte[16];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);\r
-        array = new byte[16];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 55, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 32, out.readUnsignedByte());\r
-        array = new byte[16];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1}, array);\r
-        array = new byte[16];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 57, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 58, out.readUnsignedInt());\r
-        array = new byte[4];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,1,0,2}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 58, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 59, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 60, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 60, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 62, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());\r
-        array = new byte[16];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 64, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());\r
-        array = new byte[6];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{1,0,3,0,0,6}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 66, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());\r
-        array = new byte[6];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{4,0,2,0,0,8}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 68, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 61, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 70, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 62, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 72, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 1, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 75, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 64, out.readUnsignedMedium());\r
-        array = new byte[3];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,1,2}, array);\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 77, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 1L, out.readLong());\r
-        Assert.assertEquals("Wrong match entry mask", 2L, out.readLong());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & hasMask", 79, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 358, out.readUnsignedShort());\r
-        array = new byte[2];\r
-        out.readBytes(array);\r
-        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,2}, array);\r
-        Assert.assertTrue("Wrong padding", out.readableBytes() == 4);\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13MatchSerializer02Test {
+
+    private SerializerRegistry registry;
+    private OFSerializer<Match> matchSerializer;
+
+    /**
+     * Initializes serializer table and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+        matchSerializer = registry.getSerializer(
+                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class));
+    }
+
+    /**
+     * Testing serialization of match
+     */
+    @Test
+    public void testEmptyMatch() {
+        MatchBuilder builder = new MatchBuilder();
+        builder.setType(OxmMatchType.class);
+        Match match = builder.build();
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        matchSerializer.serialize(match, out);
+        
+        Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match length", 4, out.readUnsignedShort());
+        Assert.assertTrue("Wrong padding", out.readableBytes() == 4);
+    }
+    
+    /**
+     * Testing serialization of match
+     */
+    @Test
+    public void test() {
+        MatchBuilder builder = new MatchBuilder();
+        builder.setType(OxmMatchType.class);
+        List<MatchEntries> entries = new ArrayList<>();
+        MatchEntriesBuilder entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(InPort.class);
+        entryBuilder.setHasMask(false);
+        PortNumberMatchEntryBuilder portNumberBuilder = new PortNumberMatchEntryBuilder();
+        portNumberBuilder.setPortNumber(new PortNumber(42L));
+        entryBuilder.addAugmentation(PortNumberMatchEntry.class, portNumberBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(InPhyPort.class);
+        entryBuilder.setHasMask(false);
+        portNumberBuilder = new PortNumberMatchEntryBuilder();
+        portNumberBuilder.setPortNumber(new PortNumber(43L));
+        entryBuilder.addAugmentation(PortNumberMatchEntry.class, portNumberBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Metadata.class);
+        entryBuilder.setHasMask(true);
+        MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();
+        metadataBuilder.setMetadata(new byte[]{0,0,0,0,0,0,0,1});
+        entryBuilder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());
+        MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,2});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(EthDst.class);
+        entryBuilder.setHasMask(true);
+        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress("01:00:03:00:00:06"));
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,5});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(EthSrc.class);
+        entryBuilder.setHasMask(true);
+        macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress("04:00:02:00:00:08"));
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,2});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(EthType.class);
+        entryBuilder.setHasMask(false);
+        EthTypeMatchEntryBuilder ethBuilder = new EthTypeMatchEntryBuilder();
+        ethBuilder.setEthType(new EtherType(46));
+        entryBuilder.addAugmentation(EthTypeMatchEntry.class, ethBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(VlanVid.class);
+        entryBuilder.setHasMask(true);
+        VlanVidMatchEntryBuilder vidBuilder = new VlanVidMatchEntryBuilder();
+        vidBuilder.setCfiBit(true);
+        vidBuilder.setVlanVid(45);
+        entryBuilder.addAugmentation(VlanVidMatchEntry.class, vidBuilder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,9});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(VlanPcp.class);
+        entryBuilder.setHasMask(false);
+        VlanPcpMatchEntryBuilder pcpBuilder = new VlanPcpMatchEntryBuilder();
+        pcpBuilder.setVlanPcp((short) 14);
+        entryBuilder.addAugmentation(VlanPcpMatchEntry.class, pcpBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(IpDscp.class);
+        entryBuilder.setHasMask(false);
+        DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();
+        dscpBuilder.setDscp(new Dscp((short) 48));
+        entryBuilder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(IpEcn.class);
+        entryBuilder.setHasMask(false);
+        EcnMatchEntryBuilder ecnBuilder = new EcnMatchEntryBuilder();
+        ecnBuilder.setEcn((short) 49);
+        entryBuilder.addAugmentation(EcnMatchEntry.class, ecnBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(IpProto.class);
+        entryBuilder.setHasMask(false);
+        ProtocolNumberMatchEntryBuilder protoBuilder = new ProtocolNumberMatchEntryBuilder();
+        protoBuilder.setProtocolNumber((short) 50);
+        entryBuilder.addAugmentation(ProtocolNumberMatchEntry.class, protoBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Ipv4Src.class);
+        entryBuilder.setHasMask(true);
+        Ipv4AddressMatchEntryBuilder ipv4Builder = new Ipv4AddressMatchEntryBuilder();
+        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.1"));
+        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,0,14});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Ipv4Dst.class);
+        entryBuilder.setHasMask(true);
+        ipv4Builder = new Ipv4AddressMatchEntryBuilder();
+        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.2"));
+        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,0,15});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(TcpSrc.class);
+        entryBuilder.setHasMask(false);
+        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6653));
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(TcpDst.class);
+        entryBuilder.setHasMask(false);
+        portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6654));
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(UdpSrc.class);
+        entryBuilder.setHasMask(false);
+        portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6655));
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(UdpDst.class);
+        entryBuilder.setHasMask(false);
+        portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6656));
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(SctpSrc.class);
+        entryBuilder.setHasMask(false);
+        portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6657));
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(SctpDst.class);
+        entryBuilder.setHasMask(false);
+        portBuilder = new PortMatchEntryBuilder();
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6658));
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Icmpv4Type.class);
+        entryBuilder.setHasMask(false);
+        Icmpv4TypeMatchEntryBuilder icmpv4typeBuilder = new Icmpv4TypeMatchEntryBuilder();
+        icmpv4typeBuilder.setIcmpv4Type((short) 51);
+        entryBuilder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4typeBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Icmpv4Code.class);
+        entryBuilder.setHasMask(false);
+        Icmpv4CodeMatchEntryBuilder icmpv4CodeBuilder = new Icmpv4CodeMatchEntryBuilder();
+        icmpv4CodeBuilder.setIcmpv4Code((short) 52);
+        entryBuilder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4CodeBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(ArpOp.class);
+        entryBuilder.setHasMask(false);
+        OpCodeMatchEntryBuilder opBuilder = new OpCodeMatchEntryBuilder();
+        opBuilder.setOpCode(53);
+        entryBuilder.addAugmentation(OpCodeMatchEntry.class, opBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(ArpSpa.class);
+        entryBuilder.setHasMask(true);
+        ipv4Builder = new Ipv4AddressMatchEntryBuilder();
+        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.4"));
+        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,0,16});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(ArpTpa.class);
+        entryBuilder.setHasMask(true);
+        ipv4Builder = new Ipv4AddressMatchEntryBuilder();
+        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.5"));
+        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,0,17});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(ArpSha.class);
+        entryBuilder.setHasMask(true);
+        macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress("00:01:02:03:04:05"));
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,4,0,0,6});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(ArpTha.class);
+        entryBuilder.setHasMask(true);
+        macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress("00:00:00:00:00:03"));
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,6,0,0,4});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Ipv6Src.class);
+        entryBuilder.setHasMask(true);
+        Ipv6AddressMatchEntryBuilder ipv6Builder = new Ipv6AddressMatchEntryBuilder();
+        ipv6Builder.setIpv6Address(new Ipv6Address("0:0:0:0:0:0:0:1"));
+        entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Ipv6Dst.class);
+        entryBuilder.setHasMask(true);
+        ipv6Builder = new Ipv6AddressMatchEntryBuilder();
+        ipv6Builder.setIpv6Address(new Ipv6Address("0:0:1:0:1:0:0:1"));
+        entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Ipv6Flabel.class);
+        entryBuilder.setHasMask(true);
+        Ipv6FlabelMatchEntryBuilder flabelBuilder = new Ipv6FlabelMatchEntryBuilder();
+        flabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(58L));
+        entryBuilder.addAugmentation(Ipv6FlabelMatchEntry.class, flabelBuilder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,1,0,2});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Icmpv6Type.class);
+        entryBuilder.setHasMask(false);
+        Icmpv6TypeMatchEntryBuilder icmpv6TypeBuilder = new Icmpv6TypeMatchEntryBuilder();
+        icmpv6TypeBuilder.setIcmpv6Type((short) 59);
+        entryBuilder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6TypeBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Icmpv6Code.class);
+        entryBuilder.setHasMask(false);
+        Icmpv6CodeMatchEntryBuilder icmpv6CodeBuilder = new Icmpv6CodeMatchEntryBuilder();
+        icmpv6CodeBuilder.setIcmpv6Code((short) 60);
+        entryBuilder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6CodeBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Ipv6NdTarget.class);
+        entryBuilder.setHasMask(false);
+        ipv6Builder = new Ipv6AddressMatchEntryBuilder();
+        ipv6Builder.setIpv6Address(new Ipv6Address("F:0:0::0:0:0:1"));
+        entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Ipv6NdSll.class);
+        entryBuilder.setHasMask(false);
+        macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress("01:00:03:00:00:06"));
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Ipv6NdTll.class);
+        entryBuilder.setHasMask(false);
+        macBuilder = new MacAddressMatchEntryBuilder();
+        macBuilder.setMacAddress(new MacAddress("04:00:02:00:00:08"));
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(MplsLabel.class);
+        entryBuilder.setHasMask(false);
+        MplsLabelMatchEntryBuilder labelBuilder = new MplsLabelMatchEntryBuilder();
+        labelBuilder.setMplsLabel(61L);
+        entryBuilder.addAugmentation(MplsLabelMatchEntry.class, labelBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(MplsTc.class);
+        entryBuilder.setHasMask(false);
+        TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();
+        tcBuilder.setTc((short) 62);
+        entryBuilder.addAugmentation(TcMatchEntry.class, tcBuilder.build());
+        entries.add(entryBuilder.build());
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(MplsBos.class);
+        entryBuilder.setHasMask(false);
+        BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();
+        bosBuilder.setBos(true);
+        entryBuilder.addAugmentation(BosMatchEntry.class, bosBuilder.build());
+        entries.add(entryBuilder.build());
+        
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(PbbIsid.class);
+        entryBuilder.setHasMask(true);
+        IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();
+        isidBuilder.setIsid(64L);
+        entryBuilder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,1,2});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(TunnelId.class);
+        entryBuilder.setHasMask(true);
+        metadataBuilder = new MetadataMatchEntryBuilder();
+        metadataBuilder.setMetadata(new byte[]{0,0,0,0,0,0,0,1});
+        entryBuilder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,2});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        
+        entryBuilder = new MatchEntriesBuilder();
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);
+        entryBuilder.setOxmMatchField(Ipv6Exthdr.class);
+        entryBuilder.setHasMask(true);
+        PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();
+        pseudoBuilder.setPseudoField(new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true));
+        entryBuilder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());
+        maskBuilder = new MaskMatchEntryBuilder();
+        maskBuilder.setMask(new byte[]{0,2});
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
+        entries.add(entryBuilder.build());
+        
+        
+        
+        builder.setMatchEntries(entries);
+        Match match = builder.build();
+        
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        matchSerializer.serialize(match, out);
+        
+        Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match length", 428, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 0, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 42, out.readUnsignedInt());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 2, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 43, out.readUnsignedInt());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 5, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 1L, out.readLong());
+        Assert.assertEquals("Wrong match entry mask", 2L, out.readLong());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 7, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());
+        byte[] array = new byte[6];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{1,0,3,0,0,6}, array);
+        array = new byte[6];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,5}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 9, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());
+        array = new byte[6];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{4,0,2,0,0,8}, array);
+        array = new byte[6];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,2}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 10, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 46, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 13, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 4141, out.readUnsignedShort());
+        array = new byte[2];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,9}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 14, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 14, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 16, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 48, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 18, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 49, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 20, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 50, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 23, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());
+        array = new byte[4];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,1}, array);
+        array = new byte[4];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,14}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 25, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());
+        array = new byte[4];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,2}, array);
+        array = new byte[4];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,15}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 26, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 6653, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 28, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 6654, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 30, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 6655, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 32, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 6656, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 34, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 6657, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 36, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 6658, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 38, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 51, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 40, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 52, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 42, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 53, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 45, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());
+        array = new byte[4];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,4}, array);
+        array = new byte[4];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,16}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 47, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());
+        array = new byte[4];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,5}, array);
+        array = new byte[4];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,17}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 49, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());
+        array = new byte[6];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,1,2,3,4,5}, array);
+        array = new byte[6];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,4,0,0,6}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 51, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());
+        array = new byte[6];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,3}, array);
+        array = new byte[6];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,6,0,0,4}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 53, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 32, out.readUnsignedByte());
+        array = new byte[16];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);
+        array = new byte[16];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 55, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 32, out.readUnsignedByte());
+        array = new byte[16];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1}, array);
+        array = new byte[16];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 57, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 58, out.readUnsignedInt());
+        array = new byte[4];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,1,0,2}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 58, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 59, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 60, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 60, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 62, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());
+        array = new byte[16];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 64, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());
+        array = new byte[6];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{1,0,3,0,0,6}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 66, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());
+        array = new byte[6];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{4,0,2,0,0,8}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 68, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 61, out.readUnsignedInt());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 70, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 62, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 72, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 1, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 75, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 64, out.readUnsignedMedium());
+        array = new byte[3];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,1,2}, array);
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 77, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 1L, out.readLong());
+        Assert.assertEquals("Wrong match entry mask", 2L, out.readLong());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & hasMask", 79, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 358, out.readUnsignedShort());
+        array = new byte[2];
+        out.readBytes(array);
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,2}, array);
+        Assert.assertTrue("Wrong padding", out.readableBytes() == 4);
+    }
+
+}
index 47e92623d6f3ce3e67c5c036798945b0203f597b..4a1ceb78585b200fb9cc501e8a2dffb6aad11e47 100644 (file)
@@ -1,68 +1,68 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OpenflowUtilsTest {\r
-\r
-    /**\r
-     * Tests {@link OpenflowUtils#createPortState(long)}\r
-     */\r
-    @Test\r
-    public void testPortState() {\r
-        PortStateV10 state = OpenflowUtils.createPortState(512L);\r
-        Assert.assertEquals("Wrong port state",\r
-                new PortStateV10(false, false, false, false, true, false, true, false), state);\r
-\r
-        state = OpenflowUtils.createPortState(1793L);\r
-        Assert.assertEquals("Wrong port state",\r
-                new PortStateV10(false, true, false, true, true, true, false, true), state);\r
-\r
-        state = OpenflowUtils.createPortState(1L);\r
-        Assert.assertEquals("Wrong port state",\r
-                new PortStateV10(false, true, false, false, false, false, true, false), state);\r
-    }\r
-\r
-    /**\r
-     * Tests {@link OpenflowUtils#createPortConfig(long)}\r
-     */\r
-    @Test\r
-    public void testPortConfig() {\r
-        PortConfigV10 config = OpenflowUtils.createPortConfig(127L);\r
-        Assert.assertEquals("Wrong port config",\r
-                new PortConfigV10(true, true, true, true, true, true, true), config);\r
-\r
-        config = OpenflowUtils.createPortConfig(0L);\r
-        Assert.assertEquals("Wrong port config",\r
-                new PortConfigV10(false, false, false, false, false, false, false), config);\r
-    }\r
-\r
-    /**\r
-     * Tests {@link OpenflowUtils#createPortFeatures(long)}\r
-     */\r
-    @Test\r
-    public void testPortFeatures() {\r
-        PortFeaturesV10 features = OpenflowUtils.createPortFeatures(4095L);\r
-        Assert.assertEquals("Wrong port features", new PortFeaturesV10(true, true, true, true, true, true, true,\r
-                true, true, true, true, true), features);\r
-\r
-        features = OpenflowUtils.createPortFeatures(0L);\r
-        Assert.assertEquals("Wrong port features", new PortFeaturesV10(false, false, false, false, false, false,\r
-                false, false, false, false, false, false), features);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OpenflowUtilsTest {
+
+    /**
+     * Tests {@link OpenflowUtils#createPortState(long)}
+     */
+    @Test
+    public void testPortState() {
+        PortStateV10 state = OpenflowUtils.createPortState(512L);
+        Assert.assertEquals("Wrong port state",
+                new PortStateV10(false, false, false, false, true, false, true, false), state);
+
+        state = OpenflowUtils.createPortState(1793L);
+        Assert.assertEquals("Wrong port state",
+                new PortStateV10(false, true, false, true, true, true, false, true), state);
+
+        state = OpenflowUtils.createPortState(1L);
+        Assert.assertEquals("Wrong port state",
+                new PortStateV10(false, true, false, false, false, false, true, false), state);
+    }
+
+    /**
+     * Tests {@link OpenflowUtils#createPortConfig(long)}
+     */
+    @Test
+    public void testPortConfig() {
+        PortConfigV10 config = OpenflowUtils.createPortConfig(127L);
+        Assert.assertEquals("Wrong port config",
+                new PortConfigV10(true, true, true, true, true, true, true), config);
+
+        config = OpenflowUtils.createPortConfig(0L);
+        Assert.assertEquals("Wrong port config",
+                new PortConfigV10(false, false, false, false, false, false, false), config);
+    }
+
+    /**
+     * Tests {@link OpenflowUtils#createPortFeatures(long)}
+     */
+    @Test
+    public void testPortFeatures() {
+        PortFeaturesV10 features = OpenflowUtils.createPortFeatures(4095L);
+        Assert.assertEquals("Wrong port features", new PortFeaturesV10(true, true, true, true, true, true, true,
+                true, true, true, true, true), features);
+
+        features = OpenflowUtils.createPortFeatures(0L);
+        Assert.assertEquals("Wrong port features", new PortFeaturesV10(false, false, false, false, false, false,
+                false, false, false, false, false, false), features);
+    }
 }
\ No newline at end of file
index c58a119af1eeb1cb41cd0a28ac1ece33abdae2a6..ba445321416c2a2b9aa95803bef95abdc61d8399 100644 (file)
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.util;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntryBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class TypeKeyMakerFactoryTest {\r
-\r
-    /**\r
-     * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testActionKeyMaker() {\r
-        TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
-        ActionBuilder builder = new ActionBuilder();\r
-        builder.setType(Output.class);\r
-        Action action = builder.build();\r
-        MessageTypeKey<?> key = keyMaker.make(action);\r
-\r
-        Assert.assertNotNull("Null key", key);\r
-        Assert.assertEquals("Wrong key", new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
-                        Output.class, null), key);\r
-    }\r
-\r
-    /**\r
-     * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testExperimenterActionKeyMaker() {\r
-        TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
-        ActionBuilder builder = new ActionBuilder();\r
-        builder.setType(Experimenter.class);\r
-        ExperimenterIdActionBuilder expIdBuilder = new ExperimenterIdActionBuilder();\r
-        expIdBuilder.setExperimenter(new ExperimenterId(42L));\r
-        expIdBuilder.setSubType(ActionSubtypeClass.class);\r
-        builder.addAugmentation(ExperimenterIdAction.class, expIdBuilder.build());\r
-        Action action = builder.build();\r
-        MessageTypeKey<?> key = keyMaker.make(action);\r
-\r
-        Assert.assertNotNull("Null key", key);\r
-        Assert.assertEquals("Wrong key", new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L,\r
-                ActionSubtypeClass.class), key);\r
-    }\r
-\r
-    /**\r
-     * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testInstructionKeyMaker() {\r
-        TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
-        InstructionBuilder builder = new InstructionBuilder();\r
-        builder.setType(GotoTable.class);\r
-        Instruction instruction = builder.build();\r
-        MessageTypeKey<?> key = keyMaker.make(instruction);\r
-\r
-        Assert.assertNotNull("Null key", key);\r
-        Assert.assertEquals("Wrong key", new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
-                        GotoTable.class, null), key);\r
-    }\r
-\r
-    /**\r
-     * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testExperimenterInstructionKeyMaker() {\r
-        TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
-        InstructionBuilder builder = new InstructionBuilder();\r
-        builder.setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow\r
-                .common.instruction.rev130731.Experimenter.class);\r
-        ExperimenterIdInstructionBuilder expIdBuilder = new ExperimenterIdInstructionBuilder();\r
-        expIdBuilder.setExperimenter(new ExperimenterId(42L));\r
-        builder.addAugmentation(ExperimenterIdInstruction.class, expIdBuilder.build());\r
-        Instruction instruction = builder.build();\r
-        MessageTypeKey<?> key = keyMaker.make(instruction);\r
-\r
-        Assert.assertNotNull("Null key", key);\r
-        Assert.assertEquals("Wrong key", new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID,\r
-                        42L), key);\r
-    }\r
-\r
-    /**\r
-     * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testMatchEntriesKeyMaker() {\r
-        TypeKeyMaker<MatchEntries> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(OpenflowBasicClass.class);\r
-        builder.setOxmMatchField(InPort.class);\r
-        builder.setHasMask(true);\r
-        MatchEntries entry = builder.build();\r
-        MessageTypeKey<?> key = keyMaker.make(entry);\r
-\r
-        Assert.assertNotNull("Null key", key);\r
-        MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
-                OpenflowBasicClass.class, InPort.class);\r
-        Assert.assertEquals("Wrong key", comparationKey, key);\r
-    }\r
-\r
-    /**\r
-     * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}\r
-     */\r
-    @Test\r
-    public void testExperimenterMatchEntriesKeyMaker() {\r
-        TypeKeyMaker<MatchEntries> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);\r
-        Assert.assertNotNull("Null keyMaker", keyMaker);\r
-\r
-        MatchEntriesBuilder builder = new MatchEntriesBuilder();\r
-        builder.setOxmClass(ExperimenterClass.class);\r
-        builder.setOxmMatchField(OxmMatchFieldClass.class);\r
-        builder.setHasMask(true);\r
-        ExperimenterIdMatchEntryBuilder expIdBuilder = new ExperimenterIdMatchEntryBuilder();\r
-        expIdBuilder.setExperimenter(new ExperimenterId(42L));\r
-        builder.addAugmentation(ExperimenterIdMatchEntry.class, expIdBuilder.build());\r
-        MatchEntries entry = builder.build();\r
-        MessageTypeKey<?> key = keyMaker.make(entry);\r
-\r
-        Assert.assertNotNull("Null key", key);\r
-        MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,\r
-                ExperimenterClass.class, OxmMatchFieldClass.class);\r
-        comparationKey.setExperimenterId(42L);\r
-        Assert.assertEquals("Wrong key", comparationKey, key);\r
-    }\r
-\r
-    private class ActionSubtypeClass extends ExperimenterActionSubType {\r
-        // only for testing purposes\r
-    }\r
-\r
-    private class OxmMatchFieldClass extends MatchField {\r
-        // only for testing purposes\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class TypeKeyMakerFactoryTest {
+
+    /**
+     * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}
+     */
+    @Test
+    public void testActionKeyMaker() {
+        TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null keyMaker", keyMaker);
+
+        ActionBuilder builder = new ActionBuilder();
+        builder.setType(Output.class);
+        Action action = builder.build();
+        MessageTypeKey<?> key = keyMaker.make(action);
+
+        Assert.assertNotNull("Null key", key);
+        Assert.assertEquals("Wrong key", new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+                        Output.class, null), key);
+    }
+
+    /**
+     * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}
+     */
+    @Test
+    public void testExperimenterActionKeyMaker() {
+        TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null keyMaker", keyMaker);
+
+        ActionBuilder builder = new ActionBuilder();
+        builder.setType(Experimenter.class);
+        ExperimenterIdActionBuilder expIdBuilder = new ExperimenterIdActionBuilder();
+        expIdBuilder.setExperimenter(new ExperimenterId(42L));
+        expIdBuilder.setSubType(ActionSubtypeClass.class);
+        builder.addAugmentation(ExperimenterIdAction.class, expIdBuilder.build());
+        Action action = builder.build();
+        MessageTypeKey<?> key = keyMaker.make(action);
+
+        Assert.assertNotNull("Null key", key);
+        Assert.assertEquals("Wrong key", new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L,
+                ActionSubtypeClass.class), key);
+    }
+
+    /**
+     * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}
+     */
+    @Test
+    public void testInstructionKeyMaker() {
+        TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null keyMaker", keyMaker);
+
+        InstructionBuilder builder = new InstructionBuilder();
+        builder.setType(GotoTable.class);
+        Instruction instruction = builder.build();
+        MessageTypeKey<?> key = keyMaker.make(instruction);
+
+        Assert.assertNotNull("Null key", key);
+        Assert.assertEquals("Wrong key", new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+                        GotoTable.class, null), key);
+    }
+
+    /**
+     * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}
+     */
+    @Test
+    public void testExperimenterInstructionKeyMaker() {
+        TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null keyMaker", keyMaker);
+
+        InstructionBuilder builder = new InstructionBuilder();
+        builder.setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow
+                .common.instruction.rev130731.Experimenter.class);
+        ExperimenterIdInstructionBuilder expIdBuilder = new ExperimenterIdInstructionBuilder();
+        expIdBuilder.setExperimenter(new ExperimenterId(42L));
+        builder.addAugmentation(ExperimenterIdInstruction.class, expIdBuilder.build());
+        Instruction instruction = builder.build();
+        MessageTypeKey<?> key = keyMaker.make(instruction);
+
+        Assert.assertNotNull("Null key", key);
+        Assert.assertEquals("Wrong key", new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID,
+                        42L), key);
+    }
+
+    /**
+     * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+     */
+    @Test
+    public void testMatchEntriesKeyMaker() {
+        TypeKeyMaker<MatchEntries> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null keyMaker", keyMaker);
+
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(OpenflowBasicClass.class);
+        builder.setOxmMatchField(InPort.class);
+        builder.setHasMask(true);
+        MatchEntries entry = builder.build();
+        MessageTypeKey<?> key = keyMaker.make(entry);
+
+        Assert.assertNotNull("Null key", key);
+        MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+                OpenflowBasicClass.class, InPort.class);
+        Assert.assertEquals("Wrong key", comparationKey, key);
+    }
+
+    /**
+     * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+     */
+    @Test
+    public void testExperimenterMatchEntriesKeyMaker() {
+        TypeKeyMaker<MatchEntries> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+        Assert.assertNotNull("Null keyMaker", keyMaker);
+
+        MatchEntriesBuilder builder = new MatchEntriesBuilder();
+        builder.setOxmClass(ExperimenterClass.class);
+        builder.setOxmMatchField(OxmMatchFieldClass.class);
+        builder.setHasMask(true);
+        ExperimenterIdMatchEntryBuilder expIdBuilder = new ExperimenterIdMatchEntryBuilder();
+        expIdBuilder.setExperimenter(new ExperimenterId(42L));
+        builder.addAugmentation(ExperimenterIdMatchEntry.class, expIdBuilder.build());
+        MatchEntries entry = builder.build();
+        MessageTypeKey<?> key = keyMaker.make(entry);
+
+        Assert.assertNotNull("Null key", key);
+        MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
+                ExperimenterClass.class, OxmMatchFieldClass.class);
+        comparationKey.setExperimenterId(42L);
+        Assert.assertEquals("Wrong key", comparationKey, key);
+    }
+
+    private class ActionSubtypeClass extends ExperimenterActionSubType {
+        // only for testing purposes
+    }
+
+    private class OxmMatchFieldClass extends MatchField {
+        // only for testing purposes
+    }
 }
\ No newline at end of file
index 23b1b663af6ea90cec0bde764656fb859c5ccbaf..34512d51823e39b2894cc6c4f44051afd51c51ae 100644 (file)
@@ -1,24 +1,24 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">\r
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">\r
-\r
-    <appender name="console" class="org.apache.log4j.ConsoleAppender">\r
-        <layout class="org.apache.log4j.PatternLayout">\r
-            <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />\r
-        </layout>\r
-    </appender>\r
-\r
-    <logger name="org.opendaylight.openflowjava.protocol.impl.integration" additivity="false">\r
-        <level value="DEBUG" />\r
-        <appender-ref ref="console" />\r
-    </logger>\r
-    <logger name="org.opendaylight.openflowjava.protocol.impl.clients" additivity="false">\r
-        <level value="DEBUG" />\r
-        <appender-ref ref="console" />\r
-    </logger>\r
-\r
-    <root>\r
-        <priority value="INFO" />\r
-        <appender-ref ref="console" />\r
-    </root>\r
-</log4j:configuration>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+    <appender name="console" class="org.apache.log4j.ConsoleAppender">
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />
+        </layout>
+    </appender>
+
+    <logger name="org.opendaylight.openflowjava.protocol.impl.integration" additivity="false">
+        <level value="DEBUG" />
+        <appender-ref ref="console" />
+    </logger>
+    <logger name="org.opendaylight.openflowjava.protocol.impl.clients" additivity="false">
+        <level value="DEBUG" />
+        <appender-ref ref="console" />
+    </logger>
+
+    <root>
+        <priority value="INFO" />
+        <appender-ref ref="console" />
+    </root>
+</log4j:configuration>
index c5d7a6aaab0333eae5c0308e51ee3fbb8831adaf..1d2c580b9d5665fc1ed00b10f9e3880ca72ad4b8 100644 (file)
@@ -1,28 +1,28 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.spi.statistics;\r
-\r
-/**\r
- * Used for JConsole service\r
- * \r
- * @author michal.polkorab\r
- */\r
-public interface StatisticsHandler {\r
-\r
-    /**\r
-     * Resets all counters\r
-     */\r
-    public void resetCounters();\r
-\r
-    /**\r
-     * Prints statistics\r
-     * @return statistics\r
-     */\r
-    public String printStatistics();\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.spi.statistics;
+
+/**
+ * Used for JConsole service
+ * 
+ * @author michal.polkorab
+ */
+public interface StatisticsHandler {
+
+    /**
+     * Resets all counters
+     */
+    public void resetCounters();
+
+    /**
+     * Prints statistics
+     * @return statistics
+     */
+    public String printStatistics();
 }
\ No newline at end of file
index 60647655d774c62d3d3565df1322f631bdd67655..91edd9e86c5da7628d8debc774cbc43d2718b580 100644 (file)
@@ -1,53 +1,53 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!-- Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. \r
-    This program and the accompanying materials are made available under the \r
-    terms of the Eclipse Public License v1.0 which accompanies this distribution, \r
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 
+    This program and the accompanying materials are made available under the 
+    terms of the Eclipse Public License v1.0 which accompanies this distribution, 
     and is available at http://www.eclipse.org/legal/epl-v10.html -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
-\r
-    <modelVersion>4.0.0</modelVersion>\r
-\r
-    <parent>\r
-        <groupId>org.opendaylight.openflowjava</groupId>\r
-        <artifactId>openflow-protocol-parent</artifactId>\r
-        <version>0.6.0-SNAPSHOT</version>\r
-    </parent>\r
-    <artifactId>openflowjava-config</artifactId>\r
-    <description>Configuration files for openflowjava statistics</description>\r
-    <packaging>jar</packaging>\r
-    <name>Openflow Protocol Library - CONFIG</name>\r
-    <scm>\r
-        <url>https://wiki.opendaylight.org/view/Openflow_Protocol_Library:Main</url>\r
-        <tag>HEAD</tag>\r
-    </scm>\r
-    <properties>\r
-        <configfile>45-openflowjava-stats.xml</configfile>\r
-    </properties>\r
-    <build>\r
-        <plugins>\r
-            <plugin>\r
-                <groupId>org.codehaus.mojo</groupId>\r
-                <artifactId>build-helper-maven-plugin</artifactId>\r
-                <executions>\r
-                    <execution>\r
-                        <id>attach-artifacts</id>\r
-                        <goals>\r
-                            <goal>attach-artifact</goal>\r
-                        </goals>\r
-                        <phase>package</phase>\r
-                        <configuration>\r
-                            <artifacts>\r
-                                <artifact>\r
-                                    <file>${project.build.directory}/classes/${configfile}</file>\r
-                                    <type>xml</type>\r
-                                    <classifier>configstats</classifier>\r
-                                </artifact>\r
-                            </artifacts>\r
-                        </configuration>\r
-                    </execution>\r
-                </executions>\r
-            </plugin>\r
-        </plugins>\r
-    </build>\r
-</project>\r
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.opendaylight.openflowjava</groupId>
+        <artifactId>openflow-protocol-parent</artifactId>
+        <version>0.6.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>openflowjava-config</artifactId>
+    <description>Configuration files for openflowjava statistics</description>
+    <packaging>jar</packaging>
+    <name>Openflow Protocol Library - CONFIG</name>
+    <scm>
+        <url>https://wiki.opendaylight.org/view/Openflow_Protocol_Library:Main</url>
+        <tag>HEAD</tag>
+    </scm>
+    <properties>
+        <configfile>45-openflowjava-stats.xml</configfile>
+    </properties>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-artifacts</id>
+                        <goals>
+                            <goal>attach-artifact</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            <artifacts>
+                                <artifact>
+                                    <file>${project.build.directory}/classes/${configfile}</file>
+                                    <type>xml</type>
+                                    <classifier>configstats</classifier>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
index 12761959b26db9eed424d19b1cb01cd398dcc1a3..882d7e181ee6c3b2b0c22edade5dc864a652e8a6 100644 (file)
@@ -1,41 +1,41 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!-- vi: set et smarttab sw=4 tabstop=4: -->\r
-<!--\r
-Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
-\r
-This program and the accompanying materials are made available under the\r
-terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
-and is available at http://www.eclipse.org/legal/epl-v10.html\r
--->\r
-<snapshot>\r
-  <required-capabilities>\r
-    <!-- openflowjava -->\r
-    <capability>urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider:impl?module=openflow-switch-connection-provider-impl&amp;revision=2014-03-28</capability>\r
-    <capability>urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider?module=openflow-switch-connection-provider&amp;revision=2014-03-28</capability>\r
-  </required-capabilities>\r
-\r
-  <configuration>\r
-\r
-    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">\r
-      <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">\r
-        <module>\r
-            <type xmlns:stats="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider:impl">stats:statistics-collection-service-impl</type>\r
-            <name>statistics-collection-service-impl</name>\r
-            <statistics>\r
-                <statistics-collect>true</statistics-collect>\r
-                <log-report-delay>10000</log-report-delay>\r
-            </statistics>\r
-            <openflow-switch-connection-provider>\r
-                <type xmlns:ofSwitch="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider">ofSwitch:openflow-switch-connection-provider</type>\r
-                <name>openflow-switch-connection-provider-default</name>\r
-            </openflow-switch-connection-provider>\r
-            <openflow-switch-connection-provider>\r
-                <type xmlns:ofSwitch="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider">ofSwitch:openflow-switch-connection-provider</type>\r
-                <name>openflow-switch-connection-provider-legacy</name>\r
-            </openflow-switch-connection-provider>\r
-        </module>\r
-      </modules>\r
-    </data>\r
-\r
-  </configuration>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<snapshot>
+  <required-capabilities>
+    <!-- openflowjava -->
+    <capability>urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider:impl?module=openflow-switch-connection-provider-impl&amp;revision=2014-03-28</capability>
+    <capability>urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider?module=openflow-switch-connection-provider&amp;revision=2014-03-28</capability>
+  </required-capabilities>
+
+  <configuration>
+
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+      <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+        <module>
+            <type xmlns:stats="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider:impl">stats:statistics-collection-service-impl</type>
+            <name>statistics-collection-service-impl</name>
+            <statistics>
+                <statistics-collect>true</statistics-collect>
+                <log-report-delay>10000</log-report-delay>
+            </statistics>
+            <openflow-switch-connection-provider>
+                <type xmlns:ofSwitch="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider">ofSwitch:openflow-switch-connection-provider</type>
+                <name>openflow-switch-connection-provider-default</name>
+            </openflow-switch-connection-provider>
+            <openflow-switch-connection-provider>
+                <type xmlns:ofSwitch="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:provider">ofSwitch:openflow-switch-connection-provider</type>
+                <name>openflow-switch-connection-provider-legacy</name>
+            </openflow-switch-connection-provider>
+        </module>
+      </modules>
+    </data>
+
+  </configuration>
 </snapshot>
\ No newline at end of file
index 0d4046ef44a3a59f7cee2511cd9ad00d91b9bcd1..02a2199a5e527b243e1e358410884a1b7341a299 100644 (file)
@@ -1,40 +1,40 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.clients;\r
-\r
-import com.google.common.util.concurrent.SettableFuture;\r
-\r
-/**\r
- * Unifying interface for simple clients / switch simulators\r
- * \r
- * @author michal.polkorab\r
- */\r
-public interface OFClient extends Runnable {\r
-\r
-    /**\r
-     * @return the isOnlineFuture which is set when client is started\r
-     */\r
-    SettableFuture<Boolean> getIsOnlineFuture();\r
-\r
-    /**\r
-     * @return the scenarioDone when scenario is successfully finished\r
-     */\r
-    SettableFuture<Boolean> getScenarioDone();\r
-\r
-    /**\r
-     * @param scenario list of desired actions\r
-     */\r
-    void setScenarioHandler(ScenarioHandler scenario);\r
-\r
-    /**\r
-     * @param securedClient true is client should use encrypted communication,\r
-     * false otherwise\r
-     */\r
-    void setSecuredClient(boolean securedClient);\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.clients;
+
+import com.google.common.util.concurrent.SettableFuture;
+
+/**
+ * Unifying interface for simple clients / switch simulators
+ * 
+ * @author michal.polkorab
+ */
+public interface OFClient extends Runnable {
+
+    /**
+     * @return the isOnlineFuture which is set when client is started
+     */
+    SettableFuture<Boolean> getIsOnlineFuture();
+
+    /**
+     * @return the scenarioDone when scenario is successfully finished
+     */
+    SettableFuture<Boolean> getScenarioDone();
+
+    /**
+     * @param scenario list of desired actions
+     */
+    void setScenarioHandler(ScenarioHandler scenario);
+
+    /**
+     * @param securedClient true is client should use encrypted communication,
+     * false otherwise
+     */
+    void setSecuredClient(boolean securedClient);
 }
\ No newline at end of file
index d24d6d3fb003f5379a5493984f63bf2933dfc196..8ef85bc4272bdc8e5f18ad6c9609831efdacf0e2 100644 (file)
@@ -1,84 +1,84 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class ExperimenterDeserializerKeyFactory {\r
-\r
-    /**\r
-     * @param version openflow wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @return key instance\r
-     */\r
-    public static ExperimenterIdDeserializerKey createExperimenterErrorDeserializerKey(\r
-            short version, Long experimenterId) {\r
-        return new ExperimenterIdDeserializerKey(version, experimenterId, ErrorMessage.class);\r
-    }\r
-\r
-    /**\r
-     * @param version openflow wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @return key instance\r
-     */\r
-    public static ExperimenterIdDeserializerKey createExperimenterMessageDeserializerKey(\r
-            short version, Long experimenterId) {\r
-        return new ExperimenterIdDeserializerKey(version, experimenterId, ExperimenterMessage.class);\r
-    }\r
-\r
-    /**\r
-     * @param version openflow wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @return key instance\r
-     */\r
-    public static ExperimenterIdDeserializerKey createMultipartReplyMessageDeserializerKey(\r
-            short version, Long experimenterId) {\r
-        return new ExperimenterIdDeserializerKey(version, experimenterId, MultipartReplyExperimenterCase.class);\r
-    }\r
-\r
-    /**\r
-     * @param version openflow wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @return key instance\r
-     */\r
-    public static ExperimenterIdDeserializerKey createMultipartReplyTFDeserializerKey(\r
-            short version, Long experimenterId) {\r
-        return new ExperimenterIdDeserializerKey(version, experimenterId, TableFeatureProperties.class);\r
-    }\r
-\r
-    /**\r
-     * @param version openflow wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @return key instance\r
-     */\r
-    public static ExperimenterIdDeserializerKey createQueuePropertyDeserializerKey(\r
-            short version, Long experimenterId) {\r
-        return new ExperimenterIdDeserializerKey(version, experimenterId, QueueProperty.class);\r
-    }\r
-\r
-    /**\r
-     * @param version openflow wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @return key instance\r
-     */\r
-    public static ExperimenterIdDeserializerKey createMeterBandDeserializerKey(\r
-            short version, Long experimenterId) {\r
-        return new ExperimenterIdDeserializerKey(version, experimenterId, MeterBandExperimenterCase.class);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.util;
+
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class ExperimenterDeserializerKeyFactory {
+
+    /**
+     * @param version openflow wire version
+     * @param experimenterId experimenter / vendor ID
+     * @return key instance
+     */
+    public static ExperimenterIdDeserializerKey createExperimenterErrorDeserializerKey(
+            short version, Long experimenterId) {
+        return new ExperimenterIdDeserializerKey(version, experimenterId, ErrorMessage.class);
+    }
+
+    /**
+     * @param version openflow wire version
+     * @param experimenterId experimenter / vendor ID
+     * @return key instance
+     */
+    public static ExperimenterIdDeserializerKey createExperimenterMessageDeserializerKey(
+            short version, Long experimenterId) {
+        return new ExperimenterIdDeserializerKey(version, experimenterId, ExperimenterMessage.class);
+    }
+
+    /**
+     * @param version openflow wire version
+     * @param experimenterId experimenter / vendor ID
+     * @return key instance
+     */
+    public static ExperimenterIdDeserializerKey createMultipartReplyMessageDeserializerKey(
+            short version, Long experimenterId) {
+        return new ExperimenterIdDeserializerKey(version, experimenterId, MultipartReplyExperimenterCase.class);
+    }
+
+    /**
+     * @param version openflow wire version
+     * @param experimenterId experimenter / vendor ID
+     * @return key instance
+     */
+    public static ExperimenterIdDeserializerKey createMultipartReplyTFDeserializerKey(
+            short version, Long experimenterId) {
+        return new ExperimenterIdDeserializerKey(version, experimenterId, TableFeatureProperties.class);
+    }
+
+    /**
+     * @param version openflow wire version
+     * @param experimenterId experimenter / vendor ID
+     * @return key instance
+     */
+    public static ExperimenterIdDeserializerKey createQueuePropertyDeserializerKey(
+            short version, Long experimenterId) {
+        return new ExperimenterIdDeserializerKey(version, experimenterId, QueueProperty.class);
+    }
+
+    /**
+     * @param version openflow wire version
+     * @param experimenterId experimenter / vendor ID
+     * @return key instance
+     */
+    public static ExperimenterIdDeserializerKey createMeterBandDeserializerKey(
+            short version, Long experimenterId) {
+        return new ExperimenterIdDeserializerKey(version, experimenterId, MeterBandExperimenterCase.class);
+    }
 }
\ No newline at end of file
index 5d1fc635a73cd6503575ea71081bca2d1c5d493b..4ea333b6c555853792fd21dc72ed82e1e224a5e6 100644 (file)
@@ -1,62 +1,62 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.util;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public abstract class ExperimenterSerializerKeyFactory {\r
-\r
-    /**\r
-     * @param msgVersion openflow wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @return key instance\r
-     */\r
-    public static ExperimenterIdSerializerKey<ExperimenterInput> createExperimenterMessageSerializerKey(\r
-            short msgVersion, Long experimenterId) {\r
-        return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, ExperimenterInput.class);\r
-    }\r
-\r
-    /**\r
-     * @param msgVersion openflow wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @return key instance\r
-     */\r
-    public static ExperimenterIdSerializerKey<MultipartRequestExperimenterCase> createMultipartRequestSerializerKey(\r
-            short msgVersion, Long experimenterId) {\r
-        return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, MultipartRequestExperimenterCase.class);\r
-    }\r
-\r
-    /**\r
-     * @param msgVersion openflow wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @return key instance\r
-     */\r
-    public static ExperimenterIdSerializerKey<TableFeatureProperties> createMultipartRequestTFSerializerKey(\r
-            short msgVersion, Long experimenterId) {\r
-        return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, TableFeatureProperties.class);\r
-    }\r
-\r
-    /**\r
-     * @param msgVersion openflow wire version\r
-     * @param experimenterId experimenter / vendor ID\r
-     * @return key instance\r
-     */\r
-    public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(\r
-            short msgVersion, Long experimenterId) {\r
-        return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, MeterBandExperimenterCase.class);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.util;
+
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public abstract class ExperimenterSerializerKeyFactory {
+
+    /**
+     * @param msgVersion openflow wire version
+     * @param experimenterId experimenter / vendor ID
+     * @return key instance
+     */
+    public static ExperimenterIdSerializerKey<ExperimenterInput> createExperimenterMessageSerializerKey(
+            short msgVersion, Long experimenterId) {
+        return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, ExperimenterInput.class);
+    }
+
+    /**
+     * @param msgVersion openflow wire version
+     * @param experimenterId experimenter / vendor ID
+     * @return key instance
+     */
+    public static ExperimenterIdSerializerKey<MultipartRequestExperimenterCase> createMultipartRequestSerializerKey(
+            short msgVersion, Long experimenterId) {
+        return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, MultipartRequestExperimenterCase.class);
+    }
+
+    /**
+     * @param msgVersion openflow wire version
+     * @param experimenterId experimenter / vendor ID
+     * @return key instance
+     */
+    public static ExperimenterIdSerializerKey<TableFeatureProperties> createMultipartRequestTFSerializerKey(
+            short msgVersion, Long experimenterId) {
+        return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, TableFeatureProperties.class);
+    }
+
+    /**
+     * @param msgVersion openflow wire version
+     * @param experimenterId experimenter / vendor ID
+     * @return key instance
+     */
+    public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(
+            short msgVersion, Long experimenterId) {
+        return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, MeterBandExperimenterCase.class);
+    }
 }
\ No newline at end of file
index 1c63fc0fc2bf33ef304621243b0363b4037004df..d597cfd50bc394aa6afdfc046ada78e523ca63a7 100644 (file)
@@ -1,94 +1,94 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.util;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterDeserializerKeyFactoryTest {\r
-\r
-    /**\r
-     * Test ExperimenterDeserializerKeyFactory key creation\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ExperimenterIdDeserializerKey createdKey = ExperimenterDeserializerKeyFactory\r
-                .createExperimenterErrorDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
-        ExperimenterIdDeserializerKey comparationKey =\r
-                new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ErrorMessage.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterDeserializerKeyFactory.createExperimenterErrorDeserializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
-                null, ErrorMessage.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, 43L);\r
-        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
-                43L, ExperimenterMessage.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
-                null, ExperimenterMessage.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, 44L);\r
-        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
-                44L, MeterBandExperimenterCase.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
-                null, MeterBandExperimenterCase.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, 45L);\r
-        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
-                45L, MultipartReplyExperimenterCase.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
-                null, MultipartReplyExperimenterCase.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
-                null, TableFeatureProperties.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
-                null, TableFeatureProperties.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
-                null, QueueProperty.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,\r
-                null, QueueProperty.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterDeserializerKeyFactoryTest {
+
+    /**
+     * Test ExperimenterDeserializerKeyFactory key creation
+     */
+    @Test
+    public void test() {
+        ExperimenterIdDeserializerKey createdKey = ExperimenterDeserializerKeyFactory
+                .createExperimenterErrorDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+        ExperimenterIdDeserializerKey comparationKey =
+                new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ErrorMessage.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterDeserializerKeyFactory.createExperimenterErrorDeserializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+                null, ErrorMessage.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
+                EncodeConstants.OF10_VERSION_ID, 43L);
+        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+                43L, ExperimenterMessage.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+                null, ExperimenterMessage.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
+                EncodeConstants.OF10_VERSION_ID, 44L);
+        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+                44L, MeterBandExperimenterCase.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+                null, MeterBandExperimenterCase.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
+                EncodeConstants.OF10_VERSION_ID, 45L);
+        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+                45L, MultipartReplyExperimenterCase.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+                null, MultipartReplyExperimenterCase.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+                null, TableFeatureProperties.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+                null, TableFeatureProperties.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+                null, QueueProperty.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+                null, QueueProperty.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+    }
 }
\ No newline at end of file
index df975ea5869f530c0ce44345144ef7a32767060f..397f7d69b0520e83ef93c1af38039fa9abfb65d8 100644 (file)
@@ -1,72 +1,72 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.util;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterSerializerKeyFactoryTest {\r
-\r
-    /**\r
-     * Test ExperimenterSerializerKeyFactory key creation\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ExperimenterIdSerializerKey<?> createdKey = ExperimenterSerializerKeyFactory\r
-                .createExperimenterMessageSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);\r
-        ExperimenterIdSerializerKey<?> comparationKey =\r
-                new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterInput.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterSerializerKeyFactory.createExperimenterMessageSerializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
-                null, ExperimenterInput.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, 43L);\r
-        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
-                43L, MeterBandExperimenterCase.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
-                null, MeterBandExperimenterCase.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, 44L);\r
-        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
-                44L, MultipartRequestExperimenterCase.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
-                null, MultipartRequestExperimenterCase.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, 45L);\r
-        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
-                45L, TableFeatureProperties.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-        createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(\r
-                EncodeConstants.OF10_VERSION_ID, null);\r
-        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,\r
-                null, TableFeatureProperties.class);\r
-        Assert.assertEquals("Wrong key created", comparationKey, createdKey);\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterIdSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterSerializerKeyFactoryTest {
+
+    /**
+     * Test ExperimenterSerializerKeyFactory key creation
+     */
+    @Test
+    public void test() {
+        ExperimenterIdSerializerKey<?> createdKey = ExperimenterSerializerKeyFactory
+                .createExperimenterMessageSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
+        ExperimenterIdSerializerKey<?> comparationKey =
+                new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterInput.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterSerializerKeyFactory.createExperimenterMessageSerializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+                null, ExperimenterInput.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(
+                EncodeConstants.OF10_VERSION_ID, 43L);
+        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+                43L, MeterBandExperimenterCase.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterSerializerKeyFactory.createMeterBandSerializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+                null, MeterBandExperimenterCase.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(
+                EncodeConstants.OF10_VERSION_ID, 44L);
+        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+                44L, MultipartRequestExperimenterCase.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+                null, MultipartRequestExperimenterCase.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(
+                EncodeConstants.OF10_VERSION_ID, 45L);
+        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+                45L, TableFeatureProperties.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+        createdKey = ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey(
+                EncodeConstants.OF10_VERSION_ID, null);
+        comparationKey = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+                null, TableFeatureProperties.class);
+        Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+    }
 }
\ No newline at end of file