use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.
the class MatchNormalizationUtilTest method normalizeEthernetMatch.
@Test
public void normalizeEthernetMatch() {
final MacAddress left = new MacAddress("01:23:45:AB:CD:EF");
final MacAddress leftMask = new MacAddress("FF:FF:FF:FF:FF:FF");
final MacAddress right = new MacAddress("01:23:45:ab:cd:ef");
final MatchBuilder matchBuilder = MatchNormalizationUtil.normalizeEthernetMatch(new MatchBuilder().setEthernetMatch(new EthernetMatchBuilder().setEthernetSource(new EthernetSourceBuilder().setAddress(left).setMask(leftMask).build()).setEthernetDestination(new EthernetDestinationBuilder().setAddress(left).setMask(leftMask).build()).build()));
assertEquals(right, matchBuilder.getEthernetMatch().getEthernetSource().getAddress());
assertEquals(right, matchBuilder.getEthernetMatch().getEthernetDestination().getAddress());
assertNull(matchBuilder.getEthernetMatch().getEthernetSource().getMask());
assertNull(matchBuilder.getEthernetMatch().getEthernetDestination().getMask());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.
the class ArpShaConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmNxArpShaGrouping> matchGrouping = MatchUtil.ARP_SHA_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
MacAddress macAddress = matchGrouping.get().getNxmNxArpSha().getMacAddress();
ArpShaCaseValueBuilder arpShaCaseValueBuilder = new ArpShaCaseValueBuilder();
arpShaCaseValueBuilder.setArpShaValues(new ArpShaValuesBuilder().setMacAddress(macAddress).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxArpSha.class, Nxm1Class.class, arpShaCaseValueBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.
the class ArpThaConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmNxArpThaGrouping> matchGrouping = MatchUtil.ARP_THA_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
MacAddress macAddress = matchGrouping.get().getNxmNxArpTha().getMacAddress();
ArpThaCaseValueBuilder arpThaCaseValueBuilder = new ArpThaCaseValueBuilder();
arpThaCaseValueBuilder.setArpThaValues(new ArpThaValuesBuilder().setMacAddress(macAddress).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxArpTha.class, Nxm1Class.class, arpThaCaseValueBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.
the class EncapEthSrcConvertor method convert.
@Override
public MatchEntry convert(Extension extension) {
Optional<NxmNxEncapEthSrcGrouping> matchGrouping = MatchUtil.ENCAP_ETH_SRC_RESOLVER.getExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
}
MacAddress macAddress = matchGrouping.get().getNxmNxEncapEthSrc().getMacAddress();
EncapEthSrcCaseValueBuilder encapEthSrcCaseValueBuilder = new EncapEthSrcCaseValueBuilder();
encapEthSrcCaseValueBuilder.setEncapEthSrcValues(new EncapEthSrcValuesBuilder().setMacAddress(macAddress).build());
return MatchUtil.createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxEncapEthSrc.class, Nxm1Class.class, encapEthSrcCaseValueBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress 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();
}
Aggregations