@Test public void switchFromOnlineToOnlineWithAcquireBfdFeature() { NetworkSwitchService service = new NetworkSwitchService(carrier, persistenceManager, options); List<SpeakerSwitchPortView> ports = doSpeakerOnline(service, Collections.emptySet()); List<SpeakerSwitchPortView> ports2 = swapBfdPortsState(ports); resetMocks(); service.switchBecomeManaged(getSpeakerSwitchView().toBuilder() .features(Collections.singleton(SwitchFeature.BFD)) .ports(ports2) .build()); verify(carrier).removePortHandler(Endpoint.of(alphaDatapath, 1 + BFD_LOGICAL_PORT_OFFSET)); verify(carrier).setupBfdPortHandler(Endpoint.of(alphaDatapath, 1 + BFD_LOGICAL_PORT_OFFSET), 1); verify(carrier).setBfdPortOnlineMode(Endpoint.of(alphaDatapath, 1 + BFD_LOGICAL_PORT_OFFSET), true); verify(carrier).setBfdPortLinkMode(Endpoint.of(alphaDatapath, 1 + BFD_LOGICAL_PORT_OFFSET), LinkStatus.DOWN); verify(carrier).removePortHandler(Endpoint.of(alphaDatapath, 2 + BFD_LOGICAL_PORT_OFFSET)); verify(carrier).setupBfdPortHandler(Endpoint.of(alphaDatapath, 2 + BFD_LOGICAL_PORT_OFFSET), 2); verify(carrier).setBfdPortOnlineMode(Endpoint.of(alphaDatapath, 2 + BFD_LOGICAL_PORT_OFFSET), true); verify(carrier).setBfdPortLinkMode(Endpoint.of(alphaDatapath, 2 + BFD_LOGICAL_PORT_OFFSET), LinkStatus.UP); }
public void switchBecomeManaged(SpeakerSwitchView switchView) { log.debug("Switch service receive MANAGED notification for {}", switchView.getDatapath()); SwitchFsm fsm = locateControllerCreateIfAbsent(switchView.getDatapath()); SwitchFsmContext context = SwitchFsmContext.builder(carrier) .speakerData(switchView) .build(); controllerExecutor.fire(fsm, SwitchFsmEvent.ONLINE, context); }
NetworkSwitchService { public void switchBecomeManaged(SpeakerSwitchView switchView) { log.debug("Switch service receive MANAGED notification for {}", switchView.getDatapath()); SwitchFsm fsm = locateControllerCreateIfAbsent(switchView.getDatapath()); SwitchFsmContext context = SwitchFsmContext.builder(carrier) .speakerData(switchView) .build(); controllerExecutor.fire(fsm, SwitchFsmEvent.ONLINE, context); } }
NetworkSwitchService { public void switchBecomeManaged(SpeakerSwitchView switchView) { log.debug("Switch service receive MANAGED notification for {}", switchView.getDatapath()); SwitchFsm fsm = locateControllerCreateIfAbsent(switchView.getDatapath()); SwitchFsmContext context = SwitchFsmContext.builder(carrier) .speakerData(switchView) .build(); controllerExecutor.fire(fsm, SwitchFsmEvent.ONLINE, context); } NetworkSwitchService(ISwitchCarrier carrier, PersistenceManager persistenceManager,
                                NetworkOptions options); }
NetworkSwitchService { public void switchBecomeManaged(SpeakerSwitchView switchView) { log.debug("Switch service receive MANAGED notification for {}", switchView.getDatapath()); SwitchFsm fsm = locateControllerCreateIfAbsent(switchView.getDatapath()); SwitchFsmContext context = SwitchFsmContext.builder(carrier) .speakerData(switchView) .build(); controllerExecutor.fire(fsm, SwitchFsmEvent.ONLINE, context); } NetworkSwitchService(ISwitchCarrier carrier, PersistenceManager persistenceManager,
                                NetworkOptions options); void switchAddWithHistory(HistoryFacts history); void switchEvent(SwitchInfoData payload); void switchManagerResponse(SwitchSyncResponse payload, String key); void switchManagerErrorResponse(SwitchSyncErrorData payload, String key); void switchManagerTimeout(SwitchId switchId, String key); void switchBecomeUnmanaged(SwitchId datapath); void switchBecomeManaged(SpeakerSwitchView switchView); void switchPortEvent(PortInfoData payload); void remove(SwitchId datapath); }
NetworkSwitchService { public void switchBecomeManaged(SpeakerSwitchView switchView) { log.debug("Switch service receive MANAGED notification for {}", switchView.getDatapath()); SwitchFsm fsm = locateControllerCreateIfAbsent(switchView.getDatapath()); SwitchFsmContext context = SwitchFsmContext.builder(carrier) .speakerData(switchView) .build(); controllerExecutor.fire(fsm, SwitchFsmEvent.ONLINE, context); } NetworkSwitchService(ISwitchCarrier carrier, PersistenceManager persistenceManager,
                                NetworkOptions options); void switchAddWithHistory(HistoryFacts history); void switchEvent(SwitchInfoData payload); void switchManagerResponse(SwitchSyncResponse payload, String key); void switchManagerErrorResponse(SwitchSyncErrorData payload, String key); void switchManagerTimeout(SwitchId switchId, String key); void switchBecomeUnmanaged(SwitchId datapath); void switchBecomeManaged(SpeakerSwitchView switchView); void switchPortEvent(PortInfoData payload); void remove(SwitchId datapath);  }