<artifactId>org.apache.karaf.shell.console</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.table</artifactId>
- <version>${karaf.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.commands</artifactId>
- <version>${karaf.version}</version>
- <scope>provided</scope>
- </dependency>
<!--Test dependencies-->
<dependency>
<groupId>junit</groupId>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Karaf-Commands>*</Karaf-Commands>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<scm>
<connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
<developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
*/
package org.opendaylight.protocol.bgp.cli;
-import static java.util.Objects.requireNonNull;
-
+import org.apache.karaf.shell.api.action.Action;
import org.apache.karaf.shell.api.action.Command;
import org.apache.karaf.shell.api.action.Option;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.protocol.bgp.cli.utils.BGPOperationalStateUtils;
+@Service
@Command(scope = "bgp", name = "operational-state", description = "Shows BGP Operational State.")
-public final class OperationalStateCommandProvider extends OsgiCommandSupport {
+public final class OperationalStateCommandProvider implements Action {
+ @Reference
+ private Session session;
+ @Reference
private DataBroker dataBroker;
@Option(name = "-neighbor", aliases = {"--neighbor"}, description = "Neighbor address")
private String peer;
private String group;
@Override
- protected Object doExecute() throws Exception {
+ public Object execute() {
BGPOperationalStateUtils.displayBgpOperationalState(this.dataBroker, this.session.getConsole(),
this.ribId, this.group, this.peer);
return null;
}
-
- public void setDataBroker(final DataBroker dataBroker) {
- this.dataBroker = requireNonNull(dataBroker);
- }
}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v1.0 which accompanies this distribution,
- and is available at http://www.eclipse.org/legal/epl-v10.html
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
-
- <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
- odl:type="pingpong"/>
-
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
- <command name="bgp/operational-state">
- <action class="org.opendaylight.protocol.bgp.cli.OperationalStateCommandProvider">
- <property name="dataBroker" ref="dataBroker"/>
- </action>
- </command>
- </command-bundle>
-</blueprint>
\ No newline at end of file
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <!-- This bundle works with Karaf 3 and 4.0 -->
+ <Import-Package>
+ org.apache.karaf.shell.commands;version="[3.0.0,4.2)",
+ org.apache.karaf.shell.console;version="[3.0.0,4.2)",
+ *
+ </Import-Package>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Karaf-Commands>*</Karaf-Commands>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<scm>
<connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
<developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
*/
package org.opendaylight.protocol.pcep.cli;
-import static java.util.Objects.requireNonNull;
-
+import org.apache.karaf.shell.api.action.Action;
import org.apache.karaf.shell.api.action.Command;
import org.apache.karaf.shell.api.action.Option;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.protocol.pcep.cli.utils.PcepStateUtils;
+@Service
@Command(scope = "pcep", name = "node-state", description = "Shows PCEP Topology Node Session State.")
-public final class PcepStateCommandProvider extends OsgiCommandSupport {
+public final class PcepStateCommandProvider implements Action {
+ @Reference
+ private Session session;
+ @Reference
private DataBroker dataBroker;
@Option(name = "-topology-id", aliases = {"--tpi"}, description = "Topology Id", required = true)
private String tpi;
private String ni;
@Override
- protected Object doExecute() throws Exception {
+ public Object execute() {
PcepStateUtils.displayNodeState(this.dataBroker, this.session.getConsole(), this.tpi, this.ni);
return null;
}
-
- public void setDataBroker(final DataBroker dataBroker) {
- this.dataBroker = requireNonNull(dataBroker);
- }
}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v1.0 which accompanies this distribution,
- and is available at http://www.eclipse.org/legal/epl-v10.html
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
-
- <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
- odl:type="pingpong"/>
-
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
- <command name="pcep/node-state">
- <action class="org.opendaylight.protocol.pcep.cli.PcepStateCommandProvider">
- <property name="dataBroker" ref="dataBroker"/>
- </action>
- </command>
- </command-bundle>
-</blueprint>
\ No newline at end of file