mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-12-06 18:01:53 +01:00
[ONOS-7732] Automating switch workflow - workflow event map cli completer
Change-Id: I2fbabf4b42ab99fcf439e6b5864b5c1a53c1530f
This commit is contained in:
parent
024f44c902
commit
50370b5664
@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Completion;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.onosproject.cli.AbstractShellCommand;
|
||||
import org.onosproject.workflow.api.ContextEventMapStore;
|
||||
@ -32,7 +33,11 @@ import java.util.Objects;
|
||||
@Command(scope = "onos", name = "workflow-eventmap", description = "workflow event map cli")
|
||||
public class WorkFlowEventMapCommand extends AbstractShellCommand {
|
||||
|
||||
@Argument(index = 0, name = "cmd", description = "command(print)", required = true)
|
||||
static final String PRINT = "print";
|
||||
|
||||
@Argument(index = 0, name = "cmd",
|
||||
description = "command(" + PRINT + ")", required = true)
|
||||
@Completion(WorkFlowEventMapCompleter.class)
|
||||
private String cmd = null;
|
||||
|
||||
@Override
|
||||
@ -45,7 +50,7 @@ public class WorkFlowEventMapCommand extends AbstractShellCommand {
|
||||
ContextEventMapStore store = get(ContextEventMapStore.class);
|
||||
try {
|
||||
switch (cmd) {
|
||||
case "print":
|
||||
case PRINT:
|
||||
JsonNode tree = store.asJsonTree();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2019-present Open Networking Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.onosproject.workflow.cli;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.onosproject.cli.AbstractChoicesCompleter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.onosproject.workflow.cli.WorkFlowEventMapCommand.PRINT;
|
||||
|
||||
/**
|
||||
* Workflow event map command completer.
|
||||
*/
|
||||
@Service
|
||||
public class WorkFlowEventMapCompleter extends AbstractChoicesCompleter {
|
||||
@Override
|
||||
protected List<String> choices() {
|
||||
return ImmutableList.of(PRINT); }
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user