Login  
Search All Forums
Dart Home | PowerSNMP for .NET | Custom Development Reply | PowerSNMP for .NET Topics | Forums   
AuthorForum: PowerSNMP for .NET
Topic: Nested Tables Index Problem
sevketunveren

From: Turkey
Posts: 5
Member Since: 10/18/17
posted January 26, 2018 10:03 AM

Hello,

I created a child table in the parent table.
Parent table have 34 tablecolumn and 35th is child table.

When i import my mib file the solution, dart creates csharp code. Both mib and csharp code snippets are below.

I also tried by using "AUGMENTS" keyword.

So i want to access by parent index and child index.
For example 1.3.6.1.3.480.1.35.[ParentIndex].1.[ChildIndex]
How can do this?

It is also discussed in the following links:
https://stackoverflow.com/questions/30598525/snmp-nested-table-defined-one-level-below-the-parent-table
https://stackoverflow.com/questions/2510211/snmp-asn-1-mib-definitions-referencing-a-table-within-a-table/2510340#2510340
MIB Snippet:
arentTable OBJECT-TYPE
  SYNTAX    SEQUENCE OF parentEntry
  MAX-ACCESS  not-accessible
  STATUS    current
  DESCRIPTION "Parent table"
  ::= { example 480 }

parentEntry OBJECT-TYPE
  SYNTAX    ParentEntry
  MAX-ACCESS  not-accessible
  STATUS    current
  DESCRIPTION "Entry in Parent table"
  INDEX    { parentIndex }
  ::= { parentTable 1 }

ParentEntry ::= SEQUENCE {
  parentIndex      Unsigned32,
  -- other columns in the table
  }
childTable OBJECT-TYPE
  SYNTAX    SEQUENCE OF childEntry
  MAX-ACCESS  not-accessible
  STATUS    current
  DESCRIPTION "Child table"
  ::= { example 480 }

childEntry OBJECT-TYPE
  SYNTAX    ChildEntry
  MAX-ACCESS  not-accessible
  STATUS    current
  DESCRIPTION "Entry in Child table"
  INDEX    { parentIndex,
          childIndex }
  ::= { childTable 1 }

ChildEntry ::= SEQUENCE {
  childIndex      Unsigned32,
  -- other columns in the table
  }
Nick B (Admin)

From: Utica, NY USA
Posts: 583
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted January 26, 2018 11:46 AM

Hello,

Can you clarify what you're looking for by asking "How can do this?"?

Fundamentally, it's just by specifying the relevant numerical indexes in place of those ParentIndex and ChildIndex "variables".
sevketunveren

From: Turkey
Posts: 5
Member Since: 10/18/17
posted January 29, 2018 10:02 AM

Hello,

I'm sorry because last week my question is so confusing.

As I clarify below:

I have multiple identical device as 'myDevice' and each device has 128 channels.

I have written MIB that channelTable references myDeviceTable.

So i want to access childTable with parent index, but when i import the MIB file via PowerSnmp to my agent, I cannot access.

I can send my solution if necessary.
sevketunveren

From: Turkey
Posts: 5
Member Since: 10/18/17
posted January 29, 2018 10:02 AM

MIB FILE:
  --SME_msg: This MIB has been generated using a demo version of SimpleMibEditor.
