LibItsFntp_Templates.ttcn3 50.6 KB
Newer Older
/**
 *  @author     ETSI / STF422_EETS
filatov's avatar
filatov committed
 *  @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;
reinaortega's avatar
reinaortega committed
    import from LibItsCalm_Interface all;
    import from LibItsFntp_TypesAndValues {
        const c_portRtr, c_portHst, c_portNon, c_portReservedLow, c_portReservedHigh;
        type AcFntpPrimitive
    };
    import from LibItsFntp_Pixits all;
    
    group fntpPrimitives {
        
        /**
         * @desc    Primitive on IN-SAP interface
         * @see     ISO/CD 21218 - Clause 8.3
         * @see     ISO/CD 29281-2 - Clause 7.1.2
reinaortega's avatar
reinaortega committed
        group inSapPrimitives {
reinaortega's avatar
reinaortega committed
            group sendOperation {
                 * @desc    Send template for IN-SAP source and destination address
                 * @param   p_linkId    Link identifier of the CI
                 * @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_remoteLinkId  Remote link ID
                 * @param   p_localLinkId   Local link ID
                 * @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
                
reinaortega's avatar
reinaortega committed
            } // End of group sendOperation
reinaortega's avatar
reinaortega committed
            group recvOperation {
                 * @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 'primitives' field
                } // End of template m_fntpImPrimitiveReq
                
                /**
                 * @desc Send template for IN-SAP address
                 * @see ISO/CD 21218 - Table 5 — Addresses for the Link Service Access Point (IN-SAP)
                 */
                template (value) IN_SAPaddress m_fntpInSapAddress_src_command := 186; //oct2int('BA'O);
                
                /**
                 * @desc Receive template for IN-SAP address
                 * @see ISO/CD 21218 - Table 5 — Addresses for the Link Service Access Point (IN-SAP)
                 */
                template (value) IN_SAPaddress mw_fntpInSapAddress_src_command := m_fntpInSapAddress_src_command; 
                
                /**
                 * @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_src_command, 
                        linkID := ? 
                    }, 
                    dest_addr := { 
                        csap := mw_fntpInSapAddress_src_command, 
                        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_source_linkId   Source linkId
                 * @param   p_dest_linkId     Destination linkId
                 * @see     ISO/CD 21218 - Clause 8.2.2
                 */
                template IN_UNITDATA_request mdw_inUnitDataReq( 
reinaortega's avatar
reinaortega committed
                    in template (present) Link_ID p_sourceLinkId, 
                    in template (present) Link_ID p_destLinkId 
                ) modifies mw_inUnitDataReq_any := { 
                    source_addr := { 
                        csap := mw_fntpInSapAddress_src_command, 
reinaortega's avatar
reinaortega committed
                        linkID := p_sourceLinkId 
                    }, 
                    dest_addr := { 
                        csap := mw_fntpInSapAddress_src_command, 
reinaortega's avatar
reinaortega committed
                        linkID := p_destLinkId 
                    }
                } // End of template mdw_inUnitDataReq
                
                /**
                 * @desc    Receive template for IN-UNITDATA.request SAP primitive
                 * @param   p_source_linkId Source linkId
                 * @param   p_dest_linkId   Destination linkId
                 * @param   p_accessParams Access parameters
                 * @see     ISO/CD 21218 - Clause 8.2.2
                template IN_UNITDATA_request mdw_inUnitDataReqCip( 
reinaortega's avatar
reinaortega committed
                    in template (present) Link_ID p_sourceLinkId, 
                    in template (present) Link_ID p_destLinkId, 
                    in template (present) AccessParameters p_accessParams 
                ) modifies mdw_inUnitDataReq := { 
                    accessParams := p_accessParams 
                } // End of template mdw_inUnitDataReqCip
                 * @desc    Receive template for link-ID
                 * @param   p_remoteLinkId  Remote link Id
                 * @param   p_localLinkId   Source 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   p_linkId     Link identifier of the CI
                 * @see     ISO/CD 21218 - Clause 8.2.2
                 */
                template LLserviceAddr mw_llServiceAddr(
                    in template (present) Link_ID p_linkId
                ) := {
                    csap := mw_fntpInSapAddress_src_command,
                    linkID := p_linkId
                } // End of template mw_llServiceAddr
                
