68e7817d01063bcc667ea478d84f7e696b8eac29
[bgpcep.git] / bgp / parser-impl / src / main / java / org / opendaylight / protocol / bgp / parser / impl / message / update / next / hop / Ipv6NextHopParserSerializer.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop;
10
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.rev130919.next.hop.CNextHop;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCase;
18
19 public final class Ipv6NextHopParserSerializer implements NextHopParserSerializer {
20     @Override
21     public CNextHop parseNextHop(final ByteBuf buffer) throws BGPParsingException {
22         return NextHopUtil.parseNextHop(buffer);
23
24     }
25
26     @Override
27     public void serializeNextHop(final CNextHop cNextHop, final ByteBuf byteAggregator) {
28         Preconditions.checkArgument(cNextHop instanceof Ipv6NextHopCase, "cNextHop is not a Ipv6 NextHop object.");
29         NextHopUtil.serializeNextHop(cNextHop,byteAggregator);
30     }
31 }