LibItsFntp_Templates.ttcn3 48.1 KB
Newer Older
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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987
/**
 *  @author     ETSI / STF422_EETS
 *  @version    $URL:$
 *              $Id:$
 *  @desc       Templates definitions for FAST networking & transport layer protocol (ISO 29281-2)
 */
module LibItsFntp_Templates {
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues {
        type 
            UInt8, UInt16;
    };
    
    // LibIts
    import from CALMllsap language "ASN.1:1997" {
        type 
            IN_SAPaddress, EUI64, LLserviceAddr, Link_ID, INdata, AccessParameters, 
            INsapPrimitivesDown, INsapPrimitivesUp, 
            IN_UNITDATA_request, IN_UNITDATA_indication 
    };
    import from CALMmsap language "ASN.1:1997" {
        type 
            StationID, CommandRef
    };
    import from CALMmanagement language "ASN.1:1997" {
        type ITS_scuId
    };
    import from CALMfntp language "ASN.1:1997" all;
    import from LibIts_Interface all;
    import from LibItsFntp_TypesAndValues {
        const c_portRtr, c_portHst, c_portNon, c_portReservedLow, c_portReservedHigh;
        type AcFntpPrimitive
    };
    import from LibItsFntp_Pixits all;
    import from LibItsCommon_TypesAndValues {
        type
            UtInitialize, UtCommandRequest, UtCommandConfirm, UtCommandIndication
    };
    
