blob: 90d7729dacfbdbe2b219cd8be5d60f5f3ad415f6 [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`
wahidw70574372020-12-07 07:25:06 +000023RMRVERSION=4.4.6
wahidwb4837472020-12-08 06:48:00 +000024wget --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
25wget --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
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
wahidw16deaad2020-04-17 04:03:47 +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
wahidw8f7ca652020-07-08 18:59:53 +053066go-acc . -- -f "/tmp/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.json"
wahidwfc1f59a2020-04-07 13:32:41 +053067
68cd $currnewdir/pkg/rpe
wahidw8f7ca652020-07-08 18:59:53 +053069go-acc $(go list ./...) -- -f "/tmp/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.json"
wahidwfc1f59a2020-04-07 13:32:41 +053070
71cd $currnewdir/pkg/sdl
wahidw8f7ca652020-07-08 18:59:53 +053072go-acc $(go list ./...) -- -f "/tmp/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.json"
wahidwfc1f59a2020-04-07 13:32:41 +053073
74cd $currnewdir/pkg/nbi
wahidw8f7ca652020-07-08 18:59:53 +053075go-acc $(go list ./...) -- -f "/tmp/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.json"
wahidwfc1f59a2020-04-07 13:32:41 +053076
wahidw8532ffe2020-07-21 21:06:12 +053077cd $currnewdir/pkg/rtmgr
78go-acc $(go list ./...) -- -f "/tmp/go/src/routing-manager/manifests/rtmgr/rtmgr-cfg.json"
79
wahidwfc1f59a2020-04-07 13:32:41 +053080cd $currnewdir
81
82cat $currnewdir/pkg/rpe/coverage.txt | grep -v atomic > coverage_tmp.txt
83cat $currnewdir/pkg/sdl/coverage.txt | grep -v atomic >> coverage_tmp.txt
84cat $currnewdir/pkg/nbi/coverage.txt | grep -v atomic >> coverage_tmp.txt
wahidw8532ffe2020-07-21 21:06:12 +053085cat $currnewdir/pkg/rtmgr/coverage.txt | grep -v atomic >> coverage_tmp.txt
wahidwfc1f59a2020-04-07 13:32:41 +053086cp $currnewdir/pkg/sbi/coverage.txt coverage_tmp2.txt
87cat coverage_tmp2.txt coverage_tmp.txt > $curdir/coverage.txt
88
wahidwb1778462020-04-09 05:00:45 +000089sed -i -e 's/^routing-manager/./' $curdir/coverage.txt
wahidwfc1f59a2020-04-07 13:32:41 +053090
91echo "--> rtmgr-build-ubuntu.sh ends"