]> git.stg.codes - ssmd.git/commitdiff
Extra error messages added
authorMaxim Mamontov <faust.madf@gmail.com>
Wed, 23 Nov 2011 18:11:58 +0000 (20:11 +0200)
committerMaxim Mamontov <faust.madf@gmail.com>
Wed, 23 Nov 2011 18:11:58 +0000 (20:11 +0200)
src/snmptable.cpp
src/switch.cpp

index b0aaba33d0f987aa9165bc33e9e44dac302f753e..5937270e23defc60d9adb4f2da33f14acb05e8f0 100644 (file)
@@ -11,8 +11,8 @@ SNMPTable::SNMPTable(Snmp & snmp,
     Vb vb(oid);
     Pdu pdu(&vb, 1);
     while (true) {
-        if (snmp.get_next(pdu, target) != SNMP_CLASS_SUCCESS) {
-            logger << "SNMPTable::SNMPTable() - failed to invoke Snmp::get_next (oid: '" << oid.get_printable() << "')" << std::endl;
+        if (int c = snmp.get_next(pdu, target) != SNMP_CLASS_SUCCESS) {
+            logger << "SNMPTable::SNMPTable() - failed to invoke Snmp::get_next (oid: '" << oid.get_printable() << "'). Error message: '" << Snmp::error_msg(c) << "'" << std::endl;
             return;
         }
         if (pdu.get_vb(0).get_oid().nCompare(oid.len(), oid) != 0) {
index 43c83da2ad8d14c45770b95504c6020198c82f7e..b70540294d9c1fa6ad4246366c17d9b99bb6e284 100644 (file)
@@ -178,7 +178,8 @@ bool Switch::dropACLsByTable(const CTarget & target, unsigned profileId, const S
     SNMPList::const_iterator it;
     for (it = aclsList.begin(); it != aclsList.end(); ++it) {
         int id;
-        if (it->get_value(id) != SNMP_CLASS_SUCCESS) {
+        if (int c = it->get_value(id) != SNMP_CLASS_SUCCESS) {
+            logger << "Switch::dropACLsByTable() - failed to get ACL id for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'" << std::endl;
             return false;
         }
         std::string dropACLOid(dropACLOidPrefix);
@@ -188,8 +189,8 @@ bool Switch::dropACLsByTable(const CTarget & target, unsigned profileId, const S
         vb.set_value(int(6));
         pdu += vb;
     }
-    if (_snmp.set(pdu, target) != SNMP_CLASS_SUCCESS) {
-        logger << "Switch::dropACLsByTable() - failed to invoke Snmp::set for the switch '" << _ip << "'" << std::endl;
+    if (int c = _snmp.set(pdu, target) != SNMP_CLASS_SUCCESS) {
+        logger << "Switch::dropACLsByTable() - failed to invoke Snmp::set for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'" << std::endl;
         return false;
     }
     return true;
@@ -201,8 +202,8 @@ bool Switch::createACLs(const CTarget & target)
     for (it = _acls.begin(); it != _acls.end(); ++it) {
         Pdu pdu;
         it->appendPdu(pdu);
-        if (_snmp.set(pdu, target) != SNMP_CLASS_SUCCESS) {
-            logger << "Switch::createACLs() - failed to invoke Snmp::set for the switch '" << _ip << "'" << std::endl;
+        if (int c = _snmp.set(pdu, target) != SNMP_CLASS_SUCCESS) {
+            logger << "Switch::createACLs() - failed to invoke Snmp::set for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'" << std::endl;
             return false;
         }
     }