Parsing Ping return codes and saving iteration details

 - ping command detects error types and saves events
 - exit on no packets to send
 - ping now uses runtime map (as reclass can have DHCP set)

Change-Id: Iad66bd90d0c5a43e04fd785f02f8e1c2769dda62
Related-PROD: PROD-28199
diff --git a/cfg_checker/helpers/errors.py b/cfg_checker/helpers/errors.py
index 1f962eb..eaaa1eb 100644
--- a/cfg_checker/helpers/errors.py
+++ b/cfg_checker/helpers/errors.py
@@ -1,4 +1,5 @@
 import os
+from configparser import NoSectionError
 
 from cfg_checker.common import file_utils as fu
 from cfg_checker.common import logger, logger_cli
@@ -62,9 +63,19 @@
                 self._area_code.lower(),
                 filepath=self._conf_filename
             )
-            # it is loaded, update iteration from file
-            self._iteration = self.conf.get_value('iteration', value_type=int)
-            self._iteration += 1
+            # check if there is any values there
+            try:
+                self._iteration = self.conf.get_value(
+                    'iteration',
+                    value_type=int
+                )
+                self._iteration += 1
+            except NoSectionError:
+                self._iteration += 1
+                self.conf.set_value('iteration', self._iteration)
+                self.conf.save_config(filepath=self._conf_filename)
+                logger_cli.debug("... updated config file")
+
         logger_cli.debug(" ... starting iteration {}".format(self._iteration))
 
     def save_iteration_data(self):
@@ -189,14 +200,14 @@
         _total_errors = self.get_errors_total()
 
         _list.append('-'*20)
-        _list.append("{:5d} total errors found\n".format(_total_errors))
+        _list.append("{:5d} total events found\n".format(_total_errors))
         if as_list:
             return _list
         else:
             return "\n".join(_list)
 
     def get_errors(self, as_list=False):
-        _list = ["# Errors"]
+        _list = ["# Events"]
         # Detailed errors
         if self.get_errors_total() > 0:
             # create list of strings with error messages
@@ -204,7 +215,7 @@
                 _list.append(self._format_error(_idx))
                 _list.append("\n")
         else:
-            _list.append("-> No errors")
+            _list.append("-> No events saved")
 
         if as_list:
             return _list