Commit d55aa377 authored by YannGarcia's avatar YannGarcia
Browse files

Abstract TTCN headers checking in a function

parent 8ea5737f
Loading
Loading
Loading
Loading
+1 −13
Original line number Diff line number Diff line
@@ -76,21 +76,9 @@ import from LibMec_Pixits all;
                                                                                                                                                                                                   )
                                                                                                                                                                 }
                            )))))) -> value v_response {
          var boolean v_header_matched := false;
          
          tc_ac.stop;
          
          v_headers := v_response.response.header;
          for (var integer v_idx := 0; v_idx < lengthof(v_headers); v_idx := v_idx + 1) {
            if (v_headers[v_idx].header_name == "Location") {
              if (match(v_headers[v_idx].header_value[0], "<my expected value or a receive template>") == true) { 
                v_header_matched := true;
              } // else, nothing to do
              break;
            }
          } // End of 'for' statement
          
          if (v_header_matched == true) {
          if (f_check_headers(v_response.response.header) == true) {
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppTerminationNotificationSubscription ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          } else {

LibCommon @ 8f0b6280

Original line number Diff line number Diff line
Subproject commit 21bad7c51917d19bebdff5b36983e22922421976
Subproject commit 8f0b6280029f2b786f289ee6cf671553a4806b17

LibIts @ fa803fc7

Original line number Diff line number Diff line
Subproject commit e52379698e945eb9631b229c5438de9f74efb6a0
Subproject commit fa803fc714e8896de7ce12d0ecec822b5e8949dc
+27 −1
Original line number Diff line number Diff line
@@ -114,9 +114,35 @@ module LibMec_Functions {
  
  group helpers {
    
    /**
     * @desc Check HTTP response headers
     * @param p_headers The HTTP headers
     * @param p_value the expected va;ue
     * @return true on success, false otherwise
     */
    function f_check_headers(
                             in HeaderLines p_headers,
                             in template (present) charstring p_value := ?
    ) return boolean {
      // Local variables
      var boolean v_header_matched := false;
      
      for (var integer v_idx := 0; v_idx < lengthof(p_headers); v_idx := v_idx + 1) {
        if (p_headers[v_idx].header_name == "Location") {
          if (match(p_headers[v_idx].header_value[0], p_value) == true) { 
            v_header_matched := true;
          } // else, nothing to do
          break;
        }
      } // End of 'for' statement
      
      return v_header_matched;
    }
    
    /**
     * @desc Check if the user is registered or not
     * @param 
     * @param p_ue_identity_tag The UE identity tag
     * @param p_headers The HTTP headers
     * @return 0 if unregistered, 1 if registered, -1 otherwise
     */
    function f_check_user_register_state(