Xin Jin | 313708b | 2015-07-09 13:43:04 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 3 | * |
| 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 | */ |
| 16 | package org.onosproject.cli.net; |
| 17 | |
| 18 | import org.apache.karaf.shell.commands.Argument; |
| 19 | import org.apache.karaf.shell.commands.Command; |
| 20 | import org.onosproject.cli.AbstractShellCommand; |
| 21 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
| 22 | |
| 23 | /** |
| 24 | * Manages FlowObjectiveComposition policy. |
| 25 | */ |
| 26 | @Command(scope = "onos", name = "policy", |
| 27 | description = "Manages FlowObjectiveComposition policy") |
| 28 | public class FlowObjectiveCompositionCommand extends AbstractShellCommand { |
| 29 | |
| 30 | @Argument(index = 0, name = "command", |
| 31 | description = "Command name (install)", |
| 32 | required = true, multiValued = false) |
| 33 | String command = null; |
| 34 | |
| 35 | @Argument(index = 1, name = "names", description = "policy string", |
| 36 | required = true, multiValued = true) |
| 37 | String[] policies = null; |
| 38 | |
| 39 | @Override |
| 40 | protected void execute() { |
| 41 | FlowObjectiveService service = get(FlowObjectiveService.class); |
| 42 | service.initPolicy(policies[0]); |
| 43 | print("Policy %s installed", policies[0]); |
| 44 | } |
| 45 | } |