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

Adapt ServiceState, SecurityPosture Payload

Adapt Payload to TS Schemas
parent 89b90aec
Loading
Loading
Loading
Loading
+13 −12
Original line number Diff line number Diff line
@@ -940,7 +940,7 @@ module AtsLIS_TestCases {


    /**
     * @desc "IUT responds to SIP Subscribe for ServiceState with Security Posture"
     * @desc "IUT responds to SIP Subscribe for Security Posture"
     */
    testcase TC_LIS_SIP_BV_06() runs on HttpSipComponent system TestAdapter {             
        // Local variables        
@@ -963,7 +963,7 @@ module AtsLIS_TestCases {
        
        // 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(
        template SUBSCRIBE_Request request := m_SUBSCRIBE_SecurityPosture_Request_Event(
          v_subscription_target, vc_callId ,v_cSeq_s, vc_from, vc_to, vc_via, omit
        );

@@ -972,21 +972,21 @@ module AtsLIS_TestCases {

        // Test Body
        f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callId, vc_cSeq));                        
        f_awaitingNOTIFY_sendReply(mw_NOTIFY_ServiceState_Base(vc_callId), v_msg_recv); 
        f_awaitingNOTIFY_sendReply(mw_NOTIFY_SecurityPosture_Base(vc_callId), v_msg_recv); 
                      
        var ServiceStatePayload v_serviceStatePayload;
        f_decodeServiceState(v_msg_recv, v_serviceStatePayload);
        var SecurityPosturePayload v_securityPosturePayload;
        f_decodeSecurityPosture(v_msg_recv, v_securityPosturePayload);
                
        if (match(v_serviceStatePayload, mw_service_state_payload_with_security_posture(mw_security_posture))) {
        if (match(v_securityPosturePayload, mw_security_posture_payload())) {
          f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
        } else {
          log(match(v_serviceStatePayload, mw_service_state_payload_with_security_posture(mw_security_posture)));
          log(match(v_securityPosturePayload, mw_security_posture_payload()));
          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(
        f_SendSUBSCRIBE(m_UNSUBSCRIBE_SecurityPosture_Request_Event(
                                                            v_subscription_target, vc_callId ,v_cSeq_s, vc_from, vc_to, vc_via, omit
                                                          )
        );
@@ -996,8 +996,9 @@ module AtsLIS_TestCases {
        f_cf_01_down();
    } // End of testcase TC_LIS_SIP_BV_06


    /**
     * @desc "IUT responds to SIP Unsubscribe for ServiceState with Security Posture"
     * @desc "IUT responds to SIP Unsubscribe for Security Posture"
     */
    testcase TC_LIS_SIP_BV_07() runs on HttpSipComponent system TestAdapter {             
     // Local variables        
@@ -1020,19 +1021,19 @@ module AtsLIS_TestCases {
        
        // 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(
        template SUBSCRIBE_Request request := m_SUBSCRIBE_SecurityPosture_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_ServiceState_Base(vc_callId), v_msg_recv); 
        f_awaitingNOTIFY_sendReply(mw_NOTIFY_SecurityPosture_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(
        f_SendSUBSCRIBE(m_UNSUBSCRIBE_SecurityPosture_Request_Event(
                                                            v_subscription_target, vc_callId ,v_cSeq_s, vc_from, vc_to, vc_via, omit
                                                          )
        );
+4 −6
Original line number Diff line number Diff line
@@ -14,8 +14,7 @@ module LibNg112_SubscriptionPayloads {

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


@@ -29,11 +28,10 @@ module LibNg112_SubscriptionPayloads {
        charstring reason
    }

    type record SecurityPosture {
        charstring posture,
        charstring reason
    type record SecurityPosturePayload {
        Service service,
        charstring securityPosture
    }

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

          return v_result;
      }

      function f_decodeSecurityPosture(in NOTIFY_Request p_request, inout SecurityPosturePayload p_securityPosturePayload) return integer {
          var integer v_result;
          var universal charstring v_temp;
          
          v_temp := p_request.messageBody.textplain;     
          v_result := decvalue_unichar(v_temp, p_securityPosturePayload);

          return v_result;
      }
    }
    
} // End of module LibNg112_Functions
+65 −25
Original line number Diff line number Diff line
@@ -582,6 +582,7 @@ module LibNg112_Templates {
    
    template(value) Event m_Event_elementState modifies m_Event_base := {eventType := "emergency-ElementState"}
    template(value) Event m_Event_serviceState modifies m_Event_base := {eventType := "emergency-ServiceState"}
    template(value) Event m_Event_securityPosture modifies m_Event_base := {eventType := "emergency-SecurityPosture"}

    template (present) ElementStatePayload mw_element_state_payload(
                                            template (present) charstring p_elementId := ?,
@@ -596,27 +597,24 @@ module LibNg112_Templates {
    } // 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 := ?
    template (present) SecurityPosturePayload mw_security_posture(
                                            template (present) charstring p_service_name := ?,
                                            template (present) charstring p_service_domain := ?,      
                                            template (present) charstring p_posture := pattern "Green|Yellow|Orange|Red"                                            
    ) := {
        posture := p_posture,
        reason  := p_reason
      service := {
        name    := p_service_name,
        domain  := p_service_domain       
      },
      securityPosture := p_posture        
    }


    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 := mw_security_posture                                            
                                            template (present) charstring p_service_state_reason := ?                                            
    ) := {
      service := {
        name    := p_service_name,
@@ -625,20 +623,21 @@ module LibNg112_Templates {
      serviceState := {
        state  := p_service_state,
        reason := p_service_state_reason
      },
      securityPosture := p_security_posture ifpresent
      }
    } // 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 := ?
    template (present) SecurityPosturePayload mw_security_posture_payload(
                                            template (present) charstring p_service_name := ?,
                                            template (present) charstring p_service_domain := ?,
                                            template (present) charstring p_security_posture := pattern "green|yellow|orange|red"                                            
    ) := {
      service := {
        name    := p_service_name,
        domain  := p_service_domain       
      },
        securityPosture := *
    }    

      securityPosture := p_security_posture
    } // End of template mw_service_state_payload

    template(present) NOTIFY_Request mw_NOTIFY_Presence_Base(
                                                          template CallId p_callId                                                                                                                    
@@ -670,12 +669,23 @@ module LibNg112_Templates {
                  msgHeader := {
                    contentType :={
                        fieldName := CONTENT_TYPE_E,                        
                        mTypeSubtype := "application/emergency.ServiceState+json"
                        mTypeSubtype := "application/emergencyCallData.ServiceState+json"
                    }
                  }
    }


    template(present) NOTIFY_Request mw_NOTIFY_SecurityPosture_Base(
                                                          template CallId p_callId                                                                                                                    
    ) modifies mw_NOTIFY_Request_Base := {
                  msgHeader := {
                    contentType :={
                        fieldName := CONTENT_TYPE_E,                        
                        mTypeSubtype := "application/emergencyCallData.SecurityPosture+json"
                    }
                  }
    }


    template(value) SUBSCRIBE_Request m_SUBSCRIBE_Presence_Request_Event(
                    template(value) SipUrl p_requestUri,
@@ -765,6 +775,36 @@ module LibNg112_Templates {
                  }
              } 

   template(value) SUBSCRIBE_Request m_SUBSCRIBE_SecurityPosture_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_securityPosture,
                        expires := m_Expires_3600
                    }
                }

      template(value) SUBSCRIBE_Request m_UNSUBSCRIBE_SecurityPosture_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_securityPosture,
                      expires := m_Expires_0
                  }
              } 

  }
  
} // End of module LibNg112_Templates