From 601ead6cc5e04f276d57d118e1d94d1366278a24 Mon Sep 17 00:00:00 2001 From: DR695H Date: Fri, 19 Jul 2019 14:29:09 -0400 Subject: moving all libs to global scope Issue-ID: TEST-174 Change-Id: Ieae316661540206eb1e74126f8b8859e373e3786 Signed-off-by: DR695H --- robotframework-onap/ONAPLibrary/JSON.py | 2 ++ robotframework-onap/ONAPLibrary/Kafka.py | 2 ++ robotframework-onap/ONAPLibrary/MUSIC.py | 2 ++ robotframework-onap/ONAPLibrary/OOF.py | 2 ++ robotframework-onap/ONAPLibrary/Openstack.py | 2 ++ robotframework-onap/ONAPLibrary/PreloadData.py | 2 ++ robotframework-onap/ONAPLibrary/Protobuf.py | 2 ++ robotframework-onap/ONAPLibrary/SDC.py | 2 ++ robotframework-onap/ONAPLibrary/SDNC.py | 2 ++ robotframework-onap/ONAPLibrary/SO.py | 2 ++ robotframework-onap/ONAPLibrary/ServiceMapping.py | 2 ++ robotframework-onap/ONAPLibrary/Templating.py | 2 ++ robotframework-onap/ONAPLibrary/Utilities.py | 2 ++ .../ONAPLibrary/ServiceMappingKeywordsTests.py | 33 ++++++++++++++++++++++ .../tests/ONAPLibrary/vFW/service_mapping.json | 20 +++++++++++++ robotframework-onap/tests/runner.py | 2 ++ 16 files changed, 81 insertions(+) create mode 100644 robotframework-onap/tests/ONAPLibrary/ServiceMappingKeywordsTests.py create mode 100644 robotframework-onap/tests/ONAPLibrary/vFW/service_mapping.json diff --git a/robotframework-onap/ONAPLibrary/JSON.py b/robotframework-onap/ONAPLibrary/JSON.py index 1cb67dd..b3ef653 100644 --- a/robotframework-onap/ONAPLibrary/JSON.py +++ b/robotframework-onap/ONAPLibrary/JSON.py @@ -21,6 +21,8 @@ class JSON(HybridCore): """JSON is common resource for simple json helper keywords. """ + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ JSONKeywords(), diff --git a/robotframework-onap/ONAPLibrary/Kafka.py b/robotframework-onap/ONAPLibrary/Kafka.py index 5ff8b21..e089531 100644 --- a/robotframework-onap/ONAPLibrary/Kafka.py +++ b/robotframework-onap/ONAPLibrary/Kafka.py @@ -19,6 +19,8 @@ from ONAPLibrary.KafkaKeywords import KafkaKeywords class Kafka(HybridCore): """ Utilities useful for Kafka consuming and producing """ + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ KafkaKeywords() diff --git a/robotframework-onap/ONAPLibrary/MUSIC.py b/robotframework-onap/ONAPLibrary/MUSIC.py index 29ebd9c..88eb405 100644 --- a/robotframework-onap/ONAPLibrary/MUSIC.py +++ b/robotframework-onap/ONAPLibrary/MUSIC.py @@ -20,6 +20,8 @@ class MUSIC(HybridCore): """MUSIC is an ONAP testing library for Robot Framework that provides functionality for interacting with the music component. """ + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ MUSICKeywords() diff --git a/robotframework-onap/ONAPLibrary/OOF.py b/robotframework-onap/ONAPLibrary/OOF.py index d1cc864..34b93ea 100644 --- a/robotframework-onap/ONAPLibrary/OOF.py +++ b/robotframework-onap/ONAPLibrary/OOF.py @@ -20,6 +20,8 @@ class OOF(HybridCore): """OOF is an ONAP testing library for Robot Framework that provides functionality for interacting with the optimiztion framework. """ + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ SNIROKeywords() diff --git a/robotframework-onap/ONAPLibrary/Openstack.py b/robotframework-onap/ONAPLibrary/Openstack.py index 833d731..b8861b2 100644 --- a/robotframework-onap/ONAPLibrary/Openstack.py +++ b/robotframework-onap/ONAPLibrary/Openstack.py @@ -21,6 +21,8 @@ class Openstack(HybridCore): """SO is an ONAP testing library for Robot Framework that provides functionality for interacting with the serivce orchestrator. """ + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ BaseOpenstackKeywords(), diff --git a/robotframework-onap/ONAPLibrary/PreloadData.py b/robotframework-onap/ONAPLibrary/PreloadData.py index 81ddcb8..4d24078 100644 --- a/robotframework-onap/ONAPLibrary/PreloadData.py +++ b/robotframework-onap/ONAPLibrary/PreloadData.py @@ -20,6 +20,8 @@ class PreloadData(HybridCore): """PreloadData is an ONAP testing library for Robot Framework that enables the use of a preload_data.json to dynamically add preload data to a robot test suite with out changing robot code""" + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ PreloadDataKeywords() diff --git a/robotframework-onap/ONAPLibrary/Protobuf.py b/robotframework-onap/ONAPLibrary/Protobuf.py index c81a0a2..0dfb1c4 100644 --- a/robotframework-onap/ONAPLibrary/Protobuf.py +++ b/robotframework-onap/ONAPLibrary/Protobuf.py @@ -19,6 +19,8 @@ from ONAPLibrary.ProtobufKeywords import ProtobufKeywords class Protobuf(HybridCore): """ Utilities useful for Protobuf manipulation """ + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ ProtobufKeywords() diff --git a/robotframework-onap/ONAPLibrary/SDC.py b/robotframework-onap/ONAPLibrary/SDC.py index d3dd9b3..f95468a 100644 --- a/robotframework-onap/ONAPLibrary/SDC.py +++ b/robotframework-onap/ONAPLibrary/SDC.py @@ -20,6 +20,8 @@ class SDC(HybridCore): """SDC is an ONAP testing library for Robot Framework that provides functionality for interacting with the serivce orchestrator. """ + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ BaseSDCKeywords() diff --git a/robotframework-onap/ONAPLibrary/SDNC.py b/robotframework-onap/ONAPLibrary/SDNC.py index bd16ae4..a96ef5f 100644 --- a/robotframework-onap/ONAPLibrary/SDNC.py +++ b/robotframework-onap/ONAPLibrary/SDNC.py @@ -21,6 +21,8 @@ class SDNC(HybridCore): """SDNC is an ONAP testing library for Robot Framework that provides functionality for interacting with the network controller. """ + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ BaseSDNCKeywords(), diff --git a/robotframework-onap/ONAPLibrary/SO.py b/robotframework-onap/ONAPLibrary/SO.py index b01c14f..2454e97 100644 --- a/robotframework-onap/ONAPLibrary/SO.py +++ b/robotframework-onap/ONAPLibrary/SO.py @@ -21,6 +21,8 @@ class SO(HybridCore): """SO is an ONAP testing library for Robot Framework that provides functionality for interacting with the serivce orchestrator. """ + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ BaseSOKeywords(), diff --git a/robotframework-onap/ONAPLibrary/ServiceMapping.py b/robotframework-onap/ONAPLibrary/ServiceMapping.py index 16125c2..8eeb3c9 100644 --- a/robotframework-onap/ONAPLibrary/ServiceMapping.py +++ b/robotframework-onap/ONAPLibrary/ServiceMapping.py @@ -20,6 +20,8 @@ class ServiceMapping(HybridCore): """ServiceMapping is an ONAP testing library for Robot Framework that enables the use of a service_mapping.json to dynamically add services to a robot test suite with out changing robot code""" + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ ServiceMappingKeywords() diff --git a/robotframework-onap/ONAPLibrary/Templating.py b/robotframework-onap/ONAPLibrary/Templating.py index 8975402..fc26829 100644 --- a/robotframework-onap/ONAPLibrary/Templating.py +++ b/robotframework-onap/ONAPLibrary/Templating.py @@ -21,6 +21,8 @@ class Templating(HybridCore): templating engine """ + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ TemplatingKeywords() diff --git a/robotframework-onap/ONAPLibrary/Utilities.py b/robotframework-onap/ONAPLibrary/Utilities.py index f791c9a..5751e21 100644 --- a/robotframework-onap/ONAPLibrary/Utilities.py +++ b/robotframework-onap/ONAPLibrary/Utilities.py @@ -23,6 +23,8 @@ from ONAPLibrary.Base64Keywords import Base64Keywords class Utilities(HybridCore): """ Keywords are useful for helper functions requests """ + ROBOT_LIBRARY_SCOPE = "GLOBAL" + def __init__(self): self.keyword_implementors = [ DNSKeywords(), diff --git a/robotframework-onap/tests/ONAPLibrary/ServiceMappingKeywordsTests.py b/robotframework-onap/tests/ONAPLibrary/ServiceMappingKeywordsTests.py new file mode 100644 index 0000000..105ebf4 --- /dev/null +++ b/robotframework-onap/tests/ONAPLibrary/ServiceMappingKeywordsTests.py @@ -0,0 +1,33 @@ +# Copyright 2019 AT&T Intellectual Property. All rights reserved. +# +# 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 robot.api.deco import keyword +import os.path +from unittest import TestCase +from ONAPLibrary.ServiceMappingKeywords import ServiceMappingKeywords + + +class ServiceMappingKeywordsTests(TestCase): + + @staticmethod + def _get_location(): + path = os.path.realpath( + os.path.join(os.getcwd(), os.path.dirname(__file__))) + return path + + @keyword + def test(self): + sm = ServiceMappingKeywords() + sm.set_directory("default", self._get_location()) + self.assertEqual(['vFW'], sm.get_service_folder_mapping("default", "vFW")) diff --git a/robotframework-onap/tests/ONAPLibrary/vFW/service_mapping.json b/robotframework-onap/tests/ONAPLibrary/vFW/service_mapping.json new file mode 100644 index 0000000..0c6486f --- /dev/null +++ b/robotframework-onap/tests/ONAPLibrary/vFW/service_mapping.json @@ -0,0 +1,20 @@ +{ + "GLOBAL_SERVICE_FOLDER_MAPPING": { + "vFW" : ["vFW"] + }, + "GLOBAL_SERVICE_VNF_MAPPING": { + "vFW" : ["vFW"] + }, + "GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING": { + "vFW" :[] + }, + "GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING": { + "vFW" :[] + }, + "GLOBAL_SERVICE_TEMPLATE_MAPPING": { + "vFW" : [{"isBase" : "true", "template" : "vfw_preload.template", "vnf_index": "0", "name_pattern": "base_vfw"}] + }, + "GLOBAL_VALIDATE_NAME_MAPPING": { + "vFW" : "vfw_name_0" + } +} diff --git a/robotframework-onap/tests/runner.py b/robotframework-onap/tests/runner.py index 63487ff..d1b217a 100644 --- a/robotframework-onap/tests/runner.py +++ b/robotframework-onap/tests/runner.py @@ -6,6 +6,7 @@ from unittest import TestSuite from tests.vcpeutils.SoUtils_test import SoUtilsTest from tests.ONAPLibrary.ProtobufKeywordsTest import ProtobufKeywordsTest from tests.ONAPLibrary.UUIDKeywordsTest import UUIDKeywordsTest +from tests.ONAPLibrary.ServiceMappingKeywordsTests import ServiceMappingKeywordsTests # initialize the test suite loader = TestLoader() @@ -15,6 +16,7 @@ suite = TestSuite() suite.addTests(loader.loadTestsFromTestCase(ProtobufKeywordsTest)) suite.addTests(loader.loadTestsFromTestCase(SoUtilsTest)) suite.addTests(loader.loadTestsFromTestCase(UUIDKeywordsTest)) +suite.addTests(loader.loadTestsFromTestCase(ServiceMappingKeywordsTests)) # initialize a runner, pass it your suite and run it runner = TextTestRunner(verbosity=3) -- cgit 1.2.3-korg