anchor.diff:      find_executables([snmptrapd], Config);
   init_per_group(_, Config) ->
       Config.
  +
  +init_per_group_ip(Families, Config) ->
  +    Dir = ?config(priv_dir, Config),
  +    AgentPort = ?config(agent_port, Config),
  +    ManagerPort = ?config(manager_port, Config),
  +    Versions = [v2],
  +    {ok, Host} = inet:gethostname(),
  +    Transports =
  +	[begin
  +	     {ok, Addr} = inet:getaddr(Host, Family),
  +	     {domain(Family), {Addr, AgentPort}}
  +	 end || Family <- Families],
  +    Targets =
  +	[begin
  +	     {ok, Addr} = inet:getaddr(Host, Family),
  +	     {domain(Family), {Addr, ManagerPort}}
  +	 end || Family <- Families],
  +    agent_config(Dir, Transports, Targets, Versions),
  +    [{port, ?AGENT_PORT}, {snmp_versions, Versions},
  +     {transports, Transports}, {targets, Targets}
  +     | Config].
  +
  +
   
   end_per_group(_GroupName, Config) ->
       Config.
  
positive.code: %%--------------------------------------------------------------------
  %% Internal functions ------------------------------------------------
  %%--------------------------------------------------------------------
  snmpget(Oid, Config) ->
      Versions = ?config(snmp_versions, Config),
      [TrapAddr | _] = ?config(trapaddrs, Config),
      Port = ?config(agent_port, Config),
  
      Args =
  	["-c", "public", net_snmp_version(Versions),
  	 "-m", "",
  	 "-Cf",
  	 net_snmp_addr_str(TrapAddr, Port),
  	 oid_str(Oid)],
      ProgHandle = start_program(snmpget, Args, none, Config),
      {_, line, Line} = get_program_output(ProgHandle),
      stop_program(ProgHandle),
      Line.
  
  start_snmptrapd(Mibs, TrapAddrs, Config) ->
      DataDir = ?config(data_dir, Config),
      MibDir = filename:join(code:lib_dir(snmp), "mibs"),
      SnmptrapdArgs =
  	["-f", "-Lo", "-C",
  	 "-m", Mibs,
  	 "-M", MibDir++":"++DataDir,
  	 "--disableAuthorization=yes",
  	 "--snmpTrapdAddr="++TrapAddrs],
      {ok, StartCheckMP} = re:compile("NET-SNMP version ", [anchored]),
      start_program(snmptrapd, SnmptrapdArgs, StartCheckMP, Config).
  
  
negative.code: net_snmp_version([v1 | _]) ->
      "-v1".
  
  domain(inet) ->
      transportDomainUdpIpv4;
  domain(inet6) ->
      transportDomainUdpIpv6.
  
  net_snmp_addr_str([Target | Targets]) ->
      net_snmp_addr_str(Target) ++
  	case Targets of
  	    [] ->
  		[];
  	    [_ | _] ->
  		"," ++ net_snmp_addr_str(Targets)
  	end;
  net_snmp_addr_str({transportDomainUdpIpv4, {Addr, Port}}) ->
      "udp:" ++
  	inet_parse:ntoa(Addr) ++ ":" ++
  	integer_to_list(Port);
  net_snmp_addr_str({transportDomainUdpIpv6, {Addr, Port}}) ->
      "udp6:[" ++
  	inet_parse:ntoa(Addr) ++ "]:" ++
  	integer_to_list(Port).
  