original_docstring:  main entry point for module execution
      
docstring: main entry point for module execution
docstring_tokens: main entry point for module execution
code: def main():
      """ main entry point for module execution
      """
      argument_spec = dict(
          count=dict(type="int"),
          dest=dict(type="str", required=True),
          df_bit=dict(type="bool", default=False),
          size=dict(type="int"),
          source=dict(type="str"),
          state=dict(
              type="str", choices=["absent", "present"], default="present"
          ),
          vrf=dict(type="str"),
      )
      argument_spec.update(ios_argument_spec)
      module = AnsibleModule(argument_spec=argument_spec)
      count = module.params["count"]
      dest = module.params["dest"]
      df_bit = module.params["df_bit"]
      size = module.params["size"]
      source = module.params["source"]
      vrf = module.params["vrf"]
      warnings = list()
      results = {}
      if warnings:
          results["warnings"] = warnings
      results["commands"] = [build_ping(dest, count, source, vrf, size, df_bit)]
      ping_results = run_commands(module, commands=results["commands"])
      ping_results_list = ping_results[0].split("\n")
      stats = ""
      for line in ping_results_list:
          if line.startswith("Success"):
              stats = line
      success, rx, tx, rtt = parse_ping(stats)
      loss = abs(100 - int(success))
      results["packet_loss"] = str(loss) + "%"
      results["packets_rx"] = int(rx)
      results["packets_tx"] = int(tx)
      # Convert rtt values to int
      for k, v in rtt.items():
          if rtt[k] is not None:
              rtt[k] = int(v)
      results["rtt"] = rtt
      validate_results(module, loss, results)
      module.exit_json(**results)
code_tokens: def main ( ) : argument_spec = dict ( count = dict ( type = "int" ) , dest = dict ( type = "str" , required = True ) , df_bit = dict ( type = "bool" , default = False ) , size = dict ( type = "int" ) , source = dict ( type = "str" ) , state = dict ( type = "str" , choices = [ "absent" , "present" ] , default = "present" ) , vrf = dict ( type = "str" ) , ) argument_spec . update ( ios_argument_spec ) module = AnsibleModule ( argument_spec = argument_spec ) count = module . params [ "count" ] dest = module . params [ "dest" ] df_bit = module . params [ "df_bit" ] size = module . params [ "size" ] source = module . params [ "source" ] vrf = module . params [ "vrf" ] warnings = list ( ) results = { } if warnings : results [ "warnings" ] = warnings results [ "commands" ] = [ build_ping ( dest , count , source , vrf , size , df_bit ) ] ping_results = run_commands ( module , commands = results [ "commands" ] ) ping_results_list = ping_results [ 0 ] . split ( "\n" ) stats = "" for line in ping_results_list : if line . startswith ( "Success" ) : stats = line success , rx , tx , rtt = parse_ping ( stats ) loss = abs ( 100 - int ( success ) ) results [ "packet_loss" ] = str ( loss ) + "%" results [ "packets_rx" ] = int ( rx ) results [ "packets_tx" ] = int ( tx ) for k , v in rtt . items ( ) : if rtt [ k ] is not None : rtt [ k ] = int ( v ) results [ "rtt" ] = rtt validate_results ( module , loss , results ) module . exit_json ( ** results )
short_docstring: main entry point for module execution
short_docstring_tokens: main entry point for module execution
comment: """ main entry point for module execution
      """$SEP$# Convert rtt values to int