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/12/12 11:31:28 UTC

[1/4] git commit: updated refs/heads/master to 7fa62a5

Repository: cloudstack
Updated Branches:
  refs/heads/master 2071a9e39 -> 7fa62a576


CLOUDSTACK-9135 - Moves test into smoke directory

   - Missed this test when moved the other 5 ones.


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

Branch: refs/heads/master
Commit: 632ee18ab709f0d0255796e50198ec8fd97e968a
Parents: 0c7a562
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Thu Dec 10 13:27:53 2015 +0100
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Thu Dec 10 13:27:53 2015 +0100

----------------------------------------------------------------------
 .../component/test_password_server.py           | 351 -------------------
 test/integration/smoke/test_internal_lb.py      | 132 +++++--
 test/integration/smoke/test_password_server.py  | 351 +++++++++++++++++++
 3 files changed, 457 insertions(+), 377 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/632ee18a/test/integration/component/test_password_server.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_password_server.py b/test/integration/component/test_password_server.py
deleted file mode 100644
index 0fc7e25..0000000
--- a/test/integration/component/test_password_server.py
+++ /dev/null
@@ -1,351 +0,0 @@
-# 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.
-
-# 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,
-                             ServiceOffering,
-                             NATRule,
-                             NetworkACL,
-                             FireWallRule,
-                             PublicIPAddress,
-                             NetworkOffering,
-                             Network,
-                             Router)
-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_firewall_rules,
-                               list_hosts)
-
-# Import System modules
-import time
-import logging
-
-
-class TestIsolatedNetworksPasswdServer(cloudstackTestCase):
-
-    @classmethod
-    def setUpClass(cls):
-
-        cls.logger = logging.getLogger('TestIsolatedNetworksPasswdServer')
-        cls.stream_handler = logging.StreamHandler()
-        cls.logger.setLevel(logging.DEBUG)
-        cls.logger.addHandler(cls.stream_handler)
-
-        cls.testClient = super(TestIsolatedNetworksPasswdServer, 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
-
-        cls.logger.debug("Creating Admin Account for domain %s on zone %s" % (cls.domain.id, 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.logger.debug("Creating Service Offering on zone %s" % (cls.zone.id))
-        cls.service_offering = ServiceOffering.create(
-            cls.api_client,
-            cls.services["service_offering"]
-        )
-
-        cls.services["isolated_network_offering"]["egress_policy"] = "true"
-
-        cls.logger.debug("Creating Network Offering on zone %s" % (cls.zone.id))
-        cls.network_offering = NetworkOffering.create(cls.api_client,
-                                                       cls.services["isolated_network_offering"],
-                                                       conservemode=True)
-
-        cls.network_offering.update(cls.api_client, state='Enabled')
-
-        cls.logger.debug("Creating Network for Account %s using offering %s" % (cls.account.name, cls.network_offering.id))
-        cls.network = Network.create(cls.api_client,
-                                      cls.services["network"],
-                                      accountid=cls.account.name,
-                                      domainid=cls.account.domainid,
-                                      networkofferingid=cls.network_offering.id,
-                                      zoneid=cls.zone.id)
-
-        cls.logger.debug("Creating VM1 for Account %s using offering %s" % (cls.account.name, cls.service_offering.id))
-        cls.vm_1 = VirtualMachine.create(cls.api_client,
-                                         cls.services["virtual_machine"],
-                                         templateid=template.id,
-                                         accountid=cls.account.name,
-                                         domainid=cls.domain.id,
-                                         serviceofferingid=cls.service_offering.id,
-                                         networkids=[str(cls.network.id)])
-
-        cls.logger.debug("Creating VM2 for Account %s using offering %s" % (cls.account.name, cls.service_offering.id))
-        cls.vm_2 = VirtualMachine.create(cls.api_client,
-                                         cls.services["virtual_machine"],
-                                         templateid=template.id,
-                                         accountid=cls.account.name,
-                                         domainid=cls.domain.id,
-                                         serviceofferingid=cls.service_offering.id,
-                                         networkids=[str(cls.network.id)])
-
-        cls.services["natrule1"] = {
-            "privateport": 22,
-            "publicport": 222,
-            "protocol": "TCP"
-        }
-
-        cls.services["natrule2"] = {
-            "privateport": 22,
-            "publicport": 223,
-            "protocol": "TCP"
-        }
-
-        cls.services["configurableData"] = {
-            "host": {
-                "password": "password",
-                "username": "root",
-                "port": 22
-            },
-            "input": "INPUT",
-            "forward": "FORWARD"
-        }
-
-        cls._cleanup = [
-            cls.vm_1,
-            cls.vm_2,
-            cls.network,
-            cls.network_offering,
-            cls.service_offering,
-            cls.account
-        ]
-
-        return
-
-    @classmethod
-    def tearDownClass(cls):
-        try:
-            cleanup_resources(cls.api_client, cls._cleanup)
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
-
-    def setUp(self):
-        self.apiclient = self.testClient.getApiClient()
-        return
-
-    def test_ssh_command(self, vm, nat_rule, rule_label):
-        result = 'failed'
-        try:
-            ssh_command = "ping -c 3 8.8.8.8"
-            self.logger.debug("SSH into VM with IP: %s" % nat_rule.ipaddress)
-
-            ssh = vm.get_ssh_client(ipaddress=nat_rule.ipaddress, port=self.services[rule_label]["publicport"], retries=5)
-            result = str(ssh.execute(ssh_command))
-
-            self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received")))
-        except:
-            self.fail("Failed to SSH into VM - %s" % (nat_rule.ipaddress))
-
-        self.assertEqual(
-                         result.count("3 packets received"),
-                         1,
-                         "Ping to outside world from VM should be successful"
-                         )
-
-    def test_password_file_not_empty(self, vm, router):
-        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"]
-        host.port = self.services["configurableData"]["host"]["port"]
-        
-        try:
-            result = get_process_status(
-                host.ipaddress,
-                host.port,
-                host.user,
-                host.passwd,
-                router.linklocalip,
-                "cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}'" % (vm.nic[0].gateway, vm.nic[0].ipaddress))
-        except KeyError:
-            self.skipTest(
-                "Provide a marvin config file with host\
-                        credentials to run %s" %
-                self._testMethodName)
-
-        self.logger.debug("cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}' RESULT IS ==> %s" % (vm.nic[0].gateway, vm.nic[0].ipaddress, result))
-        res = str(result)
-        
-        self.assertEqual(
-            res.count(vm.nic[0].ipaddress),
-            1,
-            "Password file is empty or doesn't exist!")
-
-    @attr(tags=["advanced", "advancedns", "ssh"], required_hardware="true")
-    def test_isolate_network_password_server(self):
-        """Check the password file in the Router VM"""
-
-        self.logger.debug("Starting test_isolate_network_password_server...")
-        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.assertEqual(
-            router.state,
-            'Running',
-            "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]
-
-        self.logger.debug("Creating Firewall rule for VM ID: %s" % self.vm_1.id)
-        FireWallRule.create(
-            self.apiclient,
-            ipaddressid=public_ip.id,
-            protocol=self.services["natrule1"]["protocol"],
-            cidrlist=['0.0.0.0/0'],
-            startport=self.services["natrule1"]["publicport"],
-            endport=self.services["natrule1"]["publicport"]
-        )
-
-        self.logger.debug("Creating NAT rule for VM ID: %s" % self.vm_1.id)
-        # Create NAT rule
-        nat_rule1 = NATRule.create(
-            self.apiclient,
-            self.vm_1,
-            self.services["natrule1"],
-            public_ip.id
-        )
-
-        self.logger.debug("Creating Firewall rule for VM ID: %s" % self.vm_2.id)
-        FireWallRule.create(
-            self.apiclient,
-            ipaddressid=public_ip.id,
-            protocol=self.services["natrule2"]["protocol"],
-            cidrlist=['0.0.0.0/0'],
-            startport=self.services["natrule2"]["publicport"],
-            endport=self.services["natrule2"]["publicport"]
-        )
-
-        self.logger.debug("Creating NAT rule for VM ID: %s" % self.vm_2.id)
-        # Create NAT rule
-        nat_rule2 = NATRule.create(
-            self.apiclient,
-            self.vm_2,
-            self.services["natrule2"],
-            public_ip.id
-        )
-
-        nat_rules = list_nat_rules(
-            self.apiclient,
-            id=nat_rule1.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"
-        )
-        
-        nat_rules = list_nat_rules(
-            self.apiclient,
-            id=nat_rule2.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"
-        )
-        
-        self.test_ssh_command(self.vm_1, nat_rule1, "natrule1")
-        self.test_ssh_command(self.vm_2, nat_rule2, "natrule2")
-
-        self.test_password_file_not_empty(self.vm_1, router)
-        self.test_password_file_not_empty(self.vm_2, router)
-
-        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/632ee18a/test/integration/smoke/test_internal_lb.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py
index 0807b2a..7f03eb1 100644
--- a/test/integration/smoke/test_internal_lb.py
+++ b/test/integration/smoke/test_internal_lb.py
@@ -128,7 +128,7 @@ class Services:
                 },
                 "egress_policy": "true",
             },
-            "vpc_offering": {
+            "redundant_vpc_offering": {
                 "name": 'Redundant VPC off',
                 "displaytext": 'Redundant VPC off',
                 "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat',
@@ -149,6 +149,12 @@ class Services:
                     }
                 },
             },
+            "vpc_offering": {
+                "name": "VPC off",
+                "displaytext": "VPC off",
+                "supportedservices":
+                    "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL"
+            },
             "vpc": {
                 "name": "TestVPC",
                 "displaytext": "TestVPC",
@@ -286,9 +292,12 @@ class TestInternalLb(cloudstackTestCase):
                    %s" % (cls.account.name,
                           cls.account.id))
 
