blob: 03fcf600e5687e663671f5d584de6c5ec912e1f7 [file] [log] [blame]
elinuxhenrikba5911d2022-06-13 13:55:28 +02001# -
2# ========================LICENSE_START=================================
3# O-RAN-SC
4# %%
5# Copyright (C) 2022: Nordix Foundation
6# %%
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18# ========================LICENSE_END===================================
19#
20
21cwd=$(pwd)
22
23mkdir -p specs
24
25curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.222/29222-h40.zip -o specs/apidef.zip
26curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.122/29122-h50.zip -o specs/common29122apidef.zip
27curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.508/29508-h60.zip -o specs/common29508apidef.zip
28curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.510/29510-h50.zip -o specs/common29510apidef.zip
29curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.512/29512-h60.zip -o specs/common29512apidef.zip
30curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.514/29514-h40.zip -o specs/common29514apidef.zip
31curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.517/29517-h50.zip -o specs/common29517apidef.zip
32curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.518/29518-h50.zip -o specs/common29518apidef.zip
33curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.522/29522-h50.zip -o specs/common29522apidef.zip
34curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.523/29523-h60.zip -o specs/common29523apidef.zip
35curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.554/29554-h30.zip -o specs/common29554apidef.zip
36curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.571/29571-h50.zip -o specs/common29571apidef.zip
37curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.572/29572-h40.zip -o specs/common29572apidef.zip
38
39cd specs/
40
41jar xvf apidef.zip
42jar xvf common29122apidef.zip
43jar xvf common29508apidef.zip
44jar xvf common29510apidef.zip
45jar xvf common29512apidef.zip
46jar xvf common29514apidef.zip
47jar xvf common29517apidef.zip
48jar xvf common29518apidef.zip
49jar xvf common29522apidef.zip
50jar xvf common29523apidef.zip
51jar xvf common29554apidef.zip
52jar xvf common29571apidef.zip
53jar xvf common29572apidef.zip
54
55sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\CivicAddress/{s/^\( *\).*/ \1/;x;d;}' TS29571_CommonData.yaml >temp.yaml
56mv temp.yaml TS29571_CommonData.yaml
57sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\GeographicArea/{s/^\( *\).*/ \1/;x;d;}' TS29571_CommonData.yaml >temp.yaml
58mv temp.yaml TS29571_CommonData.yaml
59sed '/accessTokenError.*/,+3d' TS29571_CommonData.yaml >temp.yaml
60mv temp.yaml TS29571_CommonData.yaml
61sed '/accessTokenRequest.*/,+3d' TS29571_CommonData.yaml >temp.yaml
62mv temp.yaml TS29571_CommonData.yaml
63
64sed '/oneOf.*/,+2d' TS29222_CAPIF_Publish_Service_API.yaml >temp.yaml
65mv temp.yaml TS29222_CAPIF_Publish_Service_API.yaml
66
67sed '64,68d' TS29222_CAPIF_Discover_Service_API.yaml >temp.yaml # Remove parameter preferred-aef-loc since it doesn't follow the OpenApi specification, "The behavior for nested objects and arrays is undefined."
68mv temp.yaml TS29222_CAPIF_Discover_Service_API.yaml
69
70cat TS29222_CAPIF_Security_API.yaml | sed -E 's/( AccessTokenReq*)\:/\1:| type: object/' | tr '|' '\n' > temp.yaml
71mv temp.yaml TS29222_CAPIF_Security_API.yaml
72
73cat TS29122_CommonData.yaml | sed 's/TS29572_Nlmf_Location/CommonData/g' > temp.yaml
74mv temp.yaml TS29122_CommonData.yaml
75cat TS29122_CommonData.yaml | sed 's/TS29554_Npcf_BDTPolicyControl/CommonData/g' > temp.yaml
76mv temp.yaml TS29122_CommonData.yaml
77cat TS29571_CommonData.yaml | sed 's/TS29571_CommonData.yaml//g' > temp.yaml
78mv temp.yaml TS29571_CommonData.yaml
79cat TS29222_CAPIF_Publish_Service_API.yaml | sed 's/TS29572_Nlmf_Location/CommonData/g' > temp.yaml
80mv temp.yaml TS29222_CAPIF_Publish_Service_API.yaml
81cat TS29222_CAPIF_Routing_Info_API.yaml | sed 's/TS29520_Nnwdaf_EventsSubscription/CommonData/g' > temp.yaml
82mv temp.yaml TS29222_CAPIF_Routing_Info_API.yaml
83cat TS29222_CAPIF_Routing_Info_API.yaml | sed 's/TS29510_Nnrf_NFManagement/CommonData/g' > temp.yaml
84mv temp.yaml TS29222_CAPIF_Routing_Info_API.yaml
85cat TS29222_CAPIF_Events_API.yaml | sed 's/TS29523_Npcf_EventExposure/CommonData/g' > temp.yaml
86mv temp.yaml TS29222_CAPIF_Events_API.yaml
87
88go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.10.1
89PATH=$PATH:~/go/bin
90
91cd $cwd
92
93echo "Fixing enums"
94cd src/internal/enumfixer
95go build .
96./enumfixer -apidir=../../../specs
97
98cd $cwd
99echo "Gathering common references"
100cd src/internal/commoncollector
101go build .
102./commoncollector -apidir=../../../specs
103
104cd $cwd
105echo "Fixing misc in specifications"
106cd src/internal/specificationfixer
107go build .
108./specificationfixer -apidir=../../../specs
109
110cd $cwd
111
112echo "Generating TS29122_CommonData"
113oapi-codegen --config gogeneratorspecs/common29122/generator_settings.yaml specs/TS29122_CommonData.yaml
114echo "Generating aggregated CommonData"
elinuxhenrik806724a2022-06-27 15:40:17 +0200115oapi-codegen --config gogeneratorspecs/common/generator_settings.yaml specs/CommonData.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200116echo "Generating TS29571_CommonData"
117oapi-codegen --config gogeneratorspecs/common29571/generator_settings.yaml specs/TS29571_CommonData.yaml
118echo "Generating TS29222_CAPIF_Publish_Service_API"
119oapi-codegen --config gogeneratorspecs/publishserviceapi/generator_settings_types.yaml specs/TS29222_CAPIF_Publish_Service_API.yaml
120oapi-codegen --config gogeneratorspecs/publishserviceapi/generator_settings_server.yaml specs/TS29222_CAPIF_Publish_Service_API.yaml
elinuxhenrik806724a2022-06-27 15:40:17 +0200121oapi-codegen --config gogeneratorspecs/publishserviceapi/generator_settings_client.yaml specs/TS29222_CAPIF_Publish_Service_API.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200122echo "Generating TS29222_CAPIF_API_Invoker_Management_API"
123oapi-codegen --config gogeneratorspecs/invokermanagementapi/generator_settings_types.yaml specs/TS29222_CAPIF_API_Invoker_Management_API.yaml
124oapi-codegen --config gogeneratorspecs/invokermanagementapi/generator_settings_server.yaml specs/TS29222_CAPIF_API_Invoker_Management_API.yaml
elinuxhenrik806724a2022-06-27 15:40:17 +0200125oapi-codegen --config gogeneratorspecs/invokermanagementapi/generator_settings_client.yaml specs/TS29222_CAPIF_API_Invoker_Management_API.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200126echo "Generating TS29222_CAPIF_API_Provider_Management_API"
127oapi-codegen --config gogeneratorspecs/providermanagementapi/generator_settings_types.yaml specs/TS29222_CAPIF_API_Provider_Management_API.yaml
128oapi-codegen --config gogeneratorspecs/providermanagementapi/generator_settings_server.yaml specs/TS29222_CAPIF_API_Provider_Management_API.yaml
elinuxhenrik806724a2022-06-27 15:40:17 +0200129oapi-codegen --config gogeneratorspecs/providermanagementapi/generator_settings_client.yaml specs/TS29222_CAPIF_API_Provider_Management_API.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200130echo "Generating TS29222_CAPIF_Discover_Service_API"
131oapi-codegen --config gogeneratorspecs/discoverserviceapi/generator_settings_types.yaml specs/TS29222_CAPIF_Discover_Service_API.yaml
132oapi-codegen --config gogeneratorspecs/discoverserviceapi/generator_settings_server.yaml specs/TS29222_CAPIF_Discover_Service_API.yaml
elinuxhenrik806724a2022-06-27 15:40:17 +0200133oapi-codegen --config gogeneratorspecs/discoverserviceapi/generator_settings_client.yaml specs/TS29222_CAPIF_Discover_Service_API.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200134echo "Generating TS29222_CAPIF_Security_API"
135oapi-codegen --config gogeneratorspecs/securityapi/generator_settings_types.yaml specs/TS29222_CAPIF_Security_API.yaml
136oapi-codegen --config gogeneratorspecs/securityapi/generator_settings_server.yaml specs/TS29222_CAPIF_Security_API.yaml
elinuxhenrik806724a2022-06-27 15:40:17 +0200137oapi-codegen --config gogeneratorspecs/securityapi/generator_settings_client.yaml specs/TS29222_CAPIF_Security_API.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200138echo "Generating TS29222_CAPIF_Logging_API_Invocation_API"
139oapi-codegen --config gogeneratorspecs/loggingapi/generator_settings_types.yaml specs/TS29222_CAPIF_Logging_API_Invocation_API.yaml
140oapi-codegen --config gogeneratorspecs/loggingapi/generator_settings_server.yaml specs/TS29222_CAPIF_Logging_API_Invocation_API.yaml
elinuxhenrik806724a2022-06-27 15:40:17 +0200141oapi-codegen --config gogeneratorspecs/loggingapi/generator_settings_client.yaml specs/TS29222_CAPIF_Logging_API_Invocation_API.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200142echo "Generating TS29222_CAPIF_Routing_Info_API"
143oapi-codegen --config gogeneratorspecs/routinginfoapi/generator_settings_types.yaml specs/TS29222_CAPIF_Routing_Info_API.yaml
144oapi-codegen --config gogeneratorspecs/routinginfoapi/generator_settings_server.yaml specs/TS29222_CAPIF_Routing_Info_API.yaml
elinuxhenrik806724a2022-06-27 15:40:17 +0200145oapi-codegen --config gogeneratorspecs/routinginfoapi/generator_settings_client.yaml specs/TS29222_CAPIF_Routing_Info_API.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200146echo "Generating TS29222_CAPIF_Access_Control_Policy_API"
147oapi-codegen --config gogeneratorspecs/accesscontrolpolicyapi/generator_settings_types.yaml specs/TS29222_CAPIF_Access_Control_Policy_API.yaml
148oapi-codegen --config gogeneratorspecs/accesscontrolpolicyapi/generator_settings_server.yaml specs/TS29222_CAPIF_Access_Control_Policy_API.yaml
elinuxhenrik806724a2022-06-27 15:40:17 +0200149oapi-codegen --config gogeneratorspecs/accesscontrolpolicyapi/generator_settings_client.yaml specs/TS29222_CAPIF_Access_Control_Policy_API.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200150echo "Generating TS29222_CAPIF_Events_API"
151oapi-codegen --config gogeneratorspecs/eventsapi/generator_settings_types.yaml specs/TS29222_CAPIF_Events_API.yaml
152oapi-codegen --config gogeneratorspecs/eventsapi/generator_settings_server.yaml specs/TS29222_CAPIF_Events_API.yaml
elinuxhenrik806724a2022-06-27 15:40:17 +0200153oapi-codegen --config gogeneratorspecs/eventsapi/generator_settings_client.yaml specs/TS29222_CAPIF_Events_API.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200154echo "Generating TS29222_CAPIF_Auditing_API"
155oapi-codegen --config gogeneratorspecs/auditingapi/generator_settings_types.yaml specs/TS29222_CAPIF_Auditing_API.yaml
156oapi-codegen --config gogeneratorspecs/auditingapi/generator_settings_server.yaml specs/TS29222_CAPIF_Auditing_API.yaml
elinuxhenrik806724a2022-06-27 15:40:17 +0200157oapi-codegen --config gogeneratorspecs/auditingapi/generator_settings_client.yaml specs/TS29222_CAPIF_Auditing_API.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200158echo "Generating TS29222_AEF_Security_API"
159oapi-codegen --config gogeneratorspecs/aefsecurityapi/generator_settings_types.yaml specs/TS29222_AEF_Security_API.yaml
160oapi-codegen --config gogeneratorspecs/aefsecurityapi/generator_settings_server.yaml specs/TS29222_AEF_Security_API.yaml
elinuxhenrik806724a2022-06-27 15:40:17 +0200161oapi-codegen --config gogeneratorspecs/aefsecurityapi/generator_settings_client.yaml specs/TS29222_AEF_Security_API.yaml
elinuxhenrikba5911d2022-06-13 13:55:28 +0200162
163echo "Install Java version of CAPIF Server API"
164mvn clean install -f server_pom.xml
165echo "Install Java version of CAPIF Client API"
166mvn clean install -f client_pom.xml
167
168echo "Cleanup"
elinuxhenrik4da3b832022-08-01 14:03:01 +0200169rm -rf specs