blob: a7d260d07e99ff81c9317f4ed55d24878e1ba5e4 [file] [log] [blame]
tomf5c9d922014-10-03 15:22:03 -07001package org.onlab.onos.cli.net;
2
3import org.apache.karaf.shell.commands.Command;
4import org.onlab.onos.cli.AbstractShellCommand;
5import org.onlab.onos.net.intent.Intent;
6import org.onlab.onos.net.intent.IntentService;
Brian O'Connora4cab072014-10-03 18:46:39 -07007import org.onlab.onos.net.intent.IntentState;
tomf5c9d922014-10-03 15:22:03 -07008
9/**
10 * Lists the inventory of intents and their states.
11 */
12@Command(scope = "onos", name = "intents",
13 description = "Lists the inventory of intents and their states")
14public class IntentsListCommand extends AbstractShellCommand {
15
16 @Override
17 protected void execute() {
18 IntentService service = get(IntentService.class);
19 for (Intent intent : service.getIntents()) {
Brian O'Connora4cab072014-10-03 18:46:39 -070020 IntentState state = service.getIntentState(intent.getId());
21 print("%s %s %s", intent.getId(), state, intent);
tomf5c9d922014-10-03 15:22:03 -070022 }
23 }
24
25}