Commit 4003f873 authored by Yann Garcia's avatar Yann Garcia
Browse files

Adding new TCs for I1

parent d94d3366
Loading
Loading
Loading
Loading
+10 −2
Original line number Original line Diff line number Diff line
@@ -38,6 +38,10 @@ int xml_codec::encode(const LibHttp__XmlMessageBodyTypes::XmlBody& body, OCTETST
      const http__www__cise__eu__servicemodel__v1__message::Acknowledgement& acknowledgement= msg.acknowledgement();
      const http__www__cise__eu__servicemodel__v1__message::Acknowledgement& acknowledgement= msg.acknowledgement();
      loggers::get_instance().log_msg("xml_codec::encode: Process Acknowledgement: ", (const Base_Type&)acknowledgement);
      loggers::get_instance().log_msg("xml_codec::encode: Process Acknowledgement: ", (const Base_Type&)acknowledgement);
      acknowledgement.encode(http__www__cise__eu__servicemodel__v1__message::Acknowledgement_descr_, encoding_buffer, TTCN_EncDec::CT_XER, XER_EXTENDED);
      acknowledgement.encode(http__www__cise__eu__servicemodel__v1__message::Acknowledgement_descr_, encoding_buffer, TTCN_EncDec::CT_XER, XER_EXTENDED);
    } else if (msg.ischosen(LibHttp__XmlMessageBodyTypes::XmlBodyMsg::ALT_push)) {
      const http__www__cise__eu__servicemodel__v1__message::Push& push= msg.push();
      loggers::get_instance().log_msg("xml_codec::encode: Process Push: ", (const Base_Type&)push);
      push.encode(http__www__cise__eu__servicemodel__v1__message::Push_descr_, encoding_buffer, TTCN_EncDec::CT_XER, XER_EXTENDED);
    } else {
    } else {
      loggers::get_instance().warning("xml_codec::encode: Unsupported variant");
      loggers::get_instance().warning("xml_codec::encode: Unsupported variant");
      return -1;
      return -1;
@@ -53,7 +57,7 @@ int xml_codec::encode(const LibHttp__XmlMessageBodyTypes::XmlBody& body, OCTETST
      data = OCTETSTRING(canonicalized.length(), (const unsigned char*)canonicalized.c_str());
      data = OCTETSTRING(canonicalized.length(), (const unsigned char*)canonicalized.c_str());
    }
    }


    { // TITAN issue: variant "namespace for 'agent/organization' seems buggy: <Agent xsi:type="agent:Organization">
    /*{ // TITAN issue: variant "namespace for 'agent/organization' seems buggy: <Agent xsi:type="agent:Organization">
      //        ==> xmlns:xsi=http://www.cise.eu/datamodel/v1/entity/organization/ xsi:type="ns4:Organization"
      //        ==> xmlns:xsi=http://www.cise.eu/datamodel/v1/entity/organization/ xsi:type="ns4:Organization"
      loggers::get_instance().log("xml_codec::encode: Apply TITAN workaround");
      loggers::get_instance().log("xml_codec::encode: Apply TITAN workaround");
      std::string s(static_cast<const unsigned char*>(data), data.lengthof() + static_cast<const unsigned char*>(data));
      std::string s(static_cast<const unsigned char*>(data), data.lengthof() + static_cast<const unsigned char*>(data));
@@ -69,7 +73,7 @@ int xml_codec::encode(const LibHttp__XmlMessageBodyTypes::XmlBody& body, OCTETST
      } // End of 'while' statement
      } // End of 'while' statement


      data = OCTETSTRING(s.length(), (const unsigned char*)s.c_str());
      data = OCTETSTRING(s.length(), (const unsigned char*)s.c_str());
    }
    }*/


    // Add header
    // Add header
    CHARSTRING h("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n");
    CHARSTRING h("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n");
@@ -134,6 +138,10 @@ int xml_codec::decode (const OCTETSTRING& p_data, LibHttp__XmlMessageBodyTypes::


    acknowledgement.decode(http__www__cise__eu__servicemodel__v1__message::Acknowledgement_descr_, decoding_buffer, TTCN_EncDec::CT_XER, XER_EXTENDED);
    acknowledgement.decode(http__www__cise__eu__servicemodel__v1__message::Acknowledgement_descr_, decoding_buffer, TTCN_EncDec::CT_XER, XER_EXTENDED);
    msg.acknowledgement() = acknowledgement;
    msg.acknowledgement() = acknowledgement;
  } else if ((it->second.find("<Push") != std::string::npos) || (it->second.find(":Push") != std::string::npos)) {
    http__www__cise__eu__servicemodel__v1__message::Push push;
    push.decode(http__www__cise__eu__servicemodel__v1__message::Push_descr_, decoding_buffer, TTCN_EncDec::CT_XER, XER_EXTENDED);
    msg.push() = push;
  } else {
  } else {
    loggers::get_instance().warning("xml_codec::decode: Unsupported variant");
    loggers::get_instance().warning("xml_codec::decode: Unsupported variant");
    return -1;
    return -1;
+27 −2
Original line number Original line Diff line number Diff line
@@ -43,6 +43,10 @@ LibCise_Pixits.PX_ORGANIZATION_UUID := "787aa3e9b91b-5bc2-0cf5-80a8-183a71
LibCise_Pixits.PX_PERIOD_START_DATE := "2023-09-01+01:00"
LibCise_Pixits.PX_PERIOD_START_DATE := "2023-09-01+01:00"
LibCise_Pixits.PX_PERIOD_END_DATE   := "2023-09-01+01:00"
LibCise_Pixits.PX_PERIOD_END_DATE   := "2023-09-01+01:00"


# Incident
LibCise_Pixits.PX_IRREGULAR_MIGRATION_INCIDENT_TYPE := irregularBorderEntry
LibCise_Pixits.PX_LAW_INFRINGEMENT_INCIDENT_TYPE    := lawInfringementByVessels

# Upper Tester
# Upper Tester
LibCise_Pixits.PX_UT_VESSEL_TYPE                  := "Organization"
LibCise_Pixits.PX_UT_VESSEL_TYPE                  := "Organization"
LibCise_Pixits.PX_UT_VESSEL_IDINTIFICATION_NUMBER := "inovaworks"
LibCise_Pixits.PX_UT_VESSEL_IDINTIFICATION_NUMBER := "inovaworks"
@@ -134,11 +138,32 @@ system.utPort.params := "HTTP(codecs=xml:xml_codec;json:json_codec)/TCP(debug=1,
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BO_01_06
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BO_01_06


# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving a PullRequest for Action service - no Acknowledgment required
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving a PullRequest for Action service - no Acknowledgment required
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BV_02_01
AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BV_02_01
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving a PullRequest for Action service - no Acknowledgment required
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving a PullRequest for Action service - no Acknowledgment required
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BV_02_02
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BV_02_02
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response and an error code when receiving a PullRequest with inconsistent Location
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response and an error code when receiving a PullRequest with inconsistent Location
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BO_02_01
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BO_02_01
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response and an error code when receiving a PullRequest with inconsistent Involved agent
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BO_02_01

# Check the IUT sends a PullResponse before reponse timout expiry when receiving a PullRequest with an Anomaly
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BV_03

# Check that the IUT sends a PullResponse before reponse timout expiry when receiving a PullRequest with a vessel document certificate
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BV_04
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving a PullRequest with a vessel document certificate with an invalid Integrity check
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BO_04

# Check that the IUT sends a PullResponse before reponse timout expiry when receiving a PullRequest with an Incident
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BV_05

# Check the IUT sends a PullResponse before reponse timout expiry when receiving a PullRequest with an IrregularMigrationIncident
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BV_06

# Check the IUT sends a PullResponse before reponse timout expiry when receiving a PullRequest with an IrregularMigrationIncident
#AtsCise_TestCases.TC_CDM_NODE_PULL_REQUEST_BV_07




# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving multiple PullRequest for Vessel service - no Acknowledgment required
# Check that the IUT responds with an HTTP 200 OK Acknowledgment response when receiving multiple PullRequest for Vessel service - no Acknowledgment required
#AtsCise_TestCases.TC_CDM_NODE_MULTI_PULL_REQ_BV_01
#AtsCise_TestCases.TC_CDM_NODE_MULTI_PULL_REQ_BV_01
@@ -147,7 +172,7 @@ system.utPort.params := "HTTP(codecs=xml:xml_codec;json:json_codec)/TCP(debug=1,
#AtsCise_TestCases.TC_CDM_NODE_PULL_DISC_BV_01
#AtsCise_TestCases.TC_CDM_NODE_PULL_DISC_BV_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_SUB_BV_01
#AtsCise_TestCases.TC_CDM_NODE_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_SUB_BO_01
#AtsCise_TestCases.TC_CDM_NODE_SUB_BO_01


+758 −359

File changed.

Preview size limit exceeded, changes collapsed.

+15 −5
Original line number Original line Diff line number Diff line
@@ -167,7 +167,7 @@ success. */
	XSD.String ackDetail length(5000) optional,
	XSD.String ackDetail length(5000) optional,
	/* Used in operations like to Discovery or Get Subscribers to return the
	/* Used in operations like to Discovery or Get Subscribers to return the
results of the operation. */
results of the operation. */
	record of Service_1 discoveredServices_list							optional, /**modified**/
	record of Service_1 discoveredServices_list, /**							optionalmodified**/
	XSD.String elem optional
	XSD.String elem optional
}
}
with {
with {
@@ -194,7 +194,7 @@ with {
  variant (elem) "anyElement except 'AckCode'"/*unqualified, 'http://www.cise.eu/servicemodel/v1/message/'"*/;
  variant (elem) "anyElement except 'AckCode'"/*unqualified, 'http://www.cise.eu/servicemodel/v1/message/'"*/;
  variant (AckCode) "name as capitalized";
  variant (AckCode) "name as capitalized";
  variant (ackDetail) "name as capitalized";
  variant (ackDetail) "name as capitalized";
  //variant (discoveredServices_list) "untagged";
  variant (discoveredServices_list) "untagged";
  variant (discoveredServices_list[-]) "name as 'DiscoveredServices'";
  variant (discoveredServices_list[-]) "name as 'DiscoveredServices'";
};
};


@@ -319,6 +319,11 @@ data. */
	They have not been generated automatically. */
	They have not been generated automatically. */
	Vessel 				       vessel 	optional,
	Vessel 				       vessel 	optional,
	Action                     action_ optional,
	Action                     action_ optional,
	Anomaly                    anomaly optional,
	CertificateDocument        certificateDocument optional,
	Incident                   incident optional,
	IrregularMigrationIncident irregularMigrationIncident optional,
    LawInfringementIncident    lawInfringementIncident optional,
	Cargo				       cargo optional,
	Cargo				       cargo optional,
	record of XSD.String elem_list
	record of XSD.String elem_list
}
}
@@ -336,6 +341,11 @@ with {
  //variant (ensureEncryption) "text 'false' as '0'";
  //variant (ensureEncryption) "text 'false' as '0'";
  variant (vessel) "name as capitalized";
  variant (vessel) "name as capitalized";
  variant (action_) "name as 'Action'";
  variant (action_) "name as 'Action'";
  variant (anomaly) "name as capitalized";
  variant (certificateDocument) "name as capitalized";
  variant (incident) "name as capitalized";
  variant (irregularMigrationIncident) "name as capitalized";
  variant (lawInfringementIncident) "name as capitalized";
  variant (cargo) "name as capitalized";
  variant (cargo) "name as capitalized";
  variant (elem_list) "untagged";
  variant (elem_list) "untagged";
  variant (elem_list[-]) "anyElement except 'Signature'";
  variant (elem_list[-]) "anyElement except 'Signature'";
+105 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@ module LibCise_Functions {
  import from LibHttp_TypesAndValues all;
  import from LibHttp_TypesAndValues all;
  import from LibHttp_XmlMessageBodyTypes all;
  import from LibHttp_XmlMessageBodyTypes all;
  import from LibHttp_JsonTemplates all;
  import from LibHttp_JsonTemplates all;
  import from LibHttp_XmlTemplates all;
  import from LibHttp_Templates all;
  import from LibHttp_Templates all;
  import from LibHttp_Functions all;
  import from LibHttp_Functions all;
  import from LibHttp_TestSystem all;
  import from LibHttp_TestSystem all;
@@ -27,6 +28,7 @@ module LibCise_Functions {
  import from LibCise_TypesAndValues all;
  import from LibCise_TypesAndValues all;
  import from LibCise_TestSystem all;
  import from LibCise_TestSystem all;
  import from http_www_cise_eu_servicemodel_v1_message all;
  import from http_www_cise_eu_servicemodel_v1_message all;
  import from http_www_cise_eu_servicemodel_v1_service all;
  import from http_www_w3_org_2000_09_xmldsig all;
  import from http_www_w3_org_2000_09_xmldsig all;


  // LibCise
  // LibCise
@@ -124,6 +126,109 @@ module LibCise_Functions {


  group cise_functions {
  group cise_functions {


    /**
      * @desc Process preamble/postamble subscriptions
      */
    function f_process_subscription(
                                    in PullType p_pull_type := subscribe,
                                    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 := {},
                                    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_correlation_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;

      // Preamble
      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,
                                              {}, 
                                              p_pull_type,
                                              p_discovery_profiles,
                                              -, -, 
                                              v_context_id,
                                              v_correlation_id, 
                                              PX_CISE_REQUEST_ACK, // RequiresAck
                                              p_recipient,
                                              v_payload,
                                              -,
                                              1000, // ResponseTimeOut
                                              -,
                                              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("*** " & testcasename() & ": 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, 
                                                                                                                                                  -, -, -,
                                                                                                                                                  v_correlation_id                                                                                                                                                  
                            )))))) {
          tc_ac.stop;

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

      return v_res_code;
    } // End of function f_process_subscription

    function f_sign_pull_request(
    function f_sign_pull_request(
                                 in PullRequest_1 p_pull_request, 
                                 in PullRequest_1 p_pull_request, 
                                 in HashAlgorithm p_hash_algorithm, 
                                 in HashAlgorithm p_hash_algorithm, 
Loading