Jonathan Hart | ec2df01 | 2014-10-23 16:40:24 -0700 | [diff] [blame] | 1 | package org.onlab.onos.sdnip.cli; |
| 2 | |
| 3 | import org.apache.karaf.shell.commands.Argument; |
| 4 | import org.apache.karaf.shell.commands.Command; |
| 5 | import org.onlab.onos.cli.AbstractShellCommand; |
| 6 | import org.onlab.onos.sdnip.SdnIpService; |
| 7 | |
| 8 | /** |
| 9 | * Command to change whether this SDNIP instance is primary or not. |
| 10 | */ |
| 11 | @Command(scope = "onos", name = "sdnip-set-primary", |
| 12 | description = "Changes the primary status of this SDN-IP instance") |
| 13 | public class PrimaryChangeCommand extends AbstractShellCommand { |
| 14 | |
| 15 | @Argument(index = 0, name = "isPrimary", |
| 16 | description = "True if this instance should be primary, false if not", |
| 17 | required = true, multiValued = false) |
| 18 | boolean isPrimary = false; |
| 19 | |
| 20 | @Override |
| 21 | protected void execute() { |
| 22 | get(SdnIpService.class).modifyPrimary(isPrimary); |
| 23 | } |
| 24 | |
| 25 | } |