Commit e2f7e13b authored by lengyelb's avatar lengyelb Committed by lengyelb
Browse files

28.623_Rel17_CR0265_Improve_Distinguished_Name_pattern_in_YANG

parent 9c88da97
Loading
Loading
Loading
Loading
+74 −8
Original line number Diff line number Diff line
@@ -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 {