Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dump_fixer script #41

Merged
merged 3 commits into from
Jun 27, 2022
Merged

Add dump_fixer script #41

merged 3 commits into from
Jun 27, 2022

Conversation

balloob
Copy link
Contributor

@balloob balloob commented Jun 27, 2022

Extracted from #38

Sometimes we get a bad dump because the source is using a different version of Matter. This will propose changes to the dump to make the values work correctly in a test suite.

Our lighting-app fixture has one cluster that was not processed correctly. Running the script outputs can be used to update the fixture to represent real data:

❯ python3 -m scripts.dump_fixer tests/fixtures/nodes/lighting-example-app.json
Node 4337
** Found unprocessed cluster at endpoint 0: ThreadNetworkDiagnostics
Reason: Failed to decode field [].channel, expected type <class 'chip.tlv.uint'>, got <class 'chip.clusters.Attribute.ValueDecodeFailure'>

{
  "neighborTableList": [],
  "routeTableList": [],
  "securityPolicy": [],
  "operationalDatasetComponents": [],
  "activeNetworkFaultsList": [],
  "featureMap": 15,
  "clusterRevision": 1,
  "generatedCommandList": [],
  "acceptedCommandList": [
    0
  ],
  "attributeList": [
    0,
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    16,
    17,
    18,
    19,
    20,
    21,
    22,
    23,
    24,
    25,
    26,
    27,
    28,
    29,
    30,
    31,
    32,
    33,
    34,
    35,
    36,
    37,
    38,
    39,
    40,
    41,
    42,
    43,
    44,
    45,
    46,
    47,
    48,
    49,
    50,
    51,
    52,
    53,
    54,
    55,
    56,
    57,
    58,
    59,
    60,
    61,
    62,
    65528,
    65529,
    65531,
    65532,
    65533
  ],
  "_type": "chip.clusters.Objects.ThreadNetworkDiagnostics"
}

Bad fields:
{'activeTimestamp': {'Reason': 'InteractionModelError: Failure (0x1)',
                     'TLVValue': None},
 'attachAttemptCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                        'TLVValue': None},
 'betterPartitionAttachAttemptCount': {'Reason': 'InteractionModelError: '
                                                 'Failure (0x1)',
                                       'TLVValue': None},
 'channel': {'Reason': 'InteractionModelError: Failure (0x1)',
             'TLVValue': None},
 'channelMask': {'Reason': 'InteractionModelError: Failure (0x1)',
                 'TLVValue': None},
 'childRoleCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                    'TLVValue': None},
 'dataVersion': {'Reason': 'InteractionModelError: Failure (0x1)',
                 'TLVValue': None},
 'delay': {'Reason': 'InteractionModelError: Failure (0x1)', 'TLVValue': None},
 'detachedRoleCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                       'TLVValue': None},
 'extendedPanId': {'Reason': 'InteractionModelError: Failure (0x1)',
                   'TLVValue': None},
 'leaderRoleCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                     'TLVValue': None},
 'leaderRouterId': {'Reason': 'InteractionModelError: Failure (0x1)',
                    'TLVValue': None},
 'meshLocalPrefix': {'Reason': 'InteractionModelError: Failure (0x1)',
                     'TLVValue': None},
 'networkName': {'Reason': 'InteractionModelError: Failure (0x1)',
                 'TLVValue': None},
 'overrunCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                  'TLVValue': None},
 'panId': {'Reason': 'InteractionModelError: Failure (0x1)', 'TLVValue': None},
 'parentChangeCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                       'TLVValue': None},
 'partitionId': {'Reason': 'InteractionModelError: Failure (0x1)',
                 'TLVValue': None},
 'partitionIdChangeCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                            'TLVValue': None},
 'pendingTimestamp': {'Reason': 'InteractionModelError: Failure (0x1)',
                      'TLVValue': None},
 'routerRoleCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                     'TLVValue': None},
 'routingRole': {'Reason': 'InteractionModelError: Failure (0x1)',
                 'TLVValue': None},
 'rxAddressFilteredCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                            'TLVValue': None},
 'rxBeaconCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                   'TLVValue': None},
 'rxBeaconRequestCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                          'TLVValue': None},
 'rxBroadcastCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                      'TLVValue': None},
 'rxDataCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                 'TLVValue': None},
 'rxDataPollCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                     'TLVValue': None},
 'rxDestAddrFilteredCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                             'TLVValue': None},
 'rxDuplicatedCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                       'TLVValue': None},
 'rxErrFcsCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                   'TLVValue': None},
 'rxErrInvalidSrcAddrCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                              'TLVValue': None},
 'rxErrNoFrameCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                       'TLVValue': None},
 'rxErrOtherCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                     'TLVValue': None},
 'rxErrSecCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                   'TLVValue': None},
 'rxErrUnknownNeighborCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                               'TLVValue': None},
 'rxOtherCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                  'TLVValue': None},
 'rxTotalCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                  'TLVValue': None},
 'rxUnicastCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                    'TLVValue': None},
 'stableDataVersion': {'Reason': 'InteractionModelError: Failure (0x1)',
                       'TLVValue': None},
 'txAckRequestedCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                         'TLVValue': None},
 'txAckedCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                  'TLVValue': None},
 'txBeaconCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                   'TLVValue': None},
 'txBeaconRequestCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                          'TLVValue': None},
 'txBroadcastCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                      'TLVValue': None},
 'txDataCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                 'TLVValue': None},
 'txDataPollCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                     'TLVValue': None},
 'txDirectMaxRetryExpiryCount': {'Reason': 'InteractionModelError: Failure '
                                           '(0x1)',
                                 'TLVValue': None},
 'txErrAbortCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                     'TLVValue': None},
 'txErrBusyChannelCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                           'TLVValue': None},
 'txErrCcaCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                   'TLVValue': None},
 'txIndirectMaxRetryExpiryCount': {'Reason': 'InteractionModelError: Failure '
                                             '(0x1)',
                                   'TLVValue': None},
 'txNoAckRequestedCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                           'TLVValue': None},
 'txOtherCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                  'TLVValue': None},
 'txRetryCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                  'TLVValue': None},
 'txTotalCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                  'TLVValue': None},
 'txUnicastCount': {'Reason': 'InteractionModelError: Failure (0x1)',
                    'TLVValue': None},
 'weighting': {'Reason': 'InteractionModelError: Failure (0x1)',
               'TLVValue': None}}

@balloob balloob changed the title Clean up show_stored_node script Add dump_fixer script Jun 27, 2022
@balloob balloob merged commit ee404d2 into main Jun 27, 2022
@balloob balloob deleted the add-fix-dump-script branch June 27, 2022 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant