import org.opendaylight.tcpmd5.api.KeyMapping;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.ipv4.routes.Ipv4Route;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.routes.ipv6.routes.Ipv6Route;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.LinkstateAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.LinkstateSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.linkstate.routes.linkstate.routes.LinkstateRoute;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.BgpRib;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.RibId;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
public class ParserToSalTest extends AbstractDataBrokerTest {
private BGPMock mock;
private AbstractRIBExtensionProviderActivator baseact, lsact;
- private RIBExtensionProviderContext ext;
+ private RIBExtensionProviderContext ext1, ext2;
@Mock
BGPDispatcher dispatcher;
private SchemaService schemaService;
+ @Override
+ protected java.lang.Iterable<org.opendaylight.yangtools.yang.binding.YangModuleInfo> getModuleInfos() throws Exception {
+ return ImmutableList.of(BindingReflections.getModuleInfo(Ipv4Route.class), BindingReflections.getModuleInfo(Ipv6Route.class), BindingReflections.getModuleInfo(LinkstateRoute.class));
+ };
@Override
protected DataBrokerTestCustomizer createDataBrokerTestCustomizer() {
Mockito.any(BGPPeerRegistry.class), Mockito.eq(this.tcpStrategyFactory), Mockito.eq(this.sessionStrategy),
Mockito.any(KeyMapping.class));
- this.ext = new SimpleRIBExtensionProviderContext();
+ this.ext1 = new SimpleRIBExtensionProviderContext();
+ this.ext2 = new SimpleRIBExtensionProviderContext();
this.baseact = new RIBActivator();
this.lsact = new org.opendaylight.protocol.bgp.linkstate.RIBActivator();
- this.baseact.startRIBExtensionProvider(this.ext);
- this.lsact.startRIBExtensionProvider(this.ext);
+ this.baseact.startRIBExtensionProvider(this.ext1);
+ this.lsact.startRIBExtensionProvider(this.ext2);
}
@After
this.baseact.close();
}
- private void runTestWithTables(final List<BgpTableType> tables) {
- final RIBImpl rib = new RIBImpl(new RibId(TEST_RIB_ID), new AsNumber(72L), new Ipv4Address("127.0.0.1"), null, this.ext, this.dispatcher, this.tcpStrategyFactory, this.codecFactory, this.sessionStrategy, getDataBroker(), getDomBroker(), tables, GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
+ @Test
+ public void testWithLinkstate() throws InterruptedException, ExecutionException {
+ final List<BgpTableType> tables = ImmutableList.of(
+ (BgpTableType) new BgpTableTypeImpl(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class));
+ final RIBImpl rib = new RIBImpl(new RibId(TEST_RIB_ID), new AsNumber(72L), new Ipv4Address("127.0.0.1"), null, this.ext2, this.dispatcher, this.tcpStrategyFactory, this.codecFactory, this.sessionStrategy, getDataBroker(), getDomBroker(), tables, GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
rib.onGlobalContextUpdated(this.schemaService.getGlobalContext());
final BGPPeer peer = new BGPPeer("peer-" + this.mock.toString(), rib);
final ListenerRegistration<?> reg = this.mock.registerUpdateListener(peer);
reg.close();
- }
-
- @Test
- public void testWithLinkstate() throws InterruptedException, ExecutionException {
- final List<BgpTableType> tables = ImmutableList.of(
- (BgpTableType) new BgpTableTypeImpl(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class));
- runTestWithTables(tables);
assertTablesExists(tables);
}
@Test
public void testWithoutLinkstate() throws InterruptedException, ExecutionException {
final List<BgpTableType> tables = ImmutableList.of((BgpTableType) new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class));
- runTestWithTables(tables);
+ final RIBImpl rib = new RIBImpl(new RibId(TEST_RIB_ID), new AsNumber(72L), new Ipv4Address("127.0.0.1"), null, this.ext1, this.dispatcher, this.tcpStrategyFactory, this.codecFactory, this.sessionStrategy, getDataBroker(), getDomBroker(), tables, GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
+ rib.onGlobalContextUpdated(this.schemaService.getGlobalContext());
+ final BGPPeer peer = new BGPPeer("peer-" + this.mock.toString(), rib);
+
+ final ListenerRegistration<?> reg = this.mock.registerUpdateListener(peer);
+ reg.close();
assertTablesExists(tables);
}