You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/10/09 01:49:24 UTC

[01/12] git commit: updated refs/heads/master to ca9e934

Repository: cloudstack
Updated Branches:
  refs/heads/master 99059e221 -> ca9e934e9


CLOUDSTACK-8915 - Add the default route only on address that have not been configured yet.

   - In case of rVPC we experienced the wrong route being added to the VPC tiers


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

Branch: refs/heads/master
Commit: c17fb0ff2829b3db4826954970427916df633434
Parents: 99059e2
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Mon Sep 28 13:15:54 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 6 16:41:12 2015 +0200

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cs/CsAddress.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c17fb0ff/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index e3fa1bc..3e8fbca 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -142,16 +142,16 @@ class CsAddress(CsDataBag):
                         "Address %s on device %s not configured", ip.ip(), dev)
                     if CsDevice(dev, self.config).waitfordevice():
                         ip.configure()
-
-                route.add_route(dev, network)
-
-                # The code looks redundant here, but we actually have to cater for routers and
-                # VPC routers in a different manner. Please do not remove this block otherwise
-                # The VPC default route will be broken.
-                if address["nw_type"] == "public" and not found_defaultroute:
-                    if not route.defaultroute_exists():
-                        if route.add_defaultroute(gateway):
-                            found_defaultroute = True
+                        
+                        route.add_route(dev, network)
+
+                        # The code looks redundant here, but we actually have to cater for routers and
+                        # VPC routers in a different manner. Please do not remove this block otherwise
+                        # The VPC default route will be broken.
+                        if address["nw_type"] == "public" and not found_defaultroute:
+                            if not route.defaultroute_exists():
+                                if route.add_defaultroute(gateway):
+                                    found_defaultroute = True
 
         # once we start processing public ip's we need to verify there
         # is a default route and add if needed


[05/12] git commit: updated refs/heads/master to ca9e934

Posted by re...@apache.org.
CLOUDSTACK-8915 - Improve routers tests

   - Add egress tests in order to check if VMs can reach the outside world
   - Increase the wait when testing redundant routers: they fight to become master
   - Make sure the clean up is done properly


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

Branch: refs/heads/master
Commit: 7c7c0149b25435548118c1ddbb3895866fb161ad
Parents: 260ff83
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Wed Sep 30 10:29:46 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 6 16:41:14 2015 +0200

----------------------------------------------------------------------
 .../integration/component/test_vpc_redundant.py | 64 +++++++++++++++-----
 .../component/test_vpc_router_nics.py           | 56 +++++++++++++++--
 2 files changed, 100 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c7c0149/test/integration/component/test_vpc_redundant.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_redundant.py b/test/integration/component/test_vpc_redundant.py
index 149baf7..04670c3 100644
--- a/test/integration/component/test_vpc_redundant.py
+++ b/test/integration/component/test_vpc_redundant.py
@@ -236,7 +236,7 @@ class TestVPCRedundancy(cloudstackTestCase):
             admin=True,
             domainid=self.domain.id)
 
-        self.cleanup = [self.account]
+        self._cleanup = [self.account]
         self.debug("Creating a VPC offering..")
         self.vpc_off = VpcOffering.create(
             self.apiclient,
@@ -256,13 +256,6 @@ class TestVPCRedundancy(cloudstackTestCase):
             domainid=self.account.domainid)
         return
 
-    def tearDown(self):
-        try:
-            cleanup_resources(self.apiclient, self.cleanup)
-        except Exception as e:
-            self.debug("Warning: Exception during cleanup : %s" % e)
-        return
-
     def query_routers(self, count=2, showall=False):
         self.routers = list_routers(self.apiclient,
                                     account=self.account.name,
@@ -318,7 +311,6 @@ class TestVPCRedundancy(cloudstackTestCase):
                 conservemode=False)
 
             nw_off.update(self.apiclient, state='Enabled')
-            self._cleanup.append(nw_off)
             self.debug('Created and Enabled NetworkOffering')
 
             self.services["network"]["name"] = "NETWORK-" + str(gateway)
@@ -333,6 +325,7 @@ class TestVPCRedundancy(cloudstackTestCase):
                 gateway=gateway,
                 vpcid=vpc.id if vpc else self.vpc.id
             )
+
             self.debug("Created network with ID: %s" % obj_network.id)
         except Exception, e:
             self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
@@ -419,16 +412,16 @@ class TestVPCRedundancy(cloudstackTestCase):
                 self.fail("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
-    def test_01a_create_redundant_VPC(self):
-        """ Create a redundant vpc with two networks with two vms in each network """
-        self.debug("Starting est 1a")
+    def test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL(self):
+        """ Create a redundant VPC with two networks with two VMs in each network """
+        self.debug("Starting test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL")
         self.query_routers()
         self.networks.append(self.create_network(self.services["network_offering"], "10.1.1.1"))
         self.networks.append(self.create_network(self.services["network_offering_no_lb"], "10.1.2.1"))
+        time.sleep(30)
         self.check_master_status(2)
         self.add_nat_rules()
         self.do_vpc_test(False)
-        time.sleep(15)
 
         self.stop_router("MASTER")
         # wait for the backup router to transit to master state
@@ -437,15 +430,29 @@ class TestVPCRedundancy(cloudstackTestCase):
         self.do_vpc_test(False)
 
         self.delete_nat_rules()
+        time.sleep(45)
         self.check_master_status(1)
         self.do_vpc_test(True)
 
         self.start_router()
         self.add_nat_rules()
-        time.sleep(15)
+        time.sleep(45)
         self.check_master_status(2)
         self.do_vpc_test(False)
 
+    @attr(tags=["advanced", "intervlan"], required_hardware="true")
+    def test_02_redundant_VPC_default_routes(self):
+        """ Create a redundant VPC with two networks with two VMs in each network and check default routes"""
+        self.debug("Starting test_02_redundant_VPC_default_routes")
+        self.query_routers()
+        self.networks.append(self.create_network(self.services["network_offering"], "10.1.1.1"))
+        self.networks.append(self.create_network(self.services["network_offering_no_lb"], "10.1.2.1"))
+        time.sleep(30)
+        self.check_master_status(2)
+        self.add_nat_rules()
+        self.test_default_routes()
+
+
     def delete_nat_rules(self):
         for o in self.networks:
             for vm in o.get_vms():
@@ -470,6 +477,35 @@ class TestVPCRedundancy(cloudstackTestCase):
             for vm in o.get_vms():
                 self.check_ssh_into_vm(vm.get_vm(), vm.get_ip(), expectFail=expectFail, retries=retries)
 
+    def test_default_routes(self):
+        for o in self.networks:
+            for vmObj in o.get_vms():
+                ssh_command = "ping -c 3 8.8.8.8"
+
+                # Should be able to SSH VM
+                result = 'failed'
+                try:
+                    vm = vmObj.get_vm()
+                    public_ip = vmObj.get_ip()
+                    self.debug("SSH into VM: %s" % public_ip.ipaddress.ipaddress)
+                    
+                    ssh = vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
+        
+                    self.debug("Ping to google.com from VM")
+                    result = ssh.execute(ssh_command)
+
+                    self.debug("SSH result: %s" % str(result))
+                except Exception as e:
+                    self.fail("SSH Access failed for %s: %s" % \
+                              (vmObj.get_ip(), e)
+                              )
+        
+                self.assertEqual(
+                                 result.count("0% packet loss"),
+                                 1,
+                                 "Ping to outside world from VM should be successful"
+                                 )
+
 
 class networkO(object):
     def __init__(self, net):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c7c0149/test/integration/component/test_vpc_router_nics.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_router_nics.py b/test/integration/component/test_vpc_router_nics.py
index 4cabd16..ce5a622 100644
--- a/test/integration/component/test_vpc_router_nics.py
+++ b/test/integration/component/test_vpc_router_nics.py
@@ -279,7 +279,6 @@ class TestVPCNics(cloudstackTestCase):
                 conservemode=False)
 
             nw_off.update(self.apiclient, state='Enabled')
-            self._cleanup.append(nw_off)
             self.debug('Created and Enabled NetworkOffering')
 
             self.services["network"]["name"] = "NETWORK-" + str(gateway)
@@ -294,6 +293,7 @@ class TestVPCNics(cloudstackTestCase):
                 gateway=gateway,
                 vpcid=vpc.id if vpc else self.vpc.id
             )
+            
             self.debug("Created network with ID: %s" % obj_network.id)
         except Exception, e:
             self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
@@ -369,8 +369,8 @@ class TestVPCNics(cloudstackTestCase):
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_01_VPC_nics_after_destroy(self):
-        """ Create a vpc with two networks with two vms in each network """
-        self.debug("Starting test 1")
+        """ Create a VPC with two networks with one VM in each network and test nics after destroy"""
+        self.debug("Starting test_01_VPC_nics_after_destroy")
         self.query_routers()
 
         net1 = self.create_network(self.services["network_offering"], "10.1.1.1")
@@ -380,7 +380,7 @@ class TestVPCNics(cloudstackTestCase):
         self.networks.append(net2)
 
         self.add_nat_rules()
-        self.do_vpc_test()
+        self.test_ssh_to_vm()
 
         self.stop_router()
         self.destroy_router()
@@ -388,7 +388,22 @@ class TestVPCNics(cloudstackTestCase):
 
         net1.add_vm(self.deployvm_in_network(net1.get_net()))
         self.add_nat_rules()
-        self.do_vpc_test()
+        self.test_ssh_to_vm()
+
+    @attr(tags=["advanced", "intervlan"], required_hardware="true")
+    def test_02_VPC_default_routes(self):
+        """ Create a VPC with two networks with one VM in each network and test default routes"""
+        self.debug("Starting test_02_VPC_default_routes")
+        self.query_routers()
+
+        net1 = self.create_network(self.services["network_offering"], "10.1.1.1")
+        net2 = self.create_network(self.services["network_offering_no_lb"], "10.1.2.1")
+
+        self.networks.append(net1)
+        self.networks.append(net2)
+
+        self.add_nat_rules()
+        self.test_default_routes()
 
     def delete_nat_rules(self):
         for o in self.networks:
@@ -406,11 +421,40 @@ class TestVPCNics(cloudstackTestCase):
                     vm.set_nat(self.create_natrule(vm.get_vm(), vm.get_ip(), o.get_net()))
                     time.sleep(5)
 
-    def do_vpc_test(self):
+    def test_ssh_to_vm(self):
         for o in self.networks:
             for vm in o.get_vms():
                 self.check_ssh_into_vm(vm.get_vm(), vm.get_ip())
 
+    def test_default_routes(self):
+        for o in self.networks:
+            for vmObj in o.get_vms():
+                ssh_command = "ping -c 3 8.8.8.8"
+
+                # Should be able to SSH VM
+                result = 'failed'
+                try:
+                    vm = vmObj.get_vm()
+                    public_ip = vmObj.get_ip()
+                    self.debug("SSH into VM: %s" % public_ip.ipaddress.ipaddress)
+                    
+                    ssh = vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
+        
+                    self.debug("Ping to google.com from VM")
+                    result = ssh.execute(ssh_command)
+
+                    self.debug("SSH result: %s" % str(result))
+                except Exception as e:
+                    self.fail("SSH Access failed for %s: %s" % \
+                              (vmObj.get_ip(), e)
+                              )
+        
+                self.assertEqual(
+                                 result.count("0% packet loss"),
+                                 1,
+                                 "Ping to outside world from VM should be successful"
+                                 )
+
 
 class networkO(object):
     def __init__(self, net):


[06/12] git commit: updated refs/heads/master to ca9e934

Posted by re...@apache.org.
CLOUDSTACK-8915 - Adding logging to tests


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

Branch: refs/heads/master
Commit: 5f79916eeaa6b0c8ecbd3fc938b4528f8f30e46c
Parents: 7c7c014
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Thu Oct 1 10:46:54 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 6 16:41:14 2015 +0200

----------------------------------------------------------------------
 .../component/test_routers_network_ops.py       | 12 ++--
 .../integration/component/test_vpc_redundant.py | 62 +++++++++++---------
 .../component/test_vpc_router_nics.py           | 58 ++++++++++--------
 3 files changed, 72 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f79916e/test/integration/component/test_routers_network_ops.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_routers_network_ops.py b/test/integration/component/test_routers_network_ops.py
