From: Dominik Vrbovsky Date: Tue, 7 Sep 2021 16:10:31 +0000 (+0200) Subject: Introduce cli commands for clustering-test-app X-Git-Tag: v4.0.3~3 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=771f58ab713985d0c797c80079c603256876d8d4 Introduce cli commands for clustering-test-app Rework the rpcs needed by csit in clustering-test-app to Karaf CLI commands. This is essentially a custom-coded invocation of MD-SAL services. JIRA: CONTROLLER-1995 Change-Id: If406a4dff6d441e9d0932de05f844d66f1e5bc83 Signed-off-by: Dominik Vrbovsky Signed-off-by: Robert Varga --- diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 5cead0bc16..61e96f4120 100644 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -198,6 +198,11 @@ clustering-it-provider ${project.version} + + org.opendaylight.controller.samples + clustering-it-karaf-cli + ${project.version} + diff --git a/features/odl-clustering-test-app/pom.xml b/features/odl-clustering-test-app/pom.xml index d8f40d32ec..c480eb8843 100644 --- a/features/odl-clustering-test-app/pom.xml +++ b/features/odl-clustering-test-app/pom.xml @@ -39,5 +39,9 @@ org.opendaylight.controller.samples clustering-it-provider + + org.opendaylight.controller.samples + clustering-it-karaf-cli + diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/pom.xml b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/pom.xml new file mode 100644 index 0000000000..e76ce4ab91 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/pom.xml @@ -0,0 +1,71 @@ + + + + + mdsal-parent + org.opendaylight.controller + 4.0.3-SNAPSHOT + ../../../parent/pom.xml + + 4.0.0 + + org.opendaylight.controller.samples + clustering-it-karaf-cli + bundle + + + + org.apache.karaf.shell + org.apache.karaf.shell.core + provided + + + org.opendaylight.mdsal + mdsal-binding-api + + + org.opendaylight.mdsal + mdsal-binding-dom-codec-api + + + org.opendaylight.controller.samples + clustering-it-model + + + org.opendaylight.yangtools + yang-data-codec-gson + + + org.osgi + org.osgi.service.component.annotations + + + + + + + org.apache.karaf.tooling + karaf-services-maven-plugin + ${karaf.version} + + + service-metadata-generate + process-classes + + service-metadata-generate + + + + + + + + diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/AbstractRpcAction.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/AbstractRpcAction.java new file mode 100644 index 0000000000..d76dbb5bce --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/AbstractRpcAction.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli; + +import com.google.common.util.concurrent.ListenableFuture; +import java.util.concurrent.ExecutionException; +import org.apache.karaf.shell.api.action.Action; +import org.opendaylight.yangtools.yang.common.RpcResult; + +/** + * Common base class for all commands which end up invoking an RPC. + */ +public abstract class AbstractRpcAction implements Action { + @Override + @SuppressWarnings("checkstyle:RegexpSinglelineJava") + public final Object execute() throws InterruptedException, ExecutionException { + final RpcResult result = invokeRpc().get(); + if (!result.isSuccessful()) { + // FIXME: is there a better way to report errors? + System.out.println("Invocation failed: " + result.getErrors()); + } + return null; + } + + protected abstract ListenableFuture> invokeRpc(); +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/DefaultInstanceIdentifierSupport.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/DefaultInstanceIdentifierSupport.java new file mode 100644 index 0000000000..7590c3c3dc --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/DefaultInstanceIdentifierSupport.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Verify.verifyNotNull; + +import java.util.Optional; +import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTree; +import org.opendaylight.mdsal.binding.dom.codec.api.BindingInstanceIdentifierCodec; +import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeContext; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; +import org.opendaylight.yangtools.yang.data.util.codec.TypeAwareCodec; +import org.opendaylight.yangtools.yang.model.api.Status; +import org.opendaylight.yangtools.yang.model.api.TypeAware; +import org.opendaylight.yangtools.yang.model.api.TypeDefinition; +import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.RequireServiceComponentRuntime; + +@Component +@RequireServiceComponentRuntime +public final class DefaultInstanceIdentifierSupport implements InstanceIdentifierSupport { + private final BindingInstanceIdentifierCodec bindingCodec; + private final TypeAwareCodec jsonCodec; + + @Activate + public DefaultInstanceIdentifierSupport(@Reference final BindingCodecTree bindingCodecTree, + @Reference final BindingRuntimeContext runtimeContext) { + bindingCodec = bindingCodecTree.getInstanceIdentifierCodec(); + jsonCodec = JSONCodecFactorySupplier.RFC7951.createLazy(runtimeContext.getEffectiveModelContext()) + .codecFor(new FakeLeafDefinition(), null); + } + + @Override + public InstanceIdentifier parseArgument(final String argument) { + final YangInstanceIdentifier path = verifyNotNull((YangInstanceIdentifier)jsonCodec.parseValue(null, argument)); + final InstanceIdentifier ret = bindingCodec.toBinding(path); + checkArgument(ret != null, "%s does not have a binding representation", path); + return ret; + } + + // Mock wiring for JSON codec. Perhaps we should really bind to context-ref, or receive the class, or something. + private static final class FakeLeafDefinition implements InstanceIdentifierTypeDefinition, TypeAware { + @Override + public Optional getReference() { + throw new UnsupportedOperationException(); + } + + @Override + public Optional getDescription() { + throw new UnsupportedOperationException(); + } + + @Override + public Status getStatus() { + throw new UnsupportedOperationException(); + } + + @Override + public QName getQName() { + throw new UnsupportedOperationException(); + } + + @Override + public Optional getUnits() { + throw new UnsupportedOperationException(); + } + + @Override + public Optional getDefaultValue() { + throw new UnsupportedOperationException(); + } + + @Override + public InstanceIdentifierTypeDefinition getBaseType() { + return null; + } + + @Override + public boolean requireInstance() { + return false; + } + + @Override + public TypeDefinition> getType() { + return this; + } + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/InstanceIdentifierSupport.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/InstanceIdentifierSupport.java new file mode 100644 index 0000000000..e7724dc7d9 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/InstanceIdentifierSupport.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli; + +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +/** + * Codec providing translation between CLI representation and {@link InstanceIdentifier}. This is mostly useful for + * injecting invocation contexts for {@code routed RPC}s and actions. + */ +public interface InstanceIdentifierSupport { + /** + * Parse a CLI argument into its {@link InstanceIdentifier} representation. + * + * @param argument Argument to parse + * @return Parse InstanceIdentifier + * @throws NullPointerException if {@code argument} is null + */ + @NonNull InstanceIdentifier parseArgument(String argument); +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/RegisterCommitCohortCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/RegisterCommitCohortCommand.java new file mode 100644 index 0000000000..ed42936064 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/RegisterCommitCohortCommand.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.car; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterCommitCohortInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "register-commit-cohort", description = "Run a register-commit-cohort test") +public class RegisterCommitCohortCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(CarService.class) + .registerCommitCohort(new RegisterCommitCohortInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/RegisterLoggingDtclCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/RegisterLoggingDtclCommand.java new file mode 100644 index 0000000000..dba686f5e3 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/RegisterLoggingDtclCommand.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.car; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterLoggingDtclInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "register-logging-dtcl", description = "Run a register-logging-dtcl test") +public class RegisterLoggingDtclCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(CarService.class) + .registerLoggingDtcl(new RegisterLoggingDtclInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/RegisterOwnershipCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/RegisterOwnershipCommand.java new file mode 100644 index 0000000000..60cc0989d9 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/RegisterOwnershipCommand.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.car; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterOwnershipInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "register-ownership", description = "Run a register-ownership test") +public class RegisterOwnershipCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "car-id", required = true) + String carId; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(CarService.class) + .registerOwnership(new RegisterOwnershipInputBuilder().setCarId(carId).build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/StopStressTestCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/StopStressTestCommand.java new file mode 100644 index 0000000000..7a41268591 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/StopStressTestCommand.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.car; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.StopStressTestInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app" , name = "stop-stress-test", description = "Run a stop-stress-test") +public class StopStressTestCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(CarService.class).stopStressTest(new StopStressTestInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/StressTestCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/StressTestCommand.java new file mode 100644 index 0000000000..6b9e64ad73 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/StressTestCommand.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.car; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.StressTestInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.Uint16; +import org.opendaylight.yangtools.yang.common.Uint32; + +@Service +@Command(scope = "test-app" , name = "stress-test", description = "Run a stress-test") +public class StressTestCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "rate", required = true) + int rate; + @Argument(index = 1, name = "count", required = true) + long count; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(CarService.class).stressTest(new StressTestInputBuilder() + .setRate(Uint16.valueOf(rate)) + .setCount(Uint32.valueOf(count)) + .build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/UnregisterCommitCohortCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/UnregisterCommitCohortCommand.java new file mode 100644 index 0000000000..c0e0f4efb8 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/UnregisterCommitCohortCommand.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.car; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterCommitCohortInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "unregister-commit-cohort", description = "Run a unregister-commit-cohort test") +public class UnregisterCommitCohortCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(CarService.class) + .unregisterCommitCohort(new UnregisterCommitCohortInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/UnregisterLoggingDtclsCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/UnregisterLoggingDtclsCommand.java new file mode 100644 index 0000000000..e3891fd883 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/UnregisterLoggingDtclsCommand.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.car; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterLoggingDtclsInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "unregister-logging-dtcls", description = "Run and unregister-logging-dtcls test") +public class UnregisterLoggingDtclsCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(CarService.class) + .unregisterLoggingDtcls(new UnregisterLoggingDtclsInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/UnregisterOwnershipCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/UnregisterOwnershipCommand.java new file mode 100644 index 0000000000..e699139738 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/UnregisterOwnershipCommand.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.car; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterOwnershipInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + + +@Service +@Command(scope = "test-app", name = "unregister-ownership", description = "Run an unregister-ownership test") +public class UnregisterOwnershipCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "car-id", required = true) + String carId; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(CarService.class) + .unregisterOwnership(new UnregisterOwnershipInputBuilder().setCarId(carId).build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/purchase/BuyCarCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/purchase/BuyCarCommand.java new file mode 100644 index 0000000000..f06d71f0db --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/car/purchase/BuyCarCommand.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.car.purchase; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.clustering.it.karaf.cli.InstanceIdentifierSupport; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.BuyCarInputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.CarPurchaseService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PersonId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PersonRef; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "buy-car", description = "Run a buy-car test") +public class BuyCarCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Reference + private InstanceIdentifierSupport iidSupport; + @Argument(index = 0, name = "person-ref", required = true) + String personRef; + @Argument(index = 1, name = "car-id", required = true) + CarId carId; + @Argument(index = 2, name = "person-id", required = true) + PersonId personId; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(CarPurchaseService.class).buyCar(new BuyCarInputBuilder() + .setPerson(new PersonRef(iidSupport.parseArgument(personRef))) + .setCarId(carId) + .setPersonId(personId) + .build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/AddShardReplicaCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/AddShardReplicaCommand.java new file mode 100644 index 0000000000..3280a5cc50 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/AddShardReplicaCommand.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.AddShardReplicaInputBuilder; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "add-shard-replica", description = "Run an add-shard-replica test") +public class AddShardReplicaCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "shard-name", required = true) + String shardName; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .addShardReplica(new AddShardReplicaInputBuilder().setShardName(shardName).build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/CheckPublishNotificationsCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/CheckPublishNotificationsCommand.java new file mode 100644 index 0000000000..818a9f9d55 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/CheckPublishNotificationsCommand.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.CheckPublishNotificationsInputBuilder; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "check-publish-notifications", + description = "Run a check-publish-notifications test") +public class CheckPublishNotificationsCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "id", required = true) + String id; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .checkPublishNotifications(new CheckPublishNotificationsInputBuilder() + .setId(id) + .build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/IsClientAbortedCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/IsClientAbortedCommand.java new file mode 100644 index 0000000000..0b238ee9f2 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/IsClientAbortedCommand.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.IsClientAbortedInputBuilder; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "is-client-aborted", description = "Run an is-client-aborted test") +public class IsClientAbortedCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .isClientAborted(new IsClientAbortedInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterBoundConstantCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterBoundConstantCommand.java new file mode 100644 index 0000000000..9fc92a3b19 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterBoundConstantCommand.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.clustering.it.karaf.cli.InstanceIdentifierSupport; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterBoundConstantInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "register-bound-constant", description = "Run a register-bound-constant test") +public class RegisterBoundConstantCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Reference + private InstanceIdentifierSupport iidSupport; + @Argument(index = 0, name = "context", required = true) + String context; + @Argument(index = 1, name = "constant", required = true) + String constant; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .registerBoundConstant(new RegisterBoundConstantInputBuilder() + .setConstant(constant) + .setContext(iidSupport.parseArgument(context)) + .build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterConstantCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterConstantCommand.java new file mode 100644 index 0000000000..e9a9ce938f --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterConstantCommand.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterConstantInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "register-contact", description = "Run a register-contact test") +public class RegisterConstantCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "constant", required = true) + String constant; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .registerConstant(new RegisterConstantInputBuilder().setConstant(constant).build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterDefaultConstantCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterDefaultConstantCommand.java new file mode 100644 index 0000000000..8aac81265d --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterDefaultConstantCommand.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterDefaultConstantInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "register-default-constant", description = "Run a register-default-constant test") +public class RegisterDefaultConstantCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "constant", required = true) + String constant; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .registerDefaultConstant(new RegisterDefaultConstantInputBuilder() + .setConstant(constant) + .build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterFlappingSingletonCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterFlappingSingletonCommand.java new file mode 100644 index 0000000000..8bd75fb0b7 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterFlappingSingletonCommand.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterFlappingSingletonInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "register-flapping-singleton", + description = "Run a register-flapping-singleton test") +public class RegisterFlappingSingletonCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .registerFlappingSingleton(new RegisterFlappingSingletonInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterSingletonConstantCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterSingletonConstantCommand.java new file mode 100644 index 0000000000..d5054c069c --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RegisterSingletonConstantCommand.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterSingletonConstantInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "register-singleton-constant", + description = "Run a register-singleton-constant text") +public class RegisterSingletonConstantCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "constant", required = true) + String constant; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .registerSingletonConstant(new RegisterSingletonConstantInputBuilder() + .setConstant(constant) + .build()); + + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RemoveShardReplicaCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RemoveShardReplicaCommand.java new file mode 100644 index 0000000000..fad24dda02 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/RemoveShardReplicaCommand.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RemoveShardReplicaInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "remove-shard-replica", description = "Run a remove-shard-replica test") +public class RemoveShardReplicaCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "shard-name", required = true) + String shardName; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .removeShardReplica(new RemoveShardReplicaInputBuilder().setShardName(shardName).build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/ShutdownShardReplicaCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/ShutdownShardReplicaCommand.java new file mode 100644 index 0000000000..1a75b5b9f1 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/ShutdownShardReplicaCommand.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.ShutdownShardReplicaInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "shutdown-shard-replica", description = " Run a shutdown-shard-replica test") +public class ShutdownShardReplicaCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "shard-name", required = true) + String shardName; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .shutdownShardReplica(new ShutdownShardReplicaInputBuilder() + .setShardName(shardName) + .build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/StartPublishNotificationsCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/StartPublishNotificationsCommand.java new file mode 100644 index 0000000000..bf17708401 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/StartPublishNotificationsCommand.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.StartPublishNotificationsInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.Uint32; + +@Service +@Command(scope = "test-app", name = "start-publish-notifications", + description = "Run a start-publish-notifications test") +public class StartPublishNotificationsCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "id", required = true) + String id; + @Argument(index = 1, name = "seconds", required = true) + long seconds; + @Argument(index = 2, name = "notifications-per-second", required = true) + long notificationsPerSecond; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .startPublishNotifications(new StartPublishNotificationsInputBuilder() + .setId(id) + .setSeconds(Uint32.valueOf(seconds)) + .setNotificationsPerSecond(Uint32.valueOf(notificationsPerSecond)) + .build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/SubscribeDdtlCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/SubscribeDdtlCommand.java new file mode 100644 index 0000000000..3a58f63b90 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/SubscribeDdtlCommand.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeDdtlInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "subscribe-ddtl", description = "Run a subscribe-ddtl test") +public class SubscribeDdtlCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .subscribeDdtl(new SubscribeDdtlInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/SubscribeDtclCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/SubscribeDtclCommand.java new file mode 100644 index 0000000000..4c20e60569 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/SubscribeDtclCommand.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeDtclInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "subscribe-dtcl", description = "Run a subscribe-dtcl test") +public class SubscribeDtclCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .subscribeDtcl(new SubscribeDtclInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/SubscribeYnlCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/SubscribeYnlCommand.java new file mode 100644 index 0000000000..523650ec78 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/SubscribeYnlCommand.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeYnlInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "subscribe-ynl", description = "Run a subscribe-ynl test") +public class SubscribeYnlCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "id", required = true) + String id; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .subscribeYnl(new SubscribeYnlInputBuilder().setId(id).build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterBoundConstantCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterBoundConstantCommand.java new file mode 100644 index 0000000000..76dc4d50f4 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterBoundConstantCommand.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.clustering.it.karaf.cli.InstanceIdentifierSupport; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterBoundConstantInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "unregister-bound-constant", description = "Run an unregister-bound-constant test") +public class UnregisterBoundConstantCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Reference + private InstanceIdentifierSupport iidSupport; + @Argument(index = 0, name = "context", required = true) + String context; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .unregisterBoundConstant(new UnregisterBoundConstantInputBuilder() + .setContext(iidSupport.parseArgument(context)) + .build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterConstantCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterConstantCommand.java new file mode 100644 index 0000000000..da761b3e3a --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterConstantCommand.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterConstantInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "unregister-constant", description = "Run an unregister-constant test") +public class UnregisterConstantCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .unregisterConstant(new UnregisterConstantInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterDefaultConstantCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterDefaultConstantCommand.java new file mode 100644 index 0000000000..565b72dc33 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterDefaultConstantCommand.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterDefaultConstantInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "unregister-default-constant", + description = "Run an unregister-default-constant test") +public class UnregisterDefaultConstantCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .unregisterDefaultConstant(new UnregisterDefaultConstantInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterFlappingSingletonCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterFlappingSingletonCommand.java new file mode 100644 index 0000000000..de7cc5b7c2 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterFlappingSingletonCommand.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterFlappingSingletonInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "unregister-flapping-singleton", + description = "Run an unregister-flapping-singleton test") +public class UnregisterFlappingSingletonCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .unregisterFlappingSingleton(new UnregisterFlappingSingletonInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterSingletonConstantCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterSingletonConstantCommand.java new file mode 100644 index 0000000000..7923430f06 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnregisterSingletonConstantCommand.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterSingletonConstantInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "unregister-singleton-constant", + description = "Run an unregister-singleton-constant test") +public class UnregisterSingletonConstantCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .unregisterSingletonConstant(new UnregisterSingletonConstantInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnsubscribeDdtlCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnsubscribeDdtlCommand.java new file mode 100644 index 0000000000..b44639d423 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnsubscribeDdtlCommand.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeDdtlInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "unsubscribe-ddtl", description = "Run an unsubscribe-ddtl test") +public class UnsubscribeDdtlCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .unsubscribeDdtl(new UnsubscribeDdtlInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnsubscribeDtclCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnsubscribeDtclCommand.java new file mode 100644 index 0000000000..99ab3dcce9 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnsubscribeDtclCommand.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeDtclInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "unsubscribe-dtcl", description = "Run an unsubscribe-dtcl test") +public class UnsubscribeDtclCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .unsubscribeDtcl(new UnsubscribeDtclInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnsubscribeYnlCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnsubscribeYnlCommand.java new file mode 100644 index 0000000000..e9d1104258 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/UnsubscribeYnlCommand.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeYnlInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "unsubscribe-ynl", description = "Run an unsubscribe-ynl test") +public class UnsubscribeYnlCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "id", required = true) + String id; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .unsubscribeYnl(new UnsubscribeYnlInputBuilder() + .setId(id) + .build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/WriteTransactionsCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/WriteTransactionsCommand.java new file mode 100644 index 0000000000..60288cdc19 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/odl/mdsal/lowlevel/control/WriteTransactionsCommand.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService; +import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.WriteTransactionsInputBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.Uint32; + +@Service +@Command(scope = "test-app", name = "write-transactions", description = "Run a write-transactions test") +public class WriteTransactionsCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "id", required = true) + String id; + @Argument(index = 1, name = "seconds", required = true) + long seconds; + @Argument(index = 2, name = "trasactions-per-second", required = true) + long transactionsPerSecond; + @Argument(index = 3, name = "chained-transations", required = true) + boolean chainedTransactions; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(OdlMdsalLowlevelControlService.class) + .writeTransactions(new WriteTransactionsInputBuilder() + .setId(id) + .setSeconds(Uint32.valueOf(seconds)) + .setTransactionsPerSecond(Uint32.valueOf(transactionsPerSecond)) + .setChainedTransactions(chainedTransactions) + .build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/people/AddPersonCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/people/AddPersonCommand.java new file mode 100644 index 0000000000..037b122a83 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/people/AddPersonCommand.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.people; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Argument; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.AddPersonInputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PeopleService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PersonId; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.Uint32; + +@Service +@Command(scope = "test-app", name = "add-person", description = " Run an add-person test") +public class AddPersonCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + @Argument(index = 0, name = "id", required = true) + PersonId id; + @Argument(index = 1, name = "gender", required = true) + String gender; + @Argument(index = 2, name = "age", required = true) + long age; + @Argument(index = 3, name = "address", required = true) + String address; + @Argument(index = 4, name = "contactNo", required = true) + String contactNo; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(PeopleService.class).addPerson(new AddPersonInputBuilder() + .setId(id) + .setGender(gender) + .setAge(Uint32.valueOf(age)) + .setAddress(address) + .setContactNo(contactNo) + .build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/rpc/test/BasicGlobalCommand.java b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/rpc/test/BasicGlobalCommand.java new file mode 100644 index 0000000000..fa88ed0c82 --- /dev/null +++ b/opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/rpc/test/BasicGlobalCommand.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. 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 + */ +package org.opendaylight.clustering.it.karaf.cli.rpc.test; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.karaf.shell.api.action.Command; +import org.apache.karaf.shell.api.action.lifecycle.Reference; +import org.apache.karaf.shell.api.action.lifecycle.Service; +import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction; +import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.controller.basic.rpc.test.rev160120.BasicGlobalInputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.controller.basic.rpc.test.rev160120.BasicRpcTestService; +import org.opendaylight.yangtools.yang.common.RpcResult; + +@Service +@Command(scope = "test-app", name = "global-basic", description = "Run a global-basic test") +public class BasicGlobalCommand extends AbstractRpcAction { + @Reference + private RpcConsumerRegistry rpcService; + + @Override + protected ListenableFuture> invokeRpc() { + return rpcService.getRpcService(BasicRpcTestService.class).basicGlobal(new BasicGlobalInputBuilder().build()); + } +} diff --git a/opendaylight/md-sal/samples/clustering-test-app/pom.xml b/opendaylight/md-sal/samples/clustering-test-app/pom.xml index f57c119a77..2c26261607 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/pom.xml +++ b/opendaylight/md-sal/samples/clustering-test-app/pom.xml @@ -20,6 +20,7 @@ configuration + karaf-cli model provider