cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anim...@apache.org
Subject [01/50] git commit: updated refs/heads/4.2 to 86c9363
Date Thu, 03 Oct 2013 06:05:59 GMT
Updated Branches:
  refs/heads/4.2 78517ee5c -> 86c93637f


CLOUDSTACK-4637: Add 30sec sleep before router is ssh'd

Egress rules testcases access vm via router. Sleep before
accessing router else the expect fails since router is not
accessible. Also use router.hostid instead of vm.hostid
to identify the host.

Signed-off-by: venkataswamybabu budumuru <venkataswamybabu.budumuru@citrix.com>


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

Branch: refs/heads/4.2
Commit: 7d06e77ed9bfacf6d3b74f396c705567d4bf8ba2
Parents: a9218f3
Author: Girish Shilamkar <girish@clogeny.com>
Authored: Fri Sep 13 20:43:45 2013 -0400
Committer: venkataswamybabu budumuru <venkataswamybabu.budumuru@citrix.com>
Committed: Wed Sep 18 21:40:39 2013 +0530

----------------------------------------------------------------------
 .../component/test_egress_fw_rules.py           | 38 +++++++++++---------
 1 file changed, 21 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d06e77e/test/integration/component/test_egress_fw_rules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_egress_fw_rules.py b/test/integration/component/test_egress_fw_rules.py
index ef0fc5a..5c18f9c 100644
--- a/test/integration/component/test_egress_fw_rules.py
+++ b/test/integration/component/test_egress_fw_rules.py
@@ -18,7 +18,7 @@
 """
 """
 #Import Local Modules
-#import unittest
+import unittest
 from nose.plugins.attrib           import attr
 from marvin.cloudstackTestCase     import cloudstackTestCase
 from marvin.integration.lib.base   import (Account,
@@ -198,7 +198,6 @@ class TestEgressFWRules(cloudstackTestCase):
         # Enable Network offering
         self.network_offering.update(self.apiclient, state='Enabled')
 
-
     def create_vm(self, pfrule=False, egress_policy=True, RR=False):
         self.create_network_offering(egress_policy, RR)
          # Creating network using the network offering created
@@ -229,30 +228,37 @@ class TestEgressFWRules(cloudstackTestCase):
 
     def exec_script_on_user_vm(self, script, exec_cmd_params, expected_result, negative_test=False):
         try:
+
+            vm_network_id = self.virtual_machine.nic[0].networkid
+            vm_ipaddress  = self.virtual_machine.nic[0].ipaddress
+            list_routers_response = list_routers(self.apiclient,
+                                                 account=self.account.name,
+                                                 domainid=self.account.domainid,
+                                                 networkid=vm_network_id)
+            self.assertEqual(isinstance(list_routers_response, list),
+                             True,
+                             "Check for list routers response return valid data")
+            router = list_routers_response[0]
+
+            #Once host or mgt server is reached, SSH to the router connected to VM
+            # look for Router for Cloudstack VM network.
             if self.apiclient.hypervisor.lower() == 'vmware':
                 #SSH is done via management server for Vmware
                 sourceip = self.apiclient.connection.mgtSvr
             else:
                 #For others, we will have to get the ipaddress of host connected to vm
                 hosts = list_hosts(self.apiclient,
-                                   id=self.virtual_machine.hostid)
+                                   id=router.hostid)
                 self.assertEqual(isinstance(hosts, list),
                                  True,
                                  "Check list response returns a valid list")
                 host = hosts[0]
                 sourceip = host.ipaddress
-            #Once host or mgt server is reached, SSH to the router connected to VM
-            # look for Router for Cloudstack VM network.
-            vm_network_id = self.virtual_machine.nic[0].networkid
-            vm_ipaddress  = self.virtual_machine.nic[0].ipaddress
-            list_routers_response = list_routers(self.apiclient,
-                                                 account=self.account.name,
-                                                 domainid=self.account.domainid,
-                                                 networkid=vm_network_id)
-            self.assertEqual(isinstance(list_routers_response, list),
-                             True,
-                             "Check for list routers response return valid data")
-            router = list_routers_response[0]
+
+            self.debug("Sleep %s seconds for network on router to be up"
+                        % self.services['sleep'])
+            time.sleep(self.services['sleep'])
+
             if self.apiclient.hypervisor.lower() == 'vmware':
                 key_file = " -i /var/cloudstack/management/.ssh/id_rsa "
             else:
@@ -266,7 +272,6 @@ class TestEgressFWRules(cloudstackTestCase):
                           "expect \"root@%s's password: \"\n"  % (vm_ipaddress) + \
                           "send \"password\r\"\n" + \
                           "interact\n"
-
             self.debug("expect_script>>\n%s<<expect_script" % expect_script)
 
             script_file = '/tmp/expect_script.exp'
@@ -392,7 +397,6 @@ class TestEgressFWRules(cloudstackTestCase):
                                     "['0']",
                                     negative_test=False)
 
-
     @attr(tags = ["advanced"])
     @log_test_exceptions
     def test_01_1_egress_fr1(self):


Mime
View raw message