Skip to content

Commit 5396a62

Browse files
authored
Feature: SNMPv3 Error Codes (#2547)
* Feature: SNMPv3 Error Codes * Feature: SNMPv3 Error Codes * Feature: SNMP error codes & error handling * Docs: Add new line * Feature: SNMP Walk v3 handle error messages * Feature: SNMPv3 error codes & error handling improved * Chore: Refactoring * Docs: Changelog added
1 parent 5ff50b0 commit 5396a62

File tree

17 files changed

+818
-141
lines changed

17 files changed

+818
-141
lines changed

Source/NETworkManager.Localization/ResourceIdentifier.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public enum ResourceIdentifier
1717
RemoteDesktopNetworkConnectionType,
1818
SettingsGroup,
1919
SettingsName,
20+
SNMPErrorCode,
21+
SNMPV3ErrorCode,
2022
TcpState,
2123
Theme,
2224
TimeUnit,

Source/NETworkManager.Localization/Resources/Strings.Designer.cs

Lines changed: 190 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/NETworkManager.Localization/Resources/Strings.resx

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ Profile files are not affected!</value>
11511151
<value>The settings location is not affected!</value>
11521152
</data>
11531153
<data name="TimeoutOnSNMPQuery" xml:space="preserve">
1154-
<value>Timeout on SNMP query.</value>
1154+
<value>Timeout on SNMP query. Maybe the host is not reachable or the community / password is wrong.</value>
11551155
</data>
11561156
<data name="TimeoutWhenQueryingDNSServerMessage" xml:space="preserve">
11571157
<value>Timeout when querying the DNS server with the IP address "{0}"!</value>
@@ -3685,4 +3685,67 @@ Try again in a few seconds.</value>
36853685
<data name="EnterHostToQueryIPGeolocationDots" xml:space="preserve">
36863686
<value>Enter host to query IP geolocation...</value>
36873687
</data>
3688+
<data name="SNMPV3ErrorCode_UnknownUserName" xml:space="preserve">
3689+
<value>Unknown user name.</value>
3690+
</data>
3691+
<data name="SNMPV3ErrorCode_AuthenticationFailed" xml:space="preserve">
3692+
<value>Authentication failure (incorrect password, community or key).</value>
3693+
</data>
3694+
<data name="SNMPErrorCode_NoError" xml:space="preserve">
3695+
<value>The operation was successful without any errors.</value>
3696+
</data>
3697+
<data name="SNMPErrorCode_TooBig" xml:space="preserve">
3698+
<value>The response to your request was too large to fit into a single response!</value>
3699+
</data>
3700+
<data name="SNMPErrorCode_NoSuchName" xml:space="preserve">
3701+
<value>The requested OID could not be found!</value>
3702+
</data>
3703+
<data name="SNMPErrorCode_BadValue" xml:space="preserve">
3704+
<value>A read-write or write-only object was set to an inconsistent value!</value>
3705+
</data>
3706+
<data name="SNMPErrorCode_ReadOnly" xml:space="preserve">
3707+
<value>The requested OID does not exist and is not writable!</value>
3708+
</data>
3709+
<data name="SNMPErrorCode_GenError" xml:space="preserve">
3710+
<value>An error occurred for which no specific message is available!</value>
3711+
</data>
3712+
<data name="SNMPErrorCode_NoAccess" xml:space="preserve">
3713+
<value>The requested object is not accessible for modification!</value>
3714+
</data>
3715+
<data name="SNMPErrorCode_WrongType" xml:space="preserve">
3716+
<value>The object was set to an incompatible data type!</value>
3717+
</data>
3718+
<data name="SNMPErrorCode_WrongLength" xml:space="preserve">
3719+
<value>The value assigned to the object exceeds its maximum length!</value>
3720+
</data>
3721+
<data name="SNMPErrorCode_WrongEncoding" xml:space="preserve">
3722+
<value>The encoding used for the object is incorrect!</value>
3723+
</data>
3724+
<data name="SNMPErrorCode_WrongValue" xml:space="preserve">
3725+
<value>The value assigned to the object is not a valid choice!</value>
3726+
</data>
3727+
<data name="SNMPErrorCode_NoCreation" xml:space="preserve">
3728+
<value>The requested object does not exist and cannot be created!</value>
3729+
</data>
3730+
<data name="SNMPErrorCode_InconsistentValue" xml:space="preserve">
3731+
<value>The MIB variable is currently in an inconsistent state and cannot be modified!</value>
3732+
</data>
3733+
<data name="SNMPErrorCode_ResourceUnavailable" xml:space="preserve">
3734+
<value>There are no available system resources to perform the requested operation!</value>
3735+
</data>
3736+
<data name="SNMPErrorCode_CommitFailed" xml:space="preserve">
3737+
<value>An error occurred during the set operation!</value>
3738+
</data>
3739+
<data name="SNMPErrorCode_UndoFailed" xml:space="preserve">
3740+
<value>A set operation failed, and previous changes could not be rolled back!</value>
3741+
</data>
3742+
<data name="SNMPErrorCode_AuthorizationError" xml:space="preserve">
3743+
<value>Authentication failed. Please check the community string!</value>
3744+
</data>
3745+
<data name="SNMPErrorCode_NotWritable" xml:space="preserve">
3746+
<value>The requested object is not writable and cannot be modified!</value>
3747+
</data>
3748+
<data name="SNMPErrorCode_InconsistentName" xml:space="preserve">
3749+
<value>The object's state is inconsistent, preventing the set operation!</value>
3750+
</data>
36883751
</root>

Source/NETworkManager.Models/Export/ExportManager.SNMPReceivedInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ private static void CreateCsv(IEnumerable<SNMPInfo> collection, string filePath)
4545
{
4646
var stringBuilder = new StringBuilder();
4747

48-
stringBuilder.AppendLine($"{nameof(SNMPInfo.Oid)},{nameof(SNMPInfo.Data)}");
48+
stringBuilder.AppendLine($"{nameof(SNMPInfo.OID)},{nameof(SNMPInfo.Data)}");
4949

5050
foreach (var info in collection)
51-
stringBuilder.AppendLine($"{info.Oid},{info.Data}");
51+
stringBuilder.AppendLine($"{info.OID},{info.Data}");
5252

5353
System.IO.File.WriteAllText(filePath, stringBuilder.ToString());
5454
}
@@ -66,7 +66,7 @@ private static void CreateXml(IEnumerable<SNMPInfo> collection, string filePath)
6666
from info in collection
6767
select
6868
new XElement(nameof(SNMPInfo),
69-
new XElement(nameof(SNMPInfo.Oid), info.Oid),
69+
new XElement(nameof(SNMPInfo.OID), info.OID),
7070
new XElement(nameof(SNMPInfo.Data), info.Data)))));
7171

7272
document.Save(filePath);
@@ -85,7 +85,7 @@ private static void CreateJson(IReadOnlyList<SNMPInfo> collection, string filePa
8585
{
8686
jsonData[i] = new
8787
{
88-
OID = collection[i].Oid,
88+
OID = collection[i].OID,
8989
collection[i].Data
9090
};
9191
}

0 commit comments

Comments
 (0)