Search in sources :

Example 1 with Nshc2CaseValueBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc2CaseValueBuilder 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 Nshc2CaseValueBuilder

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

the class Nshc2Convertor method convert.

@Override
public MatchEntry convert(Extension extension) {
    Optional<NxmNxNshc2Grouping> matchGrouping = MatchUtil.NSC2_RESOLVER.getExtension(extension);
    if (!matchGrouping.isPresent()) {
        throw new CodecPreconditionException(extension);
    }
    Long value = matchGrouping.get().getNxmNxNshc2().getValue();
    Nshc2CaseValueBuilder nsc2CaseValueBuilder = new Nshc2CaseValueBuilder();
    nsc2CaseValueBuilder.setNshc2Values(new Nshc2ValuesBuilder().setNshc(value).build());
    return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshc2.class, Nxm1Class.class, nsc2CaseValueBuilder.build()).build();
}
Also used : Nshc2CaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc2CaseValueBuilder) NxmNxNshc2(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.nshc._2.grouping.NxmNxNshc2) Nxm1Class(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class) NxmNxNshc2Grouping(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNshc2Grouping) CodecPreconditionException(org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException) Nshc2ValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nshc._2.grouping.Nshc2ValuesBuilder)

Example 3 with Nshc2CaseValueBuilder

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

the class Nshc2CodecTest method createMatchEntry.

private MatchEntry createMatchEntry() {
    MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
    final Nshc2CaseValueBuilder caseBuilder = new Nshc2CaseValueBuilder();
    final Nshc2ValuesBuilder valuesBuilder = new Nshc2ValuesBuilder();
    matchEntryBuilder.setOxmClass(Nxm1Class.class);
    matchEntryBuilder.setOxmMatchField(NxmNxNshc2.class);
    matchEntryBuilder.setHasMask(false);
    valuesBuilder.setNshc((long) 1);
    caseBuilder.setNshc2Values(valuesBuilder.build());
    matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
    return matchEntryBuilder.build();
}
Also used : Nshc2CaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc2CaseValueBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) Nshc2ValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nshc._2.grouping.Nshc2ValuesBuilder)

Example 4 with Nshc2CaseValueBuilder

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

the class Nshc2Codec method deserialize.

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
    Nshc2CaseValueBuilder nsc2CaseValueBuilder = new Nshc2CaseValueBuilder();
    nsc2CaseValueBuilder.setNshc2Values(new Nshc2ValuesBuilder().setNshc(message.readUnsignedInt()).build());
    matchEntryBuilder.setMatchEntryValue(nsc2CaseValueBuilder.build());
    return matchEntryBuilder.build();
}
Also used : Nshc2CaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc2CaseValueBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) Nshc2ValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nshc._2.grouping.Nshc2ValuesBuilder)

Aggregations

Nshc2ValuesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nshc._2.grouping.Nshc2ValuesBuilder)4 Nshc2CaseValueBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc2CaseValueBuilder)4 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)2 Test (org.junit.Test)1 CodecPreconditionException (org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException)1 Nxm1Class (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class)1 Nshc2CaseValue (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc2CaseValue)1 Extension (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension)1 NxmNxNshc2Grouping (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxNshc2Grouping)1 NxmNxNshc2 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.nshc._2.grouping.NxmNxNshc2)1