SnmpKit.SnmpSim.ProfileLoader (snmpkit v2.0.1)

Flexible profile loading supporting multiple sources and progressive enhancement. Start with simple walk files, upgrade to MIB-based simulation when ready.

Summary

Functions

Path of a bundled walk file (see load_profile/1).

Find the next OID after the given OID for GETNEXT operations.

Get the value for a specific OID from a loaded profile.

Get all OIDs in lexicographic order for GETNEXT operations.

Loads one of the walk files bundled with the library (priv/walks): :cable_modem, :router or :switch.

Load a device profile from various source types.

Types

t()

@type t() :: %SnmpKit.SnmpSim.ProfileLoader{
  behaviors: term(),
  device_type: term(),
  metadata: term(),
  oid_map: term(),
  source_type: term()
}

Functions

bundled_walk(device_type)

@spec bundled_walk(atom()) :: Path.t()

Path of a bundled walk file (see load_profile/1).

get_next_oid(profile, oid)

Find the next OID after the given OID for GETNEXT operations.

get_oid_value(profile_loader, oid)

Get the value for a specific OID from a loaded profile.

Examples

value = SnmpKit.SnmpSim.ProfileLoader.get_oid_value(profile, "1.3.6.1.2.1.1.1.0")

get_ordered_oids(profile_loader)

Get all OIDs in lexicographic order for GETNEXT operations.

load_profile(device_type)

@spec load_profile(atom()) :: {:ok, t()} | {:error, term()}

Loads one of the walk files bundled with the library (priv/walks): :cable_modem, :router or :switch.

{:ok, profile} = SnmpKit.SnmpSim.ProfileLoader.load_profile(:router)

load_profile(device_type, source, opts \\ [])

Load a device profile from various source types.

Supported source types:

  • {:walk_file, path} - SNMP walk files (both named and numeric formats)
  • {:oid_walk, path} - Raw OID dumps (numeric OIDs only)
  • {:json_profile, path} - Structured JSON profiles
  • {:manual, oid_map} - Manual OID definitions (for testing)
  • {:compiled_mib, mib_files} - Advanced MIB compilation (future)

Examples

# Load from SNMP walk file
profile = SnmpKit.SnmpSim.ProfileLoader.load_profile(
  :cable_modem,
  {:walk_file, "priv/walks/cable_modem.walk"}
)

# Load with behaviors
profile = SnmpKit.SnmpSim.ProfileLoader.load_profile(
  :cable_modem,
  {:walk_file, "priv/walks/cable_modem.walk"},
  behaviors: [
    {:increment_counters, rate: 1000},
    {:vary_gauges, variance: 0.1}
  ]
)