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 OpenflowPluginBulkTransactionProvider method createEthernetMatch.
private static MatchBuilder createEthernetMatch() {
// ethernettype
EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
// match
EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
EtherType type = new EtherType(0x0800L);
ethmatch.setEthernetType(ethtype.setType(type).build());
// ethernet
EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder();
// macaddress
// match
MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
ethdest.setAddress(macdest);
// ethdest.setMask(mask1);
ethmatch.setEthernetDestination(ethdest.build());
EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
ethsrc.setAddress(macsrc);
// ethsrc.setMask(mask2);
ethmatch.setEthernetSource(ethsrc.build());
MatchBuilder match = new MatchBuilder();
match.setEthernetMatch(ethmatch.build());
return match;
}
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 LearningSwitchHandlerSimpleImpl method addBridgeFlow.
private void addBridgeFlow(MacAddress srcMac, MacAddress dstMac, NodeConnectorRef destNodeConnector) {
synchronized (coveredMacPaths) {
String macPath = srcMac.toString() + dstMac.toString();
if (!coveredMacPaths.contains(macPath)) {
LOG.debug("covering mac path: {} by [{}]", macPath, destNodeConnector.getValue().firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId());
coveredMacPaths.add(macPath);
FlowId flowId = new FlowId(String.valueOf(flowIdInc.getAndIncrement()));
FlowKey flowKey = new FlowKey(flowId);
/**
* Path to the flow we want to program.
*/
InstanceIdentifier<Flow> flowPath = InstanceIdentifierUtils.createFlowPath(tablePath, flowKey);
Short tableId = InstanceIdentifierUtils.getTableId(tablePath);
FlowBuilder srcToDstFlow = FlowUtils.createDirectMacToMacFlow(tableId, DIRECT_FLOW_PRIORITY, srcMac, dstMac, destNodeConnector);
srcToDstFlow.setCookie(new FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement())));
dataStoreAccessor.writeFlowToConfig(flowPath, srcToDstFlow.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 OfToSalArpShaCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull ArpShaCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
ArpSha arpSha = source.getArpSha();
MacAddress macAddress = arpSha.getMacAddress();
if (macAddress != null) {
ArpSourceHardwareAddressBuilder arpSourceHardwareAddressBuilder = new ArpSourceHardwareAddressBuilder();
arpSourceHardwareAddressBuilder.setAddress(macAddress);
byte[] mask = arpSha.getMask();
if (mask != null) {
arpSourceHardwareAddressBuilder.setMask(new MacAddress(ByteBufUtils.macAddressToString(mask)));
}
arpMatchBuilder.setArpSourceHardwareAddress(arpSourceHardwareAddressBuilder.build());
matchBuilder.setLayer3Match(arpMatchBuilder.build());
}
return Optional.of(matchBuilder);
}
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 OfToSalEthDstCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull EthDstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final EthernetMatchBuilder ethMatchBuilder = data.getEthernetMatchBuilder();
final EthDst ethDstCase = source.getEthDst();
if (ethDstCase != null) {
EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder();
ethDestinationBuilder.setAddress(ethDstCase.getMacAddress());
byte[] destinationMask = ethDstCase.getMask();
if (destinationMask != null) {
ethDestinationBuilder.setMask(new MacAddress(macAddressToString(destinationMask)));
}
ethMatchBuilder.setEthernetDestination(ethDestinationBuilder.build());
matchBuilder.setEthernetMatch(ethMatchBuilder.build());
}
return Optional.of(matchBuilder);
}
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 Ipv6NdTllEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
processHeader(message);
final MacAddress address = OxmDeserializerHelper.convertMacAddress(message);
if (Objects.isNull(builder.getLayer3Match())) {
builder.setLayer3Match(new Ipv6MatchBuilder().setIpv6NdTll(address).build());
} else if (Ipv6Match.class.isInstance(builder.getLayer3Match()) && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6NdTll())) {
final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
builder.setLayer3Match(new Ipv6MatchBuilder(match).setIpv6NdTll(address).build());
} else {
throwErrorOnMalformed(builder, "layer3Match", "ipv6NdTll");
}
}
Aggregations