Merge "Add functional test for ResourceGroup rolling_update"
diff --git a/common/test.py b/common/test.py
index a451fcb..31ec52c 100644
--- a/common/test.py
+++ b/common/test.py
@@ -18,6 +18,7 @@
 
 import fixtures
 from heatclient import exc as heat_exceptions
+from neutronclient.common import exceptions as network_exceptions
 from oslo_log import log as logging
 from oslo_utils import timeutils
 import six
@@ -175,6 +176,13 @@
             if net['name'] == net_name:
                 return net
 
+    def is_network_extension_supported(self, extension_alias):
+        try:
+            self.network_client.show_extension(extension_alias)
+        except network_exceptions.NeutronClientException:
+            return False
+        return True
+
     @staticmethod
     def _stack_output(stack, output_key, validate_errors=True):
         """Return a stack output value for a given key."""
diff --git a/functional/test_autoscaling.py b/functional/test_autoscaling.py
index 5c2d1af..df8c54b 100644
--- a/functional/test_autoscaling.py
+++ b/functional/test_autoscaling.py
@@ -346,8 +346,7 @@
     def update_instance_group(self, updt_template,
                               num_updates_expected_on_updt,
                               num_creates_expected_on_updt,
-                              num_deletes_expected_on_updt,
-                              update_replace):
+                              num_deletes_expected_on_updt):
 
         # setup stack from the initial template
         files = {'provider.yaml': self.instance_template}
@@ -430,8 +429,7 @@
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=10,
                                    num_creates_expected_on_updt=0,
-                                   num_deletes_expected_on_updt=0,
-                                   update_replace=True)
+                                   num_deletes_expected_on_updt=0)
 
     def test_instance_group_update_replace_with_adjusted_capacity(self):
         """Test update replace with capacity adjustment.
@@ -450,8 +448,7 @@
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=8,
                                    num_creates_expected_on_updt=2,
-                                   num_deletes_expected_on_updt=2,
-                                   update_replace=True)
+                                   num_deletes_expected_on_updt=2)
 
     def test_instance_group_update_replace_huge_batch_size(self):
         """Test update replace with a huge batch size."""
@@ -466,8 +463,7 @@
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=10,
                                    num_creates_expected_on_updt=0,
-                                   num_deletes_expected_on_updt=0,
-                                   update_replace=True)
+                                   num_deletes_expected_on_updt=0)
 
     def test_instance_group_update_replace_huge_min_in_service(self):
         """Update replace with huge number of minimum instances in service."""
@@ -483,8 +479,7 @@
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=9,
                                    num_creates_expected_on_updt=1,
-                                   num_deletes_expected_on_updt=1,
-                                   update_replace=True)
+                                   num_deletes_expected_on_updt=1)
 
     def test_instance_group_update_no_replace(self):
         """Test simple update only and no replace.
@@ -505,8 +500,7 @@
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=10,
                                    num_creates_expected_on_updt=0,
-                                   num_deletes_expected_on_updt=0,
-                                   update_replace=False)
+                                   num_deletes_expected_on_updt=0)
 
     def test_instance_group_update_no_replace_with_adjusted_capacity(self):
         """Test update only and no replace with capacity adjustment.
@@ -527,8 +521,7 @@
         self.update_instance_group(updt_template,
                                    num_updates_expected_on_updt=8,
                                    num_creates_expected_on_updt=2,
-                                   num_deletes_expected_on_updt=2,
-                                   update_replace=False)
+                                   num_deletes_expected_on_updt=2)
 
 
 class AutoScalingSignalTest(AutoscalingGroupTest):
diff --git a/scenario/test_autoscaling_lb.py b/scenario/test_autoscaling_lb.py
index 1d4d41d..bba55e1 100644
--- a/scenario/test_autoscaling_lb.py
+++ b/scenario/test_autoscaling_lb.py
@@ -20,7 +20,7 @@
 
 
 class AutoscalingLoadBalancerTest(scenario_base.ScenarioTestsBase):
-    """The class is responsible for testing ASG + LB scenario.
+    """The class is responsible for testing ASG + LBv1 scenario.
 
     The very common use case tested is an autoscaling group
     of some web application servers behind a loadbalancer.
@@ -31,6 +31,8 @@
         self.template_name = 'test_autoscaling_lb_neutron.yaml'
         self.app_server_template_name = 'app_server_neutron.yaml'
         self.webapp_template_name = 'netcat-webapp.yaml'
+        if not self.is_network_extension_supported('lbaas'):
+            self.skipTest('LBaas v1 extension not available, skipping')
 
     def check_num_responses(self, url, expected_num, retries=10):
         resp = set()
@@ -51,7 +53,7 @@
         return all_res and all_res_complete
 
     def test_autoscaling_loadbalancer_neutron(self):
-        """Check work of AutoScaing and Neutron LBaaS resource in Heat.
+        """Check work of AutoScaing and Neutron LBaaS v1 resource in Heat.
 
         The scenario is the following:
             1. Launch a stack with a load balancer and autoscaling group
diff --git a/scenario/test_autoscaling_lbv2.py b/scenario/test_autoscaling_lbv2.py
new file mode 100644
index 0000000..861943a
--- /dev/null
+++ b/scenario/test_autoscaling_lbv2.py
@@ -0,0 +1,47 @@
+#
+# Licensed 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.
+
+from heat_integrationtests.scenario import scenario_base
+
+
+class AutoscalingLoadBalancerv2Test(scenario_base.ScenarioTestsBase):
+    """The class is responsible for testing ASG + LBv2 scenario.
+
+    The very common use case tested is an autoscaling group
+    of some web application servers behind a loadbalancer.
+    """
+
+    def setUp(self):
+        super(AutoscalingLoadBalancerv2Test, self).setUp()
+        self.template_name = 'test_autoscaling_lbv2_neutron.yaml'
+        self.app_server_template_name = 'app_server_lbv2_neutron.yaml'
+        self.webapp_template_name = 'netcat-webapp.yaml'
+        if not self.is_network_extension_supported('lbaasv2'):
+            self.skipTest('LBaasv2 extension not available, skipping')
+
+    def test_autoscaling_loadbalancer_neutron(self):
+        """Check work of AutoScaing and Neutron LBaaS v2 resource in Heat.
+
+        The scenario is the following:
+            1. Launch a stack with a load balancer and autoscaling group
+               of one server, wait until stack create is complete.
+            2. Check that there is only one distinctive response from
+               loadbalanced IP.
+            3. Signal the scale_up policy, wait until all resources in
+               autoscaling group are complete.
+            4. Check that now there are two distinctive responses from
+               loadbalanced IP.
+        """
+
+        # TODO(MRV): Place holder for AutoScaing and Neutron LBaaS v2 test
+        pass