From 2c94a42d6c7ce672af76eb68484d3d69710ac4d4 Mon Sep 17 00:00:00 2001 From: Tommy Carpenter Date: Wed, 31 Jul 2019 09:38:28 -0400 Subject: [PATCH] Rename urls per requirements. Change-Id: Iad5fd80d7d2b0234d61c15c3adbae83e7b62e8b9 Signed-off-by: Tommy Carpenter --- a1/openapi.yaml | 4 ++-- container-tag.yaml | 2 +- docs/release-notes.rst | 10 ++++++++-- integration_tests/a1mediator/Chart.yaml | 2 +- integration_tests/test_a1.tavern.yaml | 16 ++++++++-------- setup.py | 2 +- tests/test_controller.py | 32 ++++++++++++++++---------------- 7 files changed, 37 insertions(+), 31 deletions(-) diff --git a/a1/openapi.yaml b/a1/openapi.yaml index 81e88d1..e2d17cc 100644 --- a/a1/openapi.yaml +++ b/a1/openapi.yaml @@ -16,7 +16,7 @@ # ================================================================================== openapi: 3.0.0 info: - version: 0.9.0 + version: 0.10.0 title: RIC A1 paths: '/a1-p/healthcheck': @@ -31,7 +31,7 @@ paths: description: > a1 is healthy. Anything other than a 200 should be considered a1 as failing - '/ric/policies/{policyname}': + '/a1-p/policies/{policyname}': parameters: - name: policyname in: path diff --git a/container-tag.yaml b/container-tag.yaml index b95acd7..60b7de3 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -1,4 +1,4 @@ # The Jenkins job uses this string for the tag in the image name # for example nexus3.o-ran-sc.org:10004/my-image-name:my-tag --- -tag: 0.9.0 +tag: 0.10.0 diff --git a/docs/release-notes.rst b/docs/release-notes.rst index cb50672..b506db7 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -21,8 +21,14 @@ A1 Mediator Release Notes All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `__ -and this project adheres to `Semantic -Versioning `__. +and this project adheres to `Semantic Versioning `__. + +[0.10.0] - 7/30/2019 + +:: + + * Rename all /ric/ URLs to be consistent with requirements of /a1-p/ + [0.9.0] - 7/22/2019 ------------------- diff --git a/integration_tests/a1mediator/Chart.yaml b/integration_tests/a1mediator/Chart.yaml index fd9b2a0..188872c 100644 --- a/integration_tests/a1mediator/Chart.yaml +++ b/integration_tests/a1mediator/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v1 description: A1 Helm chart for Kubernetes name: a1mediator -version: 0.9.0 +version: 0.10.0 diff --git a/integration_tests/test_a1.tavern.yaml b/integration_tests/test_a1.tavern.yaml index 6952b9b..f1b0f6a 100644 --- a/integration_tests/test_a1.tavern.yaml +++ b/integration_tests/test_a1.tavern.yaml @@ -18,7 +18,7 @@ test_name: test delayed policy stages: - name: test the delayed policy request: - url: http://localhost:10000/ric/policies/test_policy + url: http://localhost:10000/a1-p/policies/test_policy method: PUT json: {} @@ -38,7 +38,7 @@ test_name: test admission control stages: - name: test the admission control policy request: - url: http://localhost:10000/ric/policies/admission_control_policy + url: http://localhost:10000/a1-p/policies/admission_control_policy method: PUT json: enforce: true @@ -55,7 +55,7 @@ stages: - name: test the admission control policy get request: - url: http://localhost:10000/ric/policies/admission_control_policy + url: http://localhost:10000/a1-p/policies/admission_control_policy method: GET response: status_code: 200 @@ -69,7 +69,7 @@ test_name: bad_requests stages: - name: does not exist request: - url: http://localhost:10000/ric/policies/darkness + url: http://localhost:10000/a1-p/policies/darkness method: PUT json: {} @@ -80,7 +80,7 @@ stages: - name: bad body for admission control policy request: - url: http://localhost:10000/ric/policies/admission_control_policy + url: http://localhost:10000/a1-p/policies/admission_control_policy method: PUT json: not: "expected" @@ -91,7 +91,7 @@ stages: - name: not a json request: - url: http://localhost:10000/ric/policies/admission_control_policy + url: http://localhost:10000/a1-p/policies/admission_control_policy method: PUT data: "asdf" response: @@ -99,7 +99,7 @@ stages: - name: bad body for test policy request: - url: http://localhost:10000/ric/policies/test_policy + url: http://localhost:10000/a1-p/policies/test_policy method: PUT json: not: "welcome" @@ -108,7 +108,7 @@ stages: - name: test policy doesnt support fetch request: - url: http://localhost:10000/ric/policies/test_policy + url: http://localhost:10000/a1-p/policies/test_policy method: GET response: status_code: 400 diff --git a/setup.py b/setup.py index ad35a1c..f0a9dd3 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ from setuptools import setup, find_packages setup( name="a1", - version="0.9.0", + version="0.10.0", packages=find_packages(exclude=["tests.*", "tests"]), author="Tommy Carpenter", description="RIC A1 Mediator for policy/intent changes", diff --git a/tests/test_controller.py b/tests/test_controller.py index 989390b..bae2ac9 100644 --- a/tests/test_controller.py +++ b/tests/test_controller.py @@ -99,7 +99,7 @@ def test_policy_get(client, monkeypatch): "a1.a1rmr._dequeue_all_waiting_messages", _fake_dequeue(monkeypatch, msg_payload={"GET ack": "pretend policy is here"}, msg_type=20003), ) - res = client.get("/ric/policies/admission_control_policy") + res = client.get("/a1-p/policies/admission_control_policy") assert res.status_code == 200 assert res.json == {"GET ack": "pretend policy is here"} @@ -109,7 +109,7 @@ def test_policy_get_unsupported(client, monkeypatch): test policy GET """ testing_helpers.patch_all(monkeypatch, nofetch=True) - res = client.get("/ric/policies/admission_control_policy") + res = client.get("/a1-p/policies/admission_control_policy") assert res.status_code == 400 assert res.data == b'"POLICY DOES NOT SUPPORT FETCHING"\n' @@ -118,7 +118,7 @@ def test_xapp_put_good(client, monkeypatch): """ test policy put good""" _test_put_patch(monkeypatch) monkeypatch.setattr("a1.a1rmr._dequeue_all_waiting_messages", _fake_dequeue(monkeypatch)) - res = client.put("/ric/policies/admission_control_policy", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/admission_control_policy", json=testing_helpers.good_payload()) assert res.status_code == 200 assert res.json == {"status": "SUCCESS", "foo": "bar"} @@ -130,14 +130,14 @@ def test_xapp_put_bad(client, monkeypatch): monkeypatch.setattr( "a1.a1rmr._dequeue_all_waiting_messages", _fake_dequeue(monkeypatch, msg_payload={"status": "FAIL", "foo": "bar"}) ) - res = client.put("/ric/policies/admission_control_policy", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/admission_control_policy", json=testing_helpers.good_payload()) assert res.status_code == 502 assert res.json["reason"] == "BAD STATUS" assert res.json["return_payload"] == {"status": "FAIL", "foo": "bar"} # return from policy handler has no status field monkeypatch.setattr("a1.a1rmr._dequeue_all_waiting_messages", _fake_dequeue(monkeypatch, msg_payload={"foo": "bar"})) - res = client.put("/ric/policies/admission_control_policy", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/admission_control_policy", json=testing_helpers.good_payload()) assert res.status_code == 502 assert res.json["reason"] == "NO STATUS" assert res.json["return_payload"] == {"foo": "bar"} @@ -146,20 +146,20 @@ def test_xapp_put_bad(client, monkeypatch): monkeypatch.setattr( "a1.a1rmr._dequeue_all_waiting_messages", _fake_dequeue(monkeypatch, msg_payload="booger", jsonb=False) ) - res = client.put("/ric/policies/admission_control_policy", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/admission_control_policy", json=testing_helpers.good_payload()) assert res.status_code == 502 assert res.json["reason"] == "NOT JSON" assert res.json["return_payload"] == "booger" # bad type monkeypatch.setattr("a1.a1rmr._dequeue_all_waiting_messages", _fake_dequeue(monkeypatch, msg_type=666)) - res = client.put("/ric/policies/admission_control_policy", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/admission_control_policy", json=testing_helpers.good_payload()) assert res.status_code == 504 assert res.data == b"\"A1 was expecting an ACK back but it didn't receive one or didn't recieve the expected ACK\"\n" # bad state monkeypatch.setattr("a1.a1rmr._dequeue_all_waiting_messages", _fake_dequeue(monkeypatch, msg_state=666)) - res = client.put("/ric/policies/admission_control_policy", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/admission_control_policy", json=testing_helpers.good_payload()) assert res.status_code == 504 assert res.data == b"\"A1 was expecting an ACK back but it didn't receive one or didn't recieve the expected ACK\"\n" @@ -171,16 +171,16 @@ def test_xapp_put_bad_send(client, monkeypatch): testing_helpers.patch_all(monkeypatch) monkeypatch.setattr("a1.a1rmr._dequeue_all_waiting_messages", _fake_dequeue(monkeypatch)) - res = client.put("/ric/policies/admission_control_policy", json={"not": "expected"}) + res = client.put("/a1-p/policies/admission_control_policy", json={"not": "expected"}) assert res.status_code == 400 monkeypatch.setattr("rmr.rmr.rmr_send_msg", rmr_mocks.send_mock_generator(10)) - res = client.put("/ric/policies/admission_control_policy", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/admission_control_policy", json=testing_helpers.good_payload()) assert res.status_code == 504 assert res.data == b'"A1 was unable to send a needed message to a downstream subscriber"\n' monkeypatch.setattr("rmr.rmr.rmr_send_msg", rmr_mocks.send_mock_generator(5)) - res = client.put("/ric/policies/admission_control_policy", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/admission_control_policy", json=testing_helpers.good_payload()) assert res.status_code == 504 assert res.data == b'"A1 was unable to send a needed message to a downstream subscriber"\n' @@ -190,15 +190,15 @@ def test_bad_requests(client, monkeypatch): testing_helpers.patch_all(monkeypatch) # test a 404 - res = client.put("/ric/policies/noexist", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/noexist", json=testing_helpers.good_payload()) assert res.status_code == 404 # bad media type - res = client.put("/ric/policies/admission_control_policy", data="notajson") + res = client.put("/a1-p/policies/admission_control_policy", data="notajson") assert res.status_code == 415 # test a PUT body against a poliucy not expecting one - res = client.put("/ric/policies/test_policy", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/test_policy", json=testing_helpers.good_payload()) assert res.status_code == 400 assert res.data == b'"BODY SUPPLIED BUT POLICY HAS NO EXPECTED BODY"\n' @@ -213,7 +213,7 @@ def test_missing_manifest(client, monkeypatch): monkeypatch.setattr("a1.utils.get_ric_manifest", f) - res = client.put("/ric/policies/admission_control_policy", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/admission_control_policy", json=testing_helpers.good_payload()) assert res.status_code == 500 assert res.data == b'"A1 was unable to find the required RIC manifest. report this!"\n' @@ -223,7 +223,7 @@ def test_missing_rmr(client, monkeypatch): test that we get a 500 with an approrpiate message on a missing rmr rmr_string """ testing_helpers.patch_all(monkeypatch, nonexisting_rmr=True) - res = client.put("/ric/policies/admission_control_policy", json=testing_helpers.good_payload()) + res = client.put("/a1-p/policies/admission_control_policy", json=testing_helpers.good_payload()) assert res.status_code == 500 assert res.data == b'"A1 does not have a mapping for the desired rmr string. report this!"\n' -- 2.16.6