Changes to CommandDataIB to reflect 1.3 spec (#30522)

* Changes to CommandDataIB to reflect 1.3 spec

* Fix CI
diff --git a/src/app/MessageDef/CommandDataIB.cpp b/src/app/MessageDef/CommandDataIB.cpp
index 4222c4d..ea9bc33 100644
--- a/src/app/MessageDef/CommandDataIB.cpp
+++ b/src/app/MessageDef/CommandDataIB.cpp
@@ -64,6 +64,14 @@
             ReturnErrorOnFailure(CheckIMPayload(reader, 0, "CommandFields"));
             PRETTY_PRINT_DECDEPTH();
             break;
+        case to_underlying(Tag::kRef):
+            VerifyOrReturnError(TLV::kTLVType_UnsignedInteger == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE);
+            {
+                uint16_t reference;
+                ReturnErrorOnFailure(reader.Get(reference));
+                PRETTY_PRINT("\tRef = 0x%x,", reference);
+            }
+            break;
         default:
             PRETTY_PRINT("Unknown tag num %" PRIu32, tagNum);
             break;
@@ -96,12 +104,22 @@
     return CHIP_NO_ERROR;
 }
 
+CHIP_ERROR CommandDataIB::Parser::GetRef(uint16_t * const apRef) const
+{
+    return GetUnsignedInteger(to_underlying(Tag::kRef), apRef);
+}
+
 CommandPathIB::Builder & CommandDataIB::Builder::CreatePath()
 {
     mError = mPath.Init(mpWriter, to_underlying(Tag::kPath));
     return mPath;
 }
 
+CHIP_ERROR CommandDataIB::Builder::Ref(const uint16_t aRef)
+{
+    return mpWriter->Put(TLV::ContextTag(Tag::kRef), aRef);
+}
+
 CHIP_ERROR CommandDataIB::Builder::EndOfCommandDataIB()
 {
     EndOfContainer();
diff --git a/src/app/MessageDef/CommandDataIB.h b/src/app/MessageDef/CommandDataIB.h
index c3cce65..a9b3d27 100644
--- a/src/app/MessageDef/CommandDataIB.h
+++ b/src/app/MessageDef/CommandDataIB.h
@@ -37,6 +37,7 @@
 {
     kPath   = 0,
     kFields = 1,
+    kRef    = 2,
 };
 
 class Parser : public StructParser
@@ -66,6 +67,17 @@
      *          #CHIP_END_OF_TLV if there is no such element
      */
     CHIP_ERROR GetFields(TLV::TLVReader * const apReader) const;
+
+    /**
+     *  @brief Get the provided command reference associated with the CommandData
+     *
+     *  @param [in] apRef    A pointer to apRef
+     *
+     *  @return #CHIP_NO_ERROR on success
+     *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not any of the defined unsigned integer types
+     *          #CHIP_END_OF_TLV if there is no such element
+     */
+    CHIP_ERROR GetRef(uint16_t * const apRef) const;
 };
 
 class Builder : public StructBuilder
@@ -79,6 +91,16 @@
     CommandPathIB::Builder & CreatePath();
 
     /**
+     *  @brief Inject Command Ref into the TLV stream.
+     *
+     *  @param [in] aRef refer to the CommandRef to set in CommandDataIB.
+     *
+     *  TODO What are some more errors
+     *  @return #CHIP_NO_ERROR on success
+     */
+    CHIP_ERROR Ref(const uint16_t aRef);
+
+    /**
      *  @brief Mark the end of this CommandDataIB
      *
      *  @return The builder's final status.