use of org.openkilda.wfm.topology.network.controller.port.PortFsm.PortFsmContext in project open-kilda by telstra.
the class NetworkPortService method updatePortProperties.
/**
* Update port properties.
*/
public void updatePortProperties(Endpoint endpoint, boolean discoveryEnabled) {
try {
transactionManager.doInTransaction(() -> {
PortProperties portProperties = savePortProperties(endpoint, discoveryEnabled);
PortFsm portFsm = locateController(endpoint);
PortFsmContext context = PortFsmContext.builder(carrier).build();
PortFsmEvent event = discoveryEnabled ? PortFsmEvent.ENABLE_DISCOVERY : PortFsmEvent.DISABLE_DISCOVERY;
controllerExecutor.fire(portFsm, event, context);
carrier.notifyPortPropertiesChanged(portProperties);
});
} catch (PersistenceException e) {
String message = format("Could not update port properties for '%s': %s", endpoint, e.getMessage());
throw new MessageException(NOT_FOUND, message, "Persistence exception");
} catch (IllegalStateException e) {
// Rollback if port is not found. It's allowed to change port properties for already existing ports only.
String message = format("Port not found: '%s'", e.getMessage());
throw new MessageException(NOT_FOUND, message, "Port not found exception");
}
}
use of org.openkilda.wfm.topology.network.controller.port.PortFsm.PortFsmContext in project open-kilda by telstra.
the class NetworkPortService method remove.
/**
* .
*/
public void remove(Endpoint endpoint) {
log.info("Port service receive remove request for {}", endpoint);
PortFsm portFsm = controller.remove(endpoint);
if (portFsm == null) {
throw new IllegalStateException(format("Port FSM not found (%s).", endpoint));
}
PortFsmContext context = PortFsmContext.builder(carrier).build();
controllerExecutor.fire(portFsm, PortFsmEvent.PORT_DEL, context);
}
use of org.openkilda.wfm.topology.network.controller.port.PortFsm.PortFsmContext in project open-kilda by telstra.
the class NetworkPortService method discovery.
/**
* Feed port FSM with discovery event from discovery poll subsystem.
*/
public void discovery(Endpoint endpoint, IslInfoData speakerDiscoveryEvent) {
log.debug("Port service receive discovery for {}: {}", endpoint, speakerDiscoveryEvent);
PortFsm portFsm = locateController(endpoint);
PortFsmContext context = PortFsmContext.builder(carrier).speakerDiscoveryEvent(speakerDiscoveryEvent).build();
controllerExecutor.fire(portFsm, PortFsmEvent.DISCOVERY, context);
}
use of org.openkilda.wfm.topology.network.controller.port.PortFsm.PortFsmContext in project open-kilda by telstra.
the class NetworkPortService method fail.
/**
* Feed port FSM with fail event from discovery poll subsystem.
*/
public void fail(Endpoint endpoint) {
log.debug("Port service receive fail for {}", endpoint);
PortFsm portFsm = locateController(endpoint);
PortFsmContext context = PortFsmContext.builder(carrier).build();
controllerExecutor.fire(portFsm, PortFsmEvent.FAIL, context);
}
use of org.openkilda.wfm.topology.network.controller.port.PortFsm.PortFsmContext in project open-kilda by telstra.
the class NetworkPortService method roundTripStatusNotification.
/**
* Handle round trip status notification.
*/
public void roundTripStatusNotification(RoundTripStatus status) {
log.debug("Port service receive round trip status notification: {}", status);
PortFsm portFsm = locateController(status.getEndpoint());
PortFsmContext context = PortFsmContext.builder(carrier).roundTripStatus(status).build();
controllerExecutor.fire(portFsm, PortFsmEvent.ROUND_TRIP_STATUS, context);
}
Aggregations