Commit a1bac3ed authored by Jason Graham's avatar Jason Graham
Browse files

Merge branch 'draft/jason/locationStructure' into 'cr/103280/044'

Draft/jason/locationstructure

See merge request !331
parents e531df05 4079a7c1
Loading
Loading
Loading
Loading
Loading
+106 −1
Changes for 103280/TS_103_280.asn1: 106 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -141,7 +141,15 @@ GMLShape ::= CHOICE
{
    point       [0] GeoPoint,
    sphere      [1] GeoSphere,
    xyEllipsoid [2] XYEllipsoid
    xyEllipsoid [2] XYEllipsoid,
 -- The following are new and were chosen based on the subset of GMLShapes 
 -- supported by other specifications. The specific selection can be
 --  determined at a later date.
    polygon     [3] GMLPolygon,
    circle      [4] GMLCircle,
    ellipse     [5] GMLEllipse,
    arcBand     [6] GMLArcBand,
    prism       [7] GMLPrism    
}

GeoPoint ::= CHOICE
@@ -163,6 +171,59 @@ XYEllipsoid ::= SEQUENCE
    uncertaintyAltitude  [3] UncertaintyMeters OPTIONAL
}

-- for all types currently called GMLTYPE, we need to decide what version to support here (GML, GML profile for PIDF-LO, 29.572, 33.108)
-- for simplicity of the structure, unless otherwise indicated I stole 29.572 and adapted it to things we already have defined
-- we could adjust the name accordingly or make Polygon a choice of FORMATS
-- it is also worth noting that GML supports doubles instead of integers for both uncertainty, altitude and angles, should we define our defs the same way

AngleDecimalDegrees ::= UTF8String

-- GMLPolygons support interior borders as well. Do we think we need to support this?
GMLPolygon ::= SEQUENCE
{
    pointList   [1] SEQUENCE (SIZE (3..15)) OF GeoPoint
}

GMLCircle ::= SEQUENCE
{
    centerPoint  [1] GeoPoint,
    radiusMeters [2] UncertaintyMeters
}

GMLEllipse ::= SEQUENCE
{
    centerPoint  [1] GeoPoint,
    semiMajor    [2] UncertaintyMeters,
    semiMinor    [3] UncertaintyMeters,
    orientation  [4] AngleDecimalDegrees
}

-- This is not 29.572, but is closer to GML 
GMLArcBand ::= SEQUENCE
{
    centerPoint  [1] GeoPoint,
    innerRadius  [2] UncertaintyMeters,
    outerRadius  [3] UncertaintyMeters,
    startAngle   [4] AngleDecimalDegrees,
    openingAngle [5] AngleDecimalDegrees
}

-- This is not 29.572 but is closer to the GML profile for PIDF-LO
GMLPIDFProfileEllipsoid ::= SEQUENCE
{
    centerPoint  [1] GeoPoint,
    semiMajor    [2] UncertaintyMeters,
    semiMinor    [3] UncertaintyMeters,
    verticalAxis [4] UncertaintyMeters,
    orientation  [5] AngleDecimalDegrees
}

GMLPrism ::= SEQUENCE
{
    pointList [1] SEQUENCE (SIZE (3..15)) OF GeoPoint,
    height    [2] UncertaintyMeters
}

FixMode ::= ENUMERATED
{
    unknown(0),
@@ -171,4 +232,48 @@ FixMode ::= ENUMERATED
    fix3D(3)
}

MACAddress ::= OCTET STRING (SIZE(6))

-- This choice was taken from 33.128, which copied 29.572. 
-- We may want to take the format from one of the other standards.
-- The specifics do not matter at this point in the discussion, but are open for comment.
CivicAddress ::= CHOICE
{
    mappedRFC4776CivicAddress [1] MappedRFC4776CivicAddress

}

