jeanparpaillon / elixir-snmp

SNMP tooling for elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not support "AUGMENTS"?

ewildgoose opened this issue · comments

I think the current library fails if using "AUGMENTS" in an mib? I wanted to implement IF-MIB in my app, so I created a stub something like:

defmodule SnmpAgent.Mib.If do
  use Snmp.Mib, name: "IF-MIB"
end

Then added IF-MIB and IANAifType-MIB into my local mibs directory. This fails with an error:

Generated sys_data app
==> snmp_agent
Compiling 10 files (.ex)

== Compilation error in file lib/snmp_agent/mib/if.ex ==
** (Protocol.UndefinedError) protocol Enumerable not implemented for {:augments, {:ifEntry, :undefined}} of type Tuple
    (elixir 1.14.5) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir 1.14.5) lib/enum.ex:166: Enumerable.reduce/3
    (elixir 1.14.5) lib/enum.ex:4307: Enum.map/2
    (elixir_snmp 0.2.1) lib/snmp/mib/table_info.ex:66: Snmp.Mib.TableInfo.find_indices/1
    (elixir_snmp 0.2.1) lib/snmp/mib/table_info.ex:27: Snmp.Mib.TableInfo.new/2
    (elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (elixir_snmp 0.2.1) expanding macro: Snmp.Mib.__using__/1

If I replace the "AUGMENTS { ifEntry }" in IfXEntry, then it compiles (and gives me errors about missing definitions)

So I speculate that it's something to do with the thing being augmented being described in the same file? However, I'm not sure how to progress to resolve this? Any guidance?