Skip to content

Commit

Permalink
Update operational credentials clusters for AddNOC command and respon…
Browse files Browse the repository at this point in the history
…se (#8334)

* Update operational credentials clusters for AddNOC command and response

* regen updated cluster code

* update op creds cluster code

* address review comments

* fix compilation error

* address comments
  • Loading branch information
pan-apple authored and pull[bot] committed Aug 20, 2021
1 parent 4d8e8b9 commit 3426840
Show file tree
Hide file tree
Showing 57 changed files with 542 additions and 386 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3240,7 +3240,7 @@
"outgoing": 0
},
{
"name": "AddOpCert",
"name": "AddNOC",
"code": 6,
"mfgCode": null,
"source": "client",
Expand Down Expand Up @@ -3331,7 +3331,7 @@
"outgoing": 1
},
{
"name": "OpCertResponse",
"name": "NOCResponse",
"code": 8,
"mfgCode": null,
"source": "server",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5901,7 +5901,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
{
switch (aCommandId)
{
case Clusters::OperationalCredentials::Commands::Ids::AddOpCert: {
case Clusters::OperationalCredentials::Commands::Ids::AddNOC: {
expectArgumentCount = 4;
chip::ByteSpan NOCArray;
chip::ByteSpan IPKValue;
Expand Down Expand Up @@ -5973,8 +5973,8 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman

if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfOperationalCredentialsClusterAddOpCertCallback(aEndpointId, apCommandObj, NOCArray, IPKValue,
CaseAdminNode, AdminVendorId);
wasHandled = emberAfOperationalCredentialsClusterAddNOCCallback(aEndpointId, apCommandObj, NOCArray, IPKValue,
CaseAdminNode, AdminVendorId);
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2832,8 +2832,8 @@
{ 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* SetFabricResponse */ \
{ 0x003E, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* OpCSRRequest */ \
{ 0x003E, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCSRResponse */ \
{ 0x003E, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddOpCert */ \
{ 0x003E, 0x08, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCertResponse */ \
{ 0x003E, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddNOC */ \
{ 0x003E, 0x08, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* NOCResponse */ \
{ 0x003E, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateFabricLabel */ \
{ 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \
{ 0x003E, 0x0B, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveAllFabrics */ \
Expand Down
4 changes: 2 additions & 2 deletions examples/bridge-app/bridge-common/bridge-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,7 @@
"outgoing": 1
},
{
"name": "AddOpCert",
"name": "AddNOC",
"code": 6,
"mfgCode": null,
"source": "client",
Expand Down Expand Up @@ -2201,7 +2201,7 @@
"outgoing": 1
},
{
"name": "OpCertResponse",
"name": "NOCResponse",
"code": 8,
"mfgCode": null,
"source": "server",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
{
switch (aCommandId)
{
case Clusters::OperationalCredentials::Commands::Ids::AddOpCert: {
case Clusters::OperationalCredentials::Commands::Ids::AddNOC: {
expectArgumentCount = 4;
chip::ByteSpan NOCArray;
chip::ByteSpan IPKValue;
Expand Down Expand Up @@ -1741,8 +1741,8 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman

if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfOperationalCredentialsClusterAddOpCertCallback(aEndpointId, apCommandObj, NOCArray, IPKValue,
CaseAdminNode, AdminVendorId);
wasHandled = emberAfOperationalCredentialsClusterAddNOCCallback(aEndpointId, apCommandObj, NOCArray, IPKValue,
CaseAdminNode, AdminVendorId);
}
break;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/bridge-app/bridge-common/gen/endpoint_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,8 @@
{ 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* SetFabricResponse */ \
{ 0x003E, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* OpCSRRequest */ \
{ 0x003E, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCSRResponse */ \
{ 0x003E, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddOpCert */ \
{ 0x003E, 0x08, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCertResponse */ \
{ 0x003E, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddNOC */ \
{ 0x003E, 0x08, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* NOCResponse */ \
{ 0x003E, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateFabricLabel */ \
{ 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \
{ 0x003E, 0x0B, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveAllFabrics */ \
Expand Down
61 changes: 33 additions & 28 deletions examples/chip-tool/commands/clusters/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -588,20 +588,20 @@ static void OnOtaSoftwareUpdateProviderClusterQueryImageResponse(void * context,
command->SetCommandExitStatus(CHIP_NO_ERROR);
}

static void OnOperationalCredentialsClusterOpCSRResponse(void * context, chip::ByteSpan CSR, chip::ByteSpan CSRNonce,
chip::ByteSpan VendorReserved1, chip::ByteSpan VendorReserved2,
chip::ByteSpan VendorReserved3, chip::ByteSpan Signature)
static void OnOperationalCredentialsClusterNOCResponse(void * context, uint8_t StatusCode, uint8_t FabricIndex,
chip::ByteSpan DebugText)
{
ChipLogProgress(chipTool, "OperationalCredentialsClusterOpCSRResponse");
ChipLogProgress(chipTool, "OperationalCredentialsClusterNOCResponse");

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(CHIP_NO_ERROR);
}

static void OnOperationalCredentialsClusterOpCertResponse(void * context, uint8_t StatusCode, uint64_t FabricIndex,
uint8_t * DebugText)
static void OnOperationalCredentialsClusterOpCSRResponse(void * context, chip::ByteSpan CSR, chip::ByteSpan CSRNonce,
chip::ByteSpan VendorReserved1, chip::ByteSpan VendorReserved2,
chip::ByteSpan VendorReserved3, chip::ByteSpan Signature)
{
ChipLogProgress(chipTool, "OperationalCredentialsClusterOpCertResponse");
ChipLogProgress(chipTool, "OperationalCredentialsClusterOpCSRResponse");

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(CHIP_NO_ERROR);
Expand Down Expand Up @@ -14251,7 +14251,7 @@ class ReadOnOffClusterRevision : public ModelCommand
| Cluster OperationalCredentials | 0x003E |
|------------------------------------------------------------------------------|
| Commands: | |
| * AddOpCert | 0x06 |
| * AddNOC | 0x06 |
| * AddTrustedRootCertificate | 0xA1 |
| * OpCSRRequest | 0x04 |
| * RemoveAllFabrics | 0x0B |
Expand All @@ -14266,20 +14266,20 @@ class ReadOnOffClusterRevision : public ModelCommand
\*----------------------------------------------------------------------------*/

/*
* Command AddOpCert
* Command AddNOC
*/
class OperationalCredentialsAddOpCert : public ModelCommand
class OperationalCredentialsAddNOC : public ModelCommand
{
public:
OperationalCredentialsAddOpCert() : ModelCommand("add-op-cert")
OperationalCredentialsAddNOC() : ModelCommand("add-noc")
{
AddArgument("NOCArray", &mNOCArray);
AddArgument("IPKValue", &mIPKValue);
AddArgument("CaseAdminNode", 0, UINT64_MAX, &mCaseAdminNode);
AddArgument("AdminVendorId", 0, UINT16_MAX, &mAdminVendorId);
ModelCommand::AddArguments();
}
~OperationalCredentialsAddOpCert()
~OperationalCredentialsAddNOC()
{
delete onSuccessCallback;
delete onFailureCallback;
Expand All @@ -14291,14 +14291,14 @@ class OperationalCredentialsAddOpCert : public ModelCommand

chip::Controller::OperationalCredentialsCluster cluster;
cluster.Associate(device, endpointId);
return cluster.AddOpCert(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mNOCArray, mIPKValue, mCaseAdminNode,
mAdminVendorId);
return cluster.AddNOC(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mNOCArray, mIPKValue, mCaseAdminNode,
mAdminVendorId);
}

private:
chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback> * onSuccessCallback =
new chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback>(
OnOperationalCredentialsClusterOpCertResponse, this);
chip::Callback::Callback<OperationalCredentialsClusterNOCResponseCallback> * onSuccessCallback =
new chip::Callback::Callback<OperationalCredentialsClusterNOCResponseCallback>(OnOperationalCredentialsClusterNOCResponse,
this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
chip::ByteSpan mNOCArray;
Expand Down Expand Up @@ -14434,9 +14434,9 @@ class OperationalCredentialsRemoveFabric : public ModelCommand
}

private:
chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback> * onSuccessCallback =
new chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback>(
OnOperationalCredentialsClusterOpCertResponse, this);
chip::Callback::Callback<OperationalCredentialsClusterNOCResponseCallback> * onSuccessCallback =
new chip::Callback::Callback<OperationalCredentialsClusterNOCResponseCallback>(OnOperationalCredentialsClusterNOCResponse,
this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
chip::FabricId mFabricId;
Expand Down Expand Up @@ -14542,9 +14542,9 @@ class OperationalCredentialsUpdateFabricLabel : public ModelCommand
}

private:
chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback> * onSuccessCallback =
new chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback>(
OnOperationalCredentialsClusterOpCertResponse, this);
chip::Callback::Callback<OperationalCredentialsClusterNOCResponseCallback> * onSuccessCallback =
new chip::Callback::Callback<OperationalCredentialsClusterNOCResponseCallback>(OnOperationalCredentialsClusterNOCResponse,
this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
char * mLabel;
Expand Down Expand Up @@ -23958,11 +23958,16 @@ void registerClusterOperationalCredentials(Commands & commands)
const char * clusterName = "OperationalCredentials";

commands_list clusterCommands = {
make_unique<OperationalCredentialsAddOpCert>(), make_unique<OperationalCredentialsAddTrustedRootCertificate>(),
make_unique<OperationalCredentialsOpCSRRequest>(), make_unique<OperationalCredentialsRemoveAllFabrics>(),
make_unique<OperationalCredentialsRemoveFabric>(), make_unique<OperationalCredentialsRemoveTrustedRootCertificate>(),
make_unique<OperationalCredentialsSetFabric>(), make_unique<OperationalCredentialsUpdateFabricLabel>(),
make_unique<DiscoverOperationalCredentialsAttributes>(), make_unique<ReadOperationalCredentialsFabricsList>(),
make_unique<OperationalCredentialsAddNOC>(),
make_unique<OperationalCredentialsAddTrustedRootCertificate>(),
make_unique<OperationalCredentialsOpCSRRequest>(),
make_unique<OperationalCredentialsRemoveAllFabrics>(),
make_unique<OperationalCredentialsRemoveFabric>(),
make_unique<OperationalCredentialsRemoveTrustedRootCertificate>(),
make_unique<OperationalCredentialsSetFabric>(),
make_unique<OperationalCredentialsUpdateFabricLabel>(),
make_unique<DiscoverOperationalCredentialsAttributes>(),
make_unique<ReadOperationalCredentialsFabricsList>(),
make_unique<ReadOperationalCredentialsClusterRevision>(),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3196,7 +3196,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
{
switch (aCommandId)
{
case Clusters::OperationalCredentials::Commands::Ids::AddOpCert: {
case Clusters::OperationalCredentials::Commands::Ids::AddNOC: {
expectArgumentCount = 4;
chip::ByteSpan NOCArray;
chip::ByteSpan IPKValue;
Expand Down Expand Up @@ -3268,8 +3268,8 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman

if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfOperationalCredentialsClusterAddOpCertCallback(aEndpointId, apCommandObj, NOCArray, IPKValue,
CaseAdminNode, AdminVendorId);
wasHandled = emberAfOperationalCredentialsClusterAddNOCCallback(aEndpointId, apCommandObj, NOCArray, IPKValue,
CaseAdminNode, AdminVendorId);
}
break;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/lighting-common/gen/endpoint_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1026,8 +1026,8 @@
{ 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* SetFabricResponse */ \
{ 0x003E, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* OpCSRRequest */ \
{ 0x003E, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCSRResponse */ \
{ 0x003E, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddOpCert */ \
{ 0x003E, 0x08, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCertResponse */ \
{ 0x003E, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddNOC */ \
{ 0x003E, 0x08, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* NOCResponse */ \
{ 0x003E, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateFabricLabel */ \
{ 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \
{ 0x003E, 0x0B, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveAllFabrics */ \
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/lighting-common/lighting-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -2921,7 +2921,7 @@
"outgoing": 1
},
{
"name": "AddOpCert",
"name": "AddNOC",
"code": 6,
"mfgCode": null,
"source": "client",
Expand Down Expand Up @@ -3012,7 +3012,7 @@
"outgoing": 1
},
{
"name": "OpCertResponse",
"name": "NOCResponse",
"code": 8,
"mfgCode": null,
"source": "server",
Expand Down
6 changes: 3 additions & 3 deletions examples/lock-app/lock-common/gen/IMClusterCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
{
switch (aCommandId)
{
case Clusters::OperationalCredentials::Commands::Ids::AddOpCert: {
case Clusters::OperationalCredentials::Commands::Ids::AddNOC: {
expectArgumentCount = 4;
chip::ByteSpan NOCArray;
chip::ByteSpan IPKValue;
Expand Down Expand Up @@ -1210,8 +1210,8 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman

if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfOperationalCredentialsClusterAddOpCertCallback(aEndpointId, apCommandObj, NOCArray, IPKValue,
CaseAdminNode, AdminVendorId);
wasHandled = emberAfOperationalCredentialsClusterAddNOCCallback(aEndpointId, apCommandObj, NOCArray, IPKValue,
CaseAdminNode, AdminVendorId);
}
break;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/lock-common/gen/endpoint_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,8 @@
{ 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* SetFabricResponse */ \
{ 0x003E, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* OpCSRRequest */ \
{ 0x003E, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCSRResponse */ \
{ 0x003E, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddOpCert */ \
{ 0x003E, 0x08, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCertResponse */ \
{ 0x003E, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddNOC */ \
{ 0x003E, 0x08, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* NOCResponse */ \
{ 0x003E, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateFabricLabel */ \
{ 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \
{ 0x003E, 0x0B, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveAllFabrics */ \
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/lock-common/lock-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -3265,7 +3265,7 @@
"outgoing": 1
},
{
"name": "AddOpCert",
"name": "AddNOC",
"code": 6,
"mfgCode": null,
"source": "client",
Expand Down Expand Up @@ -3356,7 +3356,7 @@
"outgoing": 1
},
{
"name": "OpCertResponse",
"name": "NOCResponse",
"code": 8,
"mfgCode": null,
"source": "server",
Expand Down
Loading

0 comments on commit 3426840

Please sign in to comment.