Search in sources :

Example 1 with DefaultBGPRibRoutingPolicyFactory

use of org.opendaylight.protocol.bgp.openconfig.routing.policy.impl.DefaultBGPRibRoutingPolicyFactory in project bgpcep by opendaylight.

the class BgpDeployerTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    doReturn("mapping").when(tableTypeRegistry).toString();
    doReturn(TABLE_TYPE).when(tableTypeRegistry).getTableType(any());
    doReturn(TABLES_KEY).when(tableTypeRegistry).getTableKey(any());
    final ClusterSingletonServiceRegistration serviceRegistration = mock(ClusterSingletonServiceRegistration.class);
    doReturn(serviceRegistration).when(singletonServiceProvider).registerClusterSingletonService(any());
    doNothing().when(serviceRegistration).close();
    final Future future = mock(BGPReconnectPromise.class);
    doReturn(true).when(future).cancel(true);
    doReturn(future).when(dispatcher).createReconnectingClient(any(), any(), anyInt(), any());
    deployer = spy(new DefaultBgpDeployer(NETWORK_INSTANCE_NAME, singletonServiceProvider, rpcRegistry, extensionContext, dispatcher, new DefaultBGPRibRoutingPolicyFactory(getDataBroker(), new StatementRegistry()), codecsRegistry, getDomBroker(), getDataBroker(), tableTypeRegistry, stateProviderRegistry));
    bgpSingletonObtainedLatch = new CountDownLatch(1);
    doAnswer(invocationOnMock -> {
        final BGPClusterSingletonService real = (BGPClusterSingletonService) invocationOnMock.callRealMethod();
        if (spiedBgpSingletonService == null) {
            spiedBgpSingletonService = spy(real);
        }
        bgpSingletonObtainedLatch.countDown();
        return spiedBgpSingletonService;
    }).when(deployer).getBgpClusterSingleton(any());
}
Also used : DefaultBGPRibRoutingPolicyFactory(org.opendaylight.protocol.bgp.openconfig.routing.policy.impl.DefaultBGPRibRoutingPolicyFactory) ClusterSingletonServiceRegistration(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration) Future(io.netty.util.concurrent.Future) StatementRegistry(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.StatementRegistry) CountDownLatch(java.util.concurrent.CountDownLatch) Before(org.junit.Before)

Example 2 with DefaultBGPRibRoutingPolicyFactory

use of org.opendaylight.protocol.bgp.openconfig.routing.policy.impl.DefaultBGPRibRoutingPolicyFactory in project bgpcep by opendaylight.

the class DefaultRibPoliciesMockTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    doReturn(DefaultPolicyType.REJECTROUTE).when(this.config).getDefaultImportPolicy();
    doReturn(DefaultPolicyType.REJECTROUTE).when(this.config).getDefaultExportPolicy();
    doReturn(Collections.singletonList("default-odl-import-policy")).when(this.config).getImportPolicy();
    doReturn(Collections.singletonList("default-odl-export-policy")).when(this.config).getExportPolicy();
    doReturn(IPV4UNICAST.class).when(this.tableRegistry).getAfiSafiType(any(TablesKey.class));
    this.policyProvider = new DefaultBGPRibRoutingPolicyFactory(getDataBroker(), this.statementRegistry);
    this.policies = this.policyProvider.buildBGPRibPolicy(AS, this.bgpID, this.ci, this.config);
}
Also used : TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey) DefaultBGPRibRoutingPolicyFactory(org.opendaylight.protocol.bgp.openconfig.routing.policy.impl.DefaultBGPRibRoutingPolicyFactory) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)2 DefaultBGPRibRoutingPolicyFactory (org.opendaylight.protocol.bgp.openconfig.routing.policy.impl.DefaultBGPRibRoutingPolicyFactory)2 Future (io.netty.util.concurrent.Future)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ClusterSingletonServiceRegistration (org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration)1 StatementRegistry (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.StatementRegistry)1 TablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey)1