-        cls.cleanup = [cls.template, cls.account, cls.compute_offering]
+        cls._cleanup = [cls.template, cls.account, cls.compute_offering]
         return
 
+    def setUp(self):
+        self.cleanup = []
+
     def get_networkoffering_state(self, offering):
         result = list_network_offerings(self.apiclient, id=offering.id)
         if result:
@@ -314,39 +323,34 @@ class TestInternalLb(cloudstackTestCase):
                     offering), "Enabled", "Failed to enable network offering")
 
                 self.logger.debug("Enabled network offering: %s" % offering.id)
+
+                self.cleanup.insert(0, offering)
                 return offering
 
         except Exception as e:
-            self.fail("Failed to create and enable network offering: %s because of %s" % (
-                offering_name, e))
+            self.fail("Failed to create and enable network offering due to %s" % e)
 
-    def create_vpc(self, name, cidr):
-        print name, cidr
+    def create_vpc(self, vpc_offering):
+        self.logger.debug("Creating VPC using offering ==> ID %s / Name %s" % (vpc_offering.id, vpc_offering.name))
         try:
-            vpcOffering = VpcOffering.list(self.apiclient, isdefault=True)
-            self.assert_(vpcOffering is not None and len(
-                vpcOffering) > 0, "No VPC offerings found")
-
-            self.services["vpc"] = {}
-            self.services["vpc"]["name"] = name
-            self.services["vpc"]["displaytext"] = name
-            self.services["vpc"]["cidr"] = cidr
-
             vpc = VPC.create(
                 apiclient=self.apiclient,
                 services=self.services["vpc"],
                 networkDomain="vpc.internallb",
-                vpcofferingid=vpcOffering[0].id,
+                vpcofferingid=vpc_offering.id,
                 zoneid=self.zone.id,
                 account=self.account.name,
                 domainid=self.domain.id
             )
