update link to upper-constraints.txt
[optf/osdf.git] / test / configdb / test_configdb_calls.py
1 # -------------------------------------------------------------------------
2 #   Copyright (c) 2018 AT&T Intellectual Property
3 #
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
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15 #
16 # -------------------------------------------------------------------------
17 #
18
19 from apps.pci.optimizers.config_request import request
20 import osdf.config.loader as config_loader
21 from osdf.utils.interfaces import json_from_file
22 from osdf.utils.programming_utils import DotDict
23 from osdf.adapters.policy import interface as pol
24
25
26 class TestConfigDbCalls():
27
28     def setUp(self):
29         self.config_spec = {
30             "deployment": "test/functest/simulators/simulated-config/osdf_config.yaml",
31             "core": "test/functest/simulators/simulated-config/common_config.yaml"
32         }
33         self.osdf_config = DotDict(config_loader.all_configs(**self.config_spec))
34         self.lp = self.osdf_config.core.get('osdf_temp', {}).get('local_policies', {}
35                                                                  ).get('placement_policy_files_vcpe')
36
37     def tearDown(self):
38         pass
39
40     def test_request(self):
41         self.setUp()
42         req_json = json_from_file("./test/pci-optimization-tests/request.json")
43         policies = pol.get_local_policies("test/policy-local-files/", self.lp)
44         cell_list = request(req_json, self.osdf_config, policies)
45
46