This product is a Go implementation of a service that calls the CAPIF Core function. When publishing a service we create a Kong route and Kong service, https://konghq.com/. The InterfaceDescription that we return is updated to point to the Kong Data Plane. Therefore, the API interface that we return from Service Discovery has the Kong host and port, and not the original service's host and port. This allows the rApp's API call to be re-directed through Kong.
This product is a Go implementation of the CAPIF Core function, which is based on the 3GPP "29.222 Common API Framework for 3GPP Northbound APIs (CAPIF)" interfaces, see https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=3450.
See CAPIF Core
The CAPIF APIs are generated from the OpenAPI specifications provided by 3GPP. The generate.sh
script downloads the specifications from 3GPP, fixes them and then generates the APIs. While these files are checked into the repo, they can be re-generated using generate.sh
.
./generate.sh
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.
To fix the specifications there are three tools.
commoncollector
, collects type definitions from peripheral specifications to keep down the number of dependencies to other specifications. The types to collect are listed in the definitions.txt
file. Some fixes are hard coded.enumfixer
, fixes enumeration definitions so they can be properly generated.specificationfixer
, fixes flaws in the specifications so they can be properly generated. All fixes are hard coded.First, we need to run generate.sh
as described above to generate our API code from the 3GPP spec.
Before we can test or run R1-SME-Manager, we need to configure a .env file with the required parameters. Please see the template .env.example in the servicemanager directory.
You can set the environmental variable SERVICE_MANAGER_ENV to specify the .env file. For example, the following command specifies to use the config file .env.development. If this flag is not set, first we try .env.development and then .env.
export SERVICE_MANAGER_ENV=development
We also need Kong and Capifcore to be running. Please see the examples in the configs
folder.
After generating the API code, we can build the application with the following command.
go build
To run the unit tests for the application, first ensure that the .env file is configured. In the following example, we specify .env.test
. For now, we need to disable parallelism in the unit tests with -p=1.
export SERVICE_MANAGER_ENV=test go test -p=1 -count=1 ./...
To run as a local app, first ensure that the .env file is configured. In the following example, we specify .env.development
.
export SERVICE_MANAGER_ENV=development ./servicemanager
R1-SME-Manager is then available on the port configured in .env.
The application can also be built as a Docker image, by using the following command. We build the image without a .env file. This is supplied by volume mounting at container run-time.
docker image build . -t servicemanager
For a stand-alone deployment, please see the deploy
folder for configurations to deploy to R1-SME-Manager to Kubernetes. We need the following steps.
We consolidate the above steps into the script deploy-to-k8s.sh
. To delete the full deployment, you can use delete-from-k8s.sh
. The deploy folder has the following structure.
We store the Kubernetes manifests files in the manifests in the subfolder. We store the shell scripts in the src folder.
In deploy-to-k8s.sh
, we copy .env.example and use sed to replace the template values with values for testing/production. You will need to update this part of the script with your own values. There is an example sed replacement in function substitute_manifest()
in deploy-to-k8s.sh
. Here, you can substitute your own Docker images for Capifcore and Service Manager for local development.
In addition there are 2 switches that are added for developer convenience.
./deploy-to-k8s.sh --repo your-docker-repo-id --env ../../.env.minikube