@@ -63,7 +63,15 @@ def setup_ctx(self, ctx):
63
63
'IETF_MISSING_TRUST_LEGAL_PROVISIONING' , 4 ,
64
64
'RFC 8407: 3.1: '
65
65
+ 'The IETF Trust Copyright statement seems to be'
66
- + ' missing or is not correct (see pyang --ietf-help for details).' )
66
+ + ' missing or is not correct'
67
+ + ' (see pyang --ietf-help for details).' )
68
+
69
+ error .add_error_code (
70
+ 'IETF_MISSING_RFC_TEXT' , 4 ,
71
+ 'RFC 8407: Appendix B: '
72
+ + 'The text about which RFC this module is part of seems to be'
73
+ + ' missing or is not correct'
74
+ + ' (see pyang --ietf-help for details).' )
67
75
68
76
def pre_validate_ctx (self , ctx , modules ):
69
77
for mod in modules :
@@ -91,6 +99,11 @@ def v_chk_description(self, ctx, s):
91
99
if y >= 2022 and arg .find ("Simplified" ) > 0 :
92
100
err_add (ctx .errors , s .pos ,
93
101
'IETF_MISSING_TRUST_LEGAL_PROVISIONING' , ())
102
+ if s .parent .arg .startswith ('ietf-' ):
103
+ m = re_ietf_rfc .search (arg )
104
+ if m is None :
105
+ err_add (ctx .errors , s .pos ,
106
+ 'IETF_MISSING_RFC_TEXT' , ())
94
107
if not self .mmap [s .i_module .arg ]['found_2119_keywords' ]:
95
108
if re_2119_keywords .search (arg ) is not None :
96
109
self .mmap [s .i_module .arg ]['found_2119_keywords' ] = True
@@ -123,6 +136,9 @@ def print_help():
123
136
Relating to IETF Documents
124
137
(https://trustee.ietf.org/license-info).
125
138
139
+ An IETF module (but not an IANA module) must also contain the
140
+ following text:
141
+
126
142
This version of this YANG module is part of RFC XXXX
127
143
(https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself
128
144
for full legal notices.
@@ -156,13 +172,16 @@ def print_help():
156
172
to the license terms contained in, the (Revised|Simplified) BSD License
157
173
set forth in Section 4\.c of the IETF Trust's Legal Provisions
158
174
Relating to IETF Documents
159
- \(https?://trustee.ietf.org/license-info\)\.
175
+ \(https?://trustee.ietf.org/license-info\)\."""
176
+
177
+ re_tlp = re .compile (re .sub (r'\s+' , ' ' , tlp_str ))
160
178
161
- This version of this YANG module is part of
179
+ ietf_rfc_str = \
180
+ r"""This version of this YANG module is part of
162
181
RFC .+(\s+\(https?://www.rfc-editor.org/info/rfc.+\))?; see
163
182
the RFC itself for full legal notices\."""
164
183
165
- re_tlp = re .compile (re .sub (r'\s+' , ' ' , tlp_str ))
184
+ re_ietf_rfc = re .compile (re .sub (r'\s+' , ' ' , ietf_rfc_str ))
166
185
167
186
re_2119_keywords = re .compile (
168
187
r"\b(MUST|REQUIRED|SHOULD|SHALL|RECOMMENDED|MAY|OPTIONAL)\b" )
0 commit comments