elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 1 | # - |
| 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 | |
| 21 | cwd=$(pwd) |
| 22 | |
| 23 | mkdir -p specs |
| 24 | |
| 25 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.222/29222-h40.zip -o specs/apidef.zip |
| 26 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.122/29122-h50.zip -o specs/common29122apidef.zip |
| 27 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.508/29508-h60.zip -o specs/common29508apidef.zip |
| 28 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.510/29510-h50.zip -o specs/common29510apidef.zip |
| 29 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.512/29512-h60.zip -o specs/common29512apidef.zip |
| 30 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.514/29514-h40.zip -o specs/common29514apidef.zip |
| 31 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.517/29517-h50.zip -o specs/common29517apidef.zip |
| 32 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.518/29518-h50.zip -o specs/common29518apidef.zip |
| 33 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.522/29522-h50.zip -o specs/common29522apidef.zip |
| 34 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.523/29523-h60.zip -o specs/common29523apidef.zip |
| 35 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.554/29554-h30.zip -o specs/common29554apidef.zip |
| 36 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.571/29571-h50.zip -o specs/common29571apidef.zip |
| 37 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.572/29572-h40.zip -o specs/common29572apidef.zip |
| 38 | |
| 39 | cd specs/ |
| 40 | |
| 41 | jar xvf apidef.zip |
| 42 | jar xvf common29122apidef.zip |
| 43 | jar xvf common29508apidef.zip |
| 44 | jar xvf common29510apidef.zip |
| 45 | jar xvf common29512apidef.zip |
| 46 | jar xvf common29514apidef.zip |
| 47 | jar xvf common29517apidef.zip |
| 48 | jar xvf common29518apidef.zip |
| 49 | jar xvf common29522apidef.zip |
| 50 | jar xvf common29523apidef.zip |
| 51 | jar xvf common29554apidef.zip |
| 52 | jar xvf common29571apidef.zip |
| 53 | jar xvf common29572apidef.zip |
| 54 | |
| 55 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\CivicAddress/{s/^\( *\).*/ \1/;x;d;}' TS29571_CommonData.yaml >temp.yaml |
| 56 | mv temp.yaml TS29571_CommonData.yaml |
| 57 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\GeographicArea/{s/^\( *\).*/ \1/;x;d;}' TS29571_CommonData.yaml >temp.yaml |
| 58 | mv temp.yaml TS29571_CommonData.yaml |
| 59 | sed '/accessTokenError.*/,+3d' TS29571_CommonData.yaml >temp.yaml |
| 60 | mv temp.yaml TS29571_CommonData.yaml |
| 61 | sed '/accessTokenRequest.*/,+3d' TS29571_CommonData.yaml >temp.yaml |
| 62 | mv temp.yaml TS29571_CommonData.yaml |
| 63 | |
| 64 | sed '/oneOf.*/,+2d' TS29222_CAPIF_Publish_Service_API.yaml >temp.yaml |
| 65 | mv temp.yaml TS29222_CAPIF_Publish_Service_API.yaml |
| 66 | |
| 67 | sed '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." |
| 68 | mv temp.yaml TS29222_CAPIF_Discover_Service_API.yaml |
| 69 | |
| 70 | cat TS29222_CAPIF_Security_API.yaml | sed -E 's/( AccessTokenReq*)\:/\1:| type: object/' | tr '|' '\n' > temp.yaml |
| 71 | mv temp.yaml TS29222_CAPIF_Security_API.yaml |
| 72 | |
| 73 | cat TS29122_CommonData.yaml | sed 's/TS29572_Nlmf_Location/CommonData/g' > temp.yaml |
| 74 | mv temp.yaml TS29122_CommonData.yaml |
| 75 | cat TS29122_CommonData.yaml | sed 's/TS29554_Npcf_BDTPolicyControl/CommonData/g' > temp.yaml |
| 76 | mv temp.yaml TS29122_CommonData.yaml |
| 77 | cat TS29571_CommonData.yaml | sed 's/TS29571_CommonData.yaml//g' > temp.yaml |
| 78 | mv temp.yaml TS29571_CommonData.yaml |
| 79 | cat TS29222_CAPIF_Publish_Service_API.yaml | sed 's/TS29572_Nlmf_Location/CommonData/g' > temp.yaml |
| 80 | mv temp.yaml TS29222_CAPIF_Publish_Service_API.yaml |
| 81 | cat TS29222_CAPIF_Routing_Info_API.yaml | sed 's/TS29520_Nnwdaf_EventsSubscription/CommonData/g' > temp.yaml |
| 82 | mv temp.yaml TS29222_CAPIF_Routing_Info_API.yaml |
| 83 | cat TS29222_CAPIF_Routing_Info_API.yaml | sed 's/TS29510_Nnrf_NFManagement/CommonData/g' > temp.yaml |
| 84 | mv temp.yaml TS29222_CAPIF_Routing_Info_API.yaml |
| 85 | cat TS29222_CAPIF_Events_API.yaml | sed 's/TS29523_Npcf_EventExposure/CommonData/g' > temp.yaml |
| 86 | mv temp.yaml TS29222_CAPIF_Events_API.yaml |
| 87 | |
| 88 | go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.10.1 |
| 89 | PATH=$PATH:~/go/bin |
| 90 | |
| 91 | cd $cwd |
| 92 | |
| 93 | echo "Fixing enums" |
| 94 | cd src/internal/enumfixer |
| 95 | go build . |
| 96 | ./enumfixer -apidir=../../../specs |
| 97 | |
| 98 | cd $cwd |
| 99 | echo "Gathering common references" |
| 100 | cd src/internal/commoncollector |
| 101 | go build . |
| 102 | ./commoncollector -apidir=../../../specs |
| 103 | |
| 104 | cd $cwd |
| 105 | echo "Fixing misc in specifications" |
| 106 | cd src/internal/specificationfixer |
| 107 | go build . |
| 108 | ./specificationfixer -apidir=../../../specs |
| 109 | |
| 110 | cd $cwd |
| 111 | |
| 112 | echo "Generating TS29122_CommonData" |
| 113 | oapi-codegen --config gogeneratorspecs/common29122/generator_settings.yaml specs/TS29122_CommonData.yaml |
| 114 | echo "Generating aggregated CommonData" |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 115 | oapi-codegen --config gogeneratorspecs/common/generator_settings.yaml specs/CommonData.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 116 | echo "Generating TS29571_CommonData" |
| 117 | oapi-codegen --config gogeneratorspecs/common29571/generator_settings.yaml specs/TS29571_CommonData.yaml |
| 118 | echo "Generating TS29222_CAPIF_Publish_Service_API" |
| 119 | oapi-codegen --config gogeneratorspecs/publishserviceapi/generator_settings_types.yaml specs/TS29222_CAPIF_Publish_Service_API.yaml |
| 120 | oapi-codegen --config gogeneratorspecs/publishserviceapi/generator_settings_server.yaml specs/TS29222_CAPIF_Publish_Service_API.yaml |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 121 | oapi-codegen --config gogeneratorspecs/publishserviceapi/generator_settings_client.yaml specs/TS29222_CAPIF_Publish_Service_API.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 122 | echo "Generating TS29222_CAPIF_API_Invoker_Management_API" |
| 123 | oapi-codegen --config gogeneratorspecs/invokermanagementapi/generator_settings_types.yaml specs/TS29222_CAPIF_API_Invoker_Management_API.yaml |
| 124 | oapi-codegen --config gogeneratorspecs/invokermanagementapi/generator_settings_server.yaml specs/TS29222_CAPIF_API_Invoker_Management_API.yaml |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 125 | oapi-codegen --config gogeneratorspecs/invokermanagementapi/generator_settings_client.yaml specs/TS29222_CAPIF_API_Invoker_Management_API.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 126 | echo "Generating TS29222_CAPIF_API_Provider_Management_API" |
| 127 | oapi-codegen --config gogeneratorspecs/providermanagementapi/generator_settings_types.yaml specs/TS29222_CAPIF_API_Provider_Management_API.yaml |
| 128 | oapi-codegen --config gogeneratorspecs/providermanagementapi/generator_settings_server.yaml specs/TS29222_CAPIF_API_Provider_Management_API.yaml |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 129 | oapi-codegen --config gogeneratorspecs/providermanagementapi/generator_settings_client.yaml specs/TS29222_CAPIF_API_Provider_Management_API.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 130 | echo "Generating TS29222_CAPIF_Discover_Service_API" |
| 131 | oapi-codegen --config gogeneratorspecs/discoverserviceapi/generator_settings_types.yaml specs/TS29222_CAPIF_Discover_Service_API.yaml |
| 132 | oapi-codegen --config gogeneratorspecs/discoverserviceapi/generator_settings_server.yaml specs/TS29222_CAPIF_Discover_Service_API.yaml |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 133 | oapi-codegen --config gogeneratorspecs/discoverserviceapi/generator_settings_client.yaml specs/TS29222_CAPIF_Discover_Service_API.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 134 | echo "Generating TS29222_CAPIF_Security_API" |
| 135 | oapi-codegen --config gogeneratorspecs/securityapi/generator_settings_types.yaml specs/TS29222_CAPIF_Security_API.yaml |
| 136 | oapi-codegen --config gogeneratorspecs/securityapi/generator_settings_server.yaml specs/TS29222_CAPIF_Security_API.yaml |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 137 | oapi-codegen --config gogeneratorspecs/securityapi/generator_settings_client.yaml specs/TS29222_CAPIF_Security_API.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 138 | echo "Generating TS29222_CAPIF_Logging_API_Invocation_API" |
| 139 | oapi-codegen --config gogeneratorspecs/loggingapi/generator_settings_types.yaml specs/TS29222_CAPIF_Logging_API_Invocation_API.yaml |
| 140 | oapi-codegen --config gogeneratorspecs/loggingapi/generator_settings_server.yaml specs/TS29222_CAPIF_Logging_API_Invocation_API.yaml |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 141 | oapi-codegen --config gogeneratorspecs/loggingapi/generator_settings_client.yaml specs/TS29222_CAPIF_Logging_API_Invocation_API.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 142 | echo "Generating TS29222_CAPIF_Routing_Info_API" |
| 143 | oapi-codegen --config gogeneratorspecs/routinginfoapi/generator_settings_types.yaml specs/TS29222_CAPIF_Routing_Info_API.yaml |
| 144 | oapi-codegen --config gogeneratorspecs/routinginfoapi/generator_settings_server.yaml specs/TS29222_CAPIF_Routing_Info_API.yaml |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 145 | oapi-codegen --config gogeneratorspecs/routinginfoapi/generator_settings_client.yaml specs/TS29222_CAPIF_Routing_Info_API.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 146 | echo "Generating TS29222_CAPIF_Access_Control_Policy_API" |
| 147 | oapi-codegen --config gogeneratorspecs/accesscontrolpolicyapi/generator_settings_types.yaml specs/TS29222_CAPIF_Access_Control_Policy_API.yaml |
| 148 | oapi-codegen --config gogeneratorspecs/accesscontrolpolicyapi/generator_settings_server.yaml specs/TS29222_CAPIF_Access_Control_Policy_API.yaml |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 149 | oapi-codegen --config gogeneratorspecs/accesscontrolpolicyapi/generator_settings_client.yaml specs/TS29222_CAPIF_Access_Control_Policy_API.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 150 | echo "Generating TS29222_CAPIF_Events_API" |
| 151 | oapi-codegen --config gogeneratorspecs/eventsapi/generator_settings_types.yaml specs/TS29222_CAPIF_Events_API.yaml |
| 152 | oapi-codegen --config gogeneratorspecs/eventsapi/generator_settings_server.yaml specs/TS29222_CAPIF_Events_API.yaml |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 153 | oapi-codegen --config gogeneratorspecs/eventsapi/generator_settings_client.yaml specs/TS29222_CAPIF_Events_API.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 154 | echo "Generating TS29222_CAPIF_Auditing_API" |
| 155 | oapi-codegen --config gogeneratorspecs/auditingapi/generator_settings_types.yaml specs/TS29222_CAPIF_Auditing_API.yaml |
| 156 | oapi-codegen --config gogeneratorspecs/auditingapi/generator_settings_server.yaml specs/TS29222_CAPIF_Auditing_API.yaml |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 157 | oapi-codegen --config gogeneratorspecs/auditingapi/generator_settings_client.yaml specs/TS29222_CAPIF_Auditing_API.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 158 | echo "Generating TS29222_AEF_Security_API" |
| 159 | oapi-codegen --config gogeneratorspecs/aefsecurityapi/generator_settings_types.yaml specs/TS29222_AEF_Security_API.yaml |
| 160 | oapi-codegen --config gogeneratorspecs/aefsecurityapi/generator_settings_server.yaml specs/TS29222_AEF_Security_API.yaml |
elinuxhenrik | 806724a | 2022-06-27 15:40:17 +0200 | [diff] [blame] | 161 | oapi-codegen --config gogeneratorspecs/aefsecurityapi/generator_settings_client.yaml specs/TS29222_AEF_Security_API.yaml |
elinuxhenrik | ba5911d | 2022-06-13 13:55:28 +0200 | [diff] [blame] | 162 | |
| 163 | echo "Install Java version of CAPIF Server API" |
| 164 | mvn clean install -f server_pom.xml |
| 165 | echo "Install Java version of CAPIF Client API" |
| 166 | mvn clean install -f client_pom.xml |
| 167 | |
| 168 | echo "Cleanup" |
elinuxhenrik | 4da3b83 | 2022-08-01 14:03:01 +0200 | [diff] [blame] | 169 | rm -rf specs |