Search in sources :

Example 1 with Nshc3CaseValue

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

the class Nshc3ConvertorTest method testConvert1.

@Test
public void testConvert1() throws Exception {
    final Nshc3ValuesBuilder nshc3ValuesBuilder = new Nshc3ValuesBuilder().setNshc(Long.valueOf(1));
    final Nshc3CaseValueBuilder nshc3CaseValueBuilder = new Nshc3CaseValueBuilder().setNshc3Values(nshc3ValuesBuilder.build());
    final Nshc3CaseValue nshc3CaseValue = nshc3CaseValueBuilder.build();
    when(matchEntry.getMatchEntryValue()).thenReturn(nshc3CaseValue);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc3Convertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNshc3().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc3Key.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc3Convertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxNshc3().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc3Key.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc3Convertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxNshc3().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc3Key.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc3Convertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
    Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNshc3().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc3Key.class);
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) Nshc3ValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nshc._3.grouping.Nshc3ValuesBuilder) Nshc3CaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc3CaseValueBuilder) Nshc3CaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc3CaseValue) Test(org.junit.Test)

Example 2 with Nshc3CaseValue

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

the class Nshc3CodecTest method deserializeTest.

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

Example 3 with Nshc3CaseValue

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

the class Nshc3Codec method serialize.

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

Example 4 with Nshc3CaseValue

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

the class Nshc3ConvertorTest method testConvert.

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

Aggregations

Test (org.junit.Test)3 Nshc3CaseValue (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc3CaseValue)3 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)1 Nshc3ValuesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nshc._3.grouping.Nshc3ValuesBuilder)1 Nshc3CaseValueBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc3CaseValueBuilder)1 Extension (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension)1