Move ipv4/ipv6 ByteBuf utilities to Ipv{4,6}Util
[bgpcep.git] / bgp / parser-impl / src / main / java / org / opendaylight / protocol / bgp / parser / impl / message / update / extended / communities / Ipv4SpecificEcHandler.java
index dc318c46a42e2f2c896bb29db6d50d9a08e6ff68..b3c271e828b7c95280b321587eaea470667b5ee7 100644 (file)
@@ -5,16 +5,15 @@
  * 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.protocol.bgp.parser.impl.message.update.extended.communities;
 
+import static com.google.common.base.Preconditions.checkArgument;
 import static org.opendaylight.protocol.bgp.parser.spi.extended.community.Inet4SpecificExtendedCommunityCommonUtil.parseCommon;
 import static org.opendaylight.protocol.bgp.parser.spi.extended.community.Inet4SpecificExtendedCommunityCommonUtil.serializeCommon;
 
-import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.bgp.parser.spi.extended.community.AbstractIpv4ExtendedCommunity;
-import org.opendaylight.protocol.util.ByteBufWriteUtil;
+import org.opendaylight.protocol.util.Ipv4Util;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.ExtendedCommunity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.Inet4SpecificExtendedCommunityCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.extended.community.extended.community.Inet4SpecificExtendedCommunityCaseBuilder;
@@ -23,7 +22,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.inet4.specific.extended.community.common.Inet4SpecificExtendedCommunityCommon;
 
 public final class Ipv4SpecificEcHandler extends AbstractIpv4ExtendedCommunity {
-
     private static final int SUBTYPE = 0;
 
     @Override
@@ -36,9 +34,8 @@ public final class Ipv4SpecificEcHandler extends AbstractIpv4ExtendedCommunity {
 
     @Override
     public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(extendedCommunity instanceof Inet4SpecificExtendedCommunityCase,
-                "The extended community %s is not Inet4SpecificExtendedCommunityCase type.",
-                extendedCommunity);
+        checkArgument(extendedCommunity instanceof Inet4SpecificExtendedCommunityCase,
+                "The extended community %s is not Inet4SpecificExtendedCommunityCase type.", extendedCommunity);
         final Inet4SpecificExtendedCommunity inet4SpecificExtendedCommunity
                 = ((Inet4SpecificExtendedCommunityCase) extendedCommunity).getInet4SpecificExtendedCommunity();
 
@@ -47,7 +44,7 @@ public final class Ipv4SpecificEcHandler extends AbstractIpv4ExtendedCommunity {
         if (common != null) {
             serializeCommon(inet4SpecificExtendedCommunity.getInet4SpecificExtendedCommunityCommon(), byteAggregator);
         } else {
-            ByteBufWriteUtil.writeIpv4Address(inet4SpecificExtendedCommunity.getGlobalAdministrator(), byteAggregator);
+            Ipv4Util.writeIpv4Address(inet4SpecificExtendedCommunity.getGlobalAdministrator(), byteAggregator);
             byteAggregator.writeBytes(inet4SpecificExtendedCommunity.getLocalAdministrator());
         }
     }
@@ -56,5 +53,4 @@ public final class Ipv4SpecificEcHandler extends AbstractIpv4ExtendedCommunity {
     public int getSubType() {
         return SUBTYPE;
     }
-
 }