Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong DOM values for xe-* interfaces #178 #180

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion interfacediagnostics/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (c *interfaceDiagnosticsCollector) interfaceDiagnosticsSatellite(client *rp
// workaround: go through all lines of the XML and remove identical, consecutive lines
err := client.RunCommandAndParseWithParser("show interfaces diagnostics optics satellite", func(b []byte) error {
var (
lines []string = strings.Split(string(b[:]), "\n")
lines = strings.Split(string(b[:]), "\n")
lineIndex int
tmpByte []byte
)
Expand Down Expand Up @@ -390,6 +390,16 @@ func interfaceDiagnosticsFromRPCResult(result InterfaceDiagnosticsRPC) []*Interf

d.Lanes = append(d.Lanes, l)
}

/* For some interfaces with 0 lanes there sometimes is <rx-signal-avg-optical-power> instead of
<laser-rx-optical-power> in the xml/json response and vice-versa.*/
} else if diag.Diagnostics.LaserRxOpticalPowerDbm == "" {
d.LaserRxOpticalPower = d.RxSignalAvgOpticalPower
d.LaserRxOpticalPowerDbm = d.RxSignalAvgOpticalPowerDbm

} else if diag.Diagnostics.RxSignalAvgOpticalPowerDbm == "" {
d.RxSignalAvgOpticalPower = d.LaserRxOpticalPower
d.RxSignalAvgOpticalPowerDbm = d.LaserRxOpticalPowerDbm
}

diagnostics = append(diagnostics, d)
Expand Down