use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc4CaseValueBuilder in project openflowplugin by opendaylight.
the class Nshc4ConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final Nshc4ValuesBuilder nshc4ValuesBuilder = new Nshc4ValuesBuilder().setNshc(Long.valueOf(1));
final Nshc4CaseValueBuilder nshc4CaseValueBuilder = new Nshc4CaseValueBuilder().setNshc4Values(nshc4ValuesBuilder.build());
final Nshc4CaseValue nshc4CaseValue = nshc4CaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(nshc4CaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = nshc4Convertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = nshc4Convertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = nshc4Convertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = nshc4Convertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmNxNshc4().getValue().intValue());
Assert.assertEquals(extensionAugment.getKey(), NxmNxNshc4Key.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc4CaseValueBuilder in project openflowplugin by opendaylight.
the class Nshc4Convertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmNxNshc4Grouping> matchGrouping = MatchUtil.NSC4_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
Long value = matchGrouping.get().getNxmNxNshc4().getValue();
Nshc4CaseValueBuilder nsc4CaseValueBuilder = new Nshc4CaseValueBuilder();
nsc4CaseValueBuilder.setNshc4Values(new Nshc4ValuesBuilder().setNshc(value).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxNshc4.class, Nxm1Class.class, nsc4CaseValueBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.Nshc4CaseValueBuilder in project openflowplugin by opendaylight.
the class Nshc4CodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final Nshc4CaseValueBuilder caseBuilder = new Nshc4CaseValueBuilder();
final Nshc4ValuesBuilder valuesBuilder = new Nshc4ValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm1Class.class);
matchEntryBuilder.setOxmMatchField(NxmNxNshc4.class);
matchEntryBuilder.setHasMask(false);
valuesBuilder.setNshc((long) 1);
caseBuilder.setNshc4Values(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.Nshc4CaseValueBuilder in project openflowplugin by opendaylight.
the class Nshc4Codec method deserialize.
@Override
public MatchEntry deserialize(ByteBuf message) {
MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
Nshc4CaseValueBuilder nsc4CaseValueBuilder = new Nshc4CaseValueBuilder();
nsc4CaseValueBuilder.setNshc4Values(new Nshc4ValuesBuilder().setNshc(message.readUnsignedInt()).build());
matchEntryBuilder.setMatchEntryValue(nsc4CaseValueBuilder.build());
return matchEntryBuilder.build();
}
Aggregations