Exemplo n.º 1
0
 def genNotifications(self):
     self.fo.write("# notifications (traps) \n")
     for notif in self.smimodule.get_notifications():
         initdict = {"OID": repr(Basetypes.ObjectIdentifier(notif.OID))}
         self.fo.write(genClass(notif, Objects.NotificationObject,
                                initdict))
         self._genOIDItem(notif.OID, notif.name)
Exemplo n.º 2
0
 def createAndWait(self, session, *indexargs, **attribs):
     vbl = self._create_vbl(*indexargs, **attribs)
     vbl.append(
         Basetypes.VarBind(
             Basetypes.ObjectIdentifier(self.rowstatus.OID + self.indexoid),
             self.rowstatus.syntaxobject(4)))  # create and go
     session.set(vbl)
     return self
Exemplo n.º 3
0
 def genNodes(self):
     self.fo.write("# nodes\n")
     for node in self.smimodule.get_nodes(SMI.SMI_NODEKIND_NODE):
         if node.name:
             initdict = {}
             initdict["name"] = repr(node.name)
             initdict["OID"] = repr(Basetypes.ObjectIdentifier(node.OID))
             self.fo.write(genClass(node, Objects.NodeObject, initdict))
             self._genOIDItem(node.OID, node.name)
     self.fo.write("\n")
Exemplo n.º 4
0
 def _make_index_oid(self, indexargs):
     assert len(indexargs) == len(self.index)
     indexoid = Basetypes.ObjectIdentifier()
     i = 0
     for idx in indexargs[:-1]:
         indexoid.extend(Basetypes.oid(self.index[i].syntaxobject(idx)))
         i += 1
     end = self.index[i].syntaxobject(indexargs[-1])
     end.implied = self.index.implied
     indexoid.extend(Basetypes.oid(end))
     return indexoid
Exemplo n.º 5
0
 def genColumns(self):
     self.fo.write("# columns\n")
     for col in self.smimodule.get_columns():
         initdict = {}
         initdict["syntaxobject"] = so = self._getSyntax(col)
         if so.find("Enumeration") >= 0:
             initdict["enumerations"] = col.syntax.enumerations
         initdict["OID"] = repr(Basetypes.ObjectIdentifier(col.OID))
         self.fo.write(genClass(col, Objects.ColumnObject, initdict))
         self.fo.write("\n")
         self._genOIDItem(col.OID, col.name)
Exemplo n.º 6
0
 def genGroups(self):
     self.fo.write("# groups \n")
     for group in self.smimodule.get_groups():
         if group.status not in (SMI.SMI_STATUS_CURRENT,
                                 SMI.SMI_STATUS_DEPRECATED,
                                 SMI.SMI_STATUS_MANDATORY):
             continue
         initdict = {}
         initdict["OID"] = repr(Basetypes.ObjectIdentifier(group.OID))
         grouplist = []
         for el in group.get_elements():
             n = el.get_node()
             grouplist.append(n.name)
         initdict["group"] = "[%s]" % ", ".join(grouplist)
         self.fo.write(genClass(group, Objects.GroupObject, initdict))
         self._genOIDItem(group.OID, group.name)
Exemplo n.º 7
0
 def genScalars(self):
     self.fo.write("# scalars \n")
     for scalar in self.smimodule.get_scalars():
         if scalar.status not in \
                 (SMI.SMI_STATUS_DEPRECATED,
                 SMI.SMI_STATUS_CURRENT,
                 SMI.SMI_STATUS_MANDATORY):
             continue  # do not expose optional or obsolete objects
         initdict = {}
         initdict["syntaxobject"] = so = self._getSyntax(scalar)
         if so.find("Enumeration") >= 0:
             initdict["enumerations"] = scalar.syntax.enumerations
         initdict["OID"] = repr(Basetypes.ObjectIdentifier(scalar.OID))
         self.fo.write(genClass(scalar, Objects.ScalarObject, initdict))
         self.fo.write("\n")
         self._genOIDItem(scalar.OID, scalar.name)
Exemplo n.º 8
0
 def genRows(self):
     self.fo.write("# rows \n")
     for row in self.smimodule.get_rows():
         if row.status not in (SMI.SMI_STATUS_DEPRECATED,
                     SMI.SMI_STATUS_CURRENT,
                     SMI.SMI_STATUS_MANDATORY):
             continue
         initdict = {}
         columns = "{%s}" % ", ".join(["%r: %s" % (s, s) for s in self._get_colnames(row)])
         initdict["columns"] = columns
         initdict["index"] = self._genIndexObjects(row)
         rowstatus = row.rowstatus
         if rowstatus:
             initdict["rowstatus"] = row.rowstatus.name
         initdict["OID"] = repr(Basetypes.ObjectIdentifier(row.OID))
         self.fo.write(genClass(row, Objects.RowObject, initdict))
         self.fo.write("\n")
Exemplo n.º 9
0
 def _oid_(self):
     new = Basetypes.ObjectIdentifier()
     self[-1].implied = self.implied
     for obj in self:
         new.extend(Basetypes.oid(obj))
     return new