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
8 package org.opendaylight.protocol.bgp.flowspec;
10 import io.netty.buffer.ByteBuf;
11 import java.util.List;
12 import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.AFI;
13 import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
14 import org.opendaylight.protocol.bgp.flowspec.ipv6.FlowspecIpv6NlriParserHelper;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.FlowspecBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.FlowspecType;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.ipv6.DestinationFlowspecIpv6;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.ipv6.DestinationFlowspecIpv6Builder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
22 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
24 public final class SimpleFlowspecIpv6NlriParser extends AbstractFlowspecIpNlriParser {
25 public SimpleFlowspecIpv6NlriParser(final SAFI safi) {
26 super(FlowspecTypeRegistries.getFlowspecTypeRegistry(AFI.IPV6, safi));
30 DestinationType createAdvertizedRoutesDestinationType(final List<Flowspec> flowspecList, final PathId pathId) {
31 return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update
32 .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
33 .setDestinationFlowspecIpv6(new DestinationFlowspecIpv6Builder()
34 .setFlowspec(flowspecList)
41 DestinationType createWithdrawnDestinationType(final List<Flowspec> flowspecList, final PathId pathId) {
42 return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update
43 .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
44 .setDestinationFlowspecIpv6(new DestinationFlowspecIpv6Builder()
45 .setFlowspec(flowspecList)
52 public void extractSpecificFlowspec(final ChoiceNode fsType, final FlowspecBuilder fsBuilder) {
53 FlowspecIpv6NlriParserHelper.extractFlowspec(fsType, fsBuilder);
57 protected void stringSpecificFSNlriType(final FlowspecType value, final StringBuilder buffer) {
58 FlowspecIpv6NlriParserHelper.buildFlowspecString(value, buffer);
62 protected void serializeMpReachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
63 if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120
64 .update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6Case) {
65 final DestinationFlowspecIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
66 .yang.bgp.flowspec.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type
67 .DestinationFlowspecIpv6Case) dstType).getDestinationFlowspecIpv6();
68 serializeNlri(destFlowspec.getFlowspec(), destFlowspec.getPathId(), byteAggregator);
73 protected void serializeMpUnreachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
74 if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120
75 .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6Case) {
76 final DestinationFlowspecIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
77 .yang.bgp.flowspec.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
78 .DestinationFlowspecIpv6Case) dstType).getDestinationFlowspecIpv6();
79 serializeNlri(destFlowspec.getFlowspec(), destFlowspec.getPathId(), byteAggregator);