use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthDstCaseValueBuilder in project openflowplugin by opendaylight.
the class EthDstConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmOfEthDstGrouping> matchGrouping = MatchUtil.ETH_DST_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
MacAddress macAddress = matchGrouping.get().getNxmOfEthDst().getMacAddress();
EthDstCaseValueBuilder ethDstCaseValueBuilder = new EthDstCaseValueBuilder();
ethDstCaseValueBuilder.setEthDstValues(new EthDstValuesBuilder().setMacAddress(macAddress).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfEthDst.class, Nxm0Class.class, ethDstCaseValueBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthDstCaseValueBuilder in project openflowplugin by opendaylight.
the class EthDstConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final EthDstValuesBuilder ethDstValuesBuilder = new EthDstValuesBuilder().setMacAddress(MAC_ADDRESS);
final EthDstCaseValueBuilder ethDstCaseValueBuilder = new EthDstCaseValueBuilder().setEthDstValues(ethDstValuesBuilder.build());
final EthDstCaseValue ethDstCaseValue = ethDstCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(ethDstCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = ethDstConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfEthDst().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthDstKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = ethDstConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfEthDst().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthDstKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = ethDstConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfEthDst().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthDstKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = ethDstConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(MAC_ADDRESS, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfEthDst().getMacAddress());
Assert.assertEquals(extensionAugment.getKey(), NxmOfEthDstKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthDstCaseValueBuilder in project openflowplugin by opendaylight.
the class EthDstCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final EthDstCaseValueBuilder caseBuilder = new EthDstCaseValueBuilder();
final EthDstValuesBuilder valuesBuilder = new EthDstValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm0Class.class);
matchEntryBuilder.setOxmMatchField(NxmOfEthDst.class);
matchEntryBuilder.setHasMask(false);
byte[] address = new byte[VALUE_LENGTH];
valuesBuilder.setMacAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));
caseBuilder.setEthDstValues(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.EthDstCaseValueBuilder in project openflowplugin by opendaylight.
the class EthDstCodec method deserialize.
@Override
public MatchEntry deserialize(ByteBuf message) {
MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
byte[] address = new byte[VALUE_LENGTH];
message.readBytes(address);
EthDstCaseValueBuilder caseBuilder = new EthDstCaseValueBuilder();
caseBuilder.setEthDstValues(new EthDstValuesBuilder().setMacAddress(new MacAddress(ByteBufUtils.macAddressToString(address))).build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
Aggregations