Commit b3d11b77 authored by Michael Proestler's avatar Michael Proestler
Browse files

Add TC_LIS_SIP_BV_06, TC_LIS_SIP_BV_07

Add Testcases, Add JSON Structures
parent ce117d6e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -43,6 +43,11 @@ module AtsLIS_Pics {
   */
  modulepar boolean PICS_LIS_SIP_ELEMENT_STATE := true;

  /**
   * @desc Does the IUT support Security Posture within Service State?
   */
  modulepar boolean PICS_LIS_SIP_SECURITY_POSTURE := true;

  /**
   * @desc Does the IUT support AML via HTTP?
   */
+107 −1
Original line number Diff line number Diff line
@@ -833,8 +833,9 @@ module AtsLIS_TestCases {
        f_cf_01_down();
    } // End of testcase TC_LIS_SIP_BV_03


    /**
     * @desc "IUT sends a SIP NOTIFY when the location changes"
     * @desc "IUT responds to SIP Subscribe for Element State with an 200 OK"
     */
    testcase TC_LIS_SIP_BV_04() runs on HttpSipComponent system TestAdapter {             
        // Local variables        
@@ -937,6 +938,111 @@ module AtsLIS_TestCases {
        f_cf_01_down();
    } // End of testcase TC_LIS_SIP_BV_05


    /**
     * @desc "IUT responds to SIP Subscribe for ServiceState with Security Posture"
     */
    testcase TC_LIS_SIP_BV_06() runs on HttpSipComponent system TestAdapter {             
        // Local variables        
        var NOTIFY_Request v_msg_recv;
        var CSeq v_cSeq_s := {
          fieldName := CSEQ_E,
          seqNumber := 0,
          method := "SUBSCRIBE"
        };

        var SipUrl v_subscription_target :=  f_initSipUrl(c_serviceProfile_SUBSCRIPTION_SERVICE);

        // Test control
        f_check_pics({ values := {PICS_LIS_SIP_SECURITY_POSTURE}, names := {"PICS_LIS_SIP_SECURITY_POSTURE"}});
        
        // Test component configuration              
        f_cf_01_up();                          
        f_init_userprofile(c_userProfile_ESINetSubscriber);        
        f_init_interfaceprofile(c_interfaceProfile_SUT_LIS);
        
        // Preamble         
        LibIms_Steps.f_setHeadersSUBSCRIBE(v_cSeq_s, v_subscription_target, f_initSipUrl(c_serviceProfile_SUBSCRIBER));                                
        template SUBSCRIBE_Request request := m_SUBSCRIBE_ServiceState_Request_Event(
          v_subscription_target, vc_callId ,v_cSeq_s, vc_from, vc_to, vc_via, omit
        );

        f_SendSUBSCRIBE(request);
        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);

        // Test Body
        f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callId, vc_cSeq));                        
        f_awaitingNOTIFY_sendReply(mw_NOTIFY_Request_Base(vc_callId), v_msg_recv); 
                      
        var ServiceStatePayload v_serviceStatePayload;
        f_decodeServiceState(v_msg_recv, v_serviceStatePayload);
                
        if (match(v_serviceStatePayload, mw_service_state_payload_with_security_posture(mw_security_posture))) {
          f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
        } else {
          log(match(v_serviceStatePayload, mw_service_state_payload_with_security_posture(mw_security_posture)));
          f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
        }
        
        // Postamble
        LibIms_Steps.f_setHeadersSUBSCRIBE(v_cSeq_s, v_subscription_target, f_initSipUrl(c_serviceProfile_SUBSCRIBER));        
        f_SendSUBSCRIBE(m_UNSUBSCRIBE_ElementState_Request_Event(
                                                            v_subscription_target, vc_callId ,v_cSeq_s, vc_from, vc_to, vc_via, omit
                                                          )
        );
        f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callId, vc_cSeq));
        f_awaitingNOTIFY_sendReply(mw_NOTIFY_Request_Base(vc_callId), v_msg_recv); 

        f_cf_01_down();
    } // End of testcase TC_LIS_SIP_BV_06

    /**
     * @desc "IUT responds to SIP Subscribe for ServiceState with Security Posture"
     */
    testcase TC_LIS_SIP_BV_07() runs on HttpSipComponent system TestAdapter {             
     // Local variables        
        var NOTIFY_Request v_msg_recv;
        var CSeq v_cSeq_s := {
          fieldName := CSEQ_E,
          seqNumber := 0,
          method := "SUBSCRIBE"
        };

        var SipUrl v_subscription_target :=  f_initSipUrl(c_serviceProfile_SUBSCRIPTION_SERVICE);

        // Test control
        f_check_pics({ values := {PICS_LIS_SIP_SECURITY_POSTURE}, names := {"PICS_LIS_SIP_SECURITY_POSTURE"}});
        
        // Test component configuration              
        f_cf_01_up();                          
        f_init_userprofile(c_userProfile_ESINetSubscriber);        
        f_init_interfaceprofile(c_interfaceProfile_SUT_LIS);
        
        // Preamble         
        LibIms_Steps.f_setHeadersSUBSCRIBE(v_cSeq_s, v_subscription_target, f_initSipUrl(c_serviceProfile_SUBSCRIBER));                                
        template SUBSCRIBE_Request request := m_SUBSCRIBE_ServiceState_Request_Event(
          v_subscription_target, vc_callId ,v_cSeq_s, vc_from, vc_to, vc_via, omit
        );

        f_SendSUBSCRIBE(request);        
        f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callId, vc_cSeq));                        
        f_awaitingNOTIFY_sendReply(mw_NOTIFY_Request_Base(vc_callId), v_msg_recv); 
        
        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);                                  

        // Test Body        
        LibIms_Steps.f_setHeadersSUBSCRIBE(v_cSeq_s, v_subscription_target, f_initSipUrl(c_serviceProfile_SUBSCRIBER));        
        f_SendSUBSCRIBE(m_UNSUBSCRIBE_ServiceState_Request_Event(
                                                            v_subscription_target, vc_callId ,v_cSeq_s, vc_from, vc_to, vc_via, omit
                                                          )
        );
        f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callId, vc_cSeq));
        f_awaitingNOTIFY_sendReply(mw_NOTIFY_Request_Base(vc_callId), v_msg_recv); 

        // Postamble
        f_cf_01_down();
    } // End of testcase TC_LIS_SIP_BV_07

  }


