-
Notifications
You must be signed in to change notification settings - Fork 2
/
yang-problems.txt
80 lines (61 loc) · 3.06 KB
/
yang-problems.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Overall observation:
RFC 6020 is a "legal" or "committee" document meant only for human consumption.
It is not meant to be executable (i.e. not meant to be consumed by machine to define a parser)
-----------------------------------------------------------------------------
From the InstaParse docs:
However, in ABNF notation, angle brackets are meant to be used for prose descriptions of
some concept that can't be mechanically specified in the grammar. For example:
P = <a prime number>
-----------------------------------------------------------------------------
One may interepret the ABNF from RFC 6020 as a kind of "loose upper bound". That's kind of like
saying "Alan cannot jump higher than 10 feet". This does not
- tell you exactly how high Alan can jump
- tell you anything about how high Alan can jump relative to other people.
- tell you how to calculate Alan's max jump height
- it only tells you that anything that can jump 10 feet (or higher) isn't Alan
-----------------------------------------------------------------------------
Examples from RFC 6020:
p18, Defining "decimal64" as "64-bit decimal" is stupid. Either make it float/double, float32/float64, or BigDecimal.
p142, "This grammar assumes that the scanner replaces YANG comments with a single space character."
p162, string = < an unquoted string as returned by the scanner >
p162,
1. duplication: why are there 2 def's?
identifier-arg-str = < a string that matches the rule identifier-arg >
identifier-arg = identifier
The reason is that these expressions are all interpreted the same by YANG:
int year ;
int "year" ;
"int" year ;
"int" "year" ;
From the RFC:
"The following strings are equivalent:"
---------------------------------
hello
"hello"
'hello'
"hel" + "lo"
'hel' + "lo"
---------------------------------
2. no (practical) way for ABNF to reject "xmlName", "XmlName", "xml-name", "XML-name", etc
;; An identifier MUST NOT start with (('X'|'x') ('M'|'m') ('L'|'l'))
identifier = (ALPHA / "_")
*(ALPHA / DIGIT / "_" / "-" / ".")
3. which one is it (problem since '*' isn't greedy like in regex)
1*("abc...xyz")
name -> [:ident "name"]
name -> [ [:ident "n"] [:ident "a"] [:ident "m"] [:ident "e"] ]
-----------------------------------------------------------------------------
Deficiencies
Yang has nothing like a typedef form C/C++. I cannot define a type "complex" { float real; float imag;}
Grouping/Uses doesn't work
`list` could be forced to work but the required `key` value is stupid & it's still not a typedef.
BTW, `typedef` in yang can only narrow existing types and cannot define a record or struct (that
is what "list" is for! Stupid name!)
Example "brocade-rbridge.yang" shows this stupid/ambiguous example:
list rbridge-id {
key rbridge-id;
leaf rbridge-id {
type uint32;
}
...
}