Search in sources :

Example 1 with DiscoverPathCommandData

use of org.openkilda.messaging.command.discovery.DiscoverPathCommandData in project open-kilda by telstra.

the class RecordHandler method doDiscoverPathCommand.

private void doDiscoverPathCommand(CommandData data) {
    DiscoverPathCommandData command = (DiscoverPathCommandData) data;
    logger.warn("NOT IMPLEMENTED: sending discover Path to {}", command);
}
Also used : DiscoverPathCommandData(org.openkilda.messaging.command.discovery.DiscoverPathCommandData)

Example 2 with DiscoverPathCommandData

use of org.openkilda.messaging.command.discovery.DiscoverPathCommandData in project open-kilda by telstra.

the class DiscoverPathCommandDataTest method dstSwitchId.

@Test
public void dstSwitchId() throws Exception {
    DiscoverPathCommandData data = new DiscoverPathCommandData();
    data.setDstSwitchId(switchId);
    assertEquals(switchId, data.getDstSwitchId());
}
Also used : DiscoverPathCommandData(org.openkilda.messaging.command.discovery.DiscoverPathCommandData) Test(org.junit.Test)

Example 3 with DiscoverPathCommandData

use of org.openkilda.messaging.command.discovery.DiscoverPathCommandData in project open-kilda by telstra.

the class DiscoverPathCommandDataTest method srcPortNo.

@Test
public void srcPortNo() throws Exception {
    DiscoverPathCommandData data = new DiscoverPathCommandData();
    data.setSrcPortNo(inputPort);
    assertEquals(inputPort, data.getSrcPortNo());
}
Also used : DiscoverPathCommandData(org.openkilda.messaging.command.discovery.DiscoverPathCommandData) Test(org.junit.Test)

Example 4 with DiscoverPathCommandData

use of org.openkilda.messaging.command.discovery.DiscoverPathCommandData in project open-kilda by telstra.

the class CommandBolt method processCommand.

protected void processCommand(Tuple tuple) throws Exception {
    CommandMessage command = Utils.MAPPER.readValue(getJson(tuple), CommandMessage.class);
    if (command.getDestination() == Destination.CONTROLLER) {
        CommandData data = command.getData();
        Commands switchCommand;
        String sw;
        if (data instanceof DiscoverIslCommandData) {
            switchCommand = Commands.DO_DISCOVER_ISL_COMMAND;
            sw = ((DiscoverIslCommandData) data).getSwitchId();
        } else if (data instanceof DiscoverPathCommandData) {
            switchCommand = Commands.DO_DISCOVER_PATH_COMMAND;
            sw = ((DiscoverPathCommandData) data).getSrcSwitchId();
        } else if (data instanceof InstallIngressFlow) {
            switchCommand = Commands.DO_INSTALL_INGRESS_FLOW;
            sw = ((InstallIngressFlow) data).getSwitchId();
        } else if (data instanceof InstallEgressFlow) {
            switchCommand = Commands.DO_INSTALL_EGRESS_FLOW;
            sw = ((InstallEgressFlow) data).getSwitchId();
        } else if (data instanceof InstallTransitFlow) {
            switchCommand = Commands.DO_INSTALL_TRANSIT_FLOW;
            sw = ((InstallTransitFlow) data).getSwitchId();
        } else if (data instanceof InstallOneSwitchFlow) {
            switchCommand = Commands.DO_INSTALL_ONESWITCH_FLOW;
            sw = ((InstallOneSwitchFlow) data).getSwitchId();
        } else if (data instanceof RemoveFlow) {
            switchCommand = Commands.DO_DELETE_FLOW;
            sw = ((RemoveFlow) data).getSwitchId();
        } else {
            logger.error("unknown data type: {}", data.toString());
            throw new Exception("Unknown command {}".format(data.getClass().getSimpleName()));
        }
        List<Integer> taskIDs = collector.emit(SimulatorTopology.COMMAND_BOLT_STREAM, tuple, new Values(sw.toLowerCase(), switchCommand.name(), command.getData()));
    // logger.info("{}:  {} - {}", switchCommand.name(), sw, command.getData().toString());
    }
}
Also used : DiscoverIslCommandData(org.openkilda.messaging.command.discovery.DiscoverIslCommandData) Values(org.apache.storm.tuple.Values) CommandMessage(org.openkilda.messaging.command.CommandMessage) Commands(org.openkilda.simulator.classes.Commands) CommandData(org.openkilda.messaging.command.CommandData) DiscoverPathCommandData(org.openkilda.messaging.command.discovery.DiscoverPathCommandData) DiscoverIslCommandData(org.openkilda.messaging.command.discovery.DiscoverIslCommandData) DiscoverPathCommandData(org.openkilda.messaging.command.discovery.DiscoverPathCommandData)

Example 5 with DiscoverPathCommandData

use of org.openkilda.messaging.command.discovery.DiscoverPathCommandData in project open-kilda by telstra.

the class DiscoverPathCommandDataTest method srcSwitchId.

@Test
public void srcSwitchId() throws Exception {
    DiscoverPathCommandData data = new DiscoverPathCommandData();
    data.setSrcSwitchId(switchId);
    assertEquals(switchId, data.getSrcSwitchId());
}
Also used : DiscoverPathCommandData(org.openkilda.messaging.command.discovery.DiscoverPathCommandData) Test(org.junit.Test)

Aggregations

DiscoverPathCommandData (org.openkilda.messaging.command.discovery.DiscoverPathCommandData)6 Test (org.junit.Test)4 Values (org.apache.storm.tuple.Values)1 CommandData (org.openkilda.messaging.command.CommandData)1 CommandMessage (org.openkilda.messaging.command.CommandMessage)1 DiscoverIslCommandData (org.openkilda.messaging.command.discovery.DiscoverIslCommandData)1 Commands (org.openkilda.simulator.classes.Commands)1