Commit 98691e24 authored by Yann Garcia's avatar Yann Garcia
Browse files

Validation Subscription for Vessel

parent 3680f765
Loading
Loading
Loading
Loading
+33 −12
Original line number Original line Diff line number Diff line
@@ -2,9 +2,30 @@
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.


# IUT roles
# IUT roles
LibCise_Pics.PICS_IUT_CDM_NODE := true
LibCise_Pics.PICS_IUT_CDM_NODE_EI_NA := true
LibCise_Pics.PICS_IUT_CDM_NODE_EI_NN := false
LibCise_Pics.PICS_IUT_CDM_ADAPTOR    := true
LibCise_Pics.PICS_IUT_CDM_ADAPTOR    := true


# Communication messages
LibCise_Pics.PICS_CDM_PULL            := true
LibCise_Pics.PICS_CDM_PUSH            := true
LibCise_Pics.PICS_CDM_SUBSCRIBE       := true
LibCise_Pics.PICS_CDM_ACKNOWLEDGEMENT := true
LibCise_Pics.PICS_CDM_FEEDBACK        := true

# Services
LibCise_Pics.PICS_CDM_VESSEL_SERVICE                       := true
LibCise_Pics.PICS_CDM_ACTION_SERVICE                       := true
LibCise_Pics.PICS_CDM_ANOMALY_SERVICE                      := true
LibCise_Pics.PICS_CDM_CERTIFICATE_DOCUMENT_SERVICE         := true
LibCise_Pics.PICS_CDM_INCIDENT_SERVICE                     := true
LibCise_Pics.PICS_CDM_IRREGULAR_MIGRATION_INCIDENT_SERVICE := true
LibCise_Pics.PICS_CDM_LAW_INFRINGEMENT_INCIDENT_SERVICE    := true
LibCise_Pics.PICS_CDM_METEO_SERVICE                        := true
LibCise_Pics.PICS_CDM_ORGANIZATION_SERVICE                 := true
LibCise_Pics.PICS_CDM_RISK_SERVICE                         := true
LibCise_Pics.PICS_CDM_CARGO_SERVICE                        := true

# LibCise
# LibCise
LibCise_Pics.PICS_CISE_CERTIFICATES_DB_PATH           := "/home/y.garcia/dev/cise-data-model/keystore"
LibCise_Pics.PICS_CISE_CERTIFICATES_DB_PATH           := "/home/y.garcia/dev/cise-data-model/keystore"
LibCise_Pics.PICS_CISE_TS_CERTIFICATE                 := "ciseadaptor5.crt" #"sim1_node01.node01.eucise.fr.pem"
LibCise_Pics.PICS_CISE_TS_CERTIFICATE                 := "ciseadaptor5.crt" #"sim1_node01.node01.eucise.fr.pem"
@@ -64,10 +85,10 @@ LibCise_Pixits.PX_MESSAGE_PROCESSING_INTERVAL := 2.0
# you want to log into the file or display on console (standard error).
# you want to log into the file or display on console (standard error).


LogFile := "../logs/AtsCise/%e.%h-%r.%s"
LogFile := "../logs/AtsCise/%e.%h-%r.%s"
#FileMask := LOG_ALL | USER | DEBUG | MATCHING
FileMask := LOG_ALL | USER | DEBUG | MATCHING
#ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING
ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING
FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TIMEROP | TESTCASE
#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TIMEROP | TESTCASE
ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TIMEROP | TESTCASE
#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TIMEROP | TESTCASE
LogSourceInfo := Stack
LogSourceInfo := Stack
LogEntityName:= Yes
LogEntityName:= Yes
LogEventTypes:= Yes
LogEventTypes:= Yes
@@ -123,7 +144,7 @@ system.utPort.params := "HTTP(codecs=xml:xml_codec;json:json_codec)/TCP(debug=1,


## cise_node_ei_na
## cise_node_ei_na
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving a PullRequest for Vessel service - no Acknowledgment required
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving a PullRequest for Vessel service - no Acknowledgment required
AtsCise_TestCases.TC_CDM_NODE_EI_NA_PULL_REQUEST_BV_01_01
#AtsCise_TestCases.TC_CDM_NODE_EI_NA_PULL_REQUEST_BV_01_01
# Check that the IUT sends a PullResponse before reponse timout expiry when receiving a PullRequest with timeout on response - no Acknowledgment required
# Check that the IUT sends a PullResponse before reponse timout expiry when receiving a PullRequest with timeout on response - no Acknowledgment required
#AtsCise_TestCases.TC_CDM_NODE_EI_NA_PULL_REQUEST_BV_01_02
#AtsCise_TestCases.TC_CDM_NODE_EI_NA_PULL_REQUEST_BV_01_02
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving a PullRequest for a unknown vessel - no Acknowledgment required
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving a PullRequest for a unknown vessel - no Acknowledgment required
@@ -220,7 +241,7 @@ AtsCise_TestCases.TC_CDM_NODE_EI_NA_PULL_REQUEST_BV_01_01
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving a subscription for VesselService
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving a subscription for VesselService
#AtsCise_TestCases.TC_CDM_NODE_EI_NA_SUB_BV_01
#AtsCise_TestCases.TC_CDM_NODE_EI_NA_SUB_BV_01
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response and an error code when receiving a subscription ending in past
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response and an error code when receiving a subscription ending in past
#AtsCise_TestCases.TC_CDM_NODE_EI_NA_SUB_BO_01
AtsCise_TestCases.TC_CDM_NODE_EI_NA_SUB_BO_01


