ydk-gen icon indicating copy to clipboard operation
ydk-gen copied to clipboard

gNMI logs should include RPC details

Open 111pontes opened this issue 6 years ago • 0 comments

Currently, gNMI logs only decode the data in the RPC requests and responses. Logs should decode the entire RPC message just like the NETCONF logs.

Currently, we get:

=============== Get Request Sent ================
path {
  origin: "Cisco-IOS-XR-shellutil-oper"
  elem {
    name: "system-time"
  }
}
encoding: JSON_IETF


2019-01-15 18:49:19,399 - ydk - INFO - 
============= Get Response Received =============
notification {
  timestamp: 1547568568644828393
  update {
    path {
      origin: "Cisco-IOS-XR-shellutil-oper"
      elem {
        name: "system-time"
      }
    }
    val {
      json_ietf_val: "{\"clock\":{\"year\":2019,\"month\":1,\"day\":15,\"hour\":16,\"minute\":9,\"second\":28,\"millisecond\":595,\"wday\":2,\"time-zone\":\"UTC\",\"time-source\":\"calendar\"},\"uptime\":{\"host-name\":\"r1\",\"uptime\":55543}}"
    }
  }
}
error {
}

Complete output should look like:

=============== Request Sent ================
Get {
  GetRequest {
    path {
      origin: "Cisco-IOS-XR-shellutil-oper"
      elem {
        name: "system-time"
      }
    }
    encoding: JSON_IETF
  }
}

2019-01-15 18:49:19,399 - ydk - INFO - 
============= Response Received =============
GetResponse {
  notification {
    timestamp: 1547568568644828393
    update {
      path {
        origin: "Cisco-IOS-XR-shellutil-oper"
        elem {
          name: "system-time"
        }
      }
      val {
        json_ietf_val: "{\"clock\":{\"year\":2019,\"month\":1,\"day\":15,\"hour\":16,\"minute\":9,\"second\":28,\"millisecond\":595,\"wday\":2,\"time-zone\":\"UTC\",\"time-source\":\"calendar\"},\"uptime\":{\"host-name\":\"r1\",\"uptime\":55543}}"
      }
    }
  }
  error {
  }
}

For comparison, this is how the NETCONF RPCs are logged:

2019-01-15 18:53:11,546 - ydk - INFO - =============Generating payload to send to device=============
2019-01-15 18:53:11,546 - ydk - INFO - 
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <filter><system-time xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-shellutil-oper"/></filter>
</get>
</rpc>
2019-01-15 18:53:11,546 - ydk - INFO - 

2019-01-15 18:53:11,843 - ydk - INFO - =============Reply payload received from device=============
2019-01-15 18:53:11,848 - ydk - INFO - 
<?xml version="1.0"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data>
    <system-time xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-shellutil-oper">
      <clock>
        <year>2019</year>
        <month>1</month>
        <day>15</day>
        <hour>16</hour>
        <minute>13</minute>
        <second>21</second>
        <millisecond>30</millisecond>
        <wday>2</wday>
        <time-zone>UTC</time-zone>
        <time-source>calendar</time-source>
      </clock>
      <uptime>
        <host-name>r1</host-name>
        <uptime>55775</uptime>
      </uptime>
    </system-time>
  </data>
</rpc-reply>

2019-01-15 18:53:11,848 - ydk - INFO - 

111pontes avatar Jan 15 '19 19:01 111pontes