MVPN RFC6514 Extendend communities
[bgpcep.git] / bgp / openconfig-spi / src / test / java / org / opendaylight / protocol / bgp / openconfig / spi / BGPTableTypeRegistryProviderActivatorTest.java
1 /*
2  * Copyright (c) 2016 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
9 package org.opendaylight.protocol.bgp.openconfig.spi;
10
11 import static org.junit.Assert.assertTrue;
12
13 import java.util.Collections;
14 import java.util.List;
15 import org.junit.Assert;
16 import org.junit.Test;
17 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.UnicastSubsequentAddressFamily;
20 import org.opendaylight.yangtools.concepts.AbstractRegistration;
21
22 public class BGPTableTypeRegistryProviderActivatorTest {
23
24     @Test
25     public void testBGPTableTypeRegistryProviderActivator() {
26         final AbstractBGPTableTypeRegistryProviderActivator activator =
27             new AbstractBGPTableTypeRegistryProviderActivator() {
28                 @Override
29                 protected List<AbstractRegistration> startBGPTableTypeRegistryProviderImpl(
30                         final BGPTableTypeRegistryProvider provider) {
31                     return Collections.singletonList(provider.registerBGPTableType(Ipv4AddressFamily.class,
32                             UnicastSubsequentAddressFamily.class, IPV4UNICAST.class));
33                 }
34             };
35
36         final SimpleBGPTableTypeRegistryProvider provider = new SimpleBGPTableTypeRegistryProvider();
37         activator.startBGPTableTypeRegistryProvider(provider);
38         assertTrue(provider.getTableType(IPV4UNICAST.class).isPresent());
39         activator.stopBGPTableTypeRegistryProvider();
40         Assert.assertFalse(provider.getTableType(IPV4UNICAST.class).isPresent());
41         activator.close();
42     }
43
44 }