# Check that the IUT sends a request of subcribers list for ActionService when triggered
# Check that the IUT sends a request of subcribers list for ActionService when triggered
#AtsCise_TestCases.TC_CDM_NODE_EI_NA_SUB_BV_02
#AtsCise_TestCases.TC_CDM_NODE_EI_NA_SUB_BV_02
+1 −1
Original line number Original line Diff line number Diff line
@@ -2,7 +2,7 @@
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.


# IUT roles
# IUT roles
LibCise_Pics.PICS_IUT_CDM_NODE := true
LibCise_Pics.PICS_IUT_CDM_NODE_EI_NA := true
LibCise_Pics.PICS_IUT_CDM_ADAPTOR  := true
LibCise_Pics.PICS_IUT_CDM_ADAPTOR  := true


# LibCise
# LibCise
Original line number Original line Diff line number Diff line
Subproject commit c38a2f267cb659c8180548bc82721d34dc71ef85
Subproject commit 6901c1c381950f308d2b1643e90757248ae99eab
+544 −411

File changed.

Preview size limit exceeded, changes collapsed.

+109 −6
Original line number Original line Diff line number Diff line
@@ -166,21 +166,20 @@ module LibCise_Functions {
     * @desc Process preamble/postamble subscriptions
     * @desc Process preamble/postamble subscriptions
     */
     */
    function f_process_subscription(
    function f_process_subscription(
                                    in PullType p_pull_type := subscribe,
                                    in template (omit) Service p_service,
                                    in template (omit) Service p_service,
                                    in template (omit) Service p_recipient,
                                    in template (omit) Service p_recipient,
                                    in template (omit) XmlEntityPayload p_entity_payload := omit,
                                    in template (omit) XmlEntityPayload p_entity_payload := omit,
                                    in template (omit) PayloadSelector p_payload_selector := omit,
                                    in template (omit) PayloadSelector p_payload_selector := omit,
                                    in template (value) PullRequest_1.discoveryProfiles_list p_discovery_profiles := {},
                                    in template (value) PullRequest_1.discoveryProfiles_list p_discovery_profiles := {},
                                    in template (omit) ServiceCapability_derivations p_requests := omit,
                                    in template (omit) ServiceCapability_derivations p_requests := omit,
                                    template Acknowledgement_1.discoveredServices_list p_ack_discovery_services := *
                                    out charstring p_correlation_id,
                                    template Acknowledgement_1.discoveredServices_list p_ack_discovery_services := ?
                                    ) runs on CiseComponent return boolean {
                                    ) runs on CiseComponent return boolean {
      // Local variables
      // Local variables
      var Headers v_headers;
      var Headers v_headers;
      var charstring v_date_time := f_get_current_date_time();
      var charstring v_date_time := f_get_current_date_time();
      var charstring v_expected_date_time := substr(v_date_time, 0, lengthof(v_date_time) - 5);
      var charstring v_expected_date_time := substr(v_date_time, 0, lengthof(v_date_time) - 5);
      var charstring v_message_id := f_generate_uuid();
      var charstring v_message_id := f_generate_uuid();
      var charstring v_correlation_id := f_generate_uuid();
      var charstring v_context_id := f_generate_uuid();
      var charstring v_context_id := f_generate_uuid();
      var template (omit) CoreEntityPayload_derivations v_payload := omit;
      var template (omit) CoreEntityPayload_derivations v_payload := omit;
      var PullRequest_1 v_pull_request;
      var PullRequest_1 v_pull_request;
@@ -192,6 +191,8 @@ module LibCise_Functions {


      log(">>> f_process_subscription");
      log(">>> f_process_subscription");


      p_correlation_id := f_generate_uuid();

      if (ispresent(p_entity_payload)) {
      if (ispresent(p_entity_payload)) {
        v_payload := m_core_entity_payload_derivations_payload(p_entity_payload);
        v_payload := m_core_entity_payload_derivations_payload(p_entity_payload);
      }
      }
@@ -202,11 +203,11 @@ module LibCise_Functions {
                                              high,
                                              high,
                                              p_service,
                                              p_service,
                                              {},
                                              {},
                                              p_pull_type,
                                              subscribe,
                                              p_discovery_profiles,
                                              p_discovery_profiles,
                                              -, -,
                                              -, -,
                                              v_context_id,
                                              v_context_id,
                                              v_correlation_id,
                                              p_correlation_id,
                                              PX_CISE_REQUEST_ACK, // RequiresAck
                                              PX_CISE_REQUEST_ACK, // RequiresAck
                                              p_recipient,
                                              p_recipient,
                                              v_payload,
                                              v_payload,
@@ -252,7 +253,7 @@ module LibCise_Functions {
                                                                                                                                                  success,
                                                                                                                                                  success,
                                                                                                                                                  p_ack_discovery_services,
                                                                                                                                                  p_ack_discovery_services,
                                                                                                                                                  -, -, -,
                                                                                                                                                  -, -, -,
                                                                                                                                                  v_correlation_id
                                                                                                                                                  p_correlation_id
                            )))))) {
                            )))))) {
          tc_ac.stop;
          tc_ac.stop;


@@ -268,6 +269,108 @@ module LibCise_Functions {
      return v_res_code;
      return v_res_code;
    } // End of function f_process_subscription
    } // End of function f_process_subscription


    function f_process_unsubscribe(
                                   in charstring p_correlation_id,
                                   in template (omit) Service p_service,
                                   in template (omit) Service p_recipient/*,
                                   in template (omit) XmlEntityPayload p_entity_payload := omit,
                                   in template (omit) PayloadSelector p_payload_selector := omit,
                                   in template (value) PullRequest_1.discoveryProfiles_list p_discovery_profiles := {},
                                   in template (omit) ServiceCapability_derivations p_requests := omit,
                                   template Acknowledgement_1.discoveredServices_list p_ack_discovery_services := **/
                                   ) runs on CiseComponent return boolean {
      // Local variables
      var Headers v_headers;
      var charstring v_date_time := f_get_current_date_time();
      var charstring v_expected_date_time := substr(v_date_time, 0, lengthof(v_date_time) - 5);
      var charstring v_message_id := f_generate_uuid();
      var charstring v_context_id := f_generate_uuid();
      //var template (omit) CoreEntityPayload_derivations v_payload := omit;
      var PullRequest_1 v_pull_request;
      var octetstring v_pull_request_signed;
      var charstring v_pull_request_canonicalized;
      var charstring v_pull_request_signed_str;
      var integer v_result;
      var boolean v_res_code := false;

      log(">>> f_process_unsubscribe");

      // if (ispresent(p_entity_payload)) {
      //   v_payload := m_core_entity_payload_derivations_payload(p_entity_payload);
      // }
      v_pull_request := valueof(
                                m_pull_request(
                                              v_date_time,
                                              v_message_id,
                                              high,
                                              p_service,
                                              {},
                                              unsubscribe,
                                              -, // p_discovery_profiles,
                                              -, -,
                                              v_context_id,
                                              p_correlation_id,
                                              PX_CISE_REQUEST_ACK, // RequiresAck
                                              p_recipient,
                                              -, //v_payload,
                                              -,
                                              1000, // ResponseTimeOut
                                              -, //p_requests,
                                              - //p_payload_selector
                                              ));
      v_result := f_sign_pull_request(v_pull_request, PX_SECURITY_SIGN_HASH_ALG, PICS_CISE_TS_CERTIFICATE, PICS_CISE_TS_SIGNING_PRIVATE_KEY, PICS_CISE_TS_SIGNING_PRIVATE_PASSWD, v_pull_request_signed, v_pull_request_canonicalized);
      if (v_result != 0) {
        log("f_process_unsubscribe: INCONC: Signature processing failed");
        return v_res_code;
      }
      v_pull_request_signed_str := oct2char(v_pull_request_signed);
      log("v_pull_request_signed_str: ", v_pull_request_signed_str);

      //f_verify_sign_pull_request(valueof(m_xml_body_pull_request(v_pull_request, v_pull_request_signed_str)), ""/*v_pull_response_canonicalized*/);

      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                  m_http_request_post(
                                                      PICS_ROOT_API & PICS_CISE_PULL_REQUEST_URI & "?messageId=" & v_message_id,
                                                      v_headers,
                                                      m_http_message_body_xml(
                                                                              m_xml_body_pull_request( // As the message was signed, we need to send as raw XML to prevent codec call
                                                                                                      v_pull_request,
                                                                                                      v_pull_request_signed_str // If raw is specified, the codec does not encode the message
                                                                                                      )))));

      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                              mw_http_response_201_created(
                                                                          mw_http_message_body_xml(
                                                                                                  mw_xml_body_acknowledgement(
                                                                                                                              mw_acknowledgement(
                                                                                                                                                  ?,
                                                                                                                                                  ?, //pattern "v_message_id*",
                                                                                                                                                  -, -,
                                                                                                                                                  success,
                                                                                                                                                  -, //p_ack_discovery_services,
                                                                                                                                                  -, -, -,
                                                                                                                                                  p_correlation_id
                            )))))) {
          tc_ac.stop;

          log("f_process_unsubscribe: IUT successfully received synchronous Acknowledgment");
          v_res_code := true;
        }
        [] tc_ac.timeout {
          log("f_process_unsubscribe: Expected message not received");
        }
      } // End of 'alt' statement

      log("<<< f_process_unsubscribe: v_res_code=", v_res_code);
      return v_res_code;
    } // End of function f_process_unsubscribe

    function f_trigger_subscription(
    function f_trigger_subscription(
                                    in template (value) UtTrigger p_ut_trigger,
                                    in template (value) UtTrigger p_ut_trigger,
                                    out PullRequest_1 p_pull_request
                                    out PullRequest_1 p_pull_request
Loading