SNAPS tests now support offline testing.
[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
14 from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase
15 from snaps.openstack.tests.create_instance_tests import SimpleHealthCheck
16
17
18 class HealthCheck(SnapsTestRunner):
19     """
20     This test executes the SNAPS Python Test case SimpleHealthCheck which
21     creates a VM with a single port with an IPv4 address that is assigned by
22     DHCP. This test then validates the expected IP with the actual
23     """
24     def __init__(self, **kwargs):
25         if "case_name" not in kwargs:
26             kwargs["case_name"] = "snaps_images_cirros"
27         super(HealthCheck, self).__init__(**kwargs)
28
29         self.suite = unittest.TestSuite()
30
31     def run(self, **kwargs):
32         """
33         Builds the test suite then calls super.run()
34         :param kwargs: the arguments to pass on
35         :return:
36         """
37         self.suite.addTest(
38             OSIntegrationTestCase.parameterize(
39                 SimpleHealthCheck, os_creds=self.os_creds,
40                 ext_net_name=self.ext_net_name,
41                 use_keystone=self.use_keystone,
42                 flavor_metadata=self.flavor_metadata,
43                 image_metadata=self.image_metadata))
44         return super(self.__class__, self).run()