blob: 02607df84d54db1f2f8c2e8c6b75f5956b1f0e4b [file] [log] [blame]
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +05301#!/bin/bash
2
3#Copyright 2018-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### BEGIN INIT INFO
18# Provides: start_inband_oltservices.sh
19# Required-Start: $all
20# Required-Stop: $network $local_fs $syslog
21# Default-Start: 2 3 4 5
22# Default-Stop: 0 1 6
23# Short-Description: Sets up inband management channel and starts device management and Openolt services
24# Description:
25# This script does the following things
26# 1) Extracts bal package and keep the files in appropriate paths.
27# 2) Starts svk_init which installs required drivers needed by the MAC devices
28# 3) Starts device management daemon which initializes all maple, qumran chip sets
29# and brings up access terminal.
30# 4) Sets up inband management channel
31# 5) Creates inband vlan tagged interface which will be used to communicate to
32# Openolt service from vOLTHA via NNI
33# 6) Sets up dhcp-client-identifier in "/etc/dhcp/dhclient.conf" for each inband
34# tagged interface so that it can obtain IP address from DHCP server
35# 7) Sets up DHCP IP configuration in "/etc/network/interfaces" for inband tagged
36# interface so that it can initiate DHCPREQUEST to DHCP server once network
37# restart triggered.
38# 8) Starts openolt service which enables all PON and NNI interfaces and creates
39# respective PON and NNI schedulers and Queues.
40### END INIT INFO
41
42#------------------------------------------------------------------------------
43# GLOBAL VARIABLES
44#------------------------------------------------------------------------------
45
46# Root path where required bal directories are located
47BRCM_OPT_DIR='/opt/bcm68620'
48BRCM_DIR='/broadcom'
49
50# olt service files
51SVK_INIT_FILE="${BRCM_OPT_DIR}/svk_init.sh"
52
Girish Gowdra6e745522020-07-15 15:52:13 -070053# inband config file
54INBAND_CONFIG_FILE="${BRCM_DIR}/inband.config"
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +053055DHCLIENT_CONF="/etc/dhcp/dhclient.conf"
56
57# olt serial number
58SERIAL_NUMBER="/sys/devices/virtual/dmi/id/product_serial"
59
60OLT_MODEL=$(cat /sys/devices/virtual/dmi/id/board_name)
61NETWORK_INTERFACE="/etc/network/interfaces"
62BAL_OPENOLT_DEB_16="/openolt_asfvolt16.deb"
63BAL_OPENOLT_DEB_64="/openolt_asgvolt64.deb"
64
65DEV_MGMT_DAEMON="dev_mgmt_daemon -d -pcie"
66OPENOLT="openolt"
67ASFVOLT16="asfvolt16"
68ASGVOLT64="asgvolt64"
69ASF16_MODEL="ASXvOLT16"
Humera Kouser4a663fe2020-09-23 04:33:54 -040070EDGECORE="edgecore"
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +053071
72# vlan id for asfvolt16
73ASFVOLT16_VLAN_ID_ETH2=
74
75# vlan id for asgvolt64
76ASGVOLT64_VLAN_ID_ETH1=
77
78# File used to set/get argument to openolt service
79OPENOLT_ARG_INPUT_FILE=/etc/default/openolt
80
81# Wait time for BAL to get ready
Girish Gowdra70feafd2020-08-06 20:08:26 -070082WAIT_TIME_BAL_READY=$(awk '/wait_time_bal_ready/{print $0}' ${INBAND_CONFIG_FILE} | awk -F "=" '{print $2}')
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +053083
84#------------------------------------------------------------------------------
85# Function Name: does_logger_exist
86# Description:
87# This function check if logger exist and executable.
88#
89# Globals:
90# None
91#
92# Arguments:
93# None
94#
95# Returns:
96# returns 0 if exist and executable else 1
97#------------------------------------------------------------------------------
98does_logger_exist() {
99 cmd=/usr/bin/logger
100 if [ -x ${cmd} ]; then
101 return 0
102 else
103 return 1
104 fi
105}
106
107#------------------------------------------------------------------------------
108# Function Name: info_message
109# Description:
110# This function print the info message information to the console
111#
112# Globals:
113# None
114#
115# Arguments:
116# string message
117#
118# Returns:
119# None
120#------------------------------------------------------------------------------
121info_message() {
122 echo "INFO: $1"
123 logger -p user.info "$1"
124}
125
126#------------------------------------------------------------------------------
127# Function Name: error_message
128# Description:
129# This function print the error message information to the console
130#
131# Globals:
132# None
133#
134# Arguments:
135# string message
136#
137# Returns:
138# returns 1
139#------------------------------------------------------------------------------
140error_message() {
141 echo "ERROR: $1"
142 logger -p user.err "$1"
143 return 1
144}
145
146#------------------------------------------------------------------------------
147# Function Name: get_vlan_ids
148# Description:
Girish Gowdra6e745522020-07-15 15:52:13 -0700149# This function facilitates to fetch vlan id from inband configuration file
150# located at /broadcom/inband.config
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530151#
152# Globals:
Girish Gowdra6e745522020-07-15 15:52:13 -0700153# INBAND_CONFIG_FILE, ASFVOLT16_VLAN_ID_ETH2, ASFVOLT16_VLAN_ID_ETH3,
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530154# ASGVOLT64_VLAN_ID_ETH1, ASGVOLT64_VLAN_ID_ETH2
155#
156# Arguments:
157# None
158#
159# Returns:
160# None
161#------------------------------------------------------------------------------
162get_vlan_ids() {
Girish Gowdra6e745522020-07-15 15:52:13 -0700163 # Read inband.config file to fetch vlan id information
164 if [ -f ${INBAND_CONFIG_FILE} ]; then
165 ASFVOLT16_VLAN_ID_ETH2=$(awk '/asfvolt16_vlan_id_eth2/{print $0}' ${INBAND_CONFIG_FILE} | awk -F "=" '{print $2}')
166 ASGVOLT64_VLAN_ID_ETH1=$(awk '/asgvolt64_vlan_id_eth1/{print $0}' ${INBAND_CONFIG_FILE} | awk -F "=" '{print $2}')
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530167 if [ -z ${ASFVOLT16_VLAN_ID_ETH2} ] || [ -z ${ASGVOLT64_VLAN_ID_ETH1} ]; then
168 error_message "ERROR: vlan ids not valid"
169 exit 1
170 fi
171 else
Girish Gowdra6e745522020-07-15 15:52:13 -0700172 error_message "ERROR: ${INBAND_CONFIG_FILE} not found, using default value 4093"
173 fi
174}
175
176#------------------------------------------------------------------------------
177# Function Name: is_out_band_connection_enabled
178# Description:
179# This function checks if out-of-band connection is enabled by reading
180# the enable_out_of_band_connection value in file /broadcom/inband.config
181#
182# Globals:
183#
184# Arguments:
185# None
186#
187# Returns:
188# true if out-of-band connection enabled, else false
189#------------------------------------------------------------------------------
190is_out_band_connection_enabled() {
191 # Read inband.config file to fetch configurtion to enable or not the out-of-band connection to the OLT.
192 if [ -f ${INBAND_CONFIG_FILE} ]; then
193 ob_cfg=$(awk '/enable_out_of_band_connection/{print $0}' ${INBAND_CONFIG_FILE} | awk -F "=" '{print $2}')
194 if [ -z ${ob_cfg} ]; then
195 error_message "ERROR: missing configuration to enable out-of-band connection to OLT. Default to false"
196 return false
197 fi
198 else
199 if [ "${ob_cfg}" = "yes" ]; then
200 return true
201 elif [ "${ob_cfg}" = "no" ]; then
202 return false
203 else
204 error_message "ERROR: Invalid configuration to enable out-of-band connection -> ${ob_cfg}"
205 return false
206 fi
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530207 fi
208}
209
210#------------------------------------------------------------------------------
211# Function Name: setup_nw_configuration
212# Description:
Girish Gowdra6e745522020-07-15 15:52:13 -0700213# This function read the "/broadcom/inband.config" file to get VLAND IDs
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530214# for the interface eth1 and eth2 based on the OLT model and update
215# these VLAN ID to /etc/network/interfaces file for dhcp request.
216# Globals:
Girish Gowdra6e745522020-07-15 15:52:13 -0700217# INBAND_CONFIG_FILE, ASFVOLT16_VLAN_ID_ETH2, ASGVOLT64_VLAN_ID_ETH1
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530218#
219# Arguments:
220# None
221#
222# Returns:
223# None
224#------------------------------------------------------------------------------
225setup_nw_configuration() {
226 # Dynamic vlan entry in /etc/network/interfaces file
Girish Gowdra6e745522020-07-15 15:52:13 -0700227
228 if [ is_out_band_connection_enabled ]; then
229 # This interface is used for out-of-band connection for the OLT
230 # This is not a mandatory requirement for in-band management of the OLT
231 set_dhcp_ip_configuration ma1
232 fi
233
234 # These interfaces are used for in-band management of the OLT
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530235 if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then
236 set_dhcp_ip_configuration eth2 ${ASFVOLT16_VLAN_ID_ETH2}
237 else
238 set_dhcp_ip_configuration eth1 ${ASGVOLT64_VLAN_ID_ETH1}
239 fi
240 # Restart the networking services
241 /etc/init.d/networking restart
242}
243
244#------------------------------------------------------------------------------
245# Function Name: set_dhcp_ip_configuration
246# Description:
247# This function facilitates setup_nw_configuration function and accepts interface
248# vlan id as an argumnet to modify network interfaces file
249#
250# Globals:
251# None
252#
253# Arguments:
254# None
255#
256# Returns:
257# None
258#------------------------------------------------------------------------------
259set_dhcp_ip_configuration() {
260 interface=$1
261 vlan_id=$2
262 grep -q "iface ${interface}.${vlan_id}" $NETWORK_INTERFACE
263 if [ $? -ne 0 ]; then
Girish Gowdra6e745522020-07-15 15:52:13 -0700264 if [ -z ${vlan_id} ]; then
265 echo "auto ${interface}" >>${NETWORK_INTERFACE}
266 echo "iface ${interface} inet dhcp" >>${NETWORK_INTERFACE}
267 else
268 echo "auto ${interface}.${vlan_id}" >>${NETWORK_INTERFACE}
269 echo "iface ${interface}.${vlan_id} inet dhcp" >>${NETWORK_INTERFACE}
270 fi
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530271 fi
272}
273
274#------------------------------------------------------------------------------
Girish Gowdra6e745522020-07-15 15:52:13 -0700275# Function Name: disable_autostart_of_openolt_and_dev_mgmt_daemon_processes
276# Description:
277# Disables autostart of openolt processes (openolt and dev_mgmt_daemon).
278# The start of these openolt processes is now controlled through this script
279#
280# Globals:
281#
282# Arguments:
283# None
284#
285# Returns:
286# None
287#------------------------------------------------------------------------------
288disable_autostart_of_openolt_and_dev_mgmt_daemon_processes() {
289 update-rc.d dev_mgmt_daemon disable
290 update-rc.d openolt disable
291}
292
293#------------------------------------------------------------------------------
294# Function Name: stop_openolt_and_dev_mgmt_daemon_processes
295# Description:
296# Stop openolt processes (openolt and dev_mgmt_daemon) if they were running
297# before
298#
299# Globals:
300#
301# Arguments:
302# None
303#
304# Returns:
305# None
306#------------------------------------------------------------------------------
307stop_openolt_and_dev_mgmt_daemon_processes() {
308 service dev_mgmt_daemon stop
309 service openolt stop
310}
311
312#------------------------------------------------------------------------------
313# Function Name: start_openolt_dev_mgmt_daemon_process_watchdog
314# Description:
315# Start openolt and dev_mgmt_daemon process watchdog
316#
317# Globals:
318#
319# Arguments:
320# None
321#
322# Returns:
323# None
324#------------------------------------------------------------------------------
325start_openolt_dev_mgmt_daemon_process_watchdog() {
326 nohup bash /opt/openolt/openolt_dev_mgmt_daemon_process_watchdog &
327}
328
329#------------------------------------------------------------------------------
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530330# Function Name: start_dev_mgmt_service
331# Description:
332# This function starts svk_init.sh script and device management service.
333# Device management service initializes all maple, qumran chip sets and
334# brings up access terminal.
335#
336# Globals:
337# SVK_INIT_FILE, BRCM_DIR, DEV_MGMT_DAEMON
338#
339# Arguments:
340# None
341#
342# Returns:
343# None
344#------------------------------------------------------------------------------
345start_dev_mgmt_service() {
346 info_message "Starting device management service"
347 chmod +x ${SVK_INIT_FILE}
348 ${SVK_INIT_FILE}
349
350 # starts the device_management deamon and openolt services
351 service dev_mgmt_daemon start
352 service dev_mgmt_daemon status
353 if [ $? -eq 0 ]; then
354 info_message "${DEV_MGMT_DAEMON} service is running"
355 setup_inband_mgmt_channel
356 else
357 error_message "${DEV_MGMT_DAEMON} is not running"
358 exit 1
359 fi
360}
361
362#------------------------------------------------------------------------------
363# Function Name: setup_inband_mgmt_channel
364# Description:
365# This function sets up inband management channel.
366#
367# Globals:
368# BRCM_DIR, ASFVOLT16_VLAN_ID_ETH2, ASGVOLT64_VLAN_ID_ETH1
369#
370# Arguments:
371# None
372#
373# Returns:
374# None
375#------------------------------------------------------------------------------
376setup_inband_mgmt_channel() {
377 local interface_type="inband"
378
379 # Extracting vlan ids from file
380 get_vlan_ids
381
382 cd ${BRCM_DIR}
383 if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then
384 # Waiting till interface eth2 get initialized & RUNNING state
385 check_interface_is_up eth2 $interface_type
386
387 # wait for BAL to get ready
Thiyagarajan Subramanief0aadb2020-06-24 16:47:49 +0530388 sleep $WAIT_TIME_BAL_READY
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530389
390 # enabling in-band communication through broadcom API on NIC interface id 14 for eth2 interface
391 echo "/Api/Set object=inband_mgmt_channel id=0 nni_intf={intf_type=nni intf_id=0} nic_intf_id=14 \
392 vlan_id=${ASFVOLT16_VLAN_ID_ETH2} action=none" | ./example_user_appl
393 if [ $? -ne 0 ]; then
394 error_message "Failed to enable in-band channel on NIC interface id 14 with vlan ${ASFVOLT16_VLAN_ID_ETH2}"
395 fi
396 else
397 # Waiting till interface eth1 get initialized & RUNNING state
398 check_interface_is_up eth1 $interface_type
399 # wait for BAL to get ready
Thiyagarajan Subramanief0aadb2020-06-24 16:47:49 +0530400 sleep $WAIT_TIME_BAL_READY
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530401 # enabling in-band communication through broadcom API on NIC interface id 14 for eth1 interface
402 echo "/Api/Set object=inband_mgmt_channel id=0 nni_intf={intf_type=nni intf_id=0} nic_intf_id=14 \
403 vlan_id=${ASGVOLT64_VLAN_ID_ETH1} action=none" | ./example_user_appl
404 if [ $? -ne 0 ]; then
405 error_message "Failed to enable in-band channel on NIC interface id 14 with vlan ${ASGVOLT64_VLAN_ID_ETH1}"
406 fi
407 fi
408}
409
410#------------------------------------------------------------------------------
411# Function Name: create_vlan_tagged_Iface
412# Description:
413# This function create the VLAN interfaces and brings them UP.
414#
415# Globals:
416# ASFVOLT16_VLAN_ID_ETH2, ASGVOLT64_VLAN_ID_ETH1
417#
418# Arguments:
419# None
420#
421# Returns:
422# None
423#------------------------------------------------------------------------------
424create_vlan_tagged_Iface() {
425 if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then
426 # Adding vlan to the interface eth2
427 ip link add link eth2 name eth2.${ASFVOLT16_VLAN_ID_ETH2} type vlan id ${ASFVOLT16_VLAN_ID_ETH2}
428 ifconfig eth2.${ASFVOLT16_VLAN_ID_ETH2} up
429 else
430 # Adding vlan to the interface eth1
431 ip link add link eth1 name eth1.${ASGVOLT64_VLAN_ID_ETH1} type vlan id ${ASGVOLT64_VLAN_ID_ETH1}
432 ifconfig eth1.${ASGVOLT64_VLAN_ID_ETH1} up
433 fi
434 info_message "Inband tagged interfaces created succesfully"
435}
436
437#------------------------------------------------------------------------------
438# Function Name: setup_dhcpd_configuration
439# Description:
440# This function updates /etc/dhcp/dhclient.conf file for dhcp
441# request for eth2.ASFVOLT16_VLAN_ID_ETH2, eth3.ASFVOLT16_VLAN_ID_ETH3,
442# eth1.ASGVOLT64_VLAN_ID_ETH1 and eth2.ASGVOLT64_VLAN_ID_ETH2 interfaces
443#
444# Globals:
445# ASFVOLT16_VLAN_ID_ETH2, ASFVOLT16_VLAN_ID_ETH3, ASGVOLT64_VLAN_ID_ETH1,
446# ASGVOLT64_VLAN_ID_ETH2, DHCLIENT_CONF
447#
448# Arguments:
449# None
450#
451# Returns:
452# None
453#------------------------------------------------------------------------------
454setup_dhcpd_configuration() {
455 if [ -f ${DHCLIENT_CONF} ]; then
456 if [ -f ${SERIAL_NUMBER} ]; then
457 serial_num=$(cat ${SERIAL_NUMBER})
458 if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then
459 # dhcient.conf file should have only one entry for eth2.<ASFVOLT16_VLAN_ID_ETH2> interface
460 set_dhclient_configuration eth2 ${ASFVOLT16_VLAN_ID_ETH2}
461 else
462 # dhcient.conf file should have only one entry for eth1.<ASGVOLT64_VLAN_ID_ETH1> interface
463 set_dhclient_configuration eth1 ${ASGVOLT64_VLAN_ID_ETH1}
464 fi
465 else
466 error_message "ERROR: serial number of olt not found"
467 fi
468 else
469 error_message "ERROR: DHCP config file not found"
470 fi
471}
472
473#------------------------------------------------------------------------------
474# Function Name: set_dhclient_configuration
475# Description:
476# This function updates dhclient conf file with in-band interfaces.
477#
478# Globals:
479# None
480#
481# Arguments:
482# None
483#
484# Returns:
485# None
486#------------------------------------------------------------------------------
487set_dhclient_configuration() {
488 interface=$1
489 vlan_id=$2
490 grep -q "interface \"${interface}.${vlan_id}\"" $DHCLIENT_CONF
491 if [ $? -ne 0 ]; then
492 echo "interface \"${interface}.${vlan_id}\" {" >>$DHCLIENT_CONF
493 echo " send dhcp-client-identifier \"${serial_num}.${vlan_id}\";" >>$DHCLIENT_CONF
Humera Kouser4a663fe2020-09-23 04:33:54 -0400494 echo " send vendor-class-identifier \"${EDGECORE}\";" >>$DHCLIENT_CONF
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530495 echo "}" >>$DHCLIENT_CONF
496 fi
497}
498
499#------------------------------------------------------------------------------
500# Function Name: check_interface_is_up
501# Description:
502# This function checks if provided inband interface is up and running
503#
504# Globals:
505# None
506#
507# Arguments:
508# None
509#
510# Returns:
511# None
512#------------------------------------------------------------------------------
513check_interface_is_up()
514{
515 interface=$1
516 interface_type=$2
517 count=0
518
519 while true; do
520 if [ $interface_type = "inband" ]; then
521 ifconfig ${interface} | grep 'RUNNING' &>/dev/null
522 if [ $? -eq 0 ]; then
523 info_message "${interface} is up and running"
524 break
525 fi
526 elif [ $interface_type = "inband-tagged" ]; then
527 while true; do
528 ifconfig ${interface} | grep 'RUNNING' &>/dev/null
529 if [ $? -eq 0 ]; then
530 ip=$(ifconfig $interface | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1)
531 if [ ! -z "$ip" ]; then
532 info_message "${interface} is up and running with valid IP address"
533 return 0
534 else
535 info_message "Inband interface ${interface} is not up, continuously retrying for DHCP IP assignment"
536 info_message "Inband interface ${interface} is not up with valid IP hence not starting openolt service"
Girish Gowdra70feafd2020-08-06 20:08:26 -0700537 sleep 5
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530538 continue
539 fi
540 fi
541 done
542 fi
543 done
544}
545
546#------------------------------------------------------------------------------
547# Function Name: stop_olt_services
548# Description:
549# This function informs about inband interface error status and stops device management service.
550#
551# Globals:
552# None
553#
554# Arguments:
555# None
556#
557# Returns:
558# None
559#------------------------------------------------------------------------------
560stop_olt_services()
561{
562 error_message "Inband tagged interface $1 is not up with valid IP address"
563 info_message "Not starting openolt service and stopping device menagement service"
564 service dev_mgmt_daemon stop
565 exit 1
566}
567
568#------------------------------------------------------------------------------
569# Function Name: start_openolt_service
570# Description:
571# This function checks whether inband interfaces are up with IP address, then
572# appends inband interface name to a file which later will be used by openolt
573# service as command line option then starts openolt service.
574# Openolt service enables all PON and NNI interfaces and creates respective PON
575# and NNI schedulers and Queues.
576#
577# Globals:
578# None
579#
580# Arguments:
581# None
582#
583# Returns:
584# None
585#------------------------------------------------------------------------------
586start_openolt_service()
587{
588 info_message "Starting openolt service"
589 local interface_type="inband-tagged"
590
591 if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then
592 check_interface_is_up eth2.${ASFVOLT16_VLAN_ID_ETH2} $interface_type
593 if [ $? -ne 0 ]; then stop_olt_services eth2.${ASFVOLT16_VLAN_ID_ETH2}; fi
594 openolt_grpc_interface=eth2.${ASFVOLT16_VLAN_ID_ETH2}
595 else
596 check_interface_is_up eth1.${ASGVOLT64_VLAN_ID_ETH1} $interface_type
597 if [ $? -ne 0 ]; then stop_olt_services eth1.${ASGVOLT64_VLAN_ID_ETH1}; fi
598 openolt_grpc_interface=eth1.${ASGVOLT64_VLAN_ID_ETH1}
599 fi
600
601 # Inband interface name appended to this file. Interface name will be
602 # used as command line argument by openolt service while running the binary.
603 if [ -f "$OPENOLT_ARG_INPUT_FILE" ]; then
604 info_message "$OPENOLT_ARG_INPUT_FILE exist"
605 echo "gRPC_interface=$openolt_grpc_interface" > $OPENOLT_ARG_INPUT_FILE
606 else
607 info_message "$OPENOLT_ARG_INPUT_FILE does not exist, creating it"
608 touch $OPENOLT_ARG_INPUT_FILE
609 echo "gRPC_interface=$openolt_grpc_interface" > $OPENOLT_ARG_INPUT_FILE
610 fi
611
612 service openolt start
613 service openolt status
614 if [ $? -eq 0 ]; then
615 info_message "${OPENOLT} service is running"
616 else
617 error_message "${OPENOLT} is not running"
618 exit 1
619 fi
620}
621
622#------------------------------------------------------------------------------
623# Function Name: start_olt_services
624# Description:
625# This function triggers services to create vlan interfaces, to run BAL services
626# and to trigger DHCP requets on eth2.VLAN_ID_1 and eth3.VLAN_ID_2 interfaces.
627#
628# Globals:
629# None
630#
631# Arguments:
632# None
633#
634# Returns:
635# None
636#------------------------------------------------------------------------------
637start_olt_services() {
Girish Gowdra6e745522020-07-15 15:52:13 -0700638 # First stop any openolt processes if they were running before
639 # and also disable auto start of these processes (since they are in /etc/init.d)
640 stop_openolt_and_dev_mgmt_daemon_processes
641 disable_autostart_of_openolt_and_dev_mgmt_daemon_processes
642
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530643 start_dev_mgmt_service
Girish Gowdra6e745522020-07-15 15:52:13 -0700644 start_openolt_dev_mgmt_daemon_process_watchdog
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530645 create_vlan_tagged_Iface
646 setup_dhcpd_configuration
647 setup_nw_configuration
648 start_openolt_service
649}
650
651#------------------------------------------------------------------------------
652# Function Name: copy_config_files
653# Description:
654# This function copy config files to /broadcom directory
655#
656# Globals:
657# BRCM_DIR
658#
659# Arguments:
660# None
661#
662# Returns:
663# None
664#------------------------------------------------------------------------------
665copy_config_files() {
666 info_message "copying config files to ${BRCM_DIR}"
667 # if [ "${OLT_MODEL}" != ${ASF16_MODEL} ]; then
668 # [ -f /qax.soc ] && cp "/qax.soc" "${BRCM_DIR}/"
669 # fi
670 # [ -f /config.bcm ] && cp "/config.bcm" "${BRCM_DIR}/"
Girish Gowdra6e745522020-07-15 15:52:13 -0700671 [ -f /inband.config ] && cp "/inband.config" "${BRCM_DIR}/"
Thiyagarajan Subramanie84935d2020-04-23 17:45:44 +0530672}
673
674# Execution starts from here
675does_logger_exist
676if [ $? -eq 0 ]; then
677 if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then
678 # check if debian package is already installed.
679 dpkg -l | grep ${ASFVOLT16}
680 if [ $? -ne 0 ]; then
681 # installs openolt debian package for asfvolt16 model
682 dpkg -i ${BAL_OPENOLT_DEB_16}
683 fi
684 else
685 dpkg -l | grep ${ASGVOLT64}
686 if [ $? -ne 0 ]; then
687 # installs openolt debian package for asgvolt64 model
688 dpkg -i ${BAL_OPENOLT_DEB_64}
689 fi
690 fi
691 copy_config_files
692 start_olt_services
693else
694 error_message "logger does not exist"
695 exit 1
696fi