Convert bgp-flowspec to OSGi DS
[bgpcep.git] / bgp / extensions / flowspec / src / main / java / org / opendaylight / protocol / bgp / flowspec / FlowspecIpv4RIBSupport.java
index f864c2c7214ad3e404c442e75b7e97ec0233defe..2d8f5b62dc26b5421d5076cec83660b3187d156f 100644 (file)
@@ -11,6 +11,7 @@ import static com.google.common.base.Verify.verify;
 
 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;
@@ -31,10 +32,8 @@ public final class FlowspecIpv4RIBSupport
         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,
@@ -43,21 +42,10 @@ public final class FlowspecIpv4RIBSupport
                 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) {