1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. SPDX-License-Identifier: CC-BY-4.0
3 .. Copyright (C) 2021 Nordix
11 This document describes the API used to manage policy types and manipulate the simulator.
13 The simulator supports different versions of the A1 interface. Some functions are common for all versions, and some are
14 specific for a certain version.
22 The status of the simulator.
30 Returns the status of the simulator.
46 curl -X GET "http://localhost:8085/"
57 The simulator can support different versions of the A1 interface. With this API the supported versions can be listed.
65 Returns the status of the simulator. (Not available for A1 Standard 1.1.3)
78 List of supported interfaces.
84 curl -X GET "http://localhost:8085/container_interfaces"
91 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']
96 The simulator keeps count of different things that can be accessed.
104 Get a counter. Counter-name can be one of the following: 'num_instances', 'num_types', 'interface', 'remote_hosts' or 'datadelivery'.
108 /counter/{counter-name}
118 The counter value for the given counter.
124 curl -X GET "http://localhost:8085/counter/num_instances"
136 There are two ways to reset the simulator, delete all instances or make a complete reset which resets the simulator to its original state.
144 Delete all policy instances.
158 All policy instances deleted.
164 curl -X POST "http://localhost:8085/deleteinstances"
170 All policy instances deleted.
192 All policy instances and types deleted.
198 curl -X POST "http://localhost:8085/deleteall"
204 All policy instances and types deleted.
207 All policy instances deleted (Only for STD_1.1.3 since it has no types)
209 Response manipulation
210 ---------------------
211 It is possible to manipulate the response of all operations on the A1 interface (admin interface is not affected)
219 Force a specific response code for one (the next) A1 operation. After that response, the reponse code will go back to normal.
223 /forceresponse?code=<http-response-code>
229 The HTTP response code to return.
235 Force response code: <expected code> set for one single A1 response
241 curl -X POST "http://localhost:8085/forceresponse?code=400"
247 Force response code: 400 set for one single A1 response
255 Force delayed response of all A1 responses. The setting will remain until the delay is set to '0'
259 /forcedelay?delay=<delay-time-seconds>
265 The time in seconds to delay all responses.
271 Force delay: <expected delay> sec set for all A1 responses
277 curl -X POST "http://localhost:8085/forcedelay?delay=2"
283 Force delay: 2 sec set for all A1 responses
288 Detailed logging of the http headers and payload are activated by default. However, it is possible to turn this logging on or off.
289 The 'off' state will only log ip, url and respose code.
297 Configure detailed logging on or off
300 /payload_logging/<state>
306 The state, 'on' or 'off'.
312 Force delay: <expected delay> sec set for all A1 responses
318 curl -X POST "http://localhost:8085/payload_logging/on"
324 Payload and header logging set to: on
327 Version Specific Functions
328 ==========================
330 The methods available to control the simulator depends on the version of the A1 API the simulator is simulating.
335 This section describes the available administrative functions for the OSC_2.1.0 version of A1.
337 To see the A1 functions for this version, see `OSC_2.1.0 API`_.
339 .. _OSC_2.1.0 API: https://gerrit.o-ran-sc.org/r/gitweb?p=sim/a1-interface.git;a=blob;f=near-rt-ric-simulator/api/OSC_2.1.0/openapi.yaml
349 Create a policy type.
353 /policytype?id=<policy-type-id>
359 The ID of the policy type.
361 **Body:** (*Required*)
363 A JSON object containing the schema for the type.
369 Policy type <policy-type-id> is OK.
373 Policy type <policy-type-id> is OK.
379 curl -X PUT "http://localhost:8085/policytype?id=1"
380 -H "Content-Type: application/json"
383 "description": "pt1 policy type",
386 "$schema": "http://json-schema.org/draft-07/schema#",
387 "title": "STD_QoSNudging_0.2.0",
388 "description": "QoS policy type",
401 "additionalProperties": false,
414 "additionalProperties": false,
432 Delete a policy type.
436 /policytype?id=<policy-type-id>
442 The ID of the policy type.
448 Policy type <policy-type-id> is OK.
454 curl -X DELETE "http://localhost:8085/policytype?id=1"
468 Get a list of policy types.
482 A list of policy types.
488 curl -X GET "http://localhost:8085/policytypes"
503 Set status and optional reason, delete and time stamp.
507 /status?policyid=<policyid>&status=<status>&deleted=<value>&created_at=<time-stamp>
511 policyid: (*Required*)
517 The status of a policy.
519 deleted: (*Optional*)
521 True or false for real values, but accepts anything for error testing.
523 created_at: (*Optional*)
525 Time stamp for the status.
531 Status set to <status> for policy <policy-id>
537 curl -X PUT "http://localhost:8085/status?policyid=1&status=Accepted"
543 Status set to Accepted for policy Policy1.
548 This section describes the available administrative functions for the A1 Standard 1.1.3 version of A1.
550 To see the A1 functions for this version, see `A1 Standard 1.1.3 API`_.
552 .. _A1 Standard 1.1.3 API: https://gerrit.o-ran-sc.org/r/gitweb?p=sim/a1-interface.git;a=blob;f=near-rt-ric-simulator/api/STD_1.1.3/STD_A1.yaml
561 Set status and optional reason, delete and time stamp.
565 /status?policyid=<policyid>&status=<status>&reason=<reason>
569 policyid: (*Required*)
575 The status of a policy.
579 The reason for the status.
585 Status set to <status> for policy <policy-id>
591 curl -X PUT "http://localhost:8085/status?policyid=Policy1&status=Accepted"
597 Status set to Accepted for policy Policy1
605 Send status for policy.
609 /sendstatus?policyid=<policy-id>
613 policyid: (*Required*)
615 The ID of the policy to send status for.
621 Is a JSON with the response of the actual post request to the callback server, whatever that is.
627 curl -X POST "http://localhost:8085/sendstatus?policyid=Policy2"
637 This section describes the available administrative functions for the A1 Standard 2.0.0 version of A1.
639 To see the A1 functions for this version, see `A1 Standard 2.0.0 API`_.
641 .. _A1 Standard 2.0.0 API: https://gerrit.o-ran-sc.org/r/gitweb?p=sim/a1-interface.git;a=blob;f=near-rt-ric-simulator/api/STD_2.0.0/ORAN_A1-p_V2.0.0_api.yaml
650 Create or update a policy type.
654 /policytype?id={policy-type-id}
658 policy-type-id: (*Required*)
660 The ID of the policy type.
662 **Body:** (*Required*)
664 A JSON object containing the schema for the type.
670 The policy type <policy-type-id> is ok
674 The policy type <policy-type-id> is ok
680 curl -X PUT "http://localhost:8085/policytype?id=STD_PolicyModelUnconstrained_0.2.0"
681 -H "Content-Type: application/json"
684 "$schema": "http://json-schema.org/draft-07/schema#",
685 "title": "STD_1_0.2.0",
686 "description": "STD 1 policy type",
699 "additionalProperties": false,
712 "additionalProperties": false,
720 "$schema": "http://json-schema.org/draft-07/schema#",
721 "title": "STD_1_0.2.0",
722 "description": "STD 1 policy type status",
731 "additionalProperties": false,
743 Policy type STD_PolicyModelUnconstrained_0.2.0 is OK
747 Policy type STD_PolicyModelUnconstrained_0.2.0 is OK
752 Delete a policy type.
756 /policytype?id={policy-type-id}
771 curl -X DELETE "http://localhost:8085/policytype?id=STD_PolicyModelUnconstrained_0.2.0"
785 Get a list of policy types.
799 A list of policy types.
805 curl -X GET "http://localhost:8085/policytypes"
811 ["STD_PolicyModelUnconstrained_0.2.0"]
814 /{policyId}/{enforceStatus}
815 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
820 Set a status to a policy instance with an enforceStatus parameter only.
824 /status?policyid={policyId}&status={status}&reason={reason}
834 Status updated for policy: <policyId>
840 curl -X PUT "http://localhost:8085/status?policyid=Policy1&status=ENFORCED"
846 Status updated for policy: Policy1
848 /{policyId}/{enforceStatus}/{enforceReason}
849 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
857 Send status for policy.
861 /sendstatus?policyid=<policy-id>
865 policyid: (*Required*)
867 The ID of the policy to send status for.
873 Is a JSON with the response of the actual post request to the callback server, whatever that is.
879 curl -X POST "http://localhost:8085/sendstatus?policyid=Policy2"