+
             self.assertIsNotNone(vpc, "VPC creation failed")
             self.logger.debug("Created VPC %s" % vpc.id)
+
+            self.cleanup.insert(0, vpc)
             return vpc
 
         except Exception as e:
-            self.fail("Failed to create VPC: %s due to %s" % (name, e))
+            self.fail("Failed to create VPC due to %s" % e)
 
     def create_network_tier(self, name, vpcid, gateway, network_offering):
         self.services["network"]["name"] = name
@@ -367,10 +371,12 @@ class TestInternalLb(cloudstackTestCase):
                 netmask=self.services["network"]["netmask"],
                 aclid=default_acl.id
             )
+
             self.assertIsNotNone(network, "Network failed to create")
             self.logger.debug(
                 "Created network %s in VPC %s" % (network.id, vpcid))
 
+            self.cleanup.insert(0, network)
             return network
 
         except Exception as e:
@@ -393,6 +399,7 @@ class TestInternalLb(cloudstackTestCase):
             self.assert_(vm.state == 'Running', "VM is not running")
             self.logger.debug("Deployed VM id: %s in VPC %s" % (vm.id, vpc.id))
 
+            self.cleanup.insert(0, vm)
             return vm
 
         except Exception as e:
@@ -565,8 +572,41 @@ class TestInternalLb(cloudstackTestCase):
 
     @attr(tags=["smoke", "advanced"], required_hardware="true")
     def test_01_internallb_roundrobin_1VPC_3VM_HTTP_port80(self):
