Search in sources :

Example 1 with AbstractAction

use of org.openkilda.wfm.AbstractAction in project open-kilda by telstra.

the class CtrlAction method handle.

@Override
protected void handle() throws MessageFormatException, UnsupportedActionException {
    String source = getTuple().getSourceComponent();
    if (!source.equals(AbstractTopology.BOLT_ID_CTRL_ROUTE)) {
        return;
    }
    isHandled = true;
    AbstractAction action;
    RouteMessage message = new RouteMessage(getTuple());
    RequestData payload = message.getPayload();
    switch(payload.getAction()) {
        case "list":
            action = new ListAction(this, message);
            break;
        case "dump":
            action = new DumpStateAction(this, message);
            break;
        case "clearState":
            action = new ClearStateAction(this, message);
            break;
        default:
            throw new UnsupportedActionException(payload.getAction());
    }
    action.run();
}
Also used : RequestData(org.openkilda.messaging.ctrl.RequestData) AbstractAction(org.openkilda.wfm.AbstractAction) UnsupportedActionException(org.openkilda.wfm.UnsupportedActionException)

Aggregations

RequestData (org.openkilda.messaging.ctrl.RequestData)1 AbstractAction (org.openkilda.wfm.AbstractAction)1 UnsupportedActionException (org.openkilda.wfm.UnsupportedActionException)1