module yang-meta-types { namespace "urn:corenova:yang:yang-meta-types"; prefix meta; yang-version 1.1; import ietf-yang-types { prefix yang; } import ietf-inet-types { prefix inet; } import iana-crypt-hash { prefix ianach; } organization "Corenova Technologies, Inc."; contact "Peter K. Lee "; description "This module provides common metadata type definitions"; revision 2016-09-14 { description "Initial revision."; } /* * Type Definitions */ typedef meta-identifier { type yang:yang-identifier; } typedef title { type string { length 1..255; } } typedef description { type string; } typedef person-name { type string { length 1..255; } } typedef email-address { type string { pattern "[\\-_.a-zA-Z0-9]+@[\\-_.a-zA-Z0-9]+(\\.[\\-_.a-zA-Z0-9]+)*"; } description "Valid format of an email address."; } typedef person-contact { type string { pattern '["-\w,. ]+\s*(<.+?@.+?>)?\s*(\(.+?\))?'; } } typedef phone-number { type string { pattern "\\+?[0-9]+(-[0-9]+)*"; } description "Valid format of a phone number."; } typedef timezone { type string; } typedef password { type ianach:crypt-hash; } typedef empty-string { type string { length 0; } } typedef wildcard { type string { pattern '\*'; } } typedef semantic-version { type string { pattern '\d+\.\d+\.\d+(-.+)?'; } } typedef semantic-version-match { type union { type semantic-version; type string { pattern '([><~^]|<=|>=)\s*\d+\.[\dx]+(\.[\dx]+)?'; } type string { pattern '\d+\.[\dx]+(\.[\dx]+)?'; } type string { pattern '([><]|<=|>=)\s*\d+\.[\dx]+\.[\dx]+ ([><]|<=|>=)\s*\d+\.?[\dx]*\.?[\dx]*'; } // TODO: add support composite ranges with || } } typedef api-version { type string { pattern '\d+\.\d+'; } } typedef license { type yang:yang-identifier; description "TODO: should reference https://spdx.org/licenses for complete enumeration."; } typedef file-name { type string { length 0..255; //pattern '[\\\/\-\w\.]+'; // might be too restrictive... } } }