wahidw | fc1f59a | 2020-04-07 13:32:41 +0530 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | ############################################################################## |
| 3 | # |
| 4 | # Copyright (c) 2020 AT&T Intellectual Property. |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # |
| 18 | ############################################################################## |
| 19 | set -eux |
| 20 | |
| 21 | echo "--> rtmgr-build-ubuntu.sh" |
| 22 | curdir=`pwd` |
wahidw | 60a8db5 | 2020-07-04 21:07:37 +0530 | [diff] [blame] | 23 | RMRVERSION=4.1.2 |
wahidw | c65a65d | 2020-07-06 11:39:47 +0000 | [diff] [blame] | 24 | wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb && sudo dpkg -i rmr_${RMRVERSION}_amd64.deb && rm -rf rmr_${RMRVERSION}_amd64.deb |
| 25 | wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb && sudo dpkg -i rmr-dev_${RMRVERSION}_amd64.deb && rm -rf rmr-dev_${RMRVERSION}_amd64.deb |
wahidw | fc1f59a | 2020-04-07 13:32:41 +0530 | [diff] [blame] | 26 | |
| 27 | # required to find nng and rmr libs |
| 28 | export LD_LIBRARY_PATH=/usr/local/lib |
| 29 | |
| 30 | # go installs tools like go-acc to $HOME/go/bin |
| 31 | # ubuntu minion path lacks go |
| 32 | export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin |
| 33 | |
| 34 | # install the go coverage tool helper |
| 35 | go get -v github.com/ory/go-acc |
| 36 | |
| 37 | mkdir -p /tmp/go/bin /tmp/go/src/routing-manager |
| 38 | |
| 39 | wget --quiet https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/swagger_linux_amd64 && mv swagger_linux_amd64 swagger && chmod +x swagger |
| 40 | |
| 41 | mv swagger /tmp/go/bin |
| 42 | |
| 43 | export GOPATH=/tmp/go |
| 44 | |
| 45 | mkdir -p /tmp/go/src/routing-manager |
| 46 | |
| 47 | git clone "https://gerrit.o-ran-sc.org/r/ric-plt/appmgr" \ |
| 48 | && cp appmgr/api/appmgr_rest_api.yaml api/ \ |
| 49 | && rm -rf appmgr |
| 50 | |
wahidw | 16deaad | 2020-04-17 04:03:47 +0000 | [diff] [blame] | 51 | cp -r $curdir/* /tmp/go/src/routing-manager/. |
wahidw | fc1f59a | 2020-04-07 13:32:41 +0530 | [diff] [blame] | 52 | |
| 53 | cd /tmp/go/src/routing-manager |
| 54 | |
| 55 | currnewdir=`pwd` |
| 56 | /tmp/go/bin/swagger generate server -f api/routing_manager.yaml -t pkg/ --exclude-main -r LICENSE |
| 57 | /tmp/go/bin/swagger generate client -f api/appmgr_rest_api.yaml -t pkg/ -m appmgr_model -c appmgr_client -r LICENSE |
| 58 | |
| 59 | export GO111MODULE=on |
wahidw | b177846 | 2020-04-09 05:00:45 +0000 | [diff] [blame] | 60 | sudo ldconfig |
wahidw | fc1f59a | 2020-04-07 13:32:41 +0530 | [diff] [blame] | 61 | go build ./cmd/rtmgr.go |
| 62 | |
| 63 | export RMR_SEED_RT=/tmp/go/src/routing-manager/uta_rtg_ric.rt |
| 64 | |
| 65 | cd $currnewdir/pkg/sbi |
wahidw | 8f7ca65 | 2020-07-08 18:59:53 +0530 | [diff] [blame] | 66 | go-acc . -- -f "/tmp/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.json" |
wahidw | fc1f59a | 2020-04-07 13:32:41 +0530 | [diff] [blame] | 67 | |
| 68 | cd $currnewdir/pkg/rpe |
wahidw | 8f7ca65 | 2020-07-08 18:59:53 +0530 | [diff] [blame] | 69 | go-acc $(go list ./...) -- -f "/tmp/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.json" |
wahidw | fc1f59a | 2020-04-07 13:32:41 +0530 | [diff] [blame] | 70 | |
| 71 | cd $currnewdir/pkg/sdl |
wahidw | 8f7ca65 | 2020-07-08 18:59:53 +0530 | [diff] [blame] | 72 | go-acc $(go list ./...) -- -f "/tmp/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.json" |
wahidw | fc1f59a | 2020-04-07 13:32:41 +0530 | [diff] [blame] | 73 | |
| 74 | cd $currnewdir/pkg/nbi |
wahidw | 8f7ca65 | 2020-07-08 18:59:53 +0530 | [diff] [blame] | 75 | go-acc $(go list ./...) -- -f "/tmp/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.json" |
wahidw | fc1f59a | 2020-04-07 13:32:41 +0530 | [diff] [blame] | 76 | |
wahidw | 8532ffe | 2020-07-21 21:06:12 +0530 | [diff] [blame] | 77 | cd $currnewdir/pkg/rtmgr |
| 78 | go-acc $(go list ./...) -- -f "/tmp/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.json" |
| 79 | |
wahidw | fc1f59a | 2020-04-07 13:32:41 +0530 | [diff] [blame] | 80 | cd $currnewdir |
| 81 | |
| 82 | cat $currnewdir/pkg/rpe/coverage.txt | grep -v atomic > coverage_tmp.txt |
| 83 | cat $currnewdir/pkg/sdl/coverage.txt | grep -v atomic >> coverage_tmp.txt |
| 84 | cat $currnewdir/pkg/nbi/coverage.txt | grep -v atomic >> coverage_tmp.txt |
wahidw | 8532ffe | 2020-07-21 21:06:12 +0530 | [diff] [blame] | 85 | cat $currnewdir/pkg/rtmgr/coverage.txt | grep -v atomic >> coverage_tmp.txt |
wahidw | fc1f59a | 2020-04-07 13:32:41 +0530 | [diff] [blame] | 86 | cp $currnewdir/pkg/sbi/coverage.txt coverage_tmp2.txt |
| 87 | cat coverage_tmp2.txt coverage_tmp.txt > $curdir/coverage.txt |
| 88 | |
wahidw | b177846 | 2020-04-09 05:00:45 +0000 | [diff] [blame] | 89 | sed -i -e 's/^routing-manager/./' $curdir/coverage.txt |
wahidw | fc1f59a | 2020-04-07 13:32:41 +0530 | [diff] [blame] | 90 | |
| 91 | echo "--> rtmgr-build-ubuntu.sh ends" |