1 # Copyright 2019 AT&T Intellectual Property. All rights reserved.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from robot.api.deco import keyword
16 from ONAPLibrary.RequestsHelper import RequestsHelper
19 class BaseCLAMPKeywords(object):
20 """The main interface for interacting with CLAMP. It handles low level stuff like managing the http request library
21 and required fields. """
24 super(BaseCLAMPKeywords, self).__init__()
25 self.reqs = RequestsHelper()
28 def run_get_request(self, endpoint, data_path, accept="application/json", auth=None):
29 """Runs an CLAMP get request"""
30 return self.reqs.get_request(alias="clamp", endpoint=endpoint, data_path=data_path, accept=accept, auth=auth)
33 def run_post_request(self, endpoint, data_path, data, accept="application/json", auth=None):
34 """Runs an CLAMP post request"""
35 return self.reqs.post_request(alias="clamp", endpoint=endpoint, data_path=data_path, data=data, accept=accept,
39 def run_put_request(self, endpoint, data_path, data, accept="application/json", auth=None):
40 """Runs an CLAMP post request"""
41 return self.reqs.put_request(alias="clamp", endpoint=endpoint, data_path=data_path, data=data, accept=accept,
45 def run_delete_request(self, endpoint, data_path, data, accept="application/json", auth=None):
46 """Runs an CLAMP delete request"""
47 return self.reqs.delete_request(alias="clamp", endpoint=endpoint, data_path=data_path, data=data, accept=accept,