blob: d87f72326df14b4de2addf89507ca3445261856a [file] [log] [blame]
Xin Jin313708b2015-07-09 13:43:04 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Xin Jin313708b2015-07-09 13:43:04 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.cli.net;
17
Ray Milkeyd84f89b2018-08-17 14:54:17 -070018import org.apache.karaf.shell.api.action.Argument;
19import org.apache.karaf.shell.api.action.Command;
20import org.apache.karaf.shell.api.action.lifecycle.Service;
Xin Jin313708b2015-07-09 13:43:04 -070021import org.onosproject.cli.AbstractShellCommand;
22import org.onosproject.net.flowobjective.FlowObjectiveService;
23
24/**
25 * Manages FlowObjectiveComposition policy.
26 */
Ray Milkeyd84f89b2018-08-17 14:54:17 -070027@Service
Xin Jin313708b2015-07-09 13:43:04 -070028@Command(scope = "onos", name = "policy",
29 description = "Manages FlowObjectiveComposition policy")
30public class FlowObjectiveCompositionCommand extends AbstractShellCommand {
31
32 @Argument(index = 0, name = "command",
33 description = "Command name (install)",
34 required = true, multiValued = false)
35 String command = null;
36
37 @Argument(index = 1, name = "names", description = "policy string",
38 required = true, multiValued = true)
39 String[] policies = null;
40
41 @Override
Ray Milkeyd84f89b2018-08-17 14:54:17 -070042 protected void doExecute() {
Xin Jin313708b2015-07-09 13:43:04 -070043 FlowObjectiveService service = get(FlowObjectiveService.class);
44 service.initPolicy(policies[0]);
45 print("Policy %s installed", policies[0]);
46 }
47}