reinaortega's avatar
reinaortega committed
            } // End of group recvOperation
reinaortega's avatar
reinaortega committed
        } // End of group inSapPrimitives
        
        /**
         * @desc Fntp NPUD templates
         */
reinaortega's avatar
reinaortega committed
        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
             */
reinaortega's avatar
reinaortega committed
            template FNTPNPDU m_fntpBasicNpdu( 
                in template (value) PortNumber p_sourcePort, 
                in template (value) PortNumber p_destinationPort, 
                in template (omit) FNTPhopCount p_hops 
            ) := { 
                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 
                    } // End of 'options' field
                }, // End of 'header' field
                body := PX_ITS_FPDU 
reinaortega's avatar
reinaortega committed
            } // End of template m_fntpBasicNpdu
            
            /**
             * @desc Unspecified receive template for FNTP basic NPDU
             * Used for:
             * <li>modifying restrictif template</li>
             * <li>default altstep</li>
             */
reinaortega's avatar
reinaortega committed
            template FNTPNPDU mw_fntpBasicNpdu_any := {
                    sourcePort := { portLong := complement((c_portReservedLow .. c_portReservedHigh)) }, // See ISO/CD 29281-2 Table 1: FNTP endpoints identified by port numbers
                    destinationPort := ?, 
                    options := mw_noFntpOptions 
                }, // End of 'header' field
reinaortega's avatar
reinaortega committed
            } // End of template mw_fntpBasicNpdu_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
reinaortega's avatar
reinaortega committed
            template (present) FNTPNPDU mdw_fntpBasicNpdu( 
                in template (present) PortNumber p_sourcePort, 
                in template (present) PortNumber p_destinationPort 
reinaortega's avatar
reinaortega committed
            ) modifies mw_fntpBasicNpdu_any := { 
                header := { 
                    sourcePort := p_sourcePort, 
                    destinationPort := p_destinationPort 
                }, // End of 'header' field
                body := PX_ITS_FPDU
reinaortega's avatar
reinaortega committed
            } // End of template mw_basicNpdu
reinaortega's avatar
reinaortega committed
        } // End of group fntpBasicNpdu
reinaortega's avatar
reinaortega committed
        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)
             */
reinaortega's avatar
reinaortega committed
            template FNTPNPDU md_fntpExtendedNpdu_invalidCtrlField( 
                in template (value) PortNumber p_sourcePort, 
                in template (value) PortNumber p_destinationPort, 
                in template (omit) FNTPhopCount p_hops 
reinaortega's avatar
reinaortega committed
            ) modifies m_fntpBasicNpdu := { 
garciay's avatar
garciay committed
                        opt4 := NULL 
                } // End of 'header' field
reinaortega's avatar
reinaortega committed
            } // End of template md_fntpExtendedNpdu_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)
             */
reinaortega's avatar
reinaortega committed
            template FNTPNPDU md_fntpExtendedNpdu_invalidBitSet( 
                in template (value) PortNumber p_sourcePort, 
                in template (value) PortNumber p_destinationPort, 
                in template (omit) FNTPhopCount p_hops // Should be omitted
reinaortega's avatar
reinaortega committed
            ) modifies m_fntpBasicNpdu := { 
garciay's avatar
garciay committed
                        opt5 := NULL 
                    } // End of 'options' field
                } // End of 'header' field
reinaortega's avatar
reinaortega committed
            } // End of template md_fntpExtendedNpdu_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
             */
reinaortega's avatar
reinaortega committed
            template FNTPNPDU md_fntpExtendedNpdu_cip( 
                in template (value) PortNumber p_sourcePort, 
                in template (value) PortNumber p_destinationPort, 
                in template (omit) FNTPhopCount p_hops, // Should be omitted
reinaortega's avatar
reinaortega committed
                in template (value) RXcip p_rxCip, 
                in template (value) TXcip p_txCip 
            ) modifies m_fntpBasicNpdu := { 
                header := { 
                    options := { 
                        hops := p_hops, 
                        cip := {
reinaortega's avatar
reinaortega committed
                            rxCIP := p_rxCip, 
                            txCIP := p_txCip
                        } // End of 'cip' field
                    } // End of'options' field 
                } // End of 'header' field
reinaortega's avatar
reinaortega committed
            } // End of template md_fntpExtendedNpdu_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
             */
            template (present) FNTPNPDU mdw_fntpExtendedNpdu(
                in template (present) PortNumber p_sourcePort,
reinaortega's avatar
reinaortega committed
                in template (present) PortNumber p_destinationPort
            ) modifies mdw_fntpBasicNpdu := {
                    options := mdw_nHopNfFntpOptions(PX_NHOPS)
                } // End of field 'header'
            } // End of template mdw_fntpExtendedNPDU
            
            /**
             * @desc    Send template for FNTP extended NPDU for BC transmission-single/N-hops with CIP
             * @param   p_rxCIP             Receive (RX) parameter settings
             * @param   p_txCIP             Transmit (TX) parameters of a VCI
             */
