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());
}
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);
}
Aggregations