use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.RibKey in project bgpcep by opendaylight.
the class AbstractBgpTopologyProvider method createInstance.
private TopologyReferenceSingletonService createInstance(final Topology topology) {
final RibReference ribReference = new DefaultRibReference(InstanceIdentifier.create(BgpRib.class).child(Rib.class, new RibKey(topology.getAugmentation(Topology1.class).getRibId())));
final AbstractTopologyBuilder<?> topologyBuilder = createTopologyBuilder(this.dataBroker, ribReference, topology.getTopologyId());
return new TopologyReferenceSingletonServiceImpl(topologyBuilder, this.deployer, topology);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.RibKey in project bgpcep by opendaylight.
the class StateProviderImplTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
doReturn(Optional.of(IPV4UNICAST.class)).when(this.tableTypeRegistry).getAfiSafiType(eq(TABLES_KEY));
doReturn(this.bgpRibStates).when(this.stateCollector).getRibStats();
doReturn(this.bgpPeerStates).when(this.stateCollector).getPeerStats();
final KeyedInstanceIdentifier<Rib, RibKey> iid = InstanceIdentifier.create(BgpRib.class).child(Rib.class, new RibKey(new RibId(this.ribId)));
doReturn(iid).when(this.bgpRibState).getInstanceIdentifier();
doReturn(this.as).when(this.bgpRibState).getAs();
doReturn(this.bgpId).when(this.bgpRibState).getRouteId();
doAnswer(invocation -> this.totalPathsCounter.longValue()).when(this.bgpRibState).getTotalPathsCount();
doAnswer(invocation -> this.totalPrefixesCounter.longValue()).when(this.bgpRibState).getTotalPrefixesCount();
doAnswer(invocation -> this.totalPathsCounter.longValue()).when(this.bgpRibState).getPathCount(eq(TABLES_KEY));
doAnswer(invocation -> this.totalPrefixesCounter.longValue()).when(this.bgpRibState).getPrefixesCount(eq(TABLES_KEY));
doAnswer(invocation -> Collections.singletonMap(TABLES_KEY, this.totalPrefixesCounter.longValue())).when(this.bgpRibState).getTablesPrefixesCount();
doAnswer(invocation -> Collections.singletonMap(TABLES_KEY, this.totalPathsCounter.longValue())).when(this.bgpRibState).getPathsCount();
// Mock Peer
doReturn("test-group").when(this.bgpPeerState).getGroupId();
doReturn(iid).when(this.bgpPeerState).getInstanceIdentifier();
doAnswer(invocation -> this.totalPrefixesCounter.longValue()).when(this.bgpPeerState).getTotalPrefixes();
doAnswer(invocation -> this.totalPathsCounter.longValue()).when(this.bgpPeerState).getTotalPathsCount();
doReturn(this.neighborAddress).when(this.bgpPeerState).getNeighborAddress();
doReturn(this.bgpSessionState).when(this.bgpPeerState).getBGPSessionState();
doReturn(this.bgpPeerMessagesState).when(this.bgpPeerState).getBGPPeerMessagesState();
doReturn(1L).when(this.bgpPeerMessagesState).getNotificationMessagesReceivedCount();
doReturn(1L).when(this.bgpPeerMessagesState).getNotificationMessagesSentCount();
doReturn(1L).when(this.bgpPeerMessagesState).getUpdateMessagesReceivedCount();
doReturn(1L).when(this.bgpPeerMessagesState).getUpdateMessagesSentCount();
doReturn(State.UP).when(this.bgpSessionState).getSessionState();
doReturn(true).when(this.bgpSessionState).isAddPathCapabilitySupported();
doReturn(true).when(this.bgpSessionState).isAsn32CapabilitySupported();
doReturn(true).when(this.bgpSessionState).isGracefulRestartCapabilitySupported();
doReturn(true).when(this.bgpSessionState).isMultiProtocolCapabilitySupported();
doReturn(true).when(this.bgpSessionState).isRouterRefreshCapabilitySupported();
doReturn(this.timersState).when(this.bgpPeerState).getBGPTimersState();
doReturn(10L).when(this.timersState).getNegotiatedHoldTime();
doReturn(1L).when(this.timersState).getUpTime();
doReturn(this.bgpTransportState).when(this.bgpPeerState).getBGPTransportState();
doReturn(this.localPort).when(this.bgpTransportState).getLocalPort();
doReturn(this.neighborAddress).when(this.bgpTransportState).getRemoteAddress();
doReturn(this.remotePort).when(this.bgpTransportState).getRemotePort();
doReturn(this.bgpErrorHandlingState).when(this.bgpPeerState).getBGPErrorHandlingState();
doReturn(1L).when(this.bgpErrorHandlingState).getErroneousUpdateReceivedCount();
doReturn(this.bgpGracelfulRestartState).when(this.bgpPeerState).getBGPGracelfulRestart();
doReturn(true).when(this.bgpGracelfulRestartState).isGracefulRestartAdvertized(any());
doReturn(true).when(this.bgpGracelfulRestartState).isGracefulRestartReceived(any());
doReturn(true).when(this.bgpGracelfulRestartState).isLocalRestarting();
doReturn(true).when(this.bgpGracelfulRestartState).isPeerRestarting();
doReturn(this.restartTime).when(this.bgpGracelfulRestartState).getPeerRestartTime();
doReturn(this.bgpAfiSafiState).when(this.bgpPeerState).getBGPAfiSafiState();
doReturn(Collections.singleton(TABLES_KEY)).when(this.bgpAfiSafiState).getAfiSafisAdvertized();
doReturn(Collections.singleton(TABLES_KEY)).when(this.bgpAfiSafiState).getAfiSafisReceived();
doReturn(1L).when(this.bgpAfiSafiState).getPrefixesInstalledCount(any());
doReturn(2L).when(this.bgpAfiSafiState).getPrefixesReceivedCount(any());
doReturn(1L).when(this.bgpAfiSafiState).getPrefixesSentCount(any());
doReturn(true).when(this.bgpAfiSafiState).isAfiSafiSupported(any());
doReturn(true).when(this.bgpAfiSafiState).isGracefulRestartAdvertized(any());
doReturn(true).when(this.bgpAfiSafiState).isGracefulRestartReceived(any());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.RibKey in project bgpcep by opendaylight.
the class AbstractConfig method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
doReturn(InstanceIdentifier.create(BgpRib.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.Rib.class, new RibKey(RIB_ID))).when(this.rib).getInstanceIdentifier();
doReturn(this.domTx).when(this.rib).createPeerDOMChain(any(TransactionChainListener.class));
doAnswer(invocation -> {
final Object[] args = invocation.getArguments();
return getDataBroker().createTransactionChain((TransactionChainListener) args[0]);
}).when(this.rib).createPeerChain(any(TransactionChainListener.class));
doReturn(getDataBroker()).when(this.rib).getDataBroker();
doReturn(AS).when(this.rib).getLocalAs();
doReturn(mock(RIBSupportContextRegistry.class)).when(this.rib).getRibSupportContext();
doReturn(Collections.emptySet()).when(this.rib).getLocalTablesKeys();
doNothing().when(this.domTx).close();
doReturn(this.domDW).when(this.domTx).newWriteOnlyTransaction();
doNothing().when(this.domDW).put(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(MapEntryNode.class));
doNothing().when(this.domDW).delete(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class));
doNothing().when(this.domDW).merge(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
final CheckedFuture<?, ?> checkedFuture = mock(CheckedFuture.class);
doAnswer(invocation -> {
final Runnable callback = (Runnable) invocation.getArguments()[0];
callback.run();
return null;
}).when(checkedFuture).addListener(Mockito.any(Runnable.class), Mockito.any(Executor.class));
doReturn(checkedFuture).when(this.domDW).submit();
doReturn(null).when(checkedFuture).checkedGet();
doReturn(null).when(checkedFuture).get();
doReturn(true).when(checkedFuture).isDone();
doReturn("checkedFuture").when(checkedFuture).toString();
doReturn(YangInstanceIdentifier.of(Rib.QNAME)).when(this.rib).getYangRibId();
doReturn(this.dataTreeChangeService).when(this.rib).getService();
doReturn(this.listener).when(this.dataTreeChangeService).registerDataTreeChangeListener(any(), any());
doReturn(new BgpId("127.0.0.1")).when(this.rib).getBgpIdentifier();
doReturn(true).when(this.future).cancel(true);
doReturn(this.future).when(this.dispatcher).createReconnectingClient(any(InetSocketAddress.class), anyInt(), any(KeyMapping.class));
doReturn(this.dispatcher).when(this.rib).getDispatcher();
doReturn(java.util.Optional.of(new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class))).when(this.tableTypeRegistry).getTableType(any());
doReturn(java.util.Optional.of(TABLES_KEY)).when(this.tableTypeRegistry).getTableKey(any());
doReturn(Collections.singleton(new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class))).when(this.rib).getLocalTables();
doNothing().when(this.bgpPeerRegistry).addPeer(any(IpAddress.class), any(BGPSessionListener.class), any(BGPSessionPreferences.class));
doNothing().when(this.bgpPeerRegistry).removePeer(any(IpAddress.class));
doReturn("registry").when(this.bgpPeerRegistry).toString();
doNothing().when(this.listener).close();
doReturn(this.bgpPeerRegistry).when(this.dispatcher).getBGPPeerRegistry();
doReturn(this.peerTracker).when(this.rib).getPeerTracker();
doReturn(this.policies).when(this.rib).getRibPolicies();
doReturn(null).when(this.peerGroupLoader).getPeerGroup(any(InstanceIdentifier.class), any(String.class));
}
Aggregations