Search in sources :

Example 51 with Extension

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project openflowplugin by opendaylight.

the class UdpSrcConvertorTest method testConvert1.

@Test
public void testConvert1() throws Exception {
    final UdpSrcValuesBuilder udpSrcValuesBuilder = new UdpSrcValuesBuilder().setMask(2).setPort(DEFAULT_PORT);
    final UdpSrcCaseValueBuilder udpSrcCaseValueBuilder = new UdpSrcCaseValueBuilder().setUdpSrcValues(udpSrcValuesBuilder.build());
    final UdpSrcCaseValue udpSrcCaseValue = udpSrcCaseValueBuilder.build();
    when(matchEntry.getMatchEntryValue()).thenReturn(udpSrcCaseValue);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = udpSrcConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
    Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfUdpSrc().getMask());
    Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfUdpSrc().getPort());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = udpSrcConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
    Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfUdpSrc().getMask());
    Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfUdpSrc().getPort());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = udpSrcConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
    Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfUdpSrc().getMask());
    Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfUdpSrc().getPort());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = udpSrcConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
    Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfUdpSrc().getMask());
    Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfUdpSrc().getPort());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.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) UdpSrcCaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValueBuilder) 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) UdpSrcValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.udp.src.grouping.UdpSrcValuesBuilder) UdpSrcCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue) Test(org.junit.Test)

Example 52 with Extension

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project openflowplugin by opendaylight.

the class ArpShaConvertorTest method testConvertFromOFJava.

@Test
public void testConvertFromOFJava() throws Exception {
    final ArpShaValuesBuilder arpShaValuesBuilder = new ArpShaValuesBuilder().setMacAddress(MAC_ADDRESS);
    final ArpShaCaseValueBuilder arpShaCaseValueBuilder = new ArpShaCaseValueBuilder().setArpShaValues(arpShaValuesBuilder.build());
    final ArpShaCaseValue arpShaCaseValue = arpShaCaseValueBuilder.build();
    when(matchEntry.getMatchEntryValue()).thenReturn(arpShaCaseValue);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = arpShaConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
    Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(), ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxArpSha().getMacAddress());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxArpShaKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = arpShaConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
    Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(), ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxArpSha().getMacAddress());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxArpShaKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = arpShaConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
    Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(), ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxArpSha().getMacAddress());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxArpShaKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = arpShaConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
    Assert.assertEquals(arpShaCaseValue.getArpShaValues().getMacAddress(), ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxArpSha().getMacAddress());
    Assert.assertEquals(extensionAugment.getKey(), NxmNxArpShaKey.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) 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) ArpShaCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpShaCaseValue) ArpShaValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.arp.sha.grouping.ArpShaValuesBuilder) ArpShaCaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpShaCaseValueBuilder) Test(org.junit.Test)

Example 53 with Extension

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project openflowplugin by opendaylight.

the class ArpThaConvertorTest method setUp.

@Before
public void setUp() throws Exception {
    final NxmNxArpThaBuilder nxArpThaBuilder = new NxmNxArpThaBuilder().setMacAddress(MAC_ADDRESS);
    final NxAugMatchRpcAddFlowBuilder nxAugMatchRpcAddFlowBuilder = new NxAugMatchRpcAddFlowBuilder().setNxmNxArpTha(nxArpThaBuilder.build());
    final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
    when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
    arpThaConvertor = new ArpThaConvertor();
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) Augmentation(org.opendaylight.yangtools.yang.binding.Augmentation) NxmNxArpThaBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.arp.tha.grouping.NxmNxArpThaBuilder) NxAugMatchRpcAddFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcAddFlowBuilder) Before(org.junit.Before)

Example 54 with Extension

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project openflowplugin by opendaylight.

the class ArpThaConvertorTest method testConvertToOFJava.

@Test
public void testConvertToOFJava() throws Exception {
    final MatchEntry converted = arpThaConvertor.convert(extension);
    Assert.assertEquals(MAC_ADDRESS.getValue(), ((ArpThaCaseValue) converted.getMatchEntryValue()).getArpThaValues().getMacAddress().getValue());
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) Test(org.junit.Test)

Example 55 with Extension

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension in project openflowplugin by opendaylight.

the class CtStateConvertorTest method testConvert.

@Test
public void testConvert() throws Exception {
    final MatchEntry converted = ctStateConvertor.convert(extension);
    Assert.assertEquals(1L, ((CtStateCaseValue) converted.getMatchEntryValue()).getCtStateValues().getCtState().longValue());
    Assert.assertEquals(2L, ((CtStateCaseValue) converted.getMatchEntryValue()).getCtStateValues().getMask().longValue());
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) Test(org.junit.Test)

Aggregations

Extension (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension)57 Test (org.junit.Test)46 CodecPreconditionException (org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException)32 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)26 NxAugMatchNodesNodeTableFlow (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlow)23 Augmentation (org.opendaylight.yangtools.yang.binding.Augmentation)23 Before (org.junit.Before)21 NxAugMatchNodesNodeTableFlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlowBuilder)18 Nxm1Class (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class)17 NxAugMatchNotifPacketIn (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn)14 NxAugMatchNotifSwitchFlowRemoved (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved)14 NxAugMatchRpcGetFlowStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStats)14 ExtensionList (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionList)11 GeneralAugMatchNodesNodeTableFlow (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralAugMatchNodesNodeTableFlow)10 Consumer (java.util.function.Consumer)9 Nxm0Class (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class)7 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)7 ArrayList (java.util.ArrayList)5 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)5 NxAugMatchRpcAddFlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcAddFlowBuilder)5