-        """Test create, assign, remove of an Internal LB with roundrobin http traffic to 3 vm's
         """
+           Test create, assign, remove of an Internal LB with roundrobin http traffic to 3 vm's in a Single VPC
+        """
+        self.logger.debug("Starting test_01_internallb_roundrobin_1VPC_3VM_HTTP_port80")
+
+        self.logger.debug("Creating a VPC offering..")
+        vpc_offering = VpcOffering.create(
+            self.apiclient,
+            self.services["vpc_offering"])
+
+        self.logger.debug("Enabling the VPC offering created")
+        vpc_offering.update(self.apiclient, state='Enabled')
+
+        self.cleanup.insert(0, vpc_offering)
+        self.execute_internallb_roundrobin_tests(vpc_offering)
+
+    @attr(tags=["smoke", "advanced"], required_hardware="true")
+    def test_02_internallb_roundrobin_1RVPC_3VM_HTTP_port80(self):
+        """
+           Test create, assign, remove of an Internal LB with roundrobin http traffic to 3 vm's in a Redundant VPC
+        """
+        self.logger.debug("Starting test_02_internallb_roundrobin_1RVPC_3VM_HTTP_port80")
+
+        self.logger.debug("Creating a Redundant VPC offering..")
+        redundant_vpc_offering = VpcOffering.create(
+            self.apiclient,
+            self.services["redundant_vpc_offering"])
+
+        self.logger.debug("Enabling the Redundant VPC offering created")
+        redundant_vpc_offering.update(self.apiclient, state='Enabled')
+
+        self.cleanup.insert(0, redundant_vpc_offering)
+        self.execute_internallb_roundrobin_tests(redundant_vpc_offering)
+
+    def execute_internallb_roundrobin_tests(self, vpc_offering):
         max_http_requests = 30
         algorithm = "roundrobin"
         public_lb_port = 80
@@ -582,7 +622,7 @@ class TestInternalLb(cloudstackTestCase):
             self.services["network_offering_internal_lb"])
 
         # Create VPC
-        vpc = self.create_vpc("vpc_intlb_test01", "10.1.0.0/16")
+        vpc = self.create_vpc(vpc_offering)
 
         # Create network tiers
         network_guestnet = self.create_network_tier(
@@ -692,14 +732,48 @@ class TestInternalLb(cloudstackTestCase):
             return False
 
     @attr(tags=["smoke", "advanced"], required_hardware="true")
-    def test02_internallb_haproxy_stats_on_all_interfaces(self):
+    def test_03_vpc_internallb_haproxy_stats_on_all_interfaces(self):
         """ Test to verify access to loadbalancer haproxy admin stats page
             when global setting network.loadbalancer.haproxy.stats.visibility is set to 'all'
             with credentials from global setting network.loadbalancer.haproxy.stats.auth
