blob: f23b9cb920fcbf36918c51ef1d5193dd5caeac1f [file] [log] [blame]
wahidwfc1f59a2020-04-07 13:32:41 +05301#!/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##############################################################################
19set -eux
20
21echo "--> rtmgr-build-ubuntu.sh"
22curdir=`pwd`
wahidwa55ae652020-04-09 14:14:15 +000023RMRVERSION=3.6.5
wahidwb1778462020-04-09 05:00:45 +000024wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb && sudo dpkg -i rmr_${RMRVERSION}_amd64.deb && rm -rf rmr_${RMRVERSION}_amd64.deb
25wget --content-disposition https://packagecloud.io/o-ran-sc/staging/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
wahidwfc1f59a2020-04-07 13:32:41 +053026
27# required to find nng and rmr libs
28export LD_LIBRARY_PATH=/usr/local/lib
29
30# go installs tools like go-acc to $HOME/go/bin
31# ubuntu minion path lacks go
32export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
33
34# install the go coverage tool helper
35go get -v github.com/ory/go-acc
36
37mkdir -p /tmp/go/bin /tmp/go/src/routing-manager
38
39wget --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
41mv swagger /tmp/go/bin
42
43export GOPATH=/tmp/go
44
45mkdir -p /tmp/go/src/routing-manager
46
47git 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
wahidw6805ff12020-04-10 03:17:52 +000051cp -r curdir/* /tmp/go/src/routing-manager/.
wahidwfc1f59a2020-04-07 13:32:41 +053052
53cd /tmp/go/src/routing-manager
54
55currnewdir=`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
59export GO111MODULE=on
wahidwb1778462020-04-09 05:00:45 +000060sudo ldconfig
wahidwfc1f59a2020-04-07 13:32:41 +053061go build ./cmd/rtmgr.go
62
63export RMR_SEED_RT=/tmp/go/src/routing-manager/uta_rtg_ric.rt
64
65cd $currnewdir/pkg/sbi
66go-acc . -- -f "/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.yaml"
67
68cd $currnewdir/pkg/rpe
69go-acc $(go list ./...) -- -f "/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.yaml"
70
71cd $currnewdir/pkg/sdl
72go-acc $(go list ./...) -- -f "/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.yaml"
73
74cd $currnewdir/pkg/nbi
75go-acc $(go list ./...) -- -f "/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.yaml"
76
77cd $currnewdir
78
79cat $currnewdir/pkg/rpe/coverage.txt | grep -v atomic > coverage_tmp.txt
80cat $currnewdir/pkg/sdl/coverage.txt | grep -v atomic >> coverage_tmp.txt
81cat $currnewdir/pkg/nbi/coverage.txt | grep -v atomic >> coverage_tmp.txt
82cp $currnewdir/pkg/sbi/coverage.txt coverage_tmp2.txt
83cat coverage_tmp2.txt coverage_tmp.txt > $curdir/coverage.txt
84
wahidwb1778462020-04-09 05:00:45 +000085sed -i -e 's/^routing-manager/./' $curdir/coverage.txt
wahidwfc1f59a2020-04-07 13:32:41 +053086
87echo "--> rtmgr-build-ubuntu.sh ends"