From 85f00c0b1b125ca38b96e30bb9c1988b2b523342 Mon Sep 17 00:00:00 2001 From: Sunil Kumar <sk0064@surrey.ac.uk> Date: Thu, 3 Aug 2023 11:22:37 +0100 Subject: [PATCH] Initial commit --- docs/favicon.ico | Bin 15086 -> 0 bytes docs/requirements-docs.txt | 5 - .../api/STD_1.1.3/STD_A1.yaml | 258 ---------- .../api/STD_2.0.0/ORAN_A1-p_V2.0.0_api.yaml | 341 ------------- near-rt-ric-simulator/src/STD_1.1.3/a1.py | 196 -------- .../src/STD_1.1.3/callBack.py | 43 -- near-rt-ric-simulator/src/STD_1.1.3/main.py | 179 ------- .../src/STD_1.1.3/var_declaration.py | 24 - near-rt-ric-simulator/src/STD_2.0.0/a1.py | 271 ----------- .../src/STD_2.0.0/callBack.py | 43 -- near-rt-ric-simulator/src/STD_2.0.0/main.py | 255 ---------- .../src/STD_2.0.0/var_declaration.py | 27 -- .../test/STD_1.1.3/basic_test.sh | 172 ------- .../test/STD_1.1.3/build_and_start.sh | 33 -- .../test/STD_1.1.3/jsonfiles/pi1.json | 13 - .../test/STD_1.1.3/jsonfiles/pi1_updated.json | 13 - .../test/STD_1.1.3/jsonfiles/pi2.json | 12 - near-rt-ric-simulator/test/STD_2.0.0/.p.json | 1 - .../test/STD_2.0.0/basic_test.sh | 288 ----------- .../test/STD_2.0.0/build_and_start.sh | 33 -- .../test/STD_2.0.0/jsonfiles/pi1.json | 10 - .../test/STD_2.0.0/jsonfiles/pi1_updated.json | 10 - .../test/STD_2.0.0/jsonfiles/pi2.json | 10 - .../test/STD_2.0.0/jsonfiles/std_1.json | 56 --- near-rt-ric-simulator/test/common/.gitignore | 1 - near-rt-ric-simulator/tests/.gitignore | 1 - near-rt-ric-simulator/tests/test_std_1_1_3.py | 459 ------------------ near-rt-ric-simulator/tests/test_std_2_0_0.py | 436 ----------------- .../.gitattributes | 0 .../.gitignore | 0 .../Dockerfile | 0 .../LICENSES.txt | 0 .../README.md | 0 .../api/OSC_2.1.0/openapi.yaml | 39 +- .../certificate/cert.crt | 0 .../certificate/generate_cert_and_key.sh | 0 .../certificate/key.crt | 0 .../certificate/pass | 0 .../container-tag.yaml | 0 .../nginx.conf | 0 .../src/OSC_2.1.0/.gitignore | 0 .../src/OSC_2.1.0/a1.py | 0 .../src/OSC_2.1.0/main.py | 1 - .../src/OSC_2.1.0/var_declaration.py | 0 .../src/common}/.gitignore | 0 .../src/common/maincommon.py | 0 .../src/common/utils.py | 0 .../src/start.sh | 0 .../test/a1_2.1.1}/basic_test.sh | 76 +-- .../test/a1_2.1.1}/build_and_start.sh | 0 .../test/a1_2.1.1}/jsonfiles/pi1.json | 0 .../test/a1_2.1.1}/jsonfiles/pi2.json | 0 .../jsonfiles/pi2_missing_param.json | 0 .../test/a1_2.1.1}/jsonfiles/pt1.json | 0 .../test/a1_2.1.1}/jsonfiles/pt2.json | 0 .../test/common}/.gitignore | 0 .../test/common/compare_json.py | 0 .../test/common/test_common.sh | 0 .../common => near-rt-ric/tests}/.gitignore | 0 .../tests/test_osc_2_1_0.py | 0 .../tests/unittest_setup.py | 0 61 files changed, 64 insertions(+), 3242 deletions(-) delete mode 100644 docs/favicon.ico delete mode 100644 docs/requirements-docs.txt delete mode 100644 near-rt-ric-simulator/api/STD_1.1.3/STD_A1.yaml delete mode 100644 near-rt-ric-simulator/api/STD_2.0.0/ORAN_A1-p_V2.0.0_api.yaml delete mode 100644 near-rt-ric-simulator/src/STD_1.1.3/a1.py delete mode 100644 near-rt-ric-simulator/src/STD_1.1.3/callBack.py delete mode 100644 near-rt-ric-simulator/src/STD_1.1.3/main.py delete mode 100644 near-rt-ric-simulator/src/STD_1.1.3/var_declaration.py delete mode 100644 near-rt-ric-simulator/src/STD_2.0.0/a1.py delete mode 100644 near-rt-ric-simulator/src/STD_2.0.0/callBack.py delete mode 100644 near-rt-ric-simulator/src/STD_2.0.0/main.py delete mode 100644 near-rt-ric-simulator/src/STD_2.0.0/var_declaration.py delete mode 100755 near-rt-ric-simulator/test/STD_1.1.3/basic_test.sh delete mode 100755 near-rt-ric-simulator/test/STD_1.1.3/build_and_start.sh delete mode 100644 near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi1.json delete mode 100644 near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi1_updated.json delete mode 100644 near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi2.json delete mode 100644 near-rt-ric-simulator/test/STD_2.0.0/.p.json delete mode 100755 near-rt-ric-simulator/test/STD_2.0.0/basic_test.sh delete mode 100755 near-rt-ric-simulator/test/STD_2.0.0/build_and_start.sh delete mode 100644 near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi1.json delete mode 100644 near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi1_updated.json delete mode 100644 near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi2.json delete mode 100644 near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/std_1.json delete mode 100644 near-rt-ric-simulator/test/common/.gitignore delete mode 100644 near-rt-ric-simulator/tests/.gitignore delete mode 100644 near-rt-ric-simulator/tests/test_std_1_1_3.py delete mode 100644 near-rt-ric-simulator/tests/test_std_2_0_0.py rename {near-rt-ric-simulator => near-rt-ric}/.gitattributes (100%) rename {near-rt-ric-simulator => near-rt-ric}/.gitignore (100%) rename {near-rt-ric-simulator => near-rt-ric}/Dockerfile (100%) rename {near-rt-ric-simulator => near-rt-ric}/LICENSES.txt (100%) rename {near-rt-ric-simulator => near-rt-ric}/README.md (100%) rename {near-rt-ric-simulator => near-rt-ric}/api/OSC_2.1.0/openapi.yaml (90%) rename {near-rt-ric-simulator => near-rt-ric}/certificate/cert.crt (100%) rename {near-rt-ric-simulator => near-rt-ric}/certificate/generate_cert_and_key.sh (100%) rename {near-rt-ric-simulator => near-rt-ric}/certificate/key.crt (100%) rename {near-rt-ric-simulator => near-rt-ric}/certificate/pass (100%) rename {near-rt-ric-simulator => near-rt-ric}/container-tag.yaml (100%) rename {near-rt-ric-simulator => near-rt-ric}/nginx.conf (100%) rename {near-rt-ric-simulator => near-rt-ric}/src/OSC_2.1.0/.gitignore (100%) rename {near-rt-ric-simulator => near-rt-ric}/src/OSC_2.1.0/a1.py (100%) rename {near-rt-ric-simulator => near-rt-ric}/src/OSC_2.1.0/main.py (99%) rename {near-rt-ric-simulator => near-rt-ric}/src/OSC_2.1.0/var_declaration.py (100%) rename {near-rt-ric-simulator/src/STD_1.1.3 => near-rt-ric/src/common}/.gitignore (100%) rename {near-rt-ric-simulator => near-rt-ric}/src/common/maincommon.py (100%) rename {near-rt-ric-simulator => near-rt-ric}/src/common/utils.py (100%) rename {near-rt-ric-simulator => near-rt-ric}/src/start.sh (100%) rename {near-rt-ric-simulator/test/OSC_2.1.0 => near-rt-ric/test/a1_2.1.1}/basic_test.sh (78%) rename {near-rt-ric-simulator/test/OSC_2.1.0 => near-rt-ric/test/a1_2.1.1}/build_and_start.sh (100%) rename {near-rt-ric-simulator/test/OSC_2.1.0 => near-rt-ric/test/a1_2.1.1}/jsonfiles/pi1.json (100%) rename {near-rt-ric-simulator/test/OSC_2.1.0 => near-rt-ric/test/a1_2.1.1}/jsonfiles/pi2.json (100%) rename {near-rt-ric-simulator/test/OSC_2.1.0 => near-rt-ric/test/a1_2.1.1}/jsonfiles/pi2_missing_param.json (100%) rename {near-rt-ric-simulator/test/OSC_2.1.0 => near-rt-ric/test/a1_2.1.1}/jsonfiles/pt1.json (100%) rename {near-rt-ric-simulator/test/OSC_2.1.0 => near-rt-ric/test/a1_2.1.1}/jsonfiles/pt2.json (100%) rename {near-rt-ric-simulator/src/STD_2.0.0 => near-rt-ric/test/common}/.gitignore (100%) rename {near-rt-ric-simulator => near-rt-ric}/test/common/compare_json.py (100%) rename {near-rt-ric-simulator => near-rt-ric}/test/common/test_common.sh (100%) rename {near-rt-ric-simulator/src/common => near-rt-ric/tests}/.gitignore (100%) rename {near-rt-ric-simulator => near-rt-ric}/tests/test_osc_2_1_0.py (100%) rename {near-rt-ric-simulator => near-rt-ric}/tests/unittest_setup.py (100%) diff --git a/docs/favicon.ico b/docs/favicon.ico deleted file mode 100644 index 00b0fd0ef0b4e78fbb8cdb413ce84561dfeb404f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15086 zcmcJW2V9fq_Q!*^*Y@7O)jL{-B7s1{OaiD3*&`%Ttk%}OweH#~IBK=vV#v^<Lfxo< z;H-NqZk)HabyQo$6+osenK}R8lMqZGC}?j!pTm>9$@`w~^E~HS=Nvd315SI6Sj<7m z<)mA2I6XNW4wu{Txig3J0M|OBWZzGEkHd+;53KPU+`<_RVb@hJOLg&A{f!h$4Wh)s zoukD4dq#=Bm=rA@x+YpY@=UaN-2G_r#OINsugjMR=Tv_0u;@jo-HOK(t+!?kusoLB z%k1XYye^MC{$rH;pU#HQ+Wl2Lt$j|U*z5gBv7c?EIOv;5ai0U=e+>T0Xz>sw_zC=w ziL^{S74kJL6NNzLP_$?PEfGd4XWJ!J4d?GscyO~$T6OttKG)=CPfL@m4_mAMZGRWx z=-fWS(bX}+(K9Ym?0Y{_EUAqY_a^W|z5w$O$SeNnCj2p??<htTMzNwrD5GeBT_O#( z+*>a;&3a~Ga%GF9$vKIo$;rRJE#K?zTk0q_iEwoKF2d2}&j?2kCHM*akhbv82X{DR zF(i`Wgv%&KxSVF#Y#|S`Q)Fp!zJO<PY6H*ss58%a?_Xk9;BE);h8zcfO@z27m^~;; z)WGl9n<5?6?Y~Sk6m~KSqPCyr?XSxpD~zF7VLa-QfWFvB{@f$PGdWG*zt1y1FwMgF zr;lFOrf>QV%pD-3ArB(NB3kO?Oy7I-qENXXO&%zrF(V{2Vq^e~816@72I5+9Acgt{ zQ@G1eigKKQdQ8)?{}_>e{#fwG3s+N^T{8KY9VQFo6R5+%3h=MDFxts|6Q{oK!TbRv z1l)y-dpOao-d;3%av$oq;B%5L{fq*Z29w`H3HdJYCZBn(<TKlmyl2>w-&7vSM_bac z{>~KQ{V6SVo(x+FMP25iY>9s*`XLc@SW9zkQmK2_W2nOs$i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r(u2K4K<TQ6489zJV)3hb|($sk*`Ee@wr$m<etY0wRXR^sZ zk<;G6X$0p(n?W4IFz0!rkn>s?W51RB@xKmSquu4^#%Y849ACRpb^tkiI9mi>IYB;( zial=6shMviMi}!R&Mj+MuAq#29A`%C)lCoXK`cL8c5nqrZeX8MTCemgZFyfDFI*>& zwoiTOWp)W?4ea~PGIMZ$jr3f)IuE0qiZQm>zZ>d({U}Q0g;*bWY~K}mek?c6{AwM$ zUveu;y*8B6Gt7s4y*K0H2&=QE9%lFNtM|OWV6S(V-JdOa_`B+U-vaf%P7wRD+1SK7 z%Hr|S5ae#;W1spE`?SYTu}9z1ct6`09jPr7Zmo*KdSs;GKn$6S`!+zTRq<rD-w<QH z>#4|)A6qSv+`X=j8I@uVyMQ%yOI5vaZAF&D^0JA1kD{-5W`#F#uae~@sAA17*f03z z6k)9n?wb(&e$e&f@&0U&%=QHj5#vioTxJc{!sTUkcHh3JvmR4Sf&rNO`eEH2fOWTD z9@gZXB)-ctmCr?bWUXPqvz$F>dnJ6_<a!kh8!A<Es6CrQ*&L4b(`GW(4a8azV>&F5 z=62Q8kCg%0*+%I9)p$mU&vVoRF?SX#wZmG#=3o{-6ihEH5{xfcjdfq=Ud?lG?}v~+ z@KJAd`;#7suPCc+_Se>0ZK`@|v7#c~JgQuVScQ(Cs0uT9Hm+o1CmxPfB=Qj^m26BZ XY+}&}KC=mD;X?Iq*l*cA?B4$ePY*3q diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt deleted file mode 100644 index 09a0c1c..0000000 --- a/docs/requirements-docs.txt +++ /dev/null @@ -1,5 +0,0 @@ -sphinx -sphinx-rtd-theme -sphinxcontrib-httpdomain -recommonmark -lfdocs-conf diff --git a/near-rt-ric-simulator/api/STD_1.1.3/STD_A1.yaml b/near-rt-ric-simulator/api/STD_1.1.3/STD_A1.yaml deleted file mode 100644 index 71638f4..0000000 --- a/near-rt-ric-simulator/api/STD_1.1.3/STD_A1.yaml +++ /dev/null @@ -1,258 +0,0 @@ -openapi: 3.0.0 -info: - title: 'A1-P Policy Management Service' - version: 1.1.3 - description: | - API for Policy Management Service. - © 2019, O-RAN Alliance. - All rights reserved. -externalDocs: - description: 'ORAN-WG2.A1.AP-v01.01 A1 interface: Application protocol' - url: 'https://www.o-ran.org/specifications' -servers: - - url: '{apiRoot}/A1-P/v1' - variables: - apiRoot: - default: 'https://example.com' - description: 'apiRoot as defined in clause 4.2.1 in ORAN-WG2.A1.AP' -paths: - '/policies': - get: - operationId: a1.get_all_policy_identities - description: 'Get all policy identities' - tags: - - All Policy Identities - responses: - 200: - description: 'Array of all policy identities' - content: - application/json: - schema: - type: array - items: - "$ref": "#/components/schemas/PolicyId" - minItems: 0 - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - - '/policies/{policyId}': - parameters: - - name: policyId - in: path - required: true - schema: - "$ref": "#/components/schemas/PolicyId" - put: - operationId: a1.put_policy - description: 'Create, or update, a policy' - tags: - - Individual Policy Object - parameters: - - name: notificationDestination - in: query - required: false - schema: - "$ref": "#/components/schemas/NotificationDestination" - requestBody: - required: true - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyObject" - responses: - 200: - description: 'The policy was updated' - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyObject" - 201: - description: 'The policy was created' - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyObject" - headers: - Location: - description: 'Contains the URI of the created policy' - required: true - schema: - type: string - - 400: - "$ref": "#/components/responses/400-BadRequest" - 409: - "$ref": "#/components/responses/409-Conflict" - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - 507: - "$ref": "#/components/responses/507-InsufficientStorage" - callbacks: - policyStatusNotification: - '{$request.query.notificationDestination}': - post: - description: 'Notify about status changes for this policy' - requestBody: - required: true - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyStatusObject" - responses: - 204: - description: 'Notification received' - get: - operationId: a1.get_policy - description: 'Query a policy' - tags: - - Individual Policy Object - responses: - 200: - description: 'The requested policy' - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyObject" - 404: - "$ref": "#/components/responses/404-NotFound" - 409: - "$ref": "#/components/responses/409-Conflict" - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - delete: - operationId: a1.delete_policy - description: 'Delete a policy' - tags: - - Individual Policy Object - responses: - 204: - description: 'The policy was deleted' - 404: - "$ref": "#/components/responses/404-NotFound" - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - - '/policies/{policyId}/status': - parameters: - - name: policyId - in: path - required: true - schema: - "$ref": "#/components/schemas/PolicyId" - get: - operationId: a1.get_policy_status - description: 'Query a policy status' - tags: - - Individual Policy Status Object - responses: - 200: - description: 'The requested policy status' - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyStatusObject" - 404: - "$ref": "#/components/responses/404-NotFound" - 409: - "$ref": "#/components/responses/409-Conflict" - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - -components: - schemas: - # - # Representation objects - # - PolicyObject: - description: 'A generic policy object that can be used to transport any policy. Additionally, a policy shall be valid according to the schema of its specific policy type.' - type: object - - PolicyStatusObject: - description: 'A generic policy status object that can be used to transport any policy status. Additionally, a policy status shall be valid according to the schema of its specific policy type.' - type: object - - ProblemDetails: - description: 'A problem detail to carry details in a HTTP response according to RFC 7807' - type: object - properties: - type: - type: string - title: - type: string - status: - type: number - detail: - type: string - instance: - type: string - - # - # Simple data types - # - NotificationDestination: - description: 'A complete callback URI defined according to IETF RFC 3986 where to send notifications' - type: string - - PolicyId: - description: 'Policy identifier assigned by the A1-P Consumer when a policy is created' - type: string - - responses: - 400-BadRequest: - description: 'Object in payload not properly formulated or not related to the method' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 404-NotFound: - description: 'No resource found at the URI' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 405-MethodNotAllowed: - description: 'Method not allowed for the URI' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 409-Conflict: - description: 'Request could not be processed in the current state of the resource' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 429-TooManyRequests: - description: 'Too many requests have been sent in a given amount of time' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 503-ServiceUnavailable: - description: 'The provider is currently unable to handle the request due to a temporary overload' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 507-InsufficientStorage: - description: 'The method could not be performed on the resource because the provider is unable to store the representation needed to successfully complete the request' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" \ No newline at end of file diff --git a/near-rt-ric-simulator/api/STD_2.0.0/ORAN_A1-p_V2.0.0_api.yaml b/near-rt-ric-simulator/api/STD_2.0.0/ORAN_A1-p_V2.0.0_api.yaml deleted file mode 100644 index 3cb62c5..0000000 --- a/near-rt-ric-simulator/api/STD_2.0.0/ORAN_A1-p_V2.0.0_api.yaml +++ /dev/null @@ -1,341 +0,0 @@ -openapi: 3.0.0 -info: - title: 'A1-P Policy Management Service' - version: 2.0.0 - description: | - API for Policy Management Service. - © 2020, O-RAN Alliance. - All rights reserved. -externalDocs: - description: 'O-RAN.WG2.A1AP-v02.00 A1 interface: Application Protocol' - url: 'https://www.o-ran.org/specifications' -servers: - - url: '{apiRoot}/A1-P/v2' - variables: - apiRoot: - default: 'https://example.com' - description: 'apiRoot as defined in clause 4.2.1 in ORAN-WG2.A1.AP' -paths: - '/policytypes': - get: - operationId: a1.get_all_policy_types - description: 'Get all policy type identifiers' - tags: - - All Policy Type Identifiers - responses: - 200: - description: 'Array of all policy type identifiers' - content: - application/json: - schema: - type: array - items: - "$ref": "#/components/schemas/PolicyTypeId" - minItems: 0 - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - - '/policytypes/{policyTypeId}': - parameters: - - name: policyTypeId - in: path - required: true - schema: - "$ref": "#/components/schemas/PolicyTypeId" - get: - operationId: a1.get_policy_type - description: 'Get the schemas for a policy type' - tags: - - Individual Policy Type - responses: - 200: - description: 'The policy type schemas' - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyTypeObject" - 404: - "$ref": "#/components/responses/404-NotFound" - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - - '/policytypes/{policyTypeId}/policies': - get: - operationId: a1.get_all_policy_identities - description: 'Get all policy identifiers' - tags: - - All Policy Identifiers - parameters: - - name: policyTypeId - in: path - required: true - schema: - "$ref": "#/components/schemas/PolicyTypeId" - responses: - 200: - description: 'Array of all policy identifiers' - content: - application/json: - schema: - type: array - items: - "$ref": "#/components/schemas/PolicyId" - minItems: 0 - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - - '/policytypes/{policyTypeId}/policies/{policyId}': - parameters: - - name: policyTypeId - in: path - required: true - schema: - "$ref": "#/components/schemas/PolicyTypeId" - - name: policyId - in: path - required: true - schema: - "$ref": "#/components/schemas/PolicyId" - put: - operationId: a1.put_policy - description: 'Create, or update, a policy' - tags: - - Individual Policy Object - parameters: - - name: notificationDestination - in: query - required: false - schema: - "$ref": "#/components/schemas/NotificationDestination" - requestBody: - required: true - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyObject" - responses: - 200: - description: 'The policy was updated' - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyObject" - 201: - description: 'The policy was created' - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyObject" - headers: - Location: - description: 'Contains the URI of the created policy' - required: true - schema: - type: string - 400: - "$ref": "#/components/responses/400-BadRequest" - 409: - "$ref": "#/components/responses/409-Conflict" - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - 507: - "$ref": "#/components/responses/507-InsufficientStorage" - callbacks: - policyStatusNotification: - '{$request.query.notificationDestination}': - post: - description: 'Notify about status changes for this policy' - requestBody: - required: true - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyStatusObject" - responses: - 204: - description: 'Notification received' - get: - operationId: a1.get_policy - description: 'Query a policy' - tags: - - Individual Policy Object - responses: - 200: - description: 'The requested policy' - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyObject" - 404: - "$ref": "#/components/responses/404-NotFound" - 409: - "$ref": "#/components/responses/409-Conflict" - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - delete: - operationId: a1.delete_policy - description: 'Delete a policy' - tags: - - Individual Policy Object - responses: - 204: - description: 'The policy was deleted' - 404: - "$ref": "#/components/responses/404-NotFound" - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - - '/policytypes/{policyTypeId}/policies/{policyId}/status': - parameters: - - name: policyTypeId - in: path - required: true - schema: - "$ref": "#/components/schemas/PolicyTypeId" - - name: policyId - in: path - required: true - schema: - "$ref": "#/components/schemas/PolicyId" - get: - operationId: a1.get_policy_status - description: 'Query a policy status' - tags: - - Individual Policy Status Object - responses: - 200: - description: 'The requested policy status' - content: - application/json: - schema: - "$ref": "#/components/schemas/PolicyStatusObject" - 404: - "$ref": "#/components/responses/404-NotFound" - 409: - "$ref": "#/components/responses/409-Conflict" - 429: - "$ref": "#/components/responses/429-TooManyRequests" - 503: - "$ref": "#/components/responses/503-ServiceUnavailable" - -components: - schemas: - # - # Representation objects - # - PolicyObject: - description: 'A generic policy object that can be used to transport any policy. Additionally, a policy shall be valid according to the schema of its specific policy type.' - type: object - - PolicyStatusObject: - description: 'A generic policy status object that can be used to transport any policy status. Additionally, a policy status shall be valid according to the schema of its specific policy type.' - type: object - - PolicyTypeObject: - description: 'A definition of a policy type, i.e. the schemas for a policy respectively its status' - type: object - properties: - policySchema: - "$ref": "#/components/schemas/JsonSchema" - statusSchema: - "$ref": "#/components/schemas/JsonSchema" - required: - - policySchema - - ProblemDetails: - description: 'A problem detail to carry details in a HTTP response according to RFC 7807' - type: object - properties: - type: - type: string - title: - type: string - status: - type: number - detail: - type: string - instance: - type: string - - # - # Simple data types - # - JsonSchema: - description: 'A JSON schema following http://json-schema.org/draft-07/schema' - type: object - - NotificationDestination: - description: 'A complete callback URI defined according to IETF RFC 3986 where to send notifications' - type: string - - PolicyId: - description: 'Policy identifier assigned by the A1-P Consumer when a policy is created' - type: string - - PolicyTypeId: - description: 'Policy type identifier assigned by the A1-P Provider' - type: string - - responses: - 400-BadRequest: - description: 'Object in payload not properly formulated or not related to the method' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 404-NotFound: - description: 'No resource found at the URI' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 405-MethodNotAllowed: - description: 'Method not allowed for the URI' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 409-Conflict: - description: 'Request could not be processed in the current state of the resource' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 429-TooManyRequests: - description: 'Too many requests have been sent in a given amount of time' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 503-ServiceUnavailable: - description: 'The provider is currently unable to handle the request due to a temporary overload' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - 507-InsufficientStorage: - description: 'The method could not be performed on the resource because the provider is unable to store the representation needed to successfully complete the request' - content: - application/problem+json: - schema: - "$ref": "#/components/schemas/ProblemDetails" - - diff --git a/near-rt-ric-simulator/src/STD_1.1.3/a1.py b/near-rt-ric-simulator/src/STD_1.1.3/a1.py deleted file mode 100644 index d7169b1..0000000 --- a/near-rt-ric-simulator/src/STD_1.1.3/a1.py +++ /dev/null @@ -1,196 +0,0 @@ -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -import copy -import datetime -import json -import logging -import collections -import time - -from connexion import NoContent -from flask import Flask, escape, request, Response, make_response -from var_declaration import policy_instances, policy_status, callbacks, forced_settings, policy_fingerprint, hosts_set -from utils import calcFingerprint -from maincommon import check_apipath, apipath, get_supported_interfaces_response, extract_host_name - -#Constsants -APPL_JSON='application/json' -APPL_PROB_JSON='application/problem+json' - -# API Function: Get all policy ids -def get_all_policy_identities(): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - return (list(policy_instances.keys()), 200) - -# API Function: Create or update a policy -def put_policy(policyId): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - try: - data = request.data - data = json.loads(data) - except Exception: - pjson=create_problem_json(None, "The policy is corrupt or missing.", 400, None, policyId) - return Response(json.dumps(pjson), 400, mimetype=APPL_PROB_JSON) - - fp_previous=None - retcode=201 - if policyId in policy_instances.keys(): - retcode=200 - fp_previous=calcFingerprint(policy_instances[policyId]) - - fp=calcFingerprint(data) - if (fp in policy_fingerprint.keys()): - p_id=policy_fingerprint[fp] - if (p_id != policyId): - pjson=create_problem_json(None, "The policy json already exists.", 400, None, policyId) - return Response(json.dumps(pjson), 400, mimetype=APPL_PROB_JSON) - - if (fp_previous is not None): - del policy_fingerprint[fp_previous] - - policy_fingerprint[fp]=policyId - - noti=request.args.get('notificationDestination') - callbacks[policyId]=noti - - policy_instances[policyId]=data - ps={} - ps["enforceStatus"] = "UNDEFINED" - policy_status[policyId]=ps - - if (retcode == 200): - return Response(json.dumps(data), 200, mimetype=APPL_JSON) - else: - headers={} - headers['Location']='/A1-P/v1/policies/' + policyId - return Response(json.dumps(data), 201, headers=headers, mimetype=APPL_JSON) - -# API Function: Get a policy -def get_policy(policyId): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - if policyId in policy_instances.keys(): - return Response(json.dumps(policy_instances[policyId]), 200, mimetype=APPL_JSON) - - pjson=create_problem_json(None, "The requested policy does not exist.", 404, None, policyId) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - -# API Function: Delete a policy -def delete_policy(policyId): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - if policyId in policy_instances.keys(): - fp_previous=calcFingerprint(policy_instances[policyId]) - policy_fingerprint.pop(fp_previous) - policy_instances.pop(policyId) - policy_status.pop(policyId) - callbacks.pop(policyId) - return Response('', 204, mimetype=APPL_JSON) - - pjson=create_problem_json(None, "The policy identity does not exist.", 404, "No policy instance has been deleted.", policyId) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - -# API Function: Get status for a policy -def get_policy_status(policyId): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - if policyId in policy_instances.keys(): - return Response(json.dumps(policy_status[policyId]), status=200, mimetype=APPL_JSON) - - pjson=create_problem_json(None, "The policy identity does not exist.", 404, "There is no existing policy instance with the identity: " + policyId, policyId) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - -# Helper: Create a response object if forced http response code is set -def get_forced_response(): - if (forced_settings['code'] is not None): - pjson=create_error_response(forced_settings['code']) - forced_settings['code']=None - return Response(json.dumps(pjson), pjson['status'], mimetype=APPL_PROB_JSON) - return None - -# Helper: Delay if delayed response code is set -def do_delay(): - if (forced_settings['delay'] is not None): - try: - val=int(forced_settings['delay']) - time.sleep(val) - except Exception: - return - -# Helper: Check if response shall be delayed or a forced response shall be sent -def check_modified_response(): - do_delay() - return get_forced_response() - -# Helper: Create a problem json object -def create_problem_json(type_of, title, status, detail, instance): - - error = {} - if type_of is not None: - error["type"] = type_of - if title is not None: - error["title"] = title - if status is not None: - error["status"] = status - if detail is not None: - error["detail"] = detail - if instance is not None: - error["instance"] = instance - return error - -# Helper: Create a problem json based on a generic http response code -def create_error_response(code): - - if code == '400': - return(create_problem_json(None, "Bad request", 400, "Object in payload not properly formulated or not related to the method", None)) - elif code == '404': - return(create_problem_json(None, "Not found", 404, "No resource found at the URI", None)) - elif code == '405': - return(create_problem_json(None, "Method not allowed", 405, "Method not allowed for the URI", None)) - elif code == '409': - return(create_problem_json(None, "Conflict", 409, "Request could not be processed in the current state of the resource", None)) - elif code == '429': - return(create_problem_json(None, "Too many requests", 429, "Too many requests have been sent in a given amount of time", None)) - elif code == '507': - return(create_problem_json(None, "Insufficient storage", 507, "The method could not be performed on the resource because the provider is unable to store the representation needed to successfully complete the request", None)) - elif code == '503': - return(create_problem_json(None, "Service unavailable", 503, "The provider is currently unable to handle the request due to a temporary overload", None)) - else: - return(create_problem_json(None, "Unknown", code, "Not implemented response code", None)) diff --git a/near-rt-ric-simulator/src/STD_1.1.3/callBack.py b/near-rt-ric-simulator/src/STD_1.1.3/callBack.py deleted file mode 100644 index 0e8e416..0000000 --- a/near-rt-ric-simulator/src/STD_1.1.3/callBack.py +++ /dev/null @@ -1,43 +0,0 @@ -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -import json -from flask import Flask, request, Response - -app = Flask(__name__) #NOSONAR - -#Check alive function -@app.route('/', methods=['GET']) -def test(): - - return Response("OK", 200, mimetype='text/plain') - -#Receive status (only for testing callbacks) -#/statustest -@app.route('/statustest', methods=['POST', 'PUT']) -def statustest(): - try: - data = request.data - data = json.loads(data) - except Exception: - return Response("The status data is corrupt or missing.", 400, mimetype='text/plain') - - return Response(json.dumps(data), 200, mimetype='application/json') - -port_number = 2223 - -app.run(port=port_number, host="127.0.0.1", threaded=False) \ No newline at end of file diff --git a/near-rt-ric-simulator/src/STD_1.1.3/main.py b/near-rt-ric-simulator/src/STD_1.1.3/main.py deleted file mode 100644 index 5742791..0000000 --- a/near-rt-ric-simulator/src/STD_1.1.3/main.py +++ /dev/null @@ -1,179 +0,0 @@ -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -import connexion -import json -import sys -import os -import requests - - -from pathlib import Path -from flask import Flask, escape, request, Response -from jsonschema import validate -from var_declaration import policy_instances, policy_status, callbacks, forced_settings, policy_fingerprint, hosts_set -from maincommon import check_apipath, apipath, get_supported_interfaces_response, extract_host_name - -#Constants -TEXT_PLAIN='text/plain' - -check_apipath() - -app = connexion.App(__name__, specification_dir=apipath) - -#Check alive function -@app.route('/', methods=['GET']) -def test(): - - return Response("OK", 200, mimetype=TEXT_PLAIN) - -#Return the current and all supported yamls for the this container -@app.route('/container_interfaces', methods=['GET']) -def container_interfaces(): - - return get_supported_interfaces_response() - -#Delete all created instances and status -@app.route('/deleteinstances', methods=['POST']) -def delete_instances(): - - policy_instances.clear() - policy_status.clear() - callbacks.clear() - forced_settings['code']=None - forced_settings['delay']=None - policy_fingerprint.clear() - return Response("All policy instances deleted", 200, mimetype=TEXT_PLAIN) - -#Delete all - all reset -#(same as delete_instances but kept to in order to use the same interface as other version of the simulator) -@app.route('/deleteall', methods=['POST']) -def delete_all(): - return delete_instances() - -#Set force response for one A1 response -#/forceresponse?code=<responsecode> -@app.route('/forceresponse', methods=['POST']) -def forceresponse(): - - try: - forced_settings['code']=request.args.get('code') - except Exception: - forced_settings['code']=None - return Response("Force response code: " + str(forced_settings['code']) + " set for one single A1 response", 200, mimetype=TEXT_PLAIN) - -#Set force delay response, in seconds, for all A1 responses -#/froceesponse?delay=<seconds> -@app.route('/forcedelay', methods=['POST']) -def forcedelay(): - - try: - forced_settings['delay']=request.args.get('delay') - except Exception: - forced_settings['delay']=None - return Response("Force delay: " + str(forced_settings['delay']) + " sec set for all A1 responses", 200, mimetype=TEXT_PLAIN) - - -#Set status and reason -#/status?policyid=<policyid>&status=<status>[&reason=<reason>] -@app.route('/status', methods=['PUT']) -def setstatus(): - - policy_id=request.args.get('policyid') - if (policy_id is None): - return Response('Parameter <policyid> missing in request', status=400, mimetype=TEXT_PLAIN) - if policy_id not in policy_instances.keys(): - return Response('Policyid: '+policy_id+' not found.', status=404, mimetype=TEXT_PLAIN) - status=request.args.get('status') - if (status is None): - return Response('Parameter <status> missing in request', status=400, mimetype=TEXT_PLAIN) - reason=request.args.get('reason') - ps = {} - ps["enforceStatus"] = status - msg="Status set to "+status - if (reason is not None): - ps["enforceReason"] = reason - msg=msg+" and "+reason - policy_status[policy_id] = ps - msg=msg+" for policy: " + policy_id - return Response(msg, 200, mimetype=TEXT_PLAIN) - -#Send status -#/status?policyid=<policyid> -@app.route('/sendstatus', methods=['POST']) -def sendstatus(): - policyid=request.args.get('policyid') - if (policyid is None): - return Response('Parameter <policyid> missing in request', status=400, mimetype=TEXT_PLAIN) - - if (policyid not in policy_status.keys()): - return Response('Policyid: '+policyid+' not found.', status=404, mimetype=TEXT_PLAIN) - - ps=policy_status[policyid] - cb=callbacks[policyid] - try: - resp=requests.post(cb,json=json.dumps(ps), verify=False) # NOSONAR - except: - return Response('Post status failed, could not send to: '+str(cb), status=500, mimetype=TEXT_PLAIN) - if (resp.status_code<199 & resp.status_code > 299): - return Response('Post status failed with code: '+resp.status_code, status=500, mimetype=TEXT_PLAIN) - - data = resp.json() - return Response(data, 200, mimetype='application/json') - -#Receive status (only for testing callbacks) -#/statustest -@app.route('/statustest', methods=['POST', 'PUT']) -def statustest(): - try: - data = request.data - data = json.loads(data) - except Exception: - return Response("The status data is corrupt or missing.", 400, mimetype=TEXT_PLAIN) - - return Response(json.dumps(data), 200, mimetype='application/json') - -#Metrics function -#Get a named counter -@app.route('/counter/<string:countername>', methods=['GET']) -def getcounter(countername): - - if (countername == "num_instances"): - return Response(str(len(policy_instances)), 200, mimetype=TEXT_PLAIN) - elif (countername == "num_types"): - return Response("0",200, mimetype=TEXT_PLAIN) - elif (countername == "interface"): - p=Path(os.getcwd()) - pp=p.parts - return Response(str(pp[len(pp)-1]),200, mimetype=TEXT_PLAIN) - elif (countername == "remote_hosts"): - hosts=",".join(hosts_set) - return str(hosts),200 - elif (countername == "datadelivery"): - return Response(str(0),200, mimetype=TEXT_PLAIN) - else: - return Response("Counter name: "+countername+" not found.",404, mimetype=TEXT_PLAIN) - -port_number = 2222 -if len(sys.argv) >= 2: - if isinstance(sys.argv[1], int): - port_number = sys.argv[1] - -app.add_api('STD_A1.yaml') - -if __name__ == '__main__': - app.run(port=port_number, host="127.0.0.1", threaded=False) \ No newline at end of file diff --git a/near-rt-ric-simulator/src/STD_1.1.3/var_declaration.py b/near-rt-ric-simulator/src/STD_1.1.3/var_declaration.py deleted file mode 100644 index 06b0031..0000000 --- a/near-rt-ric-simulator/src/STD_1.1.3/var_declaration.py +++ /dev/null @@ -1,24 +0,0 @@ -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# -policy_instances = {} -policy_status = {} -callbacks = {} -forced_settings = {} -forced_settings['code']=None -forced_settings['delay']=None -policy_fingerprint={} -hosts_set=set() diff --git a/near-rt-ric-simulator/src/STD_2.0.0/a1.py b/near-rt-ric-simulator/src/STD_2.0.0/a1.py deleted file mode 100644 index c4aa4ca..0000000 --- a/near-rt-ric-simulator/src/STD_2.0.0/a1.py +++ /dev/null @@ -1,271 +0,0 @@ -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -import copy -import datetime -import json -import logging -import collections -import time - -from connexion import NoContent -from flask import Flask, escape, request, Response, make_response -from jsonschema import validate -from var_declaration import policy_instances, policy_types, policy_status, callbacks, forced_settings, policy_fingerprint, hosts_set -from utils import calcFingerprint -from maincommon import check_apipath, apipath, get_supported_interfaces_response, extract_host_name - -#Constsants -APPL_JSON='application/json' -APPL_PROB_JSON='application/problem+json' - -# API Function: Get all policy type ids -def get_all_policy_types(): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - res = list(policy_types.keys()) - return (res, 200) - -# API Function: Get a policy type -def get_policy_type(policyTypeId): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - policy_type_id=str(policyTypeId) - - if (policy_type_id not in policy_types.keys()): - pjson=create_problem_json(None, "The policy type does not exist.", 404, None, policy_type_id) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - - return Response(json.dumps(policy_types[policy_type_id]), 200, mimetype=APPL_JSON) - -# API Function: Get all policy ids -def get_all_policy_identities(policyTypeId): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - policy_type_id=str(policyTypeId) - - if (policy_type_id not in policy_types.keys()): - pjson=create_problem_json(None, "The policy type does not exist.", 404, None, policy_type_id) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - - return (list(policy_instances[policy_type_id].keys()), 200) - -# API Function: Create or update a policy -def put_policy(policyTypeId, policyId): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - policy_type_id=str(policyTypeId) - policy_id=str(policyId) - - if (policy_type_id not in policy_types.keys()): - pjson=create_problem_json(None, "The policy type does not exist.", 404, None, policy_id) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - - try: - data = request.data - data = json.loads(data) - except Exception: - pjson=create_problem_json(None, "The policy is corrupt or missing.", 400, None, policy_id) - return Response(json.dumps(pjson), 400, mimetype=APPL_PROB_JSON) - - try: - validate(instance=data, schema=policy_types[policy_type_id]['policySchema']) - except Exception: - return (None, 400) - - fp_previous=None - retcode=201 - if policy_id in policy_instances[policy_type_id].keys(): - retcode=200 - fp_previous=calcFingerprint(policy_instances[policy_type_id][policy_id]) - else: - if (policy_id in policy_fingerprint.values()): - return (None, 400) - - fp=calcFingerprint(data) - if (fp in policy_fingerprint.keys()): - p_id=policy_fingerprint[fp] - if (p_id != policy_id): - pjson=create_problem_json(None, "Duplicate, the policy json already exists.", 400, None, policy_id) - return Response(json.dumps(pjson), 400, mimetype=APPL_PROB_JSON) - - if (fp_previous is not None): - del policy_fingerprint[fp_previous] - - policy_fingerprint[fp]=policy_id - - noti=request.args.get('notificationDestination') - callbacks[policy_id]=noti - - policy_instances[policy_type_id][policy_id]=data - - if (policy_types[policy_type_id]['statusSchema'] is not None): - ps = {} - ps["enforceStatus"] = "" - ps["enforceReason"] = "" - policy_status[policy_id] = ps - - if (retcode == 200): - return Response(json.dumps(data), 200, mimetype=APPL_JSON) - else: - headers={} - headers['Location']='/A1-P/v2/policytypes/' + policy_type_id + '/policies/' + policy_id - return Response(json.dumps(data), 201, headers=headers, mimetype=APPL_JSON) - -# API Function: Get a policy -def get_policy(policyTypeId, policyId): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - policy_type_id=str(policyTypeId) - policy_id=str(policyId) - - if (policy_type_id not in policy_types.keys()): - pjson=create_problem_json(None, "The policy type does not exist.", 404, None, policy_id) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - - if (policy_id not in policy_instances[policy_type_id].keys()): - pjson=create_problem_json(None, "The requested policy does not exist.", 404, None, policy_id) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - - return Response(json.dumps(policy_instances[policy_type_id][policy_id]), 200, mimetype=APPL_JSON) - - -# API Function: Delete a policy -def delete_policy(policyTypeId, policyId): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - policy_type_id=str(policyTypeId) - policy_id=str(policyId) - - if (policy_type_id not in policy_types.keys()): - pjson=create_problem_json(None, "The policy type does not exist.", 404, None, policy_id) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - - if (policy_id not in policy_instances[policy_type_id].keys()): - pjson=create_problem_json(None, "The requested policy does not exist.", 404, None, policy_id) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - - fp_previous=calcFingerprint(policy_instances[policy_type_id][policy_id]) - policy_fingerprint.pop(fp_previous) - policy_instances[policy_type_id].pop(policy_id) - policy_status.pop(policy_id) - callbacks.pop(policy_id) - return Response('', 204, mimetype=APPL_JSON) - - -# API Function: Get status for a policy -def get_policy_status(policyTypeId, policyId): - - extract_host_name(hosts_set, request) - - if ((r := check_modified_response()) is not None): - return r - - policy_type_id=str(policyTypeId) - policy_id=str(policyId) - - if (policy_type_id not in policy_types.keys()): - pjson=create_problem_json(None, "The policy type does not exist.", 404, None, policy_id) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - - if (policy_id not in policy_instances[policy_type_id].keys()): - pjson=create_problem_json(None, "The requested policy does not exist.", 404, None, policy_id) - return Response(json.dumps(pjson), 404, mimetype=APPL_PROB_JSON) - - return Response(json.dumps(policy_status[policy_id]), status=200, mimetype=APPL_JSON) - -# Helper: Create a response object if forced http response code is set -def get_forced_response(): - if (forced_settings['code'] is not None): - pjson=create_error_response(forced_settings['code']) - forced_settings['code']=None - return Response(json.dumps(pjson), pjson['status'], mimetype=APPL_PROB_JSON) - return None - -# Helper: Delay if delayed response code is set -def do_delay(): - if (forced_settings['delay'] is not None): - try: - val=int(forced_settings['delay']) - time.sleep(val) - except Exception: - return - -# Helper: Check if response shall be delayed or a forced response shall be sent -def check_modified_response(): - do_delay() - return get_forced_response() - -# Helper: Create a problem json object -def create_problem_json(type_of, title, status, detail, instance): - - error = {} - if type_of is not None: - error["type"] = type_of - if title is not None: - error["title"] = title - if status is not None: - error["status"] = status - if detail is not None: - error["detail"] = detail - if instance is not None: - error["instance"] = instance - return error - -# Helper: Create a problem json based on a generic http response code -def create_error_response(code): - - if code == '400': - return(create_problem_json(None, "Bad request", 400, "Object in payload not properly formulated or not related to the method", None)) - elif code == '404': - return(create_problem_json(None, "Not found", 404, "No resource found at the URI", None)) - elif code == '405': - return(create_problem_json(None, "Method not allowed", 405, "Method not allowed for the URI", None)) - elif code == '409': - return(create_problem_json(None, "Conflict", 409, "Request could not be processed in the current state of the resource", None)) - elif code == '429': - return(create_problem_json(None, "Too many requests", 429, "Too many requests have been sent in a given amount of time", None)) - elif code == '507': - return(create_problem_json(None, "Insufficient storage", 507, "The method could not be performed on the resource because the provider is unable to store the representation needed to successfully complete the request", None)) - elif code == '503': - return(create_problem_json(None, "Service unavailable", 503, "The provider is currently unable to handle the request due to a temporary overload", None)) - else: - return(create_problem_json(None, "Unknown", code, "Not implemented response code", None)) diff --git a/near-rt-ric-simulator/src/STD_2.0.0/callBack.py b/near-rt-ric-simulator/src/STD_2.0.0/callBack.py deleted file mode 100644 index 0e8e416..0000000 --- a/near-rt-ric-simulator/src/STD_2.0.0/callBack.py +++ /dev/null @@ -1,43 +0,0 @@ -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -import json -from flask import Flask, request, Response - -app = Flask(__name__) #NOSONAR - -#Check alive function -@app.route('/', methods=['GET']) -def test(): - - return Response("OK", 200, mimetype='text/plain') - -#Receive status (only for testing callbacks) -#/statustest -@app.route('/statustest', methods=['POST', 'PUT']) -def statustest(): - try: - data = request.data - data = json.loads(data) - except Exception: - return Response("The status data is corrupt or missing.", 400, mimetype='text/plain') - - return Response(json.dumps(data), 200, mimetype='application/json') - -port_number = 2223 - -app.run(port=port_number, host="127.0.0.1", threaded=False) \ No newline at end of file diff --git a/near-rt-ric-simulator/src/STD_2.0.0/main.py b/near-rt-ric-simulator/src/STD_2.0.0/main.py deleted file mode 100644 index dcf835e..0000000 --- a/near-rt-ric-simulator/src/STD_2.0.0/main.py +++ /dev/null @@ -1,255 +0,0 @@ -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -import connexion -import json -import sys -import os -import requests - - -from pathlib import Path -from flask import Flask, escape, request, Response -from jsonschema import validate -from var_declaration import policy_instances, policy_types, policy_status, callbacks, forced_settings, policy_fingerprint, hosts_set, data_delivery_counter -from maincommon import check_apipath, apipath, get_supported_interfaces_response, extract_host_name - -#Constants -TEXT_PLAIN='text/plain' - -check_apipath() - -app = connexion.App(__name__, specification_dir=apipath) - -#Check alive function -@app.route('/', methods=['GET']) -def test(): - - return Response("OK", 200, mimetype=TEXT_PLAIN) - -#Return the current and all supported yamls for the this container -@app.route('/container_interfaces', methods=['GET']) -def container_interfaces(): - - return get_supported_interfaces_response() - -#Delete all created instances and status -@app.route('/deleteinstances', methods=['POST']) -def delete_instances(): - - for i in policy_instances.keys(): - policy_instances[i]={} - policy_status.clear() - callbacks.clear() - forced_settings['code']=None - forced_settings['delay']=None - policy_fingerprint.clear() - return Response("All policy instances deleted", 200, mimetype=TEXT_PLAIN) - -#Delete all - all reset -#(same as delete_instances but kept to in order to use the same interface as other version of the simulator) -@app.route('/deleteall', methods=['POST']) -def delete_all(): - - policy_instances.clear() - policy_types.clear() - policy_status.clear() - callbacks.clear() - forced_settings['code']=None - forced_settings['delay']=None - policy_fingerprint.clear() - return Response("All policy instances and types deleted", 200, mimetype=TEXT_PLAIN) - -#Load a policy type -@app.route('/policytype', methods=['PUT']) -def policytype(): - - policy_type_id=request.args.get('id') - if (policy_type_id is None): - return Response('Parameter <id> missing in request', status=400, mimetype=TEXT_PLAIN) - - try: - data = request.data - data = json.loads(data) - except Exception: - return Response("The policy type is corrupt or missing", 400, mimetype=TEXT_PLAIN) - - if ('policySchema' not in data.keys()): - return Response("The policy type atribute policySchema is missing", 400, mimetype=TEXT_PLAIN) - - retcode=201 - if (policy_type_id in policy_types.keys()): - retcode=200 - if (len(policy_instances[policy_type_id]) > 0): - return Response("The policy type already exists and instances exists", 400, mimetype=TEXT_PLAIN) - - policy_types[policy_type_id]=data - policy_instances[policy_type_id]={} - return Response("Policy type " + policy_type_id + " is OK.", retcode, mimetype=TEXT_PLAIN) - -#Delete a policy type -@app.route('/policytype', methods=['DELETE']) -def del_policytype(): - - policy_type_id=request.args.get('id') - if (policy_type_id is None): - return Response('Parameter <id> missing in request', status=400, mimetype=TEXT_PLAIN) - - if (policy_type_id in policy_types.keys()): - if (len(policy_instances[policy_type_id]) > 0): - return Response("The policy type already exists and instances exists", 400, mimetype=TEXT_PLAIN) - - del policy_types[policy_type_id] - del policy_instances[policy_type_id] - return Response("Policy type " + policy_type_id + " is OK.", 204, mimetype=TEXT_PLAIN) - - return Response("Policy type " + policy_type_id + " not found.", 204, mimetype=TEXT_PLAIN) - - -# Get all policy type ids -@app.route('/policytypes', methods=['GET']) -def get_policytype_ids(): - - return (json.dumps(list(policy_instances.keys())), 200) - - -#Set force response for one A1 response -#/forceresponse?code=<responsecode> -@app.route('/forceresponse', methods=['POST']) -def forceresponse(): - - try: - forced_settings['code']=request.args.get('code') - except Exception: - forced_settings['code']=None - return Response("Force response code: " + str(forced_settings['code']) + " set for one single A1 response", 200, mimetype=TEXT_PLAIN) - -#Set force delay response, in seconds, for all A1 responses -#/froceesponse?delay=<seconds> -@app.route('/forcedelay', methods=['POST']) -def forcedelay(): - - try: - forced_settings['delay']=request.args.get('delay') - except Exception: - forced_settings['delay']=None - return Response("Force delay: " + str(forced_settings['delay']) + " sec set for all A1 responses", 200, mimetype=TEXT_PLAIN) - - -#Set status and reason -#/status?policyid=<policyid>&status=<status>[&reason=<reason>] -@app.route('/status', methods=['PUT']) -def setstatus(): - - policy_id=request.args.get('policyid') - if (policy_id is None): - return Response('Parameter <policyid> missing in request', status=400, mimetype=TEXT_PLAIN) - if policy_id not in policy_status.keys(): - return Response('Policyid: '+policy_id+' not found.', status=404, mimetype=TEXT_PLAIN) - status=request.args.get('status') - if (status is None): - return Response('Parameter <status> missing in request', status=400, mimetype=TEXT_PLAIN) - reason=request.args.get('reason') - ps = {} - ps["enforceStatus"] = status - msg="Status set to "+status - if (reason is not None): - ps["enforceReason"] = reason - msg=msg+" and "+reason - policy_status[policy_id] = ps - msg=msg+" for policy: " + policy_id - return Response(msg, 200, mimetype=TEXT_PLAIN) - -#Send status -#/status?policyid=<policyid> -@app.route('/sendstatus', methods=['POST']) -def sendstatus(): - policyid=request.args.get('policyid') - if (policyid is None): - return Response('Parameter <policyid> missing in request', status=400, mimetype=TEXT_PLAIN) - - if (policyid not in policy_status.keys()): - return Response('Policyid: '+policyid+' not found.', status=404, mimetype=TEXT_PLAIN) - - ps=policy_status[policyid] - cb=callbacks[policyid] - try: - print("Callback url: " + str(cb)) - resp=requests.post(cb,json=json.dumps(ps), verify=False) # NOSONAR - except: - return Response('Post status failed, could not send to: '+str(cb), status=500, mimetype=TEXT_PLAIN) - if (resp.status_code<199 & resp.status_code > 299): - return Response('Post status failed with code: '+resp.status_code, status=500, mimetype=TEXT_PLAIN) - - data = resp.json() - return Response(data, 200, mimetype='application/json') - -#Receive status (only for testing callbacks) -#/statustest -@app.route('/statustest', methods=['POST', 'PUT']) -def statustest(): - try: - data = request.data - data = json.loads(data) - except Exception: - return Response("The status data is corrupt or missing.", 400, mimetype=TEXT_PLAIN) - - return Response(json.dumps(data), 200, mimetype='application/json') - -#Receive a data delivery package -#/datadelivery -@app.route('/datadelivery', methods=['POST']) -def datadelivery(): - global data_delivery_counter - try: - data = request.data - data = json.loads(data) - except Exception: - return Response("The data is corrupt or missing.", 400, mimetype=TEXT_PLAIN) - data_delivery_counter += 1 - return Response("", 200, mimetype=TEXT_PLAIN) - -#Metrics function -#Get a named counter -@app.route('/counter/<string:countername>', methods=['GET']) -def getcounter(countername): - - if (countername == "num_instances"): - return Response(str(len(policy_fingerprint)), 200, mimetype=TEXT_PLAIN) - elif (countername == "num_types"): - return Response(str(len(policy_instances)),200, mimetype=TEXT_PLAIN) - elif (countername == "interface"): - p=Path(os.getcwd()) - pp=p.parts - return Response(str(pp[len(pp)-1]),200, mimetype=TEXT_PLAIN) - elif (countername == "remote_hosts"): - hosts=",".join(hosts_set) - return str(hosts),200 - elif (countername == "datadelivery"): - return Response(str(data_delivery_counter),200, mimetype=TEXT_PLAIN) - else: - return Response("Counter name: "+countername+" not found.",404, mimetype=TEXT_PLAIN) - -port_number = 2222 -if len(sys.argv) >= 2: - if isinstance(sys.argv[1], int): - port_number = sys.argv[1] - -app.add_api('ORAN_A1-p_V2.0.0_api.yaml') - -if __name__ == '__main__': - app.run(port=port_number, host="127.0.0.1", threaded=False) \ No newline at end of file diff --git a/near-rt-ric-simulator/src/STD_2.0.0/var_declaration.py b/near-rt-ric-simulator/src/STD_2.0.0/var_declaration.py deleted file mode 100644 index 5136404..0000000 --- a/near-rt-ric-simulator/src/STD_2.0.0/var_declaration.py +++ /dev/null @@ -1,27 +0,0 @@ -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -policy_types={} -policy_instances = {} -policy_status = {} -callbacks = {} -forced_settings = {} -forced_settings['code']=None -forced_settings['delay']=None -policy_fingerprint={} -hosts_set=set() -data_delivery_counter=0 diff --git a/near-rt-ric-simulator/test/STD_1.1.3/basic_test.sh b/near-rt-ric-simulator/test/STD_1.1.3/basic_test.sh deleted file mode 100755 index 3a828d2..0000000 --- a/near-rt-ric-simulator/test/STD_1.1.3/basic_test.sh +++ /dev/null @@ -1,172 +0,0 @@ -#!/bin/bash - -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -# Script for basic test of the simulator. -# Run the build_and_start with the same arg as this script -if [ $# -ne 1 ]; then - echo "Usage: ./basic_test.sh nonsecure|secure" - exit 1 -fi -if [ "$1" != "nonsecure" ] && [ "$1" != "secure" ]; then - echo "Usage: ./basic_test.sh nonsecure|secure" - exit 1 -fi - -if [ $1 == "nonsecure" ]; then - #Default http port for the simulator - PORT=8085 - # Set http protocol - HTTPX="http" -else - #Default https port for the simulator - PORT=8185 - # Set https protocol - HTTPX="https" -fi - -. ../common/test_common.sh - - -echo "=== Simulator hello world ===" -RESULT="OK" -do_curl GET / 200 - -echo "=== Check used and implemented interfaces ===" -RESULT="Current interface: STD_1.1.3 All supported A1 interface yamls in this container: ['OSC_2.1.0', 'STD_1.1.3', 'STD_2.0.0']" -do_curl GET /container_interfaces 200 - -echo "=== Reset simulator instances ===" -RESULT="All policy instances deleted" -do_curl POST /deleteinstances 200 - -echo "=== Reset simulator, all ===" -RESULT="All policy instances deleted" -do_curl POST /deleteall 200 - -echo "=== API: Get policy instances, shall be empty==" -RESULT="json:[]" -do_curl GET /A1-P/v1/policies 200 - -echo "=== API: Create policy instance pi1 ===" -RESULT="json:{\"scope\": {\"ueId\": \"ue1\", \"groupId\": \"group1\", \"sliceId\": \"slice1\", \"qosId\": \"qos1\", \"cellId\": \"cell1\"}, \"statement\": {\"priorityLevel\": 5}}" -do_curl PUT /A1-P/v1/policies/pi1 201 jsonfiles/pi1.json - -echo "=== API: Update policy instance pi1 ===" -RESULT="json:{\"scope\": {\"ueId\": \"ue1\", \"groupId\": \"group1\", \"sliceId\": \"slice1\", \"qosId\": \"qos1\", \"cellId\": \"cell1\"}, \"statement\": {\"priorityLevel\": 6}}" -do_curl PUT /A1-P/v1/policies/pi1 200 jsonfiles/pi1_updated.json - -echo "=== API: Get policy instances, shall contain pi1==" -RESULT="json:[ \"pi1\" ]" -do_curl GET /A1-P/v1/policies 200 - -echo "=== API: Create policy instance pi2 (copy of pi1). Shall fail ===" -RESULT="json:{\"title\": \"The policy json already exists.\", \"status\": 400, \"instance\": \"pi2\"}" -do_curl PUT /A1-P/v1/policies/pi2 400 jsonfiles/pi1_updated.json - -echo "=== Set force response code 409. ===" -RESULT="*" -do_curl POST '/forceresponse?code=409' 200 - -echo "=== API: Get policy instances, shall fail ==" -RESULT="json:{\"title\": \"Conflict\", \"status\": 409, \"detail\": \"Request could not be processed in the current state of the resource\"}" -do_curl GET /A1-P/v1/policies 409 - -echo "=== API: Get policy status ===" -RESULT="json:{\"enforceStatus\": \"UNDEFINED\"}" -do_curl GET /A1-P/v1/policies/pi1/status 200 - -echo "=== API: Create policy instance pi2 ===" -RESULT="json:{\"scope\": {\"ueId\": \"ue2\", \"groupId\": \"group2\", \"sliceId\": \"slice2\", \"qosId\": \"qos2\", \"cellId\": \"cell2\"}, \"statement\": {\"priorityLevel\": 10}}" -do_curl PUT /A1-P/v1/policies/pi2 201 jsonfiles/pi2.json - -echo "=== API: Update policy instance pi2 ===" -RESULT="json:{\"scope\": {\"ueId\": \"ue2\", \"groupId\": \"group2\", \"sliceId\": \"slice2\", \"qosId\": \"qos2\", \"cellId\": \"cell2\"}, \"statement\": {\"priorityLevel\": 10}}" -do_curl PUT '/A1-P/v1/policies/pi2?notificationDestination=http://localhost:2223/statustest' 200 jsonfiles/pi2.json - -echo "=== API: Get policy instances, shall contain pi1 and pi2==" -RESULT="json:[ \"pi1\", \"pi2\" ]" -do_curl GET /A1-P/v1/policies 200 - -echo "=== Set force delay 10. ===" -RESULT="Force delay: 10 sec set for all A1 responses" -do_curl POST '/forcedelay?delay=10' 200 - -echo "=== API: Get policy instances, shall contain pi1 and pi2 and delayed 10 sec==" -RESULT="json:[ \"pi1\", \"pi2\" ]" -do_curl GET /A1-P/v1/policies 200 - -echo "=== Reset force delay. ===" -RESULT="Force delay: None sec set for all A1 responses" -do_curl POST /forcedelay 200 - -echo "=== API: GET policy instance pi1 ===" -RESULT="json:{\"scope\": {\"ueId\": \"ue1\", \"groupId\": \"group1\", \"sliceId\": \"slice1\", \"qosId\": \"qos1\", \"cellId\": \"cell1\"}, \"statement\": {\"priorityLevel\": 6}}" -do_curl GET /A1-P/v1/policies/pi1 200 - -echo "=== API: GET policy instance pi2 ===" -RESULT="json:{\"scope\": {\"ueId\": \"ue2\", \"groupId\": \"group2\", \"sliceId\": \"slice2\", \"qosId\": \"qos2\", \"cellId\": \"cell2\"}, \"statement\": {\"priorityLevel\": 10}}" -do_curl GET /A1-P/v1/policies/pi2 200 - -echo "=== API: DELETE policy instance pi1 ===" -RESULT="" -do_curl DELETE /A1-P/v1/policies/pi1 204 - -echo "=== API: Get policy status for pi1, shall fail===" -RESULT="json:{\"title\": \"The policy identity does not exist.\", \"status\": 404, \"detail\": \"There is no existing policy instance with the identity: pi1\", \"instance\": \"pi1\"}" -do_curl GET /A1-P/v1/policies/pi1/status 404 - -echo "=== Set status for policy instance pi2 ===" -RESULT="Status set to OK for policy: pi2" -do_curl PUT '/status?policyid=pi2&status=OK' 200 - -echo "=== API: Get policy status for pi2===" -RESULT="json:{\"enforceStatus\": \"OK\"}" -do_curl GET /A1-P/v1/policies/pi2/status 200 - -echo "=== Set status for policy instance pi2 ===" -RESULT="Status set to NOTOK and notok_reason for policy: pi2" -do_curl PUT '/status?policyid=pi2&status=NOTOK&reason=notok_reason' 200 - -echo "=== API: Get policy status for pi2 ===" -RESULT="json:{\"enforceStatus\": \"NOTOK\", \"enforceReason\": \"notok_reason\"}" -do_curl GET /A1-P/v1/policies/pi2/status 200 - -echo "=== Send status for pi2===" -RESULT="json:{\"enforceStatus\": \"NOTOK\", \"enforceReason\": \"notok_reason\"}" -do_curl POST '/sendstatus?policyid=pi2' 200 - -echo "=== Get counter: intstance ===" -RESULT="1" -do_curl GET /counter/num_instances 200 - -echo "=== Get counter: types (shall be 0)===" -RESULT="0" -do_curl GET /counter/num_types 200 - -echo "=== Get counter: interface ===" -RESULT="STD_1.1.3" -do_curl GET /counter/interface 200 - -echo "=== Get counter: remote hosts ===" -RESULT="*" -do_curl GET '/counter/remote_hosts' 200 - -echo "********************" -echo "*** All tests ok ***" -echo "********************" diff --git a/near-rt-ric-simulator/test/STD_1.1.3/build_and_start.sh b/near-rt-ric-simulator/test/STD_1.1.3/build_and_start.sh deleted file mode 100755 index 1d56487..0000000 --- a/near-rt-ric-simulator/test/STD_1.1.3/build_and_start.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -# Script to build and start the container - -echo "Building image" -cd ../../ - -#Build the image -docker build -t a1test . - -docker stop a1StdSimulator > /dev/null 2>&1 -docker rm -f a1StdSimulator > /dev/null 2>&1 - -echo "Starting ric-sim" -#Run the container in interactive mode, unsecure port 8085, secure port 8185 -docker run -it -p 8085:8085 -p 8185:8185 -e A1_VERSION=STD_1.1.3 -e ALLOW_HTTP=true -e REMOTE_HOSTS_LOGGING=1 --volume "$PWD/certificate:/usr/src/app/cert" --name a1StdSimulator a1test diff --git a/near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi1.json b/near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi1.json deleted file mode 100644 index 74f22c7..0000000 --- a/near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi1.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "scope": { - "ueId": "ue1", - "groupId": "group1", - "sliceId": "slice1", - "qosId": "qos1", - "cellId": "cell1" - }, - "statement": { - "priorityLevel": 5 - } -} - diff --git a/near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi1_updated.json b/near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi1_updated.json deleted file mode 100644 index c6970ef..0000000 --- a/near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi1_updated.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "scope": { - "ueId": "ue1", - "groupId": "group1", - "sliceId": "slice1", - "qosId": "qos1", - "cellId": "cell1" - }, - "statement": { - "priorityLevel": 6 - } -} - diff --git a/near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi2.json b/near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi2.json deleted file mode 100644 index f86f1bc..0000000 --- a/near-rt-ric-simulator/test/STD_1.1.3/jsonfiles/pi2.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "scope": { - "ueId": "ue2", - "groupId": "group2", - "sliceId": "slice2", - "qosId": "qos2", - "cellId": "cell2" - }, - "statement": { - "priorityLevel": 10 - } -} \ No newline at end of file diff --git a/near-rt-ric-simulator/test/STD_2.0.0/.p.json b/near-rt-ric-simulator/test/STD_2.0.0/.p.json deleted file mode 100644 index 0967ef4..0000000 --- a/near-rt-ric-simulator/test/STD_2.0.0/.p.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/near-rt-ric-simulator/test/STD_2.0.0/basic_test.sh b/near-rt-ric-simulator/test/STD_2.0.0/basic_test.sh deleted file mode 100755 index 576bd5e..0000000 --- a/near-rt-ric-simulator/test/STD_2.0.0/basic_test.sh +++ /dev/null @@ -1,288 +0,0 @@ -#!/bin/bash - -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -# Script for basic test of the simulator. -# Run the build_and_start with the same arg as this script -if [ $# -ne 1 ]; then - echo "Usage: ./basic_test.sh nonsecure|secure" - exit 1 -fi -if [ "$1" != "nonsecure" ] && [ "$1" != "secure" ]; then - echo "Usage: ./basic_test.sh nonsecure|secure" - exit 1 -fi - -if [ $1 == "nonsecure" ]; then - #Default http port for the simulator - PORT=8085 - # Set http protocol - HTTPX="http" -else - #Default https port for the simulator - PORT=8185 - # Set https protocol - HTTPX="https" -fi - -. ../common/test_common.sh - - -echo "=== Simulator hello world ===" -RESULT="OK" -do_curl GET / 200 - -echo "=== Check used and implemented interfaces ===" -RESULT="Current interface: STD_2.0.0 All supported A1 interface yamls in this container: ['OSC_2.1.0', 'STD_1.1.3', 'STD_2.0.0']" -do_curl GET /container_interfaces 200 - -echo "=== Reset simulator instances ===" -RESULT="All policy instances deleted" -do_curl POST /deleteinstances 200 - -echo "=== Reset simulator, all ===" -RESULT="All policy instances and types deleted" -do_curl POST /deleteall 200 - -echo "=== Get counter: interface ===" -RESULT="STD_2.0.0" -do_curl GET /counter/interface 200 - -echo "=== Get counter: remote hosts ===" -RESULT="*" -do_curl GET /counter/remote_hosts 200 - -echo "=== Get counter: intstance ===" -RESULT="0" -do_curl GET /counter/num_instances 200 - -echo "=== Get counter: types (shall be 0)===" -RESULT="0" -do_curl GET /counter/num_types 200 - -echo "=== API: Get policy types, shall be empty array ==" -RESULT="json:[]" -do_curl GET /A1-P/v2/policytypes 200 - -echo "=== API: Get policy instances for type 1, type not found==" -RESULT="json:{\"title\": \"The policy type does not exist.\", \"status\": 404, \"instance\": \"1\"}" -do_curl GET /A1-P/v2/policytypes/1/policies 404 - -echo "=== API: Get policy instances, type not found==" -RESULT="json:{\"title\": \"The policy type does not exist.\", \"status\": 404, \"instance\": \"test\"}" -do_curl GET /A1-P/v2/policytypes/test/policies 404 - -echo "=== Put a policy type: STD_1 ===" -RESULT="Policy type STD_1 is OK." -do_curl PUT '/policytype?id=STD_1' 201 jsonfiles/std_1.json - -echo "=== Put a policy type: STD_1, again ===" -RESULT="Policy type STD_1 is OK." -do_curl PUT '/policytype?id=STD_1' 200 jsonfiles/std_1.json - -echo "=== API: Get policy type ids, shall contain type STD_1 ==" -RESULT="json:[ \"STD_1\" ]" -do_curl GET /A1-P/v2/policytypes 200 - -echo "=== Delete a policy type: STD_1 ===" -RESULT="" -do_curl DELETE '/policytype?id=STD_1' 204 - -echo "=== API: Get policy type ids, shall be empty ==" -RESULT="json:[]" -do_curl GET /A1-P/v2/policytypes 200 - -echo "=== Put a policy type: STD_1 ===" -RESULT="Policy type STD_1 is OK." -do_curl PUT '/policytype?id=STD_1' 201 jsonfiles/std_1.json - -echo "=== API: Get policy type ids, shall contain type STD_1 ==" -RESULT="json:[ \"STD_1\" ]" -do_curl GET /A1-P/v2/policytypes 200 - -echo "=== Get counter: types (shall be 1)===" -RESULT="1" -do_curl GET /counter/num_types 200 - -echo "=== API: Get policy type: STD_1 ===" -res=$(cat jsonfiles/std_1.json) -RESULT="json:$res" -do_curl GET /A1-P/v2/policytypes/STD_1 200 - -echo "=== API: Get policy instances, shall be empty==" -RESULT="json:[ ]" -do_curl GET /A1-P/v2/policytypes/STD_1/policies 200 - -echo "=== API: Create policy instance pi1 of type: STD_1 ===" -res=$(cat jsonfiles/pi1.json) -RESULT="json:$res" -do_curl PUT /A1-P/v2/policytypes/STD_1/policies/pi1 201 jsonfiles/pi1.json - -echo "=== API: Get policy instance pi1 of type: STD_1 ===" -res=$(cat jsonfiles/pi1.json) -RESULT="json:$res" -do_curl GET /A1-P/v2/policytypes/STD_1/policies/pi1 200 - -echo "=== API: Update policy instance pi1 of type: STD_1===" -res=$(cat jsonfiles/pi1.json) -RESULT="json:$res" -do_curl PUT /A1-P/v2/policytypes/STD_1/policies/pi1 200 jsonfiles/pi1.json - -echo "=== API: Update policy instance pi1 of type: STD_1===" -res=$(cat jsonfiles/pi1_updated.json) -RESULT="json:$res" -do_curl PUT /A1-P/v2/policytypes/STD_1/policies/pi1 200 jsonfiles/pi1_updated.json - -echo "=== API: Duplicate policy instance pi2 of type: STD_1===" -res=$(cat jsonfiles/pi1_updated.json) -RESULT="json:{\"title\": \"Duplicate, the policy json already exists.\", \"status\": 400, \"instance\": \"pi2\"}" -do_curl PUT /A1-P/v2/policytypes/STD_1/policies/pi2 400 jsonfiles/pi1_updated.json - -echo "=== API: Get policy instances, shall contain pi1==" -RESULT="json:[ \"pi1\" ]" -do_curl GET /A1-P/v2/policytypes/STD_1/policies 200 - -echo "=== Get counter: types (shall be 1)===" -RESULT="1" -do_curl GET /counter/num_types 200 - -echo "=== Get counter: intstance ===" -RESULT="1" -do_curl GET /counter/num_instances 200 - - -echo "=== Set force response code 409. ===" -RESULT="*" -do_curl POST '/forceresponse?code=409' 200 - -echo "=== API: Get policy instances, shall fail with 409 ==" -RESULT="json:{\"title\": \"Conflict\", \"status\": 409, \"detail\": \"Request could not be processed in the current state of the resource\"}" -do_curl GET /A1-P/v2/policytypes/STD_1/policies 409 - -echo "=== API: Get policy status ===" -RESULT="json:{\"enforceStatus\": \"\", \"enforceReason\": \"\"}" -do_curl GET /A1-P/v2/policytypes/STD_1/policies/pi1/status 200 - -echo "=== API: Create policy instance pi2 of type: STD_1 ===" -res=$(cat jsonfiles/pi2.json) -RESULT="json:$res" -do_curl PUT /A1-P/v2/policytypes/STD_1/policies/pi2 201 jsonfiles/pi2.json - -echo "=== API: Update policy instance pi2 of type: STD_1 ===" -res=$(cat jsonfiles/pi2.json) -RESULT="json:$res" -do_curl PUT '/A1-P/v2/policytypes/STD_1/policies/pi2?notificationDestination=http://localhost:2223/statustest' 200 jsonfiles/pi2.json - -echo "=== API: Get policy instances, shall contain pi1 and pi2==" -RESULT="json:[ \"pi1\", \"pi2\" ]" -do_curl GET /A1-P/v2/policytypes/STD_1/policies 200 - -echo "=== Get counter: types (shall be 1)===" -RESULT="1" -do_curl GET /counter/num_types 200 - -echo "=== Get counter: intstance ===" -RESULT="2" -do_curl GET /counter/num_instances 200 - -echo "=== Set force delay 10. ===" -RESULT="Force delay: 10 sec set for all A1 responses" -do_curl POST '/forcedelay?delay=10' 200 - -echo "=== API: Get policy instances, shall contain pi1 and pi2==" -RESULT="json:[ \"pi1\", \"pi2\" ]" -do_curl GET /A1-P/v2/policytypes/STD_1/policies 200 - -echo "=== Reset force delay. ===" -RESULT="Force delay: None sec set for all A1 responses" -do_curl POST /forcedelay 200 - -echo "=== API: Get policy instance pi1 of type: STD_1 ===" -res=$(cat jsonfiles/pi1_updated.json) -RESULT="json:$res" -do_curl GET /A1-P/v2/policytypes/STD_1/policies/pi1 200 - -echo "=== API: Get policy instance pi2 of type: STD_1 ===" -res=$(cat jsonfiles/pi2.json) -RESULT="json:$res" -do_curl GET /A1-P/v2/policytypes/STD_1/policies/pi2 200 - -echo "=== API: DELETE policy instance pi1 ===" -RESULT="" -do_curl DELETE /A1-P/v2/policytypes/STD_1/policies/pi1 204 - -echo "=== API: Get policy instances, shall contain pi1 and pi2==" -RESULT="json:[ \"pi2\" ]" -do_curl GET /A1-P/v2/policytypes/STD_1/policies 200 - -echo "=== API: Get policy status ===" -RESULT="json:{\"enforceStatus\": \"\", \"enforceReason\": \"\"}" -do_curl GET /A1-P/v2/policytypes/STD_1/policies/pi2/status 200 - -echo "=== Set status for policy instance pi2 ===" -RESULT="Status set to OK for policy: pi2" -do_curl PUT '/status?policyid=pi2&status=OK' 200 - -echo "=== API: Get policy status ===" -RESULT="json:{\"enforceStatus\": \"OK\"}" -do_curl GET /A1-P/v2/policytypes/STD_1/policies/pi2/status 200 - -echo "=== Set status for policy instance pi2 ===" -RESULT="Status set to NOTOK and notok_reason for policy: pi2" -do_curl PUT '/status?policyid=pi2&status=NOTOK&reason=notok_reason' 200 - -echo "=== API: Get policy status ===" -RESULT="json:{\"enforceStatus\": \"NOTOK\", \"enforceReason\":\"notok_reason\"}" -do_curl GET /A1-P/v2/policytypes/STD_1/policies/pi2/status 200 - -echo "=== Send status for pi2===" -RESULT="json:{\"enforceStatus\": \"NOTOK\", \"enforceReason\": \"notok_reason\"}" -do_curl POST '/sendstatus?policyid=pi2' 200 - -echo "=== Get counter: datadelivery ===" -RESULT="0" -do_curl GET /counter/datadelivery 200 - -echo "=== Send data ===" -echo "{}" > .p.json -RESULT="" -do_curl POST /datadelivery 200 .p.json - -echo "=== Get counter: datadelivery ===" -RESULT="1" -do_curl GET /counter/datadelivery 200 - -echo "=== Get counter: intstance ===" -RESULT="1" -do_curl GET /counter/num_instances 200 - -echo "=== Get counter: types (shall be 0)===" -RESULT="1" -do_curl GET /counter/num_types 200 - -echo "=== Get counter: interface ===" -RESULT="STD_2.0.0" -do_curl GET /counter/interface 200 - -echo "=== Get counter: remote hosts ===" -RESULT="*" -do_curl GET /counter/remote_hosts 200 - -echo "********************" -echo "*** All tests ok ***" -echo "********************" diff --git a/near-rt-ric-simulator/test/STD_2.0.0/build_and_start.sh b/near-rt-ric-simulator/test/STD_2.0.0/build_and_start.sh deleted file mode 100755 index 2cba8c1..0000000 --- a/near-rt-ric-simulator/test/STD_2.0.0/build_and_start.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -# Script to build and start the container - -echo "Building image" -cd ../../ - -#Build the image -docker build -t a1test . - -docker stop a1StdSimulator > /dev/null 2>&1 -docker rm -f a1StdSimulator > /dev/null 2>&1 - -echo "Starting ric-sim" -#Run the container in interactive mode, unsecure port 8085, secure port 8185 -docker run -it -p 8085:8085 -p 8185:8185 -e A1_VERSION=STD_2.0.0 -e ALLOW_HTTP=true -e REMOTE_HOSTS_LOGGING=1 --volume "$PWD/certificate:/usr/src/app/cert" --name a1StdSimulator a1test diff --git a/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi1.json b/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi1.json deleted file mode 100644 index 25247a1..0000000 --- a/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi1.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "scope": { - "ueId": "ue1", - "qosId": "qos1" - }, - "statement": { - "priorityLevel": 5 - } -} - diff --git a/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi1_updated.json b/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi1_updated.json deleted file mode 100644 index 7b4ada7..0000000 --- a/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi1_updated.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "scope": { - "ueId": "ue1", - "qosId": "qos1" - }, - "statement": { - "priorityLevel": 6 - } -} - diff --git a/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi2.json b/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi2.json deleted file mode 100644 index 441a9cf..0000000 --- a/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/pi2.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "scope": { - "ueId": "ue2", - "qosId": "qos2" - }, - "statement": { - "priorityLevel": 5 - } -} - diff --git a/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/std_1.json b/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/std_1.json deleted file mode 100644 index 9b0c302..0000000 --- a/near-rt-ric-simulator/test/STD_2.0.0/jsonfiles/std_1.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "policySchema": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "STD_1_0.2.0", - "description": "STD 1 policy type", - "type": "object", - "properties": { - "scope": { - "type": "object", - "properties": { - "ueId": { - "type": "string" - }, - "qosId": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "ueId", - "qosId" - ] - }, - "statement": { - "type": "object", - "properties": { - "priorityLevel": { - "type": "number" - } - }, - "additionalProperties": false, - "required": [ - "priorityLevel" - ] - } - } - }, - "statusSchema": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "STD_1_0.2.0", - "description": "STD 1 policy type status", - "type": "object", - "properties": { - "enforceStatus": { - "type": "string" - }, - "enforceReason": { - "type": "string" - }, - "additionalProperties": false, - "required": [ - "enforceStatus" - ] - } - } -} \ No newline at end of file diff --git a/near-rt-ric-simulator/test/common/.gitignore b/near-rt-ric-simulator/test/common/.gitignore deleted file mode 100644 index bee8a64..0000000 --- a/near-rt-ric-simulator/test/common/.gitignore +++ /dev/null @@ -1 +0,0 @@ -__pycache__ diff --git a/near-rt-ric-simulator/tests/.gitignore b/near-rt-ric-simulator/tests/.gitignore deleted file mode 100644 index bee8a64..0000000 --- a/near-rt-ric-simulator/tests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -__pycache__ diff --git a/near-rt-ric-simulator/tests/test_std_1_1_3.py b/near-rt-ric-simulator/tests/test_std_1_1_3.py deleted file mode 100644 index 721d7a6..0000000 --- a/near-rt-ric-simulator/tests/test_std_1_1_3.py +++ /dev/null @@ -1,459 +0,0 @@ -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -# This test case test the STD_1.1.3 version of the simulator - -import json - -#Version of simulator -INTERFACE_VERSION="STD_1.1.3" - -from unittest_setup import SERVER_URL, HOST_IP, PORT_NUMBER, setup_env, client - -#Setup env and import paths -setup_env(INTERFACE_VERSION) - -from compare_json import compare - -def test_apis(client): - - # Simulator hello world - response=client.get(SERVER_URL) - assert response.status_code == 200 - - # Check used and implemented interfaces - response=client.get(SERVER_URL+'container_interfaces') - assert response.status_code == 200 - assert response.data == b"Current interface: STD_1.1.3 All supported A1 interface yamls in this container: ['OSC_2.1.0', 'STD_1.1.3', 'STD_2.0.0']" - - # Reset simulator instances - response=client.post(SERVER_URL+'deleteinstances') - assert response.status_code == 200 - - # Reset simulator, all - response=client.post(SERVER_URL+'deleteall') - assert response.status_code == 200 - - # API: Get policy instances, shall be empty - data_policy_get = [ ] - response=client.get(SERVER_URL+'A1-P/v1/policies') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_policy_get, result) - assert res == True - - #API: Create policy instance pi1 - data_pi1 = { - "scope": { - "ueId": "ue1", - "groupId": "group1", - "sliceId": "slice1", - "qosId": "qos1", - "cellId": "cell1" - }, - "statement": { - "priorityLevel": 5 - } - } - # header for json payload - header = { - "Content-Type" : "application/json" - } - response=client.put(SERVER_URL+'A1-P/v1/policies/pi1', headers=header, data=json.dumps(data_pi1)) - assert response.status_code == 201 - result=json.loads(response.data) - res=compare(data_pi1, result) - assert res == True - - #API: Update policy instance pi1 - data_pi1_updated = { - "scope": { - "ueId": "ue1", - "groupId": "group1", - "sliceId": "slice1", - "qosId": "qos1", - "cellId": "cell1" - }, - "statement": { - "priorityLevel": 6 - } - } - response=client.put(SERVER_URL+'A1-P/v1/policies/pi1', headers=header, data=json.dumps(data_pi1_updated)) - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_pi1_updated, result) - assert res == True - - #API: Create policy instance pi9, bad json - response=client.put(SERVER_URL+'A1-P/v1/policies/pi9', headers=header, data="test") - assert response.status_code == 400 - - # API: Get policy instances, shall contain pi1 - data_policy_get = [ "pi1" ] - response=client.get(SERVER_URL+'A1-P/v1/policies') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_policy_get, result) - assert res == True - - # API: Create policy instance pi2 (copy of pi1). Shall fail - data_create_errror_pi1 = { - "title" : "The policy json already exists.", - "status" : 400, - "instance" : "pi2" - } - response=client.put(SERVER_URL+'A1-P/v1/policies/pi2', headers=header, data=json.dumps(data_pi1_updated)) - assert response.status_code == 400 - result=json.loads(response.data) - res=compare(data_create_errror_pi1, result) - assert res == True - - # Set force response code 409. ===" - response=client.post(SERVER_URL+'forceresponse?code=409') - assert response.status_code == 200 - - # API: Get policy instances, shall fail - data_get_errror = { - "title" : "Conflict", - "status" : 409, - "detail" : "Request could not be processed in the current state of the resource" - } - response=client.get(SERVER_URL+'A1-P/v1/policies') - assert response.status_code == 409 - result=json.loads(response.data) - res=compare(data_get_errror, result) - assert res == True - - # Reset force response - response=client.post(SERVER_URL+'forceresponse') - assert response.status_code == 200 - assert response.data == b"Force response code: None set for one single A1 response" - - ### - ### Repeating the above two test for code coverage - ### - # Set force response code 400 - response=client.post(SERVER_URL+'forceresponse?code=400') - assert response.status_code == 200 - - #API: Create policy instance pi3, shall fail - data_pi3 = { - "scope": { - "ueId": "ue3" - }, - "statement": { - "priorityLevel": 5 - } - } - data_get_errror = { - "title" : "Bad request", - "status" : 400, - "detail" : "Object in payload not properly formulated or not related to the method" - } - response=client.put(SERVER_URL+'A1-P/v1/policies/pi3', headers=header, data=json.dumps(data_pi3)) - assert response.status_code == 400 - result=json.loads(response.data) - res=compare(data_get_errror, result) - assert res == True - - # Set force response code 404 - response=client.post(SERVER_URL+'forceresponse?code=404') - assert response.status_code == 200 - - # API: Get policy instance pi1, shall fail ==" - data_get_errror = { - "title" : "Not found", - "status" : 404, - "detail" : "No resource found at the URI" - } - response=client.get(SERVER_URL+'A1-P/v1/policies/pi1') - assert response.status_code == 404 - result=json.loads(response.data) - res=compare(data_get_errror, result) - assert res == True - - # Set force response code 405 - response=client.post(SERVER_URL+'forceresponse?code=405') - assert response.status_code == 200 - - # API: Delete policy instances pi1, shall fail ==" - data_get_errror = { - "title" : "Method not allowed", - "status" : 405, - "detail" : "Method not allowed for the URI" - } - response=client.delete(SERVER_URL+'A1-P/v1/policies/pi1') - assert response.status_code == 405 - result=json.loads(response.data) - res=compare(data_get_errror, result) - assert res == True - - # Set force response code 429 - response=client.post(SERVER_URL+'forceresponse?code=429') - assert response.status_code == 200 - - # API: Get policy status pi3, shall fail ==" - data_get_errror = { - "title" : "Too many requests", - "status" : 429, - "detail" : "Too many requests have been sent in a given amount of time" - } - response=client.get(SERVER_URL+'A1-P/v1/policies/pi3/status') - assert response.status_code == 429 - result=json.loads(response.data) - res=compare(data_get_errror, result) - assert res == True - - # Set force response code 507 - response=client.post(SERVER_URL+'forceresponse?code=507') - assert response.status_code == 200 - - # API: Get policy instances, shall fail - data_get_errror = { - "title" : "Insufficient storage", - "status" : 507, - "detail" : "The method could not be performed on the resource because the provider is unable to store the representation needed to successfully complete the request" - } - response=client.get(SERVER_URL+'A1-P/v1/policies') - assert response.status_code == 507 - result=json.loads(response.data) - res=compare(data_get_errror, result) - assert res == True - - # Set force response code 503. ===" - response=client.post(SERVER_URL+'forceresponse?code=503') - assert response.status_code == 200 - - # API: Get policy instances, shall fail - data_get_errror = { - "title" : "Service unavailable", - "status" : 503, - "detail" : "The provider is currently unable to handle the request due to a temporary overload" - } - response=client.get(SERVER_URL+'A1-P/v1/policies') - assert response.status_code == 503 - result=json.loads(response.data) - res=compare(data_get_errror, result) - assert res == True - - # Set force response code 555. ===" - response=client.post(SERVER_URL+'forceresponse?code=555') - assert response.status_code == 200 - - # API: Get policy instances, shall fail - data_get_errror = { - "title" : "Unknown", - "status" : "555", - "detail" : "Not implemented response code" - } - response=client.get(SERVER_URL+'A1-P/v1/policies') - assert response.status_code == 555 - result=json.loads(response.data) - res=compare(data_get_errror, result) - assert res == True - - ### - ### End of repeated test - ### - - - # API: Get policy status - data_policy_status = { - "enforceStatus" : "UNDEFINED" - } - response=client.get(SERVER_URL+'A1-P/v1/policies/pi1/status') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_policy_status, result) - assert res == True - - # API: Create policy instance pi2 - data_pi2 = { - "scope": { - "ueId": "ue2", - "groupId": "group2", - "sliceId": "slice2", - "qosId": "qos2", - "cellId": "cell2" - }, - "statement": { - "priorityLevel": 10 - } - } - response=client.put(SERVER_URL+'A1-P/v1/policies/pi2', headers=header, data=json.dumps(data_pi2)) - assert response.status_code == 201 - result=json.loads(response.data) - res=compare(data_pi2, result) - assert res == True - - - # API: Update policy instance pi2 - # Reuse same policy data - response=client.put(SERVER_URL+'A1-P/v1/policies/pi2?notificationDestination=http://'+HOST_IP+':'+PORT_NUMBER+'/statustest', headers=header, data=json.dumps(data_pi2)) - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_pi2, result) - assert res == True - - # API: Get policy instances, shall contain pi1 and pi2 - data_policy_get = [ "pi1", "pi2" ] - response=client.get(SERVER_URL+'A1-P/v1/policies') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_policy_get, result) - assert res == True - - # Set force delay 10 - response=client.post(SERVER_URL+'forcedelay?delay=10') - assert response.status_code == 200 - assert response.data == b"Force delay: 10 sec set for all A1 responses" - - # API: Get policy instances, shall contain pi1 and pi2 and delayed 10 sec - data_policy_get = [ "pi1", "pi2" ] - response=client.get(SERVER_URL+'A1-P/v1/policies') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_policy_get, result) - assert res == True - - # Reset force delay - response=client.post(SERVER_URL+'forcedelay') - assert response.status_code == 200 - assert response.data == b"Force delay: None sec set for all A1 responses" - - # API: GET policy instance pi1 - response=client.get(SERVER_URL+'A1-P/v1/policies/pi1') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_pi1_updated, result) - assert res == True - - # API: GET policy instance pi2 - response=client.get(SERVER_URL+'A1-P/v1/policies/pi2') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_pi2, result) - assert res == True - - # API: GET policy instance pi9, shall fail - response=client.get(SERVER_URL+'A1-P/v1/policies/pi9') - assert response.status_code == 404 - - # API: DELETE policy instance pi1 - response=client.delete(SERVER_URL+'A1-P/v1/policies/pi1') - assert response.status_code == 204 - - # API: DELETE policy instance pi9, shall fail - response=client.delete(SERVER_URL+'A1-P/v1/policies/pi9') - assert response.status_code == 404 - - # API: Get policy status for pi1, shall fail - data_get_errror = { - "title" : "The policy identity does not exist.", - "status" : 404, - "detail" : "There is no existing policy instance with the identity: pi1", - "instance" : "pi1" - } - response=client.get(SERVER_URL+'A1-P/v1/policies/pi1/status') - assert response.status_code == 404 - result=json.loads(response.data) - res=compare(data_get_errror, result) - assert res == True - - # Set status for policy instance pi2 - response=client.put(SERVER_URL+'status?policyid=pi2&status=OK') - assert response.status_code == 200 - - # API: Get policy status for pi2 - data_get_status = { - "enforceStatus" : "OK" - } - response=client.get(SERVER_URL+'A1-P/v1/policies/pi2/status') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_get_status, result) - assert res == True - - # Set status for policy instance pi2 - response=client.put(SERVER_URL+'status?policyid=pi2&status=NOTOK&reason=notok_reason') - assert response.status_code == 200 - - # API: Get policy status for pi2 - data_get_status = { - "enforceStatus" : "NOTOK", - "enforceReason" : "notok_reason" - } - response=client.get(SERVER_URL+'A1-P/v1/policies/pi2/status') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_get_status, result) - assert res == True - - #Found no way to test these functions - #'sendstatus' will send a http request that will fail - #since no server will receive the call - #These function is instead tested when running the bash script in the 'test' dir - # # Send status for pi2 - # response=client.post(SERVER_URL+'sendstatus?policyid=pi2') - # assert response.status_code == 200 - # result=json.loads(response.data) - # res=compare(data_get_status, result) - # assert res == True - - # # Send status, shall fail - # response=client.post(SERVER_URL+'sendstatus') - # assert response.status_code == 400 - - # # Send status pi9, shall fail - # response=client.post(SERVER_URL+'sendstatus?policyid=pi9') - # assert response.status_code == 404 - - # Set status for policy instance , shall fail - response=client.put(SERVER_URL+'status') - assert response.status_code == 400 - - # Set status for policy instance pi9, shall fail - response=client.put(SERVER_URL+'status?policyid=pi9') - assert response.status_code == 404 - - # Set status for policy instance pi2, shall fail - response=client.put(SERVER_URL+'status?policyid=pi2') - assert response.status_code == 400 - - - # Get counter: intstance - response=client.get(SERVER_URL+'counter/num_instances') - assert response.status_code == 200 - assert response.data == b"1" - - # Get counter: types (shall be 0) - response=client.get(SERVER_URL+'counter/num_types') - assert response.status_code == 200 - assert response.data == b"0" - - # Get counter: interface - response=client.get(SERVER_URL+'counter/interface') - assert response.status_code == 200 - assert response.data == b"STD_1.1.3" - - # Get counter: remote hosts - response=client.get(SERVER_URL+'counter/remote_hosts') - assert response.status_code == 200 - - # Get counter: test, shall fail - response=client.get(SERVER_URL+'counter/test') - assert response.status_code == 404 diff --git a/near-rt-ric-simulator/tests/test_std_2_0_0.py b/near-rt-ric-simulator/tests/test_std_2_0_0.py deleted file mode 100644 index d63d4c3..0000000 --- a/near-rt-ric-simulator/tests/test_std_2_0_0.py +++ /dev/null @@ -1,436 +0,0 @@ -# ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. -# ======================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END================================================= -# - -# This test case test the STD_2.0.0 version of the simulator - -import json -import time - -#Version of simulator -INTERFACE_VERSION="STD_2.0.0" - -from unittest_setup import SERVER_URL, HOST_IP, PORT_NUMBER, setup_env, get_testdata_dir, client - -#Setup env and import paths -setup_env(INTERFACE_VERSION) - -from compare_json import compare - -def test_apis(client): - - testdata=get_testdata_dir() - - # Header for json payload - header = { - "Content-Type" : "application/json" - } - - # Simulator hello world - response=client.get(SERVER_URL) - assert response.status_code == 200 - - # Check used and implemented interfaces - response=client.get(SERVER_URL+'container_interfaces') - assert response.status_code == 200 - assert response.data == b"Current interface: STD_2.0.0 All supported A1 interface yamls in this container: ['OSC_2.1.0', 'STD_1.1.3', 'STD_2.0.0']" - - # Reset simulator instances - response=client.post(SERVER_URL+'deleteinstances') - assert response.status_code == 200 - - # Reset simulator, all - response=client.post(SERVER_URL+'deleteall') - assert response.status_code == 200 - - # Get counter: interface - response=client.get(SERVER_URL+'counter/interface') - assert response.status_code == 200 - assert response.data == b"STD_2.0.0" - - # Get counter: remote hosts - response=client.get(SERVER_URL+'counter/remote_hosts') - assert response.status_code == 200 - - # Get counter: intstance - response=client.get(SERVER_URL+'counter/num_instances') - assert response.status_code == 200 - assert response.data == b"0" - - # Get counter: types - response=client.get(SERVER_URL+'counter/num_types') - assert response.status_code == 200 - assert response.data == b"0" - - # API: Get policy type, shall be empty - data_response = [ ] - response=client.get(SERVER_URL+'A1-P/v2/policytypes') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # API: Get policy instances for type 1, type not found - data_response = {"title": "The policy type does not exist.", "status": 404, "instance": "1"} - response=client.get(SERVER_URL+'A1-P/v2/policytypes/1/policies') - assert response.status_code == 404 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # API: Get policy instances, type not found - data_response = {"title": "The policy type does not exist.", "status": 404, "instance": "test"} - response=client.get(SERVER_URL+'A1-P/v2/policytypes/test/policies') - assert response.status_code == 404 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # Put a policy type: STD_1 - with open(testdata+'std_1.json') as json_file: - data_response = b"Policy type STD_1 is OK." - json_payload=json.load(json_file) - response=client.put(SERVER_URL+'policytype?id=STD_1', headers=header, data=json.dumps(json_payload)) - assert response.status_code == 201 - assert data_response == response.data - - # Put a policy type: STD_1, again - with open(testdata+'std_1.json') as json_file: - data_response = b"Policy type STD_1 is OK." - json_payload=json.load(json_file) - response=client.put(SERVER_URL+'policytype?id=STD_1', headers=header, data=json.dumps(json_payload)) - assert response.status_code == 200 - assert data_response == response.data - - # API: Get policy type ids, shall contain type STD_1 - data_response = [ "STD_1" ] - response=client.get(SERVER_URL+'A1-P/v2/policytypes') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # Delete a policy type: STD_1 - data_response = b"" - response=client.delete(SERVER_URL+'policytype?id=STD_1') - assert response.status_code == 204 - assert data_response == response.data - - # API: Get policy type ids, shall be empty - data_response = [ ] - response=client.get(SERVER_URL+'A1-P/v2/policytypes') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # Put a policy type: STD_1 - with open(testdata+'std_1.json') as json_file: - data_response = b"Policy type STD_1 is OK." - json_payload=json.load(json_file) - response=client.put(SERVER_URL+'policytype?id=STD_1', headers=header, data=json.dumps(json_payload)) - assert response.status_code == 201 - assert data_response == response.data - - # API: Get policy type ids, shall contain type STD_1 - data_response = [ "STD_1" ] - response=client.get(SERVER_URL+'A1-P/v2/policytypes') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # Get counter: types (shall be 1) - response=client.get(SERVER_URL+'counter/num_types') - assert response.status_code == 200 - assert response.data == b"1" - - # API: Get policy type: STD_1 - with open(testdata+'std_1.json') as json_file: - data_response = json.load(json_file) - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # API: API: Get policy instances, shall be empty - data_response = [] - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # API: Create policy instance pi1 of type: STD_1 - with open(testdata+'pi1.json') as json_file: - json_payload=json.load(json_file) - response=client.put(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi1', headers=header, data=json.dumps(json_payload)) - assert response.status_code == 201 - result=json.loads(response.data) - res=compare(json_payload, result) - assert res == True - - # API: API: Get policy instance pi1 of type: STD_1 - with open(testdata+'pi1.json') as json_file: - data_response = json.load(json_file) - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi1') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # API: Update policy instance pi1 of type: STD_1 - with open(testdata+'pi1.json') as json_file: - json_payload=json.load(json_file) - response=client.put(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi1', headers=header, data=json.dumps(json_payload)) - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(json_payload, result) - assert res == True - - # API: Update policy instance pi1 of type: STD_1 - with open(testdata+'pi1_updated.json') as json_file: - json_payload=json.load(json_file) - response=client.put(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi1', headers=header, data=json.dumps(json_payload)) - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(json_payload, result) - assert res == True - - # API: Duplicate policy instance pi2 of type: STD_1 - with open(testdata+'pi1_updated.json') as json_file: - data_response = {"title": "Duplicate, the policy json already exists.", "status": 400, "instance": "pi2"} - json_payload=json.load(json_file) - response=client.put(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi2', headers=header, data=json.dumps(json_payload)) - assert response.status_code == 400 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # API: Get policy instances, shall contain pi1 - data_response = ["pi1"] - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # Get counter: intstance - response=client.get(SERVER_URL+'counter/num_instances') - assert response.status_code == 200 - assert response.data == b"1" - - # Get counter: types - response=client.get(SERVER_URL+'counter/num_types') - assert response.status_code == 200 - assert response.data == b"1" - - # Set force response code 409. ===" - response=client.post(SERVER_URL+'forceresponse?code=409') - assert response.status_code == 200 - - # API: Get policy instances, shall fail - data_response = {"title" : "Conflict", "status" : 409, "detail" : "Request could not be processed in the current state of the resource"} - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies') - assert response.status_code == 409 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # API: API: Get policy status - data_response = {"enforceStatus" : "", "enforceReason" : ""} - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi1/status') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # API: Create policy instance pi2 of type: STD_1 - with open(testdata+'pi2.json') as json_file: - json_payload=json.load(json_file) - response=client.put(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi2', headers=header, data=json.dumps(json_payload)) - assert response.status_code == 201 - result=json.loads(response.data) - res=compare(json_payload, result) - assert res == True - - # API: Update policy instance pi2 of type: STD_1 - with open(testdata+'pi2.json') as json_file: - json_payload=json.load(json_file) - response=client.put(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi2', headers=header, data=json.dumps(json_payload)) - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(json_payload, result) - assert res == True - - # API: Get policy instances, shall contain pi1 and pi2 - data_response = ["pi1","pi2"] - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # Get counter: intstance - response=client.get(SERVER_URL+'counter/num_instances') - assert response.status_code == 200 - assert response.data == b"2" - - # Get counter: types - response=client.get(SERVER_URL+'counter/num_types') - assert response.status_code == 200 - assert response.data == b"1" - - # Set force delay 10 - response=client.post(SERVER_URL+'forcedelay?delay=10') - assert response.status_code == 200 - assert response.data == b"Force delay: 10 sec set for all A1 responses" - - #start time stamp - start=time.time() - - # API: Get policy instances, shall contain pi1 and pi2 and delayed 10 sec - data_response = ["pi1","pi2"] - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - end=time.time() - - assert (end-start) > 9 - - # Reset force delay - response=client.post(SERVER_URL+'forcedelay') - assert response.status_code == 200 - assert response.data == b"Force delay: None sec set for all A1 responses" - - # API: API: Get policy instance pi1 of type: STD_1 - with open(testdata+'pi1_updated.json') as json_file: - data_response = json.load(json_file) - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi1') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # API: API: Get policy instance pi2 of type: STD_1 - with open(testdata+'pi2.json') as json_file: - data_response = json.load(json_file) - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi2') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # API: DELETE policy instance pi1 - data_response = b"" - response=client.delete(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi1') - assert response.status_code == 204 - assert data_response == response.data - - # API: Get policy instances, shall contain pi2 - data_response = ["pi2"] - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # API: API: Get policy status - data_response = {"enforceStatus" : "", "enforceReason" : ""} - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi2/status') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - # Set status for policy instance pi2 - response=client.put(SERVER_URL+'status?policyid=pi2&status=OK') - assert response.status_code == 200 - - # API: API: Get policy status - data_response = {"enforceStatus" : "OK"} - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi2/status') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - print(response.data) - assert res == True - - # Set status for policy instance pi2 - response=client.put(SERVER_URL+'status?policyid=pi2&status=NOTOK&reason=notok_reason') - assert response.status_code == 200 - - # API: API: Get policy status - data_response = {"enforceStatus" : "NOTOK", "enforceReason" : "notok_reason"} - response=client.get(SERVER_URL+'A1-P/v2/policytypes/STD_1/policies/pi2/status') - assert response.status_code == 200 - result=json.loads(response.data) - res=compare(data_response, result) - assert res == True - - - # #Found no way to test these functions - # #'sendstatus' will send a http request that will fail - # #since no server will receive the call - # #These function is instead tested when running the bash script in the 'test' dir - # # # Send status for pi2 - # # response=client.post(SERVER_URL+'sendstatus?policyid=pi2') - # # assert response.status_code == 200 - # # result=json.loads(response.data) - # # res=compare(data_get_status, result) - # # assert res == True - - # # # Send status, shall fail - # # response=client.post(SERVER_URL+'sendstatus') - # # assert response.status_code == 400 - - # Get counter: data_delivery - response=client.get(SERVER_URL+'counter/datadelivery') - assert response.status_code == 200 - assert response.data == b"0" - - # Send data - json_payload={} - response=client.post(SERVER_URL+'datadelivery', headers=header, data=json.dumps(json_payload)) - assert response.status_code == 200 - - # Get counter: data_delivery - response=client.get(SERVER_URL+'counter/datadelivery') - assert response.status_code == 200 - assert response.data == b"1" - - # Get counter: interface - response=client.get(SERVER_URL+'counter/interface') - assert response.status_code == 200 - assert response.data == b"STD_2.0.0" - - # Get counter: remote hosts - response=client.get(SERVER_URL+'counter/remote_hosts') - assert response.status_code == 200 - - # Get counter: intstance - response=client.get(SERVER_URL+'counter/num_instances') - assert response.status_code == 200 - assert response.data == b"1" - - # Get counter: types - response=client.get(SERVER_URL+'counter/num_types') - assert response.status_code == 200 - assert response.data == b"1" \ No newline at end of file diff --git a/near-rt-ric-simulator/.gitattributes b/near-rt-ric/.gitattributes similarity index 100% rename from near-rt-ric-simulator/.gitattributes rename to near-rt-ric/.gitattributes diff --git a/near-rt-ric-simulator/.gitignore b/near-rt-ric/.gitignore similarity index 100% rename from near-rt-ric-simulator/.gitignore rename to near-rt-ric/.gitignore diff --git a/near-rt-ric-simulator/Dockerfile b/near-rt-ric/Dockerfile similarity index 100% rename from near-rt-ric-simulator/Dockerfile rename to near-rt-ric/Dockerfile diff --git a/near-rt-ric-simulator/LICENSES.txt b/near-rt-ric/LICENSES.txt similarity index 100% rename from near-rt-ric-simulator/LICENSES.txt rename to near-rt-ric/LICENSES.txt diff --git a/near-rt-ric-simulator/README.md b/near-rt-ric/README.md similarity index 100% rename from near-rt-ric-simulator/README.md rename to near-rt-ric/README.md diff --git a/near-rt-ric-simulator/api/OSC_2.1.0/openapi.yaml b/near-rt-ric/api/OSC_2.1.0/openapi.yaml similarity index 90% rename from near-rt-ric-simulator/api/OSC_2.1.0/openapi.yaml rename to near-rt-ric/api/OSC_2.1.0/openapi.yaml index 828a6bf..32a3afd 100644 --- a/near-rt-ric-simulator/api/OSC_2.1.0/openapi.yaml +++ b/near-rt-ric/api/OSC_2.1.0/openapi.yaml @@ -17,15 +17,28 @@ # ================================================================================== openapi: 3.0.0 info: - version: 2.1.0 - title: RIC A1 + title: Near RT-RIC A1 Mediator for Policy Management Services. + version: 2.1.1 + description: | + API for A1-P Policy Management Service Near RT-RIC. + © 2023, S. Kumar Chaudhary. + All rights reserved. +externalDocs: + description: 'As per ORAN Specification version-1, A1 interface Application protocol' + url: 'https://orandownloadsweb.azurewebsites.net/specifications' +servers: + - url: '{apiRoot}/A1AP/v2' + variables: + apiRoot: + default: 'https://example.com' + description: 'apiRoot as defined in clause 4.2.1 in ORAN-WG2.A1.AP' paths: '/a1-p/healthcheck': get: description: > - Perform a healthcheck on a1 + Perform a healthcheck on A1 interface tags: - - A1 Mediator + - A1 Mediator-Healthcheck Interface operationId: a1.get_healthcheck responses: 200: @@ -37,7 +50,7 @@ paths: get: description: "Get a list of all registered policy type ids" tags: - - A1 Mediator + - A1 Mediator- Get All Policy Types Interface operationId: a1.get_all_policy_types responses: 200: @@ -63,7 +76,7 @@ paths: description: > Get this policy type tags: - - A1 Mediator + - A1 Mediator- Individual Policy Type Interfaces operationId: a1.get_policy_type responses: '200': @@ -81,7 +94,7 @@ paths: description: > Delete this policy type. Can only be performed if there are no instances of this type tags: - - A1 Mediator + - A1 Mediator- Individual Policy Type Interfaces operationId: a1.delete_policy_type responses: '204': @@ -102,7 +115,7 @@ paths: Replace is not currently allowed; to replace, for now do a DELETE and then a PUT again. tags: - - A1 Mediator + - A1 Mediator- Individual Policy Type Interfaces operationId: a1.create_policy_type requestBody: content: @@ -157,7 +170,7 @@ paths: get: description: "get a list of all policy instance ids for this policy type id" tags: - - A1 Mediator + - A1 Mediator- Individual Policy Type Instance Interface operationId: a1.get_all_policy_identities responses: 200: @@ -192,7 +205,7 @@ paths: Retrieve the policy instance tags: - - A1 Mediator + - A1 Mediator- Individual Policy Type Instance Interfaces operationId: a1.get_policy_instance responses: '200': @@ -214,7 +227,7 @@ paths: Delete this policy instance tags: - - A1 Mediator + - A1 Mediator- Individual Policy Type Instance Interfaces operationId: a1.delete_policy_instance responses: '202': @@ -232,7 +245,7 @@ paths: The schema of the PUT body is defined by the create_schema field of the policy type. tags: - - A1 Mediator + - A1 Mediator- Individual Policy Type Instance Interfaces operationId: a1.create_or_replace_policy_instance requestBody: content: @@ -282,7 +295,7 @@ paths: NOT IN EFFECT is returned otherwise If a policy instance is successfully deleted, this endpoint will return a 404 (not a 200) tags: - - A1 Mediator + - A1 Mediator- Individual Policy Type Instances Services Status operationId: a1.get_policy_instance_status responses: '200': diff --git a/near-rt-ric-simulator/certificate/cert.crt b/near-rt-ric/certificate/cert.crt similarity index 100% rename from near-rt-ric-simulator/certificate/cert.crt rename to near-rt-ric/certificate/cert.crt diff --git a/near-rt-ric-simulator/certificate/generate_cert_and_key.sh b/near-rt-ric/certificate/generate_cert_and_key.sh similarity index 100% rename from near-rt-ric-simulator/certificate/generate_cert_and_key.sh rename to near-rt-ric/certificate/generate_cert_and_key.sh diff --git a/near-rt-ric-simulator/certificate/key.crt b/near-rt-ric/certificate/key.crt similarity index 100% rename from near-rt-ric-simulator/certificate/key.crt rename to near-rt-ric/certificate/key.crt diff --git a/near-rt-ric-simulator/certificate/pass b/near-rt-ric/certificate/pass similarity index 100% rename from near-rt-ric-simulator/certificate/pass rename to near-rt-ric/certificate/pass diff --git a/near-rt-ric-simulator/container-tag.yaml b/near-rt-ric/container-tag.yaml similarity index 100% rename from near-rt-ric-simulator/container-tag.yaml rename to near-rt-ric/container-tag.yaml diff --git a/near-rt-ric-simulator/nginx.conf b/near-rt-ric/nginx.conf similarity index 100% rename from near-rt-ric-simulator/nginx.conf rename to near-rt-ric/nginx.conf diff --git a/near-rt-ric-simulator/src/OSC_2.1.0/.gitignore b/near-rt-ric/src/OSC_2.1.0/.gitignore similarity index 100% rename from near-rt-ric-simulator/src/OSC_2.1.0/.gitignore rename to near-rt-ric/src/OSC_2.1.0/.gitignore diff --git a/near-rt-ric-simulator/src/OSC_2.1.0/a1.py b/near-rt-ric/src/OSC_2.1.0/a1.py similarity index 100% rename from near-rt-ric-simulator/src/OSC_2.1.0/a1.py rename to near-rt-ric/src/OSC_2.1.0/a1.py diff --git a/near-rt-ric-simulator/src/OSC_2.1.0/main.py b/near-rt-ric/src/OSC_2.1.0/main.py similarity index 99% rename from near-rt-ric-simulator/src/OSC_2.1.0/main.py rename to near-rt-ric/src/OSC_2.1.0/main.py index e0766d8..e0be6e2 100644 --- a/near-rt-ric-simulator/src/OSC_2.1.0/main.py +++ b/near-rt-ric/src/OSC_2.1.0/main.py @@ -132,7 +132,6 @@ def del_policytype(): return Response("Policy type " + policy_type_id + " not found.", 204, mimetype=TEXT_PLAIN) - # Get all policy type ids @app.route('/policytypes', methods=['GET']) def get_policytype_ids(): diff --git a/near-rt-ric-simulator/src/OSC_2.1.0/var_declaration.py b/near-rt-ric/src/OSC_2.1.0/var_declaration.py similarity index 100% rename from near-rt-ric-simulator/src/OSC_2.1.0/var_declaration.py rename to near-rt-ric/src/OSC_2.1.0/var_declaration.py diff --git a/near-rt-ric-simulator/src/STD_1.1.3/.gitignore b/near-rt-ric/src/common/.gitignore similarity index 100% rename from near-rt-ric-simulator/src/STD_1.1.3/.gitignore rename to near-rt-ric/src/common/.gitignore diff --git a/near-rt-ric-simulator/src/common/maincommon.py b/near-rt-ric/src/common/maincommon.py similarity index 100% rename from near-rt-ric-simulator/src/common/maincommon.py rename to near-rt-ric/src/common/maincommon.py diff --git a/near-rt-ric-simulator/src/common/utils.py b/near-rt-ric/src/common/utils.py similarity index 100% rename from near-rt-ric-simulator/src/common/utils.py rename to near-rt-ric/src/common/utils.py diff --git a/near-rt-ric-simulator/src/start.sh b/near-rt-ric/src/start.sh similarity index 100% rename from near-rt-ric-simulator/src/start.sh rename to near-rt-ric/src/start.sh diff --git a/near-rt-ric-simulator/test/OSC_2.1.0/basic_test.sh b/near-rt-ric/test/a1_2.1.1/basic_test.sh similarity index 78% rename from near-rt-ric-simulator/test/OSC_2.1.0/basic_test.sh rename to near-rt-ric/test/a1_2.1.1/basic_test.sh index bc2413d..e86178a 100755 --- a/near-rt-ric-simulator/test/OSC_2.1.0/basic_test.sh +++ b/near-rt-ric/test/a1_2.1.1/basic_test.sh @@ -47,7 +47,7 @@ RESULT="OK" do_curl GET / 200 echo "=== Check used and implemented interfaces ===" -RESULT="Current interface: OSC_2.1.0 All supported A1 interface yamls in this container: ['OSC_2.1.0', 'STD_1.1.3', 'STD_2.0.0']" +RESULT="Current interface: OSC_2.1.0 All supported A1 interface yamls in this container: ['OSC_2.1.0']" do_curl GET /container_interfaces 200 echo "=== Reset simulator instances ===" @@ -60,67 +60,67 @@ do_curl POST /deleteall 200 echo "=== API: Healthcheck ===" RESULT="" -do_curl GET /a1-p/healthcheck 200 +do_curl GET /A1AP/v2/a1-p/healthcheck 200 echo "=== API: Get policy types, shall be empty array ==" RESULT="json:[]" -do_curl GET /a1-p/policytypes 200 +do_curl GET /A1AP/v2/a1-p/policytypes 200 echo "=== API: Delete a policy type, shall fail ==" RESULT="" -do_curl DELETE /a1-p/policytypes/1 404 +do_curl DELETE /A1AP/v2/a1-p/policytypes/1 404 echo "=== API: Get policy instances for type 1, shall fail ==" RESULT="" -do_curl GET /a1-p/policytypes/1/policies 404 +do_curl GET /A1AP/v2/a1-p/policytypes/1/policies 404 echo "=== API: Put a policy type: 1 ===" RESULT="" -do_curl PUT /a1-p/policytypes/1 201 jsonfiles/pt1.json +do_curl PUT /A1AP/v2/a1-p/policytypes/1 201 jsonfiles/pt1.json echo "=== API: Put a policy type: 1, again ===" RESULT="" -do_curl PUT /a1-p/policytypes/1 201 jsonfiles/pt1.json +do_curl PUT /A1AP/v2/a1-p/policytypes/1 201 jsonfiles/pt1.json echo "=== API: Delete a policy type: 1 ===" RESULT="" -do_curl DELETE /a1-p/policytypes/1 204 +do_curl DELETE /A1AP/v2/a1-p/policytypes/1 204 echo "=== API: Get policy type ids, shall be empty ==" RESULT="json:[]" -do_curl GET /a1-p/policytypes 200 +do_curl GET /A1AP/v2/a1-p/policytypes 200 echo "=== API: Load a policy type: 1 ===" RESULT="" -do_curl PUT /a1-p/policytypes/1 201 jsonfiles/pt1.json +do_curl PUT /A1AP/v2/a1-p/policytypes/1 201 jsonfiles/pt1.json echo "=== API: Get policy type ids, shall contain type 1 ==" RESULT="json:[ 1 ]" -do_curl GET /a1-p/policytypes 200 +do_curl GET /A1AP/v2/a1-p/policytypes 200 echo "=== API: Get instances for type 1, shall be empty ===" RESULT="json:[]" -do_curl GET '/a1-p/policytypes/1/policies' 200 +do_curl GET '/A1AP/v2/a1-p/policytypes/1/policies' 200 echo "=== API: Create policy instance pi1 of type: 1 ===" RESULT="" -do_curl PUT '/a1-p/policytypes/1/policies/pi1' 202 jsonfiles/pi1.json +do_curl PUT '/A1AP/v2/a1-p/policytypes/1/policies/pi1' 202 jsonfiles/pi1.json echo "=== API: Update policy instance pi1 of type: 1 ===" RESULT="" -do_curl PUT '/a1-p/policytypes/1/policies/pi1' 202 jsonfiles/pi1.json +do_curl PUT '/A1AP/v2/a1-p/policytypes/1/policies/pi1' 202 jsonfiles/pi1.json echo "=== API: Load a policy type: 1, shall fail ===" RESULT="" -do_curl PUT /a1-p/policytypes/1 400 jsonfiles/pt1.json +do_curl PUT /A1AP/v2/a1-p/policytypes/1 400 jsonfiles/pt1.json echo "=== API: Get instances for type 1, shall contain pi1 ===" RESULT="json:[ \"pi1\" ]" -do_curl GET '/a1-p/policytypes/1/policies' 200 +do_curl GET '/A1AP/v2/a1-p/policytypes/1/policies' 200 echo "=== API: Create policy instance pi2 (copy of pi1) of type: 1. Shall fail ===" RESULT="" -do_curl PUT '/a1-p/policytypes/1/policies/pi2' 400 jsonfiles/pi1.json +do_curl PUT '/A1AP/v2/a1-p/policytypes/1/policies/pi2' 400 jsonfiles/pi1.json echo "=== Set force response code 401. ===" RESULT="*" @@ -128,11 +128,11 @@ do_curl POST '/forceresponse?code=401' 200 echo "=== API: Get policy type 1. Shall fail with forced code ===" RESULT="" -do_curl GET '/a1-p/policytypes/1' 401 +do_curl GET '/A1AP/v2/a1-p/policytypes/1' 401 echo "=== API: Get policy status ===" RESULT="json:{\"instance_status\": \"NOT IN EFFECT\", \"has_been_deleted\": \"false\", \"created_at\": \"????\"}" -do_curl GET '/a1-p/policytypes/1/policies/pi1/status' 200 +do_curl GET '/A1AP/v2/a1-p/policytypes/1/policies/pi1/status' 200 echo "=== Load a policy type: 2 ===" RESULT="Policy type 2 is OK." @@ -144,7 +144,7 @@ do_curl PUT '/policytype?id=2' 200 jsonfiles/pt2.json echo "=== API: Get policy type ids, shall contain type 1 and 2 ==" RESULT="json:[ 1, 2 ]" -do_curl GET /a1-p/policytypes 200 +do_curl GET /A1AP/v2/a1-p/policytypes 200 echo "=== Get policy type ids, shall contain type 1 and 2 ==" RESULT="json:[\"1\", \"2\"]" @@ -152,7 +152,7 @@ do_curl GET /policytypes 200 echo "=== API: Get policy type 2 ==" RESULT="json:{\"name\": \"pt2\", \"description\": \"pt2 policy type\", \"policy_type_id\": 2, \"create_schema\": {\"\$schema\": \"http://json-schema.org/draft-07/schema#\", \"title\": \"STD_QoSNudging_0.2.0\", \"description\": \"QoS policy type\", \"type\": \"object\", \"properties\": {\"scope\": {\"type\": \"object\", \"properties\": {\"ueId\": {\"type\": \"string\"}, \"qosId\": {\"type\": \"string\"}}, \"additionalProperties\": false, \"required\": [\"ueId\", \"qosId\"]}, \"statement\": {\"type\": \"object\", \"properties\": {\"priorityLevel\": {\"type\": \"number\"}}, \"additionalProperties\": false, \"required\": [\"priorityLevel\"]}}}}" -do_curl GET /a1-p/policytypes/2 200 +do_curl GET /A1AP/v2/a1-p/policytypes/2 200 echo "=== Delete policy type: 2 ===" RESULT="" @@ -160,7 +160,7 @@ do_curl DELETE '/policytype?id=2' 204 jsonfiles/pt2.json echo "=== API: Get policy type ids, shall contain type 1 ==" RESULT="json:[ 1 ]" -do_curl GET /a1-p/policytypes 200 +do_curl GET /A1AP/v2/a1-p/policytypes 200 echo "=== Load a policy type: 2 ===" RESULT="Policy type 2 is OK." @@ -168,39 +168,39 @@ do_curl PUT '/policytype?id=2' 201 jsonfiles/pt2.json echo "=== API: Get policy type 2 ==" RESULT="json:{\"name\": \"pt2\", \"description\": \"pt2 policy type\", \"policy_type_id\": 2, \"create_schema\": {\"\$schema\": \"http://json-schema.org/draft-07/schema#\", \"title\": \"STD_QoSNudging_0.2.0\", \"description\": \"QoS policy type\", \"type\": \"object\", \"properties\": {\"scope\": {\"type\": \"object\", \"properties\": {\"ueId\": {\"type\": \"string\"}, \"qosId\": {\"type\": \"string\"}}, \"additionalProperties\": false, \"required\": [\"ueId\", \"qosId\"]}, \"statement\": {\"type\": \"object\", \"properties\": {\"priorityLevel\": {\"type\": \"number\"}}, \"additionalProperties\": false, \"required\": [\"priorityLevel\"]}}}}" -do_curl GET /a1-p/policytypes/2 200 +do_curl GET /A1AP/v2/a1-p/policytypes/2 200 echo "=== API: Get instances for type 2, shall be empty ===" RESULT="json:[]" -do_curl GET '/a1-p/policytypes/2/policies' 200 +do_curl GET '/A1AP/v2/a1-p/policytypes/2/policies' 200 echo "=== API: Create policy instance pi1 of type: 2, shall fail===" RESULT="" -do_curl PUT '/a1-p/policytypes/2/policies/pi1' 400 jsonfiles/pi1.json +do_curl PUT '/A1AP/v2/a1-p/policytypes/2/policies/pi1' 400 jsonfiles/pi1.json echo "=== API: Create policy instance pi2 of type: 2. Missing param, shall fail. ===" RESULT="" -do_curl PUT '/a1-p/policytypes/2/policies/pi2' 400 jsonfiles/pi2_missing_param.json +do_curl PUT '/A1AP/v2/a1-p/policytypes/2/policies/pi2' 400 jsonfiles/pi2_missing_param.json echo "=== API: Create policy instance pi2 of type: 2 ===" RESULT="" -do_curl PUT '/a1-p/policytypes/2/policies/pi2' 202 jsonfiles/pi2.json +do_curl PUT '/A1AP/v2/a1-p/policytypes/2/policies/pi2' 202 jsonfiles/pi2.json echo "=== API: Update policy instance pi2 of type: 2 ===" RESULT="" -do_curl PUT '/a1-p/policytypes/2/policies/pi2' 202 jsonfiles/pi2.json +do_curl PUT '/A1AP/v2/a1-p/policytypes/2/policies/pi2' 202 jsonfiles/pi2.json echo "=== API: Get instances for type 1, shall contain pi1 ===" RESULT="json:[ \"pi1\" ]" -do_curl GET '/a1-p/policytypes/1/policies' jsonfiles/200 +do_curl GET '/A1AP/v2/a1-p/policytypes/1/policies' jsonfiles/200 echo "=== API: Get instances for type 2, shall contain pi2 ===" RESULT="json:[ \"pi2\" ]" -do_curl GET '/a1-p/policytypes/2/policies' 200 +do_curl GET '/A1AP/v2/a1-p/policytypes/2/policies' 200 echo "=== API: Create policy instance pi11 (copy of pi1) of type: 1. Shall fail ===" RESULT="" -do_curl PUT '/a1-p/policytypes/1/policies/pi11' 400 jsonfiles/pi1.json +do_curl PUT '/A1AP/v2/a1-p/policytypes/1/policies/pi11' 400 jsonfiles/pi1.json echo "=== Set force response code 401. ===" RESULT="*" @@ -208,7 +208,7 @@ do_curl POST '/forceresponse?code=401' 200 echo "=== API: Get policy status for pi1, shall fail ===" RESULT="" -do_curl GET '/a1-p/policytypes/1/policies/pi1/status' 401 +do_curl GET '/A1AP/v2/a1-p/policytypes/1/policies/pi1/status' 401 echo "=== Set force delay 10. ===" RESULT="Force delay: 10 sec set for all A1 responses" @@ -216,7 +216,7 @@ do_curl POST '/forcedelay?delay=10' 200 echo "=== API: Get policy status for pi1. Shall delay 10 sec ===" RESULT="json:{\"instance_status\": \"NOT IN EFFECT\", \"has_been_deleted\": \"false\", \"created_at\": \"????\"}" -do_curl GET '/a1-p/policytypes/1/policies/pi1/status' 200 +do_curl GET '/A1AP/v2/a1-p/policytypes/1/policies/pi1/status' 200 echo "=== Reset force delay. ===" RESULT="Force delay: None sec set for all A1 responses" @@ -228,7 +228,7 @@ do_curl PUT '/status?policyid=pi1&status=IN%20EFFECT' 200 echo "=== API: Get policy status for pi1 ===" RESULT="json:{\"instance_status\": \"IN EFFECT\", \"has_been_deleted\": \"false\", \"created_at\": \"????\"}" -do_curl GET '/a1-p/policytypes/1/policies/pi1/status' 200 +do_curl GET '/A1AP/v2/a1-p/policytypes/1/policies/pi1/status' 200 echo "=== Set status for pi1 ===" RESULT="Status set to IN EFFECT and has_been_deleted set to true and created_at set to 2020-03-30 12:00:00 for policy: pi1" @@ -236,7 +236,7 @@ do_curl PUT '/status?policyid=pi1&status=IN%20EFFECT&deleted=true&created_at=202 echo "=== API: Get policy status for pi1 ===" RESULT="json:{\"instance_status\": \"IN EFFECT\", \"has_been_deleted\": \"true\", \"created_at\": \"2020-03-30 12:00:00\"}" -do_curl GET '/a1-p/policytypes/1/policies/pi1/status' 200 +do_curl GET '/A1AP/v2/a1-p/policytypes/1/policies/pi1/status' 200 echo "=== Get counter: instances ===" RESULT="2" @@ -256,15 +256,15 @@ do_curl GET '/counter/remote_hosts' 200 echo "=== DELETE policy pi1 ===" RESULT="" -do_curl DELETE /a1-p/policytypes/1/policies/pi1 202 +do_curl DELETE /A1AP/v2/a1-p/policytypes/1/policies/pi1 202 echo "=== API: Get instances for type 1, shall be empty ===" RESULT="[]" -do_curl GET /a1-p/policytypes/1/policies 200 +do_curl GET /A1AP/v2/a1-p/policytypes/1/policies 200 echo "=== API: Get instances for type 2, shall contain pi2 ===" RESULT="[ \"pi2\" ]" -do_curl GET /a1-p/policytypes/2/policies 200 +do_curl GET /A1AP/v2/a1-p/policytypes/2/policies 200 echo "=== Get counter: instances ===" RESULT="1" diff --git a/near-rt-ric-simulator/test/OSC_2.1.0/build_and_start.sh b/near-rt-ric/test/a1_2.1.1/build_and_start.sh similarity index 100% rename from near-rt-ric-simulator/test/OSC_2.1.0/build_and_start.sh rename to near-rt-ric/test/a1_2.1.1/build_and_start.sh diff --git a/near-rt-ric-simulator/test/OSC_2.1.0/jsonfiles/pi1.json b/near-rt-ric/test/a1_2.1.1/jsonfiles/pi1.json similarity index 100% rename from near-rt-ric-simulator/test/OSC_2.1.0/jsonfiles/pi1.json rename to near-rt-ric/test/a1_2.1.1/jsonfiles/pi1.json diff --git a/near-rt-ric-simulator/test/OSC_2.1.0/jsonfiles/pi2.json b/near-rt-ric/test/a1_2.1.1/jsonfiles/pi2.json similarity index 100% rename from near-rt-ric-simulator/test/OSC_2.1.0/jsonfiles/pi2.json rename to near-rt-ric/test/a1_2.1.1/jsonfiles/pi2.json diff --git a/near-rt-ric-simulator/test/OSC_2.1.0/jsonfiles/pi2_missing_param.json b/near-rt-ric/test/a1_2.1.1/jsonfiles/pi2_missing_param.json similarity index 100% rename from near-rt-ric-simulator/test/OSC_2.1.0/jsonfiles/pi2_missing_param.json rename to near-rt-ric/test/a1_2.1.1/jsonfiles/pi2_missing_param.json diff --git a/near-rt-ric-simulator/test/OSC_2.1.0/jsonfiles/pt1.json b/near-rt-ric/test/a1_2.1.1/jsonfiles/pt1.json similarity index 100% rename from near-rt-ric-simulator/test/OSC_2.1.0/jsonfiles/pt1.json rename to near-rt-ric/test/a1_2.1.1/jsonfiles/pt1.json diff --git a/near-rt-ric-simulator/test/OSC_2.1.0/jsonfiles/pt2.json b/near-rt-ric/test/a1_2.1.1/jsonfiles/pt2.json similarity index 100% rename from near-rt-ric-simulator/test/OSC_2.1.0/jsonfiles/pt2.json rename to near-rt-ric/test/a1_2.1.1/jsonfiles/pt2.json diff --git a/near-rt-ric-simulator/src/STD_2.0.0/.gitignore b/near-rt-ric/test/common/.gitignore similarity index 100% rename from near-rt-ric-simulator/src/STD_2.0.0/.gitignore rename to near-rt-ric/test/common/.gitignore diff --git a/near-rt-ric-simulator/test/common/compare_json.py b/near-rt-ric/test/common/compare_json.py similarity index 100% rename from near-rt-ric-simulator/test/common/compare_json.py rename to near-rt-ric/test/common/compare_json.py diff --git a/near-rt-ric-simulator/test/common/test_common.sh b/near-rt-ric/test/common/test_common.sh similarity index 100% rename from near-rt-ric-simulator/test/common/test_common.sh rename to near-rt-ric/test/common/test_common.sh diff --git a/near-rt-ric-simulator/src/common/.gitignore b/near-rt-ric/tests/.gitignore similarity index 100% rename from near-rt-ric-simulator/src/common/.gitignore rename to near-rt-ric/tests/.gitignore diff --git a/near-rt-ric-simulator/tests/test_osc_2_1_0.py b/near-rt-ric/tests/test_osc_2_1_0.py similarity index 100% rename from near-rt-ric-simulator/tests/test_osc_2_1_0.py rename to near-rt-ric/tests/test_osc_2_1_0.py diff --git a/near-rt-ric-simulator/tests/unittest_setup.py b/near-rt-ric/tests/unittest_setup.py similarity index 100% rename from near-rt-ric-simulator/tests/unittest_setup.py rename to near-rt-ric/tests/unittest_setup.py -- GitLab