-            using the uri from global setting network.loadbalancer.haproxy.stats.uri"""
+            using the uri from global setting network.loadbalancer.haproxy.stats.uri.
 
-        self.logger.debug(
-            "Starting test_02_internallb_haproxy_stats_on_all_interfaces")
+            It uses a Single Router VPC
+        """
+        self.logger.debug("Starting test_03_vpc_internallb_haproxy_stats_on_all_interfaces")
+
+        self.logger.debug("Creating a VPC offering..")
+        vpc_offering = VpcOffering.create(
+            self.apiclient,
+            self.services["vpc_offering"])
+
+        self.logger.debug("Enabling the VPC offering created")
+        vpc_offering.update(self.apiclient, state='Enabled')
+
+        self.execute_internallb_haproxy_tests(vpc_offering)
+
+    @attr(tags=["smoke", "advanced"], required_hardware="true")
+    def test_04_rvpc_internallb_haproxy_stats_on_all_interfaces(self):
+        """ Test to verify access to loadbalancer haproxy admin stats page
+            when global setting network.loadbalancer.haproxy.stats.visibility is set to 'all'
+            with credentials from global setting network.loadbalancer.haproxy.stats.auth
+            using the uri from global setting network.loadbalancer.haproxy.stats.uri.
+
+            It uses a Redundant Routers VPC
+        """
+        self.logger.debug("Starting test_04_rvpc_internallb_haproxy_stats_on_all_interfaces")
+
+        self.logger.debug("Creating a Redundant VPC offering..")
+        redundant_vpc_offering = VpcOffering.create(
+            self.apiclient,
+            self.services["redundant_vpc_offering"])
+
+        self.logger.debug("Enabling the Redundant VPC offering created")
+        redundant_vpc_offering.update(self.apiclient, state='Enabled')
+
+        self.execute_internallb_haproxy_tests(redundant_vpc_offering)
+
+    def execute_internallb_haproxy_tests(self, vpc_offering):
 
         settings = self.get_lb_stats_settings()
 
@@ -720,7 +794,7 @@ class TestInternalLb(cloudstackTestCase):
             self.services["network_offering_internal_lb"])
 
         # Create VPC
