From ed19aa09d4cda22f42ee3deeb010b1a4a5735dba Mon Sep 17 00:00:00 2001 From: "pawel.denst" Date: Fri, 17 Mar 2023 15:16:39 +0000 Subject: Fix ONAP SDK integration tests for k8s plugin Changed Flask version and corrected endpoints for mock in msb-k8s Issue-ID: INT-2212 Signed-off-by: pawel.denst Change-Id: I3a05dfb0b9aebb7914d1719d253ac259c45c213f --- mock-msb-k8s/app/app.py | 38 ++++++++++++++++++-------------------- mock-msb-k8s/requirements.txt | 4 ++-- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'mock-msb-k8s') diff --git a/mock-msb-k8s/app/app.py b/mock-msb-k8s/app/app.py index 5da64d7..3e9cec9 100644 --- a/mock-msb-k8s/app/app.py +++ b/mock-msb-k8s/app/app.py @@ -76,7 +76,7 @@ INSTANCE_EXAMPLE = { } -@app.route('/api/multicloud-k8s/v1/v1/connectivity-info/', methods=['GET', 'DELETE']) +@app.route('/v1/connectivity-info/', methods=['GET', 'DELETE']) def connectivity_info_get_delete(region_id): if request.method == 'GET': for conninfo in CONNECTIVITY_INFOS: @@ -94,7 +94,7 @@ def connectivity_info_get_delete(region_id): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/connectivity-info', methods=['POST']) +@app.route('/v1/connectivity-info', methods=['POST']) def connectivity_info_create(): if request.method == 'POST': kubeconfig = request.files['file'] @@ -108,7 +108,7 @@ def connectivity_info_create(): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition', methods=['POST']) +@app.route('/v1/rb/definition', methods=['POST']) def definition_create(): if request.method == 'POST': data = json.loads(request.data) @@ -123,7 +123,7 @@ def definition_create(): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition///content', methods=['POST']) +@app.route('/v1/rb/definition///content', methods=['POST']) def definition_upload_artifact(rb_name, rb_version): if request.method == 'POST': data = request.data @@ -131,7 +131,7 @@ def definition_upload_artifact(rb_name, rb_version): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition//', methods=['GET', 'DELETE']) +@app.route('/v1/rb/definition//', methods=['GET', 'DELETE']) def definition_get_delete(rb_name, rb_version): if request.method == 'GET': for rb in DEFINITIONS: @@ -149,14 +149,14 @@ def definition_get_delete(rb_name, rb_version): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition', methods=['GET']) +@app.route('/v1/rb/definition', methods=['GET']) def definition_get_all(): if request.method == 'GET': return json.dumps(DEFINITIONS), http.HTTPStatus.OK return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition///profile', methods=['POST']) +@app.route('/v1/rb/definition///profile', methods=['POST']) def profile_create(**kwargs): if request.method == 'POST': data = json.loads(request.data) @@ -172,9 +172,7 @@ def profile_create(**kwargs): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route( - '/api/multicloud-k8s/v1/v1/rb/definition///profile//content' - , methods=['POST']) +@app.route('/v1/rb/definition///profile//content', methods=['POST']) def profile_upload_artifact(rb_name, rb_version, profile_name): if request.method == 'POST': data = request.data @@ -182,7 +180,7 @@ def profile_upload_artifact(rb_name, rb_version, profile_name): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition///profile/', +@app.route('/v1/rb/definition///profile/', methods=['GET', 'DELETE']) def profile_get_delete(rb_name, rb_version, profile_name): if request.method == 'GET': @@ -203,7 +201,7 @@ def profile_get_delete(rb_name, rb_version, profile_name): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition///profile', methods=['GET']) +@app.route('/v1/rb/definition///profile', methods=['GET']) def profile_get_all(rb_name, rb_version): if request.method == 'GET': profiles = [] @@ -213,7 +211,7 @@ def profile_get_all(rb_name, rb_version): return json.dumps(PROFILES), http.HTTPStatus.OK return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/instance', methods=['POST']) +@app.route('/v1/instance', methods=['POST']) def instance_create(): if request.method == 'POST': data = json.loads(request.data) @@ -224,7 +222,7 @@ def instance_create(): return instance_details, http.HTTPStatus.OK return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/instance/', methods=['GET', 'DELETE']) +@app.route('/v1/instance/', methods=['GET', 'DELETE']) def instance_get_delete(instance_id): if request.method == 'GET': for instance in INSTANCES: @@ -242,14 +240,14 @@ def instance_get_delete(instance_id): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/instance', methods=['GET']) +@app.route('/v1/instance', methods=['GET']) def instance_get_all(): if request.method == 'GET': return json.dumps(INSTANCES), http.HTTPStatus.OK return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition///config-template', +@app.route('/v1/rb/definition///config-template', methods=["POST"]) def configuration_template_create(rb_name, rb_version): if request.method == "POST": @@ -260,19 +258,19 @@ def configuration_template_create(rb_name, rb_version): return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition///config-template/', +@app.route('/v1/rb/definition///config-template/', methods=["GET"]) -def configuration_template_get(rb_name, rb_version, name): +def configuration_template_get(rb_name, rb_version, template_name): if request.method == "GET": for template in CONFIGURATIONS_TEMPLATES: - if template['template-name'] == name: + if template['template-name'] == template_name: return json.dumps(template), http.HTTPStatus.OK else: return '', http.HTTPStatus.NOT_FOUND return '', http.HTTPStatus.METHOD_NOT_ALLOWED -@app.route('/api/multicloud-k8s/v1/v1/rb/definition///config-template', +@app.route('/v1/rb/definition///config-template', methods=["GET"]) def configuration_template_get_all(rb_name, rb_version): if request.method == 'GET': diff --git a/mock-msb-k8s/requirements.txt b/mock-msb-k8s/requirements.txt index 07e3f1f..bb3dbed 100644 --- a/mock-msb-k8s/requirements.txt +++ b/mock-msb-k8s/requirements.txt @@ -1,2 +1,2 @@ -Flask==1.1.2 -Flask-RESTful==0.3.8 +Flask>=2.2.2 +Flask-RESTful==0.3.9 \ No newline at end of file -- cgit 1.2.3-korg