MappedRFC4776CivicAddress ::= SEQUENCE
{
    country                             [1] UTF8String,
    a1                                  [2] UTF8String OPTIONAL,
    a2                                  [3] UTF8String OPTIONAL,
    a3                                  [4] UTF8String OPTIONAL,
    a4                                  [5] UTF8String OPTIONAL,
    a5                                  [6] UTF8String OPTIONAL,
    a6                                  [7] UTF8String OPTIONAL,
    prd                                 [8] UTF8String OPTIONAL,
    pod                                 [9] UTF8String OPTIONAL,
    sts                                 [10] UTF8String OPTIONAL,
    hno                                 [11] UTF8String OPTIONAL,
    hns                                 [12] UTF8String OPTIONAL,
    lmk                                 [13] UTF8String OPTIONAL,
    loc                                 [14] UTF8String OPTIONAL,
    nam                                 [15] UTF8String OPTIONAL,
    pc                                  [16] UTF8String OPTIONAL,
    bld                                 [17] UTF8String OPTIONAL,
    unit                                [18] UTF8String OPTIONAL,
    flr                                 [19] UTF8String OPTIONAL,
    room                                [20] UTF8String OPTIONAL,
    plc                                 [21] UTF8String OPTIONAL,
    pcn                                 [22] UTF8String OPTIONAL,
    pobox                               [23] UTF8String OPTIONAL,
    addcode                             [24] UTF8String OPTIONAL,
    seat                                [25] UTF8String OPTIONAL,
    rd                                  [26] UTF8String OPTIONAL,
    rdsec                               [27] UTF8String OPTIONAL,
    rdbr                                [28] UTF8String OPTIONAL,
    rdsubbr                             [29] UTF8String OPTIONAL
}

END
+69 −0
Changes for locationStructure/HI2OperationsLocation.asn: 69 added lines, 0 removed lines.
Original line number Diff line number Diff line
HI2OperationsLocation
{itu-t(0) identified-organization(4) etsi(0) securityDomain(2) lawfulIntercept(2) hi2Location(331) version17(18)}

-- This ASN.1 module provides a choice of location formats originally defined within TS 101 671.
--
-- Other than the top level CHOICE, the definitions in this ASN.1 module have been copied from 
-- structures originally defined in TS 101 671 V3.15.1 that were copied to
-- TS 102 232-1 to assist implementors of LI-PS-PDU.
-- The location formats in this module shall be equivalent to those defined in TS 101 671
-- so that the ASN.1 for each type encodes identically.


-- Editor's Note: It may be better to define this structure within LI-PS-PDU or within HI2Operations or to decide not to support these legacy formats.


DEFINITIONS IMPLICIT TAGS EXTENSIBILITY IMPLIED  ::=

BEGIN

IMPORTS

  -- previously from ETSI TS 101 671; now provided with ETSI TS 102 232-1 [1]
     TetraLocation,
     GSMLocation,
     UMTSLocation
       FROM HI2Operations
        {itu-t(0) identified-organization(4) etsi(0) securityDomain(2) lawfulIntercept(2) hi2(1) version17(18)};

Location ::= CHOICE
{
    e164-Number         [1] OCTET STRING (SIZE (1..25)),
        -- Coded in the same format as the ISUP location number (parameter field)
        -- of the ISUP (see EN 300 356).
    globalCellID        [2] OCTET STRING (SIZE (5..7)),
        -- See MAP format (see 3GPP TS 29.002).
    tetraLocation       [3] HI2Operations.TetraLocation,
        -- This optional parameter is not in use anymore, but is kept for backwards compatibility.
    rAI                 [4] OCTET STRING (SIZE (6)),
        -- The Routeing Area Identifier (RAI) in the current SGSN is coded in accordance with
        -- 3GPP TS 24.008 without the Routing Area Identification IEI (only the
        -- last 6 octets are used).
    gsmLocation         [5] HI2Operations.GSMLocation,
    umtsLocation        [6] HI2Operations.UMTSLocation,
    sAI                 [7] OCTET STRING (SIZE (7)),
        -- format:  PLMN-ID 3 octets (no. 1-3),
        --          LAC     2 octets (no. 4-5),
        --          SAC     2 octets (no. 6-7)
        --          (according to 3GPP TS 25.413).
    ...,
    oldRAI              [8] OCTET STRING (SIZE (6)),
        -- the "Routeing Area Identifier" in the old SGSN is coded in accordance with
        -- 3GPP TS 24.008 without the Routing Area Identification IEI
        -- (only the last 6 octets are used).
        -- This parameter is duplicated from 3GPP TS 33.108.
    tAI                 [9] OCTET STRING (SIZE (6)),
        -- The "Tracking Area Identity" (TAI) is coded in accordance with 3GPP TS 29.118
        -- without the TAI IEI.
        -- The tAI parameter is applicable only to the CS traffic cases where the available
        -- location information is the one received from the Mobility Management Entity (MME).
        -- This parameter is duplicated from 3GPP TS 33.108.
    eCGI                [10] OCTET STRING (SIZE (8))
        -- the "E-UTRAN Cell Global Identity" (E-CGI) is coded in accordance with
        -- 3GPP TS 29.118 without the E-CGI IEI.
        -- The eCGI parameter is applicable only to the CS traffic cases where
        -- the available location information is the one received from the MME.
        -- This parameter is duplicated from 3GPP TS 33.108.
}

