Search in sources :

Example 56 with MatchEntry

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry 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 57 with MatchEntry

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry in project openflowplugin by opendaylight.

the class NsiConvertorTest method testConvert1.

@Test
public void testConvert1() throws Exception {
    final NsiValuesBuilder nsiValuesBuilder = new NsiValuesBuilder().setNsi(Short.valueOf((short) 1));
    final NsiCaseValueBuilder nsiCaseValueBuilder = new NsiCaseValueBuilder().setNsiValues(nsiValuesBuilder.build());
    final NsiCaseValue nsiCaseValue = nsiCaseValueBuilder.build();
    when(matchEntry.getMatchEntryValue()).thenReturn(nsiCaseValue);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nsiConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNsi().getNsi().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNsiKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nsiConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxNsi().getNsi().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNsiKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nsiConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
    Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxNsi().getNsi().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNsiKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nsiConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
    Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNsi().getNsi().intValue());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxNsiKey.class);
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) NsiCaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NsiCaseValueBuilder) NsiValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.nsi.grouping.NsiValuesBuilder) NsiCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.NsiCaseValue) Test(org.junit.Test)

Example 58 with MatchEntry

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry in project openflowplugin by opendaylight.

the class TcpDstConvertorTest method testConvert1.

@Test
public void testConvert1() throws Exception {
    final TcpDstValuesBuilder tcpDstValuesBuilder = new TcpDstValuesBuilder().setMask(2).setPort(DEFAULT_PORT);
    final TcpDstCaseValueBuilder tcpDstCaseValueBuilder = new TcpDstCaseValueBuilder().setTcpDstValues(tcpDstValuesBuilder.build());
    final TcpDstCaseValue tcpDstCaseValue = tcpDstCaseValueBuilder.build();
    when(matchEntry.getMatchEntryValue()).thenReturn(tcpDstCaseValue);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tcpDstConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
    Assert.assertEquals(2, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
    Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpDst().getPort());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tcpDstConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
    Assert.assertEquals(2, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
    Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfTcpDst().getPort());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tcpDstConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
    Assert.assertEquals(2, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
    Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfTcpDst().getPort());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tcpDstConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
    Assert.assertEquals(2, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
    Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpDst().getPort());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.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) TcpDstValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.tcp.dst.grouping.TcpDstValuesBuilder) NxAugMatchRpcGetFlowStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStats) NxAugMatchNotifPacketIn(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn) TcpDstCaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValueBuilder) TcpDstCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue) Test(org.junit.Test)

Example 59 with MatchEntry

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry in project openflowplugin by opendaylight.

the class TcpDstConvertorTest method testConvert.

@Test
public void testConvert() throws Exception {
    final MatchEntry converted = tcpDstConvertor.convert(extension);
    Assert.assertEquals(1, ((TcpDstCaseValue) converted.getMatchEntryValue()).getTcpDstValues().getMask().intValue());
    Assert.assertEquals(DEFAULT_PORT, ((TcpDstCaseValue) converted.getMatchEntryValue()).getTcpDstValues().getPort());
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) TcpDstCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue) Test(org.junit.Test)

Example 60 with MatchEntry

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry in project openflowplugin by opendaylight.

the class TunIPv4DstConvertorTest method testConvert.

@Test
public void testConvert() throws Exception {
    final MatchEntry converted = tunIPv4DstConvertor.convert(extension);
    Assert.assertEquals(IpConverter.ipv4AddressToLong(IPV4_ADDRESS), ((TunIpv4DstCaseValue) converted.getMatchEntryValue()).getTunIpv4DstValues().getValue().longValue());
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) Test(org.junit.Test)

Aggregations

MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)207 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)127 Test (org.junit.Test)112 ArrayList (java.util.ArrayList)70 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder)33 CodecPreconditionException (org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException)32 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)30 BigInteger (java.math.BigInteger)29 ByteBuf (io.netty.buffer.ByteBuf)26 Extension (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension)26 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)24 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)21 List (java.util.List)20 VersionDatapathIdConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)20 SetFieldActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder)19 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match)19 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)17 SetFieldCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCaseBuilder)16 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)15 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)15