@Test
public void testHARoleChange() throws Exception {

    LinkDiscoveryManager linkDiscovery = getLinkDiscoveryManager();
    IOFSwitch sw1 = createMockSwitch(1L);
    IOFSwitch sw2 = createMockSwitch(2L);
    replay(sw1, sw2);
    Link lt = new Link(DatapathId.of(1L), OFPort.of(2), DatapathId.of(2L), OFPort.of(1));
    NodePortTuple srcNpt = new NodePortTuple(DatapathId.of(1L), OFPort.of(2));
    NodePortTuple dstNpt = new NodePortTuple(DatapathId.of(2L), OFPort.of(1));
    LinkInfo info = new LinkInfo(new Date(),
    		new Date(), null);
    linkDiscovery.addOrUpdateLink(lt, info);
    // check invariants hold
    assertNotNull(linkDiscovery.switchLinks.get(lt.getSrc()));
    assertTrue(linkDiscovery.switchLinks.get(lt.getSrc()).contains(lt));
    assertNotNull(linkDiscovery.portLinks.get(srcNpt));
    assertTrue(linkDiscovery.portLinks.get(srcNpt).contains(lt));
    assertNotNull(linkDiscovery.portLinks.get(dstNpt));
    assertTrue(linkDiscovery.portLinks.get(dstNpt).contains(lt));
    assertTrue(linkDiscovery.links.containsKey(lt));
    /* FIXME: what's the right thing to do here:
    // check that it clears from memory
    getMockFloodlightProvider().dispatchRoleChanged(Role.SLAVE);
    assertTrue(linkDiscovery.switchLinks.isEmpty());
    getMockFloodlightProvider().dispatchRoleChanged(Role.MASTER);
    // check that lldps were sent
    assertTrue(ldm.isSendLLDPsCalled);
    assertTrue(ldm.isClearLinksCalled);
    ldm.reset();
    */
}