Search in sources :

Example 1 with Nshc2CaseValue

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

the class Nshc2ConvertorTest method testConvert1.

@Test
public void testConvert1() throws Exception {
    final Nshc2ValuesBuilder nshc2ValuesBuilder = new Nshc2ValuesBuilder().setNshc(Long.valueOf(1));
    final Nshc2CaseValueBuilder nshc2CaseValueBuilder = new Nshc2CaseValueBuilder().setNshc2Values(nshc2ValuesBuilder.build());
    final Nshc2CaseValue nshc2CaseValue = nshc2CaseValueBuilder.build();
    when(matchEntry.getMatchEntryValue()).thenReturn(nshc2CaseValue);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc2Convertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNshc2().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc2Key.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc2Convertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxNshc2().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc2Key.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc2Convertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxNshc2().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc2Key.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc2Convertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
    Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNshc2().getValue().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc2Key.class);
}
Also used : Nshc2CaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc2CaseValueBuilder) Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) Nshc2CaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc2CaseValue) Nshc2ValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nshc._2.grouping.Nshc2ValuesBuilder) Test(org.junit.Test)

Example 2 with Nshc2CaseValue

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

the class Nshc2Codec method serialize.

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

Example 3 with Nshc2CaseValue

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

the class Nshc2CodecTest method deserializeTest.

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

Example 4 with Nshc2CaseValue

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

the class Nshc2ConvertorTest method testConvert.

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