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