END
 No newline at end of file
+199 −0
Changes for locationStructure/Location.asn: 199 added lines, 0 removed lines.
Original line number Diff line number Diff line
CommonLocations
{itu-t(0) identified-organization(4) etsi(0) securityDomain(2) lawfulIntercept(2) commonLocations(39) genHeader(1) version1(1)}

DEFINITIONS IMPLICIT TAGS EXTENSIBILITY IMPLIED ::=

BEGIN

IMPORTS
-- from ETSI TS 103 280 Common-Parameters
    WGS84CoordinateDecimal,
    WGS84LatitudeDecimal,
    WGS84LongitudeDecimal,
    MACAddress,
    CivicAddress,
    AngleDecimalDegrees,
    GMLShape,
    GNSSLocation
        FROM Common-Parameters
        {itu-t(0) identified-organization(4) etsi(0) common-parameters(3280) version271(271)}


    -- previously from ETSI TS 101 671; now provided with ETSI TS 102 232-1 [1]
    Location
       FROM HI2OperationsLocation
        {itu-t(0) identified-organization(4) etsi(0) securityDomain(2) lawfulIntercept(2) hi2Location(331) version17(18)};

    -- from 3GPP TS 33.108 [AA]
    -- Location
    --    FROM UmtsHI2Operations
    --    {itu-t(0) identified-organization(4) etsi(0) securityDomain(2) lawfulIntercept(2) threeGPP(4) hi2(1)}
            -- The relevant module (including the 3GPP release and version number) needs
            -- to be chosen when compiling the application.

    -- from 3GPP TS 33.108 [AA]
    -- EPSLocation
    --    FROM EpsHI2Operations
    --    {itu-t(0) identified-organization(4) etsi(0) securityDomain(2) lawfulIntercept(2) threeGPP(4) hi2eps(8)}
            -- The relevant module (including the 3GPP release and version number) needs
            -- to be chosen when compiling the application.

    -- from 3GPP TS 33.128 [46]
    -- Location
    --    FROM TS33128Payloads
    --    {itu-t(0) identified-organization(4) etsi(0) securityDomain(2) lawfulIntercept(2) threeGPP(4) ts33128(19)};
            -- The relevant module (including the 3GPP release and version number)
            -- needs to be chosen when compiling the application.

-- end of IMPORTS

-- =============================
-- Object Identifier Definitions
-- =============================

lawfulInterceptDomainId OBJECT IDENTIFIER ::= {itu-t(0) identified-organization(4) etsi(0) securityDomain(2) lawfulIntercept(2)}

commonLocations OBJECT IDENTIFIER ::= {lawfulInterceptDomainId commonLocations(39) genHeader(1) version1(1)}

-- ====================
-- Top-level definition
-- ====================


-- Issue 4, Point 4, Conclusion 3
Locations ::= SEQUENCE (SIZE (1..MAX)) OF Location
-- This structure will probably be better placed in whatever documents define 
-- the usage of the location structure rather than here, but it can just as
-- easily be defined here.

-- Point 5, Issue 5, Conclusion 4
Location ::= SEQUENCE
{
    locationInformation [1] LocationInformation,
    context             [2] STEIJE
}

--Source and Timing Extensible Information Jounral Entry
--Basically provenance without calling it that
STEIJE ::= SEQUENCE
{
    networkSTEIJE [1] LocationNetworkSTEIJE
}


-- Issue 4, Point 4, Conclusion 2
LocationInformation ::= CHOICE
{
    nativeFormat          [1] NativeLocationFormat,
    -- This is where we would add choices for imported location formats from other specifications. 
    -- These imports woudl ideally be a CHOICE of formats defined by that specification.
    -- For example:
    hI2OperationsLocation [2] HI2OperationsLocation.Location
}

NativeLocationFormat ::= SEQUENCE
{
    location            [1] LocationFormat,
    dynamicInformation  [2] DynamicInformation OPTIONAL
}

LocationFormat ::= CHOICE
{
    gMLShape         [1] Common-Parameters.GMLShape,
    gNSSLocation     [2] Common-Parameters.GNSSLocation,
    wlanAPMACAddress [3] Common-Parameters.MACAddress,  
    civicAddress     [4] Common-Parameters.CivicAddress,
    pIDFLO           [5] XMLType
}

