public static final NodeIdentifier VALUE_NID
= new NodeIdentifier(QName.create(Flowspec.QNAME.getModule(), "value"));
- protected final SimpleFlowspecTypeRegistry flowspecTypeRegistry;
+ protected final FlowspecTypeRegistry flowspecTypeRegistry;
/**
* Add this constant to length value to achieve all ones in the leftmost nibble.
private static final String FLOW_SEPARATOR = " AND ";
- protected AbstractFlowspecNlriParser(final SimpleFlowspecTypeRegistry flowspecTypeRegistry) {
+ protected AbstractFlowspecNlriParser(final FlowspecTypeRegistry flowspecTypeRegistry) {
this.flowspecTypeRegistry = requireNonNull(flowspecTypeRegistry);
}
*/
package org.opendaylight.protocol.bgp.flowspec;
-import static java.util.Objects.requireNonNull;
-
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.kohsuke.MetaInfServices;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.extended.communities.RedirectAsFourOctetEcHandler;
import org.opendaylight.protocol.bgp.flowspec.extended.communities.RedirectAsTwoOctetEcHandler;
import org.opendaylight.protocol.bgp.flowspec.extended.communities.RedirectIpNextHopEcHandler;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv4NextHopCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv6NextHopCase;
import org.opendaylight.yangtools.concepts.Registration;
+import org.osgi.service.component.annotations.Component;
+@Singleton
+@Component(immediate = true, service = BGPExtensionProviderActivator.class,
+ property = "type=org.opendaylight.protocol.bgp.flowspec.BGPActivator")
@MetaInfServices(value = BGPExtensionProviderActivator.class)
public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
private static final int FLOWSPEC_SAFI = 133;
private static final int FLOWSPEC_L3VPN_SAFI = 134;
- private final FlowspecActivator activator;
-
- // FIXME: this needs proper injection
- public BGPActivator(final @NonNull FlowspecActivator activator) {
- this.activator = requireNonNull(activator);
+ @Inject
+ public BGPActivator() {
+ // Exposed for DI
}
@Override
protected List<Registration> startImpl(final BGPExtensionProviderContext context) {
- final SimpleFlowspecExtensionProviderContext flowspecContext = activator.getContext();
-
final List<Registration> regs = new ArrayList<>();
regs.add(context.registerSubsequentAddressFamily(FlowspecSubsequentAddressFamily.class, FLOWSPEC_SAFI));
regs.add(context.registerSubsequentAddressFamily(FlowspecL3vpnSubsequentAddressFamily.class,
final Ipv4NextHopParserSerializer ipv4NextHopParser = new Ipv4NextHopParserSerializer();
final Ipv6NextHopParserSerializer ipv6NextHopParser = new Ipv6NextHopParserSerializer();
- final SimpleFlowspecIpv4NlriParser fsIpv4Handler = new SimpleFlowspecIpv4NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
- final SimpleFlowspecIpv6NlriParser fsIpv6Handler = new SimpleFlowspecIpv6NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser fsIpv4Handler = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
+ final SimpleFlowspecIpv6NlriParser fsIpv6Handler = new SimpleFlowspecIpv6NlriParser(SAFI.FLOWSPEC);
regs.add(context.registerNlriParser(Ipv4AddressFamily.class, FlowspecSubsequentAddressFamily.class,
fsIpv4Handler, ipv4NextHopParser, Ipv4NextHopCase.class));
regs.add(context.registerNlriParser(Ipv6AddressFamily.class, FlowspecSubsequentAddressFamily.class,
regs.add(context.registerNlriSerializer(FlowspecRoutes.class, fsIpv4Handler));
regs.add(context.registerNlriSerializer(FlowspecIpv6Routes.class, fsIpv6Handler));
- final FlowspecL3vpnIpv4NlriParser fsL3vpnIpv4Handler = new FlowspecL3vpnIpv4NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
- final FlowspecL3vpnIpv6NlriParser fsL3vpnIpv6Handler = new FlowspecL3vpnIpv6NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser fsL3vpnIpv4Handler = new FlowspecL3vpnIpv4NlriParser(SAFI.FLOWSPEC_VPN);
+ final FlowspecL3vpnIpv6NlriParser fsL3vpnIpv6Handler = new FlowspecL3vpnIpv6NlriParser(SAFI.FLOWSPEC_VPN);
regs.add(context.registerNlriParser(Ipv4AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class,
fsL3vpnIpv4Handler, ipv4NextHopParser, Ipv4NextHopCase.class));
regs.add(context.registerNlriParser(Ipv6AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class,
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco 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;
-
-import static java.util.Objects.requireNonNull;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv4DestinationPrefixHandler;
-import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv4FragmentHandler;
-import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv4SourcePrefixHandler;
-import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv6DestinationPrefixHandler;
-import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv6FragmentHandler;
-import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv6SourcePrefixHandler;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.DestinationPortCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.DscpCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.FragmentCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.IcmpCodeCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.IcmpTypeCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.PacketLengthCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.PortCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.SourcePortCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.TcpFlagsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.DestinationPrefixCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.ProtocolIpCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.SourcePrefixCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv6.flowspec.flowspec.type.DestinationIpv6PrefixCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv6.flowspec.flowspec.type.FlowLabelCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv6.flowspec.flowspec.type.NextHeaderCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv6.flowspec.flowspec.type.SourceIpv6PrefixCase;
-import org.opendaylight.yangtools.concepts.Registration;
-
-public final class FlowspecActivator implements AutoCloseable {
- private final SimpleFlowspecExtensionProviderContext context;
- private List<Registration> registrations = new ArrayList<>();
-
- public SimpleFlowspecExtensionProviderContext getContext() {
- return this.context;
- }
-
- public FlowspecActivator(final @NonNull SimpleFlowspecExtensionProviderContext context) {
- this.context = requireNonNull(context);
-
- for (SimpleFlowspecExtensionProviderContext.SAFI safi : SimpleFlowspecExtensionProviderContext.SAFI.values()) {
- registerCommonFlowspecTypeHandlers(
- SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- safi
- );
- registerIpv4FlowspecTypeHandlers(
- SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- safi
- );
-
- registerCommonFlowspecTypeHandlers(
- SimpleFlowspecExtensionProviderContext.AFI.IPV6,
- safi
- );
- registerIpv6FlowspecTypeHandlers(
- SimpleFlowspecExtensionProviderContext.AFI.IPV6,
- safi
- );
- }
- }
-
- /**
- * Register the common flowspec type handlers.
- */
- private void registerCommonFlowspecTypeHandlers(
- final SimpleFlowspecExtensionProviderContext.AFI afi,
- final SimpleFlowspecExtensionProviderContext.SAFI safi
- ) {
- final SimpleFlowspecTypeRegistry flowspecTypeRegistry = this.context.getFlowspecTypeRegistry(afi, safi);
-
- final FSPortHandler portHandler = new FSPortHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSPortHandler.PORT_VALUE, portHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(PortCase.class, portHandler));
-
- final FSDestinationPortHandler destinationPortHandler = new FSDestinationPortHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(
- FSDestinationPortHandler.DESTINATION_PORT_VALUE, destinationPortHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(DestinationPortCase.class,
- destinationPortHandler));
-
- final FSSourcePortHandler sourcePortHandler = new FSSourcePortHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSSourcePortHandler.SOURCE_PORT_VALUE,
- sourcePortHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(SourcePortCase.class,
- sourcePortHandler));
-
- final FSIcmpTypeHandler icmpTypeHandler = new FSIcmpTypeHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSIcmpTypeHandler.ICMP_TYPE_VALUE,
- icmpTypeHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(IcmpTypeCase.class,
- icmpTypeHandler));
-
- final FSIcmpCodeHandler icmpCodeHandler = new FSIcmpCodeHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSIcmpCodeHandler.ICMP_CODE_VALUE,
- icmpCodeHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(IcmpCodeCase.class,
- icmpCodeHandler));
-
- final FSTcpFlagsHandler tcpFlagsHandler = new FSTcpFlagsHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSTcpFlagsHandler.TCP_FLAGS_VALUE,
- tcpFlagsHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(TcpFlagsCase.class,
- tcpFlagsHandler));
-
- final FSPacketLengthHandler packetlengthHandler = new FSPacketLengthHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(
- FSPacketLengthHandler.PACKET_LENGTH_VALUE, packetlengthHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(PacketLengthCase.class,
- packetlengthHandler));
-
- final FSDscpHandler dscpHandler = new FSDscpHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSDscpHandler.DSCP_VALUE, dscpHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(DscpCase.class, dscpHandler));
- }
-
- private void registerIpv4FlowspecTypeHandlers(
- final SimpleFlowspecExtensionProviderContext.AFI afi,
- final SimpleFlowspecExtensionProviderContext.SAFI safi
- ) {
- final SimpleFlowspecTypeRegistry flowspecTypeRegistry = this.context.getFlowspecTypeRegistry(afi, safi);
-
- final FSIpv4DestinationPrefixHandler destinationPrefixHandler = new FSIpv4DestinationPrefixHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(
- FSIpv4DestinationPrefixHandler.DESTINATION_PREFIX_VALUE, destinationPrefixHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(DestinationPrefixCase.class,
- destinationPrefixHandler));
-
- final FSIpv4SourcePrefixHandler sourcePrefixHandler = new FSIpv4SourcePrefixHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(
- FSIpv4SourcePrefixHandler.SOURCE_PREFIX_VALUE, sourcePrefixHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(SourcePrefixCase.class,
- sourcePrefixHandler));
-
- final FSIpProtocolHandler ipProtocolHandler = new FSIpProtocolHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSIpProtocolHandler.IP_PROTOCOL_VALUE,
- ipProtocolHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(ProtocolIpCase.class,
- ipProtocolHandler));
-
- final FSIpv4FragmentHandler fragmentHandler = new FSIpv4FragmentHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSIpv4FragmentHandler.FRAGMENT_VALUE,
- fragmentHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(FragmentCase.class,
- fragmentHandler));
- }
-
- private void registerIpv6FlowspecTypeHandlers(
- final SimpleFlowspecExtensionProviderContext.AFI afi,
- final SimpleFlowspecExtensionProviderContext.SAFI safi
- ) {
- final SimpleFlowspecTypeRegistry flowspecTypeRegistry = this.context.getFlowspecTypeRegistry(afi, safi);
-
- final FSIpv6DestinationPrefixHandler destinationPrefixHandler = new FSIpv6DestinationPrefixHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(
- FSIpv6DestinationPrefixHandler.IPV6_DESTINATION_PREFIX_VALUE, destinationPrefixHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(DestinationIpv6PrefixCase.class,
- destinationPrefixHandler));
-
- final FSIpv6SourcePrefixHandler sourcePrefixHandler = new FSIpv6SourcePrefixHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(
- FSIpv6SourcePrefixHandler.SOURCE_PREFIX_VALUE, sourcePrefixHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(SourceIpv6PrefixCase.class,
- sourcePrefixHandler));
-
- final FSIpv6NextHeaderHandler nextHeaderHandler = new FSIpv6NextHeaderHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(
- FSIpv6NextHeaderHandler.NEXT_HEADER_VALUE, nextHeaderHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(NextHeaderCase.class,
- nextHeaderHandler));
-
- final FSIpv6FragmentHandler fragmentHandler = new FSIpv6FragmentHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSIpv6FragmentHandler.FRAGMENT_VALUE,
- fragmentHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(FragmentCase.class,
- fragmentHandler));
-
- final FSIpv6FlowLabelHandler flowlabelHandler = new FSIpv6FlowLabelHandler();
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSIpv6FlowLabelHandler.FLOW_LABEL_VALUE,
- flowlabelHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(FlowLabelCase.class,
- flowlabelHandler));
- }
-
- @Override
- public void close() {
- if (this.registrations != null) {
- this.registrations.forEach(Registration::close);
- this.registrations = null;
- }
- }
-}
import java.util.Map;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.FlowspecSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.bgp.rib.rib.loc.rib.tables.routes.FlowspecRoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.ipv4.DestinationFlowspecIpv4;
FlowspecRoute,
FlowspecRouteKey> {
private static final FlowspecRoutes EMPTY_CONTAINER = new FlowspecRoutesBuilder().build();
- private static FlowspecIpv4RIBSupport SINGLETON;
- private FlowspecIpv4RIBSupport(final SimpleFlowspecExtensionProviderContext context,
- final BindingNormalizedNodeSerializer mappingService) {
+ public FlowspecIpv4RIBSupport(final BindingNormalizedNodeSerializer mappingService) {
super(
mappingService,
FlowspecRoutesCase.class,
Ipv4AddressFamily.class,
FlowspecSubsequentAddressFamily.class,
DestinationFlowspecIpv4.QNAME,
- new SimpleFlowspecIpv4NlriParser(context
- .getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC))
+ new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC)
);
}
- static synchronized FlowspecIpv4RIBSupport getInstance(
- final SimpleFlowspecExtensionProviderContext context,
- final BindingNormalizedNodeSerializer mappingService) {
- if (SINGLETON == null) {
- SINGLETON = new FlowspecIpv4RIBSupport(context, mappingService);
- }
- return SINGLETON;
- }
-
@Override
public FlowspecRoute createRoute(final FlowspecRoute route, final FlowspecRouteKey key,
final Attributes attributes) {
import java.util.Map;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.FlowspecSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.bgp.rib.rib.loc.rib.tables.routes.FlowspecIpv6RoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.ipv6.DestinationFlowspecIpv6;
FlowspecRoute,
FlowspecRouteKey> {
private static final FlowspecIpv6Routes EMPTY_CONTAINER = new FlowspecIpv6RoutesBuilder().build();
- private static FlowspecIpv6RIBSupport SINGLETON;
- private FlowspecIpv6RIBSupport(final SimpleFlowspecExtensionProviderContext context,
- final BindingNormalizedNodeSerializer mappingService) {
+ public FlowspecIpv6RIBSupport(final BindingNormalizedNodeSerializer mappingService) {
super(
mappingService,
FlowspecIpv6RoutesCase.class,
Ipv6AddressFamily.class,
FlowspecSubsequentAddressFamily.class,
DestinationFlowspecIpv6.QNAME,
- new SimpleFlowspecIpv6NlriParser(context
- .getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC))
+ new SimpleFlowspecIpv6NlriParser(SAFI.FLOWSPEC)
);
}
- static synchronized FlowspecIpv6RIBSupport getInstance(
- final SimpleFlowspecExtensionProviderContext context,
- final BindingNormalizedNodeSerializer mappingService) {
- if (SINGLETON == null) {
- SINGLETON = new FlowspecIpv6RIBSupport(context, mappingService);
- }
- return SINGLETON;
- }
-
@Override
public FlowspecRoute createRoute(final FlowspecRoute route, final FlowspecRouteKey key,
final Attributes attributes) {
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o.
+ *
+ * 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;
+
+public final class FlowspecTypeRegistries {
+ public enum AFI {
+ IPV4(),
+ IPV6(),
+ }
+
+ public enum SAFI {
+ FLOWSPEC,
+ FLOWSPEC_VPN,
+ }
+
+ private static final FlowspecTypeRegistry[][] FLOWSPEC_TYPE_REGISTRIES;
+
+ static {
+ final FlowspecTypeRegistry[][] regs = new FlowspecTypeRegistry[AFI.values().length][SAFI.values().length];
+ for (SAFI safi : SAFI.values()) {
+ regs[AFI.IPV4.ordinal()][safi.ordinal()] = new FlowspecTypeRegistryBuilder()
+ .registerIpv4FlowspecTypeHandlers().build();
+ regs[AFI.IPV6.ordinal()][safi.ordinal()] = new FlowspecTypeRegistryBuilder()
+ .registerIpv6FlowspecTypeHandlers().build();
+ }
+ FLOWSPEC_TYPE_REGISTRIES = regs;
+ }
+
+ private FlowspecTypeRegistries() {
+ // Hidden on purpose
+ }
+
+ public static FlowspecTypeRegistry getFlowspecTypeRegistry(final AFI afi, final SAFI safi) {
+ return FLOWSPEC_TYPE_REGISTRIES[afi.ordinal()][safi.ordinal()];
+ }
+}
/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import org.opendaylight.protocol.bgp.flowspec.handlers.FlowspecTypeSerializer;
import org.opendaylight.protocol.concepts.HandlerRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.FlowspecType;
-import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.DataContainer;
-public class SimpleFlowspecTypeRegistry {
- private final HandlerRegistry<DataContainer, FlowspecTypeParser, FlowspecTypeSerializer> handlers =
- new HandlerRegistry<>();
+public final class FlowspecTypeRegistry {
+ private final HandlerRegistry<DataContainer, FlowspecTypeParser, FlowspecTypeSerializer> handlers;
+
+ FlowspecTypeRegistry(final HandlerRegistry<DataContainer, FlowspecTypeParser, FlowspecTypeSerializer> handlers) {
+ this.handlers = requireNonNull(handlers);
+ }
public FlowspecTypeParser getFlowspecTypeParser(final short type) {
- return this.handlers.getParser(type);
+ return handlers.getParser(type);
}
public FlowspecTypeSerializer getFlowspecTypeSerializer(final FlowspecType fsType) {
- return this.handlers.getSerializer(fsType.implementedInterface());
+ return handlers.getSerializer(fsType.implementedInterface());
}
public void serializeFlowspecType(final FlowspecType fsType, final ByteBuf output) {
requireNonNull(parser, "parser for flowspec type " + type + " is not registered");
return parser.parseType(buffer);
}
-
- public Registration registerFlowspecTypeParser(final int type, final FlowspecTypeParser parser) {
- return this.handlers.registerParser(type, parser);
- }
-
- public Registration registerFlowspecTypeSerializer(final Class<? extends FlowspecType> typeClass,
- final FlowspecTypeSerializer serializer) {
- return this.handlers.registerSerializer(typeClass, serializer);
- }
}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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;
+
+import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv4DestinationPrefixHandler;
+import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv4FragmentHandler;
+import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv4SourcePrefixHandler;
+import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv6DestinationPrefixHandler;
+import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv6FragmentHandler;
+import org.opendaylight.protocol.bgp.flowspec.handlers.FSIpv6SourcePrefixHandler;
+import org.opendaylight.protocol.bgp.flowspec.handlers.FlowspecTypeParser;
+import org.opendaylight.protocol.bgp.flowspec.handlers.FlowspecTypeSerializer;
+import org.opendaylight.protocol.concepts.HandlerRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.FlowspecType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.DestinationPortCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.DscpCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.FragmentCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.IcmpCodeCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.IcmpTypeCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.PacketLengthCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.PortCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.SourcePortCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.TcpFlagsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.DestinationPrefixCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.ProtocolIpCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.SourcePrefixCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv6.flowspec.flowspec.type.DestinationIpv6PrefixCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv6.flowspec.flowspec.type.FlowLabelCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv6.flowspec.flowspec.type.NextHeaderCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv6.flowspec.flowspec.type.SourceIpv6PrefixCase;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
+
+final class FlowspecTypeRegistryBuilder implements Builder<FlowspecTypeRegistry> {
+ private final HandlerRegistry<DataContainer, FlowspecTypeParser, FlowspecTypeSerializer> handlers =
+ new HandlerRegistry<>();
+
+ FlowspecTypeRegistryBuilder() {
+ final FSPortHandler portHandler = new FSPortHandler();
+ registerFlowspecTypeParser(FSPortHandler.PORT_VALUE, portHandler);
+ registerFlowspecTypeSerializer(PortCase.class, portHandler);
+
+ final FSDestinationPortHandler destinationPortHandler = new FSDestinationPortHandler();
+ registerFlowspecTypeParser(FSDestinationPortHandler.DESTINATION_PORT_VALUE, destinationPortHandler);
+ registerFlowspecTypeSerializer(DestinationPortCase.class, destinationPortHandler);
+
+ final FSSourcePortHandler sourcePortHandler = new FSSourcePortHandler();
+ registerFlowspecTypeParser(FSSourcePortHandler.SOURCE_PORT_VALUE, sourcePortHandler);
+ registerFlowspecTypeSerializer(SourcePortCase.class, sourcePortHandler);
+
+ final FSIcmpTypeHandler icmpTypeHandler = new FSIcmpTypeHandler();
+ registerFlowspecTypeParser(FSIcmpTypeHandler.ICMP_TYPE_VALUE, icmpTypeHandler);
+ registerFlowspecTypeSerializer(IcmpTypeCase.class, icmpTypeHandler);
+
+ final FSIcmpCodeHandler icmpCodeHandler = new FSIcmpCodeHandler();
+ registerFlowspecTypeParser(FSIcmpCodeHandler.ICMP_CODE_VALUE, icmpCodeHandler);
+ registerFlowspecTypeSerializer(IcmpCodeCase.class, icmpCodeHandler);
+
+ final FSTcpFlagsHandler tcpFlagsHandler = new FSTcpFlagsHandler();
+ registerFlowspecTypeParser(FSTcpFlagsHandler.TCP_FLAGS_VALUE, tcpFlagsHandler);
+ registerFlowspecTypeSerializer(TcpFlagsCase.class, tcpFlagsHandler);
+
+ final FSPacketLengthHandler packetlengthHandler = new FSPacketLengthHandler();
+ registerFlowspecTypeParser(FSPacketLengthHandler.PACKET_LENGTH_VALUE, packetlengthHandler);
+ registerFlowspecTypeSerializer(PacketLengthCase.class, packetlengthHandler);
+
+ final FSDscpHandler dscpHandler = new FSDscpHandler();
+ registerFlowspecTypeParser(FSDscpHandler.DSCP_VALUE, dscpHandler);
+ registerFlowspecTypeSerializer(DscpCase.class, dscpHandler);
+ }
+
+ FlowspecTypeRegistryBuilder registerIpv4FlowspecTypeHandlers() {
+ final FSIpv4DestinationPrefixHandler destinationPrefixHandler = new FSIpv4DestinationPrefixHandler();
+ registerFlowspecTypeParser(FSIpv4DestinationPrefixHandler.DESTINATION_PREFIX_VALUE, destinationPrefixHandler);
+ registerFlowspecTypeSerializer(DestinationPrefixCase.class, destinationPrefixHandler);
+
+ final FSIpv4SourcePrefixHandler sourcePrefixHandler = new FSIpv4SourcePrefixHandler();
+ registerFlowspecTypeParser(FSIpv4SourcePrefixHandler.SOURCE_PREFIX_VALUE, sourcePrefixHandler);
+ registerFlowspecTypeSerializer(SourcePrefixCase.class, sourcePrefixHandler);
+
+ final FSIpProtocolHandler ipProtocolHandler = new FSIpProtocolHandler();
+ registerFlowspecTypeParser(FSIpProtocolHandler.IP_PROTOCOL_VALUE, ipProtocolHandler);
+ registerFlowspecTypeSerializer(ProtocolIpCase.class, ipProtocolHandler);
+
+ final FSIpv4FragmentHandler fragmentHandler = new FSIpv4FragmentHandler();
+ registerFlowspecTypeParser(FSIpv4FragmentHandler.FRAGMENT_VALUE, fragmentHandler);
+ registerFlowspecTypeSerializer(FragmentCase.class, fragmentHandler);
+ return this;
+ }
+
+ FlowspecTypeRegistryBuilder registerIpv6FlowspecTypeHandlers() {
+ final FSIpv6DestinationPrefixHandler destinationPrefixHandler = new FSIpv6DestinationPrefixHandler();
+ registerFlowspecTypeParser(FSIpv6DestinationPrefixHandler.IPV6_DESTINATION_PREFIX_VALUE,
+ destinationPrefixHandler);
+ registerFlowspecTypeSerializer(DestinationIpv6PrefixCase.class, destinationPrefixHandler);
+
+ final FSIpv6SourcePrefixHandler sourcePrefixHandler = new FSIpv6SourcePrefixHandler();
+ registerFlowspecTypeParser(FSIpv6SourcePrefixHandler.SOURCE_PREFIX_VALUE, sourcePrefixHandler);
+ registerFlowspecTypeSerializer(SourceIpv6PrefixCase.class, sourcePrefixHandler);
+
+ final FSIpv6NextHeaderHandler nextHeaderHandler = new FSIpv6NextHeaderHandler();
+ registerFlowspecTypeParser(FSIpv6NextHeaderHandler.NEXT_HEADER_VALUE, nextHeaderHandler);
+ registerFlowspecTypeSerializer(NextHeaderCase.class, nextHeaderHandler);
+
+ final FSIpv6FragmentHandler fragmentHandler = new FSIpv6FragmentHandler();
+ registerFlowspecTypeParser(FSIpv6FragmentHandler.FRAGMENT_VALUE, fragmentHandler);
+ registerFlowspecTypeSerializer(FragmentCase.class, fragmentHandler);
+
+ final FSIpv6FlowLabelHandler flowlabelHandler = new FSIpv6FlowLabelHandler();
+ registerFlowspecTypeParser(FSIpv6FlowLabelHandler.FLOW_LABEL_VALUE, flowlabelHandler);
+ registerFlowspecTypeSerializer(FlowLabelCase.class, flowlabelHandler);
+ return this;
+ }
+
+ @Override
+ public FlowspecTypeRegistry build() {
+ return new FlowspecTypeRegistry(handlers);
+ }
+
+ private Registration registerFlowspecTypeParser(final int type, final FlowspecTypeParser parser) {
+ return handlers.registerParser(type, parser);
+ }
+
+ private Registration registerFlowspecTypeSerializer(final Class<? extends FlowspecType> typeClass,
+ final FlowspecTypeSerializer serializer) {
+ return handlers.registerSerializer(typeClass, serializer);
+ }
+}
package org.opendaylight.protocol.bgp.flowspec;
import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.kohsuke.MetaInfServices;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv4.FlowspecL3vpnIpv4RIBSupport;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv4AddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv6AddressFamily;
import org.opendaylight.yangtools.concepts.Registration;
+import org.osgi.service.component.annotations.Component;
+@Singleton
+@Component(immediate = true, service = RIBExtensionProviderActivator.class,
+ property = "type=org.opendaylight.protocol.bgp.flowspec.RIBActivator")
@MetaInfServices(value = RIBExtensionProviderActivator.class)
public final class RIBActivator extends AbstractRIBExtensionProviderActivator {
- private final SimpleFlowspecExtensionProviderContext fsContext;
-
- // FIXME: this requires proper injection
- public RIBActivator(final SimpleFlowspecExtensionProviderContext context) {
- this.fsContext = context;
+ @Inject
+ public RIBActivator() {
+ // Exposed for DI
}
@Override
final BindingNormalizedNodeSerializer mappingService) {
return List.of(
context.registerRIBSupport(Ipv4AddressFamily.class, FlowspecSubsequentAddressFamily.class,
- FlowspecIpv4RIBSupport.getInstance(this.fsContext, mappingService)),
+ new FlowspecIpv4RIBSupport(mappingService)),
context.registerRIBSupport(Ipv6AddressFamily.class, FlowspecSubsequentAddressFamily.class,
- FlowspecIpv6RIBSupport.getInstance(this.fsContext, mappingService)),
+ new FlowspecIpv6RIBSupport(mappingService)),
context.registerRIBSupport(Ipv4AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class,
- FlowspecL3vpnIpv4RIBSupport.getInstance(this.fsContext, mappingService)),
+ new FlowspecL3vpnIpv4RIBSupport(mappingService)),
context.registerRIBSupport(Ipv6AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class,
- FlowspecL3vpnIpv6RIBSupport.getInstance(this.fsContext, mappingService)));
+ new FlowspecL3vpnIpv6RIBSupport(mappingService)));
}
}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco 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;
-
-public class SimpleFlowspecExtensionProviderContext {
- public enum AFI {
- IPV4(0),
- IPV6(1);
-
- public final int index;
-
- AFI(int index) {
- this.index = index;
- }
- }
-
- public enum SAFI {
- FLOWSPEC(0),
- FLOWSPEC_VPN(1);
-
- public final int index;
-
- SAFI(int index) {
- this.index = index;
- }
- }
-
- private final SimpleFlowspecTypeRegistry[][] flowspecTypeRegistries = new SimpleFlowspecTypeRegistry[2][2];
-
- public SimpleFlowspecExtensionProviderContext() {
- for (AFI afi : AFI.values()) {
- for (SAFI safi : SAFI.values()) {
- this.flowspecTypeRegistries[afi.index][safi.index] = new SimpleFlowspecTypeRegistry();
- }
- }
- }
-
- public SimpleFlowspecTypeRegistry getFlowspecTypeRegistry(AFI afi, SAFI safi) {
- return this.flowspecTypeRegistries[afi.index][safi.index];
- }
-}
import io.netty.buffer.ByteBuf;
import java.util.List;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.AFI;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.ipv4.FlowspecIpv4NlriParserHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.FlowspecBuilder;
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
public final class SimpleFlowspecIpv4NlriParser extends AbstractFlowspecNlriParser {
-
- public SimpleFlowspecIpv4NlriParser(final SimpleFlowspecTypeRegistry flowspecTypeRegistry) {
- super(flowspecTypeRegistry);
+ public SimpleFlowspecIpv4NlriParser(final SAFI safi) {
+ super(FlowspecTypeRegistries.getFlowspecTypeRegistry(AFI.IPV4, safi));
}
@Override
import io.netty.buffer.ByteBuf;
import java.util.List;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.AFI;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.ipv6.FlowspecIpv6NlriParserHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.FlowspecBuilder;
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
public final class SimpleFlowspecIpv6NlriParser extends AbstractFlowspecNlriParser {
-
- public SimpleFlowspecIpv6NlriParser(final SimpleFlowspecTypeRegistry flowspecTypeRegistry) {
- super(flowspecTypeRegistry);
+ public SimpleFlowspecIpv6NlriParser(final SAFI safi) {
+ super(FlowspecTypeRegistries.getFlowspecTypeRegistry(AFI.IPV6, safi));
}
@Override
import java.util.List;
import org.opendaylight.bgp.concepts.RouteDistinguisherUtil;
import org.opendaylight.protocol.bgp.flowspec.AbstractFlowspecNlriParser;
-import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecTypeRegistry;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.FlowspecBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RouteDistinguisher;
public static final NodeIdentifier RD_NID = new NodeIdentifier(QName.create(Flowspec.QNAME.getModule(),
"route-distinguisher"));
- protected AbstractFlowspecL3vpnNlriParser(final SimpleFlowspecTypeRegistry flowspecTypeRegistry) {
+ protected AbstractFlowspecL3vpnNlriParser(final FlowspecTypeRegistry flowspecTypeRegistry) {
super(flowspecTypeRegistry);
}
import io.netty.buffer.ByteBuf;
import java.util.List;
-import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecTypeRegistry;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.AFI;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.ipv4.FlowspecIpv4NlriParserHelper;
import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnNlriParser;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec;
* @author Kevin Wang
*/
public final class FlowspecL3vpnIpv4NlriParser extends AbstractFlowspecL3vpnNlriParser {
-
- public FlowspecL3vpnIpv4NlriParser(SimpleFlowspecTypeRegistry flowspecTypeRegistry) {
- super(flowspecTypeRegistry);
+ public FlowspecL3vpnIpv4NlriParser(final SAFI safi) {
+ super(FlowspecTypeRegistries.getFlowspecTypeRegistry(AFI.IPV4, safi));
}
@Override
import java.util.Map;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
-import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.bgp.rib.rib.loc.rib.tables.routes.FlowspecL3vpnIpv4RoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.l3vpn.destination.ipv4.DestinationFlowspecL3vpnIpv4;
FlowspecL3vpnRoute,
FlowspecL3vpnRouteKey> {
private static final FlowspecL3vpnIpv4Routes EMPTY_CONTAINER = new FlowspecL3vpnIpv4RoutesBuilder().build();
- private static FlowspecL3vpnIpv4RIBSupport SINGLETON;
- private FlowspecL3vpnIpv4RIBSupport(
- final SimpleFlowspecExtensionProviderContext context,
- final BindingNormalizedNodeSerializer mappingService) {
+ public FlowspecL3vpnIpv4RIBSupport(final BindingNormalizedNodeSerializer mappingService) {
super(
mappingService,
FlowspecL3vpnIpv4RoutesCase.class,
FlowspecL3vpnRoute.class,
DestinationFlowspecL3vpnIpv4.QNAME,
Ipv4AddressFamily.class,
- new FlowspecL3vpnIpv4NlriParser(context
- .getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN))
+ new FlowspecL3vpnIpv4NlriParser(SAFI.FLOWSPEC_VPN)
);
}
- public static synchronized FlowspecL3vpnIpv4RIBSupport getInstance(
- final SimpleFlowspecExtensionProviderContext context,
- final BindingNormalizedNodeSerializer mappingService) {
- if (SINGLETON == null) {
- SINGLETON = new FlowspecL3vpnIpv4RIBSupport(context, mappingService);
- }
- return SINGLETON;
- }
-
@Override
public FlowspecL3vpnRouteKey createRouteListKey(final PathId pathId, final String routeKey) {
return new FlowspecL3vpnRouteKey(pathId, routeKey);
import io.netty.buffer.ByteBuf;
import java.util.List;
-import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecTypeRegistry;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.AFI;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.ipv6.FlowspecIpv6NlriParserHelper;
import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnNlriParser;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec;
* @author Kevin Wang
*/
public final class FlowspecL3vpnIpv6NlriParser extends AbstractFlowspecL3vpnNlriParser {
-
- public FlowspecL3vpnIpv6NlriParser(SimpleFlowspecTypeRegistry flowspecTypeRegistry) {
- super(flowspecTypeRegistry);
+ public FlowspecL3vpnIpv6NlriParser(final SAFI safi) {
+ super(FlowspecTypeRegistries.getFlowspecTypeRegistry(AFI.IPV6, safi));
}
@Override
import java.util.Map;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
-import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.bgp.rib.rib.loc.rib.tables.routes.FlowspecL3vpnIpv6RoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.l3vpn.destination.ipv6.DestinationFlowspecL3vpnIpv6;
FlowspecL3vpnRoute,
FlowspecL3vpnRouteKey> {
private static final FlowspecL3vpnIpv6Routes EMPTY_CONTAINER = new FlowspecL3vpnIpv6RoutesBuilder().build();
- private static FlowspecL3vpnIpv6RIBSupport SINGLETON;
- private FlowspecL3vpnIpv6RIBSupport(
- final SimpleFlowspecExtensionProviderContext context,
- final BindingNormalizedNodeSerializer mappingService) {
+ public FlowspecL3vpnIpv6RIBSupport(final BindingNormalizedNodeSerializer mappingService) {
super(
mappingService,
FlowspecL3vpnIpv6RoutesCase.class,
FlowspecL3vpnRoute.class,
DestinationFlowspecL3vpnIpv6.QNAME,
Ipv6AddressFamily.class,
- new FlowspecL3vpnIpv6NlriParser(context
- .getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN))
+ new FlowspecL3vpnIpv6NlriParser(SAFI.FLOWSPEC_VPN)
);
}
- public static synchronized FlowspecL3vpnIpv6RIBSupport getInstance(
- final SimpleFlowspecExtensionProviderContext context,
- final BindingNormalizedNodeSerializer mappingService) {
- if (SINGLETON == null) {
- SINGLETON = new FlowspecL3vpnIpv6RIBSupport(context, mappingService);
- }
- return SINGLETON;
- }
-
@Override
public FlowspecL3vpnRouteKey createRouteListKey(final PathId pathId, final String routeKey) {
return new FlowspecL3vpnRouteKey(pathId, routeKey);
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
-
- <bean id="flowSpecExtensionContext" class="org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext"/>
-
- <bean id="flowSpecActivator" class="org.opendaylight.protocol.bgp.flowspec.FlowspecActivator">
- <argument ref="flowSpecExtensionContext"/>
- </bean>
-
- <bean id="BGPActivator" class="org.opendaylight.protocol.bgp.flowspec.BGPActivator">
- <argument ref="flowSpecActivator"/>
- </bean>
-
- <bean id="RIBActivator" class="org.opendaylight.protocol.bgp.flowspec.RIBActivator">
- <argument ref="flowSpecExtensionContext"/>
- </bean>
-
- <service ref="BGPActivator" interface="org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator"
- odl:type="org.opendaylight.protocol.bgp.flowspec.BGPActivator"/>
-
- <service ref="RIBActivator" interface="org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator"
- odl:type="org.opendaylight.protocol.bgp.flowspec.RIBActivator"/>
-</blueprint>
@Test
public void testActivator() throws Exception {
- final SimpleFlowspecExtensionProviderContext fsContext = new SimpleFlowspecExtensionProviderContext();
- final FlowspecActivator activator = new FlowspecActivator(fsContext);
- final BGPActivator act = new BGPActivator(activator);
+ final BGPActivator act = new BGPActivator();
final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
assertNull(context.getSubsequentAddressFamilyRegistry().classForFamily(FLOWSPEC_SAFI));
assertNull(context.getSubsequentAddressFamilyRegistry().classForFamily(FLOWSPEC_VPN_SAFI));
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
@Override
public void setUp() throws Exception {
super.setUp();
- final SimpleFlowspecExtensionProviderContext fsContext = new SimpleFlowspecExtensionProviderContext();
- final FlowspecActivator activator = new FlowspecActivator(fsContext);
- final BGPActivator act = new BGPActivator(activator);
+ final BGPActivator act = new BGPActivator();
final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
act.start(context);
- this.ribSupport = FlowspecIpv4RIBSupport.getInstance(fsContext, this.adapter.currentSerializer());
+ this.ribSupport = new FlowspecIpv4RIBSupport(this.adapter.currentSerializer());
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- fsContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
this.routeKey = new FlowspecRouteKey(PATH_ID, parser.stringNlri(FLOW_LIST));
this.route = new FlowspecRouteBuilder().withKey(this.routeKey).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
@Override
public void setUp() throws Exception {
super.setUp();
- final SimpleFlowspecExtensionProviderContext fsContext = new SimpleFlowspecExtensionProviderContext();
- final FlowspecActivator activator = new FlowspecActivator(fsContext);
- final BGPActivator act = new BGPActivator(activator);
+ final BGPActivator act = new BGPActivator();
final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
act.start(context);
- final SimpleFlowspecIpv6NlriParser parser = new SimpleFlowspecIpv6NlriParser(
- fsContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv6NlriParser parser = new SimpleFlowspecIpv6NlriParser(SAFI.FLOWSPEC);
this.routeKey = new FlowspecRouteKey(PATH_ID, parser.stringNlri(FLOW_LIST));
this.route = new FlowspecRouteBuilder().withKey(this.routeKey).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
.setAttributes(new AttributesBuilder().build()).build();
this.routes = new FlowspecIpv6RoutesBuilder().setFlowspecRoute(Map.of(this.route.key(), this.route)).build();
- this.ribSupport = FlowspecIpv6RIBSupport.getInstance(fsContext, this.adapter.currentSerializer());
+ this.ribSupport = new FlowspecIpv6RIBSupport(this.adapter.currentSerializer());
setUpTestCustomizer(this.ribSupport);
}
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.handlers.AbstractNumericOperandParser;
import org.opendaylight.protocol.bgp.flowspec.handlers.AbstractOperandParser;
import org.opendaylight.protocol.bgp.flowspec.handlers.BitmaskOperandParser;
0x0c, (byte) 0x81, (byte) 0x0e
};
- private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
- private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
- private final FlowspecL3vpnIpv4NlriParser fsParser = new FlowspecL3vpnIpv4NlriParser(
- this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ private final FlowspecL3vpnIpv4NlriParser fsParser = new FlowspecL3vpnIpv4NlriParser(SAFI.FLOWSPEC_VPN);
@Before
public void setUp() {
builder.setFlowspecType(sps);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(
- this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(SAFI.FLOWSPEC_VPN);
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
builder.setFlowspecType(sps);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(
- this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(SAFI.FLOWSPEC_VPN);
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
builder.setFlowspecType(fragment);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(
- this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(SAFI.FLOWSPEC_VPN);
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
builder.setFlowspecType(fragment);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(
- this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(SAFI.FLOWSPEC_VPN);
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
@Override
public void setUp() throws Exception {
super.setUp();
- this.ribSupport = FlowspecL3vpnIpv4RIBSupport
- .getInstance(new SimpleFlowspecExtensionProviderContext(), this.adapter.currentSerializer());
+ this.ribSupport = new FlowspecL3vpnIpv4RIBSupport(this.adapter.currentSerializer());
setUpTestCustomizer(this.ribSupport);
}
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.handlers.AbstractNumericOperandParser;
import org.opendaylight.protocol.bgp.flowspec.handlers.AbstractOperandParser;
import org.opendaylight.protocol.bgp.flowspec.handlers.BitmaskOperandParser;
private PeerSpecificParserConstraint constraint;
@Mock
private MultiPathSupport muliPathSupport;
- private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
- private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
- private final FlowspecL3vpnIpv6NlriParser fsParser = new FlowspecL3vpnIpv6NlriParser(
- this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ private final FlowspecL3vpnIpv6NlriParser fsParser = new FlowspecL3vpnIpv6NlriParser(SAFI.FLOWSPEC);
private static final byte[] REACHED_NLRI = new byte[]{
0x1B, // NLRI length: 19+8=27
@Override
public void setUp() throws Exception {
super.setUp();
- this.ribSupport = FlowspecL3vpnIpv6RIBSupport
- .getInstance(new SimpleFlowspecExtensionProviderContext(), this.adapter.currentSerializer());
+ this.ribSupport = new FlowspecL3vpnIpv6RIBSupport(this.adapter.currentSerializer());
setUpTestCustomizer(this.ribSupport);
}
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.handlers.AbstractNumericOperandParser;
import org.opendaylight.protocol.bgp.flowspec.handlers.AbstractOperandParser;
import org.opendaylight.protocol.bgp.flowspec.handlers.BitmaskOperandParser;
0x0c, (byte) 0x81, (byte) 0x0e
};
- private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
- private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
- private final SimpleFlowspecIpv4NlriParser fsParser = new SimpleFlowspecIpv4NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ private final SimpleFlowspecIpv4NlriParser fsParser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
@Before
public void setUp() {
.setDestinationFlowspecIpv4(new DestinationFlowspecIpv4Builder().setFlowspec(fs).build())
.build()).build());
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
).build()
);
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
).build()
);
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
).build()
);
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
@Test
public void testBatchedFlowspecNlri() throws Exception {
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.handlers.AbstractNumericOperandParser;
import org.opendaylight.protocol.bgp.flowspec.handlers.AbstractOperandParser;
import org.opendaylight.protocol.bgp.flowspec.handlers.BitmaskOperandParser;
private PeerSpecificParserConstraint constraint;
@Mock
private MultiPathSupport muliPathSupport;
- private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
- private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
- private final SimpleFlowspecIpv6NlriParser fsParser = new SimpleFlowspecIpv6NlriParser(
- this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ private final SimpleFlowspecIpv6NlriParser fsParser = new SimpleFlowspecIpv6NlriParser(SAFI.FLOWSPEC);
private static final byte[] REACHED_NLRI = new byte[] {
0x13,
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.protocol.bgp.flowspec.BGPActivator;
-import org.opendaylight.protocol.bgp.flowspec.FlowspecActivator;
-import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
@Before
public void setUp() throws Exception {
- final SimpleFlowspecExtensionProviderContext fsContext = new SimpleFlowspecExtensionProviderContext();
- final FlowspecActivator activator = new FlowspecActivator(fsContext);
-
- this.act = new BGPActivator(activator);
+ this.act = new BGPActivator();
final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
this.act.start(context);
this.registry = context.getExtendedCommunityRegistry();
* 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.testtool;
import static org.opendaylight.protocol.bgp.testtool.BGPPeerBuilder.createPeer;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.opendaylight.protocol.bgp.flowspec.FlowspecActivator;
-import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
import org.opendaylight.protocol.bgp.parser.impl.BGPActivator;
import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext;
.evpn.impl.BGPActivator();
evpnActivator.start(ctx);
- final SimpleFlowspecExtensionProviderContext fsContext = new SimpleFlowspecExtensionProviderContext();
- final FlowspecActivator flowspecActivator = new FlowspecActivator(fsContext);
final org.opendaylight.protocol.bgp.flowspec.BGPActivator flowspecBGPActivator
- = new org.opendaylight.protocol.bgp.flowspec.BGPActivator(flowspecActivator);
+ = new org.opendaylight.protocol.bgp.flowspec.BGPActivator();
flowspecBGPActivator.start(ctx);
final org.opendaylight.protocol.bgp.labeled.unicast.BGPActivator labeledActivator