Search in sources :

Example 1 with TunIdValuesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.id.grouping.TunIdValuesBuilder in project openflowplugin by opendaylight.

the class TunIdConvertor method convert.

@Override
public MatchEntry convert(final Extension extension) {
    Optional<NxmNxTunIdGrouping> matchGrouping = MatchUtil.TUN_ID_RESOLVER.getExtension(extension);
    if (!matchGrouping.isPresent()) {
        throw new CodecPreconditionException(extension);
    }
    BigInteger value = matchGrouping.get().getNxmNxTunId().getValue();
    TunIdCaseValueBuilder tunnelIdCaseBuilder = new TunIdCaseValueBuilder();
    TunIdValuesBuilder tunnelIdBuilder = new TunIdValuesBuilder();
    tunnelIdBuilder.setValue(value);
    tunnelIdCaseBuilder.setTunIdValues(tunnelIdBuilder.build());
    return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxTunId.class, Nxm1Class.class, tunnelIdCaseBuilder.build()).build();
}
Also used : TunIdCaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValueBuilder) Nxm1Class(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class) NxmNxTunId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.tun.id.grouping.NxmNxTunId) CodecPreconditionException(org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException) TunIdValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.id.grouping.TunIdValuesBuilder) NxmNxTunIdGrouping(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIdGrouping) BigInteger(java.math.BigInteger)

Example 2 with TunIdValuesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.id.grouping.TunIdValuesBuilder in project openflowplugin by opendaylight.

the class TunIdCodecTest method createMatchEntry.

private MatchEntry createMatchEntry() {
    MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
    final TunIdCaseValueBuilder caseBuilder = new TunIdCaseValueBuilder();
    final TunIdValuesBuilder valuesBuilder = new TunIdValuesBuilder();
    matchEntryBuilder.setOxmClass(Nxm1Class.class);
    matchEntryBuilder.setOxmMatchField(NxmNxTunId.class);
    matchEntryBuilder.setHasMask(false);
    byte[] value = new byte[VALUE_LENGTH];
    valuesBuilder.setValue(new BigInteger(value));
    caseBuilder.setTunIdValues(valuesBuilder.build());
    matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
    return matchEntryBuilder.build();
}
Also used : TunIdCaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValueBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) TunIdValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.id.grouping.TunIdValuesBuilder) BigInteger(java.math.BigInteger)

Example 3 with TunIdValuesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.id.grouping.TunIdValuesBuilder in project openflowplugin by opendaylight.

the class TunIdCodec method deserialize.

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message);
    TunIdCaseValueBuilder caseBuilder = new TunIdCaseValueBuilder();
    TunIdValuesBuilder tunIdBuilder = new TunIdValuesBuilder();
    tunIdBuilder.setValue(BigInteger.valueOf(message.readLong()));
    caseBuilder.setTunIdValues(tunIdBuilder.build());
    matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
    return matchEntriesBuilder.build();
}
Also used : TunIdCaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValueBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) TunIdValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.id.grouping.TunIdValuesBuilder)

Example 4 with TunIdValuesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.id.grouping.TunIdValuesBuilder in project openflowplugin by opendaylight.

the class TunIdConvertorTest method testConvert1.

@Test
public void testConvert1() throws Exception {
    final TunIdValuesBuilder tunIdValuesBuilder = new TunIdValuesBuilder().setValue(BigInteger.TEN);
    final TunIdCaseValueBuilder tunIdCaseValueBuilder = new TunIdCaseValueBuilder().setTunIdValues(tunIdValuesBuilder.build());
    final TunIdCaseValue tunIdCaseValue = tunIdCaseValueBuilder.build();
    when(matchEntry.getMatchEntryValue()).thenReturn(tunIdCaseValue);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tunIdConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
    Assert.assertEquals(BigInteger.TEN, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxTunId().getValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tunIdConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
    Assert.assertEquals(BigInteger.TEN, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxTunId().getValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tunIdConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
    Assert.assertEquals(BigInteger.TEN, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxTunId().getValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tunIdConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
    Assert.assertEquals(BigInteger.TEN, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxTunId().getValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxTunIdKey.class);
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) NxAugMatchNotifSwitchFlowRemoved(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved) NxAugMatchNodesNodeTableFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlow) TunIdCaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValueBuilder) TunIdValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.id.grouping.TunIdValuesBuilder) NxAugMatchRpcGetFlowStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStats) TunIdCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValue) NxAugMatchNotifPacketIn(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn) Test(org.junit.Test)

Aggregations

TunIdValuesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.id.grouping.TunIdValuesBuilder)4 TunIdCaseValueBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValueBuilder)4 BigInteger (java.math.BigInteger)2 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 TunIdCaseValue (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValue)1 Extension (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension)1 NxAugMatchNodesNodeTableFlow (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlow)1 NxAugMatchNotifPacketIn (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn)1 NxAugMatchNotifSwitchFlowRemoved (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved)1 NxAugMatchRpcGetFlowStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStats)1 NxmNxTunIdGrouping (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxTunIdGrouping)1 NxmNxTunId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.tun.id.grouping.NxmNxTunId)1