Add testcase for Vswitch Hosting Subnet Route Restart
[integration/test.git] / tools / clustering / cluster-deployer / restart.py
1 #!/usr/bin/env python
2 #
3 # This script restarts the cluster nodes. It can optionally cleanup the persistent data.
4 # --------------------------------------------------------------------------------------
5 #
6 # This script takes a list of hosts as parameter
7 #
8 #
9 # -------------------------------------------------------------------------------------------------------------
10
11 import argparse
12 from remote_host import RemoteHost
13
14 parser = argparse.ArgumentParser(description='Cluster Restart')
15 parser.add_argument("--rootdir", default="/root",
16                     help="the root directory on the remote host where the distribution is deployed", required=True)
17 parser.add_argument("--hosts", default="",
18                     help="a comma separated list of host names or ip addresses", required=True)
19 parser.add_argument("--clean", action="store_true", default=False,
20                     help="clean the persistent data for the current deployment")
21 parser.add_argument("--user", default="root", help="the SSH username for the remote host(s)")
22 parser.add_argument("--password", default="Ecp123", help="the SSH password for the remote host(s)")
23 args = parser.parse_args()
24
25
26 def main():
27     hosts = args.hosts.split(",")
28     for x in range(0, len(hosts)):
29         # Connect to the remote host and start doing operations
30         remote = RemoteHost(hosts[x], args.user, args.password, args.rootdir)
31         remote.kill_controller()
32         if(args.clean):
33             remote.exec_cmd("rm -rf " + args.rootdir + "/deploy/current/odl/journal")
34             remote.exec_cmd("rm -rf " + args.rootdir + "/deploy/current/odl/snapshots")
35         remote.start_controller(args.rootdir + "/deploy/current")
36
37
38 main()

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.