original_docstring: parsing mechanism: cli
  
          Function cli() defines the cli type output parsing mechanism which
          typically contains 3 steps: exe
          cuting, transforming, returning
          
docstring: parsing mechanism: cli
  Function cli() defines the cli type output parsing mechanism which
  typically contains 3 steps: exe
  cuting, transforming, returning
docstring_tokens: parsing mechanism : cli Function cli () defines the cli type output parsing mechanism which typically contains 3 steps : exe cuting transforming returning
code: def cli(self,output=None):
          """parsing mechanism: cli
  
          Function cli() defines the cli type output parsing mechanism which
          typically contains 3 steps: exe
          cuting, transforming, returning
          """
          if output is None:
              out = self.device.execute(self.cli_command)
          else:
              out = output
  
          redundancy_dict = {}
          if out:
              redundancy_dict['red_sys_info'] = {}
          for line in out.splitlines():
              line = line.rstrip()
  
              # available_system_uptime
              p1 = re.compile(
                  r'\s*[Aa]vailable +[Ss]ystem +[Uu]ptime +\= +(?P<available_system_uptime>.+)$')
              m = p1.match(line)
              if m:
                  redundancy_dict['red_sys_info']['available_system_uptime'] = \
                      m.groupdict()['available_system_uptime']
                  continue
  
              # switchovers_system_experienced
              p2 = re.compile(
                  r'\s*[Ss]witchovers +system +experienced +\= +(?P<switchovers_system_experienced>\d+)$')
              m = p2.match(line)
              if m:
                  redundancy_dict['red_sys_info']['switchovers_system_experienced'] = \
                      m.groupdict()['switchovers_system_experienced']
                  continue
  
              # standby_failures
              p3 = re.compile(
                  r'\s*[Ss]tandby +failures +\= +(?P<standby_failures>\d+)$')
              m = p3.match(line)
              if m:
                  redundancy_dict['red_sys_info']['standby_failures'] = \
                      m.groupdict()['standby_failures']
                  continue
  
              # last_switchover_reason
              p4 = re.compile(
                  r'^\s*[Ll]ast +[Ss]witchover +[Rr]eason +\= +(?P<last_switchover_reason>.+)$')
              m = p4.match(line)
              if m:
                  redundancy_dict['red_sys_info']['last_switchover_reason'] = \
                      m.groupdict()['last_switchover_reason']
                  continue
  
              # hw_mode
              p5 = re.compile(
                  r'\s*[Hh]ardware +[Mm]ode +\= +(?P<hw_mode>\S+)$')
              m = p5.match(line)
              if m:
                  redundancy_dict['red_sys_info']['hw_mode'] = \
                      m.groupdict()['hw_mode']
                  continue
  
              # conf_red_mode
              p6 = re.compile(
                  r'\s*[Cc]onfigured +[Rr]edundancy +[Mm]ode +\= +(?P<conf_red_mode>\S+)$')
              m = p6.match(line)
              if m:
                  redundancy_dict['red_sys_info']['conf_red_mode'] = \
                      m.groupdict()['conf_red_mode']
                  continue
  
              # oper_red_mode
              p7 = re.compile(
                  r'\s*[Oo]perating +[Rr]edundancy +[Mm]ode +\= +(?P<oper_red_mode>.+)$')
              m = p7.match(line)
              if m:
                  redundancy_dict['red_sys_info']['oper_red_mode'] = \
                      m.groupdict()['oper_red_mode']
                  continue
  
              # maint_mode
              p7 = re.compile(
                  r'\s*[Mm]aintenance +[Mm]ode +\= +(?P<maint_mode>\S+)$')
              m = p7.match(line)
              if m:
                  redundancy_dict['red_sys_info']['maint_mode'] = \
                      m.groupdict()['maint_mode']
                  continue
  
              # communications
              p8 = re.compile(r'^\s*[Cc]ommunications +\= +(?P<communications>\S+)$')
              m = p8.match(line)
              if m:
                  redundancy_dict['red_sys_info']['communications'] = \
                      m.groupdict()['communications']
  
              # communications_reason
              p8 = re.compile(r'^\s*[Cc]ommunications +\= +(?P<communications>\S+)\s+[Rr]eason\: +(?P<communications_reason>.+)$')
              m = p8.match(line)
              if m:
                  redundancy_dict['red_sys_info']['communications'] = \
                      m.groupdict()['communications']
                  redundancy_dict['red_sys_info']['communications_reason'] = \
                      m.groupdict()['communications_reason']
                  continue
  
              # slot number
              p9 = re.compile(r'^\s*\S+ +[Ll]ocation +\= +(?P<slot>.+)$')
              m = p9.match(line)
              if m:
                  slot = m.groupdict()['slot']
                  if 'slot' not in redundancy_dict:
                      redundancy_dict['slot'] = {}
                  if slot not in redundancy_dict['slot']:
                      redundancy_dict['slot'][slot] = {}
                  continue
  
              # curr_sw_state
              p10 = re.compile(r'^\s*[Cc]urrent +[Ss]oftware +[Ss]tate +\= +(?P<curr_sw_state>.+)$')
              m = p10.match(line)
              if m:
                  if 'slot' in redundancy_dict:
                      redundancy_dict['slot'][slot]['curr_sw_state'] = \
                          m.groupdict()['curr_sw_state']
                  continue
  
              # uptime_in_curr_state
              p11 = re.compile(r'^\s*[Uu]ptime +[Ii]n +[Cc]urrent +[Ss]tate +\= +(?P<uptime_in_curr_state>.+)$')
              m = p11.match(line)
              if m:
                  if 'slot' in redundancy_dict:
                      redundancy_dict['slot'][slot]['uptime_in_curr_state'] = \
                          m.groupdict()['uptime_in_curr_state']
                  continue
  
              # image_ver
              p12 = re.compile(r'^\s*[Ii]mage +[Vv]ersion +\= +(?P<image_ver>.+)$')
              m = p12.match(line)
              if m:
                  if 'slot' in redundancy_dict:
                      redundancy_dict['slot'][slot]['image_ver'] = \
                          m.groupdict()['image_ver']
                  continue
  
              # boot
              p13 = re.compile(r'^\s*BOOT +\= +(?P<boot>.+)$')
              m = p13.match(line)
              if m:
                  if 'slot' in redundancy_dict:
                      redundancy_dict['slot'][slot]['boot'] = \
                          m.groupdict()['boot']
                  continue
  
              # config_file
              p14 = re.compile(r'\s*CONFIG_FILE +\= +(?P<config_file>.?)$')
              m = p14.match(line)
              if m:
                  if 'slot' in redundancy_dict:
                      redundancy_dict['slot'][slot]['config_file'] = \
                          m.groupdict()['config_file']
                  continue
  
              # bootldr
              p15 = re.compile(r'\s*BOOTLDR +\= +(?P<bootldr>.?)$')
              m = p15.match(line)
              if m:
                  if 'slot' in redundancy_dict:
                      redundancy_dict['slot'][slot]['bootldr'] = \
                          m.groupdict()['bootldr']
                  continue
  
              # config_register
              p16 = re.compile(r'^\s*[Cc]onfiguration +[Rr]egister = (?P<config_register>.+)$')
              m = p16.match(line)
              if m:
                  if 'slot' in redundancy_dict:
                      redundancy_dict['slot'][slot]['config_register'] = \
                          m.groupdict()['config_register']
                  continue
  
          return redundancy_dict
