Merge "enable doctor-notification test case"
[functest.git] / functest / opnfv_tests / openstack / snaps / health_check.py
1 # Copyright (c) 2017 Cable Television Laboratories, Inc. and others.
2 #
3 # This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8
9 import unittest
10
11 from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
12     SnapsTestRunner
13 from functest.utils.constants import CONST
14
15 from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase
16 from snaps.openstack.tests.create_instance_tests import SimpleHealthCheck
17
18
19 class HealthCheck(SnapsTestRunner):
20     """
21     This test executes the SNAPS Python Test case SimpleHealthCheck which
22     creates a VM with a single port with an IPv4 address that is assigned by
23     DHCP. This test then validates the expected IP with the actual
24     """
25     def __init__(self, **kwargs):
26         if "case_name" not in kwargs:
27             kwargs["case_name"] = "snaps_images_cirros"
28         super(HealthCheck, self).__init__(**kwargs)
29
30         self.suite = unittest.TestSuite()
31
32     def run(self, **kwargs):
33         """
34         Builds the test suite then calls super.run()
35         :param kwargs: the arguments to pass on
36         :return:
37         """
38         image_custom_config = None
39
40         if hasattr(CONST, 'snaps_images_cirros'):
41             image_custom_config = CONST.__getattribute__('snaps_images_cirros')
42         self.suite.addTest(
43             OSIntegrationTestCase.parameterize(
44                 SimpleHealthCheck, os_creds=self.os_creds,
45                 ext_net_name=self.ext_net_name,
46                 use_keystone=self.use_keystone,
47                 flavor_metadata=self.flavor_metadata,
48                 image_metadata=image_custom_config))
49         return super(self.__class__, self).run()