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 org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecTypeRegistry;
13 import org.opendaylight.protocol.bgp.flowspec.ipv6.FlowspecIpv6NlriParserHelper;
14 import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnNlriParser;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.Flowspec;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.FlowspecBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.FlowspecType;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.destination.ipv6.DestinationFlowspecL3vpnIpv6;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.destination.ipv6.DestinationFlowspecL3vpnIpv6Builder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.RouteDistinguisher;
23 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
26 * L3 VPN IPv6 flowspec parser.
30 public final class FlowspecL3vpnIpv6NlriParser extends AbstractFlowspecL3vpnNlriParser {
32 public FlowspecL3vpnIpv6NlriParser(SimpleFlowspecTypeRegistry flowspecTypeRegistry) {
33 super(flowspecTypeRegistry);
37 public DestinationType createWithdrawnDestinationType(final Object[] nlriFields, 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
41 .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
42 .setDestinationFlowspecL3vpnIpv6(new DestinationFlowspecL3vpnIpv6Builder()
43 .setRouteDistinguisher(rd)
44 .setFlowspec(flowspecList)
50 public DestinationType createAdvertizedRoutesDestinationType(final Object[] nlriFields, final PathId pathId) {
51 final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
52 final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
53 return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
54 .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
55 .setDestinationFlowspecL3vpnIpv6(new DestinationFlowspecL3vpnIpv6Builder()
56 .setRouteDistinguisher(rd)
57 .setFlowspec(flowspecList)
63 public void extractSpecificFlowspec(final ChoiceNode fsType, final FlowspecBuilder fsBuilder) {
64 FlowspecIpv6NlriParserHelper.extractFlowspec(fsType, fsBuilder);
68 protected void stringSpecificFSNlriType(final FlowspecType value, final StringBuilder buffer) {
69 FlowspecIpv6NlriParserHelper.buildFlowspecString(value, buffer);
73 protected void serializeMpReachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
74 if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
75 .update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) {
76 final DestinationFlowspecL3vpnIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
77 .ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
78 .DestinationFlowspecL3vpnIpv6Case) dstType).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
93 .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) {
94 final DestinationFlowspecL3vpnIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
95 .ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
96 .DestinationFlowspecL3vpnIpv6Case) dstType).getDestinationFlowspecL3vpnIpv6();
99 destFlowspec.getRouteDistinguisher(),
100 destFlowspec.getFlowspec()
102 destFlowspec.getPathId(),