Search in sources :

Example 1 with MastershipTermService

use of org.onosproject.mastership.MastershipTermService in project onos by opennetworkinglab.

the class VirtualNetworkMastershipManagerTest method termService.

@Test
public void termService() {
    MastershipTermService ts = mastershipMgr1;
    // term = 1 for both
    mastershipMgr1.setRole(NID_LOCAL, VDID1, MASTER);
    assertEquals("inconsistent term: ", 1, ts.getMastershipTerm(VDID1).termNumber());
    // hand devices to NID_LOCAL and back: term = 1 + 2
    mastershipMgr1.setRole(NID_OTHER, VDID1, MASTER);
    mastershipMgr1.setRole(NID_LOCAL, VDID1, MASTER);
    assertEquals("inconsistent terms: ", 3, ts.getMastershipTerm(VDID1).termNumber());
}
Also used : MastershipTermService(org.onosproject.mastership.MastershipTermService) Test(org.junit.Test)

Example 2 with MastershipTermService

use of org.onosproject.mastership.MastershipTermService in project onos by opennetworkinglab.

the class MastershipManagerTest method termService.

@Test
public void termService() {
    MastershipTermService ts = mgr;
    // term = 1 for both
    mgr.setRole(NID_LOCAL, DEV_MASTER, MASTER);
    assertEquals("inconsistent term: ", 1, ts.getMastershipTerm(DEV_MASTER).termNumber());
    // hand devices to NID_LOCAL and back: term = 1 + 2
    mgr.setRole(NID_OTHER, DEV_MASTER, MASTER);
    mgr.setRole(NID_LOCAL, DEV_MASTER, MASTER);
    assertEquals("inconsistent terms: ", 3, ts.getMastershipTerm(DEV_MASTER).termNumber());
}
Also used : MastershipTermService(org.onosproject.mastership.MastershipTermService) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 MastershipTermService (org.onosproject.mastership.MastershipTermService)2