use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlow in project openflowplugin by opendaylight.
the class TcpSrcConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final TcpSrcValuesBuilder tcpSrcValuesBuilder = new TcpSrcValuesBuilder().setMask(2).setPort(DEFAULT_PORT);
final TcpSrcCaseValueBuilder tcpSrcCaseValueBuilder = new TcpSrcCaseValueBuilder().setTcpSrcValues(tcpSrcValuesBuilder.build());
final TcpSrcCaseValue tcpSrcCaseValue = tcpSrcCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(tcpSrcCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tcpSrcConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(2, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tcpSrcConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(2, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tcpSrcConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(2, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tcpSrcConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(2, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlow in project genius by opendaylight.
the class NxMatchInfoHelper method setMatch.
@Override
public void setMatch(MatchBuilder matchBuilder, Map<Class<?>, Object> mapMatchBuilder) {
B builder = (B) mapMatchBuilder.remove(builderClass);
if (builder != null) {
NxAugMatchNodesNodeTableFlowBuilder nxAugMatchBuilder = new NxAugMatchNodesNodeTableFlowBuilder();
applyValue(nxAugMatchBuilder, builder.build());
NxAugMatchNodesNodeTableFlow nxAugMatch = nxAugMatchBuilder.build();
GeneralAugMatchNodesNodeTableFlow existingAugmentations = matchBuilder.getAugmentation(GeneralAugMatchNodesNodeTableFlow.class);
GeneralAugMatchNodesNodeTableFlow genAugMatch = generalAugMatchBuilder(existingAugmentations, nxAugMatch, keyClass);
matchBuilder.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, genAugMatch);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlow in project genius by opendaylight.
the class NxMatchInfoHelper method generalAugMatchBuilder.
private GeneralAugMatchNodesNodeTableFlow generalAugMatchBuilder(GeneralAugMatchNodesNodeTableFlow existingAugmentations, NxAugMatchNodesNodeTableFlow nxAugMatch, Class<? extends ExtensionKey> extentionKey) {
List<ExtensionList> extensions = null;
if (existingAugmentations != null) {
extensions = existingAugmentations.getExtensionList();
}
if (extensions == null) {
extensions = new ArrayList<>();
}
extensions.add(new ExtensionListBuilder().setExtensionKey(extentionKey).setExtension(new ExtensionBuilder().addAugmentation(NxAugMatchNodesNodeTableFlow.class, nxAugMatch).build()).build());
return new GeneralAugMatchNodesNodeTableFlowBuilder().setExtensionList(extensions).build();
}
Aggregations