2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore.admin.command;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.apache.karaf.shell.api.action.Argument;
12 import org.apache.karaf.shell.api.action.Command;
13 import org.apache.karaf.shell.api.action.lifecycle.Reference;
14 import org.apache.karaf.shell.api.action.lifecycle.Service;
15 import org.opendaylight.mdsal.binding.api.RpcService;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.BackupDatastore;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.BackupDatastoreInputBuilder;
18 import org.opendaylight.yangtools.yang.common.RpcResult;
19 import org.opendaylight.yangtools.yang.common.Uint32;
22 @Command(scope = "cluster-admin", name = "backup-datastore", description = "Run a backup-datastore test")
23 public class BackupDatastoreCommand extends AbstractRpcAction {
25 private RpcService rpcService;
26 @Argument(index = 0, name = "file-path", required = true)
27 private String filePath;
28 @Argument(index = 1, name = "timeout", required = true)
32 protected ListenableFuture<? extends RpcResult<?>> invokeRpc() {
33 return rpcService.getRpc(BackupDatastore.class)
34 .invoke(new BackupDatastoreInputBuilder()
35 .setFilePath(filePath)
36 .setTimeout(Uint32.valueOf(timeout))