Commit b30807ba authored by Yann Garcia's avatar Yann Garcia
Browse files

Start implementation of N1N2 TPs

parent 992507a6
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@ Package TP_N5_PCF {
                when {
                    the IMS_P_CSCF_A entity sends a vPOST containing 
                        uri indicating value "/npcf-policyauthorization/v1/app_sessions"
                        body containing
                        body containing
                            AppSessionContext containing
                                AppSessionContextReqData containing
Original line number Diff line number Diff line
Subproject commit 9ed59ebd3c0a769688262f2370f6d3c3507b2a5f
Subproject commit c0d15f46ba5406cf788059a86743ed9b87f1044e
+190 −0
Original line number Diff line number Diff line
module AtsIms5gIot_Functions {

    //LibIms
    import from LibIms_UpperTester all;
    
    //LibIot
    import from LibIot_PIXITS all;
    import from LibIot_Functions all;
    import from LibIot_TestInterface all;
    import from LibIot_Functions all;
    import from LibIot_TypesAndValues all;
    
    //LibUpperTester
    import from LibUpperTester all;
    
    // LibHttp
    import from LibHttp_TypesAndValues all;
    import from LibHttp_Templates all;

    // AtsIms5gIot
    import from AtsIms5gIot_TypesAndValues all;
    import from AtsIms5gIot_TestSystem all;

    function f_Iot_Http_receive( 
                                in template HttpMessageList p_passCriteria,
                                in template HttpMessageList p_failCriteria,
                                in template HttpSkipType p_skip,
                                in charstring p_tpId,
                                in boolean p_forwardMtc,
                                in boolean p_checkMessage
                                ) runs on HttpInterfaceMonitor { 
        var integer v_size := lengthof(p_failCriteria); 
        var DefaultList v_defaultArray;
        var integer i := 0;
        var integer v_size_ai := lengthof(PX_AVAILABLE_INTERFACES);

        //log ("### f_Iot_Http_receive: passCriteria=", p_passCriteria);
        //log ("### f_Iot_Http_receive: failCriteria=", p_failCriteria);
         
        // check if interface is available
        if (not((isvalue(vc_Interface))  /*and (vc_interfaceName=="")*/)){
            setverdict(inconc, self, "******f_Iot_Http_receive: Interface " & vc_interfaceName & " not available and is not evaluated******" );
        } else {// Interface is available
            v_defaultArray[0] := activate(a_default_http(p_tpId));
            f_activateHttpDefaults(v_defaultArray, 1, p_failCriteria, fail, p_tpId, p_forwardMtc, p_checkMessage);
            f_activateHttpDefaults(v_defaultArray, v_size + 1, p_passCriteria, pass, p_tpId, p_forwardMtc, p_checkMessage);
            f_gen_http_receive(p_tpId, p_skip);

            for (i := 0; i < lengthof(v_defaultArray); i := i + 1) {
                deactivate(v_defaultArray[i]);
            }
        }
         
    } // End of function f_Iot_Http_receive

    function f_activateHttpDefaults(
                                    inout DefaultList p_default,
                                    in integer p_startIdx,
                                    in template HttpMessageList p_list,
                                    in verdicttype p_verdict,
                                    in charstring p_tpId,
                                    in boolean p_forwardMtc,
                                    in boolean p_checkMessage
                                    ) runs on HttpInterfaceMonitor {
        var integer v_size := lengthof(p_list); 
        var integer v_idx := p_startIdx;

        for (var integer i := 0; i < v_size; i := i + 1) {
            if (ischosen(p_list[i].request)) {
                //log ("### f_activateHttpDefaults: Adding ", p_list[i].request);
                p_default[v_idx] := activate(
                    a_receive_http_Request(p_list[i],p_verdict, p_tpId, p_forwardMtc, p_checkMessage)
                );
            } else {
                //log ("### f_activateHttpDefaults: Adding ", p_list[i].response);
                p_default[v_idx] := activate(
                    a_receive_http_Response(p_list[i],p_verdict, p_tpId, p_forwardMtc, p_checkMessage)
                );
            }
            v_idx := v_idx + 1;
        }
        //log ("### f_activateHttpDefaults: ended");
    } // End of function f_activateHttpDefaults

    function f_gen_http_receive( 
                                in charstring p_tpId,
                                in template HttpSkipType p_skip
                                ) runs on HttpInterfaceMonitor {
            var integer skipCount := valueof(p_skip.skipCount);
            tc_wait.start;

            alt {
            // preamble (consume prior messages)
            [skipCount > 0 and ispresent(p_skip.skipMessage) and ischosen(p_skip.skipMessage.request)] httpPort.receive (p_skip.skipMessage) {
                skipCount := skipCount - 1;
                log("***f_gen_http_receive: Message skipped (intentionally) when checking for " & p_tpId & " at interface " & vc_interfaceName & " ****");
                repeat;
            }
            [skipCount > 0 and ispresent(p_skip.skipMessage) and ischosen(p_skip.skipMessage.response)] httpPort.receive (p_skip.skipMessage) {
                skipCount := skipCount - 1;
                log("***f_gen_http_receive: Message skipped (intentionally) when checking for " & p_tpId & " at interface " & vc_interfaceName & " ****");
                repeat;
            }
            [] tc_wait.timeout {
                f_setConformanceVerdict(inconc, "***f_gen_http_receive: Timer tc_wait expired when waiting for incoming message in " & p_tpId & " at interface " & vc_interfaceName & " ****");
            }
        }
        
    } // End of function f_gen_http_receive

    function f_getHttpMsgFromMonitor(
                                     InterfaceMonitor p_monitor,
                                     out HttpMessage p_msg
                                     ) runs on HttpImsTestCoordinator {
        timer t_local := PX_MAX_MSG_WAIT;
        t_local.start;            
        alt {
            []nxPort.receive (HttpMessage:?) /*from p_monitor*/ -> value p_msg {
                t_local.stop;
                setverdict(pass, self, "***f_getHttpMsgFromMonitor: SIP message received***");    
            }
            []t_local.timeout {
                    setverdict(fail, self, "***f_getHttpMsgFromMonitor: SIP message not received***");    
            }
        }
    } // End of function f_getHttpMsgFromMonitor

    altstep a_receive_http_Request(
                                   in template HttpMessage p_message,
                                   in verdicttype p_verdict,
                                   in charstring p_tpId,
                                   in boolean p_forwardMtc,
                                   in boolean p_checkMessage
                                   ) runs on HttpInterfaceMonitor {
        var HttpMessage v_message;
        [not p_checkMessage] httpPort.receive(p_message) -> value v_message {
            f_setConformanceVerdict(p_verdict, "***a_receive_http_Request: Received expected SIP request complying to " & p_tpId & " on interface " & vc_interfaceName & " ***");
            if(p_forwardMtc) {
                log("### Forwarding message to MTC");    
                nxPort.send(v_message);
            }
        }
        [p_checkMessage] httpPort.check(receive(p_message) -> value v_message) {
            f_setConformanceVerdict(p_verdict, "***a_receive_http_Request: Checked expected SIP request complying to " & p_tpId & " on interface " & vc_interfaceName & " ***");
            if(p_forwardMtc) {
                log("### Forwarding message to MTC");
                nxPort.send(v_message);
            }
        }
    }

    altstep a_receive_http_Response(
                                    in template HttpMessage p_message,
                                    in verdicttype p_verdict,
                                    in charstring p_tpId,
                                    in boolean p_forwardMtc,
                                    in boolean p_checkMessage
                                    ) runs on HttpInterfaceMonitor {
        var HttpMessage v_message;
        [not p_checkMessage] httpPort.receive(p_message) -> value v_message {
            f_setConformanceVerdict(p_verdict, "***a_receive_http_Response: Received expected SIP request complying to " & p_tpId & " on interface " & vc_interfaceName & " ***");
            if(p_forwardMtc) {
                log("### Forwarding message to MTC");
                nxPort.send(v_message);
            }
        }
        [p_checkMessage] httpPort.check(receive(p_message) -> value v_message) {
            f_setConformanceVerdict(p_verdict, "***a_receive_http_Response: Checked expected SIP request complying to " & p_tpId & " on interface " & vc_interfaceName & " ***");
            if(p_forwardMtc) {
                log("### Forwarding message to MTC");
                nxPort.send(v_message);
            }
        }
    }
        
    altstep a_default_http(in charstring p_TP) runs on HttpInterfaceMonitor {
        [] httpPort.receive(mw_http_request) {
            log(self, "### a_default_http: Request default for " & p_TP );
            repeat; 
        }
        [] httpPort.receive(mw_http_response) {
            log(self, "### a_default_http: Response default for " & p_TP );
            repeat; 
        }
        [] httpPort.receive {
            log(self, "*** a_default_http: Received/ignored unexpected message when waiting for message complying to " & p_TP );
            //setverdict(fail, self, "### YANN: If execution is here, this means that the message was not properly decoded due to sip/sdp-codets exception, check MMagic logs");    
            //stop; // YANN: If execution is here, this means that the message was not properly decoded 
            repeat; 
        }
    }
    
} // End of module AtsIms5gIot_Functions
+7 −0
Original line number Diff line number Diff line
module AtsIms5gIot_PICs {
  
    modulepar charstring PICS_ROOT_API := "/";
  
    modulepar charstring PICS_NPCF_POLICY_AUTHORIZATION := "npcf-policyauthorization/v1/app_sessions";
 
} // End of module AtsIms5gIot_PICs
+37 −0
Original line number Diff line number Diff line
module AtsIms5gIot_TestSystem {

    // LibIot
    import from LibIot_TestInterface all;

    // LibHttp
    import from LibHttp_TypesAndValues all;
    import from LibHttp_TestSystem all;

    // AtsImsIot
    import from AtsImsIot_TestSystem all;

    type component HttpIotSystemInterface extends IotSystemInterface {
        port HttpPort httpPort;
    }

    type component HttpImsInterfaceMonitor extends ImsInterfaceMonitor {
        port HttpPort httpPort;
    }
    
    type component HttpSipInterfaceMonitor extends SipInterfaceMonitor {
        port HttpPort httpPort;
    }

    type port HttpCoordinationPort message {
        inout HttpMessage; 
    } with {
        extension "internal"
    }

    type component HttpImsTestCoordinator extends ImsTestCoordinator {
        port HttpCoordinationPort nxPort;
    }

    type component HttpInterfaceMonitor extends InterfaceMonitor {
            port    HttpPort             httpPort;              
            port    HttpCoordinationPort nxPort;
    }

} // End of module AtsIms5gIot_TestSystem
Loading