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%2FAbstractOxmIpv4AddressSerializer.java;h=ea9d0a5c3bad82fbfa27410d87782c0fee0f94f7;hb=29a2a074c78708f6d18583779ece96bb6573f0c6;hp=1d1907afecde2e252b65d068d4d43ca0735ecf9b;hpb=87150bd287f792c118e906ffb8e9593a83f50c9e;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmIpv4AddressSerializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmIpv4AddressSerializer.java index 1d1907af..ea9d0a5c 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmIpv4AddressSerializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmIpv4AddressSerializer.java @@ -1,37 +1,27 @@ -/* - * 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.Ipv4AddressMatchEntry; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; - -/** - * Parent for Ipv4 address based match entry serializers - * @author michal.polkorab - */ -public abstract class AbstractOxmIpv4AddressSerializer extends AbstractOxmMatchEntrySerializer { - - @Override - public void serialize(final MatchEntries entry, final ByteBuf outBuffer) { - super.serialize(entry, outBuffer); - writeIpv4Address(entry, outBuffer); - writeMask(entry, outBuffer, getValueLength()); - } - - private static void writeIpv4Address(final MatchEntries entry, final ByteBuf out) { - Iterable addressGroups = ByteBufUtils.DOT_SPLITTER - .split(entry.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address().getValue()); - for (String group : addressGroups) { - out.writeByte(Short.parseShort(group)); - } - } - -} +/* + * 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; + +/** + * Parent for Ipv4 address based match entry serializers + * @author michal.polkorab + */ +public abstract class AbstractOxmIpv4AddressSerializer extends AbstractOxmMatchEntrySerializer { + + protected static void writeIpv4Address(String address, final ByteBuf out) { + Iterable addressGroups = ByteBufUtils.DOT_SPLITTER.split(address); + for (String group : addressGroups) { + out.writeByte(Short.parseShort(group)); + } + } + +}