Search in sources :

Example 1 with NspCaseValue

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NspCaseValue in project openflowplugin by opendaylight.

the class NspConvertorTest method testConvert.

@Test
public void testConvert() throws Exception {
    final MatchEntry converted = nspConvertor.convert(extension);
    Assert.assertEquals(1, ((NspCaseValue) converted.getMatchEntryValue()).getNspValues().getNsp().intValue());
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) Test(org.junit.Test)

Example 2 with NspCaseValue

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NspCaseValue in project openflowplugin by opendaylight.

the class NspCodec method serialize.

@Override
public void serialize(MatchEntry input, ByteBuf outBuffer) {
    serializeHeader(input, outBuffer);
    NspCaseValue nspCaseValue = ((NspCaseValue) input.getMatchEntryValue());
    outBuffer.writeInt(nspCaseValue.getNspValues().getNsp().intValue());
}
Also used : NspCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NspCaseValue)

Example 3 with NspCaseValue

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NspCaseValue in project openflowplugin by opendaylight.

the class NspCodecTest method deserializeTest.

@Test
public void deserializeTest() {
    createBuffer(buffer);
    input = nspCodec.deserialize(buffer);
    final NspCaseValue result = (NspCaseValue) input.getMatchEntryValue();
    assertEquals(Nxm1Class.class, input.getOxmClass());
    assertEquals(NxmNxNsp.class, input.getOxmMatchField());
    assertEquals(false, input.isHasMask());
    assertEquals(2, result.getNspValues().getNsp().intValue());
}
Also used : NspCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NspCaseValue) Test(org.junit.Test)

Example 4 with NspCaseValue

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NspCaseValue in project openflowplugin by opendaylight.

the class NspConvertorTest method testConvert1.

@Test
public void testConvert1() throws Exception {
    final NspValuesBuilder nspValuesBuilder = new NspValuesBuilder().setNsp(Long.valueOf(2L));
    final NspCaseValueBuilder nspCaseValueBuilder = new NspCaseValueBuilder().setNspValues(nspValuesBuilder.build());
    final NspCaseValue nspCaseValue = nspCaseValueBuilder.build();
    when(matchEntry.getMatchEntryValue()).thenReturn(nspCaseValue);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nspConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
    Assert.assertEquals(2, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNsp().getValue().longValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNspKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nspConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
    Assert.assertEquals(2, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxNsp().getValue().longValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNspKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nspConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
    Assert.assertEquals(2, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxNsp().getValue().longValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNspKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nspConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
    Assert.assertEquals(2, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNsp().getValue().longValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNspKey.class);
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) NspValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nsp.grouping.NspValuesBuilder) NspCaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NspCaseValueBuilder) NspCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NspCaseValue) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 NspCaseValue (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NspCaseValue)3 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)1 NspValuesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nsp.grouping.NspValuesBuilder)1 NspCaseValueBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NspCaseValueBuilder)1 Extension (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension)1