use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry in project openflowplugin by opendaylight.
the class CtStateConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final CtStateValuesBuilder ctStateValuesBuilder = new CtStateValuesBuilder().setCtState(3L).setMask(4L);
final CtStateCaseValueBuilder ctStateCaseValueBuilder = new CtStateCaseValueBuilder().setCtStateValues(ctStateValuesBuilder.build());
final CtStateCaseValue ctStateCaseValue = ctStateCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(ctStateCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ctStateConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(3L, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxCtState().getCtState().longValue());
Assert.assertEquals(4L, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxCtState().getMask().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtStateKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ctStateConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(3L, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxCtState().getCtState().longValue());
Assert.assertEquals(4L, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxCtState().getMask().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtStateKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ctStateConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(3L, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxCtState().getCtState().longValue());
Assert.assertEquals(4L, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxCtState().getMask().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtStateKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ctStateConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(3L, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxCtState().getCtState().longValue());
Assert.assertEquals(4L, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxCtState().getMask().longValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxCtStateKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry in project openflowplugin by opendaylight.
the class ArpOpConvertorTest method testConvertToOFJava.
@Test
public void testConvertToOFJava() throws Exception {
final NxmOfArpOpBuilder nxmOfArpOpBuilder = new NxmOfArpOpBuilder().setValue(2);
final NxAugMatchRpcAddFlowBuilder nxAugMatchRpcAddFlowBuilder = new NxAugMatchRpcAddFlowBuilder();
nxAugMatchRpcAddFlowBuilder.setNxmOfArpOp(nxmOfArpOpBuilder.build());
final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
final MatchEntry converted = arpOpConvertor.convert(extension);
Assert.assertEquals(nxAugMatchRpcAddFlowBuilder.getNxmOfArpOp().getValue(), ((ArpOpCaseValue) converted.getMatchEntryValue()).getArpOpValues().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry in project openflowplugin by opendaylight.
the class Nshc1Convertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmNxNshc1Grouping> matchGrouping = MatchUtil.NSC1_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
Long value = matchGrouping.get().getNxmNxNshc1().getValue();
Nshc1CaseValueBuilder nsc1CaseValueBuilder = new Nshc1CaseValueBuilder();
nsc1CaseValueBuilder.setNshc1Values(new Nshc1ValuesBuilder().setNshc(value).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshc1.class, Nxm1Class.class, nsc1CaseValueBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry in project openflowplugin by opendaylight.
the class NsiConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmNxNsiGrouping> matchGrouping = MatchUtil.NSI_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
Short value = matchGrouping.get().getNxmNxNsi().getNsi();
NsiCaseValueBuilder nsiCaseValueBuilder = new NsiCaseValueBuilder();
nsiCaseValueBuilder.setNsiValues(new NsiValuesBuilder().setNsi(value).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNsi.class, Nxm1Class.class, nsiCaseValueBuilder.build()).build();
}
Aggregations