示例#1
0
 def setter(self, value):
     value = value.strip()
     # Trailing period is bad, leading period is okay
     if value and value[-1] == '.':
         value = value[:-1]
     # Test to make sure it's all numbers and doesn't
     # need translation
     if not value.replace('.', '').isdigit():
         # Total junk becomes a blank
         oid = self._object.getDmdRoot('Mibs').name2oid(value)
         if not oid:
             value = snmptranslate('-On', value)
         else:
             value = oid
     return setattr(self._object, propertyName, value)
示例#2
0
 def setter(self, value):
     value = value.strip()
     # Trailing period is bad, leading period is okay
     if value and value[-1] == '.':
         value = value[:-1]
     # Test to make sure it's all numbers and doesn't
     # need translation
     if not value.replace('.', '').isdigit():
         # Total junk becomes a blank
         oid = self._object.getDmdRoot('Mibs').name2oid(value)
         if not oid:
             value = snmptranslate('-On', value)
         else:
             value = oid
     return setattr(self._object, propertyName, value)
 def name2oid(self, name=''):
     oid = self._root.name2oid(name)
     if not oid:
         oid = snmptranslate('-On', name)
     return oid
 def oid2name(self, oid='', exactMatch=True, strip=False):
     name = self._root.oid2name(oid, exactMatch=exactMatch, strip=strip)
     if not name:
         name = snmptranslate(oid)
     return name
示例#5
0
 def name2oid(self, name=''):
     oid = self._root.name2oid(name)
     if not oid:
         oid = snmptranslate('-On', name)
     return oid
示例#6
0
 def oid2name(self, oid='', exactMatch=True, strip=False):
     name = self._root.oid2name(oid, exactMatch=exactMatch, strip=strip)
     if not name:
         name = snmptranslate(oid)
     return name