LocationNetworkSTEIJE ::= SEQUENCE
{
    originalSource        [1] LocationSource,
    locationTimeStamps    [2] SEQUENCE (SIZE (1..MAX)) OF LocationTimestamp,
    additionalInformation [3] UTF8String OPTIONAL
}

LocationSource ::= ENUMERATED
{
    other(1),
    unknown(2),
    targetEquipmentOrClient(3),
    network(4)
}

LocationTimestamp ::= SEQUENCE
{
    timeStamp [1] GeneralizedTime,
    locationTimeStampQualifier [2] LocationTimeStampQualifier
}

LocationTimeStampQualifier ::= ENUMERATED
{
    unknown(1),
    timeOfInterception(2),
    timeOfMediation(3),
    timeOfCalculation(4),
    timeLastObserved(5)
}

XMLType ::= SEQUENCE
{
    xMLNamespace [1] XMLNamespace,
    xMLValue     [2] XMLValue
}

XMLNamespace ::= UTF8String

XMLValue ::= UTF8String


-- all Dynamic Types still need to be fleshed out and may be better in 103 280
DynamicInformation ::= SEQUENCE
{
    orientation [1] DynamicOrientation,
    speed       [2] VelocityMeters,
    heading     [3] DynamicHeading
}


-- This may require normative text clarifying "the angle according to what"
DynamicOrientation ::= SEQUENCE
{
    horizontalOrientation [1] Common-Parameters.AngleDecimalDegrees,
    verticalOrientation   [2] Common-Parameters.AngleDecimalDegrees OPTIONAL
}

-- INTEGER OR OtherFormat?
VelocityMeters ::= UTF8String

DynamicHeading ::= SEQUENCE
{
    horizontalHeading [1] Common-Parameters.AngleDecimalDegrees,
    verticalHeading   [2] Common-Parameters.AngleDecimalDegrees OPTIONAL
}

--LIProvenance ::= ENUMERATED
--{
--    other(1),
--    observed(2),
--    nFContext(3),
--    nFLookup(4)
--}

--LocationLIProvenance ::= SEQUENCE
--{
--    lIProvenance          [1] LIProvenance,
--    sourceNF              [2] SourceNF,
--    locationTimeStamps    [3] SEQUENCE (SIZE (1..MAX)) OF LocationTimestamp,
--    additionalInformation [4] UTF8String OPTIONAL
--}

--SourceNF ::= ENUMERATED
--{
--    aDMF(1),
--    tF(2),
--    pOI(3),
--    mDF(4)
--}

END
+3 −1
Changes for testing/asn/asn_compile_targets.json: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -27,7 +27,9 @@
    "./102232-3/IPAccessPDU.asn",
    "./102232-4/L2AccessPDU.asn",
    "./102232-5/IPMultimediaPDU.asn",
    "./102232-6/PstnIsdnPDU.asn"
    "./102232-6/PstnIsdnPDU.asn",
    "./locationStructure/Location.asn",
    "./locationStructure/HI2OperationsLocation.asn"
  ],
  [
    "./102657/RDMessage.asn"
+6 −4
Changes for testing/asn/asn_process.py: 6 added lines, 4 removed lines.
Original line number Diff line number Diff line
import logging
import json
import re
from pathlib import Path
from subprocess import run
from shutil import which
@@ -76,16 +77,17 @@ def syntaxCheckASN(fileList):
duplicateObjects = {
    "102232-1/LI-PS-PDU.asn": ["CCPayload", "IRIPayload", "Location"],
    "testing/mod1.asn": ["ClashField"],
    "locationStructure/Location.asn": ["Location"]
}


def fixDuplicateObjects(filename):
    stringContent = filename.read_text()
    for object in duplicateObjects[filename.as_posix()]:
        stringContent = stringContent.replace(f"{object} ::=", f"Native{object} ::=", 1)
        stringContent = stringContent.replace(
            f"SEQUENCE OF {object}", f"SEQUENCE OF Native{object}"
        )
#stringContent = stringContent.replace(f'{object} ::=', f'Native{object} ::=', 1)
        stringContent = re.sub(f"^({object} ::=)", 'Native\\1', stringContent, flags=re.MULTILINE)
        #stringContent = stringContent.replace(f'SEQUENCE OF {object}', f'SEQUENCE OF Native{object}')
        stringContent = re.sub(f"^SEQUENCE (\(SIZE \(\d+\.\.(\d+|(MAX))\)\) )*OF", 'SEQUENCE \\1OF Native\\3', stringContent, flags=re.MULTILINE)
        # stringContent = sub(f"]\\w{object}", f"] Native{object}", stringContent)

    Path("temp.asn").write_text(stringContent)