blob: 8b59ed16d99dcd6656786f70b7919f8926201688 [file] [log] [blame]
Jian Li7b8c3682019-05-12 13:57:15 +09001/*
2 * Copyright 2019-present Open Networking Foundation
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 */
16package org.onosproject.openstacknetworking.cli;
17
18import org.apache.karaf.shell.api.action.Argument;
19import org.apache.karaf.shell.api.action.Command;
20import org.apache.karaf.shell.api.action.lifecycle.Service;
21
22import org.onlab.packet.IpAddress;
23import org.onosproject.cli.AbstractShellCommand;
24import org.onosproject.openstacknetworking.api.OpenstackHaService;
25
26/**
27 * Configures openstack active IP address.
28 */
29@Service
30@Command(scope = "onos", name = "openstack-ha-activeip",
31 description = "Configure openstack active IP address.")
32public class OpenstackHaActiveIpCommand extends AbstractShellCommand {
33
34 @Argument(index = 0, name = "active node IP", description = "active node IP",
35 required = true, multiValued = false)
36 private String ip = null;
37
38 @Override
39 protected void doExecute() {
40 OpenstackHaService service = get(OpenstackHaService.class);
41
42 service.setActiveIp(IpAddress.valueOf(ip));
43
44 print("Active node IP address " + ip + " is configured");
45 }
46}