index b00e27a..2b170fa 100644
--- a/test/integration/component/test_routers_network_ops.py
+++ b/test/integration/component/test_routers_network_ops.py
@@ -52,7 +52,7 @@ class TestCreatePFOnStoppedRouter(cloudstackTestCase):
     @classmethod
     def setUpClass(cls):
 
-        cls.testClient = super(TestRouterStopCreatePF, cls).getClsTestClient()
+        cls.testClient = super(TestCreatePFOnStoppedRouter, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
 
         cls.services = cls.testClient.getParsedTestDataConfig()
@@ -96,7 +96,7 @@ class TestCreatePFOnStoppedRouter(cloudstackTestCase):
     def tearDownClass(cls):
         try:
             cls.api_client = super(
-                TestRouterStopCreatePF,
+                TestCreatePFOnStoppedRouter,
                 cls).getClsTestClient().getApiClient()
             # Clean up, terminate the created resources
             cleanup_resources(cls.api_client, cls._cleanup)
@@ -258,7 +258,7 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
     @classmethod
     def setUpClass(cls):
 
-        cls.testClient = super(TestRouterStopCreateLB, cls).getClsTestClient()
+        cls.testClient = super(TestCreateLBOnStoppedRouter, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
 
         cls.services = cls.testClient.getParsedTestDataConfig()
@@ -302,7 +302,7 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
     def tearDownClass(cls):
         try:
             cls.api_client = super(
-                TestRouterStopCreateLB,
+                TestCreateLBOnStoppedRouter,
                 cls).getClsTestClient().getApiClient()
             # Clean up, terminate the created resources
             cleanup_resources(cls.api_client, cls._cleanup)
@@ -467,7 +467,7 @@ class TestCreateFWOnStoppedRouter(cloudstackTestCase):
     @classmethod
     def setUpClass(cls):
 
-        cls.testClient = super(TestRouterStopCreateFW, cls).getClsTestClient()
+        cls.testClient = super(TestCreateFWOnStoppedRouter, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
 
         cls.services = cls.testClient.getParsedTestDataConfig()
@@ -510,7 +510,7 @@ class TestCreateFWOnStoppedRouter(cloudstackTestCase):
     def tearDownClass(cls):
         try:
             cls.api_client = super(
-                TestRouterStopCreateFW,
+                TestCreateFWOnStoppedRouter,
                 cls).getClsTestClient().getApiClient()
             # Clean up, terminate the created templates
             cleanup_resources(cls.api_client, cls._cleanup)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f79916e/test/integration/component/test_vpc_redundant.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_redundant.py b/test/integration/component/test_vpc_redundant.py
index 04670c3..84a7cd3 100644
--- a/test/integration/component/test_vpc_redundant.py
+++ b/test/integration/component/test_vpc_redundant.py
@@ -41,7 +41,7 @@ from marvin.lib.utils import cleanup_resources
 import socket
 import time
 import inspect
-
+import logging
 
 class Services:
     """Test VPC network services - Port Forwarding Rules Test Data Class.
@@ -215,6 +215,12 @@ class TestVPCRedundancy(cloudstackTestCase):
             cls.api_client,
             cls.services["service_offering"])
         cls._cleanup = [cls.service_offering]
+
+        cls.logger = logging.getLogger('TestVPCRedundancy')
+        cls.stream_handler = logging.StreamHandler()
+        cls.logger.setLevel(logging.DEBUG)
+        cls.logger.addHandler(cls.stream_handler)
+
         return
 
     @classmethod
@@ -237,15 +243,15 @@ class TestVPCRedundancy(cloudstackTestCase):
             domainid=self.domain.id)
 
         self._cleanup = [self.account]
-        self.debug("Creating a VPC offering..")
+        self.logger.debug("Creating a VPC offering..")
         self.vpc_off = VpcOffering.create(
             self.apiclient,
             self.services["vpc_offering"])
 
-        self.debug("Enabling the VPC offering created")
+        self.logger.debug("Enabling the VPC offering created")
         self.vpc_off.update(self.apiclient, state='Enabled')
 
-        self.debug("Creating a VPC network in the account: %s" % self.account.name)
+        self.logger.debug("Creating a VPC network in the account: %s" % self.account.name)
         self.services["vpc"]["cidr"] = '10.1.1.1/16'
         self.vpc = VPC.create(
             self.apiclient,
@@ -283,7 +289,7 @@ class TestVPCRedundancy(cloudstackTestCase):
 
     def stop_router(self, type):
         self.check_master_status(2)
-        self.debug('Stopping %s router' % type)
+        self.logger.debug('Stopping %s router' % type)
         for router in self.routers:
             if router.redundantstate == type:
                 cmd = stopRouter.stopRouterCmd()
@@ -292,18 +298,18 @@ class TestVPCRedundancy(cloudstackTestCase):
 
     def start_router(self):
         self.check_master_status(2, showall=True)
-        self.debug('Starting stopped routers')
+        self.logger.debug('Starting stopped routers')
         for router in self.routers:
-            self.debug('Router %s has state %s' % (router.id, router.state))
+            self.logger.debug('Router %s has state %s' % (router.id, router.state))
             if router.state == "Stopped":
-                self.debug('Starting stopped router %s' % router.id)
+                self.logger.debug('Starting stopped router %s' % router.id)
                 cmd = startRouter.startRouterCmd()
                 cmd.id = router.id
                 self.apiclient.startRouter(cmd)
 
     def create_network(self, net_offerring, gateway='10.1.1.1', vpc=None):
         try:
-            self.debug('Create NetworkOffering')
+            self.logger.debug('Create NetworkOffering')
             net_offerring["name"] = "NET_OFF-" + str(gateway)
             nw_off = NetworkOffering.create(
                 self.apiclient,
@@ -311,10 +317,10 @@ class TestVPCRedundancy(cloudstackTestCase):
                 conservemode=False)
 
             nw_off.update(self.apiclient, state='Enabled')
-            self.debug('Created and Enabled NetworkOffering')
+            self.logger.debug('Created and Enabled NetworkOffering')
 
             self.services["network"]["name"] = "NETWORK-" + str(gateway)
-            self.debug('Adding Network=%s' % self.services["network"])
+            self.logger.debug('Adding Network=%s' % self.services["network"])
             obj_network = Network.create(
                 self.apiclient,
                 self.services["network"],
@@ -326,7 +332,7 @@ class TestVPCRedundancy(cloudstackTestCase):
                 vpcid=vpc.id if vpc else self.vpc.id
             )
 
-            self.debug("Created network with ID: %s" % obj_network.id)
+            self.logger.debug("Created network with ID: %s" % obj_network.id)
         except Exception, e:
             self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
         o = networkO(obj_network)
@@ -336,7 +342,7 @@ class TestVPCRedundancy(cloudstackTestCase):
 
     def deployvm_in_network(self, network, host_id=None):
         try:
-            self.debug('Creating VM in network=%s' % network.name)
+            self.logger.debug('Creating VM in network=%s' % network.name)
             vm = VirtualMachine.create(
                 self.apiclient,
                 self.services["virtual_machine"],
@@ -346,13 +352,13 @@ class TestVPCRedundancy(cloudstackTestCase):
                 networkids=[str(network.id)],
                 hostid=host_id
             )
-            self.debug('Created VM=%s in network=%s' % (vm.id, network.name))
+            self.logger.debug('Created VM=%s in network=%s' % (vm.id, network.name))
             return vm
         except:
             self.fail('Unable to create VM in a Network=%s' % network.name)
 
     def acquire_publicip(self, network):
-        self.debug("Associating public IP for network: %s" % network.name)
+        self.logger.debug("Associating public IP for network: %s" % network.name)
         public_ip = PublicIPAddress.create(
             self.apiclient,
             accountid=self.account.name,
@@ -361,14 +367,14 @@ class TestVPCRedundancy(cloudstackTestCase):
             networkid=network.id,
             vpcid=self.vpc.id
         )
-        self.debug("Associated %s with network %s" % (
+        self.logger.debug("Associated %s with network %s" % (
             public_ip.ipaddress.ipaddress,
             network.id
         ))
         return public_ip
 
     def create_natrule(self, vm, public_ip, network, services=None):
-        self.debug("Creating NAT rule in network for vm with public IP")
+        self.logger.debug("Creating NAT rule in network for vm with public IP")
         if not services:
             services = self.services["natrule"]
         nat_rule = NATRule.create(
@@ -380,18 +386,18 @@ class TestVPCRedundancy(cloudstackTestCase):
             networkid=network.id,
             vpcid=self.vpc.id)
 
-        self.debug("Adding NetworkACL rules to make NAT rule accessible")
+        self.logger.debug("Adding NetworkACL rules to make NAT rule accessible")
         nwacl_nat = NetworkACL.create(
             self.apiclient,
             networkid=network.id,
             services=services,
             traffictype='Ingress'
         )
-        self.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
+        self.logger.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
         return nat_rule
 
     def check_ssh_into_vm(self, vm, public_ip, expectFail=False, retries=20):
-        self.debug("Checking if we can SSH into VM=%s on public_ip=%s (%r)" %
+        self.logger.debug("Checking if we can SSH into VM=%s on public_ip=%s (%r)" %
                    (vm.name, public_ip.ipaddress.ipaddress, expectFail))
         vm.ssh_client = None
         try:
@@ -403,18 +409,18 @@ class TestVPCRedundancy(cloudstackTestCase):
                 self.fail("SSH into VM=%s on public_ip=%s is successful (Not Expected)" %
                           (vm.name, public_ip.ipaddress.ipaddress))
             else:
-                self.debug("SSH into VM=%s on public_ip=%s is successful" %
+                self.logger.debug("SSH into VM=%s on public_ip=%s is successful" %
                            (vm.name, public_ip.ipaddress.ipaddress))
         except:
             if expectFail:
-                self.debug("Failed to SSH into VM - %s (Expected)" % (public_ip.ipaddress.ipaddress))
+                self.logger.debug("Failed to SSH into VM - %s (Expected)" % (public_ip.ipaddress.ipaddress))
             else:
                 self.fail("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL(self):
         """ Create a redundant VPC with two networks with two VMs in each network """
-        self.debug("Starting test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL")
+        self.logger.debug("Starting test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL")
         self.query_routers()
         self.networks.append(self.create_network(self.services["network_offering"], "10.1.1.1"))
         self.networks.append(self.create_network(self.services["network_offering_no_lb"], "10.1.2.1"))
@@ -443,7 +449,7 @@ class TestVPCRedundancy(cloudstackTestCase):
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_02_redundant_VPC_default_routes(self):
         """ Create a redundant VPC with two networks with two VMs in each network and check default routes"""
-        self.debug("Starting test_02_redundant_VPC_default_routes")
+        self.logger.debug("Starting test_02_redundant_VPC_default_routes")
         self.query_routers()
         self.networks.append(self.create_network(self.services["network_offering"], "10.1.1.1"))
         self.networks.append(self.create_network(self.services["network_offering_no_lb"], "10.1.2.1"))
@@ -487,14 +493,14 @@ class TestVPCRedundancy(cloudstackTestCase):
                 try:
                     vm = vmObj.get_vm()
                     public_ip = vmObj.get_ip()
-                    self.debug("SSH into VM: %s" % public_ip.ipaddress.ipaddress)
+                    self.logger.debug("SSH into VM: %s" % public_ip.ipaddress.ipaddress)
                     
                     ssh = vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
         
-                    self.debug("Ping to google.com from VM")
-                    result = ssh.execute(ssh_command)
+                    self.logger.debug("Ping to google.com from VM")
+                    result = str(ssh.execute(ssh_command))
 
-                    self.debug("SSH result: %s" % str(result))
+                    self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("0% packet loss")))
                 except Exception as e:
                     self.fail("SSH Access failed for %s: %s" % \
                               (vmObj.get_ip(), e)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f79916e/test/integration/component/test_vpc_router_nics.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_router_nics.py b/test/integration/component/test_vpc_router_nics.py
index ce5a622..b05e6d3 100644
--- a/test/integration/component/test_vpc_router_nics.py
+++ b/test/integration/component/test_vpc_router_nics.py
@@ -41,7 +41,7 @@ from marvin.lib.utils import cleanup_resources
 import socket
 import time
 import inspect
-
+import logging
 
 class Services:
     """Test VPC network services - Port Forwarding Rules Test Data Class.
@@ -197,6 +197,12 @@ class TestVPCNics(cloudstackTestCase):
             cls.api_client,
             cls.services["service_offering"])
         cls._cleanup = [cls.service_offering]
+
+        cls.logger = logging.getLogger('TestVPCNics')
+        cls.stream_handler = logging.StreamHandler()
+        cls.logger.setLevel(logging.DEBUG)
+        cls.logger.addHandler(cls.stream_handler)
+
         return
 
     @classmethod
@@ -219,15 +225,15 @@ class TestVPCNics(cloudstackTestCase):
             domainid=self.domain.id)
 
         self.cleanup = [self.account]
-        self.debug("Creating a VPC offering..")
+        self.logger.debug("Creating a VPC offering..")
         self.vpc_off = VpcOffering.create(
             self.apiclient,
             self.services["vpc_offering"])
 
-        self.debug("Enabling the VPC offering created")
+        self.logger.debug("Enabling the VPC offering created")
         self.vpc_off.update(self.apiclient, state='Enabled')
 
-        self.debug("Creating a VPC network in the account: %s" % self.account.name)
+        self.logger.debug("Creating a VPC network in the account: %s" % self.account.name)
         self.services["vpc"]["cidr"] = '10.1.1.1/16'
         self.vpc = VPC.create(
             self.apiclient,
@@ -242,7 +248,7 @@ class TestVPCNics(cloudstackTestCase):
         try:
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
-            self.debug("Warning: Exception during cleanup : %s" % e)
+            self.logger.debug("Warning: Exception during cleanup : %s" % e)
         return
 
     def query_routers(self):
@@ -256,14 +262,14 @@ class TestVPCNics(cloudstackTestCase):
             "Check for list routers response return valid data")
 
     def stop_router(self):
-        self.debug('Stopping router')
+        self.logger.debug('Stopping router')
         for router in self.routers:
             cmd = stopRouter.stopRouterCmd()
             cmd.id = router.id
             self.apiclient.stopRouter(cmd)
 
     def destroy_router(self):
-        self.debug('Stopping router')
+        self.logger.debug('Stopping router')
         for router in self.routers:
             cmd = destroyRouter.destroyRouterCmd()
             cmd.id = router.id
@@ -271,7 +277,7 @@ class TestVPCNics(cloudstackTestCase):
 
     def create_network(self, net_offerring, gateway='10.1.1.1', vpc=None):
         try:
-            self.debug('Create NetworkOffering')
+            self.logger.debug('Create NetworkOffering')
             net_offerring["name"] = "NET_OFF-" + str(gateway)
             nw_off = NetworkOffering.create(
                 self.apiclient,
@@ -279,10 +285,10 @@ class TestVPCNics(cloudstackTestCase):
                 conservemode=False)
 
             nw_off.update(self.apiclient, state='Enabled')
-            self.debug('Created and Enabled NetworkOffering')
+            self.logger.debug('Created and Enabled NetworkOffering')
 
             self.services["network"]["name"] = "NETWORK-" + str(gateway)
-            self.debug('Adding Network=%s' % self.services["network"])
+            self.logger.debug('Adding Network=%s' % self.services["network"])
             obj_network = Network.create(
                 self.apiclient,
                 self.services["network"],
@@ -294,7 +300,7 @@ class TestVPCNics(cloudstackTestCase):
                 vpcid=vpc.id if vpc else self.vpc.id
             )
             
-            self.debug("Created network with ID: %s" % obj_network.id)
+            self.logger.debug("Created network with ID: %s" % obj_network.id)
         except Exception, e:
             self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
         o = networkO(obj_network)
@@ -303,7 +309,7 @@ class TestVPCNics(cloudstackTestCase):
 
     def deployvm_in_network(self, network):
         try:
-            self.debug('Creating VM in network=%s' % network.name)
+            self.logger.debug('Creating VM in network=%s' % network.name)
             vm = VirtualMachine.create(
                 self.apiclient,
                 self.services["virtual_machine"],
@@ -312,13 +318,13 @@ class TestVPCNics(cloudstackTestCase):
                 serviceofferingid=self.service_offering.id,
                 networkids=[str(network.id)]
             )
-            self.debug('Created VM=%s in network=%s' % (vm.id, network.name))
+            self.logger.debug('Created VM=%s in network=%s' % (vm.id, network.name))
             return vm
         except:
             self.fail('Unable to create VM in a Network=%s' % network.name)
 
     def acquire_publicip(self, network):
-        self.debug("Associating public IP for network: %s" % network.name)
+        self.logger.debug("Associating public IP for network: %s" % network.name)
         public_ip = PublicIPAddress.create(
             self.apiclient,
             accountid=self.account.name,
@@ -327,14 +333,14 @@ class TestVPCNics(cloudstackTestCase):
             networkid=network.id,
             vpcid=self.vpc.id
         )
-        self.debug("Associated %s with network %s" % (
+        self.logger.debug("Associated %s with network %s" % (
             public_ip.ipaddress.ipaddress,
             network.id
         ))
         return public_ip
 
     def create_natrule(self, vm, public_ip, network, services=None):
-        self.debug("Creating NAT rule in network for vm with public IP")
+        self.logger.debug("Creating NAT rule in network for vm with public IP")
         if not services:
             services = self.services["natrule"]
         nat_rule = NATRule.create(
@@ -346,23 +352,23 @@ class TestVPCNics(cloudstackTestCase):
             networkid=network.id,
             vpcid=self.vpc.id)
 
-        self.debug("Adding NetworkACL rules to make NAT rule accessible")
+        self.logger.debug("Adding NetworkACL rules to make NAT rule accessible")
         nwacl_nat = NetworkACL.create(
             self.apiclient,
             networkid=network.id,
             services=services,
             traffictype='Ingress'
         )
-        self.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
+        self.logger.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
         return nat_rule
 
     def check_ssh_into_vm(self, vm, public_ip):
-        self.debug("Checking if we can SSH into VM=%s on public_ip=%s" %
+        self.logger.debug("Checking if we can SSH into VM=%s on public_ip=%s" %
                    (vm.name, public_ip.ipaddress.ipaddress))
         vm.ssh_client = None
         try:
             vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
-            self.debug("SSH into VM=%s on public_ip=%s is successful" %
+            self.logger.debug("SSH into VM=%s on public_ip=%s is successful" %
                        (vm.name, public_ip.ipaddress.ipaddress))
         except:
             self.fail("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
@@ -370,7 +376,7 @@ class TestVPCNics(cloudstackTestCase):
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_01_VPC_nics_after_destroy(self):
         """ Create a VPC with two networks with one VM in each network and test nics after destroy"""
-        self.debug("Starting test_01_VPC_nics_after_destroy")
+        self.logger.debug("Starting test_01_VPC_nics_after_destroy")
         self.query_routers()
 
         net1 = self.create_network(self.services["network_offering"], "10.1.1.1")
@@ -393,7 +399,7 @@ class TestVPCNics(cloudstackTestCase):
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_02_VPC_default_routes(self):
         """ Create a VPC with two networks with one VM in each network and test default routes"""
-        self.debug("Starting test_02_VPC_default_routes")
+        self.logger.debug("Starting test_02_VPC_default_routes")
         self.query_routers()
 
         net1 = self.create_network(self.services["network_offering"], "10.1.1.1")
@@ -436,14 +442,14 @@ class TestVPCNics(cloudstackTestCase):
                 try:
                     vm = vmObj.get_vm()
                     public_ip = vmObj.get_ip()
-                    self.debug("SSH into VM: %s" % public_ip.ipaddress.ipaddress)
+                    self.logger.debug("SSH into VM: %s" % public_ip.ipaddress.ipaddress)
                     
                     ssh = vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
         
-                    self.debug("Ping to google.com from VM")
-                    result = ssh.execute(ssh_command)
+                    self.logger.debug("Ping to google.com from VM")
+                    result = str(ssh.execute(ssh_command))
 
-                    self.debug("SSH result: %s" % str(result))
+                    self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("0% packet loss")))
                 except Exception as e:
                     self.fail("SSH Access failed for %s: %s" % \
                               (vmObj.get_ip(), e)


[02/12] git commit: updated refs/heads/master to ca9e934

Posted by re...@apache.org.
CLOUDSTACK-8915 - Reverting changes from commit id 18dbc0c4cbe506ad698bc513c901dc2d0e48159f

   - If the file is always copied, it will result in restarting keepalived everytime which makes the routers transit between master/backup


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

Branch: refs/heads/master
Commit: 3d34e4a52c95c7585fd49ec07001620621c3c846
Parents: 094d29d
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Tue Sep 29 19:38:02 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 6 16:41:13 2015 +0200

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d34e4a5/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
index 9151551..bac9fef 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -96,7 +96,8 @@ class CsRedundant(object):
                 d = s.replace(".templ", "")
             CsHelper.copy_if_needed(
                 "%s/%s" % (self.CS_TEMPLATES_DIR, s), "%s/%s" % (self.CS_ROUTER_DIR, d))
-        CsHelper.copy(
+
+        CsHelper.copy_if_needed(
             "%s/%s" % (self.CS_TEMPLATES_DIR, "keepalived.conf.templ"), self.KEEPALIVED_CONF)
         CsHelper.copy_if_needed(
             "%s/%s" % (self.CS_TEMPLATES_DIR, "conntrackd.conf.templ"), self.CONNTRACKD_CONF)


[08/12] git commit: updated refs/heads/master to ca9e934

Posted by re...@apache.org.
CLOUDSTACK-8915 - Reverting changes from commit id 1a02773b556a0efa277cf18cd099fc62a4e27706

   - That's not the place to fix the default routes for redundant VPC,
   - Adding tests to cover PF and FW in isolated networks
     * Will still add some tests for egress as well


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

Branch: refs/heads/master
Commit: 260ff836b6d7caf30a6ef0f25034791e193a5a31
Parents: 3d34e4a
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Tue Sep 29 20:35:37 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 6 16:41:14 2015 +0200

----------------------------------------------------------------------
 .../config/opt/cloud/bin/cs/CsRedundant.py      |  15 +-
 .../component/test_routers_network_ops.py       | 707 +++++++++++++++++++
 2 files changed, 720 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/260ff836/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
index bac9fef..dcdadfa 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -262,8 +262,19 @@ class CsRedundant(object):
 
         self.set_lock()
         logging.debug("Setting router to master")
-        self.address.process()
-        logging.info("added default routes")
+
+        ads = [o for o in self.address.get_ips() if o.is_public()]
+        dev = ''
+        for o in ads:
+            if dev == o.get_device():
+                continue
+            cmd2 = "ip link set %s up" % o.get_device()
+            if CsDevice(o.get_device(), self.config).waitfordevice():
+                CsHelper.execute(cmd2)
+                dev = o.get_device()
+                logging.info("Bringing public interface %s up" % o.get_device())
+            else:
+                logging.error("Device %s was not ready could not bring it up" % o.get_device())
 
         # ip route add default via $gw table Table_$dev proto static
         cmd = "%s -C %s" % (self.CONNTRACKD_BIN, self.CONNTRACKD_CONF)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/260ff836/test/integration/component/test_routers_network_ops.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_routers_network_ops.py b/test/integration/component/test_routers_network_ops.py
new file mode 100644
index 0000000..b00e27a
--- /dev/null
+++ b/test/integration/component/test_routers_network_ops.py
@@ -0,0 +1,707 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+""" P1 tests for routers
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import (stopVirtualMachine,
+                                  stopRouter,
+                                  startRouter)
+from marvin.lib.utils import (cleanup_resources,
+                              get_process_status)
+from marvin.lib.base import (ServiceOffering,
+                             VirtualMachine,
+                             Account,
+                             LoadBalancerRule,
+                             FireWallRule,
+                             NATRule)
+from marvin.lib.common import (get_zone,
+                               get_template,
+                               get_domain,
+                               list_virtual_machines,
+                               list_networks,
+                               list_configurations,
+                               list_routers,
+                               list_nat_rules,
+                               list_publicIP,
+                               list_lb_rules,
+                               list_firewall_rules,
+                               list_hosts)
+
+# Import System modules
+import time
+
+
+class TestCreatePFOnStoppedRouter(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.testClient = super(TestRouterStopCreatePF, cls).getClsTestClient()
+        cls.api_client = cls.testClient.getApiClient()
+
+        cls.services = cls.testClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.services['mode'] = cls.zone.networktype
+        template = get_template(
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        # Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+            cls.api_client,
+            cls.services["account"],
+            admin=True,
+            domainid=cls.domain.id
+        )
+        cls.service_offering = ServiceOffering.create(
+            cls.api_client,
+            cls.services["service_offering"]
+        )
+        cls.vm_1 = VirtualMachine.create(
+            cls.api_client,
+            cls.services["virtual_machine"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id
+        )
+        cls._cleanup = [
+            cls.account,
+            cls.service_offering
+        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(
+                TestRouterStopCreatePF,
+                cls).getClsTestClient().getApiClient()
+            # Clean up, terminate the created resources
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def tearDown(self):
+        try:
+            # Clean up, terminate the created resources
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.cleanup = []
+        return
+
+    @attr(tags=["advanced", "advancedns"], required_hardware="true")
+    def test_01_CreatePFOnStoppedRouter(self):
+        """Stop existing router, add a PF rule and check we can access the VM """
+
+        # Get router details associated for that account
+        routers = list_routers(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+        )
+
+        self.assertEqual(
+            isinstance(routers, list),
+            True,
+            "Check for list routers response return valid data"
+        )
+        self.assertNotEqual(
+            len(routers),
+            0,
+            "Check list router response"
+        )
+        router = routers[0]
+
+        self.debug("Stopping router ID: %s" % router.id)
+
+        # Stop the router
+        cmd = stopRouter.stopRouterCmd()
+        cmd.id = router.id
+        self.apiclient.stopRouter(cmd)
+
+        routers = list_routers(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+        )
+        self.assertEqual(
+            isinstance(routers, list),
+            True,
+            "Check for list routers response return valid data"
+        )
+        router = routers[0]
+
+        self.assertEqual(
+            router.state,
+            'Stopped',
+            "Check list router response for router state"
+        )
+
+        public_ips = list_publicIP(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            zoneid=self.zone.id
+        )
+        self.assertEqual(
+            isinstance(public_ips, list),
+            True,
+            "Check for list public IPs response return valid data"
+        )
+
+        public_ip = public_ips[0]
+
+        # Open up firewall port for SSH
+        FireWallRule.create(
+            self.apiclient,
+            ipaddressid=public_ip.id,
+            protocol=self.services["natrule"]["protocol"],
+            cidrlist=['0.0.0.0/0'],
+            startport=self.services["natrule"]["publicport"],
+            endport=self.services["natrule"]["publicport"]
+        )
+
+        self.debug("Creating NAT rule for VM ID: %s" % self.vm_1.id)
+        # Create NAT rule
+        nat_rule = NATRule.create(
+            self.apiclient,
+            self.vm_1,
+            self.services["natrule"],
+            public_ip.id
+        )
+
+        self.debug("Starting router ID: %s" % router.id)
+        # Start the router
+        cmd = startRouter.startRouterCmd()
+        cmd.id = router.id
+        self.apiclient.startRouter(cmd)
+
+        routers = list_routers(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            zoneid=self.zone.id
+        )
+        self.assertEqual(
+            isinstance(routers, list),
+            True,
+            "Check for list routers response return valid data"
+        )
+        router = routers[0]
+
+        self.assertEqual(
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+        # NAT Rule should be in Active state after router start
+        nat_rules = list_nat_rules(
+            self.apiclient,
+            id=nat_rule.id
+        )
+        self.assertEqual(
+            isinstance(nat_rules, list),
+            True,
+            "Check for list NAT rules response return valid data"
+        )
+        self.assertEqual(
+            nat_rules[0].state,
+            'Active',
+            "Check list port forwarding rules"
+        )
+        try:
+
+            self.debug("SSH into VM with ID: %s" % nat_rule.ipaddress)
+
+            self.vm_1.get_ssh_client(
+                ipaddress=nat_rule.ipaddress,
+                port=self.services["natrule"]["publicport"])
+        except Exception as e:
+            self.fail(
+                "SSH Access failed for %s: %s" %
+                (nat_rule.ipaddress, e)
+            )
+        return
+
+
+class TestCreateLBOnStoppedRouter(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.testClient = super(TestRouterStopCreateLB, cls).getClsTestClient()
+        cls.api_client = cls.testClient.getApiClient()
+
+        cls.services = cls.testClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.services['mode'] = cls.zone.networktype
+        template = get_template(
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        # Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+            cls.api_client,
+            cls.services["account"],
+            admin=True,
+            domainid=cls.domain.id
+        )
+        cls.service_offering = ServiceOffering.create(
+            cls.api_client,
+            cls.services["service_offering"]
+        )
+        cls.vm_1 = VirtualMachine.create(
+            cls.api_client,
+            cls.services["virtual_machine"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id
+        )
+        cls._cleanup = [
+            cls.account,
+            cls.service_offering
+        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(
+                TestRouterStopCreateLB,
+                cls).getClsTestClient().getApiClient()
+            # Clean up, terminate the created resources
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def tearDown(self):
+        try:
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.cleanup = []
+        return
+
+    @attr(tags=["advanced", "advancedns"], required_hardware="true")
+    def test_01_CreateLBOnStoppedRouter(self):
+        """Stop existing Router, add LB rule and check we can reach the VM"""
+
+        # Get router details associated for that account
+        routers = list_routers(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+        )
+
+        self.assertEqual(
+            isinstance(routers, list),
+            True,
+            "Check for list routers response return valid data"
+        )
+
+        self.assertNotEqual(
+            len(routers),
+            0,
+            "Check list router response"
+        )
+
+        router = routers[0]
+
+        self.debug("Stopping router with ID: %s" % router.id)
+        # Stop the router
+        cmd = stopRouter.stopRouterCmd()
+        cmd.id = router.id
+        self.apiclient.stopRouter(cmd)
+
+        routers = list_routers(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+        )
+        self.assertEqual(
+            isinstance(routers, list),
+            True,
+            "Check for list routers response return valid data"
+        )
+        router = routers[0]
+
+        self.assertEqual(
+            router.state,
+            'Stopped',
+            "Check list router response for router state"
+        )
+
+        public_ips = list_publicIP(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
+        self.assertEqual(
+            isinstance(public_ips, list),
+            True,
+            "Check for list public IPs response return valid data"
+        )
+        public_ip = public_ips[0]
+
+        # Open up firewall port for SSH
+        FireWallRule.create(
+            self.apiclient,
+            ipaddressid=public_ip.id,
+            protocol=self.services["lbrule"]["protocol"],
+            cidrlist=['0.0.0.0/0'],
+            startport=self.services["lbrule"]["publicport"],
+            endport=self.services["lbrule"]["publicport"]
+        )
+        self.debug("Creating LB rule for public IP: %s" % public_ip.id)
+        # Create Load Balancer rule and assign VMs to rule
+        lb_rule = LoadBalancerRule.create(
+            self.apiclient,
+            self.services["lbrule"],
+            public_ip.id,
+            accountid=self.account.name
+        )
+        self.debug("Assigning VM %s to LB rule: %s" % (
+            self.vm_1.id,
+            lb_rule.id
+        ))
+        lb_rule.assign(self.apiclient, [self.vm_1])
+
+        # Start the router
+        cmd = startRouter.startRouterCmd()
+        cmd.id = router.id
+        self.apiclient.startRouter(cmd)
+
+        routers = list_routers(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+        )
+        self.assertEqual(
+            isinstance(routers, list),
+            True,
+            "Check for list routers response return valid data"
+        )
+        router = routers[0]
+
+        self.assertEqual(
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+        # After router start, LB RUle should be in Active state
+        lb_rules = list_lb_rules(
+            self.apiclient,
+            id=lb_rule.id
+        )
+        self.assertEqual(
+            isinstance(lb_rules, list),
+            True,
+            "Check for list LB rules response return valid data"
+        )
+        self.assertEqual(
+            lb_rules[0].state,
+            'Active',
+            "Check list load balancing rules"
+        )
+        self.assertEqual(
+            lb_rules[0].publicport,
+            str(self.services["lbrule"]["publicport"]),
+            "Check list load balancing rules"
+        )
+
+        try:
+            self.debug("SSH into VM with IP: %s" % public_ip.ipaddress)
+            self.vm_1.ssh_port = self.services["lbrule"]["publicport"]
+            self.vm_1.get_ssh_client(public_ip.ipaddress)
+        except Exception as e:
+            self.fail(
+                "SSH Access failed for %s: %s" %
+                (self.vm_1.ipaddress, e)
+            )
+        return
+
+
+class TestCreateFWOnStoppedRouter(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.testClient = super(TestRouterStopCreateFW, cls).getClsTestClient()
+        cls.api_client = cls.testClient.getApiClient()
+
+        cls.services = cls.testClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+        cls.services['mode'] = cls.zone.networktype
+        template = get_template(
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+
+        # Create an account, network, VM and IP addresses
+        cls.account = Account.create(
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
+        cls.service_offering = ServiceOffering.create(
+            cls.api_client,
+            cls.services["service_offering"]
+        )
+        cls.vm_1 = VirtualMachine.create(
+            cls.api_client,
+            cls.services["virtual_machine"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id
+        )
+        cls._cleanup = [
+            cls.account,
+            cls.service_offering
+        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.api_client = super(
+                TestRouterStopCreateFW,
+                cls).getClsTestClient().getApiClient()
+            # Clean up, terminate the created templates
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def tearDown(self):
+        try:
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.hypervisor = self.testClient.getHypervisorInfo()
+        self.cleanup = []
+        return
+
+    @attr(tags=["advanced", "advancedns"], required_hardware="true")
+    def test_01_CreateFWOnStoppedRouter(self):
+        """Stop existing Router, create Firewall rules and check that the rules are applied to the router"""
+
+        # Get the router details associated with account
+        routers = list_routers(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+        )
+
+        self.assertEqual(
+            isinstance(routers, list),
+            True,
+            "Check for list routers response return valid data"
+        )
+
+        self.assertNotEqual(
+            len(routers),
+            0,
+            "Check list router response"
+        )
+
+        router = routers[0]
+
+        self.debug("Stopping the router: %s" % router.id)
+        # Stop the router
+        cmd = stopRouter.stopRouterCmd()
+        cmd.id = router.id
+        self.apiclient.stopRouter(cmd)
+
+        routers = list_routers(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+        )
+        self.assertEqual(
+            isinstance(routers, list),
+            True,
+            "Check for list routers response return valid data"
+        )
+        router = routers[0]
+
+        self.assertEqual(
+            router.state,
+            'Stopped',
+            "Check list router response for router state"
+        )
+
+        public_ips = list_publicIP(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
+        self.assertEqual(
+            isinstance(public_ips, list),
+            True,
+            "Check for list public IP response return valid data"
+        )
+        public_ip = public_ips[0]
+
+        # Create Firewall rule with configurations from settings file
+        fw_rule = FireWallRule.create(
+            self.apiclient,
+            ipaddressid=public_ip.id,
+            protocol='TCP',
+            cidrlist=[self.services["fwrule"]["cidr"]],
+            startport=self.services["fwrule"]["startport"],
+            endport=self.services["fwrule"]["endport"]
+        )
+        self.debug("Created firewall rule: %s" % fw_rule.id)
+
+        self.debug("Starting the router: %s" % router.id)
+        # Start the router
+        cmd = startRouter.startRouterCmd()
+        cmd.id = router.id
+        self.apiclient.startRouter(cmd)
+
+        routers = list_routers(
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+        )
+        self.assertEqual(
+            isinstance(routers, list),
+            True,
+            "Check for list routers response return valid data"
+        )
+
+        router = routers[0]
+
+        self.assertEqual(
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+        # After Router start, FW rule should be in Active state
+        fw_rules = list_firewall_rules(
+            self.apiclient,
+            id=fw_rule.id,
+        )
+        self.assertEqual(
+            isinstance(fw_rules, list),
+            True,
+            "Check for list FW rules response return valid data"
+        )
+
+        self.assertEqual(
+            fw_rules[0].state,
+            'Active',
+            "Check list load balancing rules"
+        )
+        self.assertEqual(
+            fw_rules[0].startport,
+            str(self.services["fwrule"]["startport"]),
+            "Check start port of firewall rule"
+        )
+
+        self.assertEqual(
+            fw_rules[0].endport,
+            str(self.services["fwrule"]["endport"]),
+            "Check end port of firewall rule"
+        )
+        # For DNS and DHCP check 'dnsmasq' process status
+        if (self.hypervisor.lower() == 'vmware'
+                or self.hypervisor.lower() == 'hyperv'):
+            result = get_process_status(
+                self.apiclient.connection.mgtSvr,
+                22,
+                self.apiclient.connection.user,
+                self.apiclient.connection.passwd,
+                router.linklocalip,
+                'iptables -t nat -L',
+                hypervisor=self.hypervisor
+            )
+        else:
+            hosts = list_hosts(
+                self.apiclient,
+                id=router.hostid,
+            )
+            self.assertEqual(
+                isinstance(hosts, list),
+                True,
+                "Check for list hosts response return valid data"
+            )
+            host = hosts[0]
+            host.user = self.services["configurableData"]["host"]["username"]
+            host.passwd = self.services["configurableData"]["host"]["password"]
+            try:
+                result = get_process_status(
+                    host.ipaddress,
+                    22,
+                    host.user,
+                    host.passwd,
+                    router.linklocalip,
+                    'iptables -t nat -L'
+                )
+            except KeyError:
+                self.skipTest(
+                    "Provide a marvin config file with host\
+                            credentials to run %s" %
+                    self._testMethodName)
+
+        self.debug("iptables -t nat -L: %s" % result)
+        self.debug("Public IP: %s" % public_ip.ipaddress)
+        res = str(result)
+        self.assertEqual(
+            res.count(str(public_ip.ipaddress)),
+            1,
+            "Check public IP address"
+        )
+
+        return


[03/12] git commit: updated refs/heads/master to ca9e934

Posted by re...@apache.org.
CLOUDSTACK-8915 - VRRP needs a cidr in order to work properly

   - The cidr was replaced by the single IP, which broke the feature.
   - Wait during transition from master to backup otherwise the test fails due to wronge state


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

Branch: refs/heads/master
Commit: 094d29d7cdbb9f3e6e4248875de07fbe3610b2a6
Parents: 0c752ea
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Tue Sep 29 15:13:10 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 6 16:41:13 2015 +0200

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py   | 2 +-
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py | 2 +-
 test/integration/component/test_vpc_redundant.py               | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/094d29d7/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index a473277..78ccb3a 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -292,8 +292,8 @@ class CsIP:
 
     def post_configure(self, address):
         """ The steps that must be done after a device is configured """
+        route = CsRoute()
         if not self.get_type() in ["control"]:
-            route = CsRoute()
             route.add_table(self.dev)
             
             CsRule(self.dev).addMark()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/094d29d7/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
index f71efc7..9151551 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -310,7 +310,7 @@ class CsRedundant(object):
                 if(cmdline.get_type()=='router'):
                     str = "        %s brd %s dev %s\n" % (cmdline.get_guest_gw(), o.get_broadcast(), o.get_device())
                 else:
-                    str = "        %s brd %s dev %s\n" % (o.get_ip(), o.get_broadcast(), o.get_device())
+                    str = "        %s brd %s dev %s\n" % (o.get_gateway_cidr(), o.get_broadcast(), o.get_device())
                 lines.append(str)
                 self.check_is_up(o.get_device())
         return lines

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/094d29d7/test/integration/component/test_vpc_redundant.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_redundant.py b/test/integration/component/test_vpc_redundant.py
index 32e52ec..149baf7 100644
--- a/test/integration/component/test_vpc_redundant.py
+++ b/test/integration/component/test_vpc_redundant.py
@@ -287,8 +287,6 @@ class TestVPCRedundancy(cloudstackTestCase):
                 cnts[vals.index(router.redundantstate)] += 1
         if cnts[vals.index('MASTER')] != 1:
             self.fail("No Master or too many master routers found %s" % cnts[vals.index('MASTER')])
-        # if cnts[vals.index('UNKNOWN')] > 0:
-            # self.fail("Router has unknown status")
 
     def stop_router(self, type):
         self.check_master_status(2)
@@ -430,6 +428,7 @@ class TestVPCRedundancy(cloudstackTestCase):
         self.check_master_status(2)
         self.add_nat_rules()
         self.do_vpc_test(False)
+        time.sleep(15)
 
         self.stop_router("MASTER")
         # wait for the backup router to transit to master state
@@ -443,6 +442,7 @@ class TestVPCRedundancy(cloudstackTestCase):
 
         self.start_router()
         self.add_nat_rules()
+        time.sleep(15)
         self.check_master_status(2)
         self.do_vpc_test(False)
 


[07/12] git commit: updated refs/heads/master to ca9e934

Posted by re...@apache.org.
CLOUDSTACK-8915 - This test is still under construction

   - It will help to increase coverage of VR use: PF; LB and FW


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

Branch: refs/heads/master
Commit: a0c93e7778ac85db2c5f5db58d5d778191cf2da8
Parents: 5f79916
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Thu Oct 1 13:30:12 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 6 16:41:14 2015 +0200

----------------------------------------------------------------------
 .../component/test_routers_network_ops.py       | 65 ++++++++++++--------
 1 file changed, 41 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0c93e77/test/integration/component/test_routers_network_ops.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_routers_network_ops.py b/test/integration/component/test_routers_network_ops.py
index 2b170fa..9937a4e 100644
--- a/test/integration/component/test_routers_network_ops.py
+++ b/test/integration/component/test_routers_network_ops.py
@@ -14,8 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-""" P1 tests for routers
-"""
+
 # Import Local Modules
 from nose.plugins.attrib import attr
 from marvin.cloudstackTestCase import cloudstackTestCase
@@ -45,7 +44,7 @@ from marvin.lib.common import (get_zone,
 
 # Import System modules
 import time
-
+import logging
 
 class TestCreatePFOnStoppedRouter(cloudstackTestCase):
 
@@ -90,6 +89,12 @@ class TestCreatePFOnStoppedRouter(cloudstackTestCase):
             cls.account,
             cls.service_offering
         ]
+        
+        cls.logger = logging.getLogger('TestCreatePFOnStoppedRouter')
+        cls.stream_handler = logging.StreamHandler()
+        cls.logger.setLevel(logging.DEBUG)
+        cls.logger.addHandler(cls.stream_handler)
+
         return
 
     @classmethod
@@ -126,7 +131,7 @@ class TestCreatePFOnStoppedRouter(cloudstackTestCase):
         routers = list_routers(
             self.apiclient,
             account=self.account.name,
-            domainid=self.account.domainid,
+            domainid=self.account.domainid
         )
 
         self.assertEqual(
@@ -141,7 +146,7 @@ class TestCreatePFOnStoppedRouter(cloudstackTestCase):
         )
         router = routers[0]
 
-        self.debug("Stopping router ID: %s" % router.id)
+        self.logger.debug("Stopping router ID: %s" % router.id)
 
         # Stop the router
         cmd = stopRouter.stopRouterCmd()
@@ -151,7 +156,7 @@ class TestCreatePFOnStoppedRouter(cloudstackTestCase):
         routers = list_routers(
             self.apiclient,
             account=self.account.name,
-            domainid=self.account.domainid,
+            domainid=self.account.domainid
         )
         self.assertEqual(
             isinstance(routers, list),
@@ -190,7 +195,7 @@ class TestCreatePFOnStoppedRouter(cloudstackTestCase):
             endport=self.services["natrule"]["publicport"]
         )
 
-        self.debug("Creating NAT rule for VM ID: %s" % self.vm_1.id)
+        self.logger.debug("Creating NAT rule for VM ID: %s" % self.vm_1.id)
         # Create NAT rule
         nat_rule = NATRule.create(
             self.apiclient,
@@ -199,7 +204,7 @@ class TestCreatePFOnStoppedRouter(cloudstackTestCase):
             public_ip.id
         )
 
-        self.debug("Starting router ID: %s" % router.id)
+        self.logger.debug("Starting router ID: %s" % router.id)
         # Start the router
         cmd = startRouter.startRouterCmd()
         cmd.id = router.id
@@ -240,7 +245,7 @@ class TestCreatePFOnStoppedRouter(cloudstackTestCase):
         )
         try:
 
-            self.debug("SSH into VM with ID: %s" % nat_rule.ipaddress)
+            self.logger.debug("SSH into VM with ID: %s" % nat_rule.ipaddress)
 
             self.vm_1.get_ssh_client(
                 ipaddress=nat_rule.ipaddress,
@@ -296,6 +301,12 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
             cls.account,
             cls.service_offering
         ]
+
+        cls.logger = logging.getLogger('TestCreateLBOnStoppedRouter')
+        cls.stream_handler = logging.StreamHandler()
+        cls.logger.setLevel(logging.DEBUG)
+        cls.logger.addHandler(cls.stream_handler)
+
         return
 
     @classmethod
@@ -331,7 +342,7 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
         routers = list_routers(
             self.apiclient,
             account=self.account.name,
-            domainid=self.account.domainid,
+            domainid=self.account.domainid
         )
 
         self.assertEqual(
@@ -348,7 +359,7 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
 
         router = routers[0]
 
-        self.debug("Stopping router with ID: %s" % router.id)
+        self.logger.debug("Stopping router with ID: %s" % router.id)
         # Stop the router
         cmd = stopRouter.stopRouterCmd()
         cmd.id = router.id
@@ -357,7 +368,7 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
         routers = list_routers(
             self.apiclient,
             account=self.account.name,
-            domainid=self.account.domainid,
+            domainid=self.account.domainid
         )
         self.assertEqual(
             isinstance(routers, list),
@@ -393,7 +404,7 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
             startport=self.services["lbrule"]["publicport"],
             endport=self.services["lbrule"]["publicport"]
         )
-        self.debug("Creating LB rule for public IP: %s" % public_ip.id)
+        self.logger.debug("Creating LB rule for public IP: %s" % public_ip.id)
         # Create Load Balancer rule and assign VMs to rule
         lb_rule = LoadBalancerRule.create(
             self.apiclient,
@@ -401,7 +412,7 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
             public_ip.id,
             accountid=self.account.name
         )
-        self.debug("Assigning VM %s to LB rule: %s" % (
+        self.logger.debug("Assigning VM %s to LB rule: %s" % (
             self.vm_1.id,
             lb_rule.id
         ))
@@ -415,7 +426,7 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
         routers = list_routers(
             self.apiclient,
             account=self.account.name,
-            domainid=self.account.domainid,
+            domainid=self.account.domainid
         )
         self.assertEqual(
             isinstance(routers, list),
@@ -451,7 +462,7 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
         )
 
         try:
-            self.debug("SSH into VM with IP: %s" % public_ip.ipaddress)
+            self.logger.debug("SSH into VM with IP: %s" % public_ip.ipaddress)
             self.vm_1.ssh_port = self.services["lbrule"]["publicport"]
             self.vm_1.get_ssh_client(public_ip.ipaddress)
         except Exception as e:
@@ -504,6 +515,12 @@ class TestCreateFWOnStoppedRouter(cloudstackTestCase):
             cls.account,
             cls.service_offering
         ]
+
+        cls.logger = logging.getLogger('TestCreateFWOnStoppedRouter')
+        cls.stream_handler = logging.StreamHandler()
+        cls.logger.setLevel(logging.DEBUG)
+        cls.logger.addHandler(cls.stream_handler)
+
         return
 
     @classmethod
@@ -540,7 +557,7 @@ class TestCreateFWOnStoppedRouter(cloudstackTestCase):
         routers = list_routers(
             self.apiclient,
             account=self.account.name,
-            domainid=self.account.domainid,
+            domainid=self.account.domainid
         )
 
         self.assertEqual(
@@ -557,7 +574,7 @@ class TestCreateFWOnStoppedRouter(cloudstackTestCase):
 
         router = routers[0]
 
-        self.debug("Stopping the router: %s" % router.id)
+        self.logger.debug("Stopping the router: %s" % router.id)
         # Stop the router
         cmd = stopRouter.stopRouterCmd()
         cmd.id = router.id
@@ -566,7 +583,7 @@ class TestCreateFWOnStoppedRouter(cloudstackTestCase):
         routers = list_routers(
             self.apiclient,
             account=self.account.name,
-            domainid=self.account.domainid,
+            domainid=self.account.domainid
         )
         self.assertEqual(
             isinstance(routers, list),
@@ -602,9 +619,9 @@ class TestCreateFWOnStoppedRouter(cloudstackTestCase):
             startport=self.services["fwrule"]["startport"],
             endport=self.services["fwrule"]["endport"]
         )
-        self.debug("Created firewall rule: %s" % fw_rule.id)
+        self.logger.debug("Created firewall rule: %s" % fw_rule.id)
 
-        self.debug("Starting the router: %s" % router.id)
+        self.logger.debug("Starting the router: %s" % router.id)
         # Start the router
         cmd = startRouter.startRouterCmd()
         cmd.id = router.id
@@ -613,7 +630,7 @@ class TestCreateFWOnStoppedRouter(cloudstackTestCase):
         routers = list_routers(
             self.apiclient,
             account=self.account.name,
-            domainid=self.account.domainid,
+            domainid=self.account.domainid
         )
         self.assertEqual(
             isinstance(routers, list),
@@ -695,8 +712,8 @@ class TestCreateFWOnStoppedRouter(cloudstackTestCase):
                             credentials to run %s" %
                     self._testMethodName)
 
-        self.debug("iptables -t nat -L: %s" % result)
-        self.debug("Public IP: %s" % public_ip.ipaddress)
+        self.logger.debug("iptables -t nat -L: %s" % result)
+        self.logger.debug("Public IP: %s" % public_ip.ipaddress)
         res = str(result)
         self.assertEqual(
             res.count(str(public_ip.ipaddress)),


[04/12] git commit: updated refs/heads/master to ca9e934

Posted by re...@apache.org.
CLOUDSTACK-8915 - Rearrenging a bit the default route code in order to make it more clear


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

Branch: refs/heads/master
Commit: 0c752eab60ed2b56708e7e48bcdf73c63e76f986
Parents: c17fb0f
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Tue Sep 29 14:35:48 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 6 16:41:13 2015 +0200

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/configure.py    |  2 +-
 .../debian/config/opt/cloud/bin/cs/CsAddress.py | 73 +++++++++++---------
 .../debian/config/opt/cloud/bin/cs/CsRoute.py   |  9 ++-
 3 files changed, 46 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c752eab/systemvm/patches/debian/config/opt/cloud/bin/configure.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/configure.py b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
index 29e19c4..ae24ac5 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
@@ -663,7 +663,7 @@ class CsForwardingRules(CsDataBag):
                 elif rule["type"] == "staticnat":
                     self.processStaticNatRule(rule)
 
-    #return the VR guest interface ipo
+    #return the VR guest interface ip
     def getGuestIp(self):
         ipr = []
         ipAddr = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c752eab/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 3e8fbca..a473277 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -112,9 +112,6 @@ class CsAddress(CsDataBag):
             return False
 
     def process(self):
-        route = CsRoute()
-        found_defaultroute = False
-
         for dev in self.dbag:
             if dev == "id":
                 continue
@@ -123,42 +120,21 @@ class CsAddress(CsDataBag):
             for address in self.dbag[dev]:
                 #check if link is up
                 if not self.check_if_link_up(dev):
-                   cmd="ip link set %s up"%dev
+                   cmd="ip link set %s up" % dev
                    CsHelper.execute(cmd)
 
-                gateway = str(address["gateway"])
-                network = str(address["network"])
-
                 ip.setAddress(address)
 
                 if ip.configured():
                     logging.info(
                         "Address %s on device %s already configured", ip.ip(), dev)
 
-                    ip.post_configure()
-
+                    ip.post_configure(address)
                 else:
                     logging.info(
                         "Address %s on device %s not configured", ip.ip(), dev)
                     if CsDevice(dev, self.config).waitfordevice():
-                        ip.configure()
-                        
-                        route.add_route(dev, network)
-
-                        # The code looks redundant here, but we actually have to cater for routers and
-                        # VPC routers in a different manner. Please do not remove this block otherwise
-                        # The VPC default route will be broken.
-                        if address["nw_type"] == "public" and not found_defaultroute:
-                            if not route.defaultroute_exists():
-                                if route.add_defaultroute(gateway):
-                                    found_defaultroute = True
-
-        # once we start processing public ip's we need to verify there
-        # is a default route and add if needed
-        if not route.defaultroute_exists():
-            cmdline = self.config.cmdline()
-            if(cmdline.get_gateway()):
-                route.add_defaultroute(cmdline.get_gateway())
+                        ip.configure(address)
 
 
 class CsInterface:
@@ -307,28 +283,43 @@ class CsIP:
     def getAddress(self):
         return self.address
 
-    def configure(self):
+    def configure(self, address):
         logging.info(
             "Configuring address %s on device %s", self.ip(), self.dev)
         cmd = "ip addr add dev %s %s brd +" % (self.dev, self.ip())
         subprocess.call(cmd, shell=True)
-        self.post_configure()
+        self.post_configure(address)
 
-    def post_configure(self):
+    def post_configure(self, address):
         """ The steps that must be done after a device is configured """
         if not self.get_type() in ["control"]:
             route = CsRoute()
             route.add_table(self.dev)
+            
             CsRule(self.dev).addMark()
             self.check_is_up()
             self.set_mark()
             self.arpPing()
+            
             CsRpsrfs(self.dev).enable()
             self.post_config_change("add")
 
         '''For isolated/redundant and dhcpsrvr routers, call this method after the post_config is complete '''
         if not self.config.is_vpc():
             self.setup_router_control()
+        
+        if self.config.is_vpc():
+            # The code looks redundant here, but we actually have to cater for routers and
+            # VPC routers in a different manner. Please do not remove this block otherwise
+            # The VPC default route will be broken.
+            if self.get_type() in ["public"]:
+                gateway = str(address["gateway"])
+                route.add_defaultroute(gateway)
+        else:
+            # once we start processing public ip's we need to verify there
+            # is a default route and add if needed
+            if(self.cl.get_gateway()):
+                route.add_defaultroute(self.cl.get_gateway())
 
     def check_is_up(self):
         """ Ensure device is up """
@@ -543,19 +534,20 @@ class CsIP:
             CsDevice(self.dev, self.config).configure_rp()
 
             logging.error(
-                "Not able to setup sourcenat for a regular router yet")
+                "Not able to setup source-nat for a regular router yet")
             dns = CsDnsmasq(self)
             dns.add_firewall_rules()
             app = CsApache(self)
             app.setup()
 
+        cmdline = self.config.cmdline()
         # If redundant then this is dealt with by the master backup functions
-        if self.get_type() in ["guest"] and not self.config.cl.is_redundant():
+        if self.get_type() in ["guest"] and not cmdline.is_redundant():
             pwdsvc = CsPasswdSvc(self.address['public_ip']).start()
 
         if self.get_type() == "public" and self.config.is_vpc():
             if self.address["source_nat"]:
-                vpccidr = self.config.cmdline().get_vpccidr()
+                vpccidr = cmdline.get_vpccidr()
                 self.fw.append(
                     ["filter", "", "-A FORWARD -s %s ! -d %s -j ACCEPT" % (vpccidr, vpccidr)])
                 self.fw.append(
@@ -567,7 +559,15 @@ class CsIP:
         for i in CsHelper.execute(cmd):
             vals = i.lstrip().split()
             if (vals[0] == 'inet'):
-                self.iplist[vals[1]] = self.dev
+                
+                cidr = vals[1]
+                for ip, device in self.iplist.iteritems():
+                    logging.info(
+                                 "Iterating over the existing IPs. CIDR to be configured ==> %s, existing IP ==> %s on device ==> %s",
+                                 cidr, ip, device)
+
+                    if cidr[0] != ip[0] and device != self.dev:
+                        self.iplist[cidr] = self.dev
 
     def configured(self):
         if self.address['cidr'] in self.iplist.keys():
@@ -635,8 +635,13 @@ class CsIP:
         interface = CsInterface(bag, self.config)
         if not self.config.cl.is_redundant():
             return False
+
         rip = ip.split('/')[0]
+        logging.info("Checking if cidr is a gateway for rVPC. IP ==> %s / device ==> %s", ip, self.dev)
+
         gw = interface.get_gateway()
+        logging.info("Interface has the following gateway ==> %s", gw)
+        
         if bag['nw_type'] == "guest" and rip == gw:
             return True
         return False

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c752eab/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py
index fd2d989..1178fb0 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py
@@ -71,13 +71,16 @@ class CsRoute:
         :param str gateway
         :return: bool
         """
-        if gateway is not None:
+        if not gateway:
+            raise Exception("Gateway cannot be None.")
+        
+        if self.defaultroute_exists():
+            return False
+        else:
             cmd = "default via " + gateway
             logging.info("Adding default route")
             self.set_route(cmd)
             return True
-        else:
-            return False
 
     def defaultroute_exists(self):
         """ Return True if a default route is present


[09/12] git commit: updated refs/heads/master to ca9e934

Posted by re...@apache.org.
CLOUDSTACK-8915 - Fix the assertion used for the default routes test


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

Branch: refs/heads/master
Commit: b1fb1539e9eee605b1eb7b2dd529d44ea1fe7ddc
Parents: 9fe040e
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Mon Oct 5 11:31:25 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 6 16:41:15 2015 +0200

----------------------------------------------------------------------
 test/integration/component/test_vpc_redundant.py   | 2 +-
 test/integration/component/test_vpc_router_nics.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b1fb1539/test/integration/component/test_vpc_redundant.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_redundant.py b/test/integration/component/test_vpc_redundant.py
index 84a7cd3..e1a6ecb 100644
--- a/test/integration/component/test_vpc_redundant.py
+++ b/test/integration/component/test_vpc_redundant.py
@@ -507,7 +507,7 @@ class TestVPCRedundancy(cloudstackTestCase):
                               )
         
                 self.assertEqual(
-                                 result.count("0% packet loss"),
+                                 result.count("3 packets received"),
                                  1,
                                  "Ping to outside world from VM should be successful"
                                  )

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b1fb1539/test/integration/component/test_vpc_router_nics.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_router_nics.py b/test/integration/component/test_vpc_router_nics.py
index b05e6d3..db4e27a 100644
--- a/test/integration/component/test_vpc_router_nics.py
+++ b/test/integration/component/test_vpc_router_nics.py
@@ -456,7 +456,7 @@ class TestVPCNics(cloudstackTestCase):
                               )
         
                 self.assertEqual(
-                                 result.count("0% packet loss"),
+                                 result.count("3 packets received"),
                                  1,
                                  "Ping to outside world from VM should be successful"
                                  )


[11/12] git commit: updated refs/heads/master to ca9e934

Posted by re...@apache.org.
CLOUDSTACK-8915 - Making sure cleanup resources passes

   - Due to an issue with VPC routers (CLOUDSTACK-8935) we are not able to destroy networks before destroying the routers
   - Added a forcestop/destroy routers inside the tearDown to make sure it passes. The issue will be addressed in a separate PR
   - Make sure the routers list is cleaned after destroy_routers() is called
   - Populate routers list after the router is recreated


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

Branch: refs/heads/master
Commit: 7ed81a6990956ef577c8e193fadb195546ed3181
Parents: b1fb153
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Mon Oct 5 13:26:55 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Wed Oct 7 11:14:23 2015 +0200

----------------------------------------------------------------------
 .../test_routers_iptables_default_policy.py     | 73 +++++++++++++------
 .../component/test_routers_network_ops.py       | 19 ++---
 .../integration/component/test_vpc_redundant.py | 63 ++++++++++++----
 .../component/test_vpc_router_nics.py           | 75 ++++++++++++--------
 4 files changed, 154 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ed81a69/test/integration/component/test_routers_iptables_default_policy.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_routers_iptables_default_policy.py b/test/integration/component/test_routers_iptables_default_policy.py
index b72e45f..a1bec4c 100644
--- a/test/integration/component/test_routers_iptables_default_policy.py
+++ b/test/integration/component/test_routers_iptables_default_policy.py
@@ -230,21 +230,19 @@ class TestVPCIpTablesPolicies(cloudstackTestCase):
             admin=True,
             domainid=cls.domain.id)
         
-        cls._cleanup = [cls.account]
-
         cls.service_offering = ServiceOffering.create(
             cls.apiclient,
             cls.services["service_offering"])
         
-        cls._cleanup.append(cls.service_offering)
 
         cls.logger = logging.getLogger('TestVPCIpTablesPolicies')
         cls.stream_handler = logging.StreamHandler()
         cls.logger.setLevel(logging.DEBUG)
         cls.logger.addHandler(cls.stream_handler)
 
-        cls.entity_manager = EntityManager(cls.apiclient, cls.services, cls.service_offering, cls.account, cls.zone, cls._cleanup, cls.logger)
+        cls.entity_manager = EntityManager(cls.apiclient, cls.services, cls.service_offering, cls.account, cls.zone, cls.logger)
 
+        cls._cleanup = [cls.service_offering, cls.account]
         return
 
     @classmethod
@@ -274,6 +272,16 @@ class TestVPCIpTablesPolicies(cloudstackTestCase):
             account=self.account.name,
             domainid=self.account.domainid)
 
+        self.cleanup = [self.vpc, self.vpc_off]
+        self.entity_manager.set_cleanup(self.cleanup)
+        return
+
+    def tearDown(self):
+        try:
+            self.entity_manager.destroy_routers()
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -361,21 +369,18 @@ class TestRouterIpTablesPolicies(cloudstackTestCase):
             admin=True,
             domainid=cls.domain.id)
         
-        cls._cleanup = [cls.account]
-
         cls.service_offering = ServiceOffering.create(
             cls.apiclient,
             cls.services["service_offering"])
         
-        cls._cleanup.append(cls.service_offering)
-        
         cls.logger = logging.getLogger('TestRouterIpTablesPolicies')
         cls.stream_handler = logging.StreamHandler()
         cls.logger.setLevel(logging.DEBUG)
         cls.logger.addHandler(cls.stream_handler)
 
-        cls.entity_manager = EntityManager(cls.apiclient, cls.services, cls.service_offering, cls.account, cls.zone, cls._cleanup, cls.logger)
+        cls.entity_manager = EntityManager(cls.apiclient, cls.services, cls.service_offering, cls.account, cls.zone, cls.logger)
 
+        cls._cleanup = [cls.service_offering, cls.account]
         return
 
     @classmethod
@@ -386,6 +391,18 @@ class TestRouterIpTablesPolicies(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
+    def setUp(self):
+        self.cleanup = []
+        self.entity_manager.set_cleanup(self.cleanup)
+        return
+
+    def tearDown(self):
+        try:
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_02_routervm_iptables_policies(self):
         """ Test iptables default INPUT/FORWARD policy on RouterVM """
@@ -442,18 +459,21 @@ class TestRouterIpTablesPolicies(cloudstackTestCase):
 
 class EntityManager(object):
 
-    def __init__(self, apiclient, services, service_offering, account, zone, cleanup, logger):
+    def __init__(self, apiclient, services, service_offering, account, zone, logger):
         self.apiclient = apiclient
         self.services = services
         self.service_offering = service_offering
         self.account = account
         self.zone = zone
-        self.cleanup = cleanup
         self.logger = logger
 
+        self.cleanup = []
         self.networks = []
         self.routers = []
         self.ips = []
+    
+    def set_cleanup(self, cleanup):
+        self.cleanup = cleanup
 
     def add_nat_rules(self, vpc_id):
         for o in self.networks:
@@ -514,7 +534,6 @@ class EntityManager(object):
                 conservemode=False)
 
             nw_off.update(self.apiclient, state='Enabled')
-            self.cleanup.append(nw_off)
             self.logger.debug('Created and Enabled NetworkOffering')
 
             self.services["network"]["name"] = "NETWORK-" + str(gateway)
@@ -528,13 +547,18 @@ class EntityManager(object):
                 zoneid=self.zone.id,
                 gateway=gateway,
                 vpcid=vpc_id)
+
             self.logger.debug("Created network with ID: %s" % obj_network.id)
         except Exception, e:
             raise Exception('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
 
         o = networkO(obj_network)
-        o.add_vm(self.deployvm_in_network(obj_network))
 
+        vm1 = self.deployvm_in_network(obj_network)
+        self.cleanup.insert(1, obj_network)
+        self.cleanup.insert(2, nw_off)
+
+        o.add_vm(vm1)
         self.networks.append(o)
         return o
 
@@ -548,7 +572,9 @@ class EntityManager(object):
                 domainid=self.account.domainid,
                 serviceofferingid=self.service_offering.id,
                 networkids=[str(network.id)])
+
             self.logger.debug('Created VM=%s in network=%s' % (vm.id, network.name))
+            self.cleanup.insert(0, vm)
             return vm
         except:
             raise Exception('Unable to create VM in a Network=%s' % network.name)
@@ -562,6 +588,8 @@ class EntityManager(object):
                 accountid=self.account.name,
                 domainid=self.account.domainid,
                 serviceofferingid=self.service_offering.id)
+
+            self.cleanup.insert(0, vm)
             self.logger.debug('Created VM=%s' % vm.id)
             return vm
         except:
@@ -590,22 +618,23 @@ class EntityManager(object):
 
         return self.routers
 
-    def stop_router(self):
+    def stop_router(self, router):
         self.logger.debug('Stopping router')
-        for router in self.routers:
-            cmd = stopRouter.stopRouterCmd()
-            cmd.id = router.id
-            self.apiclient.stopRouter(cmd)
+        cmd = stopRouter.stopRouterCmd()
+        cmd.id = router.id
+        self.apiclient.stopRouter(cmd)
 
-    def destroy_router(self):
-        self.logger.debug('Destroying router')
+    def destroy_routers(self):
+        self.logger.debug('Destroying routers')
         for router in self.routers:
+            self.stop_router(router)
             cmd = destroyRouter.destroyRouterCmd()
             cmd.id = router.id
             self.apiclient.destroyRouter(cmd)
+        self.routers = []
 
-    def start_router(self):
-        self.logger.debug('Starting router')
+    def start_routers(self):
+        self.logger.debug('Starting routers')
         for router in self.routers:
             cmd = startRouter.startRouterCmd()
             cmd.id = router.id

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ed81a69/test/integration/component/test_routers_network_ops.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_routers_network_ops.py b/test/integration/component/test_routers_network_ops.py
index 9937a4e..7f1e4aa 100644
--- a/test/integration/component/test_routers_network_ops.py
+++ b/test/integration/component/test_routers_network_ops.py
@@ -110,6 +110,11 @@ class TestCreatePFOnStoppedRouter(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.cleanup = []
+        return
+
     def tearDown(self):
         try:
             # Clean up, terminate the created resources
@@ -118,10 +123,6 @@ class TestCreatePFOnStoppedRouter(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    def setUp(self):
-        self.apiclient = self.testClient.getApiClient()
-        self.cleanup = []
-        return
 
     @attr(tags=["advanced", "advancedns"], required_hardware="true")
     def test_01_CreatePFOnStoppedRouter(self):
@@ -322,6 +323,11 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.cleanup = []
+        return
+
     def tearDown(self):
         try:
             cleanup_resources(self.apiclient, self.cleanup)
@@ -329,11 +335,6 @@ class TestCreateLBOnStoppedRouter(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    def setUp(self):
-        self.apiclient = self.testClient.getApiClient()
-        self.cleanup = []
-        return
-
     @attr(tags=["advanced", "advancedns"], required_hardware="true")
     def test_01_CreateLBOnStoppedRouter(self):
         """Stop existing Router, add LB rule and check we can reach the VM"""

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ed81a69/test/integration/component/test_vpc_redundant.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_redundant.py b/test/integration/component/test_vpc_redundant.py
index e1a6ecb..11fabf6 100644
--- a/test/integration/component/test_vpc_redundant.py
+++ b/test/integration/component/test_vpc_redundant.py
@@ -22,6 +22,7 @@ from nose.plugins.attrib import attr
 from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin.lib.base import (stopRouter,
                              startRouter,
+                             destroyRouter,
                              Account,
                              VpcOffering,
                              VPC,
@@ -242,7 +243,6 @@ class TestVPCRedundancy(cloudstackTestCase):
             admin=True,
             domainid=self.domain.id)
 
-        self._cleanup = [self.account]
         self.logger.debug("Creating a VPC offering..")
         self.vpc_off = VpcOffering.create(
             self.apiclient,
@@ -260,6 +260,17 @@ class TestVPCRedundancy(cloudstackTestCase):
             zoneid=self.zone.id,
             account=self.account.name,
             domainid=self.account.domainid)
+        
+        self.cleanup = [self.vpc, self.vpc_off, self.account]
+        return
+
+    def tearDown(self):
+        try:
+            #Stop/Destroy the routers so we are able to remove the networks. Issue CLOUDSTACK-8935
+            self.destroy_routers()
+            cleanup_resources(self.api_client, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
     def query_routers(self, count=2, showall=False):
@@ -287,16 +298,29 @@ class TestVPCRedundancy(cloudstackTestCase):
         if cnts[vals.index('MASTER')] != 1:
             self.fail("No Master or too many master routers found %s" % cnts[vals.index('MASTER')])
 
-    def stop_router(self, type):
+    def stop_router(self, router):
+        self.logger.debug('Stopping router %s' % router.id)
+        cmd = stopRouter.stopRouterCmd()
+        cmd.id = router.id
+        self.apiclient.stopRouter(cmd)
+
+    def stop_router_by_type(self, type):
         self.check_master_status(2)
         self.logger.debug('Stopping %s router' % type)
         for router in self.routers:
             if router.redundantstate == type:
-                cmd = stopRouter.stopRouterCmd()
-                cmd.id = router.id
-                self.apiclient.stopRouter(cmd)
+                self.stop_router(router)
 
-    def start_router(self):
+    def destroy_routers(self):
+        self.logger.debug('Destroying routers')
+        for router in self.routers:
+            self.stop_router(router)
+            cmd = destroyRouter.destroyRouterCmd()
+            cmd.id = router.id
+            self.apiclient.destroyRouter(cmd)
+        self.routers = []
+
+    def start_routers(self):
         self.check_master_status(2, showall=True)
         self.logger.debug('Starting stopped routers')
         for router in self.routers:
@@ -317,6 +341,7 @@ class TestVPCRedundancy(cloudstackTestCase):
                 conservemode=False)
 
             nw_off.update(self.apiclient, state='Enabled')
+
             self.logger.debug('Created and Enabled NetworkOffering')
 
             self.services["network"]["name"] = "NETWORK-" + str(gateway)
@@ -336,8 +361,14 @@ class TestVPCRedundancy(cloudstackTestCase):
         except Exception, e:
             self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
         o = networkO(obj_network)
-        o.add_vm(self.deployvm_in_network(obj_network))
-        o.add_vm(self.deployvm_in_network(obj_network))
+        
+        vm1 = self.deployvm_in_network(obj_network)
+        vm2 = self.deployvm_in_network(obj_network)
+        self.cleanup.insert(2, obj_network)
+        self.cleanup.insert(3, nw_off)
+        
+        o.add_vm(vm1)
+        o.add_vm(vm2)
         return o
 
     def deployvm_in_network(self, network, host_id=None):
@@ -352,7 +383,9 @@ class TestVPCRedundancy(cloudstackTestCase):
                 networkids=[str(network.id)],
                 hostid=host_id
             )
+
             self.logger.debug('Created VM=%s in network=%s' % (vm.id, network.name))
+            self.cleanup.insert(0, vm)
             return vm
         except:
             self.fail('Unable to create VM in a Network=%s' % network.name)
@@ -394,9 +427,10 @@ class TestVPCRedundancy(cloudstackTestCase):
             traffictype='Ingress'
         )
         self.logger.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
+        
         return nat_rule
 
-    def check_ssh_into_vm(self, vm, public_ip, expectFail=False, retries=20):
+    def check_ssh_into_vm(self, vm, public_ip, expectFail=False, retries=5):
         self.logger.debug("Checking if we can SSH into VM=%s on public_ip=%s (%r)" %
                    (vm.name, public_ip.ipaddress.ipaddress, expectFail))
         vm.ssh_client = None
@@ -429,7 +463,7 @@ class TestVPCRedundancy(cloudstackTestCase):
         self.add_nat_rules()
         self.do_vpc_test(False)
 
-        self.stop_router("MASTER")
+        self.stop_router_by_type("MASTER")
         # wait for the backup router to transit to master state
         time.sleep(30)
         self.check_master_status(1)
@@ -440,7 +474,7 @@ class TestVPCRedundancy(cloudstackTestCase):
         self.check_master_status(1)
         self.do_vpc_test(True)
 
-        self.start_router()
+        self.start_routers()
         self.add_nat_rules()
         time.sleep(45)
         self.check_master_status(2)
@@ -456,8 +490,7 @@ class TestVPCRedundancy(cloudstackTestCase):
         time.sleep(30)
         self.check_master_status(2)
         self.add_nat_rules()
-        self.test_default_routes()
-
+        self.do_default_routes_test()
 
     def delete_nat_rules(self):
         for o in self.networks:
@@ -483,7 +516,7 @@ class TestVPCRedundancy(cloudstackTestCase):
             for vm in o.get_vms():
                 self.check_ssh_into_vm(vm.get_vm(), vm.get_ip(), expectFail=expectFail, retries=retries)
 
-    def test_default_routes(self):
+    def do_default_routes_test(self):
         for o in self.networks:
             for vmObj in o.get_vms():
                 ssh_command = "ping -c 3 8.8.8.8"
@@ -500,7 +533,7 @@ class TestVPCRedundancy(cloudstackTestCase):
                     self.logger.debug("Ping to google.com from VM")
                     result = str(ssh.execute(ssh_command))
 
-                    self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("0% packet loss")))
+                    self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received")))
                 except Exception as e:
                     self.fail("SSH Access failed for %s: %s" % \
                               (vmObj.get_ip(), e)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ed81a69/test/integration/component/test_vpc_router_nics.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_router_nics.py b/test/integration/component/test_vpc_router_nics.py
index db4e27a..cb0734d 100644
--- a/test/integration/component/test_vpc_router_nics.py
+++ b/test/integration/component/test_vpc_router_nics.py
@@ -224,7 +224,6 @@ class TestVPCNics(cloudstackTestCase):
             admin=True,
             domainid=self.domain.id)
 
-        self.cleanup = [self.account]
         self.logger.debug("Creating a VPC offering..")
         self.vpc_off = VpcOffering.create(
             self.apiclient,
@@ -242,10 +241,13 @@ class TestVPCNics(cloudstackTestCase):
             zoneid=self.zone.id,
             account=self.account.name,
             domainid=self.account.domainid)
+        
+        self.cleanup = [self.vpc, self.vpc_off, self.account]
         return
 
     def tearDown(self):
         try:
+            self.destroy_routers()
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             self.logger.debug("Warning: Exception during cleanup : %s" % e)
@@ -261,19 +263,20 @@ class TestVPCNics(cloudstackTestCase):
             isinstance(self.routers, list), True,
             "Check for list routers response return valid data")
 
-    def stop_router(self):
+    def stop_router(self, router):
         self.logger.debug('Stopping router')
-        for router in self.routers:
-            cmd = stopRouter.stopRouterCmd()
-            cmd.id = router.id
-            self.apiclient.stopRouter(cmd)
+        cmd = stopRouter.stopRouterCmd()
+        cmd.id = router.id
+        self.apiclient.stopRouter(cmd)
 
-    def destroy_router(self):
-        self.logger.debug('Stopping router')
+    def destroy_routers(self):
+        self.logger.debug('Destroying routers')
         for router in self.routers:
+            self.stop_router(router)
             cmd = destroyRouter.destroyRouterCmd()
             cmd.id = router.id
             self.apiclient.destroyRouter(cmd)
+        self.routers = []
 
     def create_network(self, net_offerring, gateway='10.1.1.1', vpc=None):
         try:
@@ -299,12 +302,19 @@ class TestVPCNics(cloudstackTestCase):
                 gateway=gateway,
                 vpcid=vpc.id if vpc else self.vpc.id
             )
-            
+
+
             self.logger.debug("Created network with ID: %s" % obj_network.id)
         except Exception, e:
             self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
         o = networkO(obj_network)
-        o.add_vm(self.deployvm_in_network(obj_network))
+        
+        vm1 = self.deployvm_in_network(obj_network)
+
+        self.cleanup.insert(1, obj_network)
+        self.cleanup.insert(2, nw_off)
+
+        o.add_vm(vm1)
         return o
 
     def deployvm_in_network(self, network):
@@ -318,7 +328,9 @@ class TestVPCNics(cloudstackTestCase):
                 serviceofferingid=self.service_offering.id,
                 networkids=[str(network.id)]
             )
+
             self.logger.debug('Created VM=%s in network=%s' % (vm.id, network.name))
+            self.cleanup.insert(0, vm)
             return vm
         except:
             self.fail('Unable to create VM in a Network=%s' % network.name)
@@ -362,17 +374,6 @@ class TestVPCNics(cloudstackTestCase):
         self.logger.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
         return nat_rule
 
-    def check_ssh_into_vm(self, vm, public_ip):
-        self.logger.debug("Checking if we can SSH into VM=%s on public_ip=%s" %
-                   (vm.name, public_ip.ipaddress.ipaddress))
-        vm.ssh_client = None
-        try:
-            vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
-            self.logger.debug("SSH into VM=%s on public_ip=%s is successful" %
-                       (vm.name, public_ip.ipaddress.ipaddress))
-        except:
-            self.fail("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
-
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_01_VPC_nics_after_destroy(self):
         """ Create a VPC with two networks with one VM in each network and test nics after destroy"""
@@ -386,15 +387,16 @@ class TestVPCNics(cloudstackTestCase):
         self.networks.append(net2)
 
         self.add_nat_rules()
-        self.test_ssh_to_vm()
+        self.check_ssh_into_vm()
 
-        self.stop_router()
-        self.destroy_router()
+        self.destroy_routers()
         time.sleep(30)
 
         net1.add_vm(self.deployvm_in_network(net1.get_net()))
+        self.query_routers()
+        
         self.add_nat_rules()
-        self.test_ssh_to_vm()
+        self.check_ssh_into_vm()
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_02_VPC_default_routes(self):
@@ -409,7 +411,7 @@ class TestVPCNics(cloudstackTestCase):
         self.networks.append(net2)
 
         self.add_nat_rules()
-        self.test_default_routes()
+        self.do_default_routes_test()
 
     def delete_nat_rules(self):
         for o in self.networks:
@@ -427,12 +429,25 @@ class TestVPCNics(cloudstackTestCase):
                     vm.set_nat(self.create_natrule(vm.get_vm(), vm.get_ip(), o.get_net()))
                     time.sleep(5)
 
-    def test_ssh_to_vm(self):
+    def check_ssh_into_vm(self):
         for o in self.networks:
             for vm in o.get_vms():
-                self.check_ssh_into_vm(vm.get_vm(), vm.get_ip())
+                try:
+                    virtual_machine = vm.get_vm()
+                    virtual_machine.ssh_client = None
+
+                    public_ip = vm.get_ip()
+
+                    self.logger.debug("Checking if we can SSH into VM=%s on public_ip=%s" %
+                               (virtual_machine.name, public_ip.ipaddress.ipaddress))
+
+                    virtual_machine.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
+                    self.logger.debug("SSH into VM=%s on public_ip=%s is successful" %
+                               (virtual_machine.name, public_ip.ipaddress.ipaddress))
+                except:
+                    self.fail("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
 
-    def test_default_routes(self):
+    def do_default_routes_test(self):
         for o in self.networks:
             for vmObj in o.get_vms():
                 ssh_command = "ping -c 3 8.8.8.8"
@@ -449,7 +464,7 @@ class TestVPCNics(cloudstackTestCase):
                     self.logger.debug("Ping to google.com from VM")
                     result = str(ssh.execute(ssh_command))
 
-                    self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("0% packet loss")))
+                    self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received")))
                 except Exception as e:
                     self.fail("SSH Access failed for %s: %s" % \
                               (vmObj.get_ip(), e)


[10/12] git commit: updated refs/heads/master to ca9e934

Posted by re...@apache.org.
CLOUDSTACK-8915 - Copy the conntrackd configuration every time _redundant_on() function is called

   - Also refactored the copy() function under CsHelper.py


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

Branch: refs/heads/master
Commit: 9fe040e96d589f9f4bf2a0f1463ffceb5f47b843
Parents: a0c93e7
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Mon Oct 5 11:30:18 2015 +0200
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Tue Oct 6 16:41:15 2015 +0200

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py   | 7 +------
 .../patches/debian/config/opt/cloud/bin/cs/CsRedundant.py     | 6 ++++--
 2 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9fe040e9/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
index 6706d4f..9095558 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
@@ -213,12 +213,7 @@ def copy_if_needed(src, dest):
     """
     if os.path.isfile(dest):
         return
-    try:
-        shutil.copy2(src, dest)
-    except IOError:
-        logging.Error("Could not copy %s to %s" % (src, dest))
-    else:
-        logging.info("Copied %s to %s" % (src, dest))
+    copy(src, dest)
 
 def copy(src, dest):
     """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9fe040e9/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
index dcdadfa..0f71673 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -100,9 +100,11 @@ class CsRedundant(object):
         CsHelper.copy_if_needed(
             "%s/%s" % (self.CS_TEMPLATES_DIR, "keepalived.conf.templ"), self.KEEPALIVED_CONF)
         CsHelper.copy_if_needed(
-            "%s/%s" % (self.CS_TEMPLATES_DIR, "conntrackd.conf.templ"), self.CONNTRACKD_CONF)
-        CsHelper.copy_if_needed(
             "%s/%s" % (self.CS_TEMPLATES_DIR, "checkrouter.sh.templ"), "/opt/cloud/bin/checkrouter.sh")
+        #The file is always copied so the RVR doesn't't get the wrong config.
+        #Concerning the r-VPC, the configuration will be applied in a different manner
+        CsHelper.copy(
+            "%s/%s" % (self.CS_TEMPLATES_DIR, "conntrackd.conf.templ"), self.CONNTRACKD_CONF)
 
         CsHelper.execute(
             'sed -i "s/--exec\ \$DAEMON;/--exec\ \$DAEMON\ --\ --vrrp;/g" /etc/init.d/keepalived')


[12/12] git commit: updated refs/heads/master to ca9e934

Posted by re...@apache.org.
Merge pull request #908 from ekholabs/fix/rVPC_routes_CLOUDSTACK-8915

CLOUDSTACK-8915 - Cannot SSH into VMs deployed Redundant VPC routersIn order to reproduce the problem, I did the following

* Create a Redundant VPC
* Add a tier
* Add a new VM to the tier
* Add an ACL, open port 22 and associate the ACL with the tier
* Acquire a pub IP
* Add a PF rule to port 22 towards the VM
* Try to SSH to the VM through the Pub IP

It failed with "No route to host".

This PR contains the following:

* Fix for the keepalived (vrrp) configuration;
* Refactor the default router code for both isolated and [r]VPC routers
* Revert CsRedundant changes
* Add default route tests
* Add logging to tests - so we see what's happening during test execution.

* pr/908:
  CLOUDSTACK-8915 - Making sure cleanup resources passes
  CLOUDSTACK-8915 - Fix the assertion used for the default routes test
  CLOUDSTACK-8915 - Copy the conntrackd configuration every time _redundant_on() function is called
  CLOUDSTACK-8915 - This test is still under construction
  CLOUDSTACK-8915 - Adding logging to tests
  CLOUDSTACK-8915 - Improve routers tests
  CLOUDSTACK-8915 - Reverting changes from commit id 1a02773b556a0efa277cf18cd099fc62a4e27706
  CLOUDSTACK-8915 - Reverting changes from commit id 18dbc0c4cbe506ad698bc513c901dc2d0e48159f
  CLOUDSTACK-8915 - VRRP needs a cidr in order to work properly
  CLOUDSTACK-8915 - Rearrenging a bit the default route code in order to make it more clear
  CLOUDSTACK-8915 - Add the default route only on address that have not been configured yet.

Signed-off-by: Remi Bergsma <gi...@remi.nl>


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

Branch: refs/heads/master
Commit: ca9e934e96d41913bfc3a7687fb574d133383871
Parents: 99059e2 7ed81a6
Author: Remi Bergsma <gi...@remi.nl>
Authored: Fri Oct 9 00:47:52 2015 +0100
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Fri Oct 9 00:47:52 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/configure.py    |   2 +-
 .../debian/config/opt/cloud/bin/cs/CsAddress.py |  75 +-
 .../debian/config/opt/cloud/bin/cs/CsHelper.py  |   7 +-
 .../config/opt/cloud/bin/cs/CsRedundant.py      |  26 +-
 .../debian/config/opt/cloud/bin/cs/CsRoute.py   |   9 +-
 .../test_routers_iptables_default_policy.py     |  73 +-
 .../component/test_routers_network_ops.py       | 725 +++++++++++++++++++
 .../integration/component/test_vpc_redundant.py | 157 ++--
 .../component/test_vpc_router_nics.py           | 157 ++--
 9 files changed, 1071 insertions(+), 160 deletions(-)
----------------------------------------------------------------------