MYDEVICE-SV-501-MIB DEFINITIONS ::= BEGIN
  IMPORTS
  experimental, OBJECT-TYPE, MODULE-IDENTITY
    FROM SNMPv2-SMI
  OBJECT-GROUP
    FROM SNMPv2-CONF;

  mydevice MODULE-IDENTITY
    LAST-UPDATED    "201801291451Z"
    ORGANIZATION    "www.savronik.com.tr"
    CONTACT-INFO    "postal: abarkin.elik@savronik.com.tr"
    DESCRIPTION     "SNMP gateway for SunAir modem MD-2800"

    REVISION      "201801291451Z"
    DESCRIPTION     "patlama"
    ::= { experimental 501 }


  mydeviceTable OBJECT-TYPE
    SYNTAX       SEQUENCE OF MydeviceEntry
    MAX-ACCESS     not-accessible
    STATUS       current
    DESCRIPTION     "My Device Table"
    ::= { mydevice 1 }

  mydeviceEntry OBJECT-TYPE
    SYNTAX       MydeviceEntry
    MAX-ACCESS     not-accessible
    STATUS       current
    DESCRIPTION     "Row"
    INDEX        {
                mydeviceIndex
              }
    ::= { mydeviceTable 1 }

  MydeviceEntry ::= SEQUENCE {
    mydeviceIndex
      INTEGER,
    mydeviceTemperature
      INTEGER,
    myDevicePowerSupply
      OCTET STRING
  }

  mydeviceIndex OBJECT-TYPE
    SYNTAX       INTEGER (0..10)
    MAX-ACCESS     read-only
    STATUS       current
    DESCRIPTION     "Table Index"
    ::= { mydeviceEntry 1 }

  mydeviceTemperature OBJECT-TYPE
    SYNTAX       INTEGER (0..100)
    MAX-ACCESS     read-only
    STATUS       current
    DESCRIPTION     "device temperature"
    ::= { mydeviceEntry 2 }

  myDevicePowerSupply OBJECT-TYPE
    SYNTAX       OCTET STRING
    MAX-ACCESS     read-write
    STATUS       current
    DESCRIPTION     "Please replace this text with your description."
    ::= { mydeviceEntry 3 }

  channelTable OBJECT-TYPE
    SYNTAX       SEQUENCE OF ChannelEntry
    MAX-ACCESS     not-accessible
    STATUS       current
    DESCRIPTION     "My Device Table"
    ::= { mydevice 2 }

  channelEntry OBJECT-TYPE
    SYNTAX       ChannelEntry
    MAX-ACCESS     not-accessible
    STATUS       current
    DESCRIPTION     "Row"
    INDEX        {
                mydeviceIndex,
                channelIndex
              }
    ::= { channelTable 1 }

  ChannelEntry ::= SEQUENCE {
    channelIndex
      INTEGER,
    channelName
      OCTET STRING
  }

  channelIndex OBJECT-TYPE
    SYNTAX       INTEGER (0..100)
    MAX-ACCESS     read-only
    STATUS       current
    DESCRIPTION     "device temperature"
    ::= { channelEntry 1 }

  channelName OBJECT-TYPE
    SYNTAX       OCTET STRING
    MAX-ACCESS     read-write
    STATUS       current
    DESCRIPTION     "Please replace this text with your description."
    ::= { channelEntry 2 }

  mydeviceConformance OBJECT IDENTIFIER ::= { mydevice 3 }

  mydeviceGroups OBJECT IDENTIFIER ::= { mydeviceConformance 1 }

  mydeviceSv501MibAllObjects OBJECT-GROUP
    OBJECTS {     
            mydeviceIndex,
            mydeviceTemperature,
            myDevicePowerSupply,
            channelIndex,
            channelName
        }
    STATUS       current
    DESCRIPTION     "This automatically created object group contains
              all those objects that do not belong to any other
              OBJECT-GROUP"
    ::= { mydeviceGroups 1 }


END

--SME_msg: Possibly incomplete MIB, generated using demo version of SimpleMibEditor.
sevketunveren

From: Turkey
Posts: 5
Member Since: 10/18/17
posted January 29, 2018 10:04 AM

public class Mib
{
  
