Move route target ext comm container
[bgpcep.git] / bgp / parser-impl / src / main / java / org / opendaylight / protocol / bgp / parser / impl / message / update / extended / communities / route / target / As4RouteTargetExtendedHandler.java
1 /*
2  * Copyright (c) 2018 AT&T Intellectual Property. 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.extended.communities.route.target;
10
11 import io.netty.buffer.ByteBuf;
12 import org.opendaylight.protocol.bgp.parser.spi.extended.community.FourOctAsCommonECUtil;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.as._4.route.target.extended.community.grouping.As4RouteTargetExtendedCommunity;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.as._4.route.target.extended.community.grouping.As4RouteTargetExtendedCommunityBuilder;
15
16 /**
17  * Route Target 4 Octet As Handler.
18  *
19  * @author Claudio D. Gasparini
20  */
21 public final class As4RouteTargetExtendedHandler {
22     private As4RouteTargetExtendedHandler() {
23         throw new UnsupportedOperationException();
24     }
25
26     public static As4RouteTargetExtendedCommunity parse(final ByteBuf body) {
27         return new As4RouteTargetExtendedCommunityBuilder()
28                 .setAs4SpecificCommon(FourOctAsCommonECUtil.parseCommon(body)).build();
29     }
30
31     public static void serialize(final As4RouteTargetExtendedCommunity as4RouteTargetExtendedCommunity,
32             final ByteBuf body) {
33         FourOctAsCommonECUtil.serializeCommon(as4RouteTargetExtendedCommunity.getAs4SpecificCommon(), body);
34     }
35 }