Skip to content

Commit c5d8994

Browse files
Petr Hanzlikmichalvasko
authored andcommitted
yanglint UPDATE add command for IETF validation
1 parent 93c66d2 commit c5d8994

23 files changed

Lines changed: 2072 additions & 2 deletions
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module bad-ietf-prefix-namespace {
2+
yang-version 1.1;
3+
namespace "urn:wrong:namespace";
4+
prefix bpn;
5+
6+
organization "IETF NETMOD Working Group";
7+
contact "WG Web: <https://datatracker.ietf.org/wg/netmod/>";
8+
9+
description
10+
"Copyright (c) 2026 IETF Trust and the persons identified as
11+
authors of the code. All rights reserved.
12+
13+
Redistribution and use in source and binary forms, with or
14+
without modification, is permitted pursuant to, and subject
15+
to the license terms contained in, the Revised BSD License
16+
set forth in Section 4.c of the IETF Trust's Legal Provisions
17+
Relating to IETF Documents
18+
(https://trustee.ietf.org/license-info).
19+
20+
This version of this YANG module is part of RFC XXXX; see
21+
the RFC itself for full legal notices.";
22+
23+
revision 2026-07-08 {
24+
// Triggers 4.8: Missing "reference" and "description" inside the revision block
25+
}
26+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module ietf-bad-boilerplate {
2+
yang-version 1.1;
3+
namespace "urn:ietf:params:xml:ns:yang:ietf-bad-boilerplate";
4+
prefix ibb;
5+
6+
organization "IETF NETMOD Working Group";
7+
contact "WG Web: <https://datatracker.ietf.org/wg/netmod/>";
8+
9+
// 1. Missing IETF Trust Copyright (Triggers 3.1)
10+
// 2. Missing "This version of this YANG module is part of RFC..." (Triggers Appendix B)
11+
// 3. Uses the word "MUST", but lacks the RFC 8174 text block (Triggers BCP 14 check)
12+
description
13+
"This module MUST intentionally fail the text boilerplate checks.";
14+
15+
revision 2026-07-08 {
16+
description "Initial revision.";
17+
reference "RFC XXXX: Test Module";
18+
}
19+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
module ietf-correct {
2+
yang-version 1.1;
3+
namespace "urn:ietf:params:xml:ns:yang:ietf-correct";
4+
prefix isc;
5+
6+
organization
7+
"IETF NETMOD Working Group";
8+
9+
contact
10+
"WG Web: <https://datatracker.ietf.org/wg/netmod/>";
11+
12+
description
13+
"Copyright (c) 2026 IETF Trust and the persons identified as
14+
authors of the code. All rights reserved.
15+
16+
Redistribution and use in source and binary forms, with or
17+
without modification, is permitted pursuant to, and subject
18+
to the license terms contained in, the Revised BSD License
19+
set forth in Section 4.c of the IETF Trust's Legal Provisions
20+
Relating to IETF Documents
21+
(https://trustee.ietf.org/license-info).
22+
23+
This version of this YANG module is part of RFC XXXX; see
24+
the RFC itself for full legal notices.";
25+
26+
revision 2026-07-08 {
27+
description
28+
"Initial revision.";
29+
reference
30+
"RFC XXXX: Test Module";
31+
}
32+
33+
container system-info {
34+
description
35+
"A simple top-level container to hold our data. Notice it is
36+
not mandatory.";
37+
38+
leaf system-name {
39+
type string;
40+
description
41+
"The configured name of the system.";
42+
}
43+
44+
leaf status {
45+
type enumeration {
46+
enum active {
47+
description
48+
"The system is currently active and processing.";
49+
}
50+
enum inactive {
51+
description
52+
"The system is currently inactive.";
53+
}
54+
}
55+
description
56+
"The current operational status of the system. Notice there
57+
is no explicit 'config true' or 'mandatory false' here.";
58+
}
59+
}
60+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
module ietf-defaults-and-mandatory {
2+
yang-version 1.1;
3+
namespace "urn:ietf:params:xml:ns:yang:ietf-defaults-and-mandatory";
4+
prefix idm;
5+
6+
organization "IETF NETMOD Working Group";
7+
contact "WG Web: <https://datatracker.ietf.org/wg/netmod/>";
8+
description
9+
"Copyright (c) 2026 IETF Trust and the persons identified as
10+
authors of the code. All rights reserved.
11+
12+
Redistribution and use in source and binary forms, with or
13+
without modification, is permitted pursuant to, and subject
14+
to the license terms contained in, the Revised BSD License
15+
set forth in Section 4.c of the IETF Trust's Legal Provisions
16+
Relating to IETF Documents
17+
(https://trustee.ietf.org/license-info).
18+
19+
This version of this YANG module is part of RFC XXXX; see
20+
the RFC itself for full legal notices.";
21+
22+
revision 2026-07-08 {
23+
description "Initial revision.";
24+
reference "RFC XXXX: Test Module";
25+
}
26+
27+
extension ext1 {
28+
description "Ext description";
29+
argument arg1 {
30+
// Triggers 4.4: yin-element given with default
31+
yin-element false;
32+
}
33+
}
34+
35+
// Triggers 4.10: Top-level node cannot be mandatory
36+
leaf top-mand-leaf {
37+
type string;
38+
description "Top level mandatory";
39+
mandatory true;
40+
}
41+
42+
leaf bad-defaults-leaf {
43+
type string;
44+
description "Leaf with explicit defaults";
45+
// Triggers 4.4: config true
46+
config true;
47+
// Triggers 4.4: status current
48+
status current;
49+
// Triggers 4.4: mandatory false
50+
mandatory false;
51+
}
52+
53+
list bad-list {
54+
key "k";
55+
description "List with explicit defaults";
56+
ordered-by system;
57+
leaf k {
58+
type string;
59+
description "Key";
60+
}
61+
// Triggers 4.4: min-elements 0
62+
min-elements 0;
63+
// Triggers 4.4: max-elements unbounded
64+
max-elements unbounded;
65+
}
66+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
module ietf-empty-type {
2+
yang-version 1.1;
3+
namespace "urn:ietf:params:xml:ns:yang:ietf-empty-type";
4+
prefix eett;
5+
6+
organization
7+
"IETF NETMOD (Network Modeling) Working Group";
8+
9+
contact
10+
"WG Web: <https://datatracker.ietf.org/wg/netmod/>
11+
WG List: <mailto:netmod@ietf.org>
12+
13+
Author: Test Author
14+
<mailto:test@example.com>";
15+
16+
description
17+
"Copyright (c) 2026 IETF Trust and the persons identified as
18+
authors of the code. All rights reserved.
19+
20+
Redistribution and use in source and binary forms, with or
21+
without modification, is permitted pursuant to, and subject
22+
to the license terms contained in, the Revised BSD License
23+
set forth in Section 4.c of the IETF Trust's Legal Provisions
24+
Relating to IETF Documents
25+
(https://trustee.ietf.org/license-info).
26+
27+
This version of this YANG module is part of RFC XXXX; see
28+
the RFC itself for full legal notices.";
29+
30+
revision 2026-07-10 {
31+
description
32+
"Initial revision. Testing empty types in keys and leaf-lists.";
33+
reference
34+
"RFC XXXX: Guidelines for Authors and Reviewers of YANG Data Models";
35+
}
36+
37+
container top-container {
38+
description
39+
"A top level container to hold our test lists.";
40+
41+
/* TEST 1: Trigger the 'empty' type in list key warning */
42+
list list-with-empty-key {
43+
key "id";
44+
description
45+
"A list to test the empty key warning.";
46+
47+
/* TEST 2: Trigger the 'empty' type in leaf */
48+
leaf id {
49+
type empty;
50+
description
51+
"Key leaf of type empty.";
52+
}
53+
}
54+
55+
/* TEST 3: Trigger the 'empty' type in leaf-list warning */
56+
leaf-list leaf-list-with-empty-type {
57+
type empty;
58+
description
59+
"A leaf-list to test the empty type warning.";
60+
}
61+
}
62+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
module ietf-example-this-identifier-is-intentionally-designed-to-exceed-64-chars {
2+
yang-version 1.1;
3+
namespace "urn:ietf:params:xml:ns:yang:ietf-example-this-identifier-is-intentionally-designed-to-exceed-64-chars";
4+
prefix isc;
5+
6+
organization
7+
"IETF NETMOD Working Group";
8+
9+
contact
10+
"WG Web: <https://datatracker.ietf.org/wg/netmod/>";
11+
12+
description
13+
"Copyright (c) 2026 IETF Trust and the persons identified as
14+
authors of the code. All rights reserved.
15+
16+
Redistribution and use in source and binary forms, with or
17+
without modification, is permitted pursuant to, and subject
18+
to the license terms contained in, the Revised BSD License
19+
set forth in Section 4.c of the IETF Trust's Legal Provisions
20+
Relating to IETF Documents
21+
(https://trustee.ietf.org/license-info).
22+
23+
This version of this YANG module is part of RFC XXXX; see
24+
the RFC itself for full legal notices.";
25+
26+
revision 2026-07-08 {
27+
description
28+
"Initial revision.";
29+
reference
30+
"RFC XXXX: Test Module";
31+
}
32+
33+
extension this-extension-identifier-is-intentionally-designed-to-exceed-64-chars {
34+
description
35+
"Testing extension identifier length.";
36+
}
37+
38+
feature this-feature-identifier-is-intentionally-designed-to-exceed-64-chars {
39+
description
40+
"Testing feature identifier length.";
41+
}
42+
43+
identity this-identity-identifier-is-intentionally-designed-to-exceed-64-chars {
44+
description
45+
"Testing identity identifier length.";
46+
}
47+
48+
typedef this-typedef-identifier-is-intentionally-designed-to-exceed-64-chars {
49+
type string;
50+
description
51+
"Testing typedef identifier length.";
52+
}
53+
54+
grouping this-grouping-identifier-is-intentionally-designed-to-exceed-64-chars {
55+
description
56+
"Testing grouping identifier length.";
57+
58+
leaf dummy-leaf {
59+
type string;
60+
description "Needed a child to make grouping valid.";
61+
}
62+
}
63+
64+
container this-container-identifier-is-intentionally-designed-to-exceed-64-chars {
65+
description
66+
"Testing data node identifier length.";
67+
68+
leaf enum-tester {
69+
type enumeration {
70+
enum this-enum-identifier-is-intentionally-designed-to-exceed-64-chars {
71+
description
72+
"Testing enum identifier length.";
73+
}
74+
}
75+
description
76+
"Leaf to hold the long enum.";
77+
}
78+
79+
leaf bits-tester {
80+
type bits {
81+
bit this-bit-identifier-is-intentionally-designed-to-exceed-64-chars {
82+
description
83+
"Testing bit identifier length.";
84+
}
85+
}
86+
description
87+
"Leaf to hold the long bit.";
88+
}
89+
}
90+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module ietf-imported-module {
2+
yang-version 1.1;
3+
namespace "urn:ietf:params:xml:ns:yang:ietf-imported-module";
4+
prefix iim;
5+
6+
organization "IETF NETMOD Working Group";
7+
contact "WG Web: <https://datatracker.ietf.org/wg/netmod/>";
8+
description
9+
"Copyright (c) 2026 IETF Trust and the persons identified as
10+
authors of the code. All rights reserved.
11+
12+
Redistribution and use in source and binary forms, with or
13+
without modification, is permitted pursuant to, and subject
14+
to the license terms contained in, the Revised BSD License
15+
set forth in Section 4.c of the IETF Trust's Legal Provisions
16+
Relating to IETF Documents
17+
(https://trustee.ietf.org/license-info).
18+
19+
This version of this YANG module is part of RFC 9907; see
20+
the RFC itself for full legal notices.";
21+
22+
revision 2026-07-10 {
23+
description "Initial revision.";
24+
reference "RFC 9907";
25+
}
26+
}

0 commit comments

Comments
 (0)