Commit de8ff769 authored by garciay's avatar garciay
Browse files

STF545: Review TPlan

parent 5534c135
Loading
Loading
Loading
Loading
+22 −18
Original line number Diff line number Diff line
@@ -377,6 +377,7 @@ int http_codec::decode_header(CHARSTRING& header_line, LibItsHttp__TypesAndValue

int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody& p_message_body, OCTETSTRING& p_encoding_buffer, const std::string& p_content_type) {
  loggers::get_instance().log_msg(">>> http_codec::encode_body: ", (const Base_Type&)p_message_body);
  loggers::get_instance().log("http_codec::encode_body: # of codecs=%d - %p", _codecs.size(), this);

  // Sanity check
  if (p_content_type.empty()) {
@@ -391,12 +392,11 @@ int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody&
    } else {
      std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > >::const_iterator it;
      bool processed = false;
      loggers::get_instance().log("http_codec::encode_body: # of codecs=%d - %p", _codecs.size(), this);
      if (p_content_type.find("x-its") != std::string::npos) {
        loggers::get_instance().log("http_codec::encode_body: Find x-its");
        it = _codecs.find("http_its"); // TODO Use params
        if (it != _codecs.cend()) {
          loggers::get_instance().log("http_codec::encode_body: Call 'http_etsi_ieee1609dot2_codec'");
          loggers::get_instance().log("http_codec::encode_body: Call '%s'", it->first.c_str());
          _codecs["http_its"]->encode((Record_Type&)binary_body.ieee1609dot2__data(), p_encoding_buffer); // TODO Use params
          processed = true;
        }
@@ -417,7 +417,6 @@ int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody&
    } else {
      std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > >::const_iterator it;
      bool processed = false;
      loggers::get_instance().log("http_codec::encode_body: # of codecs=%d - %p", _codecs.size(), this);
      loggers::get_instance().log("http_codec::encode_body: Content-type:'%s'", p_content_type.c_str());
      if (p_content_type.find("held") != std::string::npos) {
        it = _codecs.find("held"); // TODO Use params
@@ -453,6 +452,7 @@ int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody&
int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBodyTypes::HttpMessageBody& message_body, const std::string& p_content_type) {
  loggers::get_instance().log(">>> http_codec::decode_body");
  loggers::get_instance().log_to_hexa("http_codec::decode_body", decoding_buffer);
  loggers::get_instance().log("http_codec::decode_body: # of codecs=%d - %p", _codecs.size(), this);
  loggers::get_instance().log("http_codec::decode_body: Content-Type=%s", p_content_type.c_str());

  // Sanity checks
@@ -505,10 +505,13 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
  LibItsHttp__MessageBodyTypes::HttpMessageBody v;
  if (_dc.is_binary == 0x01) {
    LibItsHttp__BinaryMessageBodyTypes::BinaryBody binary_body;
    std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > >::const_iterator it;
    bool processed = false;
    // TODO To be refined adding a string identifier to check which codec to use. E.g. held_code.id() returns "xmlns=\"urn:ietf:params:xml:ns:geopriv:held\">"
    if (p_content_type.find("x-its") != std::string::npos) {
      loggers::get_instance().log("http_codec::decode_body: Find 'x-its'");
      it = _codecs.cbegin();//_codecs.find("http_its");
      if (it != _codecs.cend()) {
        /***
            FIXME:
            This code generate a codedump, I don't undertsand the reason.
@@ -520,13 +523,14 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
            processed = true;
            }
            }*/
      loggers::get_instance().log("http_codec::decode_body: Call 'http_etsi_ieee1609dot2_codec'");
        loggers::get_instance().log("http_codec::decode_body: Call '%s'", it->first.c_str());
        http_etsi_ieee1609dot2_codec* codec = new http_etsi_ieee1609dot2_codec();
        if (codec->decode(body, binary_body.ieee1609dot2__data()) == 0) {
          message_body.binary__body() = binary_body;
          processed = true;
        }
        delete codec;
      }
    } // TODO Add new HTTP message codec here
    if (!processed) {
      loggers::get_instance().warning("http_codec::decode_body: Unsupported HTTP codec, use raw field as default");
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ LibItsHttp__TypesAndValues::HttpMessage>
  std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > > _codecs;
public:
  explicit http_codec() : codec<LibItsHttp__TypesAndValues::HttpMessage, LibItsHttp__TypesAndValues::HttpMessage>(), _ec(), _dc(), _codecs() { };
  virtual ~http_codec() { };
  virtual ~http_codec() { _codecs.clear(); };

  virtual int encode (const LibItsHttp__TypesAndValues::HttpMessage&, OCTETSTRING& data);
  virtual int decode (const OCTETSTRING& data, LibItsHttp__TypesAndValues::HttpMessage&, params* params = NULL);
+15 −5
Original line number Diff line number Diff line
@@ -2,10 +2,19 @@
[MODULE_PARAMETERS]
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.

# IUT Station ID
LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309
# The GeoNetworking address of the IUT.
LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := {                                                                                                           typeOfAddress := e_manual,
  stationType := e_passengerCar,
  stationCountryCode := 0,
  mid := '000000000001'O
#  typeOfAddress := e_initial,
#  stationType := e_unknown, #e_roadSideUnit,
#  stationCountryCode := 0, #33,
#  mid := '4C5E0C14D2EA'O
}

LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB
LibItsGeoNetworking_Pixits.PX_NEIGHBOUR_DISCOVERY_DELAY := 2.0

LibItsHttp_Pics.PICS_HEADER_HOST := "127.0.0.1" #"ptsv2.com"
LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request"
@@ -104,7 +113,7 @@ LogEventTypes:= Yes
#     save_mode   : 1 to save sent packet, 0 otherwise

# Single GeoNetworking component port
#system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,beaconing=!)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=eth2,filter=and ether proto 0x8947)"
system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=eth2)"
#system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=ptsv2.com,use_ssl=0)"
system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(server=127.0.0.1,port=8000,use_ssl=0)"
system.pkiPort.params := "PKI/HTTP(device_mode=1,uri=/its/inner_ec_request,host=httpbin.org,content_type=application/x-its-request)/TCP(server=127.0.0.1,port=8000,use_ssl=0)"
@@ -113,9 +122,10 @@ system.pkiPort.params := "PKI/HTTP(device_mode=1,uri=/its/inner_ec_request,host=
system.utPort.params := "UT_CAM/UDP(dst_ip=172.23.0.1,dst_port=8000)"

[EXECUTE]
#ItsPki_TestCases.TC_SEC_PKI_ITSS_ENR_BV_01
ItsPki_TestCases.TC_SEC_PKI_ITSS_ENR_BV_01
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_01
ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_02
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_02
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_03

[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
+422 −388
Original line number Diff line number Diff line
@@ -272,6 +272,41 @@ module ItsPki_TestCases {
        
      } // End of f_TC_SEC_PKI_ITSS_ENR_BV_01

      /**
       * @desc If the enrolment request of the IUT is an initial enrolment request, the itsId 
       *       (contained in the InnerECRequest) shall be set to the canonical identifier, the 
       *       signer (contained in the outer EtsiTs1030971Data-Signed) shall be set to self and 
       *       the outer signature shall be computed using the canonical private key.
       * <pre>
       * Pics Selection: 
       * Expected behaviour:
       *     ensure that {
       *         when {
       *             the IUT is requested to send an EnrolmentRequestMessage
       *         }
       *         then {
       *             the IUT sends an EtsiTs103097Data-Encrypted
       *                 containing an encrypted EtsiTs103097Data-Signed
       *                     containing EtsiTs103097Data
       *                          containing InnerECRequestSignedForPOP
       *                             containing InnerEcRequest
       *                                 containing itsId
       *                                     indicating the canonical identifier of the ITS-S 
       *                 and containing signer
       *                     declared as self
       *                 and containing signature 
       *                     computed using the canonical private key
       *         }
       *     }
       * </pre>
       * 
       * @see       ETSI TS ITS-00546v006 TP 3
       * @reference ETSI TS 102 941, clause 6.1.3
       */
      testcase TC_SEC_PKI_ITSS_ENR_BV_02() runs on ItsMtc /*system ItsPkiItssSystem*/ {
        
      } // End of TC_SEC_PKI_ITSS_ENR_BV_01
      
    } // End of group itss_manufacturing
    
    
@@ -279,6 +314,8 @@ module ItsPki_TestCases {
  
  group ea_behavior {

    group enrolment_request_handling {
      
      /**
       * @desc The EnrolmentResponse message shall be sent by the EA to the 
       *       ITS-S across the interface at reference point S3 in response 
@@ -355,30 +392,29 @@ module ItsPki_TestCases {
        
      } // End of testcase TC_SEC_PKI_SND_EA_BV_01

    } // End of group enrolment_request_handling

    group enrolment_response {
      
      /**
     * @desc If the enrolment request of the IUT is an initial enrolment request, the itsId 
     *       (contained in the InnerECRequest) shall be set to the canonical identifier, the 
     *       signer (contained in the outer EtsiTs1030971Data-Signed) shall be set to self and 
     *       the outer signature shall be computed using the canonical private key.
       * @desc The EnrolmentResponse message shall be encrypted using an ETSI TS 103 097 approved 
       *       algorithm and the encryption shall be done with the same AES key as the one used 
       *       by the ITS-S requestor for the encryption of the EnrolmentRequest message
       * <pre>
       * Pics Selection: 
       * Expected behaviour:
       *     ensure that {
       *         when {
     *             the IUT is requested to send an EnrolmentRequestMessage
       *             the IUT receives an EnrolmentRequestMessage
       *                 containing encKey
       *                     containing an encrypted AES key (SYMKEY)
       *         }
       *         then {
     *             the IUT sends an EtsiTs103097Data-Encrypted
     *                 containing an encrypted EtsiTs103097Data-Signed
     *                     containing EtsiTs103097Data
     *                          containing InnerECRequestSignedForPOP
     *                             containing InnerEcRequest
     *                                 containing itsId
     *                                     indicating the canonical identifier of the ITS-S 
     *                 and containing signer
     *                     declared as self
     *                 and containing signature 
     *                     computed using the canonical private key
       *             the IUT answers with an EnrolmentResponseMessage
       *                 containing cipherTex
       *                     being encrypted
       *                         using SYMKEY
       *                         and using an ETSI TS 103 097 approved algorithm
       *         }
       *     }
       * </pre>
@@ -465,30 +501,26 @@ module ItsPki_TestCases {
      } // End of testcase TC_SEC_PKI_SND_EA_BV_02
    
      /**
     * @desc The outermost structure is an EtsiTs103097Data-Encrypted structure containing the component recipients 
     *       containing one instance of RecipientInfo of choice pskRecipInfo, which contains the HashedId8 of the 
     *       symmetric key used by the ITS-S to encrypt the EnrolmentRequest message to which the response is 
     *       built and containing the component ciphertext, once decrypted, contains an EtsiTs103097Data-Signed 
     *       structure.
       * @desc The outermost structure is an EtsiTs103097Data-Encrypted structure containing 
       *       the component recipients containing one instance of RecipientInfo of choice 
       *       pskRecipInfo, which contains the HashedId8 of the symmetric key used by the 
       *       ITS-S to encrypt the EnrolmentRequest message to which the response is built 
       *       and containing the component ciphertext, once decrypted, contains an 
       *       EtsiTs103097Data-Signed structure
       * <pre>
       * Pics Selection: 
       * Expected behaviour:
       *     ensure that {
       *         when {
     *             the IUT sends an EnrolmentResponseMessage as an answer for an EnrolmentRequestMessage
       *             the IUT receives an EnrolmentRequestMessage
       *         }
       *         then {
     *             the IUT sends an EtsiTs103097Data-Encrypted
     *                 containing an encrypted EtsiTs103097Data-Signed
     *                     containing EtsiTs103097Data
     *                          containing InnerECRequestSignedForPOP
     *                             containing InnerEcRequest
     *                                 containing itsId
     *                                     indicating the canonical identifier of the ITS-S 
     *                 and containing signer
     *                     declared as self
     *                 and containing signature 
     *                     computed using the canonical private key
       *             the IUT sends an EtsiTs103097Data-Encrypted structure
       *                 containing recipients
       *                     containing one instance of RecipientInfo of choice pskRecipInfo
       *                         containing the HashedId8 of the symmetric key used to encrypt the EnrolmentRequestMessage
       *                 and containing cipherText
       *                     being an encrypted EtsiTs103097Data-Signed structure
       *         }
       *     }
       * </pre>
@@ -587,6 +619,8 @@ module ItsPki_TestCases {
        
      } // End of testcase TC_SEC_PKI_SND_EA_BV_03

    } // End of group enrolment_response

  } // End of group ea_behavior

  group aa_behavior {
Compare 919a3f42 to 82720e15
Original line number Diff line number Diff line
Subproject commit 919a3f4268398c424b892ce4b7bc79f88f3baa3f
Subproject commit 82720e1582ec32c60abcbb99d5ac0db17a8c93e5