YANG revision dates mass-update
[bgpcep.git] / bgp / extensions / flowspec / src / test / java / org / opendaylight / protocol / bgp / flowspec / ActivatorTest.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.flowspec;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNull;
12
13 import org.junit.Test;
14 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
15 import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.FlowspecL3vpnSubsequentAddressFamily;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.FlowspecSubsequentAddressFamily;
18
19 public class ActivatorTest {
20     private static final int FLOWSPEC_SAFI = 133;
21     private static final int FLOWSPEC_VPN_SAFI = 134;
22
23     @Test
24     public void testActivator() throws Exception {
25         final SimpleFlowspecExtensionProviderContext fsContext = new SimpleFlowspecExtensionProviderContext();
26         final FlowspecActivator activator = new FlowspecActivator(fsContext);
27         final BGPActivator act = new BGPActivator(activator);
28         final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
29         assertNull(context.getSubsequentAddressFamilyRegistry().classForFamily(FLOWSPEC_SAFI));
30         assertNull(context.getSubsequentAddressFamilyRegistry().classForFamily(FLOWSPEC_VPN_SAFI));
31         act.start(context);
32         assertEquals(FlowspecSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry()
33             .classForFamily(FLOWSPEC_SAFI));
34         assertEquals(FlowspecL3vpnSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry()
35             .classForFamily(FLOWSPEC_VPN_SAFI));
36         act.close();
37     }
38 }
39