Lift CAPIF specifications to latest version
[nonrtric/plt/sme.git] / capifcore / README.md
1 <!--
2  -
3    ========================LICENSE_START=================================
4    O-RAN-SC
5    %%
6    Copyright (C) 2022: Nordix Foundation
7    %%
8    Licensed under the Apache License, Version 2.0 (the "License");
9    you may not use this file except in compliance with the License.
10    You may obtain a copy of the License at
11
12         http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19    ========================LICENSE_END===================================
20
21 -->
22
23 # O-RAN-SC Non-RealTime CAPIF implementation
24
25 This product is a Go implementation of the CAPIF Core function, based on the 3GPP CAPIF interfaces.
26
27 ## Generation of API code
28
29 The CAPIF APIs are generated from the OpenAPI specification provided by 3GPP. The `generate.sh` script downloads the
30 specifications from 3GPP, fixes them and then generates the APIs. It also generates the mocks needed for unit testing. The specifications are downloaded from the following site; https://www.3gpp.org/ftp/Specs/archive/29_series. To see the APIs in swagger format, see the following link; https://github.com/jdegre/5GC_APIs/tree/Rel-16#common-api-framework-capif. **NOTE!** The documentation in this link is for release 16 of CAPIF, the downloaded specifications are for release 17.
31
32 To fix the specifications there are three tools:
33 - `commoncollector`, collects type definitions from peripheral specifications to keep down the number of dependencies to
34   other specifications. The types to collect are listed in the `definitions.txt`file. Some fixes are hard coded.
35 - `enumfixer`, fixes enumeration definitions so they can be properly generated.
36 - `specificationfixer`, fixes flaws in the specifications so they can be properly generated. All fixes are hard coded.
37
38 ## Build and test
39
40 To generate mocks manually, run the following command:
41
42     go generate ./...
43
44 To build the application, run the following command:
45
46     go build
47
48 To run the unit tests for the application, run the following command:
49
50     go test ./...
51
52 The application can also be built as a Docker image, by using the following command:
53
54     docker build . -t capifcore
55
56 ## Run
57
58 To run the Core Function from the command line, run the following commands from this folder.
59
60     ./capifcore [-port <port (default 8080)>]
61