VOL-3224: Enhance reading input argument for enabling incremental
          EVTO update feature
          Recently a bug was discovered where bool argument would
          arrive as a string, and argument parser would read the
          value as a string, but rest of the code tries to interpret
          the value as bool leading to issues. This patch fixes it.

Change-Id: I1150bf135ea14588a7a36a6c8acd162dfedecff7
diff --git a/python/adapters/brcm_openomci_onu/main.py b/python/adapters/brcm_openomci_onu/main.py
index f7b2404..eeb2539 100755
--- a/python/adapters/brcm_openomci_onu/main.py
+++ b/python/adapters/brcm_openomci_onu/main.py
@@ -153,6 +153,7 @@
     _help = 'specifies whether the adapter accepts incremental EVTO updates ' \
             '(default: %s)' % defs['accept_incremental_evto_update']
     parser.add_argument('-aie', '--accept_incremental_evto_update',
+                        type=str2bool,
                         dest='accept_incremental_evto_update',
                         action='store',
                         default=defs['accept_incremental_evto_update'],
@@ -247,7 +248,7 @@
                         action='store',
                         default=defs['core_topic'],
                         help=_help)
-    
+
     _help = 'topic of openolt adapter on the kafka bus'
     parser.add_argument('-at', '--adapter_topic',
                         dest='adapter_topic',
@@ -320,6 +321,17 @@
     return results
 
 
+def str2bool(v):
+    if isinstance(v, bool):
+        return v
+    if v.lower() in ('yes', 'true', 't', 'y', '1'):
+        return True
+    elif v.lower() in ('no', 'false', 'f', 'n', '0'):
+        return False
+    else:
+        raise argparse.ArgumentTypeError('bool-expected')
+
+
 def print_banner(log):
     log.info('       ___________ _____ _   _ _____ _   _ _   _       ')
     log.info('      |  _  | ___ \  ___| \ | |  _  | \ | | | | |      ')
@@ -603,5 +615,6 @@
         if kafka_cluster_proxy:
             Probe.kafka_proxy_faulty = kafka_cluster_proxy.is_faulty()
 
+
 if __name__ == '__main__':
     Main().start()