Repository: napalm-automation/napalm

Issue:
get_optics fails on some JUNOS versions (12.3R2, 11.4)
### Description of Issue/Question

`get_optics` fails on some JUNOS versions,  including 12.3 and 11.4 (admittedly < 12.1 supported).  
This is due to a simple space inserted in the output for Infinite light levels.

A simple change to [L61](https://github.com/napalm-automation/napalm-base/blob/0.25.0/napalm_base/constants.py#L61) in constants.py to add a space fixes this issue in my environment.  However, I realize this may not be universally true.   

_Perhaps this should be a regex instead of list membership tests in [junos.py](https://github.com/napalm-automation/napalm-junos/blob/develop/napalm_junos/junos.py#L1880)?_

**Local workaround**
```diff
diff --git a/napalm_base/constants.py b/napalm_base/constants.py
index bcfbff9..cb328dc 100644
--- a/napalm_base/constants.py
+++ b/napalm_base/constants.py
@@ -58,7 +58,7 @@ TRACEROUTE_NULL_HOST_NAME = '*'
 TRACEROUTE_NULL_IP_ADDRESS = '*'
 TRACEROUTE_VRF = ''

-OPTICS_NULL_LEVEL = '-Inf'
+OPTICS_NULL_LEVEL = '- Inf'

 PING_SOURCE = ''
 PING_TTL = 255
```

### Did you follow the steps from https://github.com/napalm-automation/napalm#faq
[X] Yes
[ ] No


### napalm version
(Paste verbatim output from `pip freeze | grep napalm` between quotes below)

```
napalm==1.2.0
napalm-base==0.25.0
napalm-eos==0.6.1
napalm-fortios==0.4.0
napalm-ios==0.8.0
napalm-iosxr==0.5.4
napalm-junos==0.12.0
napalm-nxos==0.7.0
napalm-panos==0.4.0
napalm-pluribus==0.5.1
napalm-ros==0.2.2
napalm-vyos==0.1.3
```

### Network device software version
(Paste verbatim output from `show version` (or equivalent on your platform) between quotes below)

```
show version
Hostname: <REMOVED>
Model: mx960
JUNOS Base OS boot [12.3R2.5]
JUNOS Base OS Software Suite [12.3R2.5]
JUNOS Kernel Software Suite [12.3R2.5]
JUNOS Crypto Software Suite [12.3R2.5]
JUNOS Packet Forwarding Engine Support (M/T/EX Common) [12.3R2.5]
JUNOS Packet Forwarding Engine Support (MX Common) [12.3R2.5]
JUNOS Online Documentation [12.3R2.5]
JUNOS Services AACL Container package [12.3R2.5]
JUNOS Services Application Level Gateways [12.3R2.5]
JUNOS AppId Services [12.3R2.5]
JUNOS Border Gateway Function package [12.3R2.5]
JUNOS Services Captive Portal and Content Delivery Container package [12.3R2.5]
JUNOS Services HTTP Content Management package [12.3R2.5]
JUNOS IDP Services [12.3R2.5]
JUNOS Services LL-PDF Container package [12.3R2.5]
JUNOS Services NAT [12.3R2.5]
JUNOS Services PTSP Container package [12.3R2.5]
JUNOS Services RPM [12.3R2.5]
JUNOS Services Stateful Firewall [12.3R2.5]
JUNOS Voice Services Container package [12.3R2.5]
JUNOS Services Example Container package [12.3R2.5]
JUNOS Services Crypto [12.3R2.5]
JUNOS Services SSL [12.3R2.5]
JUNOS Services IPSec [12.3R2.5]
JUNOS Runtime Software Suite [12.3R2.5]
JUNOS platform Software Suite [12.3R2.5]
JUNOS Routing Software Suite [12.3R2.5]

```


### Steps to Reproduce the Issue

Call `get_optics` on a JUNOS MX960 running 12.3R2.5

**Juniper CLI OUTPUT**
```
show interfaces diagnostics optics et-0/1/0
Physical interface: et-0/1/0
    Module temperature                        :  42 degrees C / 107 degrees F
    Module voltage                            :  3.2920 V
    Module temperature high alarm             :  Off
    Module temperature low alarm              :  Off
    Module temperature high warning           :  Off
    Module temperature low warning            :  Off
    Module voltage high alarm                 :  Off
    Module voltage low alarm                  :  Off
    Module voltage high warning               :  Off
    Module voltage low warning                :  Off
    Module not ready alarm                    :  Off
    Module low power alarm                    :  Off
    Module initialization incomplete alarm    :  Off
    Module fault alarm                        :  Off
    PLD Flash initialization fault alarm      :  Off
    Power supply fault alarm                  :  Off
    Checksum fault alarm                      :  Off
    Tx laser disabled alarm                   :  Off
    Tx loss of signal functionality alarm     :  Off
    Tx CDR loss of lock alarm                 :  Off
    Rx loss of signal alarm                   :  Off
    Rx CDR loss of lock alarm                 :  Off
    Module temperature high alarm threshold   :  74 degrees C / 165 degrees F
    Module temperature low alarm threshold    :  -4 degrees C / 25 degrees F
    Module temperature high warning threshold :  70 degrees C / 158 degrees F
    Module temperature low warning threshold  :  0 degrees C / 32 degrees F
    Module voltage high alarm threshold       :  3.6640 V
    Module voltage low alarm threshold        :  2.9340 V
    Module voltage high warning threshold     :  3.4640 V
    Module voltage low warning threshold      :  3.1340 V
    Laser bias current high alarm threshold   :  15.000 mA
    Laser bias current low alarm threshold    :  4.000 mA
    Laser bias current high warning threshold :  14.000 mA
    Laser bias current low warning threshold  :  5.000 mA
    Laser output power high alarm threshold   :  0.0000 mW / - Inf dBm
    Laser output power low alarm threshold    :  0.0000 mW / - Inf dBm
    Laser output power high warning threshold :  0.0000 mW / - Inf dBm
    Laser output power low warning threshold  :  0.0000 mW / - Inf dBm
    Laser rx power high alarm threshold       :  0.0000 mW / - Inf dBm
    Laser rx power low alarm threshold        :  0.0000 mW / - Inf dBm
    Laser rx power high warning threshold     :  0.0000 mW / - Inf dBm
    Laser rx power low warning threshold      :  0.0000 mW / - Inf dBm
    Laser temperature high alarm threshold    :  74 degrees C / 165 degrees F
    Laser temperature low alarm threshold     :  -4 degrees C / 25 degrees F
    Laser temperature high warning threshold  :  70 degrees C / 158 degrees F
    Laser temperature low warning threshold   :  0 degrees C / 32 degrees F
```

### Error Traceback
(Paste the complete traceback of the exception between quotes below)

```
Traceback (most recent call last):
  File "nuke.py", line 32, in <module>
    optics = device.get_optics()
  File "/Users/jboswell/.virtualenvs/nuke/lib/python2.7/site-packages/napalm_junos/junos.py", line 1785, in get_optics
    [None, C.OPTICS_NULL_LEVEL]
ValueError: could not convert string to float: - Inf
```


### Trace captured

```
Please, reproduce the issue with the cli tool in debug mode and paste the entire execution.

https://napalm.readthedocs.io/en/latest/cli.html

napalm --debug --user <REMOVED> --password <REMOVED> --vendor junos <REMOVED> call get_optics                                                                                                              1 ↵
2017-11-02 14:19:36,322 - napalm - DEBUG - Starting napalm's debugging tool
2017-11-02 14:19:36,322 - napalm - DEBUG - Gathering napalm packages
2017-11-02 14:19:36,330 - napalm - DEBUG - napalm-base==0.25.0
2017-11-02 14:19:36,330 - napalm - DEBUG - napalm-eos==0.6.1
2017-11-02 14:19:36,330 - napalm - DEBUG - napalm-fortios==0.4.0
2017-11-02 14:19:36,330 - napalm - DEBUG - napalm-ios==0.8.0
2017-11-02 14:19:36,330 - napalm - DEBUG - napalm-iosxr==0.5.4
2017-11-02 14:19:36,330 - napalm - DEBUG - napalm-junos==0.12.0
2017-11-02 14:19:36,330 - napalm - DEBUG - napalm-nxos==0.7.0
2017-11-02 14:19:36,330 - napalm - DEBUG - napalm-panos==0.4.0
2017-11-02 14:19:36,330 - napalm - DEBUG - napalm-pluribus==0.5.1
2017-11-02 14:19:36,330 - napalm - DEBUG - napalm-ros==0.2.2
2017-11-02 14:19:36,330 - napalm - DEBUG - napalm-vyos==0.1.3
2017-11-02 14:19:36,331 - napalm - DEBUG - napalm==1.2.0
2017-11-02 14:19:36,331 - napalm - DEBUG - get_network_driver - Calling with args: ('junos',), {}
2017-11-02 14:19:36,659 - napalm - DEBUG - get_network_driver - Successful
2017-11-02 14:19:36,659 - napalm - DEBUG - __init__ - Calling with args: (<class 'napalm_junos.junos.JunOSDriver'>, '<REMOVED>', '<REMOVED>'), {'password': u'*******', 'optional_args': {}, 'timeout': 60}
2017-11-02 14:19:36,660 - napalm - DEBUG - __init__ - Successful
2017-11-02 14:19:36,660 - napalm - DEBUG - pre_connection_tests - Calling with args: (<napalm_junos.junos.JunOSDriver object at 0x105e9cc10>,), {}
2017-11-02 14:19:36,660 - napalm - DEBUG - open - Calling with args: (<napalm_junos.junos.JunOSDriver object at 0x105e9cc10>,), {}
2017-11-02 14:19:38,979 - napalm - DEBUG - open - Successful
2017-11-02 14:19:38,979 - napalm - DEBUG - connection_tests - Calling with args: (<napalm_junos.junos.JunOSDriver object at 0x105e9cc10>,), {}
2017-11-02 14:19:38,979 - napalm - DEBUG - get_facts - Calling with args: (<napalm_junos.junos.JunOSDriver object at 0x105e9cc10>,), {}
2017-11-02 14:19:48,802 - napalm - DEBUG - Gathered facts:
{
    "os_version": "12.3R2.5",
    "uptime": 101732760,
    "interface_list": [
        "lc-0/0/0",
        "pfe-0/0/0",
        "pfh-0/0/0",
        "xe-0/0/0",
        "xe-0/0/1",
        "xe-0/0/2",
        "xe-0/0/3",
        "et-0/1/0",
        "lc-0/2/0",
        "pfe-0/2/0",
        "xe-0/2/0",
        "xe-0/2/1",
        "xe-0/2/2",
        "xe-0/2/3",
        "et-0/3/0",
        "lc-1/0/0",
        "pfe-1/0/0",
        "pfh-1/0/0",
        "xe-1/0/0",
        "xe-1/0/1",
        "xe-1/0/2",
        "xe-1/0/3",
        "et-1/1/0",
        "lc-1/2/0",
        "pfe-1/2/0",
        "xe-1/2/0",
        "xe-1/2/1",
        "xe-1/2/2",
        "xe-1/2/3",
        "et-1/3/0",
        "lc-2/0/0",
        "pfe-2/0/0",
        "pfh-2/0/0",
        "xe-2/0/0",
        "xe-2/0/1",
        "xe-2/0/2",
        "xe-2/0/3",
        "lc-2/1/0",
        "pfe-2/1/0",
        "xe-2/1/0",
        "xe-2/1/1",
        "xe-2/1/2",
        "xe-2/1/3",
        "lc-2/2/0",
        "pfe-2/2/0",
        "xe-2/2/0",
        "xe-2/2/1",
        "xe-2/2/2",
        "xe-2/2/3",
        "lc-2/3/0",
        "pfe-2/3/0",
        "xe-2/3/0",
        "xe-2/3/1",
        "xe-2/3/2",
        "xe-2/3/3",
        "lc-3/0/0",
        "pfe-3/0/0",
        "pfh-3/0/0",
        "xe-3/0/0",
        "xe-3/0/1",
        "xe-3/0/2",
        "xe-3/0/3",
        "lc-3/1/0",
        "pfe-3/1/0",
        "xe-3/1/0",
        "xe-3/1/1",
        "xe-3/1/2",
        "xe-3/1/3",
        "lc-3/2/0",
        "pfe-3/2/0",
        "xe-3/2/0",
        "xe-3/2/1",
        "xe-3/2/2",
        "xe-3/2/3",
        "lc-3/3/0",
        "pfe-3/3/0",
        "xe-3/3/0",
        "xe-3/3/1",
        "xe-3/3/2",
        "xe-3/3/3",
        "lc-4/0/0",
        "pfe-4/0/0",
        "pfh-4/0/0",
        "xe-4/0/0",
        "xe-4/0/1",
        "xe-4/0/2",
        "xe-4/0/3",
        "lc-4/1/0",
        "pfe-4/1/0",
        "xe-4/1/0",
        "xe-4/1/1",
        "xe-4/1/2",
        "xe-4/1/3",
        "lc-4/2/0",
        "pfe-4/2/0",
        "xe-4/2/0",
        "xe-4/2/1",
        "xe-4/2/2",
        "xe-4/2/3",
        "lc-4/3/0",
        "pfe-4/3/0",
        "xe-4/3/0",
        "xe-4/3/1",
        "xe-4/3/2",
        "xe-4/3/3",
        "lc-5/0/0",
        "pfe-5/0/0",
        "pfh-5/0/0",
        "xe-5/0/0",
        "xe-5/0/1",
        "xe-5/0/2",
        "xe-5/0/3",
        "lc-5/1/0",
        "pfe-5/1/0",
        "xe-5/1/0",
        "xe-5/1/1",
        "xe-5/1/2",
        "xe-5/1/3",
        "lc-5/2/0",
        "pfe-5/2/0",
        "xe-5/2/0",
        "xe-5/2/1",
        "xe-5/2/2",
        "xe-5/2/3",
        "lc-5/3/0",
        "pfe-5/3/0",
        "xe-5/3/0",
        "xe-5/3/1",
        "xe-5/3/2",
        "xe-5/3/3",
        "lc-6/0/0",
        "pfe-6/0/0",
        "pfh-6/0/0",
        "xe-6/0/0",
        "xe-6/0/1",
        "xe-6/0/2",
        "xe-6/0/3",
        "et-6/1/0",
        "lc-6/2/0",
        "pfe-6/2/0",
        "xe-6/2/0",
        "xe-6/2/1",
        "xe-6/2/2",
        "xe-6/2/3",
        "et-6/3/0",
        "lc-7/0/0",
        "pfe-7/0/0",
        "pfh-7/0/0",
        "xe-7/0/0",
        "xe-7/0/1",
        "xe-7/0/2",
        "xe-7/0/3",
        "lc-7/1/0",
        "pfe-7/1/0",
        "xe-7/1/0",
        "xe-7/1/1",
        "xe-7/1/2",
        "xe-7/1/3",
        "lc-7/2/0",
        "pfe-7/2/0",
        "xe-7/2/0",
        "xe-7/2/1",
        "xe-7/2/2",
        "xe-7/2/3",
        "lc-7/3/0",
        "pfe-7/3/0",
        "xe-7/3/0",
        "xe-7/3/1",
        "xe-7/3/2",
        "xe-7/3/3",
        "lc-8/0/0",
        "pfe-8/0/0",
        "pfh-8/0/0",
        "xe-8/0/0",
        "xe-8/0/1",
        "xe-8/0/2",
        "xe-8/0/3",
        "lc-8/1/0",
        "pfe-8/1/0",
        "xe-8/1/0",
        "xe-8/1/1",
        "xe-8/1/2",
        "xe-8/1/3",
        "lc-8/2/0",
        "pfe-8/2/0",
        "xe-8/2/0",
        "xe-8/2/1",
        "xe-8/2/2",
        "xe-8/2/3",
        "lc-8/3/0",
        "pfe-8/3/0",
        "xe-8/3/0",
        "xe-8/3/1",
        "xe-8/3/2",
        "xe-8/3/3",
        "lc-9/0/0",
        "pfe-9/0/0",
        "pfh-9/0/0",
        "xe-9/0/0",
        "xe-9/0/1",
        "xe-9/0/2",
        "xe-9/0/3",
        "lc-9/1/0",
        "pfe-9/1/0",
        "xe-9/1/0",
        "xe-9/1/1",
        "xe-9/1/2",
        "xe-9/1/3",
        "lc-9/2/0",
        "pfe-9/2/0",
        "xe-9/2/0",
        "xe-9/2/1",
        "xe-9/2/2",
        "xe-9/2/3",
        "lc-9/3/0",
        "pfe-9/3/0",
        "xe-9/3/0",
        "xe-9/3/1",
        "xe-9/3/2",
        "xe-9/3/3",
        "lc-10/0/0",
        "pfe-10/0/0",
        "pfh-10/0/0",
        "xe-10/0/0",
        "xe-10/0/1",
        "xe-10/0/2",
        "xe-10/0/3",
        "lc-10/1/0",
        "pfe-10/1/0",
        "xe-10/1/0",
        "xe-10/1/1",
        "xe-10/1/2",
        "xe-10/1/3",
        "lc-10/2/0",
        "pfe-10/2/0",
        "xe-10/2/0",
        "xe-10/2/1",
        "xe-10/2/2",
        "xe-10/2/3",
        "lc-10/3/0",
        "pfe-10/3/0",
        "xe-10/3/0",
        "xe-10/3/1",
        "xe-10/3/2",
        "xe-10/3/3",
        "lc-11/0/0",
        "pfe-11/0/0",
        "pfh-11/0/0",
        "xe-11/0/0",
        "xe-11/0/1",
        "xe-11/0/2",
        "xe-11/0/3",
        "et-11/1/0",
        "lc-11/2/0",
        "pfe-11/2/0",
        "xe-11/2/0",
        "xe-11/2/1",
        "xe-11/2/2",
        "xe-11/2/3",
        "et-11/3/0",
        ".local.",
        "ae0",
        "ae1",
        "ae2",
        "ae3",
        "ae4",
        "ae5",
        "ae6",
        "ae7",
        "ae8",
        "ae9",
        "ae10",
        "ae11",
        "ae12",
        "ae13",
        "ae14",
        "ae15",
        "ae16",
        "ae17",
        "ae18",
        "ae19",
        "ae20",
        "ae21",
        "ae22",
        "ae23",
        "ae24",
        "ae25",
        "ae26",
        "ae27",
        "ae28",
        "ae29",
        "ae30",
        "ae31",
        "ae32",
        "ae33",
        "ae34",
        "ae35",
        "ae36",
        "ae37",
        "ae38",
        "ae39",
        "ae40",
        "ae41",
        "ae42",
        "ae43",
        "ae44",
        "ae45",
        "ae46",
        "ae47",
        "ae48",
        "ae49",
        "ae50",
        "ae51",
        "ae52",
        "ae53",
        "ae54",
        "ae55",
        "ae56",
        "ae57",
        "ae58",
        "ae59",
        "ae60",
        "ae61",
        "ae62",
        "ae63",
        "as0",
        "as1",
        "as2",
        "as3",
        "as4",
        "as5",
        "as6",
        "as7",
        "as8",
        "as9",
        "as10",
        "as11",
        "as12",
        "as13",
        "as14",
        "as15",
        "cbp0",
        "demux0",
        "dsc",
        "em0",
        "em1",
        "fxp0",
        "gre",
        "ipip",
        "irb",
        "lo0",
        "lsi",
        "mtun",
        "pimd",
        "pime",
        "pip0",
        "pp0",
        "tap"
    ],
    "vendor": "Juniper",
    "serial_number": "JN11C2<REMOVED>",
    "model": "MX960",
    "hostname": "<REMOVED>",
    "fqdn": "<REMOVED>"
}
{
    "os_version": "12.3R2.5",
    "uptime": 101732760,
    "interface_list": [
        "lc-0/0/0",
        "pfe-0/0/0",
        "pfh-0/0/0",
        "xe-0/0/0",
        "xe-0/0/1",
        "xe-0/0/2",
        "xe-0/0/3",
        "et-0/1/0",
        "lc-0/2/0",
        "pfe-0/2/0",
        "xe-0/2/0",
        "xe-0/2/1",
        "xe-0/2/2",
        "xe-0/2/3",
        "et-0/3/0",
        "lc-1/0/0",
        "pfe-1/0/0",
        "pfh-1/0/0",
        "xe-1/0/0",
        "xe-1/0/1",
        "xe-1/0/2",
        "xe-1/0/3",
        "et-1/1/0",
        "lc-1/2/0",
        "pfe-1/2/0",
        "xe-1/2/0",
        "xe-1/2/1",
        "xe-1/2/2",
        "xe-1/2/3",
        "et-1/3/0",
        "lc-2/0/0",
        "pfe-2/0/0",
        "pfh-2/0/0",
        "xe-2/0/0",
        "xe-2/0/1",
        "xe-2/0/2",
        "xe-2/0/3",
        "lc-2/1/0",
        "pfe-2/1/0",
        "xe-2/1/0",
        "xe-2/1/1",
        "xe-2/1/2",
        "xe-2/1/3",
        "lc-2/2/0",
        "pfe-2/2/0",
        "xe-2/2/0",
        "xe-2/2/1",
        "xe-2/2/2",
        "xe-2/2/3",
        "lc-2/3/0",
        "pfe-2/3/0",
        "xe-2/3/0",
        "xe-2/3/1",
        "xe-2/3/2",
        "xe-2/3/3",
        "lc-3/0/0",
        "pfe-3/0/0",
        "pfh-3/0/0",
        "xe-3/0/0",
        "xe-3/0/1",
        "xe-3/0/2",
        "xe-3/0/3",
        "lc-3/1/0",
        "pfe-3/1/0",
        "xe-3/1/0",
        "xe-3/1/1",
        "xe-3/1/2",
        "xe-3/1/3",
        "lc-3/2/0",
        "pfe-3/2/0",
        "xe-3/2/0",
        "xe-3/2/1",
        "xe-3/2/2",
        "xe-3/2/3",
        "lc-3/3/0",
        "pfe-3/3/0",
        "xe-3/3/0",
        "xe-3/3/1",
        "xe-3/3/2",
        "xe-3/3/3",
        "lc-4/0/0",
        "pfe-4/0/0",
        "pfh-4/0/0",
        "xe-4/0/0",
        "xe-4/0/1",
        "xe-4/0/2",
        "xe-4/0/3",
        "lc-4/1/0",
        "pfe-4/1/0",
        "xe-4/1/0",
        "xe-4/1/1",
        "xe-4/1/2",
        "xe-4/1/3",
        "lc-4/2/0",
        "pfe-4/2/0",
        "xe-4/2/0",
        "xe-4/2/1",
        "xe-4/2/2",
        "xe-4/2/3",
        "lc-4/3/0",
        "pfe-4/3/0",
        "xe-4/3/0",
        "xe-4/3/1",
        "xe-4/3/2",
        "xe-4/3/3",
        "lc-5/0/0",
        "pfe-5/0/0",
        "pfh-5/0/0",
        "xe-5/0/0",
        "xe-5/0/1",
        "xe-5/0/2",
        "xe-5/0/3",
        "lc-5/1/0",
        "pfe-5/1/0",
        "xe-5/1/0",
        "xe-5/1/1",
        "xe-5/1/2",
        "xe-5/1/3",
        "lc-5/2/0",
        "pfe-5/2/0",
        "xe-5/2/0",
        "xe-5/2/1",
        "xe-5/2/2",
        "xe-5/2/3",
        "lc-5/3/0",
        "pfe-5/3/0",
        "xe-5/3/0",
        "xe-5/3/1",
        "xe-5/3/2",
        "xe-5/3/3",
        "lc-6/0/0",
        "pfe-6/0/0",
        "pfh-6/0/0",
        "xe-6/0/0",
        "xe-6/0/1",
        "xe-6/0/2",
        "xe-6/0/3",
        "et-6/1/0",
        "lc-6/2/0",
        "pfe-6/2/0",
        "xe-6/2/0",
        "xe-6/2/1",
        "xe-6/2/2",
        "xe-6/2/3",
        "et-6/3/0",
        "lc-7/0/0",
        "pfe-7/0/0",
        "pfh-7/0/0",
        "xe-7/0/0",
        "xe-7/0/1",
        "xe-7/0/2",
        "xe-7/0/3",
        "lc-7/1/0",
        "pfe-7/1/0",
        "xe-7/1/0",
        "xe-7/1/1",
        "xe-7/1/2",
        "xe-7/1/3",
        "lc-7/2/0",
        "pfe-7/2/0",
        "xe-7/2/0",
        "xe-7/2/1",
        "xe-7/2/2",
        "xe-7/2/3",
        "lc-7/3/0",
        "pfe-7/3/0",
        "xe-7/3/0",
        "xe-7/3/1",
        "xe-7/3/2",
        "xe-7/3/3",
        "lc-8/0/0",
        "pfe-8/0/0",
        "pfh-8/0/0",
        "xe-8/0/0",
        "xe-8/0/1",
        "xe-8/0/2",
        "xe-8/0/3",
        "lc-8/1/0",
        "pfe-8/1/0",
        "xe-8/1/0",
        "xe-8/1/1",
        "xe-8/1/2",
        "xe-8/1/3",
        "lc-8/2/0",
        "pfe-8/2/0",
        "xe-8/2/0",
        "xe-8/2/1",
        "xe-8/2/2",
        "xe-8/2/3",
        "lc-8/3/0",
        "pfe-8/3/0",
        "xe-8/3/0",
        "xe-8/3/1",
        "xe-8/3/2",
        "xe-8/3/3",
        "lc-9/0/0",
        "pfe-9/0/0",
        "pfh-9/0/0",
        "xe-9/0/0",
        "xe-9/0/1",
        "xe-9/0/2",
        "xe-9/0/3",
        "lc-9/1/0",
        "pfe-9/1/0",
        "xe-9/1/0",
        "xe-9/1/1",
        "xe-9/1/2",
        "xe-9/1/3",
        "lc-9/2/0",
        "pfe-9/2/0",
        "xe-9/2/0",
        "xe-9/2/1",
        "xe-9/2/2",
        "xe-9/2/3",
        "lc-9/3/0",
        "pfe-9/3/0",
        "xe-9/3/0",
        "xe-9/3/1",
        "xe-9/3/2",
        "xe-9/3/3",
        "lc-10/0/0",
        "pfe-10/0/0",
        "pfh-10/0/0",
        "xe-10/0/0",
        "xe-10/0/1",
        "xe-10/0/2",
        "xe-10/0/3",
        "lc-10/1/0",
        "pfe-10/1/0",
        "xe-10/1/0",
        "xe-10/1/1",
        "xe-10/1/2",
        "xe-10/1/3",
        "lc-10/2/0",
        "pfe-10/2/0",
        "xe-10/2/0",
        "xe-10/2/1",
        "xe-10/2/2",
        "xe-10/2/3",
        "lc-10/3/0",
        "pfe-10/3/0",
        "xe-10/3/0",
        "xe-10/3/1",
        "xe-10/3/2",
        "xe-10/3/3",
        "lc-11/0/0",
        "pfe-11/0/0",
        "pfh-11/0/0",
        "xe-11/0/0",
        "xe-11/0/1",
        "xe-11/0/2",
        "xe-11/0/3",
        "et-11/1/0",
        "lc-11/2/0",
        "pfe-11/2/0",
        "xe-11/2/0",
        "xe-11/2/1",
        "xe-11/2/2",
        "xe-11/2/3",
        "et-11/3/0",
        ".local.",
        "ae0",
        "ae1",
        "ae2",
        "ae3",
        "ae4",
        "ae5",
        "ae6",
        "ae7",
        "ae8",
        "ae9",
        "ae10",
        "ae11",
        "ae12",
        "ae13",
        "ae14",
        "ae15",
        "ae16",
        "ae17",
        "ae18",
        "ae19",
        "ae20",
        "ae21",
        "ae22",
        "ae23",
        "ae24",
        "ae25",
        "ae26",
        "ae27",
        "ae28",
        "ae29",
        "ae30",
        "ae31",
        "ae32",
        "ae33",
        "ae34",
        "ae35",
        "ae36",
        "ae37",
        "ae38",
        "ae39",
        "ae40",
        "ae41",
        "ae42",
        "ae43",
        "ae44",
        "ae45",
        "ae46",
        "ae47",
        "ae48",
        "ae49",
        "ae50",
        "ae51",
        "ae52",
        "ae53",
        "ae54",
        "ae55",
        "ae56",
        "ae57",
        "ae58",
        "ae59",
        "ae60",
        "ae61",
        "ae62",
        "ae63",
        "as0",
        "as1",
        "as2",
        "as3",
        "as4",
        "as5",
        "as6",
        "as7",
        "as8",
        "as9",
        "as10",
        "as11",
        "as12",
        "as13",
        "as14",
        "as15",
        "cbp0",
        "demux0",
        "dsc",
        "em0",
        "em1",
        "fxp0",
        "gre",
        "ipip",
        "irb",
        "lo0",
        "lsi",
        "mtun",
        "pimd",
        "pime",
        "pip0",
        "pp0",
        "tap"
    ],
    "vendor": "Juniper",
    "serial_number": "JN11C2<REMOVED>",
    "model": "MX960",
    "hostname": "<REMOVED>",
    "fqdn": "<REMOVED>"
}
2017-11-02 14:19:48,815 - napalm - DEBUG - get_facts - Successful
2017-11-02 14:19:48,815 - napalm - DEBUG - method - Calling with args: (<napalm_junos.junos.JunOSDriver object at 0x105e9cc10>, 'get_optics'), {}
2017-11-02 14:19:48,815 - napalm - DEBUG - get_optics - Attempting to resolve method
2017-11-02 14:19:48,815 - napalm - DEBUG - get_optics - Attempting to call method with kwargs: {}
2017-11-02 14:19:50,150 - napalm - ERROR - method - Failed: could not convert string to float: - Inf

================= Traceback =================

Traceback (most recent call last):
  File "/Users/jboswell/.virtualenvs/nuke/bin/napalm", line 11, in <module>
    sys.exit(main())
  File "/Users/jboswell/.virtualenvs/nuke/lib/python2.7/site-packages/napalm_base/clitools/cl_napalm.py", line 285, in main
    run_tests(args)
  File "/Users/jboswell/.virtualenvs/nuke/lib/python2.7/site-packages/napalm_base/clitools/cl_napalm.py", line 268, in run_tests
    call_getter(device, args.method, **method_kwargs)
  File "/Users/jboswell/.virtualenvs/nuke/lib/python2.7/site-packages/napalm_base/clitools/cl_napalm.py", line 27, in wrapper
    r = func(*args, **kwargs)
  File "/Users/jboswell/.virtualenvs/nuke/lib/python2.7/site-packages/napalm_base/clitools/cl_napalm.py", line 238, in call_getter
    r = func(**kwargs)
  File "/Users/jboswell/.virtualenvs/nuke/lib/python2.7/site-packages/napalm_junos/junos.py", line 1785, in get_optics
    [None, C.OPTICS_NULL_LEVEL]
ValueError: could not convert string to float: - Inf
```



Discussion:
We can probably do either `optics['input_power'].replace(' ', '')` in line 1879 or add a second constant. Do you want to try and submit a PR?
@dbarrosop  #521 submitted.  I put the replace before the `intf_optics` dict, and only if `input_power` is a str

Resolving patch:
diff --git a/napalm/junos/constants.py b/napalm/junos/constants.py
--- a/napalm/junos/constants.py
+++ b/napalm/junos/constants.py
@@ -14,3 +14,7 @@
     'vpls': 'BGP_VPLS',
     'forwarding': 'L2P2P'
 }
+# OPTICS_NULL_LEVEL_SPC matches infinite light level '- Inf'
+# reading on some versions of JUNOS
+# https://github.com/napalm-automation/napalm/issues/491
+OPTICS_NULL_LEVEL_SPC = '- Inf'
diff --git a/napalm/junos/junos.py b/napalm/junos/junos.py
--- a/napalm/junos/junos.py
+++ b/napalm/junos/junos.py
@@ -1873,6 +1873,8 @@ def get_optics(self):
                 optics_detail[interface_name]['physical_channels'] = {}
                 optics_detail[interface_name]['physical_channels']['channel'] = []
 
+            INVALID_LIGHT_LEVEL = [None, C.OPTICS_NULL_LEVEL, C.OPTICS_NULL_LEVEL_SPC]
+
             # Defaulting avg, min, max values to 0.0 since device does not
             # return these values
             intf_optics = {
@@ -1882,7 +1884,7 @@ def get_optics(self):
                                     'instant': (
                                         float(optics['input_power'])
                                         if optics['input_power'] not in
-                                        [None, C.OPTICS_NULL_LEVEL]
+                                        INVALID_LIGHT_LEVEL
                                         else 0.0),
                                     'avg': 0.0,
                                     'max': 0.0,
@@ -1892,7 +1894,7 @@ def get_optics(self):
                                     'instant': (
                                         float(optics['output_power'])
                                         if optics['output_power'] not in
-                                        [None, C.OPTICS_NULL_LEVEL]
+                                        INVALID_LIGHT_LEVEL
                                         else 0.0),
                                     'avg': 0.0,
                                     'max': 0.0,
@@ -1902,7 +1904,7 @@ def get_optics(self):
                                     'instant': (
                                         float(optics['laser_bias_current'])
                                         if optics['laser_bias_current'] not in
-                                        [None, C.OPTICS_NULL_LEVEL]
+                                        INVALID_LIGHT_LEVEL
                                         else 0.0),
                                     'avg': 0.0,
                                     'max': 0.0,


Test patch:
diff --git a/test/junos/mocked_data/test_get_optics/infinite_with_space/expected_result.json b/test/junos/mocked_data/test_get_optics/infinite_with_space/expected_result.json
new file mode 100644
--- /dev/null
+++ b/test/junos/mocked_data/test_get_optics/infinite_with_space/expected_result.json
@@ -0,0 +1,31 @@
+{
+"xe-2/2/2": {
+        "physical_channels": {
+            "channel": [
+                {
+                    "index": 0,
+                    "state": {
+                        "input_power": {
+                            "avg": 0.0,
+                            "instant": -31.55,
+                            "max": 0.0,
+                            "min": 0.0
+                        },
+                        "laser_bias_current": {
+                            "avg": 0.0,
+                            "instant": 33.490,
+                            "max": 0.0,
+                            "min": 0.0
+                        },
+                        "output_power": {
+                            "avg": 0.0,
+                            "instant": 0.0,
+                            "max": 0.0,
+                            "min": 0.0
+                        }
+                    }
+                }
+            ]
+        }
+    }
+}
diff --git a/test/junos/mocked_data/test_get_optics/infinite_with_space/get-interface-optics-diagnostics-information.xml b/test/junos/mocked_data/test_get_optics/infinite_with_space/get-interface-optics-diagnostics-information.xml
new file mode 100644
--- /dev/null
+++ b/test/junos/mocked_data/test_get_optics/infinite_with_space/get-interface-optics-diagnostics-information.xml
@@ -0,0 +1,65 @@
+
+<interface-information>
+    <physical-interface>
+        <name>xe-2/2/2</name>
+        <optics-diagnostics>
+            <laser-bias-current>33.490</laser-bias-current>
+            <laser-output-power>0.6980</laser-output-power>
+            <laser-output-power-dbm>- Inf</laser-output-power-dbm>
+            <module-temperature>33 degrees C / 92 degrees F</module-temperature>
+            <module-voltage>3.2760</module-voltage>
+            <rx-signal-avg-optical-power>0.0007</rx-signal-avg-optical-power>
+            <rx-signal-avg-optical-power-dbm>-31.55</rx-signal-avg-optical-power-dbm>
+            <laser-bias-current-high-alarm>off</laser-bias-current-high-alarm>
+            <laser-bias-current-low-alarm>off</laser-bias-current-low-alarm>
+            <laser-bias-current-high-warn>off</laser-bias-current-high-warn>
+            <laser-bias-current-low-warn>off</laser-bias-current-low-warn>
+            <laser-tx-power-high-alarm>off</laser-tx-power-high-alarm>
+            <laser-tx-power-low-alarm>off</laser-tx-power-low-alarm>
+            <laser-tx-power-high-warn>off</laser-tx-power-high-warn>
+            <laser-tx-power-low-warn>off</laser-tx-power-low-warn>
+            <module-temperature-high-alarm>off</module-temperature-high-alarm>
+            <module-temperature-low-alarm>off</module-temperature-low-alarm>
+            <module-temperature-high-warn>off</module-temperature-high-warn>
+            <module-temperature-low-warn>off</module-temperature-low-warn>
+            <module-voltage-high-alarm>off</module-voltage-high-alarm>
+            <module-voltage-low-alarm>off</module-voltage-low-alarm>
+            <module-voltage-high-warn>off</module-voltage-high-warn>
+            <module-voltage-low-warn>off</module-voltage-low-warn>
+            <laser-rx-power-high-alarm>off</laser-rx-power-high-alarm>
+            <laser-rx-power-low-alarm>on</laser-rx-power-low-alarm>
+            <laser-rx-power-high-warn>off</laser-rx-power-high-warn>
+            <laser-rx-power-low-warn>on</laser-rx-power-low-warn>
+            <laser-bias-current-high-alarm-threshold>85.000</laser-bias-current-high-alarm-threshold>
+            <laser-bias-current-low-alarm-threshold>15.000</laser-bias-current-low-alarm-threshold>
+            <laser-bias-current-high-warn-threshold>80.000</laser-bias-current-high-warn-threshold>
+            <laser-bias-current-low-warn-threshold>20.000</laser-bias-current-low-warn-threshold>
+            <laser-tx-power-high-alarm-threshold>1.5840</laser-tx-power-high-alarm-threshold>
+            <laser-tx-power-high-alarm-threshold-dbm>2.00</laser-tx-power-high-alarm-threshold-dbm>
+            <laser-tx-power-low-alarm-threshold>0.1580</laser-tx-power-low-alarm-threshold>
+            <laser-tx-power-low-alarm-threshold-dbm>-8.01</laser-tx-power-low-alarm-threshold-dbm>
+            <laser-tx-power-high-warn-threshold>1.2580</laser-tx-power-high-warn-threshold>
+            <laser-tx-power-high-warn-threshold-dbm>1.00</laser-tx-power-high-warn-threshold-dbm>
+            <laser-tx-power-low-warn-threshold>0.1990</laser-tx-power-low-warn-threshold>
+            <laser-tx-power-low-warn-threshold-dbm>-7.01</laser-tx-power-low-warn-threshold-dbm>
+            <module-temperature-high-alarm-threshold>88 degrees C / 190 degrees F</module-temperature-high-alarm-threshold>
+            <module-temperature-low-alarm-threshold>-13 degrees C / 9 degrees F
+            </module-temperature-low-alarm-threshold>
+            <module-temperature-high-warn-threshold>85 degrees C / 185 degrees F
+            </module-temperature-high-warn-threshold>
+            <module-temperature-low-warn-threshold>-8 degrees C / 18 degrees F</module-temperature-low-warn-threshold>
+            <module-voltage-high-alarm-threshold>3.700</module-voltage-high-alarm-threshold>
+            <module-voltage-low-alarm-threshold>2.900</module-voltage-low-alarm-threshold>
+            <module-voltage-high-warn-threshold>3.600</module-voltage-high-warn-threshold>
+            <module-voltage-low-warn-threshold>3.000</module-voltage-low-warn-threshold>
+            <laser-rx-power-high-alarm-threshold>1.7783</laser-rx-power-high-alarm-threshold>
+            <laser-rx-power-high-alarm-threshold-dbm>2.50</laser-rx-power-high-alarm-threshold-dbm>
+            <laser-rx-power-low-alarm-threshold>0.0100</laser-rx-power-low-alarm-threshold>
+            <laser-rx-power-low-alarm-threshold-dbm>-20.00</laser-rx-power-low-alarm-threshold-dbm>
+            <laser-rx-power-high-warn-threshold>1.5849</laser-rx-power-high-warn-threshold>
+            <laser-rx-power-high-warn-threshold-dbm>2.00</laser-rx-power-high-warn-threshold-dbm>
+            <laser-rx-power-low-warn-threshold>0.0158</laser-rx-power-low-warn-threshold>
+            <laser-rx-power-low-warn-threshold-dbm>-18.01</laser-rx-power-low-warn-threshold-dbm>
+        </optics-diagnostics>
+    </physical-interface>
+</interface-information>