2 * Copyright (c) 2016 Brocade Communications 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
8 package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv6;
10 import io.netty.buffer.ByteBuf;
11 import java.util.List;
12 import javax.annotation.Nonnull;
13 import javax.annotation.Nullable;
14 import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecTypeRegistry;
15 import org.opendaylight.protocol.bgp.flowspec.ipv6.FlowspecIpv6NlriParserHelper;
16 import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnNlriParser;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.Flowspec;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.FlowspecBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.FlowspecType;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.destination.ipv6.DestinationFlowspecL3vpnIpv6;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.destination.ipv6.DestinationFlowspecL3vpnIpv6Builder;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.RouteDistinguisher;
25 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
30 public final class FlowspecL3vpnIpv6NlriParser extends AbstractFlowspecL3vpnNlriParser {
32 public FlowspecL3vpnIpv6NlriParser(SimpleFlowspecTypeRegistry flowspecTypeRegistry) {
33 super(flowspecTypeRegistry);
37 public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
38 final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
39 final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
40 return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
41 .setDestinationFlowspecL3vpnIpv6(
42 new DestinationFlowspecL3vpnIpv6Builder()
43 .setRouteDistinguisher(rd)
44 .setFlowspec(flowspecList)
51 public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
52 final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
53 final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
54 return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
55 .setDestinationFlowspecL3vpnIpv6(
56 new DestinationFlowspecL3vpnIpv6Builder()
57 .setRouteDistinguisher(rd)
58 .setFlowspec(flowspecList)
65 public void extractSpecificFlowspec(final ChoiceNode fsType, final FlowspecBuilder fsBuilder) {
66 FlowspecIpv6NlriParserHelper.extractFlowspec(fsType, fsBuilder);
70 protected void stringSpecificFSNlriType(final FlowspecType value, final StringBuilder buffer) {
71 FlowspecIpv6NlriParserHelper.buildFlowspecString(value, buffer);
75 protected void serializeMpReachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
76 if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) {
77 final DestinationFlowspecL3vpnIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) dstType)
78 .getDestinationFlowspecL3vpnIpv6();
81 destFlowspec.getRouteDistinguisher(),
82 destFlowspec.getFlowspec()
84 destFlowspec.getPathId(),
91 protected void serializeMpUnreachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
92 if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) {
93 final DestinationFlowspecL3vpnIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) dstType)
94 .getDestinationFlowspecL3vpnIpv6();
97 destFlowspec.getRouteDistinguisher(),
98 destFlowspec.getFlowspec()
100 destFlowspec.getPathId(),