From 493e9e7dc5a1be2af4f326bb0bd296ced9fb25eb Mon Sep 17 00:00:00 2001 From: sebdet Date: Thu, 13 Jun 2019 12:12:09 +0200 Subject: [PATCH] Bring all fixes Bring all fixes from Dublin, but the code has slightly changed on master Issue-ID: CLAMP-410 Change-Id: Ieca7b8e9b180f46f2c30f848454405f3a504bfdd Signed-off-by: sebdet --- docs/swagger/swagger.pdf | 4 +-- .../resources/clds/camel/rest/clamp-api-v2.xml | 32 ++++++++++++---------- .../resources/clds/camel/routes/dcae-flows.xml | 6 ++-- .../resources/clds/camel/routes/policy-flows.xml | 20 +++++++------- src/test/resources/http-cache/third_party_proxy.py | 27 ++++++++++++++---- 5 files changed, 54 insertions(+), 35 deletions(-) diff --git a/docs/swagger/swagger.pdf b/docs/swagger/swagger.pdf index 7a9c85ec..0ef34fe5 100644 --- a/docs/swagger/swagger.pdf +++ b/docs/swagger/swagger.pdf @@ -4,8 +4,8 @@ << /Title (Clamp Rest API) /Creator (Asciidoctor PDF 1.5.0.alpha.10, based on Prawn 1.3.0) /Producer (Asciidoctor PDF 1.5.0.alpha.10, based on Prawn 1.3.0) -/CreationDate (D:20190529175837+02'00') -/ModDate (D:20190529175837+02'00') +/CreationDate (D:20190613105324+02'00') +/ModDate (D:20190613105324+02'00') >> endobj 2 0 obj diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml index 10144949..6ee44cad 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -211,7 +211,7 @@ - + + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DEPLOY request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> @@ -256,7 +256,7 @@ - + + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UNDEPLOY request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> @@ -300,7 +300,7 @@ - + + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> @@ -365,7 +365,7 @@ loggingLevel="ERROR" message="RESTART request failed for loop: ${header.loopName}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request failed, Error reported: ${exception} - Body: ${exception.responseBody}','INFO',${exchangeProperty[loopObject]})" /> @@ -451,6 +451,10 @@ + + 3000 + + + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> @@ -554,7 +558,7 @@ loggingLevel="ERROR" message="DELETE request failed for loop: ${header.loopName}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> @@ -583,10 +587,10 @@ - - + + java.lang.Exception @@ -599,7 +603,7 @@ loggingLevel="ERROR" message="Get Status request failed for loop: ${header.loopName}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> diff --git a/src/main/resources/clds/camel/routes/dcae-flows.xml b/src/main/resources/clds/camel/routes/dcae-flows.xml index b69c4fb8..395077a8 100644 --- a/src/main/resources/clds/camel/routes/dcae-flows.xml +++ b/src/main/resources/clds/camel/routes/dcae-flows.xml @@ -39,7 +39,7 @@ loggingLevel="INFO" message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}"> + uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.dcae.deployment.userName}}&authPassword={{clamp.config.dcae.deployment.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=300000&authenticationPreemptive=true&connectionClose=true" /> + uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.dcae.deployment.userName}}&authPassword={{clamp.config.dcae.deployment.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=300000&authenticationPreemptive=true&connectionClose=true" /> + uri="${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}?bridgeEndpoint=true&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.dcae.deployment.userName}}&authPassword={{clamp.config.dcae.deployment.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=30000&authenticationPreemptive=true&connectionClose=true" /> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true" /> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/deployed?bridgeEndpoint=true&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true" /> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true" /> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&deleteWithBody=false&mapHttpMessageBody=false&mapHttpMessageFormUrlEncodedBody=false&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true" /> @@ -212,7 +212,7 @@ loggingLevel="INFO" message="Endpoint to create operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies"> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true" /> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&deleteWithBody=false&mapHttpMessageBody=false&mapHttpMessageFormUrlEncodedBody=false&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true" /> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true" /> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1?bridgeEndpoint=true&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&deleteWithBody=false&mapHttpMessageBody=false&mapHttpMessageFormUrlEncodedBody=false&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true" /> @@ -399,7 +399,7 @@ loggingLevel="INFO" message="Endpoint to add policies to PDP Group: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies"> + uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies?bridgeEndpoint=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&useSystemProperties=true&authUsername={{clamp.config.policy.pap.userName}}&authPassword={{clamp.config.policy.pap.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true" /> @@ -449,7 +449,7 @@ loggingLevel="INFO" message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"> + uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.policy.pap.userName}}&authPassword={{clamp.config.policy.pap.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true" /> ${exchangeProperty[policyName]} PDP Group removal status diff --git a/src/test/resources/http-cache/third_party_proxy.py b/src/test/resources/http-cache/third_party_proxy.py index ce61ea06..0381ab18 100755 --- a/src/test/resources/http-cache/third_party_proxy.py +++ b/src/test/resources/http-cache/third_party_proxy.py @@ -219,7 +219,7 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): f.write(self.data_string) return True elif self.path.startswith("/policy/api/v1/policytypes/") and http_type == "DELETE": - print "self.path start with DELETE new policy API /policy/api/v1/policyTypes/ ..." + print "self.path start with DELETE new policy API /policy/api/v1/policytypes/ ..." if not os.path.exists(cached_file_folder): os.makedirs(cached_file_folder, 0777) @@ -232,7 +232,6 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): print "self.path start with POST new policy API /policy/pap/v1/pdps/ ..." if not os.path.exists(cached_file_folder): os.makedirs(cached_file_folder, 0777) - with open(cached_file_header, 'w+') as f: f.write("{\"Content-Length\": \"" + str(len("")) + "\", \"Content-Type\": \""+str("")+"\"}") with open(cached_file_content, 'w+') as f: @@ -280,7 +279,9 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): if not HOST: self.send_response(404) - return "404 Not found" + self.end_headers() + self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!') + return "404 Not found, no remote HOST specified on the emulator !!!" url = '%s%s' % (HOST, self.path) response = requests.get(url, auth=AUTH, headers=HEADERS, stream=True) @@ -293,6 +294,8 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): print('Status code : %s' % (response.status_code,)) print('Content : %s' % (response.content,)) self.send_response(response.status_code) + self.end_headers() + self.wfile.write('404 Not found, nothing found on the remote server !!!') return response.content else: print("Request for data currently present in cache: %s" % (cached_file_folder,)) @@ -331,7 +334,9 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): if not HOST: self.send_response(404) - return "404 Not found" + self.end_headers() + self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!') + return "404 Not found, no remote HOST specified on the emulator !!!" print("Request for data currently not present in cache: %s" % (cached_file_folder,)) @@ -347,6 +352,8 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): print('Status code : %s' % (response.status_code,)) print('Content : %s' % (response.content,)) self.send_response(response.status_code) + self.end_headers() + self.wfile.write('404 Not found, nothing found on the remote server !!!') return response.content else: print("Request for data present in cache: %s" % (cached_file_folder,)) @@ -378,7 +385,9 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): if not _file_available: if not HOST: self.send_response(404) - return "404 Not found" + self.end_headers() + self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!') + return "404 Not found, no remote HOST specified on the emulator !!!" print("Request for data currently not present in cache: %s" % (cached_file_folder,)) @@ -394,6 +403,8 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): print('Status code : %s' % (response.status_code,)) print('Content : %s' % (response.content,)) self.send_response(response.status_code) + self.end_headers() + self.wfile.write('404 Not found, nothing found on the remote server !!!') return response.content else: print("Request for data present in cache: %s" % (cached_file_folder,)) @@ -428,7 +439,9 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): if not _file_available: if not HOST: self.send_response(404) - return "404 Not found" + self.end_headers() + self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!') + return "404 Not found, no remote HOST specified on the emulator !!!" print("Request for data currently not present in cache: %s" % (cached_file_folder,)) @@ -444,6 +457,8 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): print('Status code : %s' % (response.status_code,)) print('Content : %s' % (response.content,)) self.send_response(response.status_code) + self.end_headers() + self.wfile.write('404 Not found, nothing found on the remote server !!!') return response.content else: print("Request for data present in cache: %s" % (cached_file_folder,)) -- 2.16.6