aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/snaps
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-12-22 20:33:23 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-12-23 14:45:41 +0800
commit645da883ab970d9c738e9534d16357ef256e19c9 (patch)
tree16132a5e3fa6f85f277503f1517508b2fce8ab06 /functest/opnfv_tests/openstack/snaps
parent2632ba86dd920267455ee10154b9e2ce4695a889 (diff)
refactor snaps and example using new constants provider
JIRA: FUNCTEST-673 Change-Id: If20be3c614f729c17bf6484676de7889747a98c0 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'functest/opnfv_tests/openstack/snaps')
-rw-r--r--functest/opnfv_tests/openstack/snaps/api_check.py18
-rw-r--r--functest/opnfv_tests/openstack/snaps/connection_check.py18
-rw-r--r--functest/opnfv_tests/openstack/snaps/smoke.py22
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_utils.py5
4 files changed, 35 insertions, 28 deletions
diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py
index 278892094..17d05b922 100644
--- a/functest/opnfv_tests/openstack/snaps/api_check.py
+++ b/functest/opnfv_tests/openstack/snaps/api_check.py
@@ -5,11 +5,13 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
-import functest.utils.functest_utils as ft_utils
+import unittest
+
+from snaps import test_suite_builder
+
from functest.core.pytest_suite_runner import PyTestSuiteRunner
from functest.opnfv_tests.openstack.snaps import snaps_utils
-from snaps import test_suite_builder
-import unittest
+from functest.utils.constants import CONST
class ApiCheck(PyTestSuiteRunner):
@@ -23,10 +25,10 @@ class ApiCheck(PyTestSuiteRunner):
self.suite = unittest.TestSuite()
self.case_name = "api_check"
- creds_file = ft_utils.get_functest_config('general.openstack.creds')
- use_key = ft_utils.get_functest_config('snaps.use_keystone')
ext_net_name = snaps_utils.get_ext_net_name()
- test_suite_builder.add_openstack_api_tests(self.suite, creds_file,
- ext_net_name,
- use_keystone=use_key)
+ test_suite_builder.add_openstack_api_tests(
+ self.suite,
+ CONST.openstack_creds,
+ ext_net_name,
+ use_keystone=CONST.snaps_use_keystone)
diff --git a/functest/opnfv_tests/openstack/snaps/connection_check.py b/functest/opnfv_tests/openstack/snaps/connection_check.py
index c2f5b1027..11f8ad074 100644
--- a/functest/opnfv_tests/openstack/snaps/connection_check.py
+++ b/functest/opnfv_tests/openstack/snaps/connection_check.py
@@ -5,11 +5,13 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
-import functest.utils.functest_utils as ft_utils
+import unittest
+
+from snaps import test_suite_builder
+
from functest.core.pytest_suite_runner import PyTestSuiteRunner
from functest.opnfv_tests.openstack.snaps import snaps_utils
-from snaps import test_suite_builder
-import unittest
+from functest.utils.constants import CONST
class ConnectionCheck(PyTestSuiteRunner):
@@ -23,10 +25,10 @@ class ConnectionCheck(PyTestSuiteRunner):
self.suite = unittest.TestSuite()
self.case_name = "connection_check"
- creds_file = ft_utils.get_functest_config('general.openstack.creds')
- use_key = ft_utils.get_functest_config('snaps.use_keystone')
ext_net_name = snaps_utils.get_ext_net_name()
- test_suite_builder.add_openstack_client_tests(self.suite, creds_file,
- ext_net_name,
- use_keystone=use_key)
+ test_suite_builder.add_openstack_client_tests(
+ self.suite,
+ CONST.openstack_creds,
+ ext_net_name,
+ use_keystone=CONST.snaps_use_keystone)
diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py
index 691f81384..83eb6600c 100644
--- a/functest/opnfv_tests/openstack/snaps/smoke.py
+++ b/functest/opnfv_tests/openstack/snaps/smoke.py
@@ -5,12 +5,14 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
-import functest.utils.functest_utils as ft_utils
+import os
+import unittest
+
+from snaps import test_suite_builder
+
from functest.core.pytest_suite_runner import PyTestSuiteRunner
from functest.opnfv_tests.openstack.snaps import snaps_utils
-from snaps import test_suite_builder
-import unittest
-import os
+from functest.utils.constants import CONST
class SnapsSmoke(PyTestSuiteRunner):
@@ -24,18 +26,18 @@ class SnapsSmoke(PyTestSuiteRunner):
self.suite = unittest.TestSuite()
self.case_name = "snaps_smoke"
- creds_file = ft_utils.get_functest_config('general.openstack.creds')
- use_key = ft_utils.get_functest_config('snaps.use_keystone')
- use_fip = ft_utils.get_functest_config('snaps.use_floating_ips')
+ use_fip = CONST.snaps_use_floating_ips
ext_net_name = snaps_utils.get_ext_net_name()
# Tests requiring floating IPs leverage files contained within the
# SNAPS repository and are found relative to that path
if use_fip:
- snaps_dir = ft_utils.get_functest_config(
- 'general.dir.dir_repo_snaps') + '/snaps'
+ snaps_dir = CONST.dir_repo_snaps + '/snaps'
os.chdir(snaps_dir)
test_suite_builder.add_openstack_integration_tests(
- self.suite, creds_file, ext_net_name, use_keystone=use_key,
+ self.suite,
+ CONST.openstack_creds,
+ ext_net_name,
+ use_keystone=CONST.snaps_use_keystone,
use_floating_ips=use_fip)
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
index a25ad3e0d..4ea1a04ad 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
@@ -5,17 +5,18 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
-import functest.utils.functest_utils as ft_utils
from snaps.openstack.tests import openstack_tests
from snaps.openstack.utils import neutron_utils
+from functest.utils.constants import CONST
+
def get_ext_net_name():
"""
Returns the first external network name
:return:
"""
- os_env_file = ft_utils.get_functest_config('general.openstack.creds')
+ os_env_file = CONST.openstack_creds
os_creds = openstack_tests.get_credentials(os_env_file=os_env_file)
neutron = neutron_utils.neutron_client(os_creds)
ext_nets = neutron_utils.get_external_networks(neutron)
id='n517' href='#n517'>517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716