[MDSAL-691] Do not format empty augmentations in DataObject.toString() Created: 28/Sep/21  Updated: 28/Sep/21  Resolved: 28/Sep/21

Status: Resolved
Project: mdsal
Component/s: Binding codegen
Affects Version/s: None
Fix Version/s: 8.0.6

Type: Improvement Priority: Medium
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

DataObject.toString() implementation are recursive and fully open, which makes the strings rather long (1146 characters):

Pcrpt{pcrptMessage=PcrptMessage{reports=[Reports{lsp=Lsp{administrative=true, delegate=true, ignore=false, operational=Up, plspId=PlspId{_value=1}, processingRule=false, remove=false, sync=true, tlvs=Tlvs{lspIdentifiers=LspIdentifiers{addressFamily=Ipv4Case{ipv4=Ipv4{ipv4ExtendedTunnelId=Ipv4Address{_value=10.30.170.250}, ipv4TunnelEndpointAddress=Ipv4Address{_value=1.1.1.1}, ipv4TunnelSenderAddress=Ipv4Address{_value=10.30.170.250}, augmentation=[]}, augmentation=[]}, lspId=LspId{_value=1}, tunnelId=TunnelId{_value=1}, augmentation=[]}, symbolicPathName=SymbolicPathName{pathName=SymbolicPathName{_value=[112, 99, 99, 95, 49, 48, 46, 51, 48, 46, 49, 55, 48, 46, 50, 53, 48, 95, 116, 117, 110, 110, 101, 108, 95, 49]}, augmentation=[]}, augmentation=[Tlvs1null]}, augmentation=[Lsp1{create=false}]}, path=Path{ero=Ero{ignore=false, processingRule=false, subobject=[Subobject{loose=false, subobjectType=IpPrefixCase{ipPrefix=IpPrefix{ipPrefix=IpPrefix{_ipv4Prefix=Ipv4Prefix{_value=1.1.1.1/32}}, augmentation=[]}, augmentation=[]}, augmentation=[]}], augmentation=[]}, augmentation=[]}, augmentation=[]}], augmentation=[]}, augmentation=[]}

As can be seen a lot of space is taken up by traling ", augmentation=[]", which is by far the most common case.

Note we prune null values from all properties, yet somehow we do not consider empty augmentations as insignificant.

Update binding codegen to omit these – improving performance and reducing repetitiveness.

Above message will then become much simpler (942 characters):

Pcrpt{pcrptMessage=PcrptMessage{reports=[Reports{lsp=Lsp{administrative=true, delegate=true, ignore=false, operational=Up, plspId=PlspId{_value=1}, processingRule=false, remove=false, sync=true, tlvs=Tlvs{lspIdentifiers=LspIdentifiers{addressFamily=Ipv4Case{ipv4=Ipv4{ipv4ExtendedTunnelId=Ipv4Address{_value=10.30.170.250}, ipv4TunnelEndpointAddress=Ipv4Address{_value=1.1.1.1}, ipv4TunnelSenderAddress=Ipv4Address{_value=10.30.170.250}}}, lspId=LspId{_value=1}, tunnelId=TunnelId{_value=1}}, symbolicPathName=SymbolicPathName{pathName=SymbolicPathName{_value=[112, 99, 99, 95, 49, 48, 46, 51, 48, 46, 49, 55, 48, 46, 50, 53, 48, 95, 116, 117, 110, 110, 101, 108, 95, 49]}}, augmentation=[Tlvs1null]}, augmentation=[Lsp1{create=false}]}, path=Path{ero=Ero{ignore=false, processingRule=false, subobject=[Subobject{loose=false, subobjectType=IpPrefixCase{ipPrefix=IpPrefix{ipPrefix=IpPrefix{_ipv4Prefix=Ipv4Prefix{_value=1.1.1.1/32}}}}}]}}}]}}

i.e. reducing size by about 21%.


Generated at Wed Feb 07 20:10:35 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.