From e2f7e13bbba5b015ae67dea7e09d714dea2c572d Mon Sep 17 00:00:00 2001 From: "U-ERICSSON\\ETHBLL" Date: Fri, 11 Aug 2023 21:47:06 +0200 Subject: [PATCH 1/2] 28.623_Rel17_CR0265_Improve_Distinguished_Name_pattern_in_YANG --- yang-models/_3gpp-common-yang-types.yang | 82 +++++++++++++++++++++--- 1 file changed, 74 insertions(+), 8 deletions(-) diff --git a/yang-models/_3gpp-common-yang-types.yang b/yang-models/_3gpp-common-yang-types.yang index a837ccbb5..6cad18ea6 100755 --- a/yang-models/_3gpp-common-yang-types.yang +++ b/yang-models/_3gpp-common-yang-types.yang @@ -14,6 +14,7 @@ module _3gpp-common-yang-types { network slicing."; reference "3GPP TS 28.623"; + revision 2023-08-09 { reference CR-0265; } revision 2023-05-09 { reference CR-0249; } revision 2022-11-03 { reference "CR-0193"; } revision 2022-10-31 { reference CR-0195; } @@ -710,14 +711,79 @@ module _3gpp-common-yang-types { } } - typedef DistinguishedName { // TODO is this equivalent to TS 32.300 ? + /* DistinguishedName pattern is built up based on the + EBNF in 32.300 clause 7.3 EBNF of DN String Representation + + leaf DN { type string { // Same pattern as LocalDN + pattern '[A-Z][^,=+<>#;\\"\r\n*.]*=([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?(,[A-Z][^,=+<>#;\\"\r\n*.]*=([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?)*'; + } } + + leaf fullLocalDN { type string { // LocalRDN , { RDNSeparator , LocalRDN } RDNSeparator is a single , no space or \R allowed Me.mykey=1 allowed + // (fullLocalRDN)(,(fullLocalRDN))* + pattern '(([A-Z][^,=+<>#;\\"\r\n*.]*|([A-Z][^,=+<>#;\\"\r\n*.]*\.[a-z][^,=+<>#;\\"\r\n*.]*))=(([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?))(,(([A-Z][^,=+<>#;\\"\r\n*.]*|([A-Z][^,=+<>#;\\"\r\n*.]*\.[a-z][^,=+<>#;\\"\r\n*.]*))=(([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?)))*'; + } } + + leaf LocalDN { type string { // LocalRDN , { RDNSeparator , LocalRDN } RDNSeparator is a single , no space or \R allowed + // LocalRDN(,LocalRDN)* + pattern '[A-Z][^,=+<>#;\\"\r\n*.]*=([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?(,[A-Z][^,=+<>#;\\"\r\n*.]*=([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?)*'; + } } + + leaf fullLocalRDN { type string { // same as fullLocalDNAttributeTypeAndValue + pattern '([A-Z][^,=+<>#;\\"\r\n*.]*|([A-Z][^,=+<>#;\\"\r\n*.]*\.[a-z][^,=+<>#;\\"\r\n*.]*))=(([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?)'; + } } + + leaf LocalRDN { type string { // same as LocalDNAttributeTypeAndValue + pattern '[A-Z][^,=+<>#;\\"\r\n*.]*=([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?'; + } } + + leaf fullLocalDNAttributeTypeAndValue { type string { // LocalDNAttributeType , AttributeTypeAndValueSeparator , RegularAttributeValue + // pattern LocalDNAttributeType=RegularAttributeValue + pattern '([A-Z][^,=+<>#;\\"\r\n*.]*|([A-Z][^,=+<>#;\\"\r\n*.]*\.[a-z][^,=+<>#;\\"\r\n*.]*))=(([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?)'; + } } + + // limitation: NamesOfClassAndNamingAttributenot supported Me.mykey=1 + leaf LocalDNAttributeTypeAndValue { type string { + // ebnf1 LocalDNAttributeType , AttributeTypeAndValueSeparator , RegularAttributeValue + // ebnf2-limited NameOfClassWithIdAttribute , AttributeTypeAndValueSeparator , RegularAttributeValue + // pattern NameOfClassWithIdAttribute=RegularAttributeValue + pattern '[A-Z][^,=+<>#;\\"\r\n*.]*=([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?'; + } } + + leaf LocalDNAttributeType { type string { // NameOfClassWithIdAttribute | NamesOfClassAndNamingAttribute RDNSeparator is a single , no space or \R allowed + // NameOfClassWithIdAttribute|NamesOfClassAndNamingAttribute + pattern '[A-Z][^,=+<>#;\\"\r\n*.]*|([A-Z][^,=+<>#;\\"\r\n*.]*\.[a-z][^,=+<>#;\\"\r\n*.]*)'; + } } + + leaf RegularAttributeValue { type string { // ( AttributeValueChar – SpaceChar ) , [ { AttributeValueChar } , ( AttributeValueChar – SpaceChar ) ] + pattern '([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?' ; + } } + + leaf NamesOfClassAndNamingAttribute { type string { // ClassName , ClassNamingAttributeSeparator , NamingAttributeName + // pattern: ClassName\.NamingAttributeName + pattern '[A-Z][^,=+<>#;\\"\r\n*.]*\.[a-z][^,=+<>#;\\"\r\n*.]*' ; + } } + + leaf restrictiveClassName { type string { // + pattern '[a-zA-Z][a-zA-Z0-9-_]*' ; + } } + + leaf ClassName { type string { // CapitalLetterChar , { LocalDNAttributeTypeChar } + pattern '[A-Z][^,=+<>#;\\"\r\n*.]*' ; + } } + + leaf NamingAttributeName { type string { // SmallLetterChar , { LocalDNAttributeTypeChar } + pattern '[a-z][^,=+<>#;\\"\r\n*.]*' ; + } } + + */ + typedef DistinguishedName { type string { - pattern '([a-zA-Z][a-zA-Z0-9-]*=(\\( |#|\\|>|<|;|"|\+|,|[a-fA-F0-9]{2})|[^\\><;"+,# ])' - + '((\\( |#|\\|>|<|;|"|\+|,|[a-fA-F0-9]{2})|[^\\><;"+,])*' - + '(\\( |#|\\|>|<|;|"|\+|,|[a-fA-F0-9]{2})|[^\\><;"+, ]))?' - + '[,\+])*[a-zA-Z][a-zA-Z0-9-]*=(\\( |#|\\|>|<|;|"|\+|,|[a-fA-F0-9]{2})|[^\\><;"+,# ])' - + '((\\( |#|\\|>|<|;|"|\+|,|[a-fA-F0-9]{2})' - + '|[^\\><;"+,])*(\\( |#|\\|>|<|;|"|\+|,|[a-fA-F0-9]{2})|[^\\><;"+, ]))?'; + pattern '[A-Z][^,=+<>#;\\"\r\n*.]*=([^,=+<>#;\\"\r\n* ]|' + + '(\\[a-fA-F0-9]{2}))(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*' + + '([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?' + + '(,[A-Z][^,=+<>#;\\"\r\n*.]*=([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2}))' + + '(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*' + + '([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?)*'; } description "Represents the international standard for the representation of Distinguished Name (RFC 4512). @@ -737,7 +803,7 @@ module _3gpp-common-yang-types { CN=John Smith,OU=Sales,O=ACME Limited,L=Moab,ST=Utah,C=US"; reference "RFC 4512 Lightweight Directory Access Protocol (LDAP): Directory Information Models"; - } // recheck regexp it doesn't handle posix [:cntrl:] + } typedef QOffsetRange { type int8 { -- GitLab From cfdcdbb00479df27115b8ae6f240b30ff9dfbd07 Mon Sep 17 00:00:00 2001 From: "U-ERICSSON\\ETHBLL" Date: Fri, 11 Aug 2023 22:07:01 +0200 Subject: [PATCH 2/2] Updated DistinguishedName description --- yang-models/_3gpp-common-yang-types.yang | 26 ++++++++---------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/yang-models/_3gpp-common-yang-types.yang b/yang-models/_3gpp-common-yang-types.yang index 6cad18ea6..cc2323312 100755 --- a/yang-models/_3gpp-common-yang-types.yang +++ b/yang-models/_3gpp-common-yang-types.yang @@ -785,24 +785,14 @@ module _3gpp-common-yang-types { + '(([^,=+<>#;\\"\r\n*]|(\\[a-fA-F0-9]{2}))*' + '([^,=+<>#;\\"\r\n* ]|(\\[a-fA-F0-9]{2})))?)*'; } - description "Represents the international standard for the representation - of Distinguished Name (RFC 4512). - The format of the DistinguishedName REGEX is: - {AttributeType = AttributeValue} - - AttributeType consists of alphanumeric and hyphen (OIDs not allowed). - All other characters are restricted. - The Attribute value cannot contain control characters or the - following characters : \\ > < ; \" + , (Comma) and White space - The Attribute value can contain the following characters if they - are excaped : \\ > < ; \" + , (Comma) and White space - The Attribute value can contain control characters if its an escaped - double digit hex number. - Examples could be - UID=nobody@example.com,DC=example,DC=com - CN=John Smith,OU=Sales,O=ACME Limited,L=Moab,ST=Utah,C=US"; - reference "RFC 4512 Lightweight Directory Access Protocol (LDAP): - Directory Information Models"; + description "Represents the 3GPP standard for DistinguishedName. + + Limitations: + - RDNSeparator: don't allow SpaceChar or CarriageReturnChar + - NullDN: Disallow nullDN that is the same as not providing a DN + - NamesOfClassAndNamingAttribute format not allowed + (eg. ManagedElement.mykey=345436)"; + reference "3GPP TS 32.300"; } typedef QOffsetRange { -- GitLab