MCTPReactor: Update MCTP D-Bus APIs

The MCTP D-Bus APIs are changed as
[1] https://codeconstruct.com.au/docs/mctp-utils-v2-0-release/
The `MCTPReactor` should be updated to use new APIs.

Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: Ie2fdd9cadb61f4a2716080d8af1bdb21b9d9ad7c
diff --git a/src/mctp/MCTPEndpoint.cpp b/src/mctp/MCTPEndpoint.cpp
index a8fcc91..870e708 100644
--- a/src/mctp/MCTPEndpoint.cpp
+++ b/src/mctp/MCTPEndpoint.cpp
@@ -34,12 +34,12 @@
 
 PHOSPHOR_LOG2_USING;
 
-static constexpr const char* mctpdBusName = "xyz.openbmc_project.MCTP";
-static constexpr const char* mctpdControlPath = "/xyz/openbmc_project/mctp";
+static constexpr const char* mctpdBusName = "au.com.codeconstruct.MCTP1";
+static constexpr const char* mctpdControlPath = "/au/com/codeconstruct/mctp1";
 static constexpr const char* mctpdControlInterface =
-    "au.com.CodeConstruct.MCTP";
+    "au.com.codeconstruct.MCTP.BusOwner1";
 static constexpr const char* mctpdEndpointControlInterface =
-    "au.com.CodeConstruct.MCTP.Endpoint";
+    "au.com.codeconstruct.MCTP.Endpoint1";
 
 MCTPDDevice::MCTPDDevice(
     const std::shared_ptr<sdbusplus::asio::connection>& connection,
@@ -116,9 +116,10 @@
                 "INVENTORY_PATH", objpath);
         }
     };
-    connection->async_method_call(onSetup, mctpdBusName, mctpdControlPath,
-                                  mctpdControlInterface, "AssignEndpoint",
-                                  interface, physaddr);
+    connection->async_method_call(
+        onSetup, mctpdBusName,
+        mctpdControlPath + std::string("/interfaces/") + interface,
+        mctpdControlInterface, "AssignEndpoint", physaddr);
 }
 
 void MCTPDDevice::endpointRemoved()
@@ -161,8 +162,8 @@
 
 std::string MCTPDEndpoint::path(const std::shared_ptr<MCTPEndpoint>& ep)
 {
-    return std::format("/xyz/openbmc_project/mctp/{}/{}", ep->network(),
-                       ep->eid());
+    return std::format("{}/networks/{}/endpoints/{}", mctpdControlPath,
+                       ep->network(), ep->eid());
 }
 
 void MCTPDEndpoint::onMctpEndpointChange(sdbusplus::message_t& msg)
diff --git a/src/mctp/MCTPEndpoint.hpp b/src/mctp/MCTPEndpoint.hpp
index 02322d1..f1b2198 100644
--- a/src/mctp/MCTPEndpoint.hpp
+++ b/src/mctp/MCTPEndpoint.hpp
@@ -52,7 +52,7 @@
 /**
  * @brief Captures properties of MCTP interfaces.
  *
- * https://github.com/CodeConstruct/mctp/blob/v1.1/src/mctp.c#L672-L703
+ * https://github.com/CodeConstruct/mctp/blob/v2.0/src/mctp.c#L668-L699
  */
 struct MCTPInterface
 {
diff --git a/src/mctp/MCTPReactor.cpp b/src/mctp/MCTPReactor.cpp
index 9d32682..1f322a8 100644
--- a/src/mctp/MCTPReactor.cpp
+++ b/src/mctp/MCTPReactor.cpp
@@ -72,7 +72,7 @@
     //
     // clang-format off
     // ```
-    // # busctl call xyz.openbmc_project.ObjectMapper /xyz/openbmc_project/object_mapper xyz.openbmc_project.ObjectMapper GetAssociatedSubTree ooias /xyz/openbmc_project/mctp/1/9/configured_by / 0 1 xyz.openbmc_project.Configuration.MCTPDevice
+    // # busctl call xyz.openbmc_project.ObjectMapper /xyz/openbmc_project/object_mapper xyz.openbmc_project.ObjectMapper GetAssociatedSubTree ooias /au/com/codeconstruct/mctp1/networks/1/endpoints/9/configured_by / 0 1 xyz.openbmc_project.Configuration.MCTPDevice
     // a{sa{sas}} 1 "/xyz/openbmc_project/inventory/system/nvme/NVMe_1/NVMe_1_Temp" 1 "xyz.openbmc_project.EntityManager" 1 "xyz.openbmc_project.Configuration.MCTPDevice"
     // ```
     // clang-format on
diff --git a/src/mctp/MCTPReactorMain.cpp b/src/mctp/MCTPReactorMain.cpp
index 9abc0fc..5d453d2 100644
--- a/src/mctp/MCTPReactorMain.cpp
+++ b/src/mctp/MCTPReactorMain.cpp
@@ -37,7 +37,7 @@
         const std::shared_ptr<sdbusplus::asio::connection>& connection) :
         server(connection)
     {
-        server.add_manager("/xyz/openbmc_project/mctp");
+        server.add_manager("/au/com/codeconstruct/mctp1");
     }
     ~DBusAssociationServer() override = default;
     DBusAssociationServer& operator=(const DBusAssociationServer&) = delete;
