blob: e54dbcba3e308f9bf6364205a9fbb61ab37073ae [file] [log] [blame]
alshabibab984662014-12-04 18:56:18 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
alshabibab984662014-12-04 18:56:18 -08003 *
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 */
Jonathan Hart470ed4f2017-01-31 16:52:28 -080016package org.onosproject.intentsync.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;
Jonathan Hart470ed4f2017-01-31 16:52:28 -080021import org.onosproject.intentsync.IntentSynchronizationAdminService;
Jonathan Hartec2df012014-10-23 16:40:24 -070022
23/**
Jonathan Hart365335e2015-12-10 11:09:53 -080024 * Command to change whether this instance's intent synchronizer is primary.
Jonathan Hartec2df012014-10-23 16:40:24 -070025 */
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() {
Jonathan Hart470ed4f2017-01-31 16:52:28 -080037 AbstractShellCommand.get(IntentSynchronizationAdminService.class).modifyPrimary(isPrimary);
Jonathan Hartec2df012014-10-23 16:40:24 -070038 }
39
40}