use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtStateCaseValueBuilder 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.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtStateCaseValueBuilder in project openflowplugin by opendaylight.
the class CtStateConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmNxCtStateGrouping> matchGrouping = MatchUtil.CT_STATE_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
CtStateCaseValueBuilder ctStateCaseValueBuilder = new CtStateCaseValueBuilder();
CtStateValuesBuilder ctStateValuesBuilder = new CtStateValuesBuilder();
ctStateValuesBuilder.setCtState(matchGrouping.get().getNxmNxCtState().getCtState());
ctStateValuesBuilder.setMask(matchGrouping.get().getNxmNxCtState().getMask());
ctStateCaseValueBuilder.setCtStateValues(ctStateValuesBuilder.build());
MatchEntryBuilder ofMatch = MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxCtState.class, Nxm1Class.class, ctStateCaseValueBuilder.build());
ofMatch.setHasMask(true);
return ofMatch.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtStateCaseValueBuilder in project openflowplugin by opendaylight.
the class CtStateCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final CtStateCaseValueBuilder caseBuilder = new CtStateCaseValueBuilder();
final CtStateValuesBuilder valuesBuilder = new CtStateValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm1Class.class);
matchEntryBuilder.setOxmMatchField(NxmNxCtState.class);
matchEntryBuilder.setHasMask(true);
valuesBuilder.setCtState((long) 1);
valuesBuilder.setMask((long) 2);
caseBuilder.setCtStateValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtStateCaseValueBuilder in project openflowplugin by opendaylight.
the class CtStateCodec method deserialize.
@Override
public MatchEntry deserialize(ByteBuf message) {
final MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
CtStateCaseValueBuilder caseBuilder = new CtStateCaseValueBuilder();
CtStateValuesBuilder ctStateValuesBuilder = new CtStateValuesBuilder();
ctStateValuesBuilder.setCtState(message.readUnsignedInt());
ctStateValuesBuilder.setMask(message.readUnsignedInt());
caseBuilder.setCtStateValues(ctStateValuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
matchEntryBuilder.setHasMask(true);
return matchEntryBuilder.build();
}
Aggregations