summaryrefslogtreecommitdiffstats
path: root/robotframework-onap
diff options
context:
space:
mode:
authorDR695H <dr695h@att.com>2019-07-31 17:42:10 -0400
committerDR695H <dr695h@att.com>2019-07-31 18:10:37 -0400
commit3db5715fbfa519dfabb2dab95630b294e7fd2857 (patch)
tree5305f6c901b511524d39403fd9ae470810a582cb /robotframework-onap
parent70ef70fb637f25a05d2d929121d3e5cdfd7e8035 (diff)
pull global vars from robot trial
Issue-ID: TEST-184 Change-Id: I008c9cfbc1ae65c7735fcab2b474a0cbf7ec2ca9 Signed-off-by: DR695H <dr695h@att.com>
Diffstat (limited to 'robotframework-onap')
-rw-r--r--robotframework-onap/ONAPLibrary/BaseAAIKeywords.py18
-rw-r--r--robotframework-onap/ONAPLibrary/Utilities.py4
-rw-r--r--robotframework-onap/ONAPLibrary/VariableKeywords.py (renamed from robotframework-onap/ONAPLibrary/VariableHelper.py)15
-rwxr-xr-xrobotframework-onap/vcpeutils/SoUtils.py11
4 files changed, 26 insertions, 22 deletions
diff --git a/robotframework-onap/ONAPLibrary/BaseAAIKeywords.py b/robotframework-onap/ONAPLibrary/BaseAAIKeywords.py
index 2804e23..a512203 100644
--- a/robotframework-onap/ONAPLibrary/BaseAAIKeywords.py
+++ b/robotframework-onap/ONAPLibrary/BaseAAIKeywords.py
@@ -19,6 +19,7 @@ import time
from ONAPLibrary.RequestsHelper import RequestsHelper
from ONAPLibrary.HTTPKeywords import HTTPKeywords
+from ONAPLibrary.VariableKeywords import VariableKeywords
class BaseAAIKeywords(object):
@@ -30,6 +31,11 @@ class BaseAAIKeywords(object):
self.reqs = RequestsHelper()
self.builtin = BuiltIn()
self.http = HTTPKeywords()
+ self.vars = VariableKeywords()
+ aai_ip_addr = self.vars.get_globally_injected_parameters()['GLOBAL_INJECTED_AAI_IP_ADDR']
+ aai_server_protocol = self.vars.get_global_parameters()['GLOBAL_AAI_SERVER_PROTOCOL']
+ aai_server_port = self.vars.get_global_parameters()['GLOBAL_AAI_SERVER_PORT']
+ self.aai_endpoint = aai_server_protocol + '://' + aai_ip_addr + ':' + aai_server_port
@keyword
def run_get_request(self, endpoint, data_path, accept="application/json", auth=None):
@@ -54,15 +60,15 @@ class BaseAAIKeywords(object):
def run_delete_request(self, endpoint, data_path, resource_version, accept="application/json", auth=None):
"""Runs an AAI delete request"""
self.http.disable_warnings()
- return self.reqs.delete_request("aai", endpoint, data_path + '?resource-version=' + resource_version, data=None,
- sdc_user=None, accept=accept, auth=auth)
+ return self.reqs.delete_request("aai", endpoint, data_path + '?resource-version=' + resource_version,
+ data=None, sdc_user=None, accept=accept, auth=auth)
@keyword
- def wait_for_node_to_exist(self, endpoint, search_node_type, key, uuid, auth=None):
+ def wait_for_node_to_exist(self, search_node_type, key, uuid, auth=None):
logger.info('Waiting for AAI traversal to complete...')
for i in range(30):
time.sleep(1)
- result = self.find_node(endpoint, search_node_type, key, uuid, auth=auth)
+ result = self.find_node(search_node_type, key, uuid, auth=auth)
if result:
return result
@@ -72,10 +78,10 @@ class BaseAAIKeywords(object):
self.builtin.fail(error_message)
@keyword
- def find_node(self, endpoint, search_node_type, key, node_uuid, auth=None):
+ def find_node(self, search_node_type, key, node_uuid, auth=None):
data_path = '/aai/v11/search/nodes-query?search-node-type={0}&filter={1}:EQUALS:{2}'.format(
search_node_type, key, node_uuid)
self.http.disable_warnings()
- resp = self.reqs.get_request("aai", endpoint, data_path, accept="application/json", auth=auth)
+ resp = self.reqs.get_request("aai", self.aai_endpoint, data_path, accept="application/json", auth=auth)
response = resp.json()
return 'result-data' in response
diff --git a/robotframework-onap/ONAPLibrary/Utilities.py b/robotframework-onap/ONAPLibrary/Utilities.py
index 5751e21..4773432 100644
--- a/robotframework-onap/ONAPLibrary/Utilities.py
+++ b/robotframework-onap/ONAPLibrary/Utilities.py
@@ -18,6 +18,7 @@ from ONAPLibrary.SocketKeywords import SocketKeywords
from ONAPLibrary.UUIDKeywords import UUIDKeywords
from ONAPLibrary.HTTPKeywords import HTTPKeywords
from ONAPLibrary.Base64Keywords import Base64Keywords
+from ONAPLibrary.VariableKeywords import VariableKeywords
class Utilities(HybridCore):
@@ -31,6 +32,7 @@ class Utilities(HybridCore):
SocketKeywords(),
UUIDKeywords(),
HTTPKeywords(),
- Base64Keywords()
+ Base64Keywords(),
+ VariableKeywords()
]
HybridCore.__init__(self, self.keyword_implementors)
diff --git a/robotframework-onap/ONAPLibrary/VariableHelper.py b/robotframework-onap/ONAPLibrary/VariableKeywords.py
index 4a0b819..6338aa2 100644
--- a/robotframework-onap/ONAPLibrary/VariableHelper.py
+++ b/robotframework-onap/ONAPLibrary/VariableKeywords.py
@@ -13,29 +13,32 @@
# limitations under the License.
from robot.libraries.BuiltIn import BuiltIn
+from robot.api.deco import keyword
-class VariableHelper(object):
- """ Non keyword class for useful for working with varaibles """
+class VariableKeywords(object):
+ """ keyword class for useful keywords for working with varaibles """
def __init__(self):
- super(VariableHelper, self).__init__()
+ super(VariableKeywords, self).__init__()
self.builtin = BuiltIn()
+ @keyword
def get_globally_injected_parameters(self):
dictionary = self.builtin.get_variables(no_decoration=True)
- return self.filter_variables_by_key_prefix(dictionary, "GLOBAL_INJECTED_")
+ return self._filter_variables_by_key_prefix(dictionary, "GLOBAL_INJECTED_")
+ @keyword
def get_global_parameters(self):
dictionary = self.builtin.get_variables(no_decoration=True)
- global_variables = self.filter_variables_by_key_prefix(dictionary, "GLOBAL_")
+ global_variables = self._filter_variables_by_key_prefix(dictionary, "GLOBAL_")
# strip out global injected (get those above)
for key in self.get_globally_injected_parameters():
del global_variables[key]
return global_variables
@staticmethod
- def filter_variables_by_key_prefix(dictionary, partial):
+ def _filter_variables_by_key_prefix(dictionary, partial):
matches = dict()
for key, val in dictionary.items():
if key.startswith(partial):
diff --git a/robotframework-onap/vcpeutils/SoUtils.py b/robotframework-onap/vcpeutils/SoUtils.py
index 99376ae..229d5b1 100755
--- a/robotframework-onap/vcpeutils/SoUtils.py
+++ b/robotframework-onap/vcpeutils/SoUtils.py
@@ -25,11 +25,6 @@ class SoUtils:
self.so_userpass = 'InfraPortalClient', 'password1$'
self.so_headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
- # aai urls
- self.aai_userpass = 'AAI', 'AAI'
- self.aai_query_port = '8443'
- self.aai_host = 'aai.onap'
-
# mr utls
self.mr_ip_addr = 'mr.onap'
self.mr_ip_port = '3904'
@@ -248,8 +243,7 @@ class SoUtils:
return None
# wait for AAI to complete traversal
- endpoint = "https://{0}:{1}".format(self.aai_host, self.aai_query_port)
- self.aai.wait_for_node_to_exist(endpoint, 'service-instance', 'service-instance-id', svc_instance_id)
+ self.aai.wait_for_node_to_exist('service-instance', 'service-instance-id', svc_instance_id)
# create networks
for model in parser.net_models:
@@ -311,8 +305,7 @@ class SoUtils:
if not vnf_instance_id:
logger.error('No VNF instance ID returned!')
sys.exit()
- endpoint = "https://{0}:{1}".format(self.aai_host, self.aai_query_port)
- self.aai.wait_for_node_to_exist(endpoint, 'generic-vnf', 'vnf-id', vnf_instance_id)
+ self.aai.wait_for_node_to_exist('generic-vnf', 'vnf-id', vnf_instance_id)
# SDNC Preload
preloader = PreloadSDNCKeywords()