reinaortega's avatar
reinaortega committed
            template FNTPNPDU mw_fntpExtendedNpduCip( 
                in template RXcip p_rxCip, 
                in template TXcip p_txCip 
                    sourcePort := { portLong := complement((c_portReservedLow .. c_portReservedHigh)) }, // See ISO/CD 29281-2 Table 1: FNTP endpoints identified by port numbers
                    destinationPort := ?, 
reinaortega's avatar
reinaortega committed
                    options := mdw_nHopNfFntpOptions_cip(
reinaortega's avatar
reinaortega committed
                        p_rxCip, 
                        p_txCip 
                    )
                }, // End of field 'header'
                body := ? 
            } // End of template mdw_fntpExtendedNPDU
reinaortega's avatar
reinaortega committed
        } // End of group fntpExtendedNpdu
reinaortega's avatar
reinaortega committed
        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_fntpForwardingNpdu( 
                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 
reinaortega's avatar
reinaortega committed
            ) modifies m_fntpBasicNpdu := { 
                header := { 
                    options := { 
                        intForw := { 
                            hostITS_scuId := PX_HOST_SCU_ID,
                            link := PX_WL_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_fntpForwardingNpdu
            
            /**
             * @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
             */
reinaortega's avatar
reinaortega committed
            template (value) FNTPNPDU md_fntpForwardingNpdu_unknownItsScuId( 
                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_fntpForwardingNpdu := { 
                header := { 
                    options := { 
                        intForw := { 
                            hostITS_scuId := PX_UNKNOWN_HOST_SCU_ID,
                            link := PX_WL_LINK_ID_UC,
                            counter := p_counter, 
                            sourcePort := p_fromPort, 
                            destinationPort := p_toPort 
                        } // End of field 'intForw' 
                    } // End of field 'options' 
                }  // End of field 'header' 
reinaortega's avatar
reinaortega committed
            } // End of template md_fntpForwardingNpdu_UnknownITtsScuId
            
            /**
             * @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
             */
reinaortega's avatar
reinaortega committed
            template (value) FNTPNPDU md_fntpForwardingNpdu_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, 
reinaortega's avatar
reinaortega committed
                in template (value) RXcip p_rxCip, 
                in template (value) TXcip p_txCip 
            ) modifies md_fntpForwardingNpdu := { 
                header := { 
                    options := { 
                        intForw := { 
                            hostITS_scuId := PX_HOST_SCU_ID,
                            link := PX_WL_LINK_ID_UC,
                            counter := p_counter, 
                            sourcePort := p_fromPort, 
                            destinationPort := p_toPort 
                        }, // End of field 'intForw' 
                        cip := { 
reinaortega's avatar
reinaortega committed
                            rxCIP := p_rxCip, 
                            txCIP := p_txCip 
                        } // End of field 'cip'
                    } // End of field 'options' 
                }  // End of field 'header' 
reinaortega's avatar
reinaortega committed
            } // End of template md_fntpForwardingNpdu_cip
            
            /**
             * @desc Receive template for FNTP forwarding NPDU
             */
reinaortega's avatar
reinaortega committed
            template (present) FNTPNPDU mw_fntpForwardingNpdu_any := { 
                    sourcePort := ?, 
                    destinationPort := ?, 
                    options := { 
                        intForw := { 
                            hostITS_scuId := ?, 
                            link := { 
                                remoteCIID := ?, 
                                localCIID := ? 
                            }, 
                            counter := ?, 
                            sourcePort := ?, 
                            destinationPort := ? 
                        }, 
                        sec := omit, 
                        hops := ?,
                        opt4 := omit, 
                        opt5 := omit, 
                        opt6 := omit, 
                        lpp := omit, 
                        cip := omit 
                    } 
                }, 
                body := ? 
reinaortega's avatar
reinaortega committed
            } // End of template mw_fntpForwardingNpdu_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 (present) FNTPNPDU mdw_fntpForwardingNpdu( 
                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 
reinaortega's avatar
reinaortega committed
            ) modifies mw_fntpForwardingNpdu_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_FPDU 
            } // End of template mdw_fntpForwardingNpdu
            
            /**
             * @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 (present) FNTPNPDU mdw_fntpForwardingNpduCip( 
                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, 
reinaortega's avatar
reinaortega committed
                in template (present) RXcip p_rxCip, 
                in template (present) TXcip p_txCip 
            ) modifies mdw_fntpForwardingNpdu := { 
                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 := {
reinaortega's avatar
reinaortega committed
                            rxCIP := p_rxCip, 
                            txCIP := p_txCip
                        } // End of field 'cip'
                    } // End of field 'options' 
                } // End of field 'header' 
            } // End of template mdw_fntpForwardingNpduCip
reinaortega's avatar
reinaortega committed
        } // 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( 
reinaortega's avatar
reinaortega committed
                in template (value) LLserviceAddr p_insapSourceAddress, 
                in template (value) LLserviceAddr p_insapDestAddress, 
                in template (value) INdata p_npdu 
            ) := { 
                acGenerateFntpNpdu := { 
                    fntpNPDU := {
                        fill := '00000'B, 
                        primitives := { 
                            inUnitdataInd := { 
reinaortega's avatar
reinaortega committed
                                source_addr := p_insapSourceAddress, 
                                dest_addr := p_insapDestAddress, 
                                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
             */
reinaortega's avatar
reinaortega committed
            template (value) AcFntpPrimitive md_generateFntpNpduCip( 
                in template (value) LLserviceAddr p_insapSourceAddress, 
                in template (value) LLserviceAddr p_insapDestAddress, 
                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_generateFntpNpduCip
            
            /**
             * @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(
reinaortega's avatar
reinaortega committed
                in template (value) LLserviceAddr p_insapSourceAddress, 
                in template (value) LLserviceAddr p_insapDestAddress, 
                in template (value) INdata p_sam 
            ) := {
                acGenerateSamMessagePdu := { 
                    samPdu := {
                        fill := '00000'B, 
                        primitives := { 
                            inUnitdataInd := { 
reinaortega's avatar
reinaortega committed
                                source_addr := p_insapSourceAddress, 
                                dest_addr := p_insapDestAddress, 
                                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(
reinaortega's avatar
reinaortega committed
                in template (value) LLserviceAddr p_insapSourceAddress, 
                in template (value) LLserviceAddr p_insapDestAddress, 
                in template (value) INdata p_ctx 
            ) := {
                acGenerateCtxMessagePdu := {
                    ctxPdu := {
                        fill := '00000'B, 
                        primitives := { 
                            inUnitdataInd := { 
reinaortega's avatar
reinaortega committed
                                source_addr := p_insapSourceAddress, 
                                dest_addr := p_insapDestAddress, 
                                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) PortNumber p_portNumber
                ) := {
                    utFntpCommandRequest := {
                        nfSapPrimitives := {
                            fill := PX_NF_SAP_DOWN_FILL_FIELD_VALUE, 
                            primitivesDown := {
                                fntpPortRequest := {
                                    serviceRef := p_serviceRef,
                                    operation := true,
                                    port_ := 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, 
                                priority := PX_USER_PRIORITY, 
                                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 COMMAND.confirm primitive
             * @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 Check why TTwb raises an error using 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 COMMAND.confirm primitive
             * @see     ISO/WD 29281-2 Clause 8.3.2
             */
            template (present) UtCommandConfirm mdw_fntpCommConfirm_unspecFailure 
            modifies mw_fntpCommConfirm_success := {
                utFntpCommandConfirm := {
                    nfSapPrimitives := {
                        primitivesUp := {
                            fntpCommConfirm := {
                                errStatus := 1 // FIXME Check why TTwb raises an error using FNTPerrorStatus values
                            } // End of field 'fntpCommConfirm'
                        } // End of field 'primitivesUp'
                    } // End of field 'nfSapPrimitives'
                } // End of field 'utFntpCommandConfirm'
            } // End of template mdw_fntpCommConfirm_fail
            
            /**
             * @desc    Receive an COMMAND.indication primitive
             * @see     ISO/CD 29281-2 Clause 8.3.3
             */
            template (present) UtCommandIndication mw_checkNfFntpCommIndication_any := { 
                utFntpCommandIndication := { 
                    nfSapPrimitives := { 
                        fill := PX_NF_SAP_UP_FILL_FIELD_VALUE, 
                        primitivesUp := { 
                            fntpCommIndication := { 
                                servicePort := ?, 
                                remotePort := ?, 
                                linkID := ?, 
                                data := PX_ITS_FPDU, 
                                priority := PX_USER_PRIORITY, 
                                controlField := mw_noFntpOptions
                            } // End of field 'fntpCommIndication' 
                        } // End of field 'primitivesUp' 
                    } // End of field 'nfsapPrimitives' 
                } // End of field 'utFntpCommandIndication' 
            } // End of template mw_checkNfFntpCommIndication_any 
            
            /**
             * @desc  Receive an COMMAND.indication primitive
             * @param p_servicePort Set equal to "destinationPort" given in the NPDU
             * @param p_port        Set equal to "sourcePort" given in the NPDU
             * @param p_linkID      Identify the VCI associated with the peer station
             */
            template (present) UtCommandIndication mdw_checkNfFntpCommIndication(
                in template (present) PortNumber p_servicePort,
                in template (present) PortNumber p_remotePort,
                in template (present) Link_ID p_linkId
            ) modifies mw_checkNfFntpCommIndication_any := {
                utFntpCommandIndication := {
                    nfSapPrimitives := {
                        fill := PX_NF_SAP_UP_FILL_FIELD_VALUE,
                        primitivesUp := {
                            fntpCommIndication := {
                                servicePort := p_servicePort,
                                remotePort := p_remotePort,
                                linkID := p_linkId
                            } // End of field 'fntpCommIndication'
                        } // End of field 'primitivesUp'
                    } // End of field 'nfsapPrimitives'
                } // End of field 'utFntpCommandIndication'
            } // End of template mw_checkNfFntpCommIndication
             * @desc  Receive an COMMAND.indication primitive with Access parameters
             * @param p_servicePort             Set equal to "destinationPort" given in the NPDU
             * @param p_port                    Set equal to "sourcePort" given in the NPDU
             * @param p_linkID                  Identify the VCI associated with the peer station
             * @param p_nHopNfFntpOptionsCip   FNTP options with Access parameters
             * @see ISO/WD 29281-2 Clause 6.2.2.3.6 CIP management
            template (present) UtCommandIndication mdw_checkNfFntpCommIndicationCip(
                in template (present) PortNumber p_servicePort,
                in template (present) PortNumber p_remotePort,
                in template (present) Link_ID p_linkId, 
                in template (present) FntpOptions p_nHopNfFntpOptionsCip
            ) modifies mw_checkNfFntpCommIndication_any := {
                utFntpCommandIndication := {
                    nfSapPrimitives := {
                        fill := PX_NF_SAP_UP_FILL_FIELD_VALUE,
                        primitivesUp := {
                            fntpCommIndication := {
                                servicePort := p_servicePort,
                                remotePort := p_remotePort,
                                linkID := p_linkId, 
                                controlField := p_nHopNfFntpOptionsCip
                            } // End of field 'fntpCommIndication'
                        } // End of field 'primitivesUp'
                    } // End of field 'nfsapPrimitives'
                } // End of field 'utFntpCommandIndication'
            } // End of template mdw_checkNfFntpCommIndicationCip
            
            /**
             * @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 := { 
garciay's avatar
garciay committed
                    opt5 := NULL 
                } // 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 := {
garciay's avatar
garciay committed
                    opt4 := NULL 
                } // 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, 
reinaortega's avatar
reinaortega committed
                    in template (value) RXcip p_rxCip, 
                    in template (value) TXcip p_txCip 
                ) modifies md_nHopNfFntpOptions := {