Class NxosGpbParserUtil
- java.lang.Object
-
- org.opennms.netmgt.telemetry.protocols.nxos.adapter.NxosGpbParserUtil
-
public class NxosGpbParserUtil extends 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 Summary
Constructors Constructor Description NxosGpbParserUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<TelemetryBis.TelemetryField>
getRowsFromTable(TelemetryBis.Telemetry msg, String name)
Given a Telemetry Message and row name, get the list of fieldsstatic Double
getValueAsDouble(TelemetryBis.Telemetry msg, String name)
Given a Telemetry Message and field name, get it's value as double.static Double
getValueAsDoubleRelativeToField(TelemetryBis.Telemetry msg, String parentFieldName, String name)
Given a Telemetry Message, parent field name and field name, get field value as Doublestatic String
getValueAsString(TelemetryBis.Telemetry msg, String name)
Given a Telemetry Message and field name, get it's value as string.static String
getValueAsStringRelativeToField(TelemetryBis.Telemetry msg, String parentFieldName, String name)
Given a Telemetry Message, parent field name and field name, get field value as Doublestatic Double
getValueFromRowAsDouble(TelemetryBis.TelemetryField row, String name)
Given a Telemetry field row and name of field, get field value as Doublestatic String
getValueFromRowAsString(TelemetryBis.TelemetryField row, String name)
Given a Telemetry field row and name of field, get field value as String
-
-
-
Method Detail
-
getValueAsDouble
public static Double getValueAsDouble(TelemetryBis.Telemetry msg, String name)
Given a Telemetry Message and field name, get it's value as double.- Parameters:
msg
-TelemetryBis.Telemetry
messagename
- field name- Returns:
- value field value
-
getValueAsString
public static String getValueAsString(TelemetryBis.Telemetry msg, String name)
Given a Telemetry Message and field name, get it's value as string.- Parameters:
msg
-TelemetryBis.Telemetry
messagename
- field name- Returns:
- value field value
-
getRowsFromTable
public static List<TelemetryBis.TelemetryField> getRowsFromTable(TelemetryBis.Telemetry msg, String name)
Given a Telemetry Message and row name, get the list of fields- Parameters:
Telemetry
- messageTelemetryBis.Telemetry
name
- of field- Returns:
- list of Telemetry fields
-
getValueFromRowAsString
public static String getValueFromRowAsString(TelemetryBis.TelemetryField row, 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 Double getValueFromRowAsDouble(TelemetryBis.TelemetryField row, 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 Double getValueAsDoubleRelativeToField(TelemetryBis.Telemetry msg, String parentFieldName, String name)
Given a Telemetry Message, parent field name and field name, get field value as Double- Parameters:
msg
-TelemetryBis.Telemetry
messageparentFieldName
-name
- field name- Returns:
- value field value
-
getValueAsStringRelativeToField
public static String getValueAsStringRelativeToField(TelemetryBis.Telemetry msg, String parentFieldName, String name)
Given a Telemetry Message, parent field name and field name, get field value as Double- Parameters:
msg
-TelemetryBis.Telemetry
messageparentFieldName
-name
- field name- Returns:
- value field value
-
-