Search in sources :

Example 1 with SwitchOnlineStatusMonitor

use of org.openkilda.wfm.topology.network.utils.SwitchOnlineStatusMonitor in project open-kilda by telstra.

the class NetworkBfdSessionServiceTest method setUp.

@Before
public void setUp() throws Exception {
    RepositoryFactory repositoryFactory = Mockito.mock(RepositoryFactory.class);
    when(repositoryFactory.createSwitchRepository()).thenReturn(switchRepository);
    when(repositoryFactory.createBfdSessionRepository()).thenReturn(bfdSessionRepository);
    when(persistenceManager.getTransactionManager()).thenReturn(transactionManager);
    doAnswer(invocation -> {
        TransactionCallbackWithoutResult<?> tr = invocation.getArgument(0);
        tr.doInTransaction();
        return null;
    }).when(transactionManager).doInTransaction(Mockito.any(TransactionCallbackWithoutResult.class));
    doAnswer(invocation -> {
        TransactionCallback<?, ?> tr = invocation.getArgument(0);
        return tr.doInTransaction();
    }).when(transactionManager).doInTransaction(Mockito.any(TransactionCallback.class));
    when(persistenceManager.getRepositoryFactory()).thenReturn(repositoryFactory);
    switchOnlineStatusMonitor = new SwitchOnlineStatusMonitor();
    endpointStatusMonitor = new EndpointStatusMonitor();
    setupCarrier();
    service = new NetworkBfdSessionService(persistenceManager, switchOnlineStatusMonitor, endpointStatusMonitor, carrier);
}
Also used : TransactionCallback(org.openkilda.persistence.tx.TransactionCallback) SwitchOnlineStatusMonitor(org.openkilda.wfm.topology.network.utils.SwitchOnlineStatusMonitor) EndpointStatusMonitor(org.openkilda.wfm.topology.network.utils.EndpointStatusMonitor) RepositoryFactory(org.openkilda.persistence.repositories.RepositoryFactory) TransactionCallbackWithoutResult(org.openkilda.persistence.tx.TransactionCallbackWithoutResult) Before(org.junit.Before)

Example 2 with SwitchOnlineStatusMonitor

use of org.openkilda.wfm.topology.network.utils.SwitchOnlineStatusMonitor in project open-kilda by telstra.

the class BfdHub method init.

// -- setup --
@Override
protected void init() {
    switchOnlineStatusMonitor = new SwitchOnlineStatusMonitor();
    endpointStatusMonitor = new EndpointStatusMonitor();
    logicalPortService = new NetworkBfdLogicalPortService(this, switchOnlineStatusMonitor, options.getBfdLogicalPortOffset());
    sessionService = new NetworkBfdSessionService(persistenceManager, switchOnlineStatusMonitor, endpointStatusMonitor, this);
    globalToggleService = new NetworkBfdGlobalToggleService(this, persistenceManager);
    requestIdFactory = new TaskIdBasedKeyFactory(getTaskId());
}
Also used : SwitchOnlineStatusMonitor(org.openkilda.wfm.topology.network.utils.SwitchOnlineStatusMonitor) EndpointStatusMonitor(org.openkilda.wfm.topology.network.utils.EndpointStatusMonitor) NetworkBfdLogicalPortService(org.openkilda.wfm.topology.network.service.NetworkBfdLogicalPortService) NetworkBfdGlobalToggleService(org.openkilda.wfm.topology.network.service.NetworkBfdGlobalToggleService) TaskIdBasedKeyFactory(org.openkilda.wfm.share.hubandspoke.TaskIdBasedKeyFactory) NetworkBfdSessionService(org.openkilda.wfm.topology.network.service.NetworkBfdSessionService)

Aggregations

EndpointStatusMonitor (org.openkilda.wfm.topology.network.utils.EndpointStatusMonitor)2 SwitchOnlineStatusMonitor (org.openkilda.wfm.topology.network.utils.SwitchOnlineStatusMonitor)2 Before (org.junit.Before)1 RepositoryFactory (org.openkilda.persistence.repositories.RepositoryFactory)1 TransactionCallback (org.openkilda.persistence.tx.TransactionCallback)1 TransactionCallbackWithoutResult (org.openkilda.persistence.tx.TransactionCallbackWithoutResult)1 TaskIdBasedKeyFactory (org.openkilda.wfm.share.hubandspoke.TaskIdBasedKeyFactory)1 NetworkBfdGlobalToggleService (org.openkilda.wfm.topology.network.service.NetworkBfdGlobalToggleService)1 NetworkBfdLogicalPortService (org.openkilda.wfm.topology.network.service.NetworkBfdLogicalPortService)1 NetworkBfdSessionService (org.openkilda.wfm.topology.network.service.NetworkBfdSessionService)1