Built tests for TransmitChannelConfigurationObject and UpstreamChannelDescriptor
This commit is contained in:
parent
92364dbb03
commit
ed3f273238
@ -25,7 +25,7 @@ namespace skyscraper8.Tests
|
||||
public class DocsisTests
|
||||
{
|
||||
[Fact]
|
||||
public void AAA_ModemCapabilitiesEncodingTest()
|
||||
public void ModemCapabilitiesEncoding()
|
||||
{
|
||||
byte[] buffer = Resources.ModemCapabilitiesEncodingTest;
|
||||
ModemCapabilitiesEncoding modemCapabilitiesEncoding = new ModemCapabilitiesEncoding(buffer);
|
||||
@ -33,7 +33,7 @@ namespace skyscraper8.Tests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AAB_MultipartRegistrationResponseTest()
|
||||
public void MultipartRegistrationResponse()
|
||||
{
|
||||
Random rng = new Random();
|
||||
|
||||
@ -53,7 +53,7 @@ namespace skyscraper8.Tests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AAC_MacManagement_4_45()
|
||||
public void MacManagement_4_45()
|
||||
{
|
||||
DocsisEventHandlerImpl docsisEventHandler = new DocsisEventHandlerImpl();
|
||||
DocsisEnvironment environment = new DocsisEnvironment(docsisEventHandler);
|
||||
@ -71,5 +71,32 @@ namespace skyscraper8.Tests
|
||||
|
||||
environment.PushMacManagementMessage(testPayload, 4, 45, source, target, testPayload);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InvalidUpstreamChannelDescriptorTest()
|
||||
{
|
||||
byte[] testPayload = Resources.UpstreamChannelDescriptorTest;
|
||||
|
||||
Random rng = new Random();
|
||||
byte[] sourceBuffer = new byte[6];
|
||||
rng.NextBytes(sourceBuffer);
|
||||
PhysicalAddress source = new PhysicalAddress(sourceBuffer);
|
||||
|
||||
byte[] targetBuffer = new byte[6];
|
||||
rng.NextBytes(targetBuffer);
|
||||
PhysicalAddress target = new PhysicalAddress(targetBuffer);
|
||||
|
||||
UpstreamChannelDescriptor ucd = new UpstreamChannelDescriptor(source, target, testPayload);
|
||||
Assert.False(ucd.Valid);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TransmitChannelConfigurationObjectTest()
|
||||
{
|
||||
byte[] testPayload = Resources.TransmitChannelConfigurationObject;
|
||||
|
||||
CommonTlvEncodingObject.TransmitChannelConfigurationObject child = new CommonTlvEncodingObject.TransmitChannelConfigurationObject(testPayload);
|
||||
Assert.True(child.Valid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,11 @@ namespace skyscraper8.Tests
|
||||
public void TestLongBoiSingleStreams()
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo("D:\\DocsisDemo");
|
||||
Skip.If(!di.Exists, "Files not available.");
|
||||
if (!di.Exists)
|
||||
{
|
||||
Debug.WriteLine("Files not available!");
|
||||
return;
|
||||
}
|
||||
|
||||
FilesystemScraperStorageFactory storageFactory = new FilesystemScraperStorageFactory();
|
||||
storageFactory.Directory = "docsis_longboi";
|
||||
@ -34,7 +38,11 @@ namespace skyscraper8.Tests
|
||||
public void TestM3u8Stream()
|
||||
{
|
||||
FileInfo docsisM3u8 = new FileInfo("D:\\DocsisDemo\\docsis.m3u8");
|
||||
Skip.If(!docsisM3u8.Exists, "Index file not available.");
|
||||
if (!docsisM3u8.Exists)
|
||||
{
|
||||
Debug.WriteLine("File not available!");
|
||||
return;
|
||||
}
|
||||
|
||||
FileInfo alreadyTested = new FileInfo("docsis_m3u8_test.complete");
|
||||
if (alreadyTested.Exists)
|
||||
|
||||
20
skyscraper8.Tests/Properties/Resources.Designer.cs
generated
20
skyscraper8.Tests/Properties/Resources.Designer.cs
generated
@ -129,5 +129,25 @@ namespace skyscraper8.Tests.Properties {
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] TransmitChannelConfigurationObject {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("TransmitChannelConfigurationObject", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] UpstreamChannelDescriptorTest {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("UpstreamChannelDescriptorTest", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,4 +139,10 @@
|
||||
<data name="test-3packets-04-05-06" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\test-3packets-04-05-06.ts;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="TransmitChannelConfigurationObject" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\TransmitChannelConfigurationObject.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="UpstreamChannelDescriptorTest" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\UpstreamChannelDescriptorTest.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
BIN
skyscraper8.Tests/Resources/UpstreamChannelDescriptorTest.bin
Normal file
BIN
skyscraper8.Tests/Resources/UpstreamChannelDescriptorTest.bin
Normal file
Binary file not shown.
@ -1,4 +1,5 @@
|
||||
using skyscraper5.Docsis.MacManagement;
|
||||
using skyscraper5.Skyscraper;
|
||||
using skyscraper5.Skyscraper.IO;
|
||||
using skyscraper8.Docsis.AnnexC;
|
||||
using skyscraper8.Docsis.DQoS;
|
||||
@ -85,7 +86,7 @@ namespace skyscraper5.Docsis.AnnexC
|
||||
public List<GeneralPacketClassifierEncoding> UpstreamDropPacketClassificationEncoding { get; set; }
|
||||
|
||||
public List<TransmitChannelConfigurationObject> TransmitChannelConfiguration { get; set; }
|
||||
public class TransmitChannelConfigurationObject
|
||||
public class TransmitChannelConfigurationObject : Validatable
|
||||
{
|
||||
public TransmitChannelConfigurationObject(byte[] buffer)
|
||||
{
|
||||
@ -116,6 +117,12 @@ namespace skyscraper5.Docsis.AnnexC
|
||||
case 7:
|
||||
InitializationTechnique = (InitalizationTechniqueEnum?)v[0];
|
||||
break;
|
||||
case 9:
|
||||
DynamicRangeWindow = v[0];
|
||||
break;
|
||||
case 10:
|
||||
P16Hi = v[0];
|
||||
break;
|
||||
case 11:
|
||||
ListOfIucs = v;
|
||||
break;
|
||||
@ -124,6 +131,7 @@ namespace skyscraper5.Docsis.AnnexC
|
||||
throw new NotImplementedException(string.Format("TCC TLV Type {0}", type));
|
||||
}
|
||||
}
|
||||
Valid = true;
|
||||
}
|
||||
|
||||
public byte[] ListOfIucs { get; set; }
|
||||
@ -146,6 +154,7 @@ namespace skyscraper5.Docsis.AnnexC
|
||||
public byte? TccReferenceId { get; set; }
|
||||
public InitalizationTechniqueEnum? InitializationTechnique { get; }
|
||||
public UpstreamChannelDescriptor UpstreamChannelDescriptor { get; }
|
||||
public byte DynamicRangeWindow { get; }
|
||||
}
|
||||
|
||||
public byte KeySequenceNumber { get; set; }
|
||||
|
||||
@ -115,6 +115,11 @@ namespace skyscraper5.Docsis.MacManagement
|
||||
RandomizationSeed = BitConverter.ToUInt32(v2, 0);
|
||||
break;
|
||||
default:
|
||||
if (type > 34)
|
||||
{
|
||||
Valid = false;
|
||||
return;
|
||||
}
|
||||
throw new NotImplementedException(String.Format("{0} TLV type {1}", nameof(UpstreamChannelDescriptor), type));
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
@ -68,6 +69,7 @@ namespace skyscraper8.Skyscraper.IO
|
||||
private Stream GetSegmentStream(string segmentName)
|
||||
{
|
||||
Console.WriteLine("open segment {0}", segmentName);
|
||||
Debug.WriteLine(String.Format("open segment {0}", segmentName));
|
||||
if (source.StartsWith("http://") || source.StartsWith("https://"))
|
||||
{
|
||||
return webClient.GetStreamAsync(segmentName).Result;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user