5ccf35583435305bc69754325fb0b1616846e328
[netvirt.git] / qosservice / impl / src / main / java / org / opendaylight / netvirt / qosservice / QosAlertEnableCLI.java
1 /*
2  * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.netvirt.qosservice;
10
11 import javax.annotation.Nullable;
12 import org.apache.karaf.shell.commands.Argument;
13 import org.apache.karaf.shell.commands.Command;
14 import org.apache.karaf.shell.console.OsgiCommandSupport;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18
19 @Command(scope = "qos", name = "enable-qos-alert",
20                         description = "configuration to enable or disable QoS packet drop alert")
21 public class QosAlertEnableCLI extends OsgiCommandSupport {
22
23     @Argument(index = 0, name = "<value>", description = "true|false - enable/disable QoS packet drop alert",
24                                                                               required = true, multiValued = false)
25     private String value;
26
27     private QosAlertManager qosAlertManager;
28
29     private static final Logger LOG = LoggerFactory.getLogger(QosAlertEnableCLI.class);
30
31     public void setQosAlertManager(QosAlertManager qosAlertManager) {
32         this.qosAlertManager = qosAlertManager;
33         LOG.trace("Qos manager:{} set", qosAlertManager);
34     }
35
36     @Override
37     @Nullable
38     protected Object doExecute() {
39         LOG.debug("Setting poll enable in qos alert manager:{}", value);
40         qosAlertManager.setEnable(Boolean.parseBoolean(value));
41         return null;
42     }
43
44 }