    group fntpPrimitives {
        
        /**
         * @desc Primitive on IN-SAP interface
         * @see   ISO/CD 21218 - Clause 8.3
         * @see   ISO/CD 29281-2 - Clause 7.1.2
         */
        group inSAPPrimitives {
            
            group sendTemplates {
                
                /**
                 * @desc Send template for IN-SAP source and destination address
                 * @param p_insap_source_address   Source linkId
                 * @param p_insap_dest_address     Destination linkId
                 * @see   ISO/CD 21218 - Clause 8.2.2
                 */
                template (value) LLserviceAddr m_llServiceAddr(
                    in template (value) Link_ID p_linkId
                ) := {
                    csap := mw_fntpInSapAddress_src_command,
                    linkID := p_linkId
                } //  // End of template m_llServiceAddr
                
                /**
                 * @desc Send template for link-ID
                 * @param p_insap_source_address   Source linkId
                 * @param p_insap_dest_address     Destination linkId
                 * @see   ISO/CD 21218 - Clause 8.2.2
                 */
                template (value) Link_ID m_linkID(
                    in template (value) EUI64 p_remoteLinkId,
                    in template (value) EUI64 p_localLinkId
                ) := {
                    remoteCIID := p_remoteLinkId,
                    localCIID := p_localLinkId
                } // End of template mw_linkID
                
            } // End of group sendTemplates
            
            group receiveTemplates {
                
                /**
                 * @desc Receive template for a SAP primitive message on IN-SAP interface
                 * @param p_inUnitdataRq The IN-DATA.request SAP primitive message
                 * @see   ISO/CD 21218 - Clause 8.3.1
                 * @see   ISO/CD 29281-2 - Clause 7.1.2
                 */
                template INsapPrimitivesDown mw_fntpInSapPrimitiveReq(
                    in template (present) IN_UNITDATA_request p_inUnitdataRq
                ) := {
                    fill := '00000'B, // TODO Use a PIXIT
                    primitives := {
                        inUnitdataRq := p_inUnitdataRq
                    }
                } // End of template m_fntpImPrimitiveReq
                
                /**
                 * @desc The IN-SAP address for FNTP
                 * @see ISO/CD 21218 - Table 5 — Addresses for the Link Service Access Point (IN-SAP)
                 */
                template IN_SAPaddress mw_fntpInSapAddress_any := (186..187); //(oct2int('BA'O) .. oct2int('BB'O));
                
                /**
                 * @desc The IN-SAP address for FNTP
                 * @see ISO/CD 21218 - Table 5 — Addresses for the Link Service Access Point (IN-SAP)
                 */
                template (value) IN_SAPaddress mw_fntpInSapAddress_src_command := 186;//bit2int('10111010'B);
                template (value) IN_SAPaddress mw_fntpInSapAddress_src_response := 187;//bit2int('10111011'B);
                
                /**
                 * @desc  Receive template for IN-UNITDATA.request SAP primitive
                 * @see   ISO/CD 21218 - Clause 8.2.2
                 */
                template IN_UNITDATA_request mw_inUnitDataReq_any := { 
                    source_addr := { 
                        csap := mw_fntpInSapAddress_any, 
                        linkID := ? 
                    }, 
                    dest_addr := { 
                        csap := mw_fntpInSapAddress_any, 
                        linkID := ? 
                    }, 
                    data := ?, 
                    priority := PX_USER_PRIORITY, 
                    accessParams := ''O, 
                    refNo := ? 
                } // End of template mw_inUnitDataReq_any
                
                /**
                 * @desc  Receive template for IN-UNITDATA.request SAP primitive
                 * @param p_insap_source_address   Source linkId
                 * @param p_insap_dest_address     Destination linkId
                 * @see   ISO/CD 21218 - Clause 8.2.2
                 */
                template IN_UNITDATA_request mdw_inUnitDataReq( 
                    in template (present) Link_ID p_insap_source_address, 
                    in template (present) Link_ID p_insap_dest_address 
                ) modifies mw_inUnitDataReq_any := { 
                    source_addr := { 
                        csap := mw_fntpInSapAddress_src_command, 
                        linkID := p_insap_source_address 
                    }, 
                    dest_addr := { 
                        csap := mw_fntpInSapAddress_src_command, 
                        linkID := p_insap_dest_address 
                    }
                } // End of template mdw_inUnitDataReq
                
                /**
                 * @desc  Receive template for IN-UNITDATA.request SAP primitive
                 * @param p_insap_source_address   Source linkId
                 * @param p_insap_dest_address     Destination linkId
                 * @see   ISO/CD 21218 - Clause 8.2.2
                 */
                template IN_UNITDATA_request mdw_inUnitDataReq_CIP( 
                    in template (present) Link_ID p_insap_source_address, 
                    in template (present) Link_ID p_insap_dest_address, 
                    in template (present) AccessParameters p_accessParams 
                ) modifies mw_inUnitDataReq_any := { 
                    source_addr := { 
                        linkID := p_insap_source_address 
                    }, 
                    dest_addr := { 
                        linkID := p_insap_dest_address 
                    }, 
                    accessParams := p_accessParams 
                } // End of template mdw_inUnitDataReq
                
                /**
                 * @desc Receive template for link-ID
                 * @see   ISO/CD 21218 - Clause 8.2.2
                 */
                template Link_ID mw_linkID(
                    in template (present) EUI64 p_remoteLinkId,
                    in template (present) EUI64 p_localLinkId
                ) := {
                    remoteCIID := p_remoteLinkId,
                    localCIID := p_localLinkId
                } // End of template mw_linkID
                
                /**
                 * @desc Receive template for IN-SAP source and destination address
                 * @param csap              IN-SAP address
                 * @param p_insap_dest_address     Destination linkId
                 * @see   ISO/CD 21218 - Clause 8.2.2
                 */
                template LLserviceAddr mw_llServiceAddr(
                    in template (present) Link_ID p_linkId
                ) := {
                    csap := ?,//mw_fntpInSapAddress_any,
                    linkID := p_linkId
                } // End of template mw_llServiceAddr
                
            } // End of group receiveTemplates
            
        } // End of group inSAPPrimitives
        
        /**
         * @desc Fntp NPUD templates
         */
        group fntpBasicNPDU {
            
            /**
             * @desc    Send template for basic NPDU for UC/BC transmission- N/single hop
             * @param   p_sourcePort        Source port
             * @param   p_destinationPort   Destination port
             * @param   p_hops              N-hops value
             */
            template FNTPNPDU m_basicNPDU( 
                in template (value) PortNumber p_sourcePort, 
                in template (value) PortNumber p_destinationPort, 
                in template (omit) FNTPhopCount p_hops // Should be omitted
            ) := { 
                header := { 
                    sourcePort := p_sourcePort, 
                    destinationPort := p_destinationPort, 
                    options := { 
                        intForw := omit, 
                        sec := omit, 
                        hops := p_hops, 
                        opt4 := omit, 
                        opt5 := omit, 
                        opt6 := omit, 
                        lpp := omit, 
                        cip := omit 
                    }
                },
                body := PX_ITS_SP_PAYLOAD_EPDU 
            } // End of template m_basicNPDU
            
            /**
             * @desc Unspecified receive template for FNTP basic NPDU
             * Used for:
             * <li>modifying restrictif template</li>
             * <li>default altstep</li>
             */
            template FNTPNPDU mw_basicNPDU_any := {
                header := {
                    sourcePort := { portLong := complement(c_portReservedLow..c_portReservedHigh) }, // See ISO/CD 29281-2 Table 1: FNTP endpoints identified by port numbers
                    destinationPort := ?, 
                    options := mw_noFntpOptions 
                }, 
                body := ? 
            } // End of template mw_basicNPDU_any
            
            /**
             * @desc Receive template for FNTP basic NPDU, specifying port values
             * @param p_sourcePort      Source port number
             * @param p_destinationPort Destination (or remote) port number
             */
            template (present) FNTPNPDU mdw_basicNPDU( 
                in template (present) PortNumber p_sourcePort, 
                in template (present) PortNumber p_destinationPort 
            ) modifies mw_basicNPDU_any := { 
                header := { 
                    sourcePort := p_sourcePort, 
                    destinationPort := p_destinationPort 
                }
            } // End of template mw_basicNPDU
            
        } // End of group fntpBasicNPDU
        
        group fntpExtendedNPDU {
            
            /**
             * @desc    Send template for FNTP extended NPDU with an invalid control fields (lpp is set)
             * @param   p_sourcePort        Broadcast source port
             * @param   p_destinationPort   Broadcast destination port
             * @param   p_hops              N-hops value
             * @see     ISO/CD 29281-2 - Table 3 — FNTP control field (implemented as OPTION selector in ASN.1)
             */
            template FNTPNPDU md_extendedNPDU_InvalidCtrlField( 
                in template (value) PortNumber p_sourcePort, 
                in template (value) PortNumber p_destinationPort, 
                in template (omit) FNTPhopCount p_hops 
            ) modifies m_basicNPDU := { 
                header := { 
                    options := { 
                        hops := p_hops, 
                        lpp := PX_LPP 
                    } 
                } // End of field 'header'
            } // End of template md_extendedNPDU_InvalidCtrlField
            
            /**
             * @desc    Send template for FNTP extended NPDU with an invalid control fields (lpp is set)
             * @param   p_sourcePort        Broadcast source port
             * @param   p_destinationPort   Broadcast destination port
             * @param   p_hops              N-hops value
             * @see     ISO/CD 29281-2 - Table 3 — FNTP control field (implemented as OPTION selector in ASN.1)
             */
            template FNTPNPDU md_extendedNPDU_InvalidBitSet( 
                in template (value) PortNumber p_sourcePort, 
                in template (value) PortNumber p_destinationPort, 
                in template (omit) FNTPhopCount p_hops // Should be omitted
            ) modifies m_basicNPDU := { 
                header := { 
                    options := { 
                        opt5 := 'CAFEDECA'O 
                    } 
                } // End of field 'header'
            } // End of template md_extendedNPDU_InvalidBitSet
            
            /**
             * @desc    Send template for FNTP extended NPDU with an invalid control fields (lpp is set)
             * @param   p_sourcePort        Broadcast source port
             * @param   p_destinationPort   Broadcast destination port
             * @param   p_hops              N-hops value
             * @param   p_rxCIP             Receive (RX) parameter settings
             * @param   p_txCIP             Transmit (TX) parameters of a VCI
             */
            template FNTPNPDU md_extendedNPDU_CIP( 
                in template (value) PortNumber p_sourcePort, 
                in template (value) PortNumber p_destinationPort, 
                in template (omit) FNTPhopCount p_hops, // Should be omitted
                in template (value) RXcip p_rxCIP, 
                in template (value) TXcip p_txCIP 
            ) modifies m_basicNPDU := { 
                header := { 
                    options := { 
                        hops := p_hops, 
                        cip := {
                            rxCIP := p_rxCIP, 
                            txCIP := p_txCIP
                        } // End of field 'cip'
                    } // End of field 'options'
                } // End of field 'header'
            } // End of template md_extendedNPDU_CIP
            
            /**
             * @desc    Send template for FNTP extended NPDU for BC transmission-single/N-hops
             * @param   p_sourcePort        Broadcast source port
             * @param   p_destinationPort   Broadcast destination port
             * @param   p_hops              N-hops value
             */
            template (present) FNTPNPDU mdw_extendedNPDU(
                in template (present) PortNumber p_sourcePort,
                in template (present) PortNumber p_destinationPort,
                in template (present) FNTPhopCount p_hops 
            ) modifies mw_basicNPDU_any := {
                header := { 
                    options := mdw_NHopNFfntpOptions(PX_NHOPS)
                } // End of field 'header'
            } // End of template mdw_extendedNPDU
            
            /**
             * @desc    Send template for FNTP extended NPDU for BC transmission-single/N-hops with CIP
             * @param   p_sourcePort        Broadcast source port
             * @param   p_destinationPort   Broadcast destination port
             * @param   p_hops              N-hops value
             * @param   p_rxCIP             Receive (RX) parameter settings
             * @param   p_txCIP             Transmit (TX) parameters of a VCI
             */
            template FNTPNPDU mdw_extendedNPDU_CIP( 
                in template (present) PortNumber p_sourcePort, 
                in template (present) PortNumber p_destinationPort, 
                in template (present) FNTPhopCount p_hops, 
                in template RXcip p_rxCIP, 
                in template TXcip p_txCIP 
            ) := {
                header := { 
                    sourcePort := { portLong := complement(c_portReservedLow..c_portReservedHigh) }, // See ISO/CD 29281-2 Table 1: FNTP endpoints identified by port numbers
                    destinationPort := ?, 
                    options := mdw_NHopNFfntpOptions_CIP(
                        PX_NHOPS, 
                        p_rxCIP, 
                        p_txCIP 
                    )
                }, // End of field 'header'
                body := ? 
            } // End of template mdw_extendedNPDU
            
        } // End of group fntpExtendedNPDU
        
        group fntpForwardingNPDU {
            
            /**
             * @desc    Send template for FNTP forwarding NPDU
             * @param   p_sourcePort        Source port (c_portRtr or c_portHst)
             * @param   p_destinationPort   Destination port (c_portRtr or c_portHst)
             * @param   p_hops              N-hops value
             * @param   p_fromPort          Forwarding source port
             * @param   p_toPort            Forwarding destination port
             * @param   p_counter           Expected value of FNTP packet counter counter field
             */
            template (value) FNTPNPDU md_forwardingNPDU( 
                in template (value) PortNumber p_sourcePort, 
                in template (value) PortNumber p_destinationPort, 
                in template (value) FNTPhopCount p_hops, 
                in template (value) PortNumber p_fromPort, 
                in template (value) PortNumber p_toPort, 
                in template (value) FNTPpacketCounter p_counter 
            ) modifies m_basicNPDU := { 
                header := { 
                    options := { 
                        intForw := { 
                            hostITS_scuId := PX_HOST_SCU_ID,
                            link := PX_LINK_ID_UC,
                            counter := p_counter, 
                            sourcePort := p_fromPort, 
                            destinationPort := p_toPort 
                        } // End of field 'intForw' 
                    } // End of field 'options' 
                }  // End of field 'header' 
            } // End of template md_forwardingNPDU
            
            /**
             * @desc    Send template for FNTP forwarding NPDU with an unknown ITS-SCU-ID
             * @param   p_sourcePort        Source port (c_portRtr or c_portHst)
             * @param   p_destinationPort   Destination port (c_portRtr or c_portHst)
             * @param   p_hops              N-hops value
             * @param   p_fromPort          Forwarding source port
             * @param   p_toPort            Forwarding destination port
             * @param   p_counter           Expected value of FNTP packet counter counter field
             */
            template (value) FNTPNPDU md_forwardingNPDU_UnknownITS_SCU_ID( 
                in template (value) PortNumber p_sourcePort, 
                in template (value) PortNumber p_destinationPort, 
                in template (value) FNTPhopCount p_hops, 
                in template (value) PortNumber p_fromPort, 
                in template (value) PortNumber p_toPort, 
                in template (value) FNTPpacketCounter p_counter 
            ) modifies md_forwardingNPDU := { 
                header := { 
                    options := { 
                        intForw := { 
                            hostITS_scuId := PX_UNKNOWN_HOST_SCU_ID,
                            link := PX_LINK_ID_UC,
                            counter := p_counter, 
                            sourcePort := p_fromPort, 
                            destinationPort := p_toPort 
                        } // End of field 'intForw' 
                    } // End of field 'options' 
                }  // End of field 'header' 
            } // End of template md_forwardingNPDU_UnknownITS_SCU_ID
            
            /**
             * @desc    Send template for FNTP forwarding NPDU with CIPs
             * @param   p_sourcePort        Source port (c_portRtr or c_portHst)
             * @param   p_destinationPort   Destination port (c_portRtr or c_portHst)
             * @param   p_hops              N-hops value
             * @param   p_fromPort          Forwarding source port
             * @param   p_toPort            Forwarding destination port
             * @param   p_counter           Expected value of FNTP packet counter counter field
             * @param   p_rxCIP             Receive (RX) parameter settings
             * @param   p_txCIP             Transmit (TX) parameters of a VCI
             */
            template (value) FNTPNPDU md_forwardingNPDU_CIP( 
                in template (value) PortNumber p_sourcePort, 
                in template (value) PortNumber p_destinationPort, 
                in template (value) FNTPhopCount p_hops, 
                in template (value) PortNumber p_fromPort, 
                in template (value) PortNumber p_toPort, 
                in template (value) FNTPpacketCounter p_counter, 
                in template (value) RXcip p_rxCIP, 
                in template (value) TXcip p_txCIP 
            ) modifies md_forwardingNPDU := { 
                header := { 
                    options := { 
                        intForw := { 
                            hostITS_scuId := PX_HOST_SCU_ID,
                            link := PX_LINK_ID_UC,
                            counter := p_counter, 
                            sourcePort := p_fromPort, 
                            destinationPort := p_toPort 
                        }, // End of field 'intForw' 
                        cip := { 
                            rxCIP := p_rxCIP, 
                            txCIP := p_txCIP 
                        } // End of field 'cip'
                    } // End of field 'options' 
                }  // End of field 'header' 
            } // End of template md_forwardingNPDU_CIP
            
            /**
             * @desc Receive template for FNTP forwarding NPDU
             */
            template (present) FNTPNPDU mw_forwardingNPDU_any := { 
                header := { 
                    sourcePort := { portLong := c_portHst },        // See ISO 29281 - Table 3
                    destinationPort := { portLong := c_portRtr },   // See ISO 29281 - Table 3
                    options := { 
                        intForw := { 
                            hostITS_scuId := ?, 
                            link := { 
                                remoteCIID := ?, 
                                localCIID := ? 
                            }, 
                            counter := ?, 
                            sourcePort := ?, 
                            destinationPort := ? 
                        }, 
                        sec := omit, 
                        hops := PX_SHOP,
                        opt4 := omit, 
                        opt5 := omit, 
                        opt6 := omit, 
                        lpp := omit, 
                        cip := omit 
                    } 
                }, 
                body := ? 
            } // End of template mw_forwardingNPDU_any
            
            /**
             * @desc    Receive template for FNTP forwarding NPDU
             * @param   p_sourcePort        Source port
             * @param   p_destinationPort   Destination port
             * @param   p_fromPort          Forwarding source port
             * @param   p_toPort            Forwarding destination port
             * @param   p_hops              N-hops value
             * @param   p_counter           Expected value of FNTP packet counter counter field
             */
            template FNTPNPDU mdw_forwardingNPDU( 
                in template (present) UInt16 p_sourcePort, 
                in template (present) UInt16 p_destinationPort, 
                in template (present) PortNumber p_fromPort, 
                in template (present) PortNumber p_toPort,
                in template (present) FNTPpacketCounter p_counter, 
                in template (present) FNTPhopCount p_hops 
            ) modifies mw_forwardingNPDU_any := { 
                header := { 
                    sourcePort := { portLong := p_sourcePort }, 
                    destinationPort := { portLong := p_destinationPort }, 
                    options := { 
                        intForw := { 
                            counter := p_counter, 
                            sourcePort := p_fromPort, 
                            destinationPort := p_toPort 
                        }, // End of field 'intForw' 
                        hops := p_hops 
                    } // End of field 'options' 
                },  // End of field 'header' 
                body := PX_ITS_SP_PAYLOAD_EPDU 
            } // End of template mdw_forwardingNPDU
            
            /**
             * @desc    Receive template for FNTP forwarding NPDU with CIP
             * @param   p_sourcePort        Source port
             * @param   p_destinationPort   Destination port
             * @param   p_fromPort          Forwarding source port
             * @param   p_toPort            Forwarding destination port
             * @param   p_hops              N-hops value
             * @param   p_counter           Expected value of FNTP packet counter counter field
             * @param   p_rxCIP             Receive (RX) parameter settings
             * @param   p_txCIP             Transmit (TX) parameters of a VCI
             */
            template FNTPNPDU mdw_forwardingNPDU_CIP( 
                in template (present) UInt16 p_sourcePort, 
                in template (present) UInt16 p_destinationPort, 
                in template (present) PortNumber p_fromPort, 
                in template (present) PortNumber p_toPort,
                in template (present) FNTPpacketCounter p_counter, 
                in template (present) FNTPhopCount p_hops, 
                in template (present) RXcip p_rxCIP, 
                in template (present) TXcip p_txCIP 
            ) modifies mdw_forwardingNPDU := { 
                header := { 
                    sourcePort := { portLong := c_portRtr }, 
                    destinationPort := { portLong := c_portHst }, 
                    options := { 
                        intForw := { 
                            counter := p_counter, 
                            sourcePort := p_fromPort, 
                            destinationPort := p_toPort 
                        }, // End of field 'intForw' 
                        hops := p_hops, 
                        cip := {
                            rxCIP := p_rxCIP, 
                            txCIP := p_txCIP
                        } // End of field 'cip'
                    } // End of field 'options' 
                } // End of field 'header' 
            } // End of template mdw_forwardingNPDU_CIP
            
        } // End of group fntpForwardingNPDU
        
        /**
         * @desc template used to trigger message on Lower Tester
         */
        group taPrimitives {
            
            /**
             * @desc   Generate a FNTP NPDU through IN-SAP
             * @param p_insap_source_address   Source linkId
             * @param p_insap_dest_address     Destination linkId
             * @param p_npdu            The FNTP NPDU in octetstring format
             * @see   ISO/CD 21218 - Clause 8.3.3
             */
            template (value) AcFntpPrimitive m_generateFntpNPDU( 
                in template (value) LLserviceAddr p_insap_source_address, 
                in template (value) LLserviceAddr p_insap_dest_address, 
                in template (value) INdata p_npdu 
            ) := { 
                acGenerateFntpNPDU := { 
                    fntpNPDU := {
                        fill := '00000'B, 
                        primitives := { 
                            inUnitdataInd := { 
                                source_addr := p_insap_source_address, 
                                dest_addr := p_insap_dest_address, 
                                data := p_npdu, 
                                priority := PX_USER_PRIORITY, 
                                accessParams := ''O 
                            } // End of field 'inUnitdataInd'
                        }  // End of field 'primitives'
                    } // End of field 'acGenerateFntpNPDU'
                } // End of field 'fntpNPDU'
            } // End of template m_generateFntpNPDU
            
            /**
             * @desc   Generate a FNTP NPDU through IN-SAP
             * @param p_insap_source_address   Source linkId
             * @param p_insap_dest_address     Destination linkId
             * @param p_npdu            The FNTP NPDU in octetstring format
             * @param p_accessParams    access_parameters parameter
             * @see   ISO/CD 21218 - Clause 8.3.3 & Clause 8.5 
             * @see   ISO 29281-2 - Clause 7.10.1
             */
            template (value) AcFntpPrimitive m_generateFntpNPDU_CIP( 
                in template (value) LLserviceAddr p_insap_source_address,  // TODO Rename in p_insap_source_address
                in template (value) LLserviceAddr p_insap_dest_address,  // TODO Rename in p_insap_dest_address
                in template (value) INdata p_npdu, 
                in template (present) AccessParameters p_accessParams 
            ) modifies m_generateFntpNPDU := { 
                acGenerateFntpNPDU := { 
                    fntpNPDU := {
                        fill := '00000'B, 
                        primitives := { 
                            inUnitdataInd := { 
                                accessParams := p_accessParams 
                            } // End of field 'inUnitdataInd'
                        }  // End of field 'primitives'
                    } // End of field 'acGenerateFntpNPDU'
                } // End of field 'fntpNPDU'
            } // End of template m_generateFntpNPDU
            
            /**
             * @desc   Generate a SAM notification message through IN-SAP
             * @param p_insap_source_address   Source linkId
             * @param p_insap_dest_address     Destination linkId
             * @param p_sam             The SAM message in octetstring format
             * @see   ISO/CD 21218 - Clause 8.3.3
             * @see   ISO 29281 - Clause 7.9.3
             */
            template (value) AcFntpPrimitive m_generateSamMessagePDU(
                in template (value) LLserviceAddr p_insap_source_address,  // TODO Rename in p_insap_source_address
                in template (value) LLserviceAddr p_insap_dest_address,  // TODO Rename in p_insap_dest_address
                in template (value) INdata p_sam 
            ) := {
                acGenerateSamMessagePDU := { 
                    samPDU := {
                        fill := '00000'B, 
                        primitives := { 
                            inUnitdataInd := { 
                                source_addr := p_insap_source_address, 
                                dest_addr := p_insap_dest_address, 
                                data := p_sam, 
                                priority := PX_USER_PRIORITY, 
                                accessParams := ''O 
                            } // End of field 'inUnitdataInd'
                        } // End of field 'primitives'
                    } // End of field 'samPDU'
                } // End of field 'acGenerateSamMessagePDU'
            } // End of template m_generateSamMessagePDU
            
            /**
             * @desc   Generate a CTX reception message through IN-SAP
             * @param p_insap_source_address   Source linkId
             * @param p_insap_dest_address     Destination linkId
             * @param p_ctx             The SAM message in octetstring format
             * @see   ISO/CD 21218 - Clause 8.3.3
             * @see   ISO 29281 - Clause 7.9.4
             */
            template (value) AcFntpPrimitive m_generateCtxMessagePDU(
                in template (value) LLserviceAddr p_insap_source_address,  // TODO Rename in p_insap_source_address
                in template (value) LLserviceAddr p_insap_dest_address,  // TODO Rename in p_insap_dest_address
                in template (value) INdata p_ctx 
            ) := {
                acGenerateCtxMessagePDU := {
                    ctxPDU := {
                        fill := '00000'B, 
                        primitives := { 
                            inUnitdataInd := { 
                                source_addr := p_insap_source_address, 
                                dest_addr := p_insap_dest_address, 
                                data := p_ctx, 
                                priority := PX_USER_PRIORITY, 
                                accessParams := ''O 
                            } // End of field 'inUnitdataInd'
                        } // End of field 'primitives'
                    } // End of field 'ctxPDU'
                } // End of field 'acGenerateCtxMessagePDU'
            } // End of template m_generateCtxMessagePDU
            
        } // End of group taPrimitives
        
        /**
         * @desc Templates used to 
         * <li>trigger message on Upper Tester</li>
         * <li>capture indication message sent by the IUT</li>
         */
        group utPrimitives {
        
            /**
             * @desc Initializes the FNTP IUT
             */
            template (value) UtInitialize m_fntpInitialize := {
                utFntpInitialize := {
                }
            } // End of template m_fntpInitialize
            
            group fntpNfPort {
                
                /**
                 * @desc  Send template to request creation or modification of a socket for an endpoint
                 * @param p_serviceRef    Number uniquely identifying the endpoint at this host in an implementation specific way
                 * @param p_portNumber    Contains either the value PORT_NON in order to indicate dynamic assignment of a port number by the port number manager, or a valid value of a well-known static port PORT_REG
                 * @see ISO/CD 29281-2 Clause 8.2.1
                 */
                template (value) UtCommandRequest m_generateNfFntpPortCreationRequest(
                    in template (value) integer p_serviceRef,
                    in template (value) UInt16 p_portNumber
                ) := {
                    utFntpCommandRequest := {
                        nfSapPrimitives := {
                            fill := PX_NF_SAP_DOWN_FILL_FIELD_VALUE, 
                            primitivesDown := {
                                fntpPortRequest := {
                                    serviceRef := p_serviceRef,
                                    operation := true,
                                    port_ := { portLong := p_portNumber },
                                    priority := PX_USER_PRIORITY
                                } // End of field 'fntpPortRequest'
                            } // End of field 'primitivesDown'
                        } // End of field 'nfSapPrimitives'
                    } // End of field 'utFntpCommandRequest'
                } // End of template m_generateNfFntpPortCreationRequest
                
                /**
                 * @desc  Send template to request deletion of a socket for an endpoint
                 * @param p_serviceRef    Number uniquely identifying the endpoint at this host in an implementation specific way
                 * @param p_portNumber    Contains the port to be deleted
                 * @see ISO/CD 29281-2 Clause 8.2.1
                 */
                template (value) UtCommandRequest m_generateNfFntpPortDeletionRequest(
                    in template (value) integer p_serviceRef,
                    in template (value) PortNumber p_portNumber
                ) := {
                    utFntpCommandRequest := {
                        nfSapPrimitives := {
                            fill := PX_NF_SAP_DOWN_FILL_FIELD_VALUE, 

                            primitivesDown := {
                                fntpPortRequest := {
                                    serviceRef := p_serviceRef,
                                    operation := false,
                                    port_ := p_portNumber,
                                    priority := PX_USER_PRIORITY
                                } // End of field 'fntpPortRequest'
                            } // End of field 'fntpPortRequest'
                        } // End of field 'nfSapPrimitives'
                    } // End of field 'utFntpCommandRequest'
                } // End of template m_generateNfFntpPortDeletionRequest
                
                /**
                 * @desc  Receive template used by the FNTP to acknowledge a previous NF-FNTP-PORT.request
                 * @param p_serviceRef  Contains the same value provided in parameter "serviceRef" in the related NF-FNTP-SOCKET.request
                 * @param p_servicePort Contains the Service port number assigned by the FNTP
                 * @see ISO/CD 29281-2 Clause 8.2.2
                 */
                template UtCommandConfirm mw_fntpPortConfirm(
                    in template (present) integer p_serviceRef,
                    in template (present) PortNumber p_servicePort
                ) := {
                    utFntpCommandConfirm := {
                        nfSapPrimitives := {
                            fill := PX_NF_SAP_UP_FILL_FIELD_VALUE, 
                            primitivesUp := {
                                fntpPortConfirm := {
                                    serviceRef := p_serviceRef,
                                    servicePort := p_servicePort
                                } // End of field 'fntpPortConfirm'
                            } // End of field 'primitivesUp'
                        } // End of field 'nfSapPrimitives'
                    } // End of field 'nfSapPrimitives'
                } // End of template mw_fntpPortConfirm
                
            } // End of group fntpNfPort
            
            /**
             * @desc  Send template for a NF-SAP command request
             * @param p_commRef       Unique cyclic reference number of command
             * @param p_servicePort   Port number allocated by FN-FNTP-SOCKECT.create operation
             * @param p_linkID        Identifies the VCI to be used to transmit the packet
             * @param p_data          Contains the ITS-SP payload EPDU
             * @param p_controlField  Content of the FNTP control field in the FNTP extended header
             * @see ISO/CD 29281-2 Clause 8.3.1
             */
            template (value) UtCommandRequest m_generateNfFntpCommRequest(
                in template (value) CommandRef p_commRef,
                in template (value) PortNumber p_servicePort,
                in template (value) Link_ID p_linkID,
                in template (value) ITSfpdu p_data,
                in template (value) FntpOptions p_controlField
            ) := {
                utFntpCommandRequest := {
                    nfSapPrimitives := {
                        fill := PX_NF_SAP_DOWN_FILL_FIELD_VALUE, 
                        primitivesDown := {
                            fntpCommRequest := {
                                commRef := p_commRef,
                                servicePort := p_servicePort,
                                remotePort := PX_REMOTE_PORT_NUMBER,
                                linkID := p_linkID,
                                data := p_data,
                                controlField := p_controlField
                            } // End of field 'fntpCommRequest'
                        } // End of field 'primitivesDown'
                    } // End of field 'nfSapPrimitives'
                } // End of field 'utFntpCommandRequest'
            } // End of template m_generateNfFntpCommRequest
            
            /**
             * @desc Receive a succesful COMAND.confirm primmitive
             * @see ISO/CD 29281-2 Clause 8.3.1
             */
            template (present) UtCommandConfirm mw_fntpCommConfirm_success := {
                utFntpCommandConfirm := {
                    nfSapPrimitives := {
                        fill := PX_NF_SAP_UP_FILL_FIELD_VALUE,
                        primitivesUp := {
                            fntpCommConfirm := {
                                commRef := ?,
                                servicePort := ?,
                                errStatus := 0 // FIXME Pb with TTWB to access to FNTPerrorStatus values
                            } // End of field 'fntpCommConfirm'
                        } // End of field 'primitivesUp'
                    } // End of field 'nfSapPrimitives'
                } // End of field 'utFntpCommandConfirm'
            } // End of template mw_fntpCommConfirm_success
            
            /**
             * @desc Receive an unsuccesful COMAND.confirm primmitive
             */
            template (present) UtCommandConfirm mdw_fntpCommConfirm_unspecFailure 
            modifies mw_fntpCommConfirm_success := {
                utFntpCommandConfirm := {
                    nfSapPrimitives := {
                        primitivesUp := {
                            fntpCommConfirm := {
                                errStatus := 1 // FIXME Pb with TTWB to access to FNTPerrorStatus values
                            } // End of field 'fntpCommConfirm'
                        } // End of field 'primitivesUp'
                    } // End of field 'nfSapPrimitives'
                } // End of field 'utFntpCommandConfirm'
            } // End of template mdw_fntpCommConfirm_fail
            
            template (present) UtCommandIndication mw_checkNfFntpCommIndication := {
                utFntpCommandIndication := {
                    nfSapPrimitives := {
                        fill := PX_NF_SAP_UP_FILL_FIELD_VALUE,
                        primitivesUp := {
                            fntpCommIndication := {
                                servicePort := ?,
                                remotePort := ?,
                                linkID := ?,
                                data := ?,
                                priority := ?
                            } // End of field 'fntpCommIndication'
                        } // End of field 'primitivesUp'
                    } // End of field 'nfsapPrimitives'
                } // End of field 'utFntpCommandIndication'
            } // End of template mw_checkNfFntpCommIndication
            
            /**
             * @desc Templates for FNTP control fields
             * @see ISO/CD 29281-2 Clause 6.2.2.3
             */
            group fntpControlFields {
                
                /**
                 * @desc Send template for no FNTP control fields set, meaning "Basic procedure" (ISO/CD 29281-2 Clause 7.6.1)
                 * @see ISO/CD 29281-2 Clause 6.2.2.3.1
                 */
                template (value) FntpOptions m_noFntpOptions := { 
                    intForw := omit, 
                    sec := omit, 
                    hops := omit, 
                    opt4 := omit, 
                    opt5 := omit, 
                    opt6 := omit, 
                    lpp := omit, 
                    cip := omit 
                } // End of template m_noFntpOptions
                
                /**
                 * @desc Send template for a S/N-hops communications
                 * @param p_hops Number of hops. This parameter shall be set to zero for single hop
                 * @see ISO/CD 29281-2 Clause 6.2.2.3.1
                 */
                template (value) FntpOptions md_NHopNFfntpOptions( 
                    in template (value) FNTPhopCount p_hops 
                ) modifies m_noFntpOptions := { 
                    hops := p_hops 
                } // End of template md_NHopNFfntpOptions
                
                /**
                 * @desc Receive template for no FNTP control fields set, meaning "Basic procedure" (ISO/CD 29281-2 Clause 7.6.1)
                 * @see ISO/CD 29281-2 Clause 6.2.2.3.1
                 */
                template FntpOptions mw_noFntpOptions := { 
                    intForw := omit, 
                    sec := omit, 
                    hops := omit, 
                    opt4 := omit, 
                    opt5 := omit, 
                    opt6 := omit, 
                    lpp := omit, 
                    cip := omit 
                } // End of template mw_noFntpOptions
                
                /**
                 * @desc Receive template for a S/N-hops communications
                 * @param p_hops Number of hops. This parameter shall be set to zero for single hop
                 * @see ISO/CD 29281-2 Clause 6.2.2.3.1
                 */
                template (present) FntpOptions mdw_NHopNFfntpOptions(
                    in template (present) FNTPhopCount p_hops 
                ) modifies mw_noFntpOptions := { 
                    hops := p_hops 
                } // End of template mdw_NHopNFfntpOptions
                
                /**
                 * @desc Send template for unsupported control fiel
                 * @see ISO/CD 29281-2 Clause 6.2.6
                 */
                template (value) FntpOptions md_nonSupportedFntpControlField
                modifies m_noFntpOptions := {
                    lpp := PX_LPP
                } // End of template md_nonSupportedFntpControlField
                
                /**
                 * @desc Send template for with CIP required
                 * @param p_hops Number of hops. This parameter shall be set to zero for single hop
                 * @param p_rxCIP Receive (RX) parameter settings
                 * @param p_txCIP Transmit (TX) parameters of a VCI
                 * @see ISO/CD 29281-2 Clause 7.10
                 */
                template (value) FntpOptions md_CIPNFfntpOptions(
                    in template (value) FNTPhopCount p_hops, 
                    in template (value) RXcip p_rxCIP, 
                    in template (value) TXcip p_txCIP 
                ) modifies md_NHopNFfntpOptions := { 
                    cip := { 
                        rxCIP := p_rxCIP, 
                        txCIP := p_txCIP 
                    } // End of field 'cip'
                } // End of template md_CIPNFfntpOptions
                
                /**
                 * @desc Receive template for a S/N-hops communications with CIP
                 * @param p_hops Number of hops. This parameter shall be set to zero for single hop
                 * @param p_rxCIP Receive (RX) parameter settings
                 * @param p_txCIP Transmit (TX) parameters of a VCI
                 * @see ISO/CD 29281-2 Clause 6.2.2.3.1
                 */
                template FntpOptions mdw_NHopNFfntpOptions_CIP(
                    in template (present) FNTPhopCount p_hops, 
                    in template RXcip p_rxCIP, 
                    in template TXcip p_txCIP 
                ) modifies mw_noFntpOptions := { 
                    hops := p_hops, 
                    cip := { 
                        rxCIP := p_rxCIP, 
                        txCIP := p_txCIP 
                    }  // End of field 'cip'
                } // End of template mdw_NHopNFfntpOptions
                
            } // End of group fntpControlFields
            
        } // End of group utPrimitives
        
    } // End of group fntpPrimitives
    
} // End of module LibItsFntp_Templates