summaryrefslogtreecommitdiffstats
path: root/test/test_ConductorApiBuilder.py
diff options
context:
space:
mode:
authorkrishnaa96 <krishna.moorthy6@wipro.com>2020-03-10 10:55:13 +0530
committerkrishnaa96 <krishna.moorthy6@wipro.com>2020-03-20 20:39:59 +0530
commitf30da9513ae0501f453ee93729b381270fad0a2b (patch)
treea3ab005e2f16bfe8709bdcfbab6d28b5c6760a19 /test/test_ConductorApiBuilder.py
parent420f4b3a4ca25d5de5c9318b2ca89e1ef126b278 (diff)
Add generic conductor interface
Issue-ID: OPTFRA-715 Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com> Change-Id: I84218ab65e645a90d2ff1c365bdde1e06ab27d2e
Diffstat (limited to 'test/test_ConductorApiBuilder.py')
-rw-r--r--test/test_ConductorApiBuilder.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/test/test_ConductorApiBuilder.py b/test/test_ConductorApiBuilder.py
index 07cb3bb..44c14d8 100644
--- a/test/test_ConductorApiBuilder.py
+++ b/test/test_ConductorApiBuilder.py
@@ -1,5 +1,6 @@
# -------------------------------------------------------------------------
# Copyright (c) 2017-2018 AT&T Intellectual Property
+# Copyright (C) 2020 Wipro Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,7 +20,7 @@ import unittest
import json
import yaml
-from apps.placement.optimizers.conductor.api_builder import conductor_api_builder
+from osdf.adapters.conductor.api_builder import conductor_api_builder
from osdf.adapters.local_data import local_policies
from osdf.utils.interfaces import json_from_file
@@ -28,7 +29,7 @@ class TestConductorApiBuilder(unittest.TestCase):
def setUp(self):
self.main_dir = ""
- self.conductor_api_template = self.main_dir + "apps/placement/templates/conductor_interface.json"
+ self.conductor_api_template = self.main_dir + "osdf/adapters/conductor/templates/conductor_interface.json"
self.local_config_file = self.main_dir + "config/common_config.yaml"
policy_data_path = self.main_dir + "test/policy-local-files" # "test/policy-local-files"
@@ -48,7 +49,12 @@ class TestConductorApiBuilder(unittest.TestCase):
request_json = self.request_json
policies = self.policies
local_config = yaml.safe_load(open(self.local_config_file))
- templ_string = conductor_api_builder(request_json, policies, local_config, self.conductor_api_template)
+ req_info = request_json['requestInfo']
+ demands = request_json['placementInfo']['placementDemands']
+ request_parameters = request_json['placementInfo']['requestParameters']
+ service_info = request_json['serviceInfo']
+ templ_string = conductor_api_builder(req_info, demands, request_parameters, service_info, policies,
+ local_config, self.conductor_api_template)
templ_json = json.loads(templ_string)
self.assertEqual(templ_json["name"], "yyy-yyy-yyyy")
@@ -56,7 +62,12 @@ class TestConductorApiBuilder(unittest.TestCase):
request_json = self.request_vfmod_json
policies = self.policies
local_config = yaml.safe_load(open(self.local_config_file))
- templ_string = conductor_api_builder(request_json, policies, local_config, self.conductor_api_template)
+ req_info = request_json['requestInfo']
+ demands = request_json['placementInfo']['placementDemands']
+ request_parameters = request_json['placementInfo']['requestParameters']
+ service_info = request_json['serviceInfo']
+ templ_string = conductor_api_builder(req_info, demands, request_parameters, service_info, policies,
+ local_config, self.conductor_api_template)
templ_json = json.loads(templ_string)
self.assertEqual(templ_json, self.request_placement_vfmod_json)