elinuxhenrik | c727c84 | 2022-02-11 08:29:36 +0100 | [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 internal/readonly/api |
| 24 | |
elinuxhenrik | 5142344 | 2022-04-25 15:36:13 +0200 | [diff] [blame] | 25 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.222/29222-h40.zip -o internal/readonly/api/apidef.zip |
| 26 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.122/29122-h50.zip -o internal/readonly/api/commonapidef.zip |
| 27 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.571/29571-h50.zip -o internal/readonly/api/common29571apidef.zip |
| 28 | curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.572/29572-h40.zip -o internal/readonly/api/common29572apidef.zip |
elinuxhenrik | c727c84 | 2022-02-11 08:29:36 +0100 | [diff] [blame] | 29 | |
| 30 | cd internal/readonly/api/ |
| 31 | |
| 32 | jar xvf apidef.zip |
| 33 | jar xvf commonapidef.zip |
| 34 | jar xvf common29571apidef.zip |
elinuxhenrik | 5142344 | 2022-04-25 15:36:13 +0200 | [diff] [blame] | 35 | jar xvf common29572apidef.zip |
elinuxhenrik | c727c84 | 2022-02-11 08:29:36 +0100 | [diff] [blame] | 36 | |
elinuxhenrik | 3969edc | 2022-04-29 09:28:51 +0200 | [diff] [blame] | 37 | sed '/nwAreaInfo.*/,+1d' TS29122_CommonData.yaml >temp.yaml |
elinuxhenrik | c727c84 | 2022-02-11 08:29:36 +0100 | [diff] [blame] | 38 | mv temp.yaml TS29122_CommonData.yaml |
elinuxhenrik | 5142344 | 2022-04-25 15:36:13 +0200 | [diff] [blame] | 39 | |
elinuxhenrik | 4f1dda2 | 2022-05-02 16:44:31 +0200 | [diff] [blame^] | 40 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\DddTrafficDescriptor/{s/^\( *\).*/ \1/;x;d;}' TS29571_CommonData.yaml >temp.yaml |
| 41 | mv temp.yaml TS29571_CommonData.yaml |
| 42 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\CivicAddress/{s/^\( *\).*/ \1/;x;d;}' TS29571_CommonData.yaml >temp.yaml |
| 43 | mv temp.yaml TS29571_CommonData.yaml |
| 44 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\GeographicArea/{s/^\( *\).*/ \1/;x;d;}' TS29571_CommonData.yaml >temp.yaml |
| 45 | mv temp.yaml TS29571_CommonData.yaml |
elinuxhenrik | c727c84 | 2022-02-11 08:29:36 +0100 | [diff] [blame] | 46 | sed '/accessTokenError.*/,+3d' TS29571_CommonData.yaml >temp.yaml |
| 47 | mv temp.yaml TS29571_CommonData.yaml |
| 48 | sed '/accessTokenRequest.*/,+3d' TS29571_CommonData.yaml >temp.yaml |
| 49 | mv temp.yaml TS29571_CommonData.yaml |
elinuxhenrik | 5142344 | 2022-04-25 15:36:13 +0200 | [diff] [blame] | 50 | |
| 51 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\moAssistanceDataTypes/{s/^\( *\).*/ \1/;x;d;}' TS29572_Nlmf_Location.yaml >temp.yaml |
| 52 | mv temp.yaml TS29572_Nlmf_Location.yaml |
| 53 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\RelativeCartesianLocation/{s/^\( *\).*/ \1/;x;d;}' TS29572_Nlmf_Location.yaml >temp.yaml |
| 54 | mv temp.yaml TS29572_Nlmf_Location.yaml |
| 55 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\Local2dPointUncertaintyEllipse/{s/^\( *\).*/ \1/;x;d;}' TS29572_Nlmf_Location.yaml >temp.yaml |
| 56 | mv temp.yaml TS29572_Nlmf_Location.yaml |
| 57 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\Local3dPointUncertaintyEllipsoid/{s/^\( *\).*/ \1/;x;d;}' TS29572_Nlmf_Location.yaml >temp.yaml |
| 58 | mv temp.yaml TS29572_Nlmf_Location.yaml |
| 59 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\oneOf/{s/^\( *\).*/ \1/;x;d;}' TS29572_Nlmf_Location.yaml >temp.yaml |
| 60 | mv temp.yaml TS29572_Nlmf_Location.yaml |
| 61 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\ueAreaInd/{s/^\( *\).*/ \1/;x;d;}' TS29572_Nlmf_Location.yaml >temp.yaml |
| 62 | mv temp.yaml TS29572_Nlmf_Location.yaml |
| 63 | sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\UeAreaIndication/{s/^\( *\).*/ \1/;x;d;}' TS29572_Nlmf_Location.yaml >temp.yaml |
| 64 | mv temp.yaml TS29572_Nlmf_Location.yaml |
| 65 | sed '/connectivitystate.*/,+2d' TS29572_Nlmf_Location.yaml >temp.yaml |
| 66 | mv temp.yaml TS29572_Nlmf_Location.yaml |
| 67 | |
elinuxhenrik | 667fbf3 | 2022-02-18 11:10:07 +0100 | [diff] [blame] | 68 | sed '/oneOf.*/,+2d' TS29222_CAPIF_Publish_Service_API.yaml >temp.yaml |
| 69 | mv temp.yaml TS29222_CAPIF_Publish_Service_API.yaml |
elinuxhenrik | 5142344 | 2022-04-25 15:36:13 +0200 | [diff] [blame] | 70 | |
| 71 | 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." |
| 72 | mv temp.yaml TS29222_CAPIF_Discover_Service_API.yaml |
| 73 | |
elinuxhenrik | 587d71d | 2022-03-23 17:44:46 +0100 | [diff] [blame] | 74 | cat TS29222_CAPIF_Security_API.yaml | sed -E 's/( AccessTokenReq*)\:/\1:| type: object/' | tr '|' '\n' > temp.yaml |
| 75 | mv temp.yaml TS29222_CAPIF_Security_API.yaml |
| 76 | |
| 77 | cd $cwd |
| 78 | |
| 79 | cd internal/enumfixer |
| 80 | go build . |
| 81 | ./enumfixer -apidir=../readonly/api |
elinuxhenrik | c727c84 | 2022-02-11 08:29:36 +0100 | [diff] [blame] | 82 | |
| 83 | cd $cwd |
| 84 | |
elinuxhenrik | 498e5c4 | 2022-04-28 09:54:05 +0200 | [diff] [blame] | 85 | go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen |
elinuxhenrik | fd7b7d0 | 2022-04-19 14:04:29 +0200 | [diff] [blame] | 86 | PATH=$PATH:~/go/bin |
| 87 | |
elinuxhenrik | c727c84 | 2022-02-11 08:29:36 +0100 | [diff] [blame] | 88 | oapi-codegen --config internal/readonly/common/generator_settings.yaml internal/readonly/api/TS29122_CommonData.yaml |
| 89 | oapi-codegen --config internal/readonly/common29571/generator_settings.yaml internal/readonly/api/TS29571_CommonData.yaml |
elinuxhenrik | 5142344 | 2022-04-25 15:36:13 +0200 | [diff] [blame] | 90 | oapi-codegen --config internal/readonly/nlfm/generator_settings.yaml internal/readonly/api/TS29572_Nlmf_Location.yaml |
elinuxhenrik | d1cc571 | 2022-02-17 14:50:50 +0100 | [diff] [blame] | 91 | oapi-codegen --config internal/readonly/publishserviceapi/generator_settings_types.yaml internal/readonly/api/TS29222_CAPIF_Publish_Service_API.yaml |
| 92 | oapi-codegen --config internal/readonly/publishserviceapi/generator_settings_server.yaml internal/readonly/api/TS29222_CAPIF_Publish_Service_API.yaml |
| 93 | oapi-codegen --config internal/readonly/invokermanagementapi/generator_settings_types.yaml internal/readonly/api/TS29222_CAPIF_API_Invoker_Management_API.yaml |
| 94 | oapi-codegen --config internal/readonly/invokermanagementapi/generator_settings_server.yaml internal/readonly/api/TS29222_CAPIF_API_Invoker_Management_API.yaml |
| 95 | oapi-codegen --config internal/readonly/providermanagementapi/generator_settings_types.yaml internal/readonly/api/TS29222_CAPIF_API_Provider_Management_API.yaml |
elinuxhenrik | c9e4b97 | 2022-02-18 16:42:05 +0100 | [diff] [blame] | 96 | oapi-codegen --config internal/readonly/providermanagementapi/generator_settings_server.yaml internal/readonly/api/TS29222_CAPIF_API_Provider_Management_API.yaml |
| 97 | oapi-codegen --config internal/readonly/discoverserviceapi/generator_settings_types.yaml internal/readonly/api/TS29222_CAPIF_Discover_Service_API.yaml |
elinuxhenrik | d6134d5 | 2022-03-08 16:05:44 +0100 | [diff] [blame] | 98 | oapi-codegen --config internal/readonly/discoverserviceapi/generator_settings_server.yaml internal/readonly/api/TS29222_CAPIF_Discover_Service_API.yaml |
elinuxhenrik | 76aff48 | 2022-03-16 10:28:44 +0100 | [diff] [blame] | 99 | oapi-codegen --config internal/readonly/securityapi/generator_settings_types.yaml internal/readonly/api/TS29222_CAPIF_Security_API.yaml |
| 100 | oapi-codegen --config internal/readonly/securityapi/generator_settings_server.yaml internal/readonly/api/TS29222_CAPIF_Security_API.yaml |
elinuxhenrik | d6134d5 | 2022-03-08 16:05:44 +0100 | [diff] [blame] | 101 | |
elinuxhenrik | 4f1dda2 | 2022-05-02 16:44:31 +0200 | [diff] [blame^] | 102 | go generate ./... |
| 103 | go test ./... |