From d9669dbc37f565d2997ba4feb74c2a28fcb05801 Mon Sep 17 00:00:00 2001 From: Sahithi Nukala Date: Mon, 11 May 2026 15:14:56 +0200 Subject: [PATCH 1/4] mw/com: Delete SOME/IP configuration struct source files Remove the placeholder SOME/IP configuration structs that were never connected to a real transport implementation: - SomeIpServiceInstanceDeployment - SomeIpServiceInstanceId - SomeIpEventInstanceDeployment - SomeIpFieldInstanceDeployment --- .../someip_event_instance_deployment.cpp | 23 ---- .../someip_event_instance_deployment.h | 37 ------ .../someip_event_instance_deployment_test.cpp | 61 --------- .../someip_field_instance_deployment.cpp | 23 ---- .../someip_field_instance_deployment.h | 37 ------ .../someip_field_instance_deployment_test.cpp | 59 --------- .../someip_service_instance_deployment.cpp | 106 ---------------- .../someip_service_instance_deployment.h | 67 ---------- ...omeip_service_instance_deployment_test.cpp | 117 ------------------ .../someip_service_instance_id.cpp | 85 ------------- .../someip_service_instance_id.h | 64 ---------- .../someip_service_instance_id_test.cpp | 106 ---------------- 12 files changed, 785 deletions(-) delete mode 100644 score/mw/com/impl/configuration/someip_event_instance_deployment.cpp delete mode 100644 score/mw/com/impl/configuration/someip_event_instance_deployment.h delete mode 100644 score/mw/com/impl/configuration/someip_event_instance_deployment_test.cpp delete mode 100644 score/mw/com/impl/configuration/someip_field_instance_deployment.cpp delete mode 100644 score/mw/com/impl/configuration/someip_field_instance_deployment.h delete mode 100644 score/mw/com/impl/configuration/someip_field_instance_deployment_test.cpp delete mode 100644 score/mw/com/impl/configuration/someip_service_instance_deployment.cpp delete mode 100644 score/mw/com/impl/configuration/someip_service_instance_deployment.h delete mode 100644 score/mw/com/impl/configuration/someip_service_instance_deployment_test.cpp delete mode 100644 score/mw/com/impl/configuration/someip_service_instance_id.cpp delete mode 100644 score/mw/com/impl/configuration/someip_service_instance_id.h delete mode 100644 score/mw/com/impl/configuration/someip_service_instance_id_test.cpp diff --git a/score/mw/com/impl/configuration/someip_event_instance_deployment.cpp b/score/mw/com/impl/configuration/someip_event_instance_deployment.cpp deleted file mode 100644 index f1da04f04..000000000 --- a/score/mw/com/impl/configuration/someip_event_instance_deployment.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#include "score/mw/com/impl/configuration/someip_event_instance_deployment.h" - -namespace score::mw::com::impl -{ - -bool operator==(const SomeIpEventInstanceDeployment& /* lhs */, const SomeIpEventInstanceDeployment& /* rhs */) noexcept -{ - return true; -} - -} // namespace score::mw::com::impl diff --git a/score/mw/com/impl/configuration/someip_event_instance_deployment.h b/score/mw/com/impl/configuration/someip_event_instance_deployment.h deleted file mode 100644 index cb6e02dac..000000000 --- a/score/mw/com/impl/configuration/someip_event_instance_deployment.h +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#ifndef SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_EVENT_INSTANCE_DEPLOYMENT_H -#define SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_EVENT_INSTANCE_DEPLOYMENT_H - -#include "score/json/json_parser.h" - -namespace score::mw::com::impl -{ - -class SomeIpEventInstanceDeployment -{ - public: - SomeIpEventInstanceDeployment() noexcept = default; - explicit SomeIpEventInstanceDeployment(const score::json::Object& /* json_object */) noexcept {} - - json::Object Serialize() const noexcept - { - return json::Object{}; - } -}; - -bool operator==(const SomeIpEventInstanceDeployment& lhs, const SomeIpEventInstanceDeployment& rhs) noexcept; - -} // namespace score::mw::com::impl - -#endif // SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_EVENT_INSTANCE_DEPLOYMENT_H diff --git a/score/mw/com/impl/configuration/someip_event_instance_deployment_test.cpp b/score/mw/com/impl/configuration/someip_event_instance_deployment_test.cpp deleted file mode 100644 index 2c23f2975..000000000 --- a/score/mw/com/impl/configuration/someip_event_instance_deployment_test.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#include "score/mw/com/impl/configuration/someip_event_instance_deployment.h" - -#include "score/json/json_parser.h" -#include -#include - -namespace score::mw::com::impl -{ -namespace -{ - -TEST(SomeIpEventInstanceDeploymentTest, DefaultConstructedObjectsAreEqual) -{ - // Given two default-constructed SomeIpEventInstanceDeployment objects - const SomeIpEventInstanceDeployment lhs; - const SomeIpEventInstanceDeployment rhs; - - // When comparing them for equality - - // Then they should be equal - EXPECT_TRUE(lhs == rhs); -} - -TEST(SomeIpEventInstanceDeploymentTest, JsonConstructedObjectsAreEqual) -{ - // Given a default-constructed JSON object - const score::json::Object json_object; - const SomeIpEventInstanceDeployment lhs{json_object}; - const SomeIpEventInstanceDeployment rhs{json_object}; - - // When comparing them for equality - // Then they should be equal - EXPECT_TRUE(lhs == rhs); -} - -TEST(SomeIpEventInstanceDeploymentTest, SerializeReturnsEmptyObject) -{ - // Given a default-constructed SomeIpEventInstanceDeployment object - const SomeIpEventInstanceDeployment deployment; - - // When serializing the object - const auto serialized = deployment.Serialize(); - - // Then the serialized result expected be empty - EXPECT_TRUE(serialized.empty()); -} - -} // namespace -} // namespace score::mw::com::impl diff --git a/score/mw/com/impl/configuration/someip_field_instance_deployment.cpp b/score/mw/com/impl/configuration/someip_field_instance_deployment.cpp deleted file mode 100644 index 3a03c2ef8..000000000 --- a/score/mw/com/impl/configuration/someip_field_instance_deployment.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#include "score/mw/com/impl/configuration/someip_field_instance_deployment.h" - -namespace score::mw::com::impl -{ - -bool operator==(const SomeIpFieldInstanceDeployment& /* lhs */, const SomeIpFieldInstanceDeployment& /* rhs */) noexcept -{ - return true; -} - -} // namespace score::mw::com::impl diff --git a/score/mw/com/impl/configuration/someip_field_instance_deployment.h b/score/mw/com/impl/configuration/someip_field_instance_deployment.h deleted file mode 100644 index 94a9b457e..000000000 --- a/score/mw/com/impl/configuration/someip_field_instance_deployment.h +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#ifndef SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_FIELD_INSTANCE_DEPLOYMENT_H -#define SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_FIELD_INSTANCE_DEPLOYMENT_H - -#include "score/json/json_parser.h" - -namespace score::mw::com::impl -{ - -class SomeIpFieldInstanceDeployment -{ - public: - SomeIpFieldInstanceDeployment() noexcept = default; - explicit SomeIpFieldInstanceDeployment(const score::json::Object& /* json_object */) noexcept {} - - json::Object Serialize() const noexcept - { - return json::Object{}; - } -}; - -bool operator==(const SomeIpFieldInstanceDeployment& lhs, const SomeIpFieldInstanceDeployment& rhs) noexcept; - -} // namespace score::mw::com::impl - -#endif // SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_FIELD_INSTANCE_DEPLOYMENT_H diff --git a/score/mw/com/impl/configuration/someip_field_instance_deployment_test.cpp b/score/mw/com/impl/configuration/someip_field_instance_deployment_test.cpp deleted file mode 100644 index 5d708a781..000000000 --- a/score/mw/com/impl/configuration/someip_field_instance_deployment_test.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#include "score/mw/com/impl/configuration/someip_field_instance_deployment.h" - -#include -#include - -namespace score::mw::com::impl -{ -namespace -{ - -TEST(SomeIpFieldInstanceDeploymentTest, DefaultConstructedObjectsAreEqual) -{ - // Given two default-constructed SomeIpFieldInstanceDeployment objects - const SomeIpFieldInstanceDeployment lhs; - const SomeIpFieldInstanceDeployment rhs; - - // When comparing them for equality - // Then they should be equal - EXPECT_TRUE(lhs == rhs); -} - -TEST(SomeIpFieldInstanceDeploymentTest, JsonConstructedObjectsAreEqual) -{ - // Given a default-constructed JSON object - const score::json::Object json_object; - const SomeIpFieldInstanceDeployment lhs{json_object}; - const SomeIpFieldInstanceDeployment rhs{json_object}; - - // When comparing them for equality - // Then they should be equal - EXPECT_TRUE(lhs == rhs); -} - -TEST(SomeIpFieldInstanceDeploymentTest, SerializeReturnsEmptyObject) -{ - // Given a default-constructed SomeIpFieldInstanceDeployment object - const SomeIpFieldInstanceDeployment deployment; - - // When serializing the object - const auto serialized = deployment.Serialize(); - - // Then the serialized result expected be empty - EXPECT_TRUE(serialized.empty()); -} - -} // namespace -} // namespace score::mw::com::impl diff --git a/score/mw/com/impl/configuration/someip_service_instance_deployment.cpp b/score/mw/com/impl/configuration/someip_service_instance_deployment.cpp deleted file mode 100644 index bedafc943..000000000 --- a/score/mw/com/impl/configuration/someip_service_instance_deployment.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#include "score/mw/com/impl/configuration/someip_service_instance_deployment.h" - -#include "score/mw/com/impl/configuration/configuration_common_resources.h" - -#include "score/json/json_writer.h" - -#include -#include -#include -#include -#include - -namespace score::mw::com::impl -{ - -namespace -{ - -constexpr auto kSerializationVersionKeySerInstDepl = "serializationVersion"; -constexpr auto kInstanceIdKeySerInstDepl = "instanceId"; -constexpr auto kEventsKeySerInstDepl = "events"; -constexpr auto kFieldsKeySerInstDepl = "fields"; - -} // namespace - -auto areCompatible(const SomeIpServiceInstanceDeployment& lhs, const SomeIpServiceInstanceDeployment& rhs) -> bool -{ - if ((lhs.instance_id_.has_value() == false) || (rhs.instance_id_.has_value() == false)) - { - return true; - } - return lhs.instance_id_ == rhs.instance_id_; -} - -bool operator==(const SomeIpServiceInstanceDeployment& lhs, const SomeIpServiceInstanceDeployment& rhs) noexcept -{ - return (lhs.instance_id_ == rhs.instance_id_); -} - -bool operator<(const SomeIpServiceInstanceDeployment& lhs, const SomeIpServiceInstanceDeployment& rhs) noexcept -{ - return (lhs.instance_id_ < rhs.instance_id_); -} - -// Suppress "AUTOSAR C++14 A15-5-3" rule finding. This rule states: "The std::terminate() function shall not be called -// implicitly" -// coverity reports that json.As().value might throw due to std::bad_variant_access. Which will cause an implicit -// terminate. -// The .value() call will only throw if the As function didn't succeed in parsing the json. In this case termination -// is the intended behaviour. -// -// Suppress "AUTOSAR C++14 A12-6-1" rule finding. This rule declares: "All class data members that are -// initialized by the constructor shall be initialized using member initializers". -// This is false positive, all data members are initialized using member initializers in the delegation constructor. -// -// coverity[autosar_cpp14_a15_5_3_violation] -// coverity[autosar_cpp14_a12_6_1_violation] -SomeIpServiceInstanceDeployment::SomeIpServiceInstanceDeployment(const score::json::Object& json_object) noexcept - : SomeIpServiceInstanceDeployment{ - {}, - ConvertJsonToServiceElementMap(json_object, kEventsKeySerInstDepl), - ConvertJsonToServiceElementMap(json_object, kFieldsKeySerInstDepl)} -{ - const auto instance_id_it = json_object.find(kInstanceIdKeySerInstDepl); - if (instance_id_it != json_object.end()) - { - instance_id_ = instance_id_it->second.As().value(); - } - - const auto serialization_version = - GetValueFromJson(json_object, kSerializationVersionKeySerInstDepl); - if (serialization_version != serializationVersion) - { - std::terminate(); - } -} - -score::json::Object SomeIpServiceInstanceDeployment::Serialize() const noexcept -{ - score::json::Object json_object{}; - json_object[kSerializationVersionKeySerInstDepl] = score::json::Any{serializationVersion}; - - if (instance_id_.has_value()) - { - json_object[kInstanceIdKeySerInstDepl] = instance_id_.value().Serialize(); - } - - json_object[kEventsKeySerInstDepl] = ConvertServiceElementMapToJson(events_); - json_object[kFieldsKeySerInstDepl] = ConvertServiceElementMapToJson(fields_); - - return json_object; -} - -} // namespace score::mw::com::impl diff --git a/score/mw/com/impl/configuration/someip_service_instance_deployment.h b/score/mw/com/impl/configuration/someip_service_instance_deployment.h deleted file mode 100644 index e9aed6820..000000000 --- a/score/mw/com/impl/configuration/someip_service_instance_deployment.h +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#ifndef SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_SERVICE_INSTANCE_DEPLOYMENT_H -#define SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_SERVICE_INSTANCE_DEPLOYMENT_H - -#include "score/mw/com/impl/configuration/someip_event_instance_deployment.h" -#include "score/mw/com/impl/configuration/someip_field_instance_deployment.h" -#include "score/mw/com/impl/configuration/someip_service_instance_id.h" - -#include "score/json/json_parser.h" - -#include - -#include -#include -#include -#include - -namespace score::mw::com::impl -{ - -class SomeIpServiceInstanceDeployment -{ - public: - using EventInstanceMapping = std::unordered_map; - using FieldInstanceMapping = std::unordered_map; - - explicit SomeIpServiceInstanceDeployment(const score::json::Object& json_object) noexcept; - explicit SomeIpServiceInstanceDeployment(score::cpp::optional instance_id = {}, - EventInstanceMapping events = {}, - FieldInstanceMapping fields = {}) - : instance_id_{instance_id}, events_{std::move(events)}, fields_{std::move(fields)} - { - } - - constexpr static std::uint32_t serializationVersion{1U}; - - // Note the struct is not compliant to POD type containing non-POD member. - // The struct is used as a config storage obtained by performing the parsing json object. - // Public access is required by the implementation to reach the following members of the struct. - // coverity[autosar_cpp14_m11_0_1_violation] - score::cpp::optional instance_id_; - // coverity[autosar_cpp14_m11_0_1_violation] - EventInstanceMapping events_; // key = event name - // coverity[autosar_cpp14_m11_0_1_violation] - FieldInstanceMapping fields_; // key = field name - - score::json::Object Serialize() const noexcept; -}; - -bool areCompatible(const SomeIpServiceInstanceDeployment& lhs, const SomeIpServiceInstanceDeployment& rhs); -bool operator==(const SomeIpServiceInstanceDeployment& lhs, const SomeIpServiceInstanceDeployment& rhs) noexcept; -bool operator<(const SomeIpServiceInstanceDeployment& lhs, const SomeIpServiceInstanceDeployment& rhs) noexcept; - -} // namespace score::mw::com::impl - -#endif // SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_SERVICE_INSTANCE_DEPLOYMENT_H diff --git a/score/mw/com/impl/configuration/someip_service_instance_deployment_test.cpp b/score/mw/com/impl/configuration/someip_service_instance_deployment_test.cpp deleted file mode 100644 index 1d2cfeadf..000000000 --- a/score/mw/com/impl/configuration/someip_service_instance_deployment_test.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#include "score/mw/com/impl/configuration/someip_service_instance_deployment.h" - -#include "score/mw/com/impl/configuration/test/configuration_test_resources.h" - -#include - -namespace score::mw::com::impl -{ -namespace -{ - -TEST(SomeIpServiceInstanceDeployment, construction) -{ - SomeIpServiceInstanceDeployment unit{SomeIpServiceInstanceId{42U}}; - - ASSERT_EQ(unit.instance_id_.value().GetId(), 42U); -} - -TEST(SomeIpServiceInstanceDeployment, BothInstancesAnyIsCompatible) -{ - EXPECT_TRUE(areCompatible(SomeIpServiceInstanceDeployment{}, SomeIpServiceInstanceDeployment{})); -} - -TEST(SomeIpServiceInstanceDeployment, OneInstancesAnyIsCompatible) -{ - EXPECT_TRUE(areCompatible(SomeIpServiceInstanceDeployment{}, - SomeIpServiceInstanceDeployment{SomeIpServiceInstanceId{45U}})); -} - -TEST(SomeIpServiceInstanceDeployment, OneInstancesAnyIsCompatibleOtherSide) -{ - EXPECT_TRUE(areCompatible(SomeIpServiceInstanceDeployment{SomeIpServiceInstanceId{45U}}, - SomeIpServiceInstanceDeployment{})); -} - -TEST(SomeIpServiceInstanceDeployment, SameInstancesIsCompatibleOtherSide) -{ - EXPECT_TRUE(areCompatible(SomeIpServiceInstanceDeployment{SomeIpServiceInstanceId{45U}}, - SomeIpServiceInstanceDeployment{SomeIpServiceInstanceId{45U}})); -} - -TEST(SomeIpServiceInstanceDeployment, DifferentInstancesIsNotCompatibleOtherSide) -{ - EXPECT_FALSE(areCompatible(SomeIpServiceInstanceDeployment{SomeIpServiceInstanceId{45U}}, - SomeIpServiceInstanceDeployment{SomeIpServiceInstanceId{44U}})); -} - -TEST(SomeIpServiceInstanceDeployment, Equality) -{ - EXPECT_EQ(SomeIpServiceInstanceDeployment{SomeIpServiceInstanceId{45U}}, - SomeIpServiceInstanceDeployment{SomeIpServiceInstanceId{45U}}); -} - -using SomeIpServiceInstanceDeploymentFixture = ConfigurationStructsFixture; -TEST_F(SomeIpServiceInstanceDeploymentFixture, CanCreateFromSerializedObjectWithOptional) -{ - const SomeIpServiceInstanceDeployment unit{MakeSomeIpServiceInstanceDeployment()}; - - const auto serialized_unit{unit.Serialize()}; - - const SomeIpServiceInstanceDeployment reconstructed_unit{serialized_unit}; - - ExpectSomeIpServiceInstanceDeploymentObjectsEqual(reconstructed_unit, unit); -} - -TEST_F(SomeIpServiceInstanceDeploymentFixture, CanCreateFromSerializedObjectWithoutOptional) -{ - const SomeIpServiceInstanceDeployment unit{MakeSomeIpServiceInstanceDeployment({})}; - - const auto serialized_unit{unit.Serialize()}; - - const SomeIpServiceInstanceDeployment reconstructed_unit{serialized_unit}; - - ExpectSomeIpServiceInstanceDeploymentObjectsEqual(reconstructed_unit, unit); -} - -TEST(SomeIpServiceInstanceDeploymentDeathTest, CreatingFromSerializedObjectWithMismatchedSerializationVersionTerminates) -{ - const SomeIpServiceInstanceDeployment unit{42U}; - - const auto serialization_version_key = "serializationVersion"; - const std::uint32_t invalid_serialization_version = SomeIpServiceInstanceDeployment::serializationVersion + 1; - - auto serialized_unit{unit.Serialize()}; - auto it = serialized_unit.find(serialization_version_key); - ASSERT_NE(it, serialized_unit.end()); - it->second = json::Any{invalid_serialization_version}; - - EXPECT_DEATH(SomeIpServiceInstanceDeployment reconstructed_unit{serialized_unit}, ".*"); -} - -TEST(LolaServiceInstanceDeploymentLessThan, DeploymentsComparedBasedOnInstanceId) -{ - // Given 2 SomeIpServiceInstanceDeployments containing different values - const SomeIpServiceInstanceDeployment lhs{1U}; - const SomeIpServiceInstanceDeployment rhs{2U}; - - // When comparing the two - // Then the result is based on the instance IDs - EXPECT_EQ(lhs < rhs, lhs.instance_id_ < rhs.instance_id_); - EXPECT_EQ(rhs < lhs, rhs.instance_id_ < lhs.instance_id_); -} - -} // namespace -} // namespace score::mw::com::impl diff --git a/score/mw/com/impl/configuration/someip_service_instance_id.cpp b/score/mw/com/impl/configuration/someip_service_instance_id.cpp deleted file mode 100644 index d1d97e548..000000000 --- a/score/mw/com/impl/configuration/someip_service_instance_id.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#include "score/mw/com/impl/configuration/someip_service_instance_id.h" - -#include "score/mw/com/impl/configuration/configuration_common_resources.h" - -#include "score/json/json_parser.h" - -#include -#include -#include -#include - -namespace score::mw::com::impl -{ - -namespace -{ - -constexpr auto kInstanceIdKey = "instanceId"; - -} // namespace - -// Suppress "AUTOSAR C++14 A12-1-5" rule finding. -// This rule states: Common class initialization for non-constant members shall be done by a delegating constructor. -// Justification: This constructor is used by other constructors for delegation. -// coverity[autosar_cpp14_a12_1_5_violation] -SomeIpServiceInstanceId::SomeIpServiceInstanceId(InstanceId instance_id) noexcept - : id_{instance_id}, hash_string_{ToHashStringImpl(id_, hashStringSize)} -{ -} - -// Suppress "AUTOSAR C++14 A12-1-5" rule finding. -// This rule states: Common class initialization for non-constant members shall be done by a delegating constructor. -// Justification: Delegating constructor is used. -// coverity[autosar_cpp14_a12_1_5_violation] -SomeIpServiceInstanceId::SomeIpServiceInstanceId(const score::json::Object& json_object) noexcept - : SomeIpServiceInstanceId{GetValueFromJson(json_object, kInstanceIdKey)} -{ - const auto serialization_version = GetValueFromJson(json_object, kSerializationVersionKey); - if (serialization_version != serializationVersion) - { - std::terminate(); - } -} - -score::json::Object SomeIpServiceInstanceId::Serialize() const noexcept -{ - score::json::Object json_object{}; - json_object[kInstanceIdKey] = score::json::Any{id_}; - json_object[kSerializationVersionKey] = json::Any{serializationVersion}; - return json_object; -} - -std::string_view SomeIpServiceInstanceId::ToHashString() const noexcept -{ - return hash_string_; -} - -SomeIpServiceInstanceId::InstanceId SomeIpServiceInstanceId::GetId() const noexcept -{ - return id_; -} - -bool operator==(const SomeIpServiceInstanceId& lhs, const SomeIpServiceInstanceId& rhs) noexcept -{ - return lhs.GetId() == rhs.GetId(); -} - -bool operator<(const SomeIpServiceInstanceId& lhs, const SomeIpServiceInstanceId& rhs) noexcept -{ - return lhs.GetId() < rhs.GetId(); -} - -} // namespace score::mw::com::impl diff --git a/score/mw/com/impl/configuration/someip_service_instance_id.h b/score/mw/com/impl/configuration/someip_service_instance_id.h deleted file mode 100644 index 1fdcce278..000000000 --- a/score/mw/com/impl/configuration/someip_service_instance_id.h +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#ifndef SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_SERVICE_INSTANCE_ID_H -#define SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_SERVICE_INSTANCE_ID_H - -#include "score/json/json_parser.h" - -#include -#include -#include - -namespace score::mw::com::impl -{ - -/// \brief Struct that wraps the type of a SomeIp instance ID. -/// -/// Since SomeIpServiceInstanceId is held in a variant within ServiceInstanceId, we use a struct so that we can -/// unambiguously differentiate between the different InstanceId types when visiting the struct. -class SomeIpServiceInstanceId -{ - public: - using InstanceId = std::uint16_t; - - explicit SomeIpServiceInstanceId(const score::json::Object& json_object) noexcept; - explicit SomeIpServiceInstanceId(InstanceId instance_id) noexcept; - - score::json::Object Serialize() const noexcept; - std::string_view ToHashString() const noexcept; - - InstanceId GetId() const noexcept; - - /** - * \brief The size of the hash string returned by ToHashString() - * - * The size is the amount of chars required to represent InstanceId as a hex string. - */ - constexpr static std::size_t hashStringSize{2U * sizeof(InstanceId)}; - - constexpr static std::uint32_t serializationVersion{1U}; - - private: - InstanceId id_; - /** - * \brief Stringified format of this SomeIpServiceInstanceId which can be used for hashing. - */ - std::string hash_string_; -}; - -bool operator==(const SomeIpServiceInstanceId& lhs, const SomeIpServiceInstanceId& rhs) noexcept; -bool operator<(const SomeIpServiceInstanceId& lhs, const SomeIpServiceInstanceId& rhs) noexcept; - -} // namespace score::mw::com::impl - -#endif // SCORE_MW_COM_IMPL_CONFIGURATION_SOMEIP_SERVICE_INSTANCE_ID_H diff --git a/score/mw/com/impl/configuration/someip_service_instance_id_test.cpp b/score/mw/com/impl/configuration/someip_service_instance_id_test.cpp deleted file mode 100644 index d993572d9..000000000 --- a/score/mw/com/impl/configuration/someip_service_instance_id_test.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#include "score/mw/com/impl/configuration/someip_service_instance_id.h" - -#include "score/mw/com/impl/configuration/test/configuration_test_resources.h" - -#include -#include - -namespace score::mw::com::impl -{ -namespace -{ - -using SomeIpServiceInstanceIdFixture = ConfigurationStructsFixture; -TEST_F(SomeIpServiceInstanceIdFixture, CanCreateFromSerializedObject) -{ - SomeIpServiceInstanceId unit{10U}; - - const auto serialized_unit{unit.Serialize()}; - - SomeIpServiceInstanceId reconstructed_unit{serialized_unit}; - - ExpectSomeIpServiceInstanceIdObjectsEqual(reconstructed_unit, unit); -} - -TEST(SomeIpServiceInstanceIdTest, CanBeCopiedAndEqualCompared) -{ - const auto unit = SomeIpServiceInstanceId{10U}; - const auto unitCopy = unit; - - ASSERT_EQ(unit, unitCopy); -} - -TEST(SomeIpServiceInstanceIdTest, DifferentIdsAreNotEqual) -{ - const auto unit = SomeIpServiceInstanceId{10U}; - const auto unit_2 = SomeIpServiceInstanceId{12U}; - - ASSERT_FALSE(unit == unit_2); -} - -TEST(SomeIpServiceInstanceIdTest, LessThanOperator) -{ - const auto unit = SomeIpServiceInstanceId{10U}; - const auto unit_2 = SomeIpServiceInstanceId{12U}; - - ASSERT_TRUE(unit < unit_2); - ASSERT_FALSE(unit_2 < unit); -} - -TEST(SomeIpServiceInstanceIdDeathTest, CreatingFromSerializedObjectWithMismatchedSerializationVersionTerminates) -{ - const SomeIpServiceInstanceId unit{10U}; - - const auto serialization_version_key = "serializationVersion"; - const std::uint32_t invalid_serialization_version = SomeIpServiceInstanceId::serializationVersion + 1; - - auto serialized_unit{unit.Serialize()}; - auto it = serialized_unit.find(serialization_version_key); - ASSERT_NE(it, serialized_unit.end()); - it->second = json::Any{invalid_serialization_version}; - - EXPECT_DEATH(SomeIpServiceInstanceId reconstructed_unit{serialized_unit}, ".*"); -} - -class SomeIpServiceInstanceIdHashFixture - : public ::testing::TestWithParam> -{ -}; - -TEST_P(SomeIpServiceInstanceIdHashFixture, ToHashString) -{ - const auto param_tuple = GetParam(); - - const auto unit = std::get(param_tuple); - const auto expected_hash_string = std::get(param_tuple); - - const auto actual_hash_string = unit.ToHashString(); - - EXPECT_EQ(actual_hash_string, expected_hash_string); - EXPECT_EQ(actual_hash_string.size(), SomeIpServiceInstanceId::hashStringSize); -} - -const std::vector> instance_id_to_hash_string_variations{ - {SomeIpServiceInstanceId{0U}, "0000"}, - {SomeIpServiceInstanceId{1U}, "0001"}, - {SomeIpServiceInstanceId{10U}, "000a"}, - {SomeIpServiceInstanceId{255U}, "00ff"}, - {SomeIpServiceInstanceId{std::numeric_limits::max()}, "ffff"}}; -INSTANTIATE_TEST_SUITE_P(SomeIpServiceInstanceIdHashFixture, - SomeIpServiceInstanceIdHashFixture, - ::testing::ValuesIn(instance_id_to_hash_string_variations)); - -} // namespace -} // namespace score::mw::com::impl From d1c5f2f0174372d398f5dc64aa5f755d425492cf Mon Sep 17 00:00:00 2001 From: Sahithi Nukala Date: Mon, 11 May 2026 15:15:09 +0200 Subject: [PATCH 2/4] mw/com: Remove SOME/IP from configuration layer - Remove SOME/IP from BindingInformation variants in ServiceInstanceDeployment and ServiceInstanceId - Remove SOME/IP binding type and error codes from config_parser, configuration_error, and mw_com_config_schema.json - Fix operator== and operator< for blank binding in ServiceInstanceId - Remove SOME/IP targets from BUILD - Update tests and test helpers accordingly --- score/mw/com/impl/configuration/BUILD | 90 -------- .../com/impl/configuration/config_parser.cpp | 12 +- .../impl/configuration/config_parser_test.cpp | 57 +---- .../impl/configuration/configuration_error.h | 9 - .../configuration_error_test.cpp | 12 - .../configuration/mw_com_config_schema.json | 10 +- .../service_instance_deployment.cpp | 17 -- .../service_instance_deployment.h | 7 +- .../service_instance_deployment_test.cpp | 206 ++++-------------- .../configuration/service_instance_id.cpp | 30 +-- .../impl/configuration/service_instance_id.h | 10 +- .../service_instance_id_test.cpp | 96 +------- .../test/configuration_test_resources.cpp | 70 ------ .../test/configuration_test_resources.h | 18 -- 14 files changed, 67 insertions(+), 577 deletions(-) diff --git a/score/mw/com/impl/configuration/BUILD b/score/mw/com/impl/configuration/BUILD index e7c8c7696..f5a078d95 100644 --- a/score/mw/com/impl/configuration/BUILD +++ b/score/mw/com/impl/configuration/BUILD @@ -50,7 +50,6 @@ cc_library( ":lola_service_instance_deployment", ":quality_type", ":service_type_deployment", - ":someip_service_instance_deployment", "@score_baselibs//score/mw/log", "@score_baselibs//score/quality/compiler_warnings", ], @@ -151,18 +150,6 @@ cc_library( ], ) -cc_library( - name = "someip_event_instance_deployment", - srcs = ["someip_event_instance_deployment.cpp"], - hdrs = ["someip_event_instance_deployment.h"], - features = COMPILER_WARNING_FEATURES, - tags = ["FFI"], - visibility = [ - "//score/mw/com/impl/configuration:__subpackages__", - ], - deps = ["@score_baselibs//score/json"], -) - cc_library( name = "lola_event_id", srcs = ["lola_event_id.cpp"], @@ -218,15 +205,6 @@ cc_library( deps = [":lola_event_instance_deployment"], ) -cc_library( - name = "someip_field_instance_deployment", - srcs = ["someip_field_instance_deployment.cpp"], - hdrs = ["someip_field_instance_deployment.h"], - features = COMPILER_WARNING_FEATURES, - tags = ["FFI"], - deps = ["@score_baselibs//score/json"], -) - cc_library( name = "lola_method_instance_deployment", srcs = ["lola_method_instance_deployment.cpp"], @@ -282,16 +260,6 @@ cc_library( deps = ["@score_baselibs//score/json"], ) -cc_library( - name = "someip_service_instance_id", - srcs = ["someip_service_instance_id.cpp"], - hdrs = ["someip_service_instance_id.h"], - features = COMPILER_WARNING_FEATURES, - implementation_deps = [":configuration_common_resources"], - tags = ["FFI"], - deps = ["@score_baselibs//score/json"], -) - cc_library( name = "service_identifier_type", srcs = ["service_identifier_type.cpp"], @@ -317,7 +285,6 @@ cc_library( ":lola_service_instance_deployment", ":quality_type", ":service_identifier_type", - ":someip_service_instance_deployment", "//score/mw/com/impl:binding_type", "//score/mw/com/impl:error", "//score/mw/com/impl:instance_specifier", @@ -335,7 +302,6 @@ cc_library( deps = [ ":configuration_common_resources", ":lola_service_instance_id", - ":someip_service_instance_id", "@score_baselibs//score/json", "@score_baselibs//score/language/futurecpp", ], @@ -368,23 +334,6 @@ cc_library( ], ) -cc_library( - name = "someip_service_instance_deployment", - srcs = ["someip_service_instance_deployment.cpp"], - hdrs = ["someip_service_instance_deployment.h"], - features = COMPILER_WARNING_FEATURES, - tags = ["FFI"], - deps = [ - ":configuration_common_resources", - ":someip_event_instance_deployment", - ":someip_field_instance_deployment", - ":someip_service_instance_id", - "@score_baselibs//score/json", - "@score_baselibs//score/language/futurecpp", - "@score_baselibs//score/result", - ], -) - cc_library( name = "binding_service_type_deployment", srcs = ["binding_service_type_deployment.cpp"], @@ -443,7 +392,6 @@ cc_library( ":service_type_deployment", ":service_version_type", ":shm_size_calc_mode", - ":someip_service_instance_deployment", ], ) @@ -600,16 +548,6 @@ cc_gtest_unit_test( ], ) -cc_gtest_unit_test( - name = "someip_service_instance_deployment_test", - srcs = ["someip_service_instance_deployment_test.cpp"], - features = COMPILER_WARNING_FEATURES, - deps = [ - ":someip_service_instance_deployment", - "//score/mw/com/impl/configuration/test:configuration_test_resources", - ], -) - cc_gtest_unit_test( name = "lola_service_type_deployment_test", srcs = ["lola_service_type_deployment_test.cpp"], @@ -640,16 +578,6 @@ cc_gtest_unit_test( ], ) -cc_gtest_unit_test( - name = "someip_service_instance_id_test", - srcs = ["someip_service_instance_id_test.cpp"], - features = COMPILER_WARNING_FEATURES, - deps = [ - ":someip_service_instance_deployment", - "//score/mw/com/impl/configuration/test:configuration_test_resources", - ], -) - cc_gtest_unit_test( name = "global_configuration_test", srcs = ["global_configuration_test.cpp"], @@ -668,20 +596,6 @@ cc_gtest_unit_test( ], ) -cc_gtest_unit_test( - name = "someip_field_instance_deployment_test", - srcs = ["someip_field_instance_deployment_test.cpp"], - features = COMPILER_WARNING_FEATURES, - deps = [":someip_field_instance_deployment"], -) - -cc_gtest_unit_test( - name = "someip_event_instance_deployment_test", - srcs = ["someip_event_instance_deployment_test.cpp"], - features = COMPILER_WARNING_FEATURES, - deps = [":someip_event_instance_deployment"], -) - cc_gtest_unit_test( name = "shm_size_calc_mode_test", srcs = ["shm_size_calc_mode_test.cpp"], @@ -711,10 +625,6 @@ cc_unit_test_suites_for_host_and_qnx( ":service_instance_id_test", ":service_type_deployment_test", ":service_version_type_test", - ":someip_event_instance_deployment_test", - ":someip_field_instance_deployment_test", - ":someip_service_instance_deployment_test", - ":someip_service_instance_id_test", ":tracing_configuration_test", ], visibility = ["//score/mw/com/impl:__pkg__"], diff --git a/score/mw/com/impl/configuration/config_parser.cpp b/score/mw/com/impl/configuration/config_parser.cpp index bd2a2106f..7f5afe9c9 100644 --- a/score/mw/com/impl/configuration/config_parser.cpp +++ b/score/mw/com/impl/configuration/config_parser.cpp @@ -101,7 +101,6 @@ constexpr auto kNumberOfIpcTracingSlotsDefault = static_cast ServiceT LolaServiceTypeDeployment lola_deployment = ParseLoLaServiceTypeDeployments(binding_map); return ServiceTypeDeployment{lola_deployment}; } - else if (value == kSomeIpBinding) - { - // we skip this, because we don't support SOME/IP right now. - } else { score::mw::log::LogFatal("lola") << "No unknown binding provided. Required argument."; diff --git a/score/mw/com/impl/configuration/config_parser_test.cpp b/score/mw/com/impl/configuration/config_parser_test.cpp index 47e10e00b..f528c33d1 100644 --- a/score/mw/com/impl/configuration/config_parser_test.cpp +++ b/score/mw/com/impl/configuration/config_parser_test.cpp @@ -1056,7 +1056,7 @@ TEST_F(ConfigParserFixture, DuplicateServiceInstanceWillDie) "instances": [ { "asil-level": "QM", - "binding": "SOME/IP" + "binding": "SHM" } ] } @@ -2477,61 +2477,6 @@ TEST(ConfigParser, InvalidQualityTypeForAllowedConsumersWillDie) SCORE_LANGUAGE_FUTURECPP_EXPECT_CONTRACT_VIOLATED(score::mw::com::impl::configuration::Parse(std::move(j2))); } -TEST(ConfigParser, TerminateOnParsingSomeIP) -{ - // Give a SOME/IP binding configuration - auto config_with_some_ip_binding = R"( - { - "serviceTypes": [ - { - "serviceTypeName": "/score/ncar/services/TirePressureService", - "version": { - "major": 12, - "minor": 34 - }, - "bindings": [ - { - "serviceId": 1234, - "binding": "SOME/IP", - "events": [], - "fields": [] - } - ] - } - ], - "serviceInstances": [ - { - "instanceSpecifier": "abc/abc/TirePressurePort", - "serviceTypeName": "/score/ncar/services/TirePressureService", - "version": { - "major": 12, - "minor": 34 - }, - "instances": [ - { - "instanceId": 1, - "asil-level": "B", - "binding": "SOME/IP", - "events": [], - "fields": [] - } - ] - } - ], - "global": { - "asil-level": "B" - } - } - )"; - const score::json::JsonParser json_parser_obj; - auto json = json_parser_obj.FromBuffer(config_with_some_ip_binding); - - // When parsing such a configuration - // Fail and abort - SCORE_LANGUAGE_FUTURECPP_EXPECT_CONTRACT_VIOLATED( - score::mw::com::impl::configuration::Parse(std::move(json).value())); -} - class ShmSizeCalcMode : public ::testing::TestWithParam> { }; diff --git a/score/mw/com/impl/configuration/configuration_error.h b/score/mw/com/impl/configuration/configuration_error.h index b63371c61..759f4fd6e 100644 --- a/score/mw/com/impl/configuration/configuration_error.h +++ b/score/mw/com/impl/configuration/configuration_error.h @@ -27,8 +27,6 @@ enum class configuration_errc : score::result::ErrorCode serialization_deploymentinformation_invalid = 0, serialization_no_shmbindinginformation = 1, serialization_shmbindinginformation_invalid = 2, - serialization_someipbindinginformation_invalid = 3, - serialization_no_someipbindinginformation = 4, }; /// \brief See above explanation in configuration_errc @@ -61,13 +59,6 @@ class ConfigurationErrorDomain final : public score::result::ErrorDomain case static_cast(configuration_errc::serialization_shmbindinginformation_invalid): return "serialization of is invalid"; // coverity[autosar_cpp14_m6_4_5_violation] - case static_cast(configuration_errc::serialization_no_someipbindinginformation): - return "no serialization of "; - // coverity[autosar_cpp14_m6_4_5_violation] - case static_cast( - configuration_errc::serialization_someipbindinginformation_invalid): - return "serialization of is invalid"; - // coverity[autosar_cpp14_m6_4_5_violation] default: return "unknown configuration error"; } diff --git a/score/mw/com/impl/configuration/configuration_error_test.cpp b/score/mw/com/impl/configuration/configuration_error_test.cpp index 0f2cda607..552ae9fd2 100644 --- a/score/mw/com/impl/configuration/configuration_error_test.cpp +++ b/score/mw/com/impl/configuration/configuration_error_test.cpp @@ -50,18 +50,6 @@ TEST_F(ConfigurationErrorTest, MessageForSerializationShmbindinginformationInval "serialization of is invalid"); } -TEST_F(ConfigurationErrorTest, MessageForSerializationSomeipbindinginformationInvalid) -{ - testErrorMessage(configuration_errc::serialization_someipbindinginformation_invalid, - "serialization of is invalid"); -} - -TEST_F(ConfigurationErrorTest, MessageForSerializationNoSomeipbindinginformationInvalid) -{ - testErrorMessage(configuration_errc::serialization_no_someipbindinginformation, - "no serialization of "); -} - TEST_F(ConfigurationErrorTest, MessageForDefault) { testErrorMessage(static_cast(-1), "unknown configuration error"); diff --git a/score/mw/com/impl/configuration/mw_com_config_schema.json b/score/mw/com/impl/configuration/mw_com_config_schema.json index a5276c039..12b0a8cc2 100644 --- a/score/mw/com/impl/configuration/mw_com_config_schema.json +++ b/score/mw/com/impl/configuration/mw_com_config_schema.json @@ -50,7 +50,6 @@ "title": "Type of binding", "type": "string", "enum": [ - "SOME/IP", "SHM" ], "description": "Binding technology" @@ -58,7 +57,7 @@ "serviceId": { "type": "integer", "title": "Service Id", - "description": "Binding technology specific service id, it might be 16 or 64 bit. For LoLa/Shm and SOME/IP we have 16 bit values." + "description": "Binding technology specific service id, it might be 16 or 64 bit. For LoLa/Shm we have 16 bit values." }, "events": { "type": "array", @@ -82,7 +81,7 @@ "eventId": { "type": "integer", "title": "Service Event Id", - "description": "Binding technology specific event id. LoLa supports 8 bit, while SOME/IP supports 15 bit." + "description": "Binding technology specific event id. LoLa supports 8 bit." } } } @@ -109,7 +108,7 @@ "fieldId": { "type": "integer", "title": "Service Field Id", - "description": "Binding technology specific field id. LoLa supports 8 bit, while SOME/IP supports 15 bit." + "description": "Binding technology specific field id. LoLa supports 8 bit." }, "Get": { "type": "boolean", @@ -144,7 +143,7 @@ }, "methodId": { "type": "integer", - "description": "Binding technology specific method id. LoLa supports 8 bit, while SOME/IP supports 15 bit." + "description": "Binding technology specific method id. LoLa supports 8 bit." } } } @@ -215,7 +214,6 @@ "binding": { "type": "string", "enum": [ - "SOME/IP", "SHM" ], "title": "Binding", diff --git a/score/mw/com/impl/configuration/service_instance_deployment.cpp b/score/mw/com/impl/configuration/service_instance_deployment.cpp index 399eb0a8b..e3a0749b0 100644 --- a/score/mw/com/impl/configuration/service_instance_deployment.cpp +++ b/score/mw/com/impl/configuration/service_instance_deployment.cpp @@ -90,15 +90,6 @@ auto areCompatible(const ServiceInstanceDeployment& lhs, const ServiceInstanceDe { bindingCompatible = areCompatible(*lhsShmBindingInfo, *rhsShmBindingInfo); } - else - { - const auto* const lhsSomeIpBindingInfo = std::get_if(&lhs.bindingInfo_); - const auto* const rhsSomeIpBindingInfo = std::get_if(&rhs.bindingInfo_); - if ((lhsSomeIpBindingInfo != nullptr) && (rhsSomeIpBindingInfo != nullptr)) - { - bindingCompatible = areCompatible(*lhsSomeIpBindingInfo, *rhsSomeIpBindingInfo); - } - } return areCompatible(lhs.asilLevel_, rhs.asilLevel_) && bindingCompatible; } @@ -138,9 +129,6 @@ score::json::Object ServiceInstanceDeployment::Serialize() const noexcept [&json_object](const LolaServiceInstanceDeployment& deployment) { json_object[kBindingInfoKey] = deployment.Serialize(); }, - [&json_object](const SomeIpServiceInstanceDeployment& deployment) { - json_object[kBindingInfoKey] = deployment.Serialize(); - }, [](const score::cpp::blank&) noexcept {}); std::visit(visitor, bindingInfo_); @@ -166,11 +154,6 @@ BindingType ServiceInstanceDeployment::GetBindingType() const noexcept }, // FP: only one statement in this line // coverity[autosar_cpp14_a7_1_7_violation] - [](const SomeIpServiceInstanceDeployment&) noexcept { - return BindingType::kSomeIp; - }, - // FP: only one statement in this line - // coverity[autosar_cpp14_a7_1_7_violation] [](const score::cpp::blank&) noexcept { return BindingType::kFake; }); diff --git a/score/mw/com/impl/configuration/service_instance_deployment.h b/score/mw/com/impl/configuration/service_instance_deployment.h index 320a2515c..41d0130e7 100644 --- a/score/mw/com/impl/configuration/service_instance_deployment.h +++ b/score/mw/com/impl/configuration/service_instance_deployment.h @@ -18,7 +18,6 @@ #include "score/mw/com/impl/configuration/lola_service_instance_deployment.h" #include "score/mw/com/impl/configuration/quality_type.h" #include "score/mw/com/impl/configuration/service_identifier_type.h" -#include "score/mw/com/impl/configuration/someip_service_instance_deployment.h" #include "score/mw/com/impl/instance_specifier.h" #include "score/json/json_parser.h" @@ -38,8 +37,7 @@ namespace score::mw::com::impl class ServiceInstanceDeployment { public: - using BindingInformation = - std::variant; + using BindingInformation = std::variant; explicit ServiceInstanceDeployment(const score::json::Object& json_object) noexcept; ServiceInstanceDeployment(const ServiceIdentifierType service, @@ -91,8 +89,7 @@ const ServiceInstanceDeploymentBinding& GetServiceInstanceDeploymentBinding( // LCOV_EXCL_BR_START False positive: The tool is reporting that the true decision is never taken. We have tests in // service_instance_deployment_test.cpp - // (GettingLolaBindingFromServiceInstanceDeploymentNotContainingLolaBindingTerminates, - // GettingSomeIpBindingFromServiceInstanceDeploymentNotContainingSomeIpBindingTerminates and + // (GettingLolaBindingFromServiceInstanceDeploymentNotContainingLolaBindingTerminates and // GettingBlankBindingFromServiceInstanceDeploymentNotContainingBlankBindingTerminates) which test the true branch // of this condition. This is a bug with the tool to be fixed in (Ticket-219132). This suppression should be removed // when the tool is fixed. diff --git a/score/mw/com/impl/configuration/service_instance_deployment_test.cpp b/score/mw/com/impl/configuration/service_instance_deployment_test.cpp index 8d66fbae1..93fd12b2c 100644 --- a/score/mw/com/impl/configuration/service_instance_deployment_test.cpp +++ b/score/mw/com/impl/configuration/service_instance_deployment_test.cpp @@ -16,7 +16,6 @@ #include "score/mw/com/impl/configuration/lola_service_instance_deployment.h" #include "score/mw/com/impl/configuration/quality_type.h" #include "score/mw/com/impl/configuration/service_identifier_type.h" -#include "score/mw/com/impl/configuration/someip_service_instance_deployment.h" #include "score/mw/com/impl/configuration/test/configuration_test_resources.h" #include "score/mw/com/impl/instance_specifier.h" @@ -49,8 +48,7 @@ TEST(ServiceInstanceDeploymentTest, DifferentBindingsAreNotCompatible) ASSERT_FALSE(areCompatible( ServiceInstanceDeployment{ kDummyService, LolaServiceInstanceDeployment{}, QualityType::kASIL_QM, kInstanceSpecifier}, - ServiceInstanceDeployment{ - kDummyService, SomeIpServiceInstanceDeployment{}, QualityType::kASIL_QM, kInstanceSpecifier})); + ServiceInstanceDeployment{kDummyService, score::cpp::blank{}, QualityType::kASIL_QM, kInstanceSpecifier})); } TEST(ServiceInstanceDeploymentTest, DifferentShmBindingsAreCompatible) @@ -62,21 +60,12 @@ TEST(ServiceInstanceDeploymentTest, DifferentShmBindingsAreCompatible) kDummyService, LolaServiceInstanceDeployment{}, QualityType::kASIL_QM, kInstanceSpecifier})); } -TEST(ServiceInstanceDeploymentTest, DifferentSomeIpBindingsAreCompatible) -{ - ASSERT_TRUE(areCompatible( - ServiceInstanceDeployment{ - kDummyService, SomeIpServiceInstanceDeployment{}, QualityType::kASIL_QM, kInstanceSpecifier}, - ServiceInstanceDeployment{ - kDummyService, SomeIpServiceInstanceDeployment{}, QualityType::kASIL_QM, kInstanceSpecifier})); -} - TEST(ServiceInstanceDeploymentTest, Equality) { const auto unit1 = ServiceInstanceDeployment{ - kDummyService, SomeIpServiceInstanceDeployment{}, QualityType::kASIL_QM, kInstanceSpecifier}; + kDummyService, LolaServiceInstanceDeployment{}, QualityType::kASIL_QM, kInstanceSpecifier}; const auto unit2 = ServiceInstanceDeployment{ - kDummyService, SomeIpServiceInstanceDeployment{}, QualityType::kASIL_QM, kInstanceSpecifier}; + kDummyService, LolaServiceInstanceDeployment{}, QualityType::kASIL_QM, kInstanceSpecifier}; EXPECT_EQ(unit1, unit2); } @@ -92,17 +81,6 @@ TEST_F(ServiceInstanceDeploymentFixture, CanConstructFromLolaServiceInstanceDepl ASSERT_NE(binding_ptr, nullptr); } -TEST_F(ServiceInstanceDeploymentFixture, CanConstructFromSomeIpServiceInstanceDeployment) -{ - ServiceInstanceDeployment unit{ - kDummyService, SomeIpServiceInstanceDeployment{16U}, QualityType::kASIL_QM, kInstanceSpecifier}; - - ASSERT_EQ(unit.asilLevel_, QualityType::kASIL_QM); - ExpectServiceIdentifierTypeObjectsEqual(unit.service_, kDummyService); - const auto* const binding_ptr = std::get_if(&unit.bindingInfo_); - ASSERT_NE(binding_ptr, nullptr); -} - TEST_F(ServiceInstanceDeploymentFixture, CanConstructFromBlankInstanceDeployment) { ServiceInstanceDeployment unit{kDummyService, score::cpp::blank{}, QualityType::kASIL_QM, kInstanceSpecifier}; @@ -127,22 +105,6 @@ TEST_F(ServiceInstanceDeploymentFixture, CanCreateFromSerializedLolaObject) ExpectServiceInstanceDeploymentObjectsEqual(reconstructed_unit, unit); } -TEST_F(ServiceInstanceDeploymentFixture, CanCreateFromSerializedSomeIpObject) -{ - const std::uint16_t instance_id{123U}; - - SomeIpServiceInstanceDeployment someip_service_instance_deployment{instance_id}; - - ServiceInstanceDeployment unit{ - kDummyService, someip_service_instance_deployment, QualityType::kASIL_B, kInstanceSpecifier}; - - const auto serialized_unit{unit.Serialize()}; - - ServiceInstanceDeployment reconstructed_unit{serialized_unit}; - - ExpectServiceInstanceDeploymentObjectsEqual(reconstructed_unit, unit); -} - TEST_F(ServiceInstanceDeploymentFixture, CanCreateFromSerializedBlankObject) { ServiceInstanceDeployment unit{kDummyService, score::cpp::blank{}, QualityType::kASIL_B, kInstanceSpecifier}; @@ -167,21 +129,6 @@ TEST_F(ServiceInstanceDeploymentFixture, CanGetLolaBindingFromServiceInstanceDep EXPECT_EQ(lola_service_instance_deployment, returned_service_instance_deployment_binding); } -TEST_F(ServiceInstanceDeploymentFixture, CanGetSomeIpBindingFromServiceInstanceDeploymentContainingSomeIpBinding) -{ - // Given a ServiceInstanceDeployment containing a SomeIp binding - const auto& someip_service_instance_deployment = MakeSomeIpServiceInstanceDeployment(); - ServiceInstanceDeployment service_instance_deployment{ - kDummyService, someip_service_instance_deployment, QualityType::kASIL_QM, kInstanceSpecifier}; - - // When getting the SomeIpServiceInstanceDeployment - const auto returned_service_instance_deployment_binding = - GetServiceInstanceDeploymentBinding(service_instance_deployment); - - // Then the SomeIp binding of the ServiceInstanceDeployment is returned - EXPECT_EQ(someip_service_instance_deployment, returned_service_instance_deployment_binding); -} - TEST_F(ServiceInstanceDeploymentFixture, CanGetBlankBindingFromServiceInstanceDeploymentContainingBlankBinding) { // Given a ServiceInstanceDeployment containing a blank binding @@ -200,10 +147,9 @@ using ServiceInstanceDeploymentDeathTest = ServiceInstanceDeploymentFixture; TEST_F(ServiceInstanceDeploymentDeathTest, GettingLolaBindingFromServiceInstanceDeploymentNotContainingLolaBindingTerminates) { - // Given a ServiceInstanceDeployment containing a SomeIp binding - const auto& someip_service_instance_deployment = MakeSomeIpServiceInstanceDeployment(); + // Given a ServiceInstanceDeployment containing a blank binding ServiceInstanceDeployment service_instance_deployment{ - kDummyService, someip_service_instance_deployment, QualityType::kASIL_QM, kInstanceSpecifier}; + kDummyService, score::cpp::blank{}, QualityType::kASIL_QM, kInstanceSpecifier}; // When getting the LolaServiceInstanceDeployment // Then the program terminates @@ -212,28 +158,12 @@ TEST_F(ServiceInstanceDeploymentDeathTest, ".*"); } -TEST_F(ServiceInstanceDeploymentDeathTest, - GettingSomeIpBindingFromServiceInstanceDeploymentNotContainingSomeIpBindingTerminates) -{ - // Given a ServiceInstanceDeployment containing a Lola binding - const auto& lola_service_instance_deployment = MakeLolaServiceInstanceDeployment(); - ServiceInstanceDeployment service_instance_deployment{ - kDummyService, lola_service_instance_deployment, QualityType::kASIL_QM, kInstanceSpecifier}; - - // When getting the SomeIpServiceInstanceDeployment - // Then the program terminates - EXPECT_DEATH(score::cpp::ignore = - GetServiceInstanceDeploymentBinding(service_instance_deployment), - ".*"); -} - TEST_F(ServiceInstanceDeploymentDeathTest, GettingBlankBindingFromServiceInstanceDeploymentNotContainingBlankBindingTerminates) { - // Given a ServiceInstanceDeployment containing a SomeIp binding - const auto& someip_service_instance_deployment = MakeSomeIpServiceInstanceDeployment(); + // Given a ServiceInstanceDeployment containing a Lola binding ServiceInstanceDeployment service_instance_deployment{ - kDummyService, someip_service_instance_deployment, QualityType::kASIL_QM, kInstanceSpecifier}; + kDummyService, MakeLolaServiceInstanceDeployment(), QualityType::kASIL_QM, kInstanceSpecifier}; // When getting a blank binding // Then the program terminates @@ -259,17 +189,6 @@ TEST_F(ServiceInstanceDeploymentDeathTest, CreatingFromSerializedObjectWithMisma EXPECT_DEATH(ServiceInstanceDeployment reconstructed_unit{serialized_unit}, ".*"); } -TEST(ServiceInstanceDeploymentTest, GetBindingTypeReturnsSomeIpForSomeIpBinding) -{ - // Given a ServiceInstanceDeployment - const auto unit = ServiceInstanceDeployment{ - kDummyService, SomeIpServiceInstanceDeployment{16U}, QualityType::kASIL_QM, kInstanceSpecifier}; - - // When getting the binding type - // Then it should return BindingType::kSomeIp - EXPECT_EQ(unit.GetBindingType(), BindingType::kSomeIp); -} - TEST(ServiceInstanceDeploymentTest, GetBindingTypeReturnsFakeForBlankBinding) { // Given a ServiceInstanceDeployment @@ -377,77 +296,46 @@ TEST_P(ServiceInstanceDeploymentLessThanParamaterisedFixture, DifferentDeploymen EXPECT_FALSE(service_type_deployment_2 < service_type_deployment_1); } -INSTANTIATE_TEST_CASE_P( - ServiceInstanceDeploymentLessThanParamaterisedFixture, - ServiceInstanceDeploymentLessThanParamaterisedFixture, - ::testing::Values( - // Comparing two ServiceInstanceDeployments with equal bindings compares based on Asil level - std::make_pair(ServiceInstanceDeployment{kDummyService, - LolaServiceInstanceDeployment{1U}, - QualityType::kASIL_QM, - kInstanceSpecifier}, - ServiceInstanceDeployment{kDummyService, - LolaServiceInstanceDeployment{1U}, - QualityType::kASIL_B, - kInstanceSpecifier}), - - // Comparing two LolaServiceInstanceDeployments compares based on InstanceId only - std::make_pair(ServiceInstanceDeployment{kDummyService, - LolaServiceInstanceDeployment{1U}, - QualityType::kASIL_QM, - kInstanceSpecifier}, - ServiceInstanceDeployment{kDummyService, - LolaServiceInstanceDeployment{2U}, - QualityType::kASIL_B, - kInstanceSpecifier}), - std::make_pair(ServiceInstanceDeployment{kDummyService, - LolaServiceInstanceDeployment{1U}, - QualityType::kASIL_B, - kInstanceSpecifier}, - ServiceInstanceDeployment{kDummyService, - LolaServiceInstanceDeployment{2U}, - QualityType::kASIL_QM, - kInstanceSpecifier}), - - // Comparing two SomeIpServiceInstanceDeployments compares based on InstanceId only - std::make_pair(ServiceInstanceDeployment{kDummyService, - SomeIpServiceInstanceDeployment{1U}, - QualityType::kASIL_QM, - kInstanceSpecifier}, - ServiceInstanceDeployment{kDummyService, - SomeIpServiceInstanceDeployment{2U}, - QualityType::kASIL_B, - kInstanceSpecifier}), - std::make_pair(ServiceInstanceDeployment{kDummyService, - SomeIpServiceInstanceDeployment{1U}, - QualityType::kASIL_B, - kInstanceSpecifier}, - ServiceInstanceDeployment{kDummyService, - SomeIpServiceInstanceDeployment{2U}, - QualityType::kASIL_QM, - kInstanceSpecifier}), - - // Comparing difference ServiceInstanceDeployment bindings compares based on variant index - std::make_pair(ServiceInstanceDeployment{kDummyService, - LolaServiceInstanceDeployment{2U}, - QualityType::kASIL_QM, - kInstanceSpecifier}, - ServiceInstanceDeployment{kDummyService, - SomeIpServiceInstanceDeployment{1U}, - QualityType::kASIL_B, - kInstanceSpecifier}), - std::make_pair( - ServiceInstanceDeployment{kDummyService, - LolaServiceInstanceDeployment{2U}, - QualityType::kASIL_QM, - kInstanceSpecifier}, - ServiceInstanceDeployment{kDummyService, score::cpp::blank{}, QualityType::kASIL_B, kInstanceSpecifier}), - std::make_pair( - ServiceInstanceDeployment{kDummyService, - SomeIpServiceInstanceDeployment{2U}, - QualityType::kASIL_QM, - kInstanceSpecifier}, - ServiceInstanceDeployment{kDummyService, score::cpp::blank{}, QualityType::kASIL_B, kInstanceSpecifier}))); +INSTANTIATE_TEST_CASE_P(ServiceInstanceDeploymentLessThanParamaterisedFixture, + ServiceInstanceDeploymentLessThanParamaterisedFixture, + ::testing::Values( + // Comparing two ServiceInstanceDeployments with equal bindings compares based on Asil level + std::make_pair(ServiceInstanceDeployment{kDummyService, + LolaServiceInstanceDeployment{1U}, + QualityType::kASIL_QM, + kInstanceSpecifier}, + ServiceInstanceDeployment{kDummyService, + LolaServiceInstanceDeployment{1U}, + QualityType::kASIL_B, + kInstanceSpecifier}), + + // Comparing two LolaServiceInstanceDeployments compares based on InstanceId only + std::make_pair(ServiceInstanceDeployment{kDummyService, + LolaServiceInstanceDeployment{1U}, + QualityType::kASIL_QM, + kInstanceSpecifier}, + ServiceInstanceDeployment{kDummyService, + LolaServiceInstanceDeployment{2U}, + QualityType::kASIL_B, + kInstanceSpecifier}), + std::make_pair(ServiceInstanceDeployment{kDummyService, + LolaServiceInstanceDeployment{1U}, + QualityType::kASIL_B, + kInstanceSpecifier}, + ServiceInstanceDeployment{kDummyService, + LolaServiceInstanceDeployment{2U}, + QualityType::kASIL_QM, + kInstanceSpecifier}), + + // Comparing difference ServiceInstanceDeployment bindings compares based on variant index + std::make_pair(ServiceInstanceDeployment{kDummyService, + LolaServiceInstanceDeployment{2U}, + QualityType::kASIL_QM, + kInstanceSpecifier}, + ServiceInstanceDeployment{kDummyService, + score::cpp::blank{}, + QualityType::kASIL_B, + kInstanceSpecifier}))); } // namespace } // namespace score::mw::com::impl diff --git a/score/mw/com/impl/configuration/service_instance_id.cpp b/score/mw/com/impl/configuration/service_instance_id.cpp index c43b1367f..d265d2eee 100644 --- a/score/mw/com/impl/configuration/service_instance_id.cpp +++ b/score/mw/com/impl/configuration/service_instance_id.cpp @@ -85,9 +85,6 @@ std::string ToHashStringImpl(const ServiceInstanceId::BindingInformation& bindin [](const LolaServiceInstanceId& instance_id) noexcept -> std::string_view { return instance_id.ToHashString(); }, - [](const SomeIpServiceInstanceId& instance_id) noexcept -> std::string_view { - return instance_id.ToHashString(); - }, [](const score::cpp::blank&) noexcept -> std::string_view { return ""; }); @@ -135,9 +132,6 @@ score::json::Object ServiceInstanceId::Serialize() const noexcept [&json_object](const LolaServiceInstanceId& instance_id) { json_object[kBindingInfoKeySerInstID] = instance_id.Serialize(); }, - [&json_object](const SomeIpServiceInstanceId& instance_id) { - json_object[kBindingInfoKeySerInstID] = instance_id.Serialize(); - }, [](const score::cpp::blank&) noexcept {}); std::visit(visitor, binding_info_); return json_object; @@ -161,16 +155,8 @@ bool operator==(const ServiceInstanceId& lhs, const ServiceInstanceId& rhs) noex } return lhs_lola == *rhs_lola; }, - [lhs, rhs](const SomeIpServiceInstanceId& lhs_someip) noexcept -> bool { - const auto* const rhs_someip = std::get_if(&rhs.binding_info_); - if (rhs_someip == nullptr) - { - return false; - } - return lhs_someip == *rhs_someip; - }, - [](const score::cpp::blank&) noexcept -> bool { - return true; + [&rhs](const score::cpp::blank&) noexcept -> bool { + return std::holds_alternative(rhs.binding_info_); }); return std::visit(visitor, lhs.binding_info_); } @@ -188,18 +174,10 @@ bool operator<(const ServiceInstanceId& lhs, const ServiceInstanceId& rhs) noexc } return lhs_lola < *rhs_lola; }, - [lhs, rhs](const SomeIpServiceInstanceId& lhs_someip) noexcept -> bool { - const auto* const rhs_someip = std::get_if(&rhs.binding_info_); - if (rhs_someip == nullptr) - { - return false; - } - return lhs_someip < *rhs_someip; - }, // FP: only one statement in this line // coverity[autosar_cpp14_a7_1_7_violation] - [](const score::cpp::blank&) noexcept -> bool { - return true; + [&rhs](const score::cpp::blank&) noexcept -> bool { + return !std::holds_alternative(rhs.binding_info_); }); return std::visit(visitor, lhs.binding_info_); } diff --git a/score/mw/com/impl/configuration/service_instance_id.h b/score/mw/com/impl/configuration/service_instance_id.h index cfd715abd..559bb2a52 100644 --- a/score/mw/com/impl/configuration/service_instance_id.h +++ b/score/mw/com/impl/configuration/service_instance_id.h @@ -14,7 +14,6 @@ #define SCORE_MW_COM_IMPL_CONFIGURATION_SERVICE_INSTANCE_ID_H #include "score/mw/com/impl/configuration/lola_service_instance_id.h" -#include "score/mw/com/impl/configuration/someip_service_instance_id.h" #include "score/json/json_parser.h" #include "score/mw/log/logging.h" @@ -31,7 +30,7 @@ namespace score::mw::com::impl class ServiceInstanceId { public: - using BindingInformation = std::variant; + using BindingInformation = std::variant; explicit ServiceInstanceId(const score::json::Object& json_object) noexcept; explicit ServiceInstanceId(BindingInformation binding_info) noexcept; @@ -54,8 +53,7 @@ class ServiceInstanceId */ // Variable is used in a test case -> so this line is tested and prepared for easier reuse // coverity[autosar_cpp14_a0_1_1_violation] - constexpr static std::size_t hashStringSize{ - std::max(LolaServiceInstanceId::hashStringSize, SomeIpServiceInstanceId::hashStringSize) + 1U}; + constexpr static std::size_t hashStringSize{LolaServiceInstanceId::hashStringSize + 1U}; constexpr static std::uint32_t serializationVersion = 1U; @@ -74,8 +72,8 @@ const ServiceInstanceIdBinding& GetServiceInstanceIdBinding(const ServiceInstanc { const auto* service_instance_id_binding = std::get_if(&service_instance_id.binding_info_); // LCOV_EXCL_BR_START False positive: The tool is reporting that the true decision is never taken. We have tests in - // service_instance_deployment_test.cpp (GettingLolaBindingFromServiceInstanceIdNotContainingLolaBindingTerminates - // and GettingSomeIpBindingFromServiceInstanceIdNotContainingSomeIpBindingTerminates) which test the true branch of + // service_instance_deployment_test.cpp (GettingLolaBindingFromServiceInstanceIdNotContainingLolaBindingTerminates) + // which test the true branch of // this condition. This is a bug with the tool to be fixed in (Ticket-219132). This suppression should be removed // when the tool is fixed. if (service_instance_id_binding == nullptr) diff --git a/score/mw/com/impl/configuration/service_instance_id_test.cpp b/score/mw/com/impl/configuration/service_instance_id_test.cpp index 9315eb621..cce1125fd 100644 --- a/score/mw/com/impl/configuration/service_instance_id_test.cpp +++ b/score/mw/com/impl/configuration/service_instance_id_test.cpp @@ -12,7 +12,6 @@ ********************************************************************************/ #include "score/mw/com/impl/configuration/service_instance_id.h" #include "score/mw/com/impl/configuration/lola_service_instance_id.h" -#include "score/mw/com/impl/configuration/someip_service_instance_id.h" #include "score/mw/com/impl/configuration/test/configuration_test_resources.h" @@ -31,14 +30,6 @@ TEST(ServiceInstanceIdTest, LolaBindingCanBeCopiedAndEqualCompared) ASSERT_EQ(unit, unitCopy); } -TEST(ServiceInstanceIdTest, SomeIpBindingCanBeCopiedAndEqualCompared) -{ - const auto unit = ServiceInstanceId{SomeIpServiceInstanceId{10U}}; - const auto unitCopy = unit; - - ASSERT_EQ(unit, unitCopy); -} - TEST(ServiceInstanceIdTest, EmptyBindingCanBeCopiedAndEqualCompared) { const auto unit = ServiceInstanceId{score::cpp::blank{}}; @@ -50,7 +41,7 @@ TEST(ServiceInstanceIdTest, EmptyBindingCanBeCopiedAndEqualCompared) TEST(ServiceInstanceIdTest, ComparingDifferentBindingsReturnsFalse) { const auto unit = ServiceInstanceId{LolaServiceInstanceId{10U}}; - const auto unit_2 = ServiceInstanceId{SomeIpServiceInstanceId{10U}}; + const auto unit_2 = ServiceInstanceId{score::cpp::blank{}}; // Note: The code being executed depends on the type of lhs. As a result we need to cover both "directions" ASSERT_FALSE(unit == unit_2); @@ -66,28 +57,6 @@ TEST(ServiceInstanceIdTest, LessThanOperatorLolaServiceBindings) EXPECT_FALSE(unit_2 < unit); } -TEST(ServiceInstanceIdTest, LessThanOperatorSomeIpServiceBindings) -{ - // Given ServiceInstanceId objects containing SomeIpServiceInstanceId - const auto unit = ServiceInstanceId{SomeIpServiceInstanceId{10U}}; - const auto unit_2 = ServiceInstanceId{SomeIpServiceInstanceId{11U}}; - - // When comparing them via the less-than operator - EXPECT_TRUE(unit < unit_2); - EXPECT_FALSE(unit_2 < unit); - - // Then the expecations above must be fulfilled -} - -TEST(ServiceInstanceIdTest, LessThanOperatorDifferentBindingsIsAlwaysFalse) -{ - const auto unit = ServiceInstanceId{LolaServiceInstanceId{10U}}; - const auto unit_2 = ServiceInstanceId{SomeIpServiceInstanceId{11U}}; - - EXPECT_FALSE(unit < unit_2); - EXPECT_FALSE(unit_2 < unit); -} - TEST(ServiceInstanceIdTest, LessThanOperatorWithBlanks) { // Given ServiceInstanceId objects of which one holds score::cpp::blank as binding_info @@ -112,16 +81,6 @@ TEST_F(ServiceInstanceIdFixture, CanConstructFromLolaServiceInstanceId) ExpectLolaServiceInstanceIdObjectsEqual(*binding_ptr, lola_service_instance_id); } -TEST_F(ServiceInstanceIdFixture, CanConstructFromSomeIpServiceInstanceId) -{ - SomeIpServiceInstanceId someip_service_instance_id{10U}; - ServiceInstanceId unit{someip_service_instance_id}; - - const auto* const binding_ptr = std::get_if(&unit.binding_info_); - ASSERT_NE(binding_ptr, nullptr); - ExpectSomeIpServiceInstanceIdObjectsEqual(*binding_ptr, someip_service_instance_id); -} - TEST_F(ServiceInstanceIdFixture, CanConstructFromBlankInstanceDeployment) { ServiceInstanceId unit{score::cpp::blank{}}; @@ -143,21 +102,6 @@ TEST_F(ServiceInstanceIdFixture, CanCreateFromSerializedLolaObject) ExpectServiceInstanceIdObjectsEqual(reconstructed_unit, unit); } -TEST_F(ServiceInstanceIdFixture, CanCreateFromSerializedSomeIpObject) -{ - const std::uint16_t instance_id{123U}; - - SomeIpServiceInstanceId someip_service_instance_deployment{instance_id}; - - ServiceInstanceId unit{someip_service_instance_deployment}; - - const auto serialized_unit{unit.Serialize()}; - - ServiceInstanceId reconstructed_unit{serialized_unit}; - - ExpectServiceInstanceIdObjectsEqual(reconstructed_unit, unit); -} - TEST_F(ServiceInstanceIdFixture, CanCreateFromSerializedBlankObject) { ServiceInstanceId unit{score::cpp::blank{}}; @@ -204,13 +148,7 @@ const std::vector> instance_id_t {ServiceInstanceId{LolaServiceInstanceId{1U}}, "00001"}, {ServiceInstanceId{LolaServiceInstanceId{10U}}, "0000a"}, {ServiceInstanceId{LolaServiceInstanceId{255U}}, "000ff"}, - {ServiceInstanceId{LolaServiceInstanceId{std::numeric_limits::max()}}, "0ffff"}, - {ServiceInstanceId{SomeIpServiceInstanceId{0U}}, "10000"}, - {ServiceInstanceId{SomeIpServiceInstanceId{1U}}, "10001"}, - {ServiceInstanceId{SomeIpServiceInstanceId{10U}}, "1000a"}, - {ServiceInstanceId{SomeIpServiceInstanceId{255U}}, "100ff"}, - {ServiceInstanceId{SomeIpServiceInstanceId{std::numeric_limits::max()}}, - "1ffff"}}; + {ServiceInstanceId{LolaServiceInstanceId{std::numeric_limits::max()}}, "0ffff"}}; INSTANTIATE_TEST_SUITE_P(ServiceInstanceIdHashFixture, ServiceInstanceIdHashFixture, ::testing::ValuesIn(instance_id_to_hash_string_variations)); @@ -229,41 +167,15 @@ TEST(ServiceInstanceIdTest, CanGetLolaBindingFromServiceInstanceIdContainingLola EXPECT_EQ(lola_service_instance_id, returned_service_instance_id_binding); } -TEST(ServiceInstanceIdTest, CanGetSomeIpBindingFromServiceInstanceIdContainingSomeIpBinding) -{ - // Given a ServiceInstanceId containing a SomeIp binding - const SomeIpServiceInstanceId some_ip_service_instance_id{10U}; - const ServiceInstanceId service_instance_id{some_ip_service_instance_id}; - - // When getting the SomeIpServiceInstanceId - const auto returned_service_instance_id_binding = - GetServiceInstanceIdBinding(service_instance_id); - - // Then the SomeIp binding of the ServiceInstanceId is returned - EXPECT_EQ(some_ip_service_instance_id, returned_service_instance_id_binding); -} - TEST(ServiceInstanceIdDeathTest, GettingLolaBindingFromServiceInstanceIdNotContainingLolaBindingTerminates) { - // Given a ServiceInstanceId containing a SomeIp binding - const SomeIpServiceInstanceId some_ip_service_instance_id{10U}; - ServiceInstanceId service_instance_id{some_ip_service_instance_id}; + // Given a ServiceInstanceId containing a blank binding + ServiceInstanceId service_instance_id{score::cpp::blank{}}; // When getting the LolaServiceInstanceId // Then the program terminates EXPECT_DEATH(score::cpp::ignore = GetServiceInstanceIdBinding(service_instance_id), ".*"); } -TEST(ServiceInstanceIdDeathTest, GettingSomeIpBindingFromServiceInstanceIdNotContainingSomeIpBindingTerminates) -{ - // Given a ServiceInstanceId containing a Lola binding - const LolaServiceInstanceId lola_service_instance_id{10U}; - ServiceInstanceId service_instance_id{lola_service_instance_id}; - - // When getting the SomeIpServiceInstanceId - // Then the program terminates - EXPECT_DEATH(score::cpp::ignore = GetServiceInstanceIdBinding(service_instance_id), ".*"); -} - } // namespace } // namespace score::mw::com::impl diff --git a/score/mw/com/impl/configuration/test/configuration_test_resources.cpp b/score/mw/com/impl/configuration/test/configuration_test_resources.cpp index 7a2d28660..0f29a54bc 100644 --- a/score/mw/com/impl/configuration/test/configuration_test_resources.cpp +++ b/score/mw/com/impl/configuration/test/configuration_test_resources.cpp @@ -111,24 +111,6 @@ LolaServiceInstanceDeployment MakeLolaServiceInstanceDeployment( return unit; } -SomeIpServiceInstanceDeployment MakeSomeIpServiceInstanceDeployment( - const score::cpp::optional instance_id) noexcept -{ - const SomeIpEventInstanceDeployment event_instance_deployment_1{}; - const SomeIpEventInstanceDeployment event_instance_deployment_2{}; - - const SomeIpFieldInstanceDeployment field_instance_deployment_1{}; - const SomeIpFieldInstanceDeployment field_instance_deployment_2{}; - - const SomeIpServiceInstanceDeployment::EventInstanceMapping events{{kDummyEventName1, event_instance_deployment_1}, - {kDummyEventName2, event_instance_deployment_2}}; - - const SomeIpServiceInstanceDeployment::FieldInstanceMapping fields{{kDummyFieldName1, field_instance_deployment_1}, - {kDummyFieldName2, field_instance_deployment_2}}; - - return SomeIpServiceInstanceDeployment(instance_id, events, fields); -} - LolaServiceTypeDeployment MakeLolaServiceTypeDeployment(const std::uint16_t service_id) noexcept { const LolaEventId event_type_deployment_1{33U}; @@ -181,18 +163,6 @@ void ConfigurationStructsFixture::ExpectLolaMethodInstanceDeploymentObjectsEqual EXPECT_EQ(lhs.queue_size_, rhs.queue_size_); } -void ConfigurationStructsFixture::ExpectSomeIpEventInstanceDeploymentObjectsEqual( - const SomeIpEventInstanceDeployment& /* lhs */, - const SomeIpEventInstanceDeployment& /* rhs */) const noexcept -{ -} - -void ConfigurationStructsFixture::ExpectSomeIpFieldInstanceDeploymentObjectsEqual( - const SomeIpFieldInstanceDeployment& /* lhs */, - const SomeIpFieldInstanceDeployment& /* rhs */) const noexcept -{ -} - void ConfigurationStructsFixture::ExpectLolaServiceInstanceDeploymentObjectsEqual( const LolaServiceInstanceDeployment& lhs, const LolaServiceInstanceDeployment& rhs) const noexcept @@ -257,29 +227,6 @@ void ConfigurationStructsFixture::ExpectLolaServiceInstanceDeploymentObjectsEqua } } -void ConfigurationStructsFixture::ExpectSomeIpServiceInstanceDeploymentObjectsEqual( - const SomeIpServiceInstanceDeployment& lhs, - const SomeIpServiceInstanceDeployment& rhs) const noexcept -{ - EXPECT_EQ(lhs.instance_id_, rhs.instance_id_); - - ASSERT_EQ(lhs.events_.size(), rhs.events_.size()); - for (const auto& lhs_it : lhs.events_) - { - auto rhs_it = rhs.events_.find(lhs_it.first); - ASSERT_NE(rhs_it, rhs.events_.end()); - ExpectSomeIpEventInstanceDeploymentObjectsEqual(lhs_it.second, rhs_it->second); - } - - ASSERT_EQ(lhs.fields_.size(), rhs.fields_.size()); - for (const auto& lhs_it : lhs.fields_) - { - auto rhs_it = rhs.fields_.find(lhs_it.first); - ASSERT_NE(rhs_it, rhs.fields_.end()); - ExpectSomeIpFieldInstanceDeploymentObjectsEqual(lhs_it.second, rhs_it->second); - } -} - void ConfigurationStructsFixture::ExpectServiceInstanceDeploymentObjectsEqual( const ServiceInstanceDeployment& lhs, const ServiceInstanceDeployment& rhs) const noexcept @@ -294,11 +241,6 @@ void ConfigurationStructsFixture::ExpectServiceInstanceDeploymentObjectsEqual( ASSERT_NE(rhs_deployment, nullptr); ExpectLolaServiceInstanceDeploymentObjectsEqual(lhs_deployment, *rhs_deployment); }, - [this, lhs, rhs](const SomeIpServiceInstanceDeployment& lhs_deployment) { - const auto* const rhs_deployment = std::get_if(&rhs.bindingInfo_); - ASSERT_NE(rhs_deployment, nullptr); - ExpectSomeIpServiceInstanceDeploymentObjectsEqual(lhs_deployment, *rhs_deployment); - }, [](const score::cpp::blank&) noexcept {}); std::visit(visitor, lhs.bindingInfo_); } @@ -376,11 +318,6 @@ void ConfigurationStructsFixture::ExpectServiceInstanceIdObjectsEqual(const Serv ASSERT_NE(rhs_instance_id, nullptr); ExpectLolaServiceInstanceIdObjectsEqual(lhs_instance_id, *rhs_instance_id); }, - [this, rhs](const SomeIpServiceInstanceId& lhs_instance_id) { - const auto* const rhs_instance_id = std::get_if(&rhs.binding_info_); - ASSERT_NE(rhs_instance_id, nullptr); - ExpectSomeIpServiceInstanceIdObjectsEqual(lhs_instance_id, *rhs_instance_id); - }, [](const score::cpp::blank&) noexcept {}); std::visit(visitor, lhs.binding_info_); } @@ -392,11 +329,4 @@ void ConfigurationStructsFixture::ExpectLolaServiceInstanceIdObjectsEqual( EXPECT_EQ(lhs.GetId(), rhs.GetId()); } -void ConfigurationStructsFixture::ExpectSomeIpServiceInstanceIdObjectsEqual( - const SomeIpServiceInstanceId& lhs, - const SomeIpServiceInstanceId& rhs) const noexcept -{ - EXPECT_EQ(lhs.GetId(), rhs.GetId()); -} - } // namespace score::mw::com::impl diff --git a/score/mw/com/impl/configuration/test/configuration_test_resources.h b/score/mw/com/impl/configuration/test/configuration_test_resources.h index a85cf8522..787b7d680 100644 --- a/score/mw/com/impl/configuration/test/configuration_test_resources.h +++ b/score/mw/com/impl/configuration/test/configuration_test_resources.h @@ -26,9 +26,6 @@ #include "score/mw/com/impl/configuration/service_instance_deployment.h" #include "score/mw/com/impl/configuration/service_instance_id.h" #include "score/mw/com/impl/configuration/service_type_deployment.h" -#include "score/mw/com/impl/configuration/someip_event_instance_deployment.h" -#include "score/mw/com/impl/configuration/someip_field_instance_deployment.h" -#include "score/mw/com/impl/configuration/someip_service_instance_id.h" #include #include @@ -68,9 +65,6 @@ LolaServiceInstanceDeployment MakeLolaServiceInstanceDeployment( const score::cpp::optional control_asil_b_memory_size = 3000U, const score::cpp::optional control_qm_memory_size = 4000U) noexcept; -SomeIpServiceInstanceDeployment MakeSomeIpServiceInstanceDeployment( - const score::cpp::optional instance_id = 22U) noexcept; - LolaServiceTypeDeployment MakeLolaServiceTypeDeployment(const std::uint16_t service_id = 31U) noexcept; class ConfigurationStructsFixture : public ::testing::Test @@ -85,18 +79,9 @@ class ConfigurationStructsFixture : public ::testing::Test void ExpectLolaMethodInstanceDeploymentObjectsEqual(const LolaMethodInstanceDeployment& lhs, const LolaMethodInstanceDeployment& rhs) const noexcept; - void ExpectSomeIpEventInstanceDeploymentObjectsEqual(const SomeIpEventInstanceDeployment& lhs, - const SomeIpEventInstanceDeployment& rhs) const noexcept; - - void ExpectSomeIpFieldInstanceDeploymentObjectsEqual(const SomeIpFieldInstanceDeployment& lhs, - const SomeIpFieldInstanceDeployment& rhs) const noexcept; - void ExpectLolaServiceInstanceDeploymentObjectsEqual(const LolaServiceInstanceDeployment& lhs, const LolaServiceInstanceDeployment& rhs) const noexcept; - void ExpectSomeIpServiceInstanceDeploymentObjectsEqual(const SomeIpServiceInstanceDeployment& lhs, - const SomeIpServiceInstanceDeployment& rhs) const noexcept; - void ExpectServiceInstanceDeploymentObjectsEqual(const ServiceInstanceDeployment& lhs, const ServiceInstanceDeployment& rhs) const noexcept; @@ -116,9 +101,6 @@ class ConfigurationStructsFixture : public ::testing::Test void ExpectLolaServiceInstanceIdObjectsEqual(const LolaServiceInstanceId& lhs, const LolaServiceInstanceId& rhs) const noexcept; - - void ExpectSomeIpServiceInstanceIdObjectsEqual(const SomeIpServiceInstanceId& lhs, - const SomeIpServiceInstanceId& rhs) const noexcept; }; } // namespace score::mw::com::impl From fb6fcb5ca008c53bdc2350bb05a5753d9c6818b3 Mon Sep 17 00:00:00 2001 From: Sahithi Nukala Date: Mon, 11 May 2026 15:15:22 +0200 Subject: [PATCH 3/4] mw/com: Remove SOME/IP from plumbing layer - Remove SomeIpServiceInstanceDeployment visitor lambdas from all binding factory implementations - Remove CreateSomeIpBindingInstanceIdentifier from test helper - Remove SOME/IP typed test cases from all plumbing factory tests - Remove SOME/IP visitor from GetServiceInstanceId in instance_identifier --- .../enriched_instance_identifier_test.cpp | 12 -------- score/mw/com/impl/handle_type_test.cpp | 28 ------------------- score/mw/com/impl/instance_identifier.cpp | 7 ----- .../mw/com/impl/instance_identifier_test.cpp | 3 +- .../lola_proxy_element_building_blocks.cpp | 4 --- .../plumbing/proxy_binding_factory_impl.cpp | 4 --- .../plumbing/proxy_binding_factory_test.cpp | 17 ----------- ...proxy_event_field_binding_factory_test.cpp | 14 ---------- .../proxy_method_binding_factory_test.cpp | 22 --------------- .../skeleton_binding_factory_impl.cpp | 7 ----- .../skeleton_binding_factory_test.cpp | 6 ++-- .../skeleton_method_binding_factory_impl.cpp | 14 ++-------- .../skeleton_method_binding_factory_test.cpp | 20 ------------- ...ton_service_element_binding_factory_impl.h | 12 -------- ...n_service_element_binding_factory_test.cpp | 13 --------- .../dummy_instance_identifier_builder.cpp | 8 ------ .../test/dummy_instance_identifier_builder.h | 3 -- 17 files changed, 7 insertions(+), 187 deletions(-) diff --git a/score/mw/com/impl/enriched_instance_identifier_test.cpp b/score/mw/com/impl/enriched_instance_identifier_test.cpp index 2dadcbf64..b44baaa9b 100644 --- a/score/mw/com/impl/enriched_instance_identifier_test.cpp +++ b/score/mw/com/impl/enriched_instance_identifier_test.cpp @@ -155,18 +155,6 @@ TEST(EnrichedInstanceIdentifierBindingSpecificInstanceIdTest, CannotRetrieveInst EXPECT_FALSE(unit.GetBindingSpecificInstanceId().has_value()); } -TEST(EnrichedInstanceIdentifierBindingSpecificInstanceIdTest, CannotRetrieveInstanceIdIfGettingWrongBindingInstanceId) -{ - // Given an EnrichedInstanceIdentifier containing a Lola binding - const EnrichedInstanceIdentifier unit{kLolaInstanceIdentifier}; - - // When trying to get a SomeIpServiceInstanceId - const auto service_instance_id_result = unit.GetBindingSpecificInstanceId(); - - // Then an empty optional is returned - EXPECT_FALSE(service_instance_id_result.has_value()); -} - TEST(EnrichedInstanceIdentifierComparison, ComparesEqual) { const EnrichedInstanceIdentifier lhs{kLolaInstanceIdentifier}; diff --git a/score/mw/com/impl/handle_type_test.cpp b/score/mw/com/impl/handle_type_test.cpp index b5775e95e..0997a60c2 100644 --- a/score/mw/com/impl/handle_type_test.cpp +++ b/score/mw/com/impl/handle_type_test.cpp @@ -30,10 +30,6 @@ const LolaServiceInstanceId kLolaInstanceId{16U}; const LolaServiceInstanceId kLolaInstanceId2{15U}; LolaServiceInstanceDeployment kLolaServiceInstanceDeployment{kLolaInstanceId}; LolaServiceInstanceDeployment kLolaServiceInstanceDeployment2{kLolaInstanceId2}; -const SomeIpServiceInstanceId kSomeIpInstanceId{16U}; -const SomeIpServiceInstanceId kSomeIpInstanceId2{15U}; -const SomeIpServiceInstanceDeployment kSomeIpServiceInstanceDeployment{kSomeIpInstanceId}; -const SomeIpServiceInstanceDeployment kSomeIpServiceInstanceDeployment2{kSomeIpInstanceId2}; const ServiceInstanceDeployment kServiceInstanceDeployment1{kService1, kLolaServiceInstanceDeployment, QualityType::kASIL_QM, @@ -319,30 +315,6 @@ INSTANTIATE_TEST_CASE_P( kLolaServiceInstanceDeployment2, QualityType::kASIL_QM, kInstanceSpecifier}, - kTestTypeDeployment))}, - - std::array{ - make_HandleType(make_InstanceIdentifier(ServiceInstanceDeployment{kService1, - kSomeIpServiceInstanceDeployment, - QualityType::kASIL_QM, - kInstanceSpecifier}, - kTestTypeDeployment)), - make_HandleType(make_InstanceIdentifier(ServiceInstanceDeployment{kService1, - kSomeIpServiceInstanceDeployment2, - QualityType::kASIL_QM, - kInstanceSpecifier}, - kTestTypeDeployment))}, - - std::array{ - make_HandleType(make_InstanceIdentifier(ServiceInstanceDeployment{kService1, - kSomeIpServiceInstanceDeployment, - QualityType::kASIL_QM, - kInstanceSpecifier}, - kTestTypeDeployment)), - make_HandleType(make_InstanceIdentifier(ServiceInstanceDeployment{kService1, - kLolaServiceInstanceDeployment, - QualityType::kASIL_QM, - kInstanceSpecifier}, kTestTypeDeployment))})); } // namespace diff --git a/score/mw/com/impl/instance_identifier.cpp b/score/mw/com/impl/instance_identifier.cpp index 8420b39e8..4d7316f0d 100644 --- a/score/mw/com/impl/instance_identifier.cpp +++ b/score/mw/com/impl/instance_identifier.cpp @@ -171,13 +171,6 @@ auto InstanceIdentifierView::GetServiceInstanceId() const noexcept -> score::cpp } return ServiceInstanceId{*deployment.instance_id_}; }, - [](const SomeIpServiceInstanceDeployment& deployment) -> score::cpp::optional { - if (!deployment.instance_id_.has_value()) - { - return {}; - } - return ServiceInstanceId{*deployment.instance_id_}; - }, [](const score::cpp::blank&) noexcept -> score::cpp::optional { return score::cpp::optional{}; }); diff --git a/score/mw/com/impl/instance_identifier_test.cpp b/score/mw/com/impl/instance_identifier_test.cpp index 186a5bb71..1e658b09a 100644 --- a/score/mw/com/impl/instance_identifier_test.cpp +++ b/score/mw/com/impl/instance_identifier_test.cpp @@ -173,8 +173,7 @@ struct DeploymentPair using ServiceInstanceIdType = ServiceInstanceIdT; }; -using DeploymentTypes = ::testing::Types, - DeploymentPair>; +using DeploymentTypes = ::testing::Types>; template class InstanceIdentifierViewTypedTest : public ::testing::Test diff --git a/score/mw/com/impl/plumbing/lola_proxy_element_building_blocks.cpp b/score/mw/com/impl/plumbing/lola_proxy_element_building_blocks.cpp index 805d87d18..c4376c8e9 100644 --- a/score/mw/com/impl/plumbing/lola_proxy_element_building_blocks.cpp +++ b/score/mw/com/impl/plumbing/lola_proxy_element_building_blocks.cpp @@ -14,7 +14,6 @@ #include "score/mw/com/impl/configuration/binding_service_type_deployment.h" #include "score/mw/com/impl/configuration/lola_service_type_deployment.h" -#include "score/mw/com/impl/configuration/someip_service_instance_deployment.h" #include "score/mw/log/logging.h" #include @@ -94,9 +93,6 @@ std::optional LookupLolaProxyElement(const Handl }, [](const score::cpp::blank&) noexcept -> std::optional { return std::nullopt; - }, - [](const SomeIpServiceInstanceDeployment&) noexcept -> std::optional { - return std::nullopt; }); return std::visit(visitor, type_deployment.binding_info_); diff --git a/score/mw/com/impl/plumbing/proxy_binding_factory_impl.cpp b/score/mw/com/impl/plumbing/proxy_binding_factory_impl.cpp index 8e8abe9d0..78def8cc6 100644 --- a/score/mw/com/impl/plumbing/proxy_binding_factory_impl.cpp +++ b/score/mw/com/impl/plumbing/proxy_binding_factory_impl.cpp @@ -50,10 +50,6 @@ std::unique_ptr ProxyBindingFactoryImpl::Create(const HandleType& return lola::Proxy::Create(handle); }, // coverity[autosar_cpp14_a7_1_7_violation] - [](const SomeIpServiceInstanceDeployment&) noexcept -> ReturnType { - return nullptr; - }, - // coverity[autosar_cpp14_a7_1_7_violation] [](const score::cpp::blank&) noexcept -> ReturnType { return nullptr; }); diff --git a/score/mw/com/impl/plumbing/proxy_binding_factory_test.cpp b/score/mw/com/impl/plumbing/proxy_binding_factory_test.cpp index 6d6bc791f..f3079c474 100644 --- a/score/mw/com/impl/plumbing/proxy_binding_factory_test.cpp +++ b/score/mw/com/impl/plumbing/proxy_binding_factory_test.cpp @@ -137,23 +137,6 @@ TEST_F(ProxyBindingFactoryCreateFixture, CannotCreateBlank) EXPECT_EQ(result, nullptr); } -TEST_F(ProxyBindingFactoryCreateFixture, CannotCreateSomeIpBinding) -{ - // Given a SomeIp binding - DummyInstanceIdentifierBuilder instance_identifier_builder{}; - auto identifier = instance_identifier_builder.CreateSomeIpBindingInstanceIdentifier(); - auto handle = make_HandleType(identifier, ServiceInstanceId{LolaServiceInstanceId{1}}); - - ON_CALL(service_discovery_mock_, StartFindService(_, EnrichedInstanceIdentifier{handle})) - .WillByDefault(Return(make_FindServiceHandle(10U))); - - // When creating a proxy with that - const auto result = ProxyBindingFactory::Create(handle); - - // Then a nullptr is returned - EXPECT_EQ(result, nullptr); -} - using ProxyBindingFactoryCreateDeathTest = ProxyBindingFactoryCreateFixture; TEST_F(ProxyBindingFactoryCreateDeathTest, MissingLoLaTypeDeployment) { diff --git a/score/mw/com/impl/plumbing/proxy_event_field_binding_factory_test.cpp b/score/mw/com/impl/plumbing/proxy_event_field_binding_factory_test.cpp index 465ff432f..5e61cec99 100644 --- a/score/mw/com/impl/plumbing/proxy_event_field_binding_factory_test.cpp +++ b/score/mw/com/impl/plumbing/proxy_event_field_binding_factory_test.cpp @@ -174,20 +174,6 @@ TEST_P(ProxyServiceElementBindingFactoryParamaterisedFixture, CanConstructProxyS ASSERT_NE(proxy_event, nullptr); } -TEST_P(ProxyServiceElementBindingFactoryParamaterisedFixture, CannotConstructEventFromSomeIpBinding) -{ - // Given a ProxyBase that contains a SomeIp binding - const auto instance_identifier = dummy_instance_identifier_builder_.CreateSomeIpBindingInstanceIdentifier(); - const auto handle = make_HandleType(instance_identifier, ServiceInstanceId{LolaServiceInstanceId{kInstanceId}}); - WithAProxyBaseWithValidBinding(handle); - - // When constructing a proxy service element - const auto unit = CreateServiceElementBinding(); - - // Then a nullptr is returned - EXPECT_EQ(unit, nullptr); -} - TEST_P(ProxyServiceElementBindingFactoryParamaterisedFixture, CannotCreateProxyServiceWhenProxyBindingIsNullptr) { // Given a ProxyBase that does not contain a valid binding i.e. the binding is a nullptr diff --git a/score/mw/com/impl/plumbing/proxy_method_binding_factory_test.cpp b/score/mw/com/impl/plumbing/proxy_method_binding_factory_test.cpp index 5abbf7cec..a4a7eaa6c 100644 --- a/score/mw/com/impl/plumbing/proxy_method_binding_factory_test.cpp +++ b/score/mw/com/impl/plumbing/proxy_method_binding_factory_test.cpp @@ -87,11 +87,6 @@ class ProxyMethodFactoryFixture : public lola::ProxyMockedMemoryFixture return kConfigStoreAsilB.GetHandle(); } - HandleType GetValidSomIpHandle() - { - const auto instance_identifier = dummy_instance_identifier_builder_.CreateSomeIpBindingInstanceIdentifier(); - return make_HandleType(instance_identifier, ServiceInstanceId{LolaServiceInstanceId{kInstanceId}}); - } HandleType GetBlankBindingHandle() { const auto instance_identifier = dummy_instance_identifier_builder_.CreateBlankBindingInstanceIdentifier(); @@ -155,23 +150,6 @@ TYPED_TEST(ProxyMethodFactoryTypedFixture, CannotCreateProxyServiceWhenProxyBind ASSERT_EQ(proxy_method, nullptr); } -TYPED_TEST(ProxyMethodFactoryTypedFixture, CannotConstructEventFromSomeIpBinding) -{ - - const auto handle = this->GetValidSomIpHandle(); - - // Given a valid someip binding - auto proxy_binding = this->CreateBindingFromHandle(handle); - - // When creating a ProxyMethod using MethodBindingFactory - using MethodSignature = TypeParam; - auto proxy_method = ProxyMethodBindingFactory::Create( - handle, proxy_binding, kDummyMethodName, MethodType::kMethod); - - // Then a nullptr is returned - EXPECT_EQ(proxy_method, nullptr); -} - TYPED_TEST(ProxyMethodFactoryTypedFixture, CannotConstructEventFromBlankBinding) { const auto handle = this->GetBlankBindingHandle(); diff --git a/score/mw/com/impl/plumbing/skeleton_binding_factory_impl.cpp b/score/mw/com/impl/plumbing/skeleton_binding_factory_impl.cpp index b1f49b3d6..c21d5cd8e 100644 --- a/score/mw/com/impl/plumbing/skeleton_binding_factory_impl.cpp +++ b/score/mw/com/impl/plumbing/skeleton_binding_factory_impl.cpp @@ -69,13 +69,6 @@ auto SkeletonBindingFactoryImpl::Create(const InstanceIdentifier& identifier) no return lola::Skeleton::Create( identifier, filesystem, std::move(shm_path_builder), std::move(partial_restart_path_builder)); }, - [](const SomeIpServiceInstanceDeployment&) noexcept -> std::unique_ptr { - return nullptr; /* not yet implemented */ - }, - // Suppress "AUTOSAR C++14 A7-1-7" rule finding. This rule states: "Each - // expression statement and identifier declaration shall be placed on a - // separate line.". Following line statement is fine, this happens due to - // clang formatting. // coverity[autosar_cpp14_a7_1_7_violation] [](const score::cpp::blank&) noexcept -> std::unique_ptr { return nullptr; diff --git a/score/mw/com/impl/plumbing/skeleton_binding_factory_test.cpp b/score/mw/com/impl/plumbing/skeleton_binding_factory_test.cpp index 12a66deb8..5dc9372cd 100644 --- a/score/mw/com/impl/plumbing/skeleton_binding_factory_test.cpp +++ b/score/mw/com/impl/plumbing/skeleton_binding_factory_test.cpp @@ -49,13 +49,13 @@ TEST_F(SkeletonBindingFactoryFixture, CanCreateLoLaBinding) TEST_F(SkeletonBindingFactoryFixture, CanNotCreateOtherBinding) { - // Given an InstanceIdentifier with a SomeIp binding - auto instance_id = instance_identifier_builder_.CreateSomeIpBindingInstanceIdentifier(); + // Given an InstanceIdentifier with a blank binding + auto instance_id = instance_identifier_builder_.CreateBlankBindingInstanceIdentifier(); // When creating the binding auto unit = SkeletonBindingFactory::Create(instance_id); - // That it is not null and a LoLa Skeleton + // That it is null EXPECT_EQ(unit, nullptr); } diff --git a/score/mw/com/impl/plumbing/skeleton_method_binding_factory_impl.cpp b/score/mw/com/impl/plumbing/skeleton_method_binding_factory_impl.cpp index 7eb58acb9..badaa7308 100644 --- a/score/mw/com/impl/plumbing/skeleton_method_binding_factory_impl.cpp +++ b/score/mw/com/impl/plumbing/skeleton_method_binding_factory_impl.cpp @@ -65,20 +65,12 @@ auto SkeletonMethodBindingFactoryImpl::Create(const InstanceIdentifier& instance return std::make_unique(*lola_parent, unique_method_identifier); }; - auto deployment_info_visitor = score::cpp::overload( - lola_deployment_handler, - [](const score::cpp::blank&) noexcept -> LambdaReturnType { - // coverage false positive. Covered by the test: - // SkeletonMethodFactoryFixture.CannotConstructEventFromSomeIpBinding - // inside score/mw/com/impl/plumbing/skeleton_method_binding_factory_test.cpp - // LCOV_EXCL_BR_LINE (false positive. See justification above). - return nullptr; - }, - [](const SomeIpServiceInstanceDeployment&) noexcept -> LambdaReturnType { + auto deployment_info_visitor = + score::cpp::overload(lola_deployment_handler, [](const score::cpp::blank&) noexcept -> LambdaReturnType { // coverage false positive. Covered by the test: // SkeletonMethodFactoryFixture.CannotConstructEventFromBlankBinding // inside score/mw/com/impl/plumbing/skeleton_method_binding_factory_test.cpp - // LCOV_EXCL_BR_LINE(false positive. See justification above). + // LCOV_EXCL_BR_LINE (false positive. See justification above). return nullptr; }); diff --git a/score/mw/com/impl/plumbing/skeleton_method_binding_factory_test.cpp b/score/mw/com/impl/plumbing/skeleton_method_binding_factory_test.cpp index b4cb0739b..1ba247fb3 100644 --- a/score/mw/com/impl/plumbing/skeleton_method_binding_factory_test.cpp +++ b/score/mw/com/impl/plumbing/skeleton_method_binding_factory_test.cpp @@ -61,11 +61,6 @@ class SkeletonMethodFactoryFixture : public lola::SkeletonMockedMemoryFixture return kConfigStoreAsilB.GetInstanceIdentifier(); } - InstanceIdentifier GetValidSomeIpInstanceIdentifier() - { - return dummy_instance_identifier_builder_.CreateSomeIpBindingInstanceIdentifier(); - } - InstanceIdentifier GetBlankBindingInstanceIdentifier() { return dummy_instance_identifier_builder_.CreateBlankBindingInstanceIdentifier(); @@ -113,21 +108,6 @@ TEST_F(SkeletonMethodFactoryFixture, CannotCreateSkeletonServiceWhenSkeletonBind ASSERT_EQ(skeleton_method, nullptr); } -TEST_F(SkeletonMethodFactoryFixture, CannotConstructEventFromSomeIpBinding) -{ - const auto instance_identifier = GetValidSomeIpInstanceIdentifier(); - - // Given a valid SomeIp binding - auto skeleton_binding = GetBindingFromInstanceIdentifier(instance_identifier); - - // When creating a SkeletonMethod using MethodBindingFactory - auto skeleton_method = SkeletonMethodBindingFactory::Create( - instance_identifier, skeleton_binding, kDummyMethodName, MethodType::kMethod); - - // Then a nullptr is returned - EXPECT_EQ(skeleton_method, nullptr); -} - TEST_F(SkeletonMethodFactoryFixture, CannotConstructEventFromBlankBinding) { const auto instance_identifier = GetBlankBindingInstanceIdentifier(); diff --git a/score/mw/com/impl/plumbing/skeleton_service_element_binding_factory_impl.h b/score/mw/com/impl/plumbing/skeleton_service_element_binding_factory_impl.h index 7614683b2..f3bc69910 100644 --- a/score/mw/com/impl/plumbing/skeleton_service_element_binding_factory_impl.h +++ b/score/mw/com/impl/plumbing/skeleton_service_element_binding_factory_impl.h @@ -19,7 +19,6 @@ #include "score/mw/com/impl/configuration/binding_service_type_deployment.h" #include "score/mw/com/impl/configuration/lola_service_instance_deployment.h" #include "score/mw/com/impl/configuration/service_instance_deployment.h" -#include "score/mw/com/impl/configuration/someip_service_instance_deployment.h" #include "score/mw/com/impl/data_type_meta_info.h" #include "score/mw/com/impl/skeleton_base.h" #include "score/mw/com/impl/tracing/skeleton_event_tracing_data.h" @@ -120,14 +119,6 @@ auto CreateSkeletonServiceElement(const InstanceIdentifier& identifier, return std::make_unique( *lola_parent, element_fq_id, service_element_name, skeleton_event_properties); }, - [](const SomeIpServiceInstanceDeployment&) noexcept -> ReturnType { - return nullptr; - }, - // Suppress "AUTOSAR C++14 A7-1-7" rule finding. This rule states: "Each - // expression statement and identifier declaration shall be placed on a - // separate line.". Following line statement is fine, this happens due to - // clang formatting. - // coverity[autosar_cpp14_a7_1_7_violation] [](const score::cpp::blank&) noexcept -> ReturnType { return nullptr; }); @@ -183,9 +174,6 @@ auto CreateGenericSkeletonServiceElement(const InstanceIdentifier& identifier, meta_info, tracing::SkeletonEventTracingData{}); }, - [](const SomeIpServiceInstanceDeployment&) noexcept -> ReturnType { - return nullptr; - }, [](const score::cpp::blank&) noexcept -> ReturnType { return nullptr; }); diff --git a/score/mw/com/impl/plumbing/skeleton_service_element_binding_factory_test.cpp b/score/mw/com/impl/plumbing/skeleton_service_element_binding_factory_test.cpp index 218192c5b..37207dd89 100644 --- a/score/mw/com/impl/plumbing/skeleton_service_element_binding_factory_test.cpp +++ b/score/mw/com/impl/plumbing/skeleton_service_element_binding_factory_test.cpp @@ -157,19 +157,6 @@ TEST_P(SkeletonServiceElementBindingFactoryParamaterisedFixture, CanConstructSer EXPECT_NE(unit, nullptr); } -TEST_P(SkeletonServiceElementBindingFactoryParamaterisedFixture, CannotConstructServiceElementFromSomeIpBinding) -{ - // Given a SkeletonBase that uses a someip binding - const auto instance_identifier = dummy_instance_identifier_builder.CreateSomeIpBindingInstanceIdentifier(); - WithASkeletonBaseWithValidBinding(instance_identifier); - - // When constructing a service element - const auto unit = CreateServiceElementBinding(instance_identifier); - - // Then a valid binding cannot be created - EXPECT_EQ(unit, nullptr); -} - TEST_P(SkeletonServiceElementBindingFactoryParamaterisedFixture, CannotConstructServiceElementFromBlankBinding) { // Given a SkeletonBase that uses a blank binding diff --git a/score/mw/com/impl/test/dummy_instance_identifier_builder.cpp b/score/mw/com/impl/test/dummy_instance_identifier_builder.cpp index 132f0fbdb..e649266a8 100644 --- a/score/mw/com/impl/test/dummy_instance_identifier_builder.cpp +++ b/score/mw/com/impl/test/dummy_instance_identifier_builder.cpp @@ -23,7 +23,6 @@ namespace score::mw::com::impl DummyInstanceIdentifierBuilder::DummyInstanceIdentifierBuilder() : service_instance_deployment_{}, - some_ip_service_instance_deployment_information_{}, service_type_deployment_{0x0}, type_deployment_{score::cpp::blank{}}, type_{make_ServiceIdentifierType("foo")}, @@ -109,11 +108,4 @@ InstanceIdentifier DummyInstanceIdentifierBuilder::CreateBlankBindingInstanceIde return make_InstanceIdentifier(*instance_deployment_, type_deployment_); } -InstanceIdentifier DummyInstanceIdentifierBuilder::CreateSomeIpBindingInstanceIdentifier() -{ - instance_deployment_ = std::make_unique( - type_, some_ip_service_instance_deployment_information_, QualityType::kASIL_QM, instance_specifier_); - return make_InstanceIdentifier(*instance_deployment_, type_deployment_); -} - } // namespace score::mw::com::impl diff --git a/score/mw/com/impl/test/dummy_instance_identifier_builder.h b/score/mw/com/impl/test/dummy_instance_identifier_builder.h index 707e9cdac..5a7c3fba6 100644 --- a/score/mw/com/impl/test/dummy_instance_identifier_builder.h +++ b/score/mw/com/impl/test/dummy_instance_identifier_builder.h @@ -18,7 +18,6 @@ #include "score/mw/com/impl/configuration/service_identifier_type.h" #include "score/mw/com/impl/configuration/service_instance_deployment.h" #include "score/mw/com/impl/configuration/service_type_deployment.h" -#include "score/mw/com/impl/configuration/someip_service_instance_deployment.h" #include "score/mw/com/impl/instance_identifier.h" #include "score/mw/com/impl/instance_specifier.h" @@ -42,11 +41,9 @@ class DummyInstanceIdentifierBuilder InstanceIdentifier CreateLolaInstanceIdentifierWithoutInstanceId(); InstanceIdentifier CreateLolaInstanceIdentifierWithoutTypeDeployment(); InstanceIdentifier CreateBlankBindingInstanceIdentifier(); - InstanceIdentifier CreateSomeIpBindingInstanceIdentifier(); private: LolaServiceInstanceDeployment service_instance_deployment_; - SomeIpServiceInstanceDeployment some_ip_service_instance_deployment_information_; LolaServiceTypeDeployment service_type_deployment_; ServiceTypeDeployment type_deployment_; From 4a167103092e2b311609d9095223032b06bd6a6b Mon Sep 17 00:00:00 2001 From: Sahithi Nukala Date: Mon, 11 May 2026 15:15:29 +0200 Subject: [PATCH 4/4] mw/com: Update documentation to remove SOME/IP references - Remove SOME/IP from supported bindings lists in README files - Update example configurations to use SHM-only binding - Remove SomeIpServiceInstanceDeployment from structural_view.puml --- score/mw/com/design/configuration/README.md | 35 +++++-------------- .../design/configuration/structural_view.puml | 8 +---- score/mw/com/impl/configuration/README.md | 3 +- 3 files changed, 10 insertions(+), 36 deletions(-) diff --git a/score/mw/com/design/configuration/README.md b/score/mw/com/design/configuration/README.md index 1187bb6f2..17bcf1217 100644 --- a/score/mw/com/design/configuration/README.md +++ b/score/mw/com/design/configuration/README.md @@ -2,8 +2,7 @@ The main configuration items we have to deal with in `mw::com` are mappings from "logical" service instances to real existing service instances with their concrete used technical binding. -Currently, we prepare our configuration to support the following technical bindings: -- SOME/IP +Currently, our configuration supports the following technical bindings: - Shared Memory IPC Of course, we do foresee arbitrary extensions. @@ -36,13 +35,12 @@ The `ServiceTypeDeployment` aka `Service Interface Deployment` in AUTOSAR speech The binding independent `ServiceType` is defined within AUTOSAR metamodel by its Service Interface and its corresponding [service type identification](#service-type-identification). So within the configuration we might need to express, how a certain abstract `ServiceType` shall be represented in a -`SOME/IP` or a `LoLa` binding. For instance, both bindings might use their own, distinct service ID -for identification and also the embedded service parts (events, fields, methods) might have different identification and -properties between a `SOME/IP` and a `LoLa` binding. +`LoLa` binding. For instance, the binding uses its own distinct service ID +for identification and also configuration of the embedded service parts (events, fields, methods). Note here, that these `ServiceTypeDeployment`s are independent of their concrete instances! E.g. an AUTOSAR service -`/a/b/c/InterfaceName` will be once mapped to a `SOME/IP` service id **_SIDn_** and this applies then to ALL instances of -this `/a/b/c/InterfaceName` service with a `SOME/IP` mapping! +`/a/b/c/InterfaceName` will be once mapped to a `LoLa` service id **_SIDn_** and this applies then to ALL instances of +this `/a/b/c/InterfaceName` service with a `LoLa` mapping! ### `ServiceInstanceDeployment` The `ServiceInstanceDeployment` maps concrete instances (identified by an [Instance Specifier](#instance-specifiers)) of @@ -69,8 +67,7 @@ config artifacts with the applications. For `ServiceTypeDeployment` this is not so clear. In case of `ServiceTypeDeployments` for local only communication, which is the case of our `LoLa` binding, it is also the job of the ECU integrator, as it is only a local ECU -optimization. Without any effect to the boardnet. In case of `SOME/IP` `ServiceTypeDeployments`, it might be expected -for the future, that parts of `ServiceTypeDeployment` come from central toolchains (Symphony). +optimization. Without any effect to the boardnet. ## Instance Specifiers @@ -120,17 +117,6 @@ An example of such a mapping is shown here: "minor": 34 }, "bindings": [ - { - "binding": "SOME/IP", - "serviceId": 1234, - "events": [ - { - "eventName": "CurrentPressureFrontLeft", - "eventId": 633 - } - ], - "fields": [] - }, { "binding": "SHM", "serviceId": 1234, @@ -150,11 +136,6 @@ An example of such a mapping is shown here: "instanceSpecifier": "abc/abc/TirePressurePort", "serviceTypeName": "/score/ncar/services/TirePressureService", "instances": [ - { - "instanceId": 1234, - "asil-level": "QM", - "binding": "SOME/IP" - }, { "instanceId": 62, "asil-level": "ASIL-B", @@ -184,8 +165,8 @@ instances. What is **not** visible here: Whether `"abc/abc/TirePressurePort"` is a provided or required service instance. Both could be possible, since we do support 1 to n mappings in both cases. Here we have a mapping of `"abc/abc/TirePressurePort"` to two different concrete technical instances: The first one is a -SOME/IP based instance (so it is most likely used for inter ECU, network communication) and the second is a concrete -instance based on our shared memory IPC for ECU local communication. +hypothetical SOME/IP based instance (so it is most likely used for inter-ECU network communication) and the second is a +concrete instance based on our shared-memory IPC for ECU-local communication. #### C++ representation of configuration and mappings The JSON representation of the configuration shown above gets read and parsed at application startup within call to one diff --git a/score/mw/com/design/configuration/structural_view.puml b/score/mw/com/design/configuration/structural_view.puml index 9579a38cd..f2f7a21bb 100644 --- a/score/mw/com/design/configuration/structural_view.puml +++ b/score/mw/com/design/configuration/structural_view.puml @@ -26,11 +26,6 @@ package "configuration" { + ToString() : std::string const& } - class "score::mw::com::impl::SomeIpServiceInstanceDeployment" { - + instanceId: score::cpp::optional const - + ToString() const : std::string - } - class "score::mw::com::impl::LolaServiceInstanceDeployment" { + events : std::unordered_map const + fields : std::unordered_map const @@ -47,7 +42,7 @@ package "configuration" { class "score::mw::com::impl::ServiceInstanceDeployment" { + service: ServiceIdentifierType + asilLevel: QualityType - + bindingInfo_ : std::variant const + + bindingInfo_ : std::variant const + ServiceInstanceDeployment(service : ServiceIdentifierType const, binding : BindingInformation, asil_level: QualityType const) + ToString() : std::string const } @@ -224,7 +219,6 @@ class "score::mw::com::impl::Runtime" { "score::mw::com::impl::ServiceInstanceDeployment" *-- "QualityType" "score::mw::com::impl::ServiceInstanceDeployment" *-- "score::mw::com::ServiceIdentifierType" "score::mw::com::impl::ServiceInstanceDeployment" *-- "score::mw::com::impl::LolaServiceInstanceDeployment" -"score::mw::com::impl::ServiceInstanceDeployment" *-- "score::mw::com::impl::SomeIpServiceInstanceDeployment" "score::mw::com::impl::LolaServiceInstanceDeployment" *-- "score::mw::com::impl::LolaEventInstanceDeployment" : 0..1 "score::mw::com::impl::LolaServiceInstanceDeployment" *-- "score::mw::com::impl::LolaFieldInstanceDeployment" : 0..1 "score::mw::com::impl::LolaServiceInstanceDeployment" *-- "score::mw::com::impl::LolaMethodInstanceDeployment" : 0..1 diff --git a/score/mw/com/impl/configuration/README.md b/score/mw/com/impl/configuration/README.md index efe772ca0..6162e3d77 100644 --- a/score/mw/com/impl/configuration/README.md +++ b/score/mw/com/impl/configuration/README.md @@ -88,14 +88,13 @@ exist, but has no functional effect yet! Our `mw::com` architecture foresees, that a `service-type` might be provided via several technical transport mechanisms, which we call a `binding`. The decision, which technical transport mechanisms to be used is finally taken by the `service-instances`. I.e. a `service-instance` might be configured to support an ECU local -transport mechanism, like our shared-memory based mechanism, and also a network based mechanism (like `SOME/IP`) to +transport mechanism, like our shared-memory based mechanism, and also a network based mechanism to support cross-ECU communication. However, the `service-type` on which the `service-instance` is based on, needs to support the technical transport mechanism (`binding`) and needs to configure the instance `independent` parts of the binding. Currently, the only supported binding is the shared-memory binding, which is represented as `SHM` in the json. -The other binding `SOME/IP`, which the schema allows, is only a placeholder right now. In the corresponding snippet from our example configuration: "bindings": [