-        vpc = self.create_vpc("vpc_intlb_test_02", "10.1.0.0/16")
+        vpc = self.create_vpc(vpc_offering)
 
         # Create network tier with internal lb service enabled
         network_internal_lb = self.create_network_tier(
@@ -757,8 +831,14 @@ class TestInternalLb(cloudstackTestCase):
     @classmethod
     def tearDownClass(cls):
         try:
-            cls.logger.debug("Cleaning up testcase resources")
-            cleanup_resources(cls.apiclient, cls.cleanup)
+            cls.logger.debug("Cleaning up class resources")
+            cleanup_resources(cls.apiclient, cls._cleanup)
+        except Exception as e:
+            raise Exception("Cleanup failed with %s" % e)
 
+    def tearDown(self):
+        try:
+            self.logger.debug("Cleaning up test resources")
+            cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Cleanup failed with %s" % e)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/632ee18a/test/integration/smoke/test_password_server.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_password_server.py b/test/integration/smoke/test_password_server.py
new file mode 100644
index 0000000..0fc7e25
--- /dev/null
+++ b/test/integration/smoke/test_password_server.py
@@ -0,0 +1,351 @@
+# 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.
+
+# 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,
+                             ServiceOffering,
+                             NATRule,
+                             NetworkACL,
+                             FireWallRule,
+                             PublicIPAddress,
+                             NetworkOffering,
+                             Network,
+                             Router)
+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_firewall_rules,
+                               list_hosts)
+
+# Import System modules
+import time
+import logging
+
+
+class TestIsolatedNetworksPasswdServer(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.logger = logging.getLogger('TestIsolatedNetworksPasswdServer')
+        cls.stream_handler = logging.StreamHandler()
+        cls.logger.setLevel(logging.DEBUG)
+        cls.logger.addHandler(cls.stream_handler)
+
+        cls.testClient = super(TestIsolatedNetworksPasswdServer, 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
+
+        cls.logger.debug("Creating Admin Account for domain %s on zone %s" % (cls.domain.id, 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.logger.debug("Creating Service Offering on zone %s" % (cls.zone.id))
+        cls.service_offering = ServiceOffering.create(
+            cls.api_client,
+            cls.services["service_offering"]
+        )
+
+        cls.services["isolated_network_offering"]["egress_policy"] = "true"
+
+        cls.logger.debug("Creating Network Offering on zone %s" % (cls.zone.id))
+        cls.network_offering = NetworkOffering.create(cls.api_client,
+                                                       cls.services["isolated_network_offering"],
+                                                       conservemode=True)
+
+        cls.network_offering.update(cls.api_client, state='Enabled')
+
+        cls.logger.debug("Creating Network for Account %s using offering %s" % (cls.account.name, cls.network_offering.id))
+        cls.network = Network.create(cls.api_client,
+                                      cls.services["network"],
+                                      accountid=cls.account.name,
+                                      domainid=cls.account.domainid,
+                                      networkofferingid=cls.network_offering.id,
+                                      zoneid=cls.zone.id)
+
+        cls.logger.debug("Creating VM1 for Account %s using offering %s" % (cls.account.name, cls.service_offering.id))
+        cls.vm_1 = VirtualMachine.create(cls.api_client,
+                                         cls.services["virtual_machine"],
+                                         templateid=template.id,
+                                         accountid=cls.account.name,
+                                         domainid=cls.domain.id,
+                                         serviceofferingid=cls.service_offering.id,
+                                         networkids=[str(cls.network.id)])
+
+        cls.logger.debug("Creating VM2 for Account %s using offering %s" % (cls.account.name, cls.service_offering.id))
+        cls.vm_2 = VirtualMachine.create(cls.api_client,
+                                         cls.services["virtual_machine"],
+                                         templateid=template.id,
+                                         accountid=cls.account.name,
+                                         domainid=cls.domain.id,
+                                         serviceofferingid=cls.service_offering.id,
+                                         networkids=[str(cls.network.id)])
+
+        cls.services["natrule1"] = {
+            "privateport": 22,
+            "publicport": 222,
+            "protocol": "TCP"
+        }
+
+        cls.services["natrule2"] = {
+            "privateport": 22,
+            "publicport": 223,
+            "protocol": "TCP"
+        }
+
+        cls.services["configurableData"] = {
+            "host": {
+                "password": "password",
+                "username": "root",
+                "port": 22
+            },
+            "input": "INPUT",
+            "forward": "FORWARD"
+        }
+
+        cls._cleanup = [
+            cls.vm_1,
+            cls.vm_2,
+            cls.network,
+            cls.network_offering,
+            cls.service_offering,
+            cls.account
+        ]
+
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        return
+
+    def test_ssh_command(self, vm, nat_rule, rule_label):
+        result = 'failed'
+        try:
+            ssh_command = "ping -c 3 8.8.8.8"
+            self.logger.debug("SSH into VM with IP: %s" % nat_rule.ipaddress)
+
+            ssh = vm.get_ssh_client(ipaddress=nat_rule.ipaddress, port=self.services[rule_label]["publicport"], retries=5)
+            result = str(ssh.execute(ssh_command))
+
+            self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received")))
+        except:
+            self.fail("Failed to SSH into VM - %s" % (nat_rule.ipaddress))
+
+        self.assertEqual(
+                         result.count("3 packets received"),
+                         1,
+                         "Ping to outside world from VM should be successful"
+                         )
+
+    def test_password_file_not_empty(self, vm, router):
+        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"]
+        host.port = self.services["configurableData"]["host"]["port"]
+        
+        try:
+            result = get_process_status(
+                host.ipaddress,
+                host.port,
+                host.user,
+                host.passwd,
+                router.linklocalip,
+                "cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}'" % (vm.nic[0].gateway, vm.nic[0].ipaddress))
+        except KeyError:
+            self.skipTest(
+                "Provide a marvin config file with host\
+                        credentials to run %s" %
+                self._testMethodName)
+
+        self.logger.debug("cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}' RESULT IS ==> %s" % (vm.nic[0].gateway, vm.nic[0].ipaddress, result))
+        res = str(result)
+        
+        self.assertEqual(
+            res.count(vm.nic[0].ipaddress),
+            1,
+            "Password file is empty or doesn't exist!")
+
+    @attr(tags=["advanced", "advancedns", "ssh"], required_hardware="true")
+    def test_isolate_network_password_server(self):
+        """Check the password file in the Router VM"""
+
+        self.logger.debug("Starting test_isolate_network_password_server...")
+        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.assertEqual(
+            router.state,
+            'Running',
+            "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]
+
+        self.logger.debug("Creating Firewall rule for VM ID: %s" % self.vm_1.id)
+        FireWallRule.create(
+            self.apiclient,
+            ipaddressid=public_ip.id,
+            protocol=self.services["natrule1"]["protocol"],
+            cidrlist=['0.0.0.0/0'],
+            startport=self.services["natrule1"]["publicport"],
+            endport=self.services["natrule1"]["publicport"]
+        )
+
+        self.logger.debug("Creating NAT rule for VM ID: %s" % self.vm_1.id)
+        # Create NAT rule
+        nat_rule1 = NATRule.create(
+            self.apiclient,
+            self.vm_1,
+            self.services["natrule1"],
+            public_ip.id
+        )
+
+        self.logger.debug("Creating Firewall rule for VM ID: %s" % self.vm_2.id)
+        FireWallRule.create(
+            self.apiclient,
+            ipaddressid=public_ip.id,
+            protocol=self.services["natrule2"]["protocol"],
+            cidrlist=['0.0.0.0/0'],
+            startport=self.services["natrule2"]["publicport"],
+            endport=self.services["natrule2"]["publicport"]
+        )
+
+        self.logger.debug("Creating NAT rule for VM ID: %s" % self.vm_2.id)
+        # Create NAT rule
+        nat_rule2 = NATRule.create(
+            self.apiclient,
+            self.vm_2,
+            self.services["natrule2"],
+            public_ip.id
+        )
+
+        nat_rules = list_nat_rules(
+            self.apiclient,
+            id=nat_rule1.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"
+        )
+        
+        nat_rules = list_nat_rules(
+            self.apiclient,
+            id=nat_rule2.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"
+        )
+        
+        self.test_ssh_command(self.vm_1, nat_rule1, "natrule1")
+        self.test_ssh_command(self.vm_2, nat_rule2, "natrule2")
+
+        self.test_password_file_not_empty(self.vm_1, router)
+        self.test_password_file_not_empty(self.vm_2, router)
+
+        return


[2/4] git commit: updated refs/heads/master to 7fa62a5

Posted by re...@apache.org.
CLOUDSTACK-9135 - Makes possible to add multiple providers per service

   - Same is done in the Java side. Check the createVpcOffering() method in the VpcManagerImpl class


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

Branch: refs/heads/master
Commit: 590af145b0c703f9c957c6f81ef450856dc2c407
Parents: 632ee18
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Fri Dec 11 15:02:55 2015 +0100
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Fri Dec 11 15:02:55 2015 +0100

----------------------------------------------------------------------
 tools/marvin/marvin/lib/base.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/590af145/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 4b04e77..ab15a78 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -4055,17 +4055,25 @@ class VpcOffering:
     @classmethod
     def create(cls, apiclient, services):
         """Create vpc offering"""
-
+        
+        import logging
+        
         cmd = createVPCOffering.createVPCOfferingCmd()
         cmd.name = "-".join([services["name"], random_gen()])
         cmd.displaytext = services["displaytext"]
         cmd.supportedServices = services["supportedservices"]
         if "serviceProviderList" in services:
             for service, provider in services["serviceProviderList"].items():
-                cmd.serviceproviderlist.append({
-                    'service': service,
-                    'provider': provider
-                })
+                providers = provider
+                if isinstance(provider, str):
+                    providers = [provider]
+
+                for provider_item in providers:
+                    cmd.serviceproviderlist.append({
+                        'service': service,
+                        'provider': provider_item
+                    })
+
         if "serviceCapabilityList" in services:
             cmd.servicecapabilitylist = []
             for service, capability in \


[4/4] git commit: updated refs/heads/master to 7fa62a5

Posted by re...@apache.org.
Merge pull request #1221 from ekholabs/improve/test-internal-lb-CLOUDSTACK-9135

CLOUDSTACK-9135 - As a Developer I want the test_internal_lb.py to test Redundant VPCsThis PR refactors the existing tests and adds tests to cover internal LB with Redundant VPCs.

In order to make it possible I had to change the base.py, allowing multiple providers per service. This change requires the changes in the Java side which were dealt with PR #1215 .

* pr/1221:
  CLOUDSTACK-9135 - Makes test compliant with Redundant VPCs
  CLOUDSTACK-9135 - Makes possible to add multiple providers per service
  CLOUDSTACK-9135 - Moves test into smoke directory

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/7fa62a57
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7fa62a57
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7fa62a57

Branch: refs/heads/master
Commit: 7fa62a576523ad7740563d7626b4caec6c040735
Parents: 2071a9e 43ce049
Author: Remi Bergsma <gi...@remi.nl>
Authored: Sat Dec 12 11:29:28 2015 +0100
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Sat Dec 12 11:29:29 2015 +0100

----------------------------------------------------------------------
 .../component/test_password_server.py           | 351 -------------------
 test/integration/smoke/test_internal_lb.py      | 146 ++++++--
 test/integration/smoke/test_password_server.py  | 351 +++++++++++++++++++
 tools/marvin/marvin/lib/base.py                 |  18 +-
 4 files changed, 482 insertions(+), 384 deletions(-)
----------------------------------------------------------------------



[3/4] git commit: updated refs/heads/master to 7fa62a5

Posted by re...@apache.org.
CLOUDSTACK-9135 - Makes test compliant with Redundant VPCs


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

Branch: refs/heads/master
Commit: 43ce049d43ce7aa0e4d25b0630cbcd1c423156b9
Parents: 590af14
Author: Wilder Rodrigues <wr...@schubergphilis.com>
Authored: Fri Dec 11 15:03:50 2015 +0100
Committer: Wilder Rodrigues <wr...@schubergphilis.com>
Committed: Fri Dec 11 15:03:50 2015 +0100

----------------------------------------------------------------------
 test/integration/smoke/test_internal_lb.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43ce049d/test/integration/smoke/test_internal_lb.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py
index 7f03eb1..c4be42b 100644
--- a/test/integration/smoke/test_internal_lb.py
+++ b/test/integration/smoke/test_internal_lb.py
@@ -137,8 +137,8 @@ class Services:
                     "Dhcp": 'VpcVirtualRouter',
                     "Dns": 'VpcVirtualRouter',
                     "SourceNat": 'VpcVirtualRouter',
+                    "Lb" : ["InternalLbVm", "VpcVirtualRouter"],
                     "PortForwarding": 'VpcVirtualRouter',
-                    "Lb": 'VpcVirtualRouter',
                     "UserData": 'VpcVirtualRouter',
                     "StaticNat": 'VpcVirtualRouter',
                     "NetworkACL": 'VpcVirtualRouter'
@@ -146,14 +146,24 @@ class Services:
                 "serviceCapabilityList": {
                     "SourceNat": {
                         "RedundantRouter": 'true'
-                    }
+                    },
                 },
             },
             "vpc_offering": {
                 "name": "VPC off",
                 "displaytext": "VPC off",
-                "supportedservices":
-                    "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL"
+                "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL",
+                "serviceProviderList": {
+                    "Vpn": 'VpcVirtualRouter',
+                    "Dhcp": 'VpcVirtualRouter',
+                    "Dns": 'VpcVirtualRouter',
+                    "SourceNat": 'VpcVirtualRouter',
+                    "Lb" : ["InternalLbVm", "VpcVirtualRouter"],
+                    "PortForwarding": 'VpcVirtualRouter',
+                    "UserData": 'VpcVirtualRouter',
+                    "StaticNat": 'VpcVirtualRouter',
+                    "NetworkACL": 'VpcVirtualRouter'
+                },
             },
             "vpc": {
                 "name": "TestVPC",