blob: 2d57f4e6beacc93d58d7f9152f83c87f7bf7c9b6 [file] [log] [blame]
selvamuthukumaran_c50dea5a2019-03-06 12:03:40 +05301#!/bin/bash
2
3# Copyright 2017-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17#Below are the list of ports which are required to be free, for the SEBA services to use. If any new services get added into SEBA, Update the required node ports below and also add it to the arrray portlist.
18
19#Service name : node Port number
20#onos-debugger: 30555
21#onos-openflow: 31653
22#onos-ssh: 30115
23#onos-ui: 30120
24#xos-chameleon: 30006
25#xos-core: 30010, 30011
26#xos-core-prometheus: 30009
27#xos-gui: 30001
28#xos-tosca: 30007
29#xos-ws: 30008
30#ingress-nginx: 30080, 30443
31#vcli: 30110
32#voltha: 30125, 30613, 32443, 31390
33#kpi-exporter: 31080
34#logging-elasticsearch-client: 31636
35#logging-kibana: 30601
36#nem-monitoring-grafana: 31300
37#nem-monitoring-prometheus-server: 31301
38
39declare -a portlist=("30555" "31653" "30115" "30120" "30006" "30010" "30011" "30009" "30001" "30007" "30008" "30080" "30443" "30110" "30125" "30613" "32443" "31390" "31080" "31636" "30601" "31300" "31301")
40
41number_of_ports_in_use=0
42
43#Below loop is to check whether any port in the list is already being used
44for port in "${portlist[@]}"
45do
46 if netstat -lntp | grep :":$port" > /dev/null ; then
47 used_process=$(netstat -lntp | grep :":$port" | tr -s ' ' | cut -f7 -d' ')
48 echo "ERROR: Process with PID/Program_name $used_process is already listening on port: $port needed by SEBA"
49 number_of_ports_in_use=$((number_of_ports_in_use+1))
50 fi
51done
52
53#If any of the ports are already used then the user will be notified to kill the running services before installing SEBA
54if [ $number_of_ports_in_use -gt 0 ]
55 then
56 echo "Kill the running services mentioned above before proceeding to install SEBA"
57 echo "Terminating make"
Zack Williamsf0b8e942019-07-23 16:21:28 -070058 exit 1
selvamuthukumaran_c50dea5a2019-03-06 12:03:40 +053059fi
60
61#The ports that are required by SEBA components will be added to the reserved port list
62var=$(printf '%s,' "${portlist[@]}")
63echo "$var" > /proc/sys/net/ipv4/ip_local_reserved_ports
64echo "SUCCESS: Added ports required for SEBA services to ip_local_reserved_ports"
65