+23 −0
Original line number Diff line number Diff line
@@ -11,6 +11,29 @@ module LibNg112_SubscriptionPayloads {
        } with {
        variant(reason) "JSON:omit as null"
    }

    type record ServiceStatePayload {
        Service service,
        ServiceState serviceState,
        SecurityPosture securityPosture optional 
    }


    type record Service {
        charstring name,
        charstring domain
    }

    type record ServiceState {
        charstring state,
        charstring reason
    }

    type record SecurityPosture {
        charstring posture,
        charstring reason
    }

} with {
    encode "JSON";
}
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
@@ -263,6 +263,16 @@ module LibNg112_Functions {

          return v_result;
      }

      function f_decodeServiceState(in NOTIFY_Request p_request, inout ServiceStatePayload p_serviceStatePayload) return integer {
          var integer v_result;
          var universal charstring v_temp;
          
          v_temp := p_request.messageBody.textplain;     
          v_result := decvalue_unichar(v_temp, p_serviceStatePayload);

          return v_result;
      }
    }
    
} // End of module LibNg112_Functions
+77 −2
Original line number Diff line number Diff line
@@ -593,7 +593,51 @@ module LibNg112_Templates {
        state     := p_state,
        reason    := p_reason
      }
    } // End of template mw_presence
    } // End of template mw_element_state_payload


    template (present) SecurityPosture mw_security_posture(
                                            template (present) charstring p_posture := pattern "Green|Yellow|Orange|Red",
                                            template (present) charstring p_reason := ?
    ) := {
        posture := p_posture,
        reason  := p_reason
    }


    template (present) ServiceStatePayload mw_service_state_payload_with_security_posture(
                                            template  SecurityPosture p_security_posture := *    
    ) modifies mw_service_state_payload_Dummy := {
      securityPosture := p_security_posture
    }

    template (present) ServiceStatePayload mw_service_state_payload(
                                            template (present) charstring p_service_name := ?,
                                            template (present) charstring p_service_domain := ?,
                                            template (present) charstring p_service_state := pattern "Normal|Unstaffed|ScheduledMaintenanceDown|ScheduledMaintenanceAvailable|MajorIncidentInProgress|Partial|Overloaded|GoingDown|Down",
                                            template (present) charstring p_service_state_reason := ?,
                                            template  SecurityPosture p_security_posture := *                                            
    ) := {
      service := {
        name    := p_service_name,
        domain  := p_service_domain       
      },
      serviceState := {
        state  := p_service_state,
        reason := p_service_state_reason
      },
      securityPosture := p_security_posture
    } // End of template mw_service_state_payload


    template (present) ServiceStatePayload mw_service_state_payload_Dummy := {
        service := ?,
        serviceState := {
          state := pattern "Normal|Unstaffed|ScheduledMaintenanceDown|ScheduledMaintenanceAvailable|MajorIncidentInProgress|Partial|Overloaded|GoingDown|Down",
          reason := ?
        },
        securityPosture := *
    }    
    

    template(value) SUBSCRIBE_Request m_SUBSCRIBE_Presence_Request_Event(
@@ -653,6 +697,37 @@ module LibNg112_Templates {
                      expires := m_Expires_0
                  }
              }

    template(value) SUBSCRIBE_Request m_SUBSCRIBE_ServiceState_Request_Event(
                    template(value) SipUrl p_requestUri,
                    template(value) CallId p_callId,
                    template(value) CSeq p_cSeq,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) LibSip_SIPTypesAndValues.Contact p_contact := omit                  
                ) modifies m_SUBSCRIBE_Request_IMS := {
                    msgHeader := {
                        event := m_Event_serviceState,
                        expires := m_Expires_3600
                    }
                }

      template(value) SUBSCRIBE_Request m_UNSUBSCRIBE_ServiceState_Request_Event(
                  template(value) SipUrl p_requestUri,
                  template(value) CallId p_callId,
                  template(value) CSeq p_cSeq,
                  template(value) From p_from,
                  template(value) To p_to,
                  template(value) Via p_via,
                  template(omit) LibSip_SIPTypesAndValues.Contact p_contact := omit                  
              ) modifies m_SUBSCRIBE_Request_IMS := {
                  msgHeader := {
                      event := m_Event_serviceState,
                      expires := m_Expires_0
                  }
              } 

  }
  
} // End of module LibNg112_Templates