Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 1 | #!/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 |
| 47 | BRCM_OPT_DIR='/opt/bcm68620' |
| 48 | BRCM_DIR='/broadcom' |
| 49 | |
| 50 | # olt service files |
| 51 | SVK_INIT_FILE="${BRCM_OPT_DIR}/svk_init.sh" |
| 52 | |
| 53 | # vlan config file |
| 54 | VLAN_CONFIG_FILE="${BRCM_DIR}/vlan.config" |
| 55 | DHCLIENT_CONF="/etc/dhcp/dhclient.conf" |
| 56 | |
| 57 | # olt serial number |
| 58 | SERIAL_NUMBER="/sys/devices/virtual/dmi/id/product_serial" |
| 59 | |
| 60 | OLT_MODEL=$(cat /sys/devices/virtual/dmi/id/board_name) |
| 61 | NETWORK_INTERFACE="/etc/network/interfaces" |
| 62 | BAL_OPENOLT_DEB_16="/openolt_asfvolt16.deb" |
| 63 | BAL_OPENOLT_DEB_64="/openolt_asgvolt64.deb" |
| 64 | |
| 65 | DEV_MGMT_DAEMON="dev_mgmt_daemon -d -pcie" |
| 66 | OPENOLT="openolt" |
| 67 | ASFVOLT16="asfvolt16" |
| 68 | ASGVOLT64="asgvolt64" |
| 69 | ASF16_MODEL="ASXvOLT16" |
| 70 | |
| 71 | # vlan id for asfvolt16 |
| 72 | ASFVOLT16_VLAN_ID_ETH2= |
| 73 | |
| 74 | # vlan id for asgvolt64 |
| 75 | ASGVOLT64_VLAN_ID_ETH1= |
| 76 | |
| 77 | # File used to set/get argument to openolt service |
| 78 | OPENOLT_ARG_INPUT_FILE=/etc/default/openolt |
| 79 | |
| 80 | # Wait time for BAL to get ready |
Thiyagarajan Subramani | ef0aadb | 2020-06-24 16:47:49 +0530 | [diff] [blame^] | 81 | WAIT_TIME_BAL_READY=120 |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 82 | |
| 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 | #------------------------------------------------------------------------------ |
| 97 | does_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 | #------------------------------------------------------------------------------ |
| 120 | info_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 | #------------------------------------------------------------------------------ |
| 139 | error_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: |
| 148 | # This function facilitates to fetch vlan id from vlan configuration file |
| 149 | # located at /broadcom/vlan.config |
| 150 | # |
| 151 | # Globals: |
| 152 | # VLAN_CONFIG_FILE, ASFVOLT16_VLAN_ID_ETH2, ASFVOLT16_VLAN_ID_ETH3, |
| 153 | # ASGVOLT64_VLAN_ID_ETH1, ASGVOLT64_VLAN_ID_ETH2 |
| 154 | # |
| 155 | # Arguments: |
| 156 | # None |
| 157 | # |
| 158 | # Returns: |
| 159 | # None |
| 160 | #------------------------------------------------------------------------------ |
| 161 | get_vlan_ids() { |
| 162 | # Read vlan.config file to fetch vlan id information |
| 163 | if [ -f ${VLAN_CONFIG_FILE} ]; then |
| 164 | ASFVOLT16_VLAN_ID_ETH2=$(awk '/asfvolt16_vlan_id_eth2/{print $0}' ${VLAN_CONFIG_FILE} | awk -F "=" '{print $2}') |
| 165 | ASGVOLT64_VLAN_ID_ETH1=$(awk '/asgvolt64_vlan_id_eth1/{print $0}' ${VLAN_CONFIG_FILE} | awk -F "=" '{print $2}') |
| 166 | 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 |
| 171 | error_message "ERROR: ${VLAN_CONFIG_FILE} not found, using default value 4093" |
| 172 | fi |
| 173 | } |
| 174 | |
| 175 | #------------------------------------------------------------------------------ |
| 176 | # Function Name: setup_nw_configuration |
| 177 | # Description: |
| 178 | # This function read the "/broadcom/vlan.config" file to get VLAND IDs |
| 179 | # for the interface eth1 and eth2 based on the OLT model and update |
| 180 | # these VLAN ID to /etc/network/interfaces file for dhcp request. |
| 181 | # Globals: |
| 182 | # VLAN_CONFIG_FILE, ASFVOLT16_VLAN_ID_ETH2, ASGVOLT64_VLAN_ID_ETH1 |
| 183 | # |
| 184 | # Arguments: |
| 185 | # None |
| 186 | # |
| 187 | # Returns: |
| 188 | # None |
| 189 | #------------------------------------------------------------------------------ |
| 190 | setup_nw_configuration() { |
| 191 | # Dynamic vlan entry in /etc/network/interfaces file |
| 192 | # Should have only one entry in the file in case of multiple reboot |
| 193 | if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then |
| 194 | set_dhcp_ip_configuration eth2 ${ASFVOLT16_VLAN_ID_ETH2} |
| 195 | else |
| 196 | set_dhcp_ip_configuration eth1 ${ASGVOLT64_VLAN_ID_ETH1} |
| 197 | fi |
| 198 | # Restart the networking services |
| 199 | /etc/init.d/networking restart |
| 200 | } |
| 201 | |
| 202 | #------------------------------------------------------------------------------ |
| 203 | # Function Name: set_dhcp_ip_configuration |
| 204 | # Description: |
| 205 | # This function facilitates setup_nw_configuration function and accepts interface |
| 206 | # vlan id as an argumnet to modify network interfaces file |
| 207 | # |
| 208 | # Globals: |
| 209 | # None |
| 210 | # |
| 211 | # Arguments: |
| 212 | # None |
| 213 | # |
| 214 | # Returns: |
| 215 | # None |
| 216 | #------------------------------------------------------------------------------ |
| 217 | set_dhcp_ip_configuration() { |
| 218 | interface=$1 |
| 219 | vlan_id=$2 |
| 220 | grep -q "iface ${interface}.${vlan_id}" $NETWORK_INTERFACE |
| 221 | if [ $? -ne 0 ]; then |
| 222 | echo "auto ${interface}.${vlan_id}" >>${NETWORK_INTERFACE} |
| 223 | echo "iface ${interface}.${vlan_id} inet dhcp" >>${NETWORK_INTERFACE} |
| 224 | fi |
| 225 | } |
| 226 | |
| 227 | #------------------------------------------------------------------------------ |
| 228 | # Function Name: start_dev_mgmt_service |
| 229 | # Description: |
| 230 | # This function starts svk_init.sh script and device management service. |
| 231 | # Device management service initializes all maple, qumran chip sets and |
| 232 | # brings up access terminal. |
| 233 | # |
| 234 | # Globals: |
| 235 | # SVK_INIT_FILE, BRCM_DIR, DEV_MGMT_DAEMON |
| 236 | # |
| 237 | # Arguments: |
| 238 | # None |
| 239 | # |
| 240 | # Returns: |
| 241 | # None |
| 242 | #------------------------------------------------------------------------------ |
| 243 | start_dev_mgmt_service() { |
| 244 | info_message "Starting device management service" |
| 245 | chmod +x ${SVK_INIT_FILE} |
| 246 | ${SVK_INIT_FILE} |
| 247 | |
| 248 | # starts the device_management deamon and openolt services |
| 249 | service dev_mgmt_daemon start |
| 250 | service dev_mgmt_daemon status |
| 251 | if [ $? -eq 0 ]; then |
| 252 | info_message "${DEV_MGMT_DAEMON} service is running" |
| 253 | setup_inband_mgmt_channel |
| 254 | else |
| 255 | error_message "${DEV_MGMT_DAEMON} is not running" |
| 256 | exit 1 |
| 257 | fi |
| 258 | } |
| 259 | |
| 260 | #------------------------------------------------------------------------------ |
| 261 | # Function Name: setup_inband_mgmt_channel |
| 262 | # Description: |
| 263 | # This function sets up inband management channel. |
| 264 | # |
| 265 | # Globals: |
| 266 | # BRCM_DIR, ASFVOLT16_VLAN_ID_ETH2, ASGVOLT64_VLAN_ID_ETH1 |
| 267 | # |
| 268 | # Arguments: |
| 269 | # None |
| 270 | # |
| 271 | # Returns: |
| 272 | # None |
| 273 | #------------------------------------------------------------------------------ |
| 274 | setup_inband_mgmt_channel() { |
| 275 | local interface_type="inband" |
| 276 | |
| 277 | # Extracting vlan ids from file |
| 278 | get_vlan_ids |
| 279 | |
| 280 | cd ${BRCM_DIR} |
| 281 | if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then |
| 282 | # Waiting till interface eth2 get initialized & RUNNING state |
| 283 | check_interface_is_up eth2 $interface_type |
| 284 | |
| 285 | # wait for BAL to get ready |
Thiyagarajan Subramani | ef0aadb | 2020-06-24 16:47:49 +0530 | [diff] [blame^] | 286 | sleep $WAIT_TIME_BAL_READY |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 287 | |
| 288 | # enabling in-band communication through broadcom API on NIC interface id 14 for eth2 interface |
| 289 | echo "/Api/Set object=inband_mgmt_channel id=0 nni_intf={intf_type=nni intf_id=0} nic_intf_id=14 \ |
| 290 | vlan_id=${ASFVOLT16_VLAN_ID_ETH2} action=none" | ./example_user_appl |
| 291 | if [ $? -ne 0 ]; then |
| 292 | error_message "Failed to enable in-band channel on NIC interface id 14 with vlan ${ASFVOLT16_VLAN_ID_ETH2}" |
| 293 | fi |
| 294 | else |
| 295 | # Waiting till interface eth1 get initialized & RUNNING state |
| 296 | check_interface_is_up eth1 $interface_type |
| 297 | # wait for BAL to get ready |
Thiyagarajan Subramani | ef0aadb | 2020-06-24 16:47:49 +0530 | [diff] [blame^] | 298 | sleep $WAIT_TIME_BAL_READY |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 299 | # enabling in-band communication through broadcom API on NIC interface id 14 for eth1 interface |
| 300 | echo "/Api/Set object=inband_mgmt_channel id=0 nni_intf={intf_type=nni intf_id=0} nic_intf_id=14 \ |
| 301 | vlan_id=${ASGVOLT64_VLAN_ID_ETH1} action=none" | ./example_user_appl |
| 302 | if [ $? -ne 0 ]; then |
| 303 | error_message "Failed to enable in-band channel on NIC interface id 14 with vlan ${ASGVOLT64_VLAN_ID_ETH1}" |
| 304 | fi |
| 305 | fi |
| 306 | } |
| 307 | |
| 308 | #------------------------------------------------------------------------------ |
| 309 | # Function Name: create_vlan_tagged_Iface |
| 310 | # Description: |
| 311 | # This function create the VLAN interfaces and brings them UP. |
| 312 | # |
| 313 | # Globals: |
| 314 | # ASFVOLT16_VLAN_ID_ETH2, ASGVOLT64_VLAN_ID_ETH1 |
| 315 | # |
| 316 | # Arguments: |
| 317 | # None |
| 318 | # |
| 319 | # Returns: |
| 320 | # None |
| 321 | #------------------------------------------------------------------------------ |
| 322 | create_vlan_tagged_Iface() { |
| 323 | if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then |
| 324 | # Adding vlan to the interface eth2 |
| 325 | ip link add link eth2 name eth2.${ASFVOLT16_VLAN_ID_ETH2} type vlan id ${ASFVOLT16_VLAN_ID_ETH2} |
| 326 | ifconfig eth2.${ASFVOLT16_VLAN_ID_ETH2} up |
| 327 | else |
| 328 | # Adding vlan to the interface eth1 |
| 329 | ip link add link eth1 name eth1.${ASGVOLT64_VLAN_ID_ETH1} type vlan id ${ASGVOLT64_VLAN_ID_ETH1} |
| 330 | ifconfig eth1.${ASGVOLT64_VLAN_ID_ETH1} up |
| 331 | fi |
| 332 | info_message "Inband tagged interfaces created succesfully" |
| 333 | } |
| 334 | |
| 335 | #------------------------------------------------------------------------------ |
| 336 | # Function Name: setup_dhcpd_configuration |
| 337 | # Description: |
| 338 | # This function updates /etc/dhcp/dhclient.conf file for dhcp |
| 339 | # request for eth2.ASFVOLT16_VLAN_ID_ETH2, eth3.ASFVOLT16_VLAN_ID_ETH3, |
| 340 | # eth1.ASGVOLT64_VLAN_ID_ETH1 and eth2.ASGVOLT64_VLAN_ID_ETH2 interfaces |
| 341 | # |
| 342 | # Globals: |
| 343 | # ASFVOLT16_VLAN_ID_ETH2, ASFVOLT16_VLAN_ID_ETH3, ASGVOLT64_VLAN_ID_ETH1, |
| 344 | # ASGVOLT64_VLAN_ID_ETH2, DHCLIENT_CONF |
| 345 | # |
| 346 | # Arguments: |
| 347 | # None |
| 348 | # |
| 349 | # Returns: |
| 350 | # None |
| 351 | #------------------------------------------------------------------------------ |
| 352 | setup_dhcpd_configuration() { |
| 353 | if [ -f ${DHCLIENT_CONF} ]; then |
| 354 | if [ -f ${SERIAL_NUMBER} ]; then |
| 355 | serial_num=$(cat ${SERIAL_NUMBER}) |
| 356 | if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then |
| 357 | # dhcient.conf file should have only one entry for eth2.<ASFVOLT16_VLAN_ID_ETH2> interface |
| 358 | set_dhclient_configuration eth2 ${ASFVOLT16_VLAN_ID_ETH2} |
| 359 | else |
| 360 | # dhcient.conf file should have only one entry for eth1.<ASGVOLT64_VLAN_ID_ETH1> interface |
| 361 | set_dhclient_configuration eth1 ${ASGVOLT64_VLAN_ID_ETH1} |
| 362 | fi |
| 363 | else |
| 364 | error_message "ERROR: serial number of olt not found" |
| 365 | fi |
| 366 | else |
| 367 | error_message "ERROR: DHCP config file not found" |
| 368 | fi |
| 369 | } |
| 370 | |
| 371 | #------------------------------------------------------------------------------ |
| 372 | # Function Name: set_dhclient_configuration |
| 373 | # Description: |
| 374 | # This function updates dhclient conf file with in-band interfaces. |
| 375 | # |
| 376 | # Globals: |
| 377 | # None |
| 378 | # |
| 379 | # Arguments: |
| 380 | # None |
| 381 | # |
| 382 | # Returns: |
| 383 | # None |
| 384 | #------------------------------------------------------------------------------ |
| 385 | set_dhclient_configuration() { |
| 386 | interface=$1 |
| 387 | vlan_id=$2 |
| 388 | grep -q "interface \"${interface}.${vlan_id}\"" $DHCLIENT_CONF |
| 389 | if [ $? -ne 0 ]; then |
| 390 | echo "interface \"${interface}.${vlan_id}\" {" >>$DHCLIENT_CONF |
| 391 | echo " send dhcp-client-identifier \"${serial_num}.${vlan_id}\";" >>$DHCLIENT_CONF |
| 392 | echo "}" >>$DHCLIENT_CONF |
| 393 | fi |
| 394 | } |
| 395 | |
| 396 | #------------------------------------------------------------------------------ |
| 397 | # Function Name: check_interface_is_up |
| 398 | # Description: |
| 399 | # This function checks if provided inband interface is up and running |
| 400 | # |
| 401 | # Globals: |
| 402 | # None |
| 403 | # |
| 404 | # Arguments: |
| 405 | # None |
| 406 | # |
| 407 | # Returns: |
| 408 | # None |
| 409 | #------------------------------------------------------------------------------ |
| 410 | check_interface_is_up() |
| 411 | { |
| 412 | interface=$1 |
| 413 | interface_type=$2 |
| 414 | count=0 |
| 415 | |
| 416 | while true; do |
| 417 | if [ $interface_type = "inband" ]; then |
| 418 | ifconfig ${interface} | grep 'RUNNING' &>/dev/null |
| 419 | if [ $? -eq 0 ]; then |
| 420 | info_message "${interface} is up and running" |
| 421 | break |
| 422 | fi |
| 423 | elif [ $interface_type = "inband-tagged" ]; then |
| 424 | while true; do |
| 425 | ifconfig ${interface} | grep 'RUNNING' &>/dev/null |
| 426 | if [ $? -eq 0 ]; then |
| 427 | ip=$(ifconfig $interface | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1) |
| 428 | if [ ! -z "$ip" ]; then |
| 429 | info_message "${interface} is up and running with valid IP address" |
| 430 | return 0 |
| 431 | else |
| 432 | info_message "Inband interface ${interface} is not up, continuously retrying for DHCP IP assignment" |
| 433 | info_message "Inband interface ${interface} is not up with valid IP hence not starting openolt service" |
| 434 | sleep 10 |
| 435 | continue |
| 436 | fi |
| 437 | fi |
| 438 | done |
| 439 | fi |
| 440 | done |
| 441 | } |
| 442 | |
| 443 | #------------------------------------------------------------------------------ |
| 444 | # Function Name: stop_olt_services |
| 445 | # Description: |
| 446 | # This function informs about inband interface error status and stops device management service. |
| 447 | # |
| 448 | # Globals: |
| 449 | # None |
| 450 | # |
| 451 | # Arguments: |
| 452 | # None |
| 453 | # |
| 454 | # Returns: |
| 455 | # None |
| 456 | #------------------------------------------------------------------------------ |
| 457 | stop_olt_services() |
| 458 | { |
| 459 | error_message "Inband tagged interface $1 is not up with valid IP address" |
| 460 | info_message "Not starting openolt service and stopping device menagement service" |
| 461 | service dev_mgmt_daemon stop |
| 462 | exit 1 |
| 463 | } |
| 464 | |
| 465 | #------------------------------------------------------------------------------ |
| 466 | # Function Name: start_openolt_service |
| 467 | # Description: |
| 468 | # This function checks whether inband interfaces are up with IP address, then |
| 469 | # appends inband interface name to a file which later will be used by openolt |
| 470 | # service as command line option then starts openolt service. |
| 471 | # Openolt service enables all PON and NNI interfaces and creates respective PON |
| 472 | # and NNI schedulers and Queues. |
| 473 | # |
| 474 | # Globals: |
| 475 | # None |
| 476 | # |
| 477 | # Arguments: |
| 478 | # None |
| 479 | # |
| 480 | # Returns: |
| 481 | # None |
| 482 | #------------------------------------------------------------------------------ |
| 483 | start_openolt_service() |
| 484 | { |
| 485 | info_message "Starting openolt service" |
| 486 | local interface_type="inband-tagged" |
| 487 | |
| 488 | if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then |
| 489 | check_interface_is_up eth2.${ASFVOLT16_VLAN_ID_ETH2} $interface_type |
| 490 | if [ $? -ne 0 ]; then stop_olt_services eth2.${ASFVOLT16_VLAN_ID_ETH2}; fi |
| 491 | openolt_grpc_interface=eth2.${ASFVOLT16_VLAN_ID_ETH2} |
| 492 | else |
| 493 | check_interface_is_up eth1.${ASGVOLT64_VLAN_ID_ETH1} $interface_type |
| 494 | if [ $? -ne 0 ]; then stop_olt_services eth1.${ASGVOLT64_VLAN_ID_ETH1}; fi |
| 495 | openolt_grpc_interface=eth1.${ASGVOLT64_VLAN_ID_ETH1} |
| 496 | fi |
| 497 | |
| 498 | # Inband interface name appended to this file. Interface name will be |
| 499 | # used as command line argument by openolt service while running the binary. |
| 500 | if [ -f "$OPENOLT_ARG_INPUT_FILE" ]; then |
| 501 | info_message "$OPENOLT_ARG_INPUT_FILE exist" |
| 502 | echo "gRPC_interface=$openolt_grpc_interface" > $OPENOLT_ARG_INPUT_FILE |
| 503 | else |
| 504 | info_message "$OPENOLT_ARG_INPUT_FILE does not exist, creating it" |
| 505 | touch $OPENOLT_ARG_INPUT_FILE |
| 506 | echo "gRPC_interface=$openolt_grpc_interface" > $OPENOLT_ARG_INPUT_FILE |
| 507 | fi |
| 508 | |
| 509 | service openolt start |
| 510 | service openolt status |
| 511 | if [ $? -eq 0 ]; then |
| 512 | info_message "${OPENOLT} service is running" |
| 513 | else |
| 514 | error_message "${OPENOLT} is not running" |
| 515 | exit 1 |
| 516 | fi |
| 517 | } |
| 518 | |
| 519 | #------------------------------------------------------------------------------ |
| 520 | # Function Name: start_olt_services |
| 521 | # Description: |
| 522 | # This function triggers services to create vlan interfaces, to run BAL services |
| 523 | # and to trigger DHCP requets on eth2.VLAN_ID_1 and eth3.VLAN_ID_2 interfaces. |
| 524 | # |
| 525 | # Globals: |
| 526 | # None |
| 527 | # |
| 528 | # Arguments: |
| 529 | # None |
| 530 | # |
| 531 | # Returns: |
| 532 | # None |
| 533 | #------------------------------------------------------------------------------ |
| 534 | start_olt_services() { |
| 535 | start_dev_mgmt_service |
| 536 | create_vlan_tagged_Iface |
| 537 | setup_dhcpd_configuration |
| 538 | setup_nw_configuration |
| 539 | start_openolt_service |
| 540 | } |
| 541 | |
| 542 | #------------------------------------------------------------------------------ |
| 543 | # Function Name: copy_config_files |
| 544 | # Description: |
| 545 | # This function copy config files to /broadcom directory |
| 546 | # |
| 547 | # Globals: |
| 548 | # BRCM_DIR |
| 549 | # |
| 550 | # Arguments: |
| 551 | # None |
| 552 | # |
| 553 | # Returns: |
| 554 | # None |
| 555 | #------------------------------------------------------------------------------ |
| 556 | copy_config_files() { |
| 557 | info_message "copying config files to ${BRCM_DIR}" |
| 558 | # if [ "${OLT_MODEL}" != ${ASF16_MODEL} ]; then |
| 559 | # [ -f /qax.soc ] && cp "/qax.soc" "${BRCM_DIR}/" |
| 560 | # fi |
| 561 | # [ -f /config.bcm ] && cp "/config.bcm" "${BRCM_DIR}/" |
| 562 | [ -f /vlan.config ] && cp "/vlan.config" "${BRCM_DIR}/" |
| 563 | } |
| 564 | |
| 565 | # Execution starts from here |
| 566 | does_logger_exist |
| 567 | if [ $? -eq 0 ]; then |
| 568 | if [ "${OLT_MODEL}" = ${ASF16_MODEL} ]; then |
| 569 | # check if debian package is already installed. |
| 570 | dpkg -l | grep ${ASFVOLT16} |
| 571 | if [ $? -ne 0 ]; then |
| 572 | # installs openolt debian package for asfvolt16 model |
| 573 | dpkg -i ${BAL_OPENOLT_DEB_16} |
| 574 | fi |
| 575 | else |
| 576 | dpkg -l | grep ${ASGVOLT64} |
| 577 | if [ $? -ne 0 ]; then |
| 578 | # installs openolt debian package for asgvolt64 model |
| 579 | dpkg -i ${BAL_OPENOLT_DEB_64} |
| 580 | fi |
| 581 | fi |
| 582 | copy_config_files |
| 583 | start_olt_services |
| 584 | else |
| 585 | error_message "logger does not exist" |
| 586 | exit 1 |
| 587 | fi |