Search in sources :

Example 36 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 ArpSpaConvertorTest method testConvertToOFJava.

@Test
public void testConvertToOFJava() throws Exception {
    final NxmOfArpSpaBuilder nxmOfArpSpaBuilder = new NxmOfArpSpaBuilder().setIpv4Address(IPV4_ADDRESS);
    final NxAugMatchRpcAddFlowBuilder nxAugMatchRpcAddFlowBuilder = new NxAugMatchRpcAddFlowBuilder();
    nxAugMatchRpcAddFlowBuilder.setNxmOfArpSpa(nxmOfArpSpaBuilder.build());
    final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
    when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
    final MatchEntry converted = arpSpaConvertor.convert(extension);
    Assert.assertEquals(IpConverter.ipv4AddressToLong(IPV4_ADDRESS), ((ArpSpaCaseValue) converted.getMatchEntryValue()).getArpSpaValues().getValue().longValue());
}
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) NxmOfArpSpaBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.arp.spa.grouping.NxmOfArpSpaBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) NxAugMatchRpcAddFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcAddFlowBuilder) Test(org.junit.Test)

Example 37 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 EthSrcConvertorTest method testConvert1.

@Test
public void testConvert1() throws Exception {
    final EthSrcValuesBuilder ethSrcValuesBuilder = new EthSrcValuesBuilder().setMacAddress(MAC_ADDRESS);
    final EthSrcCaseValueBuilder ethSrcCaseValueBuilder = new EthSrcCaseValueBuilder().setEthSrcValues(ethSrcValuesBuilder.build());
    final EthSrcCaseValue ethSrcCaseValue = ethSrcCaseValueBuilder.build();
    when(matchEntry.getMatchEntryValue()).thenReturn(ethSrcCaseValue);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ethSrcConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
    Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfEthSrc().getMacAddress());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfEthSrcKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ethSrcConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
    Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfEthSrc().getMacAddress());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfEthSrcKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ethSrcConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
    Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfEthSrc().getMacAddress());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfEthSrcKey.class);
    final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ethSrcConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
    Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfEthSrc().getMacAddress());
    Assert.assertEquals(extensionAugment.getKey(), NxmOfEthSrcKey.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) EthSrcCaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthSrcCaseValueBuilder) EthSrcCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthSrcCaseValue) EthSrcValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.eth.src.grouping.EthSrcValuesBuilder) Test(org.junit.Test)

Example 38 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 Nshc1ConvertorTest method testConvert.

@Test
public void testConvert() throws Exception {
    final MatchEntry converted = nshc1Convertor.convert(extension);
    Assert.assertEquals(1, ((Nshc1CaseValue) converted.getMatchEntryValue()).getNshc1Values().getNshc().intValue());
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) Test(org.junit.Test)

Example 39 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 Nshc1ConvertorTest method setUp.

@Before
public void setUp() throws Exception {
    final NxmNxNshc1Builder nxmNxNshc1Builder = new NxmNxNshc1Builder().setValue(1L);
    final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
    nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxNshc1(nxmNxNshc1Builder.build());
    final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
    when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
    nshc1Convertor = new Nshc1Convertor();
}
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) NxAugMatchNodesNodeTableFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlowBuilder) NxmNxNshc1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.nshc._1.grouping.NxmNxNshc1Builder) Before(org.junit.Before)

Example 40 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 Nshc3ConvertorTest method setUp.

@Before
public void setUp() throws Exception {
    final NxmNxNshc3Builder nxmNxNshc3Builder = new NxmNxNshc3Builder().setValue(1L);
    final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
    nxAugMatchNotifUpdateFlowStatsBuilder.setNxmNxNshc3(nxmNxNshc3Builder.build());
    final Augmentation<Extension> extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build();
    when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
    nshc3Convertor = new Nshc3Convertor();
}
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) NxAugMatchNodesNodeTableFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlowBuilder) NxmNxNshc3Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.nshc._3.grouping.NxmNxNshc3Builder) Before(org.junit.Before)

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