-
Notifications
You must be signed in to change notification settings - Fork 7
Remote Diagnostics API #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0658e24
bbe380d
836bcb1
67669db
95e8e57
17dc1e1
8cf67d3
c9d4458
259a459
cd5e623
bf01218
448fb44
1e60bdc
9b9cb89
72f7023
05483de
1df8855
1ff1298
6a09386
0c45874
289a4ed
e3f2bef
7645c07
9801b9f
149f422
97e560d
50d152f
93a3cfb
5571123
6a11767
2ddb21b
11a818b
2f5767c
80058c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,6 @@ | |
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
|
|
||
| import subprocess | ||
| import shlex | ||
| import sys | ||
|
|
@@ -27,8 +26,7 @@ class Result(object): | |
| # Execute shell command | ||
| def run_cmd(command): | ||
| result = Result() | ||
| final_cmd = shlex.split(command) | ||
| p = subprocess.Popen(final_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
| p = subprocess.Popen(shlex.split(command), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
| (stdout, stderr) = p.communicate() | ||
|
|
||
| result.exit_code = p.returncode | ||
|
|
@@ -39,7 +37,7 @@ def run_cmd(command): | |
| if p.returncode != 0 and result.stderr is not "": | ||
| print('Error executing command [%s]' % command) | ||
| print('stderr: [%s]' % stderr) | ||
| sys.exit(1) | ||
| sys.exit(result.exit_code) | ||
|
|
||
| print('stdout: [%s]' % result.stdout) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's discuss the way to export stdout/stderr and parse them from VR resource. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. STDOUT, STDERR, EXITCODE -> use that to parse/split the details -> output -> create and set them in the answer class/object.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved |
||
| print('return code: %s' % result.exit_code) | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| """ BVT tests for remote diagnostics of system VMs | ||
| """ | ||
| # Import Local Modules | ||
| from marvin.codes import FAILED | ||
| from marvin.cloudstackTestCase import cloudstackTestCase | ||
| from marvin.cloudstackAPI import remoteDiganostics | ||
| from marvin.lib.utils import (cleanup_resources) | ||
|
|
@@ -102,8 +103,11 @@ def setUp(self): | |
|
|
||
| def tearDown(self): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You probably want to remove self.cleanup. Also add newline after
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved |
||
| pass | ||
|
|
||
| @attr(tags=["advanced", "advancedns", "ssh", "smoke"], required_hardware="true") | ||
| def test_01_ping_in_system_vm(self): | ||
|
|
||
| # Test with VR | ||
| list_router_response = list_routers( | ||
| self.apiclient | ||
| ) | ||
|
|
@@ -117,16 +121,64 @@ def test_01_ping_in_system_vm(self): | |
|
|
||
| cmd = remoteDiganostics.remoteDiganosticsCmd() | ||
| cmd.id = router.id | ||
| cmd.ipaddress = "dkdlglglsmndhjfgke;" | ||
| cmd.ipaddress = "8.8.8.8;" | ||
| cmd.type = "ping" | ||
| cmd_response = self.apiclient.remoteDiganostics(cmd); | ||
|
|
||
| self.assertEqual(True, | ||
| cmd_response.success, | ||
| msg="Ping command not executed successfully") | ||
| msg="Failed to exeute remote Ping command in VR" | ||
| ) | ||
|
|
||
| # Test with SSVM | ||
| list_ssvm_response = list_ssvms( | ||
| self.apiclient, | ||
| systemvmtype='secondarystoragevm', | ||
| state='Running', | ||
| ) | ||
|
|
||
| self.assertEqual( | ||
| isinstance(list_ssvm_response, list), | ||
| True, | ||
| "Check list response returns a valid list" | ||
| ) | ||
| ssvm = list_ssvm_response[0] | ||
|
|
||
| self.debug("Setting up SSVM with ID %s" %ssvm.id) | ||
| cmd.id = ssvm.id | ||
| ssvm_response = self.apiclient.remoteDiganostics(cmd) | ||
|
|
||
| self.assertEqual(True, | ||
| ssvm_response.success, | ||
| msg="Failed to execute remote Ping in SSVM" | ||
| ) | ||
|
|
||
| # Test with CPVM | ||
| list_cpvm_response = list_ssvms( | ||
| self.apiclient, | ||
| systemvmtype='consoleproxy', | ||
| state='Running', | ||
| ) | ||
| self.assertEqual( | ||
| isinstance(list_cpvm_response, list), | ||
| True, | ||
| "Check list response returns a valid list" | ||
| ) | ||
| cpvm = list_cpvm_response[0] | ||
|
|
||
| self.debug("Setting up CPVM with ID %s" %cpvm.id) | ||
| cmd.id = cpvm.id | ||
| cpvm_response = self.apiclient.remoteDiganostics(cmd) | ||
|
|
||
| self.assertEqual(True, | ||
| cpvm_response.success, | ||
| msg="Failed to execute remote Ping in CPVM" | ||
| ) | ||
|
|
||
| @attr(tags=["advanced", "advancedns", "ssh", "smoke"], required_hardware="true") | ||
| def test_02_traceroute_in_system_vm(self): | ||
|
|
||
| # Test with VR | ||
| list_router_response = list_routers( | ||
| self.apiclient | ||
| ) | ||
|
|
@@ -140,34 +192,56 @@ def test_02_traceroute_in_system_vm(self): | |
|
|
||
| cmd = remoteDiganostics.remoteDiganosticsCmd() | ||
| cmd.id = router.id | ||
| cmd.ipaddress = "dkdlglglsmndhjfgke;" | ||
| cmd.type = "ping" | ||
| cmd.ipaddress = "8.8.8.8;" | ||
| cmd.type = "traceroute" | ||
| cmd_response = self.apiclient.remoteDiganostics(cmd); | ||
|
|
||
| self.assertEqual(True, | ||
| cmd_response.success, | ||
| msg="Ping command not executed successfully") | ||
|
|
||
| @attr(tags=["advanced", "advancedns", "ssh", "smoke"], required_hardware="true") | ||
| def test_03_arping_in_system_vm(self): | ||
| list_router_response = list_routers( | ||
| self.apiclient | ||
| msg="Failed to exeute remote Traceroute command in VR" | ||
| ) | ||
|
|
||
| # Test with SSVM | ||
| list_ssvm_response = list_ssvms( | ||
| self.apiclient, | ||
| systemvmtype='secondarystoragevm', | ||
| state='Running', | ||
| ) | ||
|
|
||
| self.assertEqual( | ||
| isinstance(list_router_response, list), | ||
| isinstance(list_ssvm_response, list), | ||
| True, | ||
| "Check list response returns a valid list" | ||
| ) | ||
| router = list_router_response[0] | ||
| self.debug("Starting the router with ID: %s" %router.id) | ||
| ssvm = list_ssvm_response[0] | ||
|
|
||
| cmd = remoteDiganostics.remoteDiganosticsCmd() | ||
| cmd.id = router.id | ||
| cmd.ipaddress = "dkdlglglsmndhjfgke;" | ||
| cmd.type = "ping" | ||
| cmd_response = self.apiclient.remoteDiganostics(cmd); | ||
| self.debug("Setting up SSVM with ID %s" %ssvm.id) | ||
| cmd.id = ssvm.id | ||
| ssvm_response = self.apiclient.remoteDiganostics(cmd) | ||
|
|
||
| self.assertEqual(True, | ||
| cmd_response.success, | ||
| msg="Ping command not executed successfully") | ||
| ssvm_response.success, | ||
| msg="Failed to execute remote Traceroute in SSVM" | ||
| ) | ||
|
|
||
| # Test with CPVM | ||
| list_cpvm_response = list_ssvms( | ||
| self.apiclient, | ||
| systemvmtype='consoleproxy', | ||
| state='Running', | ||
| ) | ||
| self.assertEqual( | ||
| isinstance(list_cpvm_response, list), | ||
| True, | ||
| "Check list response returns a valid list" | ||
| ) | ||
| cpvm = list_cpvm_response[0] | ||
|
|
||
| self.debug("Setting up CPVM with ID %s" %cpvm.id) | ||
| cmd.id = cpvm.id | ||
| cpvm_response = self.apiclient.remoteDiganostics(cmd) | ||
|
|
||
| self.assertEqual(True, | ||
| cpvm_response.success, | ||
| msg="Failed to execute remote Traceroute in CPVM" | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep one of the two, but not both the shell script and python script. Probably simplify filename to say
diagnostics.py.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved