<afi xmlns:bgp="urn:opendaylight:params:xml:ns:yang:bgp-types">bgp:ipv6-address-family</afi>
<safi xmlns:flowspec="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">flowspec:flowspec-subsequent-address-family</safi>
</module>
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type-impl</type>
+ <name>ipv4-flowspec-l3vpn</name>
+ <afi xmlns:bgp="urn:opendaylight:params:xml:ns:yang:bgp-types">bgp:ipv4-address-family</afi>
+ <safi xmlns:flowspec="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">flowspec:flowspec-l3vpn-subsequent-address-family</safi>
+ </module>
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type-impl</type>
+ <name>ipv6-flowspec-l3vpn</name>
+ <afi xmlns:bgp="urn:opendaylight:params:xml:ns:yang:bgp-types">bgp:ipv6-address-family</afi>
+ <safi xmlns:flowspec="urn:opendaylight:params:xml:ns:yang:bgp-flowspec">flowspec:flowspec-l3vpn-subsequent-address-family</safi>
+ </module>
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type-impl</type>
<name>ipv4-labeled-unicast</name>
<name>ipv6-flowspec</name>
<provider>/modules/module[type='bgp-table-type-impl'][name='ipv6-flowspec']</provider>
</instance>
+ <instance>
+ <name>ipv4-flowspec-l3vpn</name>
+ <provider>/modules/module[type='bgp-table-type-impl'][name='ipv4-flowspec-l3vpn']</provider>
+ </instance>
+ <instance>
+ <name>ipv6-flowspec-l3vpn</name>
+ <provider>/modules/module[type='bgp-table-type-impl'][name='ipv6-flowspec-l3vpn']</provider>
+ </instance>
<instance>
<name>ipv4-labeled-unicast</name>
<provider>/modules/module[type='bgp-table-type-impl'][name='ipv4-labeled-unicast']</provider>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
<name>ipv6-flowspec</name>
</advertized-table>
+ <advertized-table>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
+ <name>ipv4-flowspec-l3vpn</name>
+ </advertized-table>
+ <advertized-table>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
+ <name>ipv6-flowspec-l3vpn</name>
+ </advertized-table>
<advertized-table>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
<name>ipv4-labeled-unicast</name>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
<name>ipv6-flowspec</name>
</local-table>
+ <local-table>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
+ <name>ipv4-flowspec-l3vpn</name>
+ </local-table>
+ <local-table>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
+ <name>ipv6-flowspec-l3vpn</name>
+ </local-table>
<local-table>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
<name>ipv4-labeled-unicast</name>
* @param pathId associated path id with given NLRI
* @return created destination type
*/
- protected abstract DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId);
+ public abstract DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId);
/**
* Create advertized destination type
* @param pathId associated path id with given NLRI
* @return created destination type
*/
- protected abstract DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId);
+ public abstract DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId);
@Override
public final void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
package org.opendaylight.protocol.bgp.flowspec;
import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.protocol.bgp.parser.spi.PathIdUtil;
import org.opendaylight.protocol.bgp.rib.spi.MultiPathAbstractRIBSupport;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.FlowspecSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.PathId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.destination.DestinationType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Route;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.tables.Routes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public abstract class AbstractFlowspecRIBSupport extends MultiPathAbstractRIBSupport {
- protected AbstractFlowspecRIBSupport(final Class<? extends Routes> cazeClass, final Class<? extends DataObject> containerClass,
- final Class<? extends Route> listClass, final Class<? extends AddressFamily> afiClass, final QName destinationQname) {
- super(cazeClass, containerClass, listClass, afiClass, FlowspecSubsequentAddressFamily.class, "route-key", destinationQname);
- }
+public abstract class AbstractFlowspecRIBSupport<T extends AbstractFlowspecNlriParser> extends MultiPathAbstractRIBSupport {
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractFlowspecRIBSupport.class);
+
+ protected final T nlriParser;
+
+ protected AbstractFlowspecRIBSupport(
+ final Class<? extends Routes> cazeClass,
+ final Class<? extends DataObject> containerClass,
+ final Class<? extends Route> listClass,
+ final Class<? extends AddressFamily> afiClass,
+ final Class<? extends SubsequentAddressFamily> safiClass,
+ final QName dstContainerClassQName,
+ final T nlriParser
+ ) {
+ super(cazeClass, containerClass, listClass, afiClass, safiClass, "route-key", dstContainerClassQName);
- protected abstract AbstractFlowspecNlriParser getParser();
+ this.nlriParser = Preconditions.checkNotNull(nlriParser);
+ }
@Override
+ @Nonnull
public final ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
return ImmutableSet.of();
}
@Override
+ @Nonnull
public final ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
return ImmutableSet.of();
}
protected DestinationType buildDestination(@Nonnull final Collection<MapEntryNode> routes) {
final MapEntryNode routesCont = Iterables.getOnlyElement(routes);
final PathId pathId = PathIdUtil.buildPathId(routesCont, routePathIdNid());
- return getParser().createAdvertizedRoutesDestinationType(new Object[] {getParser().extractFlowspec(routesCont)}, pathId);
+ return this.nlriParser.createAdvertizedRoutesDestinationType(
+ new Object[] {this.nlriParser.extractFlowspec(routesCont)},
+ pathId
+ );
}
@Nonnull
protected DestinationType buildWithdrawnDestination(@Nonnull final Collection<MapEntryNode> routes) {
final MapEntryNode routesCont = Iterables.getOnlyElement(routes);
final PathId pathId = PathIdUtil.buildPathId(routesCont, routePathIdNid());
- return getParser().createWithdrawnDestinationType(new Object[] {getParser().extractFlowspec(Iterables.getOnlyElement(routes))}, pathId);
+ return this.nlriParser.createWithdrawnDestinationType(
+ new Object[] {this.nlriParser.extractFlowspec(Iterables.getOnlyElement(routes))},
+ pathId
+ );
}
@Override
- protected final void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
- final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
+ protected final void processDestination(
+ final DOMDataWriteTransaction tx,
+ final YangInstanceIdentifier routesPath,
+ final ContainerNode destination,
+ final ContainerNode attributes,
+ final ApplyRoute function
+ ) {
if (destination != null) {
final YangInstanceIdentifier base = routesPath.node(routesContainerIdentifier()).node(routeQName());
final Optional<DataContainerChild<? extends PathArgument, ?>> maybePathIdLeaf = destination.getChild(routePathIdNid());
- final String routeKeyValue = getParser().stringNlri(destination);
+ final String routeKeyValue = this.nlriParser.stringNlri(destination);
final NodeIdentifierWithPredicates routeKey = PathIdUtil.createNidKey(routeQName(), routeKeyQName(), pathIdQName(), routeKeyValue, maybePathIdLeaf);
function.apply(tx, base, routeKey, destination, attributes);
}
*/
package org.opendaylight.protocol.bgp.flowspec;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.FlowspecSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.bgp.rib.rib.loc.rib.tables.routes.FlowspecRoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.destination.ipv4.DestinationFlowspec;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.ipv4.route.FlowspecRoute;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.routes.FlowspecRoutes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
-final class FlowspecIpv4RIBSupport extends AbstractFlowspecRIBSupport {
-
- private SimpleFlowspecIpv4NlriParser FS_PARSER;
+public final class FlowspecIpv4RIBSupport extends AbstractFlowspecRIBSupport<SimpleFlowspecIpv4NlriParser> {
public FlowspecIpv4RIBSupport(SimpleFlowspecExtensionProviderContext context) {
- super(FlowspecRoutesCase.class, FlowspecRoutes.class, FlowspecRoute.class, Ipv4AddressFamily.class, DestinationFlowspec.QNAME);
- FS_PARSER = new SimpleFlowspecIpv4NlriParser(context.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ super(
+ FlowspecRoutesCase.class,
+ FlowspecRoutes.class,
+ FlowspecRoute.class,
+ Ipv4AddressFamily.class,
+ FlowspecSubsequentAddressFamily.class,
+ DestinationFlowspec.QNAME,
+ new SimpleFlowspecIpv4NlriParser(context.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC))
+ );
}
static FlowspecIpv4RIBSupport getInstance(SimpleFlowspecExtensionProviderContext context) {
return new FlowspecIpv4RIBSupport(context);
}
-
- @Override
- protected AbstractFlowspecNlriParser getParser() {
- return FS_PARSER;
- }
}
*/
package org.opendaylight.protocol.bgp.flowspec;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.FlowspecSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.bgp.rib.rib.loc.rib.tables.routes.FlowspecIpv6RoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.destination.ipv6.DestinationFlowspec;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.ipv6.route.FlowspecRoute;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.ipv6.routes.FlowspecIpv6Routes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
-public final class FlowspecIpv6RIBSupport extends AbstractFlowspecRIBSupport {
-
- private SimpleFlowspecIpv6NlriParser FS_PARSER;
+public final class FlowspecIpv6RIBSupport extends AbstractFlowspecRIBSupport<SimpleFlowspecIpv6NlriParser> {
public FlowspecIpv6RIBSupport(SimpleFlowspecExtensionProviderContext context) {
- super(FlowspecIpv6RoutesCase.class, FlowspecIpv6Routes.class, FlowspecRoute.class, Ipv6AddressFamily.class, DestinationFlowspec.QNAME);
- FS_PARSER = new SimpleFlowspecIpv6NlriParser(context.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ super(
+ FlowspecIpv6RoutesCase.class,
+ FlowspecIpv6Routes.class,
+ FlowspecRoute.class,
+ Ipv6AddressFamily.class,
+ FlowspecSubsequentAddressFamily.class,
+ DestinationFlowspec.QNAME,
+ new SimpleFlowspecIpv6NlriParser(context.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC))
+ );
}
static FlowspecIpv6RIBSupport getInstance(SimpleFlowspecExtensionProviderContext context) {
return new FlowspecIpv6RIBSupport(context);
}
-
- @Override
- protected AbstractFlowspecNlriParser getParser() {
- return FS_PARSER;
- }
}
import java.util.ArrayList;
import java.util.List;
+import org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv4.FlowspecL3vpnIpv4RIBSupport;
+import org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv6.FlowspecL3vpnIpv6RIBSupport;
import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBExtensionProviderActivator;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.FlowspecL3vpnSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.FlowspecSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
final List<AutoCloseable> regs = new ArrayList<>();
regs.add(context.registerRIBSupport(Ipv4AddressFamily.class, FlowspecSubsequentAddressFamily.class, FlowspecIpv4RIBSupport.getInstance(fs_context)));
regs.add(context.registerRIBSupport(Ipv6AddressFamily.class, FlowspecSubsequentAddressFamily.class, FlowspecIpv6RIBSupport.getInstance(fs_context)));
+ regs.add(context.registerRIBSupport(Ipv4AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, FlowspecL3vpnIpv4RIBSupport.getInstance(fs_context)));
+ regs.add(context.registerRIBSupport(Ipv6AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, FlowspecL3vpnIpv6RIBSupport.getInstance(fs_context)));
return regs;
}
}
}
@Override
- protected DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[0];
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCaseBuilder()
.setDestinationFlowspec(
}
@Override
- protected DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[0];
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCaseBuilder()
.setDestinationFlowspec(
}
@Override
- protected DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[0];
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
.setDestinationFlowspec(
}
@Override
- protected DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[0];
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
.setDestinationFlowspec(
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.flowspec.l3vpn;
+
+import com.google.common.collect.Iterables;
+import java.util.Collection;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.opendaylight.bgp.concepts.RouteDistinguisherUtil;
+import org.opendaylight.protocol.bgp.flowspec.AbstractFlowspecRIBSupport;
+import org.opendaylight.protocol.bgp.parser.spi.PathIdUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.FlowspecL3vpnSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.PathId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.destination.DestinationType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Route;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.tables.Routes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.RouteDistinguisher;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Kevin Wang
+ */
+public abstract class AbstractFlowspecL3vpnRIBSupport<T extends AbstractFlowspecL3vpnNlriParser> extends AbstractFlowspecRIBSupport<T> {
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractFlowspecL3vpnRIBSupport.class);
+
+ private final NodeIdentifier RD_NID;
+
+ protected AbstractFlowspecL3vpnRIBSupport(
+ final Class<? extends Routes> cazeClass,
+ final Class<? extends DataObject> containerClass,
+ final Class<? extends Route> listClass,
+ final QName dstContainerClassQName,
+ final Class<? extends AddressFamily> afiClass,
+ final T flowspecNlriParser
+ ) {
+ super(cazeClass, containerClass, listClass, afiClass, FlowspecL3vpnSubsequentAddressFamily.class, dstContainerClassQName, flowspecNlriParser);
+ final QName RD_QNAME = QName.create(routeQName(), "route-distinguisher").intern();
+ RD_NID = new NodeIdentifier(RD_QNAME);
+ }
+
+ @Nullable
+ private RouteDistinguisher buildRouteDistinguisher(final DataContainerNode<? extends PathArgument> data) {
+ final NormalizedNode<?, ?> rdNode = NormalizedNodes.findNode(data, RD_NID).orNull();
+ RouteDistinguisher rd = null;
+ if (rdNode != null) {
+ rd = RouteDistinguisherUtil.parseRouteDistinguisher(rdNode.getValue());
+ }
+ return rd;
+ }
+
+ @Nonnull
+ @Override
+ protected DestinationType buildDestination(@Nonnull final Collection<MapEntryNode> routes) {
+ final MapEntryNode routesCont = Iterables.getOnlyElement(routes);
+ final PathId pathId = PathIdUtil.buildPathId(routesCont, routePathIdNid());
+ final RouteDistinguisher rd = buildRouteDistinguisher(routesCont);
+ return this.nlriParser.createAdvertizedRoutesDestinationType(
+ new Object[] {rd, this.nlriParser.extractFlowspec(routesCont)},
+ pathId
+ );
+ }
+
+ @Nonnull
+ @Override
+ protected DestinationType buildWithdrawnDestination(@Nonnull final Collection<MapEntryNode> routes) {
+ final MapEntryNode routesCont = Iterables.getOnlyElement(routes);
+ final PathId pathId = PathIdUtil.buildPathId(routesCont, routePathIdNid());
+ final RouteDistinguisher rd = buildRouteDistinguisher(routesCont);
+ return this.nlriParser.createWithdrawnDestinationType(
+ new Object[] {rd, nlriParser.extractFlowspec(Iterables.getOnlyElement(routes))},
+ pathId
+ );
+ }
+}
}
@Override
- protected DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
}
@Override
- protected DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv4;
+
+import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
+import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.bgp.rib.rib.loc.rib.tables.routes.FlowspecL3vpnIpv4RoutesCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.ipv4.route.FlowspecRoute;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.l3vpn.destination.ipv4.DestinationFlowspecL3vpnIpv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.l3vpn.ipv4.routes.FlowspecL3vpnIpv4Routes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
+
+/**
+ * @author Kevin Wang
+ */
+public final class FlowspecL3vpnIpv4RIBSupport extends AbstractFlowspecL3vpnRIBSupport<FlowspecL3vpnIpv4NlriParser> {
+
+ public FlowspecL3vpnIpv4RIBSupport(SimpleFlowspecExtensionProviderContext context) {
+ super(
+ FlowspecL3vpnIpv4RoutesCase.class,
+ FlowspecL3vpnIpv4Routes.class,
+ FlowspecRoute.class,
+ DestinationFlowspecL3vpnIpv4.QNAME,
+ Ipv4AddressFamily.class,
+ new FlowspecL3vpnIpv4NlriParser(context.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN))
+ );
+ }
+
+ public static final FlowspecL3vpnIpv4RIBSupport getInstance(SimpleFlowspecExtensionProviderContext context) {
+ return new FlowspecL3vpnIpv4RIBSupport(context);
+ }
+}
}
@Override
- protected DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
}
@Override
- protected DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv6;
+
+import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
+import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.bgp.rib.rib.loc.rib.tables.routes.FlowspecL3vpnIpv6RoutesCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.ipv6.route.FlowspecRoute;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.l3vpn.destination.ipv6.DestinationFlowspecL3vpnIpv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.flowspec.l3vpn.ipv6.routes.FlowspecL3vpnIpv6Routes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
+
+/**
+ * @author Kevin Wang
+ */
+public final class FlowspecL3vpnIpv6RIBSupport extends AbstractFlowspecL3vpnRIBSupport<FlowspecL3vpnIpv6NlriParser> {
+
+ public FlowspecL3vpnIpv6RIBSupport(SimpleFlowspecExtensionProviderContext context) {
+ super(
+ FlowspecL3vpnIpv6RoutesCase.class,
+ FlowspecL3vpnIpv6Routes.class,
+ FlowspecRoute.class,
+ DestinationFlowspecL3vpnIpv6.QNAME,
+ Ipv6AddressFamily.class,
+ new FlowspecL3vpnIpv6NlriParser(context.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN))
+ );
+ }
+
+ public static final FlowspecL3vpnIpv6RIBSupport getInstance(SimpleFlowspecExtensionProviderContext context) {
+ return new FlowspecL3vpnIpv6RIBSupport(context);
+ }
+}