2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.protocol.bgp.inet.codec.nexthop;
11 import com.google.common.base.Preconditions;
12 import io.netty.buffer.ByteBuf;
13 import org.opendaylight.bgp.concepts.NextHopUtil;
14 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
15 import org.opendaylight.protocol.bgp.parser.spi.NextHopParserSerializer;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.CNextHop;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.Ipv6NextHopCase;
19 public final class Ipv6NextHopParserSerializer implements NextHopParserSerializer {
21 public CNextHop parseNextHop(final ByteBuf buffer) throws BGPParsingException {
22 return NextHopUtil.parseNextHop(buffer);
27 public void serializeNextHop(final CNextHop nextHop, final ByteBuf byteAggregator) {
28 Preconditions.checkArgument(nextHop instanceof Ipv6NextHopCase,
29 "cNextHop is not a Ipv6 NextHop object.");
30 NextHopUtil.serializeNextHop(nextHop, byteAggregator);