blob: b7416d48bc51c4baeb2793148e613e128ab739a7 [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
Ray Milkey86ad7bb2018-09-27 12:32:28 -070018import org.apache.karaf.shell.api.action.Argument;
19import org.apache.karaf.shell.api.action.Command;
Ray Milkey7a2dee52018-09-28 10:58:28 -070020import org.apache.karaf.shell.api.action.lifecycle.Service;
Brian O'Connorabafb502014-12-02 22:26:20 -080021import org.onosproject.cli.AbstractShellCommand;
Jonathan Hart470ed4f2017-01-31 16:52:28 -080022import org.onosproject.intentsync.IntentSynchronizationAdminService;
Jonathan Hartec2df012014-10-23 16:40:24 -070023
24/**
Jonathan Hart365335e2015-12-10 11:09:53 -080025 * Command to change whether this instance's intent synchronizer is primary.
Jonathan Hartec2df012014-10-23 16:40:24 -070026 */
Ray Milkey7a2dee52018-09-28 10:58:28 -070027@Service
Jonathan Hartec2df012014-10-23 16:40:24 -070028@Command(scope = "onos", name = "sdnip-set-primary",
29 description = "Changes the primary status of this SDN-IP instance")
30public class PrimaryChangeCommand extends AbstractShellCommand {
31
32 @Argument(index = 0, name = "isPrimary",
33 description = "True if this instance should be primary, false if not",
34 required = true, multiValued = false)
35 boolean isPrimary = false;
36
37 @Override
Ray Milkey86ad7bb2018-09-27 12:32:28 -070038 protected void doExecute() {
Jonathan Hart470ed4f2017-01-31 16:52:28 -080039 AbstractShellCommand.get(IntentSynchronizationAdminService.class).modifyPrimary(isPrimary);
Jonathan Hartec2df012014-10-23 16:40:24 -070040 }
41
42}