Create common parent for extensions families
[bgpcep.git] / bgp / extensions / labeled-unicast / src / main / java / org / opendaylight / protocol / bgp / labeled / unicast / RIBActivator.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.bgp.labeled.unicast;
9
10 import java.util.ArrayList;
11 import java.util.List;
12 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
13 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBExtensionProviderActivator;
14 import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.LabeledUnicastSubsequentAddressFamily;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
18
19 public class RIBActivator extends AbstractRIBExtensionProviderActivator {
20
21     @Override
22     protected List<AutoCloseable> startRIBExtensionProviderImpl(
23         final RIBExtensionProviderContext context,
24             final BindingNormalizedNodeSerializer mappingService
25     ) {
26         final List<AutoCloseable> regs = new ArrayList<>(2);
27         regs.add(context.registerRIBSupport(Ipv4AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class,
28                 LabeledUnicastIpv4RIBSupport.getInstance(mappingService)));
29         regs.add(context.registerRIBSupport(Ipv6AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class,
30                 LabeledUnicastIpv6RIBSupport.getInstance(mappingService)));
31         return regs;
32     }
33 }