VOL-3444 Handling of ONT Activation Failure and generation of an alarm

Change-Id: Ibdf7add4258b856f10c121351d9c691bba325a24
diff --git a/Makefile b/Makefile
index 0eddf59..7893114 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@
 
 ## Variables
 OPENOLTDEVICE     ?= asfvolt16
-OPENOLT_PROTO_VER ?= v3.4.3
+OPENOLT_PROTO_VER ?= v3.4.5
 GTEST_VER         ?= release-1.8.0
 CMOCK_VER         ?= 0207b30
 GMOCK_GLOBAL_VER  ?= 1.0.2
diff --git a/agent/Makefile.in b/agent/Makefile.in
index 2f86ada..32e4c62 100644
--- a/agent/Makefile.in
+++ b/agent/Makefile.in
@@ -42,7 +42,7 @@
 # This specifies the GIT tag in https://github.com/opencord/voltha-protos
 # repo that we need to refer to, to pick the right version of
 # openolt.proto and tech_profile.proto
-OPENOLT_PROTO_VER ?= v3.4.3
+OPENOLT_PROTO_VER ?= v3.4.5
 
 # Variables used for Inband build
 INBAND = "n"
diff --git a/agent/src/indications.cc b/agent/src/indications.cc
index 759f419..1939e60 100644
--- a/agent/src/indications.cc
+++ b/agent/src/indications.cc
@@ -818,6 +818,25 @@
                         onu_ind->set_oper_state("up");
                     if (ONU_ACTIVATION_COMPLETED_FAIL(data->status))
                         onu_ind->set_oper_state("down");
+                        switch (data->fail_reason) {
+                            case BCMOLT_ACTIVATION_FAIL_REASON_RANGING:
+                                onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_REASON_RANGING);
+                                break;
+                            case BCMOLT_ACTIVATION_FAIL_REASON_PASSWORD_AUTHENTICATION:
+                                onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_REASON_PASSWORD_AUTHENTICATION);
+                                break;
+                            case BCMOLT_ACTIVATION_FAIL_REASON_LOS:
+                                onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_REASON_LOS);
+                                break;
+                            case BCMOLT_ACTIVATION_FAIL_REASON_ONU_ALARM:
+                                onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_ONU_ALARM);
+                                break;
+                            case BCMOLT_ACTIVATION_FAIL_REASON_SWITCH_OVER:
+                                onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_SWITCH_OVER);
+                                break;
+                            default:
+                                onu_ind->set_fail_reason(openolt::OnuIndication_ActivationFailReason_ONU_ACTIVATION_FAIL_REASON_NONE);
+			}
                     // Setting the admin_state state field based on a valid onu_id does not make any sense.
                     // The adapter too does not seem to interpret this seriously.
                     // Legacy code, lets keep this as is for now.
diff --git a/agent/test/Makefile b/agent/test/Makefile
index 9a8683a..87f03a1 100644
--- a/agent/test/Makefile
+++ b/agent/test/Makefile
@@ -21,7 +21,7 @@
 TOP_DIR=`pwd`
 OPENOLTDEVICE ?= asfvolt16
 
-OPENOLT_PROTO_VER ?= v3.4.3
+OPENOLT_PROTO_VER ?= v3.4.5
 
 GTEST_VER ?= release-1.8.0
 gtest-target = /usr/local/lib/libgtest.a
diff --git a/protos/Makefile b/protos/Makefile
index 60200f0..6f7ed0b 100644
--- a/protos/Makefile
+++ b/protos/Makefile
@@ -19,7 +19,7 @@
 # This specifies the GIT tag in https://github.com/opencord/voltha-protos
 # repo that we need to refer to, to pick the right version of
 # openolt.proto and tech_profile.proto
-OPENOLT_PROTO_VER ?= v3.4.3
+OPENOLT_PROTO_VER ?= v3.4.5
 GRPC_VER ?= v1.10.x
 
 CXX ?= g++