Skip to content

Commit

Permalink
Merge pull request #453 from handymenny/mts-asn1-kotlin-per
Browse files Browse the repository at this point in the history
Support Segmented Capabilities
  • Loading branch information
handymenny authored Jul 27, 2024
2 parents 433ca12 + afb0922 commit e1b84a9
Show file tree
Hide file tree
Showing 12 changed files with 171,074 additions and 4 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ val tstypesImplementation: Configuration by
configurations.getting { extendsFrom(configurations.implementation.get()) }

dependencies {
val mtsAsn1Version = "45cc560"
val mtsAsn1Version = "3800c8a165"
val javalinVersion = "6.1.6"
val coroutinesVersion = "1.8.1"
val kotlinxSerializationVer = "1.7.1"
Expand All @@ -38,6 +38,7 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$kotlinxSerializationVer")
implementation("com.github.handymenny.mts-asn1:mts-asn1-converter:$mtsAsn1Version")
implementation("com.github.handymenny.mts-asn1:mts-asn1-per:$mtsAsn1Version")
implementation("com.github.handymenny.mts-asn1:mts-asn1-kotlin-per:$mtsAsn1Version")
implementation("com.github.handymenny.mts-asn1:mts-asn1-kotlinx-json:$mtsAsn1Version")
implementation("org.slf4j:slf4j-nop:2.0.13")
implementation("com.github.ajalt.clikt:clikt:4.4.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.ericsson.mts.asn1.ASN1Lexer
import com.ericsson.mts.asn1.ASN1Parser
import com.ericsson.mts.asn1.ASN1Translator
import com.ericsson.mts.asn1.KotlinJsonFormatWriter
import com.ericsson.mts.asn1.PERTranslatorFactory
import com.ericsson.mts.asn1.PERTranslatorFactoryKT
import com.ericsson.mts.asn1.converter.AbstractConverter
import it.smartphonecombo.uecapabilityparser.extension.decodeHex
import it.smartphonecombo.uecapabilityparser.extension.getArrayAtPath
Expand Down Expand Up @@ -80,13 +80,13 @@ object MtsAsn1Helpers {
private fun getAsn1Translator(rat: Rat): ASN1Translator {
val trees = if (rat == Rat.EUTRA) lteTrees else nrTrees

return ASN1Translator.fromExternalTrees(PERTranslatorFactory(false), trees)
return ASN1Translator.fromExternalTrees(PERTranslatorFactoryKT(false), trees)
}

private fun getAsn1ApTranslator(rat: Rat): ASN1Translator {
val trees = if (rat == Rat.EUTRA) s1apTrees else ngapTrees

return ASN1Translator.fromExternalTrees(PERTranslatorFactory(true), trees)
return ASN1Translator.fromExternalTrees(PERTranslatorFactoryKT(true), trees)
}

fun apPDUtoJson(rat: Rat, pdu: ByteArray): JsonElement? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,21 @@ internal class CliCsvOutputTest {
)
}

@Test
fun testUeCapHexSegmented() {
test(
"-i",
"$path/input/ueCapHexSegmented.hex",
"--sub-types",
"LTE",
"-t",
"H",
"-c",
"-",
oracleFilename = "ueCapHexSegmented.csv",
)
}

@Test
fun testQcatMrdc() {
test(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,22 @@ internal class CliJsonOutputTest {
)
}

@Test
fun testUeCapHexSegmented() {
test(
"-i",
"$path/input/ueCapHexSegmented.hex",
"--sub-types",
"LTE",
"-t",
"H",
"-j",
"-",
"--json-pretty-print",
oracleFilename = "ueCapHexSegmented.json",
)
}

@Test
fun testQcatMrdc() {
test(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,22 @@ internal class CliUeLogOutputTest {
)
}

@Test
fun testUeCapHexSegmented() {
test(
"-i",
"$path/input/ueCapHexSegmented.hex",
"--sub-types",
"LTE",
"-t",
"H",
"-l",
"-",
"--json-pretty-print",
oracleFilename = "ueCapHexSegmented.json",
)
}

@Test
fun testQcatMrdc() {
test(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,22 @@ internal class ServerModeMultiPartParseTest {
)
}

@Test
fun ueCapHexSegmentedJsonOutput() {
javalinJsonTest(
request =
buildJsonArray {
addJsonObject {
put("type", "H")
putJsonArray("inputIndexes") { add(0) }
putJsonArray("subTypes") { add("LTE") }
}
},
files = listOf("$inputPath/ueCapHexSegmented.hex"),
oraclePath = "$oraclePath/ueCapHexSegmented.json",
)
}

@Test
fun qcatNrdc() {
javalinJsonTest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,18 @@ internal class ServerModeParseTest {
)
}

@Test
fun ueCapHexSegmentedJsonOutput() {
javalinJsonTest(
request =
buildJsonObject {
put("type", "H")
put("input", fileToBase64("$path/input/ueCapHexSegmented.hex"))
},
oraclePath = "$path/oracleJson/ueCapHexSegmented.json"
)
}

@Test
fun qcatMrdcJsonOutput() {
javalinJsonTest(
Expand Down
Loading

0 comments on commit e1b84a9

Please sign in to comment.