Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-691

Do not format empty augmentations in DataObject.toString()

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 8.0.6
    • None
    • Binding codegen

      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%.

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: