Pretty PrintΒΆ
PrettyPrint string representation of the Python object. This Serializer is mainly recommended to be used for CLI debugging.
For example, given the following napalm-logs document (as JSON):
{
"yang_message": {
"bgp": {
"neighbors": {
"neighbor": {
"192.168.140.254": {
"state": {
"session_state": "CONNECT"
}
}
}
}
}
},
"message_details": {
"processId": null,
"severity": 4,
"facility": 0,
"hostPrefix": null,
"pri": "4",
"processName": "kernel",
"host": "vmx01",
"tag": "tcp_auth_ok",
"time": "21:23:00",
"date": "Jul 20",
"message": "Packet from 192.168.140.254:61664 wrong MD5 digest"
},
"timestamp": 1500585780,
"facility": 0,
"ip": "127.0.0.1",
"host": "vmx01",
"yang_model": "openconfig-bgp",
"error": "BGP_MD5_INCORRECT",
"os": "junos",
"severity": 4
}
The document will be serialized as:
{'error': 'BGP_MD5_INCORRECT',
'facility': 0,
'host': 'vmx01',
'ip': '127.0.0.1',
'message_details': {'date': 'Jul 20',
'facility': 0,
'host': 'vmx01',
'hostPrefix': None,
'message': 'Packet from 192.168.140.254:61664 wrong MD5 digest',
'pri': '4',
'processId': None,
'processName': 'kernel',
'severity': 4,
'tag': 'tcp_auth_ok',
'time': '21:23:00'},
'os': 'junos',
'severity': 4,
'timestamp': 1500585780,
'yang_message': {'bgp': {'neighbors': {'neighbor': {'192.168.140.254': {'state': {'session_state': 'CONNECT'}}}}}},
'yang_model': 'openconfig-bgp'}