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