code_tokens: def cli ( self , output = None ) : if output is None : out = self . device . execute ( self . cli_command ) else : out = output redundancy_dict = { } if out : redundancy_dict [ 'red_sys_info' ] = { } for line in out . splitlines ( ) : line = line . rstrip ( ) p1 = re . compile ( r'\s*[Aa]vailable +[Ss]ystem +[Uu]ptime +\= +(?P<available_system_uptime>.+)$' ) m = p1 . match ( line ) if m : redundancy_dict [ 'red_sys_info' ] [ 'available_system_uptime' ] = m . groupdict ( ) [ 'available_system_uptime' ] continue p2 = re . compile ( r'\s*[Ss]witchovers +system +experienced +\= +(?P<switchovers_system_experienced>\d+)$' ) m = p2 . match ( line ) if m : redundancy_dict [ 'red_sys_info' ] [ 'switchovers_system_experienced' ] = m . groupdict ( ) [ 'switchovers_system_experienced' ] continue p3 = re . compile ( r'\s*[Ss]tandby +failures +\= +(?P<standby_failures>\d+)$' ) m = p3 . match ( line ) if m : redundancy_dict [ 'red_sys_info' ] [ 'standby_failures' ] = m . groupdict ( ) [ 'standby_failures' ] continue p4 = re . compile ( r'^\s*[Ll]ast +[Ss]witchover +[Rr]eason +\= +(?P<last_switchover_reason>.+)$' ) m = p4 . match ( line ) if m : redundancy_dict [ 'red_sys_info' ] [ 'last_switchover_reason' ] = m . groupdict ( ) [ 'last_switchover_reason' ] continue p5 = re . compile ( r'\s*[Hh]ardware +[Mm]ode +\= +(?P<hw_mode>\S+)$' ) m = p5 . match ( line ) if m : redundancy_dict [ 'red_sys_info' ] [ 'hw_mode' ] = m . groupdict ( ) [ 'hw_mode' ] continue p6 = re . compile ( r'\s*[Cc]onfigured +[Rr]edundancy +[Mm]ode +\= +(?P<conf_red_mode>\S+)$' ) m = p6 . match ( line ) if m : redundancy_dict [ 'red_sys_info' ] [ 'conf_red_mode' ] = m . groupdict ( ) [ 'conf_red_mode' ] continue p7 = re . compile ( r'\s*[Oo]perating +[Rr]edundancy +[Mm]ode +\= +(?P<oper_red_mode>.+)$' ) m = p7 . match ( line ) if m : redundancy_dict [ 'red_sys_info' ] [ 'oper_red_mode' ] = m . groupdict ( ) [ 'oper_red_mode' ] continue p7 = re . compile ( r'\s*[Mm]aintenance +[Mm]ode +\= +(?P<maint_mode>\S+)$' ) m = p7 . match ( line ) if m : redundancy_dict [ 'red_sys_info' ] [ 'maint_mode' ] = m . groupdict ( ) [ 'maint_mode' ] continue p8 = re . compile ( r'^\s*[Cc]ommunications +\= +(?P<communications>\S+)$' ) m = p8 . match ( line ) if m : redundancy_dict [ 'red_sys_info' ] [ 'communications' ] = m . groupdict ( ) [ 'communications' ] p8 = re . compile ( r'^\s*[Cc]ommunications +\= +(?P<communications>\S+)\s+[Rr]eason\: +(?P<communications_reason>.+)$' ) m = p8 . match ( line ) if m : redundancy_dict [ 'red_sys_info' ] [ 'communications' ] = m . groupdict ( ) [ 'communications' ] redundancy_dict [ 'red_sys_info' ] [ 'communications_reason' ] = m . groupdict ( ) [ 'communications_reason' ] continue p9 = re . compile ( r'^\s*\S+ +[Ll]ocation +\= +(?P<slot>.+)$' ) m = p9 . match ( line ) if m : slot = m . groupdict ( ) [ 'slot' ] if 'slot' not in redundancy_dict : redundancy_dict [ 'slot' ] = { } if slot not in redundancy_dict [ 'slot' ] : redundancy_dict [ 'slot' ] [ slot ] = { } continue p10 = re . compile ( r'^\s*[Cc]urrent +[Ss]oftware +[Ss]tate +\= +(?P<curr_sw_state>.+)$' ) m = p10 . match ( line ) if m : if 'slot' in redundancy_dict : redundancy_dict [ 'slot' ] [ slot ] [ 'curr_sw_state' ] = m . groupdict ( ) [ 'curr_sw_state' ] continue p11 = re . compile ( r'^\s*[Uu]ptime +[Ii]n +[Cc]urrent +[Ss]tate +\= +(?P<uptime_in_curr_state>.+)$' ) m = p11 . match ( line ) if m : if 'slot' in redundancy_dict : redundancy_dict [ 'slot' ] [ slot ] [ 'uptime_in_curr_state' ] = m . groupdict ( ) [ 'uptime_in_curr_state' ] continue p12 = re . compile ( r'^\s*[Ii]mage +[Vv]ersion +\= +(?P<image_ver>.+)$' ) m = p12 . match ( line ) if m : if 'slot' in redundancy_dict : redundancy_dict [ 'slot' ] [ slot ] [ 'image_ver' ] = m . groupdict ( ) [ 'image_ver' ] continue p13 = re . compile ( r'^\s*BOOT +\= +(?P<boot>.+)$' ) m = p13 . match ( line ) if m : if 'slot' in redundancy_dict : redundancy_dict [ 'slot' ] [ slot ] [ 'boot' ] = m . groupdict ( ) [ 'boot' ] continue p14 = re . compile ( r'\s*CONFIG_FILE +\= +(?P<config_file>.?)$' ) m = p14 . match ( line ) if m : if 'slot' in redundancy_dict : redundancy_dict [ 'slot' ] [ slot ] [ 'config_file' ] = m . groupdict ( ) [ 'config_file' ] continue p15 = re . compile ( r'\s*BOOTLDR +\= +(?P<bootldr>.?)$' ) m = p15 . match ( line ) if m : if 'slot' in redundancy_dict : redundancy_dict [ 'slot' ] [ slot ] [ 'bootldr' ] = m . groupdict ( ) [ 'bootldr' ] continue p16 = re . compile ( r'^\s*[Cc]onfiguration +[Rr]egister = (?P<config_register>.+)$' ) m = p16 . match ( line ) if m : if 'slot' in redundancy_dict : redundancy_dict [ 'slot' ] [ slot ] [ 'config_register' ] = m . groupdict ( ) [ 'config_register' ] continue return redundancy_dict
short_docstring: parsing mechanism: cli
  Function cli() defines the cli type output parsing mechanism which
  typically contains 3 steps: exe
  cuting, transforming, returning
short_docstring_tokens: parsing mechanism : cli Function cli () defines the cli type output parsing mechanism which typically contains 3 steps : exe cuting transforming returning
comment: """parsing mechanism: cli
  
          Function cli() defines the cli type output parsing mechanism which
          typically contains 3 steps: exe
          cuting, transforming, returning
          """$SEP$# available_system_uptime$SEP$# switchovers_system_experienced$SEP$# standby_failures$SEP$# last_switchover_reason$SEP$# hw_mode$SEP$# conf_red_mode$SEP$# oper_red_mode$SEP$# maint_mode$SEP$# communications$SEP$# communications_reason$SEP$# slot number$SEP$# curr_sw_state$SEP$# uptime_in_curr_state$SEP$# image_ver$SEP$# boot$SEP$# config_file$SEP$# bootldr$SEP$# config_register