X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fserialization%2Fmatch%2FAbstractOxmMacAddressSerializer.java;h=a665eb79d9dba07c4864fd653833797591ab0c21;hb=29a2a074c78708f6d18583779ece96bb6573f0c6;hp=847a04091c0ef1500c79c69ce88fef436afcadcd;hpb=87150bd287f792c118e906ffb8e9593a83f50c9e;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmMacAddressSerializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmMacAddressSerializer.java index 847a0409..a665eb79 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmMacAddressSerializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmMacAddressSerializer.java @@ -1,29 +1,24 @@ -/* - * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.openflowjava.protocol.impl.serialization.match; - -import io.netty.buffer.ByteBuf; - -import org.opendaylight.openflowjava.util.ByteBufUtils; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; - -/** - * Parent for MAC address based match entry serializers - * @author michal.polkorab - */ -public abstract class AbstractOxmMacAddressSerializer extends AbstractOxmMatchEntrySerializer { - - @Override - public void serialize(MatchEntries entry, ByteBuf outBuffer) { - super.serialize(entry, outBuffer); - String macAddress = entry.getAugmentation(MacAddressMatchEntry.class).getMacAddress().getValue(); - outBuffer.writeBytes(ByteBufUtils.macAddressToBytes(macAddress)); // 48 b + mask [OF 1.3.2 spec] - writeMask(entry, outBuffer, getValueLength()); - } -} +/* + * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.openflowjava.protocol.impl.serialization.match; + +import io.netty.buffer.ByteBuf; + +import org.opendaylight.openflowjava.util.ByteBufUtils; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress; + +/** + * Parent for MAC address based match entry serializers + * @author michal.polkorab + */ +public abstract class AbstractOxmMacAddressSerializer extends AbstractOxmMatchEntrySerializer { + + protected void writeMacAddress(MacAddress address, ByteBuf outBuffer) { + outBuffer.writeBytes(ByteBufUtils.macAddressToBytes(address.getValue())); // 48 b + mask [OF 1.3.2 spec] + } +}