This repository has been archived by the owner on Jan 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Modifications to get_optics to survive from N/A output power value #136
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
test/unit/mocked_data/test_get_optics/interface_shutdown/expected_result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"TenGigabitEthernet1/0/1": { | ||
"physical_channels": { | ||
"channel": [{ | ||
"index": 0, | ||
"state": { | ||
"output_power": { | ||
"max": 0.0, | ||
"avg": 0.0, | ||
"instant": -2.0, | ||
"min": 0.0 | ||
}, | ||
"laser_bias_current": { | ||
"max": 0.0, | ||
"avg": 0.0, | ||
"instant": 0.0, | ||
"min": 0.0 | ||
}, | ||
"input_power": { | ||
"max": 0.0, | ||
"avg": 0.0, | ||
"instant": -3.5, | ||
"min": 0.0 | ||
} | ||
} | ||
}] | ||
} | ||
}, | ||
"TenGigabitEthernet2/0/1": { | ||
"physical_channels": { | ||
"channel": [{ | ||
"index": 0, | ||
"state": { | ||
"output_power": { | ||
"max": 0.0, | ||
"avg": 0.0, | ||
"instant": -40.0, | ||
"min": 0.0 | ||
}, | ||
"laser_bias_current": { | ||
"max": 0.0, | ||
"avg": 0.0, | ||
"instant": 0.0, | ||
"min": 0.0 | ||
}, | ||
"input_power": { | ||
"max": 0.0, | ||
"avg": 0.0, | ||
"instant": -40.0, | ||
"min": 0.0 | ||
} | ||
} | ||
}] | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
test/unit/mocked_data/test_get_optics/interface_shutdown/show_int_Te1_0_1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
TenGigabitEthernet1/0/1 is up, line protocol is up (connected) | ||
Hardware is Ten Gigabit Ethernet, address is 0042.5a67.0e9b (bia 0042.5a67.0e9b) | ||
Description: Uplink-to-DSW1 | ||
MTU 1500 bytes, BW 10000000 Kbit/sec, DLY 10 usec, | ||
reliability 255/255, txload 1/255, rxload 1/255 | ||
Encapsulation ARPA, loopback not set | ||
Keepalive not set | ||
Full-duplex, 10Gb/s, link type is auto, media type is SFP-10GBase-LRM | ||
input flow-control is off, output flow-control is unsupported | ||
ARP type: ARPA, ARP Timeout 04:00:00 | ||
Last input 00:00:02, output 00:00:04, output hang never | ||
Last clearing of "show interface" counters never | ||
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 | ||
Queueing strategy: fifo | ||
Output queue: 0/40 (size/max) | ||
5 minute input rate 61000 bits/sec, 52 packets/sec | ||
5 minute output rate 59000 bits/sec, 63 packets/sec | ||
13525429 packets input, 1636789604 bytes, 0 no buffer | ||
Received 2388654 broadcasts (578107 multicasts) | ||
0 runts, 0 giants, 0 throttles | ||
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored | ||
0 watchdog, 578107 multicast, 0 pause input | ||
0 input packets with dribble condition detected | ||
7831375 packets output, 870124569 bytes, 0 underruns | ||
0 output errors, 0 collisions, 1 interface resets | ||
0 unknown protocol drops | ||
0 babbles, 0 late collision, 0 deferred | ||
0 lost carrier, 0 no carrier, 0 pause output | ||
0 output buffer failures, 0 output buffers swapped out |
29 changes: 29 additions & 0 deletions
29
test/unit/mocked_data/test_get_optics/interface_shutdown/show_int_Te2_0_1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
TenGigabitEthernet2/0/1 is up, line protocol is up (connected) | ||
Hardware is Ten Gigabit Ethernet, address is 0042.5a8d.d91b (bia 0042.5a8d.d91b) | ||
Description: Uplink-to-DSW2 | ||
MTU 1500 bytes, BW 10000000 Kbit/sec, DLY 10 usec, | ||
reliability 255/255, txload 1/255, rxload 1/255 | ||
Encapsulation ARPA, loopback not set | ||
Keepalive not set | ||
Full-duplex, 10Gb/s, link type is auto, media type is SFP-10GBase-LRM | ||
input flow-control is off, output flow-control is unsupported | ||
ARP type: ARPA, ARP Timeout 04:00:00 | ||
Last input 00:00:29, output 00:00:01, output hang never | ||
Last clearing of "show interface" counters never | ||
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 | ||
Queueing strategy: fifo | ||
Output queue: 0/40 (size/max) | ||
5 minute input rate 187000 bits/sec, 135 packets/sec | ||
5 minute output rate 181000 bits/sec, 113 packets/sec | ||
21192627 packets input, 4732793131 bytes, 0 no buffer | ||
Received 1625861 broadcasts (279957 multicasts) | ||
0 runts, 0 giants, 0 throttles | ||
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored | ||
0 watchdog, 279957 multicast, 0 pause input | ||
0 input packets with dribble condition detected | ||
27963853 packets output, 3954071411 bytes, 0 underruns | ||
0 output errors, 0 collisions, 1 interface resets | ||
0 unknown protocol drops | ||
0 babbles, 0 late collision, 0 deferred | ||
0 lost carrier, 0 no carrier, 0 pause output | ||
0 output buffer failures, 0 output buffers swapped out |
11 changes: 11 additions & 0 deletions
11
test/unit/mocked_data/test_get_optics/interface_shutdown/show_interfaces_transceiver.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
If device is externally calibrated, only calibrated values are printed. | ||
++ : high alarm, + : high warning, - : low warning, -- : low alarm. | ||
NA or N/A: not applicable, Tx: transmit, Rx: receive. | ||
mA: milliamperes, dBm: decibels (milliwatts). | ||
|
||
Optical Optical | ||
Temperature Voltage Tx Power Rx Power | ||
Port (Celsius) (Volts) (dBm) (dBm) | ||
--------- ----------- ------- -------- -------- | ||
Te1/0/1 34.6 3.29 -2.0 -3.5 | ||
Te2/0/1 34.3 3.28 N/A -40.0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why -40? Is that an insane value that clearly indicates it is not supported/available? I am not an optics person myself :P
In any case, I am fine with having such a value if it makes sense but we should make it clear here:
https://github.com/napalm-automation/napalm-base/blob/develop/napalm_base/base.py#L1332
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was thinking about this. I'm wondering whether it is good to use 0.0 as default value for optical powers as it is (in some cases) completely valid value. So 0.0 doesn't indicate not supported(available) see Cisco 10GBASE SFP+ Modules datasheet table 2 for example. Cisco uses value of -40.0 at Rx side to indicate "no light". Nevermind, as technology evolves somebody will create more sensitive receivers and -40.0 will be again valid value. Should we default to -100 or something?
Even you are fine with such value I think we should have it consistent across platforms and all values of Rx, Tx, instant, max, min, avg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I am fine with -100 as a sort of "infinite" value. Eventually we will move this to the classes in
napalm-yang
and those have support to leave empty values.Before moving forward I'd like @mirceaulinic's opinion though but if he agrees we can probably create a few issues to (1) document the behavior in
napalm-base
and (2) update the rest of the drivers as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that makes sense to me.