cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tall...@apache.org
Subject git commit: updated refs/heads/master to a3d08ae
Date Mon, 10 Nov 2014 11:40:37 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master fa8f0a43c -> a3d08aebb


CLOUDSTACK-7856: test_vpc_network_pf_rules.py - Check if httpd service is running or not,
if not, start it

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a3d08aeb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a3d08aeb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a3d08aeb

Branch: refs/heads/master
Commit: a3d08aebb70bff102cb898d8c979f14cecc275cd
Parents: fa8f0a4
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Thu Nov 6 18:23:08 2014 +0530
Committer: SrikanteswaraRao Talluri <talluri@apache.org>
Committed: Mon Nov 10 17:10:11 2014 +0530

----------------------------------------------------------------------
 .../component/test_vpc_network_pfrules.py       | 51 ++++++++++++++------
 1 file changed, 36 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3d08aeb/test/integration/component/test_vpc_network_pfrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_pfrules.py b/test/integration/component/test_vpc_network_pfrules.py
index c3a8161..e49642b 100644
--- a/test/integration/component/test_vpc_network_pfrules.py
+++ b/test/integration/component/test_vpc_network_pfrules.py
@@ -18,7 +18,7 @@
 """ Component tests for VPC network functionality - Port Forwarding Rules.
 """
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin.lib.base import (stopRouter,
                                          startRouter,
                                          Account,
@@ -327,20 +327,31 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
                 else:
                     self.debug("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
 
-    def check_wget_from_vm(self, vm, public_ip, testnegative=False):
+    def check_wget_from_vm(self, vm, public_ip, network=None, testnegative=False, isVmAccessible=True):
         import urllib
         self.debug("Checking if we can wget from a VM=%s http server on public_ip=%s"  %
(vm.name, public_ip.ipaddress.ipaddress))
         try:
+                if not isVmAccessible:
+                    self.create_natrule(vm, public_ip, network)
+                # Start httpd service on VM first
+                sshClient = vm.get_ssh_client()
+                sshClient.execute("service httpd start")
+                time.sleep(5)
+                ssh_response = str(sshClient.execute("service httpd status")).lower()
+                self.debug("httpd service status is: %s" % ssh_response)
+                if not "running" in ssh_response:
+                    raise Exception("Failed to start httpd service")
+
                 urllib.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress,
filename="test.html")
                 if not testnegative:
                     self.debug("Successesfull to wget from VM=%s http server on public_ip=%s"
% (vm.name, public_ip.ipaddress.ipaddress))
                 else:
                     self.fail("Successesfull to wget from VM=%s http server on public_ip=%s"
% (vm.name, public_ip.ipaddress.ipaddress))
-        except:
+        except Exception as e:
                 if not testnegative:
-                    self.fail("Failed to wget from VM=%s http server on public_ip=%s" % (vm.name,
public_ip.ipaddress.ipaddress))
+                    self.fail("Failed to wget from VM=%s http server on public_ip=%s: %s"
% (vm.name, public_ip.ipaddress.ipaddress, e))
                 else:
-                    self.debug("Failed to wget from VM=%s http server on public_ip=%s" %
(vm.name, public_ip.ipaddress.ipaddress))
+                    self.debug("Failed to wget from VM=%s http server on public_ip=%s: %s"
% (vm.name, public_ip.ipaddress.ipaddress, e))
 
     def create_natrule(self, vm, public_ip, network, services=None):
         self.debug("Creating NAT rule in network for vm with public IP")
@@ -687,7 +698,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         nat_rule.delete(self.apiclient)
         self.start_vpcrouter(router)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -717,7 +729,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         http_rule.delete(self.apiclient)
         nat_rule.delete(self.apiclient)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -781,10 +794,14 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
         self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
         self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True)
-        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True)
-        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True,
+                isVmAccessible=False, network=network_2)
+        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True,
+                isVmAccessible=False, network=network_2)
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -843,8 +860,12 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
         self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
         self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True)
-        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True)
-        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True,
+                isVmAccessible=False, network=network_2)
+        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True,
+                isVmAccessible=False, network=network_2)
         return


Mime
View raw message