use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.RibKey in project bgpcep by opendaylight.
the class StateProviderImplTest method setUp.
@Before
public void setUp() {
doReturn(IPV4UNICAST.class).when(this.tableTypeRegistry).getAfiSafiType(eq(TABLES_KEY));
doReturn(this.bgpRibStates).when(this.stateProvider).getRibStats();
doReturn(this.bgpPeerStates).when(this.stateProvider).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 -> Map.of(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(10L).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).isLocalRestarting();
doReturn(true).when(this.bgpGracelfulRestartState).isPeerRestarting();
doReturn(this.restartTime.toJava()).when(this.bgpGracelfulRestartState).getPeerRestartTime();
doReturn(BgpAfiSafiGracefulRestartState.Mode.BILATERAL).when(this.bgpGracelfulRestartState).getMode();
doReturn(this.bgpAfiSafiState).when(this.bgpPeerState).getBGPAfiSafiState();
doReturn(Set.of(TABLES_KEY)).when(this.bgpAfiSafiState).getAfiSafisAdvertized();
doReturn(Set.of(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());
doReturn(true).when(this.bgpAfiSafiState).isLlGracefulRestartAdvertised(any());
doReturn(true).when(this.bgpAfiSafiState).isLlGracefulRestartReceived(any());
doReturn(60).when(this.bgpAfiSafiState).getLlGracefulRestartTimer(any());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.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.augmentation(Topology1.class).getRibId())));
final AbstractTopologyBuilder<?> topologyBuilder = createTopologyBuilder(dataBroker, ribReference, topology.getTopologyId());
return new TopologyReferenceSingletonServiceImpl(topologyBuilder, deployer, topology);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.RibKey in project bgpcep by opendaylight.
the class AbstractConfig method setUp.
@Override
@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.rev180329.bgp.rib.Rib.class, new RibKey(RIB_ID))).when(this.rib).getInstanceIdentifier();
doReturn(this.domTx).when(this.rib).createPeerDOMChain(any(DOMTransactionChainListener.class));
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));
doReturn(CommitInfo.emptyFluentFuture()).when(this.domDW).commit();
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), any(), anyInt(), any(KeyMapping.class));
doReturn(this.dispatcher).when(this.rib).getDispatcher();
doReturn(new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class)).when(this.tableTypeRegistry).getTableType(any());
doReturn(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(IpAddressNoZone.class), any(BGPSessionListener.class), any(BGPSessionPreferences.class));
doNothing().when(this.bgpPeerRegistry).removePeer(any(IpAddressNoZone.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