Skip to content

Commit 08b4f3d

Browse files
update conversion to enum states
1 parent 662b022 commit 08b4f3d

File tree

6 files changed

+30
-22
lines changed

6 files changed

+30
-22
lines changed

QAction_1/ProtocolExtensions.cs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ namespace Skyline.Protocol.Extension
33
using System;
44
using System.Collections.Generic;
55
using System.Linq;
6-
76
using Skyline.DataMiner.Scripting;
87

98
public static class ProtocolExtension

QAction_1/SnmpAgentState.cs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Skyline.Protocol.Extension
2+
{
3+
public enum SnmpAgentStates
4+
{
5+
NotRestarted = 0,
6+
Restarted = 1,
7+
}
8+
}

QAction_1000/IfTable.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void ProcessData()
150150
ProcessUtilization(duplexStatuses, i, key, bitrateIn, bitrateOut);
151151
}
152152

153-
if (iftableGetter.IsSnmpAgentRestarted)
153+
if (iftableGetter.IsSnmpAgentRestarted == SnmpAgentStates.Restarted)
154154
{
155155
iftableSetter.SetParamsData[Parameter.iftablesnmpagentrestartflag] = 0;
156156
}
@@ -180,7 +180,7 @@ private void ProcessBitRates(SnmpDeltaHelper snmpDeltaHelper, int getPosition, o
180180
string discontinuityTime = Convert.ToString(iftableGetter.Discontinuity[getPosition]);
181181
bool discontinuity = Interface.HasDiscontinuity(discontinuityTime, rateData.DiscontinuityTime);
182182

183-
if (iftableGetter.IsSnmpAgentRestarted || discontinuity)
183+
if (iftableGetter.IsSnmpAgentRestarted == SnmpAgentStates.Restarted || discontinuity)
184184
{
185185
rateData.BitrateIn = SnmpRate32.FromJsonString(String.Empty, MinDelta, MaxDelta);
186186
rateData.BitrateOut = SnmpRate32.FromJsonString(String.Empty, MinDelta, MaxDelta);
@@ -281,12 +281,12 @@ public IfTableGetter(SLProtocol protocol)
281281

282282
public object[] RateData { get; private set; }
283283

284-
public bool IsSnmpAgentRestarted { get; private set; }
284+
public SnmpAgentStates IsSnmpAgentRestarted { get; private set; }
285285

286286
public void Load()
287287
{
288-
IsSnmpAgentRestarted = Convert.ToBoolean(Convert.ToInt16(protocol.GetParameter(Parameter.iftablesnmpagentrestartflag)));
289-
288+
Enum.TryParse<SnmpAgentStates>(Convert.ToString(protocol.GetParameter(Parameter.iftablesnmpagentrestartflag)), out var snmpAgentState);
289+
IsSnmpAgentRestarted = snmpAgentState;
290290
LoadIfTable();
291291
LoadIfXTable();
292292
}

QAction_1100/IfXTable.cs

+5-4
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public void ProcessData()
149149
ProcessUtilization(duplexStatuses, i, key, bitrateIn, bitrateOut);
150150
}
151151

152-
if (ifxTableGetter.IsSnmpAgentRestarted)
152+
if (ifxTableGetter.IsSnmpAgentRestarted == SnmpAgentStates.Restarted)
153153
{
154154
ifxTableSetter.SetParamsData[Parameter.ifxtablesnmpagentrestartflag] = 0;
155155
}
@@ -179,7 +179,7 @@ private void ProcessBitRates(SnmpDeltaHelper snmpDeltaHelper, int getPosition, o
179179
string discontinuityTime = Convert.ToString(ifxTableGetter.Discontinuity[getPosition]);
180180
bool discontinuity = Interface.HasDiscontinuity(discontinuityTime, rateData.DiscontinuityTime);
181181

182-
if (ifxTableGetter.IsSnmpAgentRestarted || discontinuity)
182+
if (ifxTableGetter.IsSnmpAgentRestarted == SnmpAgentStates.Restarted || discontinuity)
183183
{
184184
rateData.BitrateIn = SnmpRate64.FromJsonString(String.Empty, MinDelta, MaxDelta);
185185
rateData.BitrateOut = SnmpRate64.FromJsonString(String.Empty, MinDelta, MaxDelta);
@@ -279,11 +279,12 @@ public IfXTableGetter(SLProtocol protocol)
279279

280280
public object[] RateData { get; private set; }
281281

282-
public bool IsSnmpAgentRestarted { get; private set; }
282+
public SnmpAgentStates IsSnmpAgentRestarted { get; private set; }
283283

284284
public void Load()
285285
{
286-
IsSnmpAgentRestarted = Convert.ToBoolean(Convert.ToInt16(protocol.GetParameter(Parameter.ifxtablesnmpagentrestartflag)));
286+
Enum.TryParse<SnmpAgentStates>(Convert.ToString(protocol.GetParameter(Parameter.ifxtablesnmpagentrestartflag)), out var snmpAgentRestarted);
287+
IsSnmpAgentRestarted = snmpAgentRestarted;
287288

288289
uint[] columnsToGet = new uint[]
289290
{

QAction_Helper/QAction_Helper.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ public static class Parameter
6565
public const int iftablesetinstance = 999;
6666
/// <summary>PID: 1092 | Type: read</summary>
6767
[EditorBrowsable(EditorBrowsableState.Never)]
68-
public const int ifxtabletimeoutafterretriesflag_1092 = 1092;
68+
public const int ifxtablegroupresultafterretries_1092 = 1092;
6969
/// <summary>PID: 1092 | Type: read</summary>
70-
public const int ifxtabletimeoutafterretriesflag = 1092;
70+
public const int ifxtablegroupresultafterretries = 1092;
7171
/// <summary>PID: 1095 | Type: read</summary>
7272
[EditorBrowsable(EditorBrowsableState.Never)]
7373
public const int ifxtablesnmpagentrestartflag_1095 = 1095;
@@ -1146,8 +1146,8 @@ public interface SLProtocolExt : SLProtocol
11461146
object Iftableifratedata { get; set; }
11471147
object Iftableifadminstatus_1057 { get; set; }
11481148
object Ifxtabletimeouttrigger_dummy { get; set; }
1149-
object Ifxtabletimeoutafterretriesflag_1092 { get; set; }
1150-
object Ifxtabletimeoutafterretriesflag { get; set; }
1149+
object Ifxtablegroupresultafterretries_1092 { get; set; }
1150+
object Ifxtablegroupresultafterretries { get; set; }
11511151
object Ifxtablecalculatebitrates_dummy { get; set; }
11521152
object Ifxtablesnmpagentrestartflag_1095 { get; set; }
11531153
object Ifxtablesnmpagentrestartflag { get; set; }
@@ -1487,11 +1487,11 @@ public class ConcreteSLProtocolExt : ConcreteSLProtocol, SLProtocolExt
14871487
public System.Object Iftableifadminstatus_1057 {get { return GetParameter(1057); }set { SetParameter(1057, value); }}
14881488
/// <summary>PID: 1091 | Type: dummy</summary>
14891489
public System.Object Ifxtabletimeouttrigger_dummy {get { return GetParameter(1091); }set { SetParameter(1091, value); }}
1490-
/// <summary>PID: 1092 | Type: read | DISCREETS: False = 0, True = 1</summary>
1490+
/// <summary>PID: 1092 | Type: read | DISCREETS: Success = 0, Timeout = 1</summary>
14911491
[EditorBrowsable(EditorBrowsableState.Never)]
1492-
public System.Object Ifxtabletimeoutafterretriesflag_1092 {get { return GetParameter(1092); }set { SetParameter(1092, value); }}
1493-
/// <summary>PID: 1092 | Type: read | DISCREETS: False = 0, True = 1</summary>
1494-
public System.Object Ifxtabletimeoutafterretriesflag {get { return GetParameter(1092); }set { SetParameter(1092, value); }}
1492+
public System.Object Ifxtablegroupresultafterretries_1092 {get { return GetParameter(1092); }set { SetParameter(1092, value); }}
1493+
/// <summary>PID: 1092 | Type: read | DISCREETS: Success = 0, Timeout = 1</summary>
1494+
public System.Object Ifxtablegroupresultafterretries {get { return GetParameter(1092); }set { SetParameter(1092, value); }}
14951495
/// <summary>PID: 1093 | Type: dummy</summary>
14961496
public System.Object Ifxtablecalculatebitrates_dummy {get { return GetParameter(1093); }set { SetParameter(1093, value); }}
14971497
/// <summary>PID: 1095 | Type: read | DISCREETS: False = 0, True = 1</summary>

protocol.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2584,8 +2584,8 @@ Currently only calculated for Ethernet interfaces.
25842584
<Type>dummy</Type>
25852585
</Param>
25862586
<Param id="1092">
2587-
<Name>ifXTableTimeoutAfterRetriesFlag</Name>
2588-
<Description>InterfaceX Table Timeout After Retries Flag</Description>
2587+
<Name>ifXTableGroupResultAfterRetries</Name>
2588+
<Description>Group Result After Retries - InterfaceX Table</Description>
25892589
<Type>read</Type>
25902590
<Interprete>
25912591
<RawType>numeric text</RawType>
@@ -2599,11 +2599,11 @@ Currently only calculated for Ethernet interfaces.
25992599
<Type>discreet</Type>
26002600
<Discreets>
26012601
<Discreet>
2602-
<Display>False</Display>
2602+
<Display>Success</Display>
26032603
<Value>0</Value>
26042604
</Discreet>
26052605
<Discreet>
2606-
<Display>True</Display>
2606+
<Display>Timeout</Display>
26072607
<Value>1</Value>
26082608
</Discreet>
26092609
</Discreets>

0 commit comments

Comments
 (0)