  public static void Import(Dart.Snmp.MibNodes mib)
  {
    System.Collections.Generic.List<Dart.Snmp.MibDefinition> list;
    list = new System.Collections.Generic.List<Dart.Snmp.MibDefinition>();
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.Identifier, "1.3.6.1.3.501", "", Dart.Snmp.Access.Uninitialized, Dart.Snmp.Status.Uninitialized, "", "mydevice", null, "", "", "", "", "", "", "MYDEVICE-SV-501-MIB", "", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.Identifier, "1.3.6.1.3.501.3", "", Dart.Snmp.Access.Uninitialized, Dart.Snmp.Status.Uninitialized, "", "mydeviceConformance", null, "", "", "", "", "", "", "MYDEVICE-SV-501-MIB", "", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.Identifier, "1.3.6.1.3.501.3.1", "", Dart.Snmp.Access.Uninitialized, Dart.Snmp.Status.Uninitialized, "", "mydeviceGroups", null, "", "", "", "", "", "", "MYDEVICE-SV-501-MIB", "", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.Table, "1.3.6.1.3.501.1", "SequenceOf Sequence { mydeviceIndex Integer, mydeviceTemperature Integer, myDevic" +
          "ePowerSupply OctetString }", Dart.Snmp.Access.NotAccessible, Dart.Snmp.Status.Current, "My Device Table", "mydeviceTable", typeof(Dart.Snmp.SequenceOf), "", "", "", "", "", "", "MYDEVICE-SV-501-MIB", "SEQUENCE OF MydeviceEntry", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.TableEntry, "1.3.6.1.3.501.1.1", "Sequence { mydeviceIndex Integer, mydeviceTemperature Integer, myDevicePowerSuppl" +
          "y OctetString }", Dart.Snmp.Access.NotAccessible, Dart.Snmp.Status.Current, "Row", "mydeviceEntry", typeof(Dart.Snmp.Sequence), "", "", "mydeviceIndex", "", "", "", "MYDEVICE-SV-501-MIB", "MydeviceEntry", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.TableColumn, "1.3.6.1.3.501.1.1.1", "Integer (0..10)", Dart.Snmp.Access.ReadOnly, Dart.Snmp.Status.Current, "Table Index", "mydeviceIndex", typeof(Dart.Snmp.SimpleType.Integer), "", "", "", "", "", "", "MYDEVICE-SV-501-MIB", "INTEGER (0..10)", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.TableColumn, "1.3.6.1.3.501.1.1.2", "Integer (0..100)", Dart.Snmp.Access.ReadOnly, Dart.Snmp.Status.Current, "device temperature", "mydeviceTemperature", typeof(Dart.Snmp.SimpleType.Integer), "", "", "", "", "", "", "MYDEVICE-SV-501-MIB", "INTEGER (0..100)", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.TableColumn, "1.3.6.1.3.501.1.1.3", "OctetString", Dart.Snmp.Access.ReadWrite, Dart.Snmp.Status.Current, "Please replace this text with your description.", "myDevicePowerSupply", typeof(Dart.Snmp.SimpleType.OctetString), "", "", "", "", "", "", "MYDEVICE-SV-501-MIB", "OCTET STRING", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.Table, "1.3.6.1.3.501.2", "SequenceOf Sequence { channelIndex Integer, channelName OctetString }", Dart.Snmp.Access.NotAccessible, Dart.Snmp.Status.Current, "My Device Table", "channelTable", typeof(Dart.Snmp.SequenceOf), "", "", "", "", "", "", "MYDEVICE-SV-501-MIB", "SEQUENCE OF ChannelEntry", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.TableEntry, "1.3.6.1.3.501.2.1", "Sequence { channelIndex Integer, channelName OctetString }", Dart.Snmp.Access.NotAccessible, Dart.Snmp.Status.Current, "Row", "channelEntry", typeof(Dart.Snmp.Sequence), "", "", "mydeviceIndex, channelIndex", "", "", "", "MYDEVICE-SV-501-MIB", "ChannelEntry", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.TableColumn, "1.3.6.1.3.501.2.1.1", "Integer (0..100)", Dart.Snmp.Access.ReadOnly, Dart.Snmp.Status.Current, "device temperature", "channelIndex", typeof(Dart.Snmp.SimpleType.Integer), "", "", "", "", "", "", "MYDEVICE-SV-501-MIB", "INTEGER (0..100)", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.TableColumn, "1.3.6.1.3.501.2.1.2", "OctetString", Dart.Snmp.Access.ReadWrite, Dart.Snmp.Status.Current, "", "channelName", typeof(Dart.Snmp.SimpleType.OctetString), "", "", "", "", "", "", "MYDEVICE-SV-501-MIB", "OCTET STRING", ""));
    list.Add(new Dart.Snmp.MibNode(Dart.Snmp.Usage.Group, "1.3.6.1.3.501.3.1.1", "", Dart.Snmp.Access.Uninitialized, Dart.Snmp.Status.Uninitialized, "" +
          "long to any other OBJECT-GROUP", "mydeviceSv501MibAllObjects", null, "", "", "", "", "{ mydeviceIndex, mydeviceTemperature, myDevicePowerSupply, channelIndex, channelN" +
          "ame }", "", "MYDEVICE-SV-501-MIB", "", ""));
    mib.Import(list);
  }
  
  public enum NodeName
  {
    
    mydevice,
    
    mydeviceConformance,
    
    mydeviceGroups,
    
    mydeviceTable,
    
    mydeviceEntry,
    
    mydeviceIndex,
    
    mydeviceTemperature,
    
    myDevicePowerSupply,
    
    channelTable,
    
    channelEntry,
    
    channelIndex,
    
    channelName,
    
    mydeviceSv501MibAllObjects,
  }
}
Reply | PowerSNMP for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX