First commit of the near-rt-ric simulator
[sim/a1-interface.git] / near-rt-ric-simulator / README.md
1 # O-RAN-SC Near-RealTime RIC Simulator
2
3 The O-RAN SC Near-RealTime RIC simulates the A1 as an generic REST API which can receive and send northbound messages. The simulator validates the payload and applies policy.
4
5 The simulator handles the requests that are defined in the A1 open API yaml file. All these requests are simulated in the a1.py file. The available requests and the addresses are currently:
6  - GET all policy identities (respectively for a policy type if query parameter used): http://localhost:8085/A1-P/v1/policies?policyTypeId={policyTypeId}
7  - PUT a policy instance(create or update it): http://localhost:8085/A1-P/v1/policies/{policyId}?policyTypeId={policyTypeId}
8  - GET a policy: http://localhost:8085/A1-P/v1/policies/{policyId}
9  - DELETE a policy instance: http://localhost:8085/A1-P/v1/policies/{policyId}
10  - GET a policy status: http://localhost:8085/A1-P/v1/policystatus
11  - GET all policy types: http://localhost:8085/A1-P/v1/policytypes
12  - GET the schemas for a policy type: http://localhost:8085/A1-P/v1/policytypes/{policyTypeId}
13
14 Nota Bene: It could happen that this page is not updated as soon as the yaml file is. The yaml file can be found under /near-rt-ric-simulator/a1-openapi.yaml.
15
16 Additionally, there are requests that are defined in main.py as an administrative API. The goal is to handle information that couldn't be handled using the A1 interface. The available requests and the addresses are currently:
17  - GET, a basic healthcheck: http://localhost:8085/
18  - PUT a policy type: http://localhost:8085/policytypes/{policyTypeId}
19  - DELETE a policy type: http://localhost:8085/policytypes/{policyTypeId}
20  - DELETE all policy instances: http://localhost:8085/deleteinstances
21  - DELETE all policy types: http://localhost:8085/deletetypes
22  - PUT a status to a policy instance with an enforceStatus parameter only: http://localhost:8085/{policyId}/{enforceStatus}
23  - PUT a status to a policy instance with both enforceStatus and enforceReason: http://localhost:8085/{policyId}/{enforceStatus}/{enforceReason}
24
25 The backend server publishes live API documentation at the URL `http://your-host-name-here:8080/swagger-ui.html`
26
27 # Starting up the simulator
28 First, download the sim/a1-interface repo on gerrit:
29 git clone "https://gerrit.o-ran-sc.org/oransc/sim/a1-interface"
30
31 Then, build the docker container:
32 docker build -t simulator .
33
34 To run it, use the command:
35 docker run -it -p 8085:8085 simulator
36
37 Note: -p 8085:8085 allows to map the port inside the container to any port you choose. One can for example choose -p 8084:8085; in that case, all the addresses mentioned above should be modified accordingly.
38
39 Let the simulator run in one terminal; in another terminal, one can run the command ./commands.sh. It contains the main requests, and will eventually leave the user with a policy type STD_QoSNudging_0.2.0 and a policy instance pi1 with an enforceStatus set to NOT_ENFORCED and an enforce Reason set to 300.
40 All the response codes should be 20X, otherwise something went wrong.
41
42 ## License
43
44 Copyright (C) 2019 Nordix Foundation.
45 Licensed under the Apache License, Version 2.0 (the "License")
46 you may not use this file except in compliance with the License.
47 You may obtain a copy of the License at
48
49       http://www.apache.org/licenses/LICENSE-2.0
50
51 Unless required by applicable law or agreed to in writing, software
52 distributed under the License is distributed on an "AS IS" BASIS,
53 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54 See the License for the specific language governing permissions and
55 limitations under the License.
56
57 For more information about license please see the [LICENSE](LICENSE.txt) file for details.