1 # -------------------------------------------------------------------------
2 # Copyright (c) 2018 AT&T Intellectual Property
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # -------------------------------------------------------------------------
20 from osdf.optimizers.placementopt.conductor import conductor
21 import osdf.config.loader as config_loader
22 from osdf.utils.interfaces import json_from_file
23 from osdf.utils.programming_utils import DotDict
24 from osdf.adapters.policy import interface as pol
27 class TestConductorCalls(unittest.TestCase):
31 "deployment": "test/functest/simulators/simulated-config/osdf_config.yaml",
32 "core": "test/functest/simulators/simulated-config/common_config.yaml"
34 self.osdf_config = DotDict(config_loader.all_configs(**self.config_spec))
35 self.lp = self.osdf_config.core.get('osdf_temp', {}).get('local_policies', {}
36 ).get('placement_policy_files_vcpe')
41 def test_request(self):
42 req_json = json_from_file("./test/placement-tests/request.json")
43 policies = pol.get_local_policies("test/policy-local-files/", self.lp)
44 conductor.request(req_json, self.osdf_config, policies)
46 def test_request_vfmod(self):
47 req_json = json_from_file("./test/placement-tests/request_vfmod.json")
48 policies = pol.get_local_policies("test/policy-local-files/", self.lp)
49 conductor.request(req_json, self.osdf_config, policies)
52 if __name__ == "__main__":