-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update classes, fix configuration issues
- Loading branch information
Showing
31 changed files
with
1,308 additions
and
836 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Root Type="DevExpress.CodeRush.Foundation.CodePlaces.Options.FavoritesListContainer"> | ||
<Options Language="Neutral"> | ||
<Groups /> | ||
</Options> | ||
</Root> |
18 changes: 18 additions & 0 deletions
18
QAction_1/PollingManager/CustomCode/Configuration/BasicPoll.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Skyline.Protocol.PollingManager.CustomCode.Configuration | ||
{ | ||
using Skyline.DataMiner.PollingManager; | ||
using Skyline.DataMiner.Scripting; | ||
|
||
internal class BasicPoll : PollableBase | ||
{ | ||
public BasicPoll(SLProtocol protocol, string description, int actionID) : base(protocol, description) | ||
{ | ||
ActionId = actionID; | ||
} | ||
|
||
protected override void PollConfiguration() | ||
{ | ||
Protocol.Log($"Polling '{Name}'."); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
QAction_1/PollingManager/CustomCode/Configuration/Pollable.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace Skyline.Protocol.PollingManager.CustomCode.Configuration | ||
{ | ||
using Skyline.DataMiner.PollingManager; | ||
using Skyline.DataMiner.Scripting; | ||
|
||
public class Pollable : PollableBase | ||
{ | ||
public Pollable(SLProtocol protocol, string description) : base(protocol, description) | ||
{ | ||
} | ||
|
||
protected override void PollConfiguration() | ||
{ | ||
Protocol.Log($"Polling '{Name}'."); | ||
} | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
QAction_1/PollingManager/CustomCode/Configuration/PollingManagerConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
namespace Skyline.Protocol.PollingManager.CustomCode.Configuration | ||
{ | ||
using System.Collections.Generic; | ||
using Skyline.DataMiner.PollingManager; | ||
using Skyline.DataMiner.Scripting; | ||
using Skyline.Protocol.PollingManager.CustomCode.ResponseHandlers; | ||
using Skyline.Protocol.PollingManager.GenericAPI.Handlers; | ||
|
||
public class PollingManagerConfiguration : PollingManagerConfigurationBase | ||
{ | ||
public PollingManagerConfiguration(SLProtocol protocol) : base(protocol) | ||
{ | ||
Rows = new Dictionary<string, PollableBase>() | ||
{ | ||
{ "Basic", new BasicPoll(Protocol, "Basic Dataset", 60_001) }, | ||
{ "Fail", new BasicPoll(Protocol, "Failing Dataset", 60_002) }, | ||
{ "Parent1", new Pollable(Protocol, "Parent1 Dataset") }, | ||
{ "Parent2", new Pollable(Protocol, "Parent2 Dataset") }, | ||
{ "Child1", new Pollable(Protocol, "Parent1 - Child 1 Dataset") }, | ||
{ "Child2", new Pollable(Protocol, "Multiple Parent - Child 2 Dataset") }, | ||
{ "Dependency", new Pollable(Protocol, "API 2.0 Dataset") }, | ||
{ "Mandatory", new Pollable(Protocol, "Mandatory Dataset") }, | ||
}; | ||
|
||
Rows["Mandatory"].Mandatory = true; | ||
|
||
Dependencies = new List<Dependency>() | ||
{ | ||
}; | ||
|
||
ResponseHandlers = new Dictionary<int, ResponseHandler>() | ||
{ }; | ||
} | ||
|
||
public override Dictionary<int, ResponseHandler> ResponseHandlers { get; set; } | ||
|
||
protected override List<Dependency> Dependencies { get; set; } | ||
|
||
protected override Dictionary<string, PollableBase> Rows { get; set; } | ||
|
||
protected override void CreateDependencies() | ||
{ | ||
var apiDependency = new Dependency("Version2", true, "Only supported in Api version 2.0"); | ||
Rows["Dependency"].AddDependency(Parameter.apiversion_5, apiDependency); | ||
} | ||
|
||
protected override void CreateParameterRelations() | ||
{ | ||
var basicSingleParameter = new Dictionary<int, object> | ||
{ | ||
{ Parameter.systemname_20, string.Empty}, | ||
{ Parameter.serialNumber_21,"-1"}, | ||
}; | ||
|
||
var basicTableParameters = new List<int> { 100 }; | ||
Rows["Basic"].AddParameters(basicSingleParameter, basicTableParameters); | ||
} | ||
|
||
protected override void CreateRelations() | ||
{ | ||
Rows["Parent1"].AddChildren(Rows["Child1"], Rows["Child2"]); | ||
Rows["Parent2"].AddChildren(Rows["Child2"]); | ||
} | ||
|
||
protected override void CreateResponseHandlers() | ||
{ | ||
ResponseHandlers.Add(61001, new ResponseBasicDataSet("Basic")); | ||
ResponseHandlers.Add(61002, new ResponseBasicFailDataSet("Fail")); | ||
} | ||
} | ||
} |
9 changes: 0 additions & 9 deletions
9
QAction_1/PollingManager/CustomCode/ResponseHandlers/IPollingManagerResponseHandler.cs
This file was deleted.
Oops, something went wrong.
31 changes: 29 additions & 2 deletions
31
QAction_1/PollingManager/CustomCode/ResponseHandlers/ResponseBasicDataSet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,44 @@ | ||
namespace Skyline.Protocol.PollingManager.CustomCode.ResponseHandlers | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Skyline.DataMiner.Scripting; | ||
using Skyline.Protocol.PollingManager.GenericAPI.Exceptions; | ||
using Skyline.Protocol.PollingManager.GenericAPI.Handlers; | ||
|
||
public class ResponseBasicDataSet : ResponseHandler | ||
{ | ||
public ResponseBasicDataSet(string rowName) : base(rowName) | ||
{ | ||
} | ||
|
||
public override void ProcessResponse(SLProtocol protocol) | ||
protected override void ProcessResponse(SLProtocol protocol) | ||
{ | ||
return; | ||
Dictionary<int, object> setParameters = new Dictionary<int, object> | ||
{ | ||
{ Parameter.systemname_20, "Dummy Name" }, | ||
{ Parameter.serialNumber_21, "DUMMY23430E7W" }, | ||
}; | ||
protocol.SetParameters(setParameters.Keys.ToArray(), setParameters.Values.ToArray()); | ||
|
||
int dummyRows = 10; | ||
List<DummydataQActionRow> tableRows = new List<DummydataQActionRow>(); | ||
Random random = new Random(); | ||
|
||
for (int i = 0; i < dummyRows; i++) | ||
{ | ||
var row = new DummydataQActionRow | ||
{ | ||
Dummydatainstance_101 = $"{i}", | ||
Dummydatadescription_102 = $"Dummy Entry {i}", | ||
Dummydatastatus_103 = random.Next(0, 2), | ||
}; | ||
|
||
tableRows.Add(row); | ||
} | ||
|
||
protocol.FillArray(100, tableRows.ToArray().Select(r => r.ToObjectArray()).ToList(), NotifyProtocol.SaveOption.Full); | ||
} | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
QAction_1/PollingManager/CustomCode/ResponseHandlers/ResponseBasicFailDataSet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 0 additions & 58 deletions
58
QAction_1/PollingManager/CustomCode/ResponseHandlers/ResponseHandler.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Skyline.Protocol.PollingManager.GenericAPI.Enums | ||
{ | ||
/// <summary> | ||
/// Represents the type of a pollable. | ||
/// </summary> | ||
public enum PollableType | ||
{ | ||
/// <summary> | ||
/// The pollable triggers and action with actionId. | ||
/// </summary> | ||
TriggerAction, | ||
|
||
/// <summary> | ||
/// The pollalbe process the poll fully in Code. | ||
/// </summary> | ||
ProcessInCode, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,14 @@ | ||
namespace Skyline.DataMiner.PollingManager | ||
namespace Skyline.Protocol.PollingManager.GenericAPI.Enums | ||
{ | ||
using System; | ||
|
||
using Skyline.DataMiner.Scripting; | ||
|
||
/// <summary> | ||
/// Represents triggers of the <see cref="PollingmanagerQActionTable"/>. | ||
/// </summary> | ||
public enum Trigger | ||
{ | ||
Description = 999, | ||
Interval = 1054, | ||
IntervalType = 1056, | ||
Poll = 1057, | ||
} | ||
|
||
/// <summary> | ||
/// Extension class for <see cref="Trigger"/>. | ||
/// </summary> | ||
public static class TriggerExtensions | ||
{ | ||
/// <summary> | ||
/// Converts <see cref="Trigger"/> to its corresponding <see cref="Column"/> value. | ||
/// </summary> | ||
/// <param name="trigger">Trigger to be converted.</param> | ||
/// <returns>Column that corresponds to the trigger.</returns> | ||
/// <exception cref="InvalidOperationException">Throws if trigger has no corresponding column.</exception> | ||
public static Column ToColumn(this Trigger trigger) | ||
{ | ||
switch (trigger) | ||
{ | ||
case Trigger.Interval: | ||
return Column.Interval; | ||
case Trigger.IntervalType: | ||
return Column.AdminStatus; | ||
case Trigger.Description: | ||
return Column.Description; | ||
case Trigger.Poll: | ||
return Column.Poll; | ||
|
||
default: | ||
throw new ArgumentException($"Unsupported IntervalType '{trigger}'."); | ||
} | ||
} | ||
} | ||
} |
11 changes: 4 additions & 7 deletions
11
...Code/ResponseHandlers/PollingException.cs → ...GenericAPI/Exceptions/PollingException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
using System.Runtime.Serialization; | ||
using System.Security; | ||
|
||
namespace Skyline.Protocol.PollingManager.CustomCode.ResponseHandlers | ||
namespace Skyline.Protocol.PollingManager.GenericAPI.Exceptions | ||
{ | ||
using System; | ||
|
||
/// <summary> | ||
/// Represents errors that occur during polling execution. | ||
/// </summary> | ||
public class PollingException : Exception | ||
{ | ||
/// <summary>Initializes a new instance of the <see cref="PollingException" /> class with a specified error message.</summary> | ||
/// <param name="message">The message that describes the error.</param> | ||
public PollingException(string message) : base(message) | ||
{ | ||
|
||
} | ||
|
||
/// <summary>Initializes a new instance of the <see cref="PollingException" /> class.</summary> | ||
public PollingException() | ||
{ | ||
|
||
} | ||
|
||
/// <summary>Initializes a new instance of the <see cref="PollingException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary> | ||
/// <param name="message">The error message that explains the reason for the exception.</param> | ||
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (<see langword="Nothing" /> in Visual Basic) if no inner exception is specified.</param> | ||
public PollingException(string message, Exception innerException) : base(message, innerException) | ||
{ | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.