use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthTypeCaseValue in project openflowplugin by opendaylight.
the class EthTypeConvertorTest method testConvert.
@Test
public void testConvert() throws Exception {
final MatchEntry converted = ethTypeConvertor.convert(extension);
Assert.assertEquals(1, ((EthTypeCaseValue) converted.getMatchEntryValue()).getEthTypeValues().getValue().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthTypeCaseValue in project openflowplugin by opendaylight.
the class EthTypeConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final EthTypeValuesBuilder ethTypeValuesBuilder = new EthTypeValuesBuilder().setValue(Integer.valueOf(1));
final EthTypeCaseValueBuilder ethTypeCaseValueBuilder = new EthTypeCaseValueBuilder().setEthTypeValues(ethTypeValuesBuilder.build());
final EthTypeCaseValue ethTypeCaseValue = ethTypeCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(ethTypeCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ethTypeConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ethTypeConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ethTypeConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ethTypeConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfEthType().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthTypeCaseValue in project openflowplugin by opendaylight.
the class EthTypeCodec method serialize.
@Override
public void serialize(MatchEntry input, ByteBuf outBuffer) {
serializeHeader(input, outBuffer);
EthTypeCaseValue value = (EthTypeCaseValue) input.getMatchEntryValue();
outBuffer.writeShort(value.getEthTypeValues().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthTypeCaseValue in project openflowplugin by opendaylight.
the class EthTypeCodecTest method deserializeTest.
@Test
public void deserializeTest() {
createBuffer(buffer);
input = ethTypeCodec.deserialize(buffer);
final EthTypeCaseValue result = (EthTypeCaseValue) input.getMatchEntryValue();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfEthType.class, input.getOxmMatchField());
assertEquals(false, input.isHasMask());
assertEquals(2, result.getEthTypeValues().getValue().shortValue());
}
Aggregations