title: Dynamic increment of OIDs at SNMP Agent side
body: <p>I am trying to implement a snmp agent with two different context name.I got some sample program from the <a href="http://snmplabs.com/" rel="nofollow noreferrer">http://snmplabs.com/</a> .
  Following is how I am trying to implement my agent side. At the begining of the implementation I got some error like</p>
  
  <pre><code>Error: OID not increasing: SNMPv2-SMI::dod
   &gt;= SNMPv2-SMI::dod
  </code></pre>
  
  <p>I got answer from the stackoverflow for that. </p>
  
  <p><a href="https://stackoverflow.com/questions/58977166/error-oid-not-increasing-snmpv2-smidod-how-to-increase-oid/58980756?noredirect=1#comment104583772_58980756">Error: OID not increasing: SNMPv2-SMI::dod, How to increase OID?</a></p>
  
  <p>So I fixed my code like </p>
  
  <pre class="lang-py prettyprint-override"><code>class sample ():
      def readVars (self , varBinds, acInfo=(None, None)):
              retItem = []
              for ov in varBinds:
                  if str(ov[0]) == '1.3.6.1.4.1.12345.1.1.1.0':
                      retItem.extend([(ov[0], v2c.OctetString('%s' % primary_keys['value1']))])
                  elif str(ov[0]) == '1.3.6.1.4.1.12345.1.1.2.0':
                      retItem.extend([(ov[0], v2c.OctetString('%s' % primary_keys['value2']))])
                  . 
                  .
                  .
                  .
  
      def readNextVars (self , varBinds, acInfo=(None, None)):
              retItem = []
              for ov in varBinds:
                  if str(ov[0]) == '1.3.6.1.4.1.12345.1.1.1.0':
                      retItem.extend([('1.3.6.1.4.1.12345.1.1.2.0', v2c.OctetString('%s' % primary_keys['value2']))])
                  elif str(ov[0]) == '1.3.6.1.4.1.12345.1.1.2.0':
                      retItem.extend([('1.3.6.1.4.1.12345.1.1.3.1.1.0', v2c.OctetString('%s' % item_list['value3']]))])
                  .
                  .
                  .
                  .
              else:
                      retItem.extend([('1.3.6.1.4.1.44555.1.1.1.0', v2c.OctetString('%s' % primary_keys['value1']))])
              return retItem
  </code></pre>
  
  <p>and I registred this class under the context like this</p>
  
  <pre class="lang-py prettyprint-override"><code>mibTreeA = sample()
  
  self._snmpContext.registerContextName(v2c.OctetString('ContextOne'), mibTreeA)  
  self._snmpContext.registerContextName(v2c.OctetString('ContextTwo'), mibTreeA)  
  </code></pre>
  
  <p>But the problem is I want to use more than 50 OIDs in this, so I am thinking to make it dynamic, any suggestion or example for doing that. Please ask if you want more details.</p>