idnits 2.17.1 draft-srivastav-netmod-formulae-00.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == It seems as if not all pages are separated by form feeds - found 0 form feeds but 28 pages Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (September 2017) is 2405 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'RFC6241' is mentioned on line 127, but not defined == Missing Reference: 'RFC3688' is mentioned on line 1213, but not defined Summary: 0 errors (**), 0 flaws (~~), 4 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group S.K.Srivastav 3 Internet-Draft September 2017 4 Intended status: Standards Track 5 Expires: March 2018 7 YANG extension Statements for formulae modeling 8 draft-srivastav-netmod-formulae-00 10 Abstract 12 Operational data can be divided into multiple categories like i) 13 state data, ii) raw performance counter, iii) Derived/calculated 14 Counters by arithmetic operation on raw performance counters also 15 referred as KPIs. Existing YANG built-in-types only define the way to 16 model the state data and raw performance counters but have no 17 provision for modelling derived performance counters representing an 18 equivalent of a simple mathematical formula. 20 This document define extensions for the modeling language YANG as new 21 language statements, which introduce a method to model KPIs aka 22 mathematical expression in YANG data modeling language and describes 23 the syntax and semantics of newly added . 25 As KPIs require limited number of mathematical operations viz. +, /, 26 -, *,minimum, maximum, summation are needed. Hence, +, /, -, 27 *,minimum, maximum, summation are needed. Hence, our proposal is to 28 enhance YANG to support formula based nodes for these basic 29 arithmetic operations. YANG is enhanced to model KPI formulae with 30 basic arithmetic operations. 32 Status of this Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at http://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 Copyright Notice 49 Copyright (c) 2017 IETF Trust and the persons identified as the 50 document authors. All rights reserved. 52 This document is subject to BCP 78 and the IETF Trust's Legal 53 Provisions Relating to IETF Documents 54 (http://trustee.ietf.org/license-info) in effect on the date of 55 publication of this document. Please review these documents 56 carefully, as they describe your rights and restrictions with respect 57 to this document. Code Components extracted from this document must 58 include Simplified BSD License text as described in Section 3.e of 59 the Trust Legal Provisions and are provided without warranty as 60 described in the Simplified BSD License. 62 Table of Contents 64 1. Introduction and overview . . . . . . . . . . . . . . . . . . 5 65 2. NETCONF Enhancement. . . . . . . . . . . . . . . . . . . . . . 5 66 3. MATH types Statements. . . . . . . . . . . . . . . . . . . . . 5 67 3.1. The "mt:math" Statement . . . . . . . . . . . . . . . . 5 68 3.1.1. The mt:math's Substatements. . . . . . . . . . . 5 69 3.2. The "mt:addition " Statement. . . . . . . . . . . . . . .6 70 3.2.1. The mt:addition 's Substatements. . . . . . . . .6 71 3.2.2. The mt:addend Statements. . . . . . . . . . . . .6 72 3.2.2.1 The mt:addend Substatements. . . . . .6 73 3.3. The "mt:subtraction" Statement. . . . . . . . . . . . . .6 74 3.3.1. The mt:subtraction's Substatements. .. . . . . . 7 75 3.3.2. The "mt:minuend" Statement. . . . . . . . . . . .7 76 3.3.2.1 The "mt:minuend" Substatements . . . . .7 77 3.3.3. The "mt:subtrahend" Statement. . . . . . . . . .7 78 3.3.3.1 mt:subtrahend Substatements. . . . . . .7 79 3.4. The "mt:multiplication" Statement. . . . . . . . . . . . 8 80 3.4.1. The mt:multiplication's Substatements . . . . . .8 81 3.4.2. The "mt:multiplier" Statement. . . . . . . . . . 8 82 3.4.2.1. mt:multiplier Substatements. . . . . . .8 83 3.5. The "mt:division" Statement. . . . . . . . . . . . . . .9 84 3.5.1. The mt:division's Substatements. . . . . . . . . 9 85 3.5.2. The "mt:dividend" Statement. . . . . . . . . . . 9 86 3.5.2.1. mt:dividend Substatements. . . . . . . .9 87 3.5.3. The "mt:divisor" Statement. . . . . . . . . . . 9 88 3.5.3.1. mt:divisor Substatements. . . . . . . . 9 89 3.6. The "mt:summation" Statement. . . . . . . . . . . . . . .10 90 3.6.1. The mt:summation's Substatements. . . . . . . . .10 91 3.6.2. The "mt:loop" Statement. . . . . . . . . . . . . 10 92 3.6.2.1 mt:loop Substatements.. . . . . . . . . .10 93 3.6.2.2 Example. . . . . . . . . . . . . . . . . 10 94 3.7. The "mt:min" Statement. . . . . . . . . . . . . . . . . .11 95 3.7.1. The mt:min's Substatements. . . . . . . . . . . .11 96 3.7.2. The mt:event Statement. . . . . . . . . . . . . .11 97 3.7.3. The mt:event's Substatements. . . . . . . . . . .11 98 3.7.4. Example. . . . . . . . . . . . . . . . . . . . . 12 99 3.7.5. Example. . . . . . . . . . . . . . . . . . . . . 12 100 3.7.6. Example. . . . . . . . . . . . . . . . . . . . . 13 101 3.8. The "mt:max" Statement. . . . . . . . . . . . . . . . . .14 102 3.8.1. The mt:max's Substatements. . . . . . . . . . . .14 103 3.8.2. Example. . . . . . . . . . . . . . . . . . . . . 14 104 3.8.3. Example. . . . . . . . . . . . . . . . . . . . . 15 105 3.8.4. Example. . . . . . . . . . . . . . . . . . . . . 16 106 3.9. The "mt:const" Statement. . . . . . . . . . . . . . . . .16 107 3.9.1. The mt:const's Substatements. . . . . . . . . . .16 108 3.10. Usage example of expression statements. . . . . . . . . .16 109 3.10.1. Sample Example. . . . . . . . . . . . . . . . . .16 110 3.10.2. 3GPP Standard formula(3GPP TS 32.450) . . . . . .19 111 3.11. YIN. . . . . . . . . . . . . . . . . . . . . . . . . . . 20 112 3.11.1. Example. . . . . . . . . . . . . . . . . . . . . 21 113 3.12. YANG ABNF Grammar. . . . . . . . . . . . . . . . . . . . 22 114 3.13. XML Mapping Rules. . . . . . . . . . . . . . . . . . . .25 115 4. Extension Definition Module. . . . . . . . . . . . . . . . . . 25 116 5. IANA Considerations. . . . . . . . . . . . . . . . . . . . . . 27 117 6. Security Considerations . . . . . . . . . . . . . . . . . . . .27 118 7. References. . . . . . . . . . . . . . . . . . . . . . . . . . 28 119 7.1. Normative References . . . . . . . . . . . . . . . . . . 28 120 Authors' Addresses. . . . . . . . . . . . . . . . . . . . . . . . .28 122 1. Introduction and Overview 124 YANG is a data modeling language originally designed to model 125 configuration and state data manipulated by the Network Configuration 126 Protocol (NETCONF), NETCONF Remote Procedure Calls, and NETCONF 127 notifications [RFC6241]. 128 This document define and describes the syntax and semantics of new 129 YANG extension statements for expression modelling. 130 In future, telco's will be moving towards highly automated 131 virtualized network to get lesser vender dependency and to have 132 freedom to change and deploy services dynamically in less time. To do 133 that they need good statistics and highly adaptable analytics engine 134 that can adapt KPIs for new/changed services. They can not wait to 135 get analytic engine changed to support new/Change service. To achieve 136 that kind of automation and less time to market in service deployment 137 in telco network, formula modelling in yang is necessary. In summary 138 Formula modelling in standard helps to develop generic/highly 139 adaptable Analytics Engine framework for future Telco network which 140 learns the formula on fly and apply on received statistics. 141 Note that this document does not obsolete RFC 6020 [RFC6020]. 143 2. NETCONF Enhancement 145 To support mathematical exprssion with enhanced YANG DML, NETCONF 146 protocol should be enhanced to parse and understand the newly added, 147 enhanced extension statements as described in below sections. 148 NETCONF protocol should exchange its mathematical expression 149 capabilty with client establishing session. 151 3. MATH types Statements 153 This draft proposes definition of math type extension statement using 154 YANG extension and method to model mathematical expression using 155 those new defined statements. 157 3.1. The "mt:math" Statement 159 This statement allows a module or submodule to define a mathematical 160 expression in a schema tree. It takes one argument, which is an 161 identifier, followed by a block of substatements that holds detailed 162 mathematical expression. This node is always root of mathematical 163 expression tree in YANG. 165 3.1.1 The mt:math's Substatements 167 +------------------+----------------+-------------+ 168 | substatement | section | cardinality | 169 +------------------+----------------+-------------+ 170 | leaf | rfc6020 7.10 | 0..1 | 171 | mt:subtraction | 3.3 | 0..1 | 172 | mt:addition | 3.2 | 0..1 | 173 | mt:division | 3.5 | 0..1 | 174 | mt:multiplication| 3.4 | 0..1 | 175 | Description | rfc6020 7.19.3 | 0..1 | 176 | mt:summation | 3.6 | 0..1 | 177 +------------------+----------------+-------------+ 179 3.2. The "mt:addition" Statement 181 This statement allows a module or submodule to define a mt:addition 182 node in a schema tree of mathematical expression. It takes one 183 argument, which is an identifier, followed by a block of 184 substatements that holds detailed mathematical expression. 186 3.2.1 The mt:addition 's Substatements 188 +---------------+----------------+-------------+ 189 | substatement | section | cardinality | 190 +---------------+----------------+-------------+ 191 | leaf | rfc6020 7.10 | 0..1 | 192 | Description | rfc6020 7.19.3 | 0..1 | 193 | mt:addend | 3.2.1 | 2..n | 194 +---------------+----------------+-------------+ 196 3.2.2 The mt:addend Statement 198 This substatement specifies name or refernce of node to be added. It 199 takes one argument, which is an identifier, followed by a block of 200 substatements that holds detailed mathematical expression. 202 3.2.2.1 mt:addend Substatement's 204 +------------------+----------------+-------------+ 205 | substatement | section | cardinality | 206 +------------------+----------------+-------------+ 207 | leaf | rfc6020 7.10 | 0..1 | 208 | mt:subtraction | 3.3 | 0..1 | 209 | mt:addition | 3.2 | 0..1 | 210 | mt:division | 3.5 | 0..1 | 211 | mt:multiplication| 3.4 | 0..1 | 212 | Description | rfc6020 7.19.3 | 0..1 | 213 +------------------+----------------+-------------+ 215 3.3. The "mt:subtraction" Statement 217 This statement allows a module or submodule to define a 218 mt:subtraction node in a schema tree of mathematical expression.It 219 takes one argument, which is an identifier, followed by a block of 220 substatements that holds detailed mathematical expression. 222 3.3.1 The mt:subtraction's Substatements 224 +---------------+----------------+-------------+ 225 | substatement | section | cardinality | 226 +---------------+----------------+-------------+ 227 | leaf | rfc6020 7.10 | 0..1 | 228 | Description | rfc6020 7.19.3 | 0..1 | 229 | mt:minuend | 3.3.2 | 1 | 230 | mt:subtrahend | 3.3.3 | 1 | 231 +---------------+----------------+-------------+ 233 3.3.2 The "mt:minuend" Statement 235 This substatement specifies name or refernce of mt:minuend node. It 236 takes one argument, which is an identifier, followed by a block of 237 substatements that holds detailed mathematical expression. 239 3.3.2.1 mt:minuend Substatement's 241 +------------------+----------------+-------------+ 242 | substatement | section | cardinality | 243 +------------------+----------------+-------------+ 244 | leaf | rfc6020 7.10 | 0..1 | 245 | mt:subtraction | 3.3 | 0..1 | 246 | mt:addition | 3.2 | 0..1 | 247 | mt:division | 3.5 | 0..1 | 248 | mt:multiplication| 3.4 | 0..1 | 249 | Description | rfc6020 7.19.3 | 0..1 | 250 +------------------+----------------+-------------+ 252 3.3.3 The "mt:subtrahend" Statement 254 This substatement specifies name or refernce of mt:subtrahend node. 255 It takes one argument, which is an identifier, followed by a block of 256 substatements that holds detailed mathematical expression. 258 3.3.3.1 mt:subtrahend substatement's 260 +------------------+----------------+-------------+ 261 | substatement | section | cardinality | 262 +------------------+----------------+-------------+ 263 | leaf | rfc6020 7.10 | 0..1 | 264 | mt:subtraction | 3.3 | 0..1 | 265 | mt:addition | 3.2 | 0..1 | 266 | mt:division | 3.5 | 0..1 | 267 | mt:multiplication| 3.4 | 0..1 | 268 | Description | rfc6020 7.19.3 | 0..1 | 269 +------------------+----------------+-------------+ 271 3.4. The "mt:multiplication" Statement 273 This statement allows a module or submodule to define a 274 mt:multiplication node in a schema tree of mathematical expression. 275 It takes one argument, which is an identifier, followed by a block of 276 substatements that holds detailed mathematical expression. 278 3.4.1 The mt:multiplication's Substatements 280 +---------------+----------------+-------------+ 281 | substatement | section | cardinality | 282 +---------------+----------------+-------------+ 283 | leaf | rfc6020 7.10 | 0..1 | 284 | Description | rfc6020 7.19.3 | 0..1 | 285 | mt:multiplier | 3.4.2 | 2..n | 286 +---------------+----------------+-------------+ 288 3.4.2 The "mt:multiplier" Statement 290 This substatement specifies name or refernce of mt:multiplier node. 291 It takes one argument, which is an identifier, followed by a block of 292 substatements that holds detailed mathematical expression. 294 3.4.2.1 mt:multiplier substatement's 296 +------------------+----------------+-------------+ 297 | substatement | section | cardinality | 298 +------------------+----------------+-------------+ 299 | leaf | rfc6020 7.10 | 0..1 | 300 | mt:subtraction | 3.3 | 0..1 | 301 | mt:addition | 3.2 | 0..1 | 302 | mt:division | 3.5 | 0..1 | 303 | mt:multiplication| 3.4 | 0..1 | 304 | Description | rfc6020 7.19.3 | 0..1 | 305 +------------------+----------------+-------------+ 307 3.5. The "mt:division" Statement 309 This statement allows a module or submodule to define a mt:division 310 node in a schema tree of mathematical expression. It takes one 311 argument, which is an identifier, followed by a block of 312 substatements that holds detailed mathematical expression. 314 3.5.1 The mt:division's Substatements 316 +---------------+----------------+-------------+ 317 | substatement | section | cardinality | 318 +---------------+----------------+-------------+ 319 | leaf | rfc6020 7.10 | 0..1 | 320 | Description | rfc6020 7.19.3 | 0..1 | 321 | mt:dividend | 3.5.2 | 1 | 322 | mt:divisor | 3.5.3 | 1 | 323 +---------------+----------------+-------------+ 325 3.5.2 The "mt:dividend" Statement 327 This substatement specifies name or refernce of mt:dividend node. It 328 takes one argument, which is an identifier, followed by a block of 329 substatements that holds detailed mathematical expression. 331 3.5.2.1 mt:dividend substatement's 333 +------------------+----------------+-------------+ 334 | substatement | section | cardinality | 335 +------------------+----------------+-------------+ 336 | leaf | rfc6020 7.10 | 0..1 | 337 | mt:subtraction | 3.3 | 0..1 | 338 | mt:addition | 3.2 | 0..1 | 339 | mt:division | 3.5 | 0..1 | 340 | mt:multiplication| 3.4 | 0..1 | 341 | Description | rfc6020 7.19.3 | 0..1 | 342 +------------------+----------------+-------------+ 344 3.5.3 The "mt:divisor" Statement 346 This substatement specifies name or refernce of mt:divisor node. It 347 takes one argument, which is an identifier, followed by a block of 348 substatements that holds detailed mathematical expression. 350 3.5.3.1 mt:divisor substatement's 352 +------------------+----------------+-------------+ 353 | substatement | section | cardinality | 354 +------------------+----------------+-------------+ 355 | leaf | rfc6020 7.10 | 0..1 | 356 | mt:subtraction | 3.3 | 0..1 | 357 | mt:addition | 3.2 | 0..1 | 358 | mt:division | 3.5 | 0..1 | 359 | mt:multiplication| 3.4 | 0..1 | 360 | Description | rfc6020 7.19.3 | 0..1 | 361 +------------------+----------------+-------------+ 363 3.6. The "mt:summation" Statement 365 This statement allows a module or submodule to define a Summation 366 node in a schema tree of mathematical expression. It takes one 367 argument, which is an identifier, followed by a block of 368 substatements that holds detailed mathematical expression. 370 3.6.1 The mt:summation's Substatements 372 +---------------+----------------+-------------+ 373 | substatement | section | cardinality | 374 +---------------+----------------+-------------+ 375 | leaf | rfc6020 7.10 | 1 | 376 | Description | rfc6020 7.19.3 | 0..1 | 377 | mt:loop | 3.6.2 | 1..n | 378 +---------------+----------------+-------------+ 380 3.6.2 The "mt:loop" Statement 382 This substatement specifies mt:summation index refernce. It takes one 383 argument, which is an identifier, followed by a block of 384 substatements that holds detailed mathematical expression. leaf 385 substatement of this statement can only be of type leafref.Range of 386 mt:summation index will be the range of refered leaf. 388 3.6.2.1 mt:loop substatement's 390 +---------------+----------------+-------------+ 391 | substatement | section | cardinality | 392 +---------------+----------------+-------------+ 393 | leaf | rfc6020 7.10 | 0..1 | 394 | Description | rfc6020 7.19.3 | 0..1 | 395 +---------------+----------------+-------------+ 397 3.6.2.2 Example 399 sum a, where a goes from 1 to 5. 400 container formula { 401 list elements{ 402 leaf a { 403 type uint32{ 404 range "1..5" 405 } 406 } 407 } mt:math suma { 408 mt:summation a { 409 mt:loop index { 410 leaf a { 411 type leafref { 412 path "../../../elements/a"; 413 } 414 } 415 } 416 } 417 } 418 } 420 3.7. The "mt:min" Statement 422 This statement allows a module or submodule to define a Minimum node 423 in a schema tree of mathematical expression. It takes one argument, 424 which is an identifier, followed by a block of substatements that 425 holds detailed mathematical expression i.e set of nodes which 426 reference to other node. 427 Minimum is done on a set of values. There are three categories of 428 sets : 1. Set consist different leafs. 2. Set consist different 429 values of a leaf defined in a list. 3. Set consist intermediate 430 values of a leaf. By modeling this server/application can learn 431 that minimum of respective values to be calculated and should be 432 marked as minimum when server/application defined event occurs. 434 3.7.1 The mt:min's Substatements 436 +---------------+----------------+-------------+ 437 | substatement | section | cardinality | 438 +---------------+----------------+-------------+ 439 | leaf | rfc6020 7.10 | 1 | 440 | Description | rfc6020 7.19.3 | 0..1 | 441 | mt:loop | 3.6.2.1 | 1 | 442 | mt:event | 3.7.2 | 1 | 443 +---------------+----------------+-------------+ 445 3.7.2 The mt:event statement 447 This substatement specifies calculation of minimum on intermediate 448 value of a leaf and to be committed on application defined event.It 449 takes one argument, which is an identifier, followed by a block of 450 substatements that holds detailed mathematical expression. leaf 451 substatement of this statement can only be of type leafref. 453 3.7.3 The mt:event's Substatements 454 +---------------+----------------+-------------+ 455 | substatement | section | cardinality | 456 +---------------+----------------+-------------+ 457 | leaf | rfc6020 7.10 | 1 | 458 | Description | rfc6020 7.19.3 | 0..1 | 459 +---------------+----------------+-------------+ 461 3.7.4 Example 463 Minimum to be calculated over a set of different leafs. 464 x = min(a,b,c) 465 container formula { 466 list elements{ 467 leaf a { 468 type uint32{ 469 range "1..5" 470 } 471 } leaf b { 472 type uint32{ 473 range "1..5" 474 } 475 } leaf c { 476 type uint32{ 477 range "1..5" 478 } 479 } 480 mt:math formula { 481 mt:min x { 482 leaf a{ 483 type leafref { 484 path "../../../elements/a"; 485 } 486 } leaf b{ 487 type leafref { 488 path "../../../elements/b"; 489 } 490 } leaf c{ 491 type leafref { 492 path "../../../elements/c"; 493 } 494 } 495 } 496 } 497 } 499 3.7.5 Example 501 Minimum to be calculated over a set of differen value of a 502 leaf defined in a list. 503 x = min(a) where a is a leaf in list. 504 container formula { 505 list elements{ 506 leaf a { 507 type uint32{ 508 range "1..5" 509 } 510 } leaf b { 511 type uint32{ 512 range "1..5" 513 } 514 } leaf c { 515 type uint32{ 516 range "1..5" 517 } 518 } 519 } 520 mt:math formula { 521 mt:min x { 522 mt:loop index { 523 leaf a { 524 type leafref { 525 path "../../../../elements/a"; 526 } 527 } 528 } 529 } 530 } 531 } 533 3.7.6 Example 535 Minimum to be calculated over a intermediate values of a leaf, 536 when a perticuler mt:event occurs. 537 x = min(a) where x is mt:min of intermediate values of a. 538 container formula { 539 list elements{ 540 leaf a { 541 type uint32{ 542 range "1..5" 543 } 544 } mt:math formula { 545 mt:min x { 546 mt:event period{ 547 leaf a { 548 type leafref { 549 path "../../../a"; 550 } 551 } 552 } 553 } 554 } 556 } 557 } 559 3.8. The "mt:max" Statement 561 This statement allows a module or submodule to define a Maximum node 562 in a schema tree of mathematical expression. It takes one argument, 563 which is an identifier, followed by a block of substatements that 564 holds detailed mathematical expression i.e set of nodes which 565 reference to other node. 566 Maximum is normally done a set of values. There are three categories 567 of sets : 1. Set consist different leafs. 2. Set consist different 568 values of a leaf defined in a list. 3. Set consist intermediate 569 values of a leaf. By modeling this server/application can learn 570 that maximum of respective values to be calculated and should be 571 marked as maximum when server/application defined event occurs. 573 3.8.1 The mt:max's Substatements 575 +---------------+----------------+-------------+ 576 | substatement | section | cardinality | 577 +---------------+----------------+-------------+ 578 | leaf | rfc6020 7.10 | 1 | 579 | Description | rfc6020 7.19.3 | 0..1 | 580 | mt:loop | 3.6.2.1 | 1 | 581 | mt:event | 3.7.2 | 1 | 582 +---------------+----------------+-------------+ 584 3.8.2 Example 586 Maximum to be calculated over a set of different leafs. 587 x = max(a,b,c) 588 container formula { 589 list elements{ 590 leaf a { 591 type uint32{ 592 range "1..5" 593 } 594 } leaf b { 595 type uint32{ 596 range "1..5" 597 } 598 } leaf c { 599 type uint32{ 600 range "1..5" 601 } 602 } 603 mt:math formula { 604 mt:max x { 605 leaf a{ 606 type leafref { 607 path "../../../elements/a"; 608 } 609 } leaf b{ 610 type leafref { 611 path "../../../elements/b"; 612 } 613 } leaf c{ 614 type leafref { 615 path "../../../elements/c"; 616 } 617 } 618 } 619 } 620 } 622 3.8.3 Example 624 Maximum to be calculated over a set of differen value of 625 A leaf defined in a list. x = max(a) where a is a leaf in 626 list. 627 container formula { 628 list elements{ 629 leaf a { 630 type uint32{ 631 range "1..5" 632 } 633 } leaf b { 634 type uint32{ 635 range "1..5" 636 } 637 } leaf c { 638 type uint32{ 639 range "1..5" 640 } 641 } 642 } 643 mt:math formula { 644 mt:min x { 645 mt:loop index { 646 leaf a { 647 type leafref { 648 path "../../../../elements/a"; 649 } 650 } 651 } 653 } 654 } 655 } 657 3.8.4 Example 659 Maximum to be calculated over a intermediate values of a leaf, 660 when a perticuler mt:event occurs. 661 x = max(a) where x is mt:min of intermediate values of a. 662 container formula { 663 list elements{ 664 leaf a { 665 type uint32{ 666 range "1..5" 667 } 668 } mt:math formula { 669 mt:max x { 670 mt:event period{ 671 leaf a { 672 type leafref { 673 path "../../../a"; 674 } 675 } 676 } 677 } 678 } 679 } 680 } 682 3.9. The "mt:const" Statement 684 This statement allows a module or submodule to define a constant leaf 685 node in a schema tree of mathematical expression. This statement can 686 be used only inside a leaf node.leaf with mt:const statment is non- 687 modifiable and should hold the value defined using mt-const 688 statement. 690 3.9.1 The mt:const's Substatements 692 +---------------+----------------+-------------+ 693 | substatement | section | cardinality | 694 +---------------+----------------+-------------+ 695 | Description | rfc6020 7.19.3 | 0..1 | 696 +---------------+----------------+-------------+ 698 3.10. Usage example of expression statements 700 3.10.1 Sample Example 701 x=((a+b)-(c-d))/(e*100) 702 container formula { 703 leaf a { 704 type int32; 705 } 706 leaf b { 707 type int32; 708 } 709 leaf c { 710 type int32; 711 } 712 leaf d { 713 type int32; 714 } 715 leaf e { 716 type int32; 717 } 718 mt:math x { 719 leaf x { 720 type int32; 721 description "x=((a+b) - (c-d)/(e*100))"; 722 } 723 mt:division divNode { 724 mt:dividend dividendNode { 725 mt:subtraction subNode { 726 mt:minuend minuendNode { 727 leaf minuendNodeVal { 728 type int32; 729 description "Can be used to store 730 intermediate value a+b" 731 } 732 mt:addition additionNode { 733 mt:addend a { 734 leaf a { 735 type leafref { 736 path "/formula/a"; 737 } 738 } 739 } 740 mt:addend b { 741 leaf b { 742 type leafref { 743 path "/formula/b"; 744 } 745 } 746 } 747 } 748 } 749 mt:subtrahend subtrahendNode { 750 leaf subtrahendNodeVal { 751 type int32; 752 description "Can be used to 753 store intermediate value c-d"; 754 } 755 mt:subtraction subNode { 756 mt:minuend minuendNode{ 757 leaf c{ 758 type leafref{ 759 path "/formula/c"; 760 } 761 } 762 } 763 mt:subtrahend subtrahendNode { 764 leaf d { 765 type leafref{ 766 path "/formula/d"; 767 } 768 } 769 } 770 } 771 } 772 } 773 } 774 mt:divisor divisorNode { 775 mt:multiplication multiplicationNode { 776 leaf mt:subtrahendNodeVal { 777 type int32; 778 description "Can be used to store intermediate 779 value e * 100" 780 } 781 mt:multiplier multiplierNodeOne { 782 leaf e { 783 type leafref { 784 path "/formula/e"; 785 } 786 } 787 } 788 mt:multiplier multiplierNodeTwo { 789 leaf const { 790 mt:const 100; 791 type uint32; 792 } 793 } 794 } 795 } 796 } 798 } 799 } 801 3.10.2 3GPP Standard formula(3GPP TS 32.450 V14.0.0(2017-04)) 803 MobilitySuccessRate for QCI x = 804 ((HO.ExeSucc for QCI x/HO.ExeAtt for QCI x) 805 *(HO.PrepSucc for QCI x /HO.PrepAtt for QCI x) * 100) 806 list MobiltySuccess { 807 key QCI; 808 leaf QCI { 809 leaf int32; 810 } 811 leaf HOExeSucc { 812 type int32; 813 } 814 leaf HOExeAtt { 815 type int32; 816 } 817 leaf HOPrepSucc { 818 type int32; 819 } 820 leaf HOPrepAtt { 821 type int32; 822 } 823 mt:mathMobiltySuccessRate { 824 leaf MobSuccRate { 825 type int32; 826 description "MobSuccRate= 827 ((HOExeSucc/HOExeAtt)*(HOPrepSucc/HOPrepAtt))*100"; 828 } 829 mt:multiplication multNode { 830 mt:mulitiplier multiplerNodeOne { 831 mt:muliplication multNode { 832 mt:mulitiplier multiplerNodeOne { 833 leaf multiplerNodeOneVal { 834 type int32; 835 description "Can be used to 836 store value of HOExeSucc/HOExeAtt"; 837 } 838 mt:division divNode { 839 mt:dividend divNode { 840 leaf HOExeSucc{ 841 type leafref { 842 path "/MobiltySuccess/HOExeSucc"; 843 } 844 } 845 } 846 mt:divisor divsNode { 847 leaf HOExeAtt{ 848 type leafref { 849 path "/MobiltySuccess/HOExeAtt"; 850 } 851 } 852 } 853 } 854 } 855 mt:mulitiplier multiplerNodeTwo { 856 leaf multiplerNodeTwoval { 857 type int32; 858 description "Can be used to store 859 value of HOPrepSucc/HOPrepAtt"; 860 } 861 mt:division divNode { 862 mt:dividend divNode { 863 leaf HOPrepSucc{ 864 type leafref { 865 path "/MobiltySuccess/HOPrepSucc"; 866 } 867 } 868 } 869 mt:divisor divsNode { 870 leaf HOPrepAtt{ 871 type leafref{ 872 path "/MobiltySuccess/HOPrepAtt"; 873 } 874 } 875 } 876 } 877 } 878 } 879 } 880 mt:mulitiplier multiplerNodeTwo { 881 leaf const { 882 mt:const 100; 883 type int32; 884 } 885 } 886 } 887 } 888 } 890 3.11. YIN 892 A YANG module can be translated into an alternative XML-based syntax 893 called YIN. The translated module is called a YIN module. This 894 section describes symmetric mapping rules between the two formats. 895 The YANG and YIN formats contain equivalent information using 896 different notations. The YIN notation enables developers to 897 represent YANG data models in XML and therefore use the rich set of 898 XML-based tools for data filtering and validation, automated 899 generation of code and documentation, and other tasks. Tools like 900 XSLT or XML validators can be utilized. 901 The mapping between YANG and YIN does not modify the information 902 content of the model. Comments and whitespace are not preserved. 903 Mapping of arguments of the YANG statements. 905 +------------------+---------------+-------------+ 906 | keyword | argument name | yin-element | 907 +------------------+---------------+-------------+ 908 | mt:math | name | false | 909 | mt:addition | name | false | 910 | mt:addend | name | false | 911 | mt:minuend | name | false | 912 | mt:subtrahend | name | false | 913 | mt:multiplication| name | false | 914 | mt:mulitiplier | name | false | 915 | mt:division | name | false | 916 | mt:dividend | name | false | 917 | mt:divisor | name | false | 918 | mt:const | value | false | 919 | mt:summation | name | false | 920 | mt:loop | name | false | 921 | mt:min | name | false | 922 | mt:max | name | false | 923 | mt:event | name | false | 924 +------------------+---------------+-------------+ 926 3.11.1 Example 928 mt:division divNode { 929 mt:dividend divNode { 930 leaf HOPrepSucc{ 931 type leafref { 932 path "/MobiltySuccess/HOPrepSucc"; 933 } 934 } 935 } 936 mt:divisor divsNode { 937 leaf HOPrepAtt{ 938 type leafref{ 939 path "/MobiltySuccess/HOPrepAtt"; 940 } 941 } 943 } 944 } 946 Corresponding YIN 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 964 3.12. YANG ABNF Grammar 966 mt:addition-stmt = mt:addition-keyword sep 967 identifier-arg-str optsep 968 ("{" stmtsep 969 ;; these stmts can appear in any order 970 [mt:addend-stmt stmtsep] 971 [description-stmt stmtsep] 972 [leaf-stmt] 973 "}") 974 mt:addend-stmt = mt:addend-keyword sep identifier-arg-str 975 optsep 976 ("{" stmtsep 977 [leaf-stmt] 978 ;; these stmts can appear in any order 979 [mt:addend-stmt stmtsep] 980 [mt:subtraction-stmt stmtsep] 981 [mt:division-stmt stmtsep] 982 [mt:multiplication-stmt stmtsep] 983 [description-stmt stmtsep] 984 "}") 986 mt:subtraction-stmt = mt:subtraction-keyword sep 987 identifier-arg-str optsep 988 ("{" stmtsep 989 [leaf-stmt] 990 [mt:minuend-stmt stmtsep] 992 [mt:subtrahend-stmt stmtsep] 993 ;; these stmts can appear in any order 994 [description-stmt stmtsep] 995 "}") 997 mt:minuend-stmt = mt:minuend-keyword sep identifier-arg-str 998 optsep 999 ("{" stmtsep 1000 [leaf-stmt] 1001 ;; these stmts can appear in any order 1002 [mt:addition -stmt stmtsep] 1003 [mt:subtraction-stmt stmtsep] 1004 [mt:division-stmt stmtsep] 1005 [mt:multiplication-stmt stmtsep] 1006 [description-stmt stmtsep] 1007 "}") 1009 mt:subtrahend-stmt = mt:subtrahend-keyword sep 1010 identifier-arg-str optsep 1011 ("{" stmtsep 1012 [leaf-stmt] 1013 ;; these stmts can appear in any order 1014 [mt:addition -stmt stmtsep] 1015 [mt:subtraction-stmt stmtsep] 1016 [mt:division-stmt stmtsep] 1017 [mt:multiplication-stmt stmtsep] 1018 [description-stmt stmtsep] 1019 "}") 1021 mt:multiplication-stmt = mt:multiplication-keyword sep 1022 identifier-arg-str optsep 1023 ("{" stmtsep 1024 [leaf-stmt] 1025 [mt:multiplier-stmt stmtsep] 1026 ;; these stmts can appear in any order 1027 [description-stmt stmtsep] 1028 "}") 1029 mt:multiplier-stmt = mt:multiplier-keyword sep 1030 identifier-arg-str optsep 1031 ("{" stmtsep 1032 [leaf-stmt] 1033 ;; these stmts can appear in any order 1034 [mt:addition -stmt stmtsep] 1035 [mt:subtraction-stmt stmtsep] 1036 [mt:division-stmt stmtsep] 1037 [mt:multiplication-stmt stmtsep] 1038 [description-stmt stmtsep] 1039 "}") 1041 mt:division-stmt = mt:division-keyword sep 1042 identifier-arg-str optsep 1043 ("{" stmtsep 1044 [leaf-stmt] 1045 [mt:dividend-stmt stmtsep] 1046 [mt:divisor-stmt stmtsep] 1047 [description-stmt stmtsep] 1048 "}") 1049 mt:dividend-stmt = mt:dividend-keyword sep 1050 identifier-arg-str optsep 1051 ("{" stmtsep 1052 [leaf-stmt] 1053 ;; these stmts can appear in any order 1054 [mt:addition -stmt stmtsep] 1055 [mt:subtraction-stmt stmtsep] 1056 [mt:division-stmt stmtsep] 1057 [mt:multiplication-stmt stmtsep] 1058 [description-stmt stmtsep] 1059 "}") 1061 mt:divisor-stmt = mt:divisor-keyword sep 1062 identifier-arg-str optsep 1063 ("{" stmtsep 1064 [leaf-stmt] 1065 ;; these stmts can appear in any order 1066 [mt:addition -stmt stmtsep] 1067 [mt:subtraction-stmt stmtsep] 1068 [mt:division-stmt stmtsep] 1069 [mt:multiplication-stmt stmtsep] 1070 [description-stmt stmtsep] 1071 "}") 1073 mt:summation-stmt = mt:summation-keyword sep 1074 identifier-arg-str optsep 1075 ("{" stmtsep 1076 [leaf-stmt]/ 1077 [mt:loop-stmt] 1078 [description-stmt stmtsep] 1079 "}") 1080 mt:loop-stmt = mt:loop-keyword sep identifier-arg-str 1081 optsep 1082 ("{" stmtsep 1083 [leaf-stmt] 1084 [description-stmt stmtsep] 1085 "}") 1087 mt:math-stmt = mt:math-keyword sep identifier-arg-str 1088 optsep 1089 ("{" stmtsep 1090 [leaf-stmt] 1091 [mt:addition -stmt]/ 1092 [mt:subtraction-stmt]/ 1093 [mt:division-stmt]/ 1094 [mt:multiplication-stmt] 1095 [description-stmt stmtsep] 1096 "}") 1097 mt:const-stmt = mt:const-keyword sep integer-value stmtend 1099 mt:event-stmt = mt:event-keyword sep identifier-arg-str 1100 optsep 1101 ("{" stmtsep 1102 [leaf-stmt] 1103 [description-stmt stmtsep] 1104 "}") 1105 mt:min-stmt = mt:min-keyword sep identifier-arg-str optsep 1106 ("{" stmtsep 1107 1*(leaf-stmt)/ 1108 [mt:loop-stmt]/ 1109 [mt:event-stmt] 1110 [description-stmt stmtsep] 1111 "}") 1112 mt:max-stmt = mt:max-keyword sep identifier-arg-str optsep 1113 ("{" stmtsep 1114 1*(leaf-stmt)/ 1115 [mt:loop-stmt]/ 1116 [mt:event-stmt] 1117 [description-stmt stmtsep] 1118 "}") 1120 3.13. XML Mapping Rules 1122 A NETCONF server that replies to a or request 1123 may choose to not send newly added nodes and its subnodes 1124 if does not have the leaf nodes which can hold a data. 1126 4. Extension Definition Module 1128 file "ietf-math-types@2017-09-12.yang" 1130 module ietf-math-types { 1132 namespace "urn:ietf:params:xml:ns:yang:ietf-math-types"; 1133 prefix "mt"; 1134 organization "NETMOD WG"; 1135 contact "Editor: Sudhanshu Kumar Srivastav 1136 "; 1137 description 1138 "YANG extensions for math types."; 1139 revision 2017-09-12 { 1140 description "Initial revision."; 1141 reference "RFC 6080"; 1142 } 1143 extension math { 1144 argument name; 1145 description "Define a mathematical expression node"; 1146 } 1147 extension addition { 1148 argument name; 1149 description "Define a addition expression node"; 1150 } 1151 extension addend { 1152 argument name; 1153 description "Define a addend node"; 1154 } 1155 extension subtraction { 1156 argument name; 1157 description "Define a subtraction expression node"; 1158 } 1159 extension minuend { 1160 argument name; 1161 description "Define a minuend node"; 1162 } 1163 extension subtrahend { 1164 argument name; 1165 description "Define a subtrahend node"; 1166 } 1167 extension multiplication { 1168 argument name; 1169 description "Define a multiplication expression node"; 1170 } 1171 extension multiplier { 1172 argument name; 1173 description "Define a multiplier node"; 1174 } 1175 extension division { 1176 argument name; 1177 description "Define a division expression node"; 1178 } 1179 extension divisor { 1180 argument name; 1181 description "Define a divisor node"; 1182 } 1183 extension dividend { 1184 argument name; 1185 description "Define a dividend node"; 1186 } 1187 extension event { 1188 argument name; 1189 description "Define a event node"; 1190 } 1191 extension loop { 1192 argument name; 1193 description "Define a loop node"; 1194 } 1195 extension min { 1196 argument name; 1197 description "Define a min node"; 1198 } 1199 extension max { 1200 argument name; 1201 description "Define a max node"; 1202 } 1203 extension const { 1204 argument name; 1205 description "Define a const node"; 1206 } 1207 } 1208 1210 5. IANA Considerations 1212 This document registers one URIs in the IETF XML registry. 1213 IANA registered the following URIs, according to [RFC3688]: 1214 URI: "urn:ietf:params:xml:ns:yang:ietf-math-types" 1216 This document registers one module name in the 1217 "YANG Module Names" registry, defined in [RFC6020]. 1218 name: ietf-math-types 1220 namespace: urn:ietf:params:xml:ns:yang:ietf-math-types 1222 prefix: mt 1224 6. Security Considerations 1226 The YANG module "math-types" in this memo defines YANG 1227 extensions for math types new language statements. 1229 math types themselves do not have any security impact 1230 on the Internet. 1232 7. References 1234 7.1. Normative References 1235 [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for 1236 the Network Configuration Protocol (NETCONF)", RFC 6020, 1237 DOI 10.17487/RFC6020, October 2010, 1238 . 1240 Authors' Addresses 1242 Sudhanshu Kumar Srivastav 1243 Samsung R and D Institute 1244 Bangalore, KA 560037 1245 India 1246 Phone: (966) 339-4051 1247 EMail: sk.srivastav@samsung.com