Class NxosGpbParserUtil


  • public class NxosGpbParserUtil
    extends java.lang.Object
    Utility to parse any key/value metric from gpb messages. Since there is no easy way to get key/value metrics from repeated data_gpbkv, this utility provides some methods to get values for those metrics without bothering about structure they may follow.
    Author:
    cgorantla
    • Constructor Detail

      • NxosGpbParserUtil

        public NxosGpbParserUtil()
    • Method Detail

      • getValueAsDouble

        public static java.lang.Double getValueAsDouble​(TelemetryBis.Telemetry msg,
                                                        java.lang.String name)
        Given a Telemetry Message and field name, get it's value as double.
        Parameters:
        msg - TelemetryBis.Telemetry message
        name - field name
        Returns:
        value field value
      • getValueAsString

        public static java.lang.String getValueAsString​(TelemetryBis.Telemetry msg,
                                                        java.lang.String name)
        Given a Telemetry Message and field name, get it's value as string.
        Parameters:
        msg - TelemetryBis.Telemetry message
        name - field name
        Returns:
        value field value
      • getValueFromRowAsString

        public static java.lang.String getValueFromRowAsString​(TelemetryBis.TelemetryField row,
                                                               java.lang.String name)
        Given a Telemetry field row and name of field, get field value as String
        Parameters:
        row - TelemetryBis.TelemetryField
        name - field name
        Returns:
        value field value
      • getValueFromRowAsDouble

        public static java.lang.Double getValueFromRowAsDouble​(TelemetryBis.TelemetryField row,
                                                               java.lang.String name)
        Given a Telemetry field row and name of field, get field value as Double
        Parameters:
        row - TelemetryBis.TelemetryField
        name - field name
        Returns:
        value field value
      • getValueAsDoubleRelativeToField

        public static java.lang.Double getValueAsDoubleRelativeToField​(TelemetryBis.Telemetry msg,
                                                                       java.lang.String parentFieldName,
                                                                       java.lang.String name)
        Given a Telemetry Message, parent field name and field name, get field value as Double
        Parameters:
        msg - TelemetryBis.Telemetry message
        parentFieldName -
        name - field name
        Returns:
        value field value
      • getValueAsStringRelativeToField

        public static java.lang.String getValueAsStringRelativeToField​(TelemetryBis.Telemetry msg,
                                                                       java.lang.String parentFieldName,
                                                                       java.lang.String name)
        Given a Telemetry Message, parent field name and field name, get field value as Double
        Parameters:
        msg - TelemetryBis.Telemetry message
        parentFieldName -
        name - field name
        Returns:
        value field value