Search in sources :

Example 1 with Nshc4CaseValue

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

the class Nshc4ConvertorTest method testConvert1.

@Test
public void testConvert1() throws Exception {
    final Nshc4ValuesBuilder nshc4ValuesBuilder = new Nshc4ValuesBuilder().setNshc(Long.valueOf(1));
    final Nshc4CaseValueBuilder nshc4CaseValueBuilder = new Nshc4CaseValueBuilder().setNshc4Values(nshc4ValuesBuilder.build());
    final Nshc4CaseValue nshc4CaseValue = nshc4CaseValueBuilder.build();
    when(matchEntry.getMatchEntryValue()).thenReturn(nshc4CaseValue);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc4Convertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc4Convertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc4Convertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc4Convertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
    Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) Nshc4CaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc4CaseValueBuilder) Nshc4ValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nshc._4.grouping.Nshc4ValuesBuilder) Nshc4CaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc4CaseValue) Test(org.junit.Test)

Example 2 with Nshc4CaseValue

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

the class Nshc4CodecTest method deserializeTest.

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

Example 3 with Nshc4CaseValue

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

the class Nshc4Codec method serialize.

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

Example 4 with Nshc4CaseValue

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

the class Nshc4ConvertorTest method testConvert.

@Test
public void testConvert() throws Exception {
    final MatchEntry converted = nshc4Convertor.convert(extension);
    Assert.assertEquals(1, ((Nshc4CaseValue) converted.getMatchEntryValue()).getNshc4Values().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 Nshc4CaseValue (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc4CaseValue)3 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)1 Nshc4ValuesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nshc._4.grouping.Nshc4ValuesBuilder)1 Nshc4CaseValueBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc4CaseValueBuilder)1 Extension (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension)1