@@ -211,7 +211,7 @@
         std::bind_front(exitReactor, &io));
 
     const std::string mctpdNameLostSpec =
-        rules::nameOwnerChanged("xyz.openbmc_project.MCTP");
+        rules::nameOwnerChanged("au.com.codeconstruct.MCTP1");
 
     auto mctpdNameLostMatch = sdbusplus::bus::match_t(
         static_cast<sdbusplus::bus_t&>(*systemBus), mctpdNameLostSpec,
diff --git a/src/tests/test_MCTPReactor.cpp b/src/tests/test_MCTPReactor.cpp
index abdd9e9..0e6971f 100644
--- a/src/tests/test_MCTPReactor.cpp
+++ b/src/tests/test_MCTPReactor.cpp
@@ -108,9 +108,12 @@
 
     std::vector<Association> requiredAssociation{
         {"configured_by", "configures", "/test"}};
-    EXPECT_CALL(assoc, associate("/xyz/openbmc_project/mctp/1/9",
-                                 requiredAssociation));
-    EXPECT_CALL(assoc, disassociate("/xyz/openbmc_project/mctp/1/9"));
+    EXPECT_CALL(assoc,
+                associate("/au/com/codeconstruct/mctp1/networks/1/endpoints/9",
+                          requiredAssociation));
+    EXPECT_CALL(
+        assoc,
+        disassociate("/au/com/codeconstruct/mctp1/networks/1/endpoints/9"));
 
     EXPECT_CALL(*endpoint, remove()).WillOnce(testing::Invoke([&]() {
         removeHandler(endpoint);
@@ -134,9 +137,12 @@
 
     std::vector<Association> requiredAssociation{
         {"configured_by", "configures", "/test"}};
-    EXPECT_CALL(assoc, associate("/xyz/openbmc_project/mctp/1/9",
-                                 requiredAssociation));
-    EXPECT_CALL(assoc, disassociate("/xyz/openbmc_project/mctp/1/9"));
+    EXPECT_CALL(assoc,
+                associate("/au/com/codeconstruct/mctp1/networks/1/endpoints/9",
+                          requiredAssociation));
+    EXPECT_CALL(
+        assoc,
+        disassociate("/au/com/codeconstruct/mctp1/networks/1/endpoints/9"));
 
     EXPECT_CALL(*endpoint, remove()).WillOnce(testing::Invoke([&]() {
         removeHandler(endpoint);
@@ -164,9 +170,13 @@
     std::vector<Association> requiredAssociation{
         {"configured_by", "configures", "/test"}};
     EXPECT_CALL(assoc,
-                associate("/xyz/openbmc_project/mctp/1/9", requiredAssociation))
+                associate("/au/com/codeconstruct/mctp1/networks/1/endpoints/9",
+                          requiredAssociation))
         .Times(2);
-    EXPECT_CALL(assoc, disassociate("/xyz/openbmc_project/mctp/1/9")).Times(2);
+    EXPECT_CALL(
+        assoc,
+        disassociate("/au/com/codeconstruct/mctp1/networks/1/endpoints/9"))
+        .Times(2);
 
     EXPECT_CALL(*endpoint, remove()).WillOnce(testing::Invoke([&]() {
         removeHandler(endpoint);
@@ -199,9 +209,13 @@
         {"configured_by", "configures", "/test"}};
 
     EXPECT_CALL(assoc,
-                associate("/xyz/openbmc_project/mctp/1/9", requiredAssociation))
+                associate("/au/com/codeconstruct/mctp1/networks/1/endpoints/9",
+                          requiredAssociation))
         .Times(2);
-    EXPECT_CALL(assoc, disassociate("/xyz/openbmc_project/mctp/1/9")).Times(2);
+    EXPECT_CALL(
+        assoc,
+        disassociate("/au/com/codeconstruct/mctp1/networks/1/endpoints/9"))
+        .Times(2);
 
     auto endpoint = std::make_shared<MockMCTPEndpoint>();
     EXPECT_CALL(*endpoint, describe())