blob: 72cc112e14f30559c15e42a5ed510877f8693ab5 [file] [log] [blame]
alshabibab984662014-12-04 18:56:18 -08001/*
2 * Copyright 2014 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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.sdnip.cli;
Jonathan Hartec2df012014-10-23 16:40:24 -070017
18import org.apache.karaf.shell.commands.Argument;
19import org.apache.karaf.shell.commands.Command;
Brian O'Connorabafb502014-12-02 22:26:20 -080020import org.onosproject.cli.AbstractShellCommand;
21import org.onosproject.sdnip.SdnIpService;
Jonathan Hartec2df012014-10-23 16:40:24 -070022
23/**
24 * Command to change whether this SDNIP instance is primary or not.
25 */
26@Command(scope = "onos", name = "sdnip-set-primary",
27 description = "Changes the primary status of this SDN-IP instance")
28public class PrimaryChangeCommand extends AbstractShellCommand {
29
30 @Argument(index = 0, name = "isPrimary",
31 description = "True if this instance should be primary, false if not",
32 required = true, multiValued = false)
33 boolean isPrimary = false;
34
35 @Override
36 protected void execute() {
37 get(SdnIpService.class).modifyPrimary(isPrimary);
38 }
39
40}