[Git][NTPsec/ntpsec][master] Added MIB coverage

Ian Bruene gitlab at mg.gitlab.com
Wed Nov 8 01:51:53 UTC 2017


Ian Bruene pushed to branch master at NTPsec / ntpsec


Commits:
dcaaa4a7 by Ian Bruene at 2017-11-07T19:51:47-06:00
Added MIB coverage

- - - - -


1 changed file:

- ntpclients/ntpsnmpd


Changes:

=====================================
ntpclients/ntpsnmpd
=====================================
--- a/ntpclients/ntpsnmpd
+++ b/ntpclients/ntpsnmpd
@@ -388,20 +388,25 @@ class DataSource:  # This may be broken up in future to be less NTP-specific
             data = self.session.readstat()
             return ax.Varbind(ax.VALUE_GAUGE32, oid, len(data))
 
-    def cb_statusDispersion(self, oid, write=None):  # DUMMY
+    def cb_statusDispersion(self, oid, write=None):
         # DisplayString
         if write is None:
-            return ax.Varbind(ax.VALUE_OCTET_STR, oid, "quux")
+            data = self.session.readvar(0, ["rootdisp"], raw=True)
+            return ax.Varbind(ax.VALUE_OCTET_STR, oid, data["rootdisp"][1])
 
     def cb_statusEntityUptime(self, oid, write=None):  # DUMMY
         # TimeTicks
         if write is None:
             return ax.Varbind(ax.VALUE_TIME_TICKS, oid, 8)
 
-    def cb_statusDateTime(self, oid, write=None):  # DUMMY
+    def cb_statusDateTime(self, oid, write=None):
         # NtpDateTime
         if write is None:
-            return ax.Varbind(ax.VALUE_OCTET_STR, oid, "fred")
+            data = self.session.readvar(0, ["reftime"])
+            txt = data["reftime"]
+            txt = txt[2:]  # Strip '0x'
+            txt = "".join(txt.split("."))  # Strip '.'
+            return ax.Varbind(ax.VALUE_OCTET_STR, oid, txt)
 
     def cb_statusLeapSecond(self, oid, write=None):  # DUMMY
         # NtpDateTime



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/dcaaa4a7cff5bb457ff50f8a51c8188d36dbfa7e

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/dcaaa4a7cff5bb457ff50f8a51c8188d36dbfa7e
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20171108/72abea6f/attachment.html>


More information about the vc mailing list