Repository: napalm-automation/napalm

Issue:
Junos get_bgp_config() issue with route reflector clients
### Junos get_bgp_config() fails when a value is present in neighbor data for "cluster".  This raises an exception in helpers.convert, as a None datatype is passed in for "to".   If I add `"cluster": str` to `_COMMON_FIELDS_DATATYPE_` in napalm/junos.py it does seem to work as expected.

### Did you follow the steps from https://github.com/napalm-automation/napalm#faq
(Place an ``x`` between the square brackets where applicable)

- [x] Yes
- [] No


### Setup

### napalm version
(Paste verbatim output from `pip freeze | grep napalm` between quotes below)

```
napalm==4.0.0
```

### Network operating system version
(Paste verbatim output from `show version` - or equivalent - between quotes below)

```
Hostname: router1
Model: mx960
Junos: 20.4R3-S2.6
JUNOS OS Kernel 64-bit  [20211117.c779bdc_builder_stable_11-204ab]
JUNOS OS libs [20211117.c779bdc_builder_stable_11-204ab]
JUNOS OS runtime [20211117.c779bdc_builder_stable_11-204ab]
JUNOS OS time zone information [20211117.c779bdc_builder_stable_11-204ab]
JUNOS network stack and utilities [20220206.163424_builder_junos_204_r3_s2]
JUNOS libs [20220206.163424_builder_junos_204_r3_s2]
JUNOS OS libs compat32 [20211117.c779bdc_builder_stable_11-204ab]
JUNOS OS 32-bit compatibility [20211117.c779bdc_builder_stable_11-204ab]
JUNOS libs compat32 [20220206.163424_builder_junos_204_r3_s2]
JUNOS runtime [20220206.163424_builder_junos_204_r3_s2]
JUNOS sflow mx [20220206.163424_builder_junos_204_r3_s2]
JUNOS py extensions2 [20220206.163424_builder_junos_204_r3_s2]
JUNOS py extensions [20220206.163424_builder_junos_204_r3_s2]
JUNOS py base2 [20220206.163424_builder_junos_204_r3_s2]
JUNOS py base [20220206.163424_builder_junos_204_r3_s2]
JUNOS OS crypto [20211117.c779bdc_builder_stable_11-204ab]
JUNOS OS boot-ve files [20211117.c779bdc_builder_stable_11-204ab]
JUNOS na telemetry [20.4R3-S2.6]
JUNOS Security Intelligence [20220206.163424_builder_junos_204_r3_s2]
JUNOS mx libs compat32 [20220206.163424_builder_junos_204_r3_s2]
JUNOS mx runtime [20220206.163424_builder_junos_204_r3_s2]
JUNOS RPD Telemetry Application [20.4R3-S2.6]
Redis [20220206.163424_builder_junos_204_r3_s2]
JUNOS probe utility [20220206.163424_builder_junos_204_r3_s2]
JUNOS common platform support [20220206.163424_builder_junos_204_r3_s2]
JUNOS Openconfig [20.4R3-S2.6]
JUNOS mtx network modules [20220206.163424_builder_junos_204_r3_s2]
JUNOS modules [20220206.163424_builder_junos_204_r3_s2]
JUNOS mx modules [20220206.163424_builder_junos_204_r3_s2]
JUNOS mx libs [20220206.163424_builder_junos_204_r3_s2]
JUNOS SQL Sync Daemon [20220206.163424_builder_junos_204_r3_s2]
JUNOS mtx Data Plane Crypto Support [20220206.163424_builder_junos_204_r3_s2]
JUNOS daemons [20220206.163424_builder_junos_204_r3_s2]
JUNOS mx daemons [20220206.163424_builder_junos_204_r3_s2]
JUNOS Broadband Egde User Plane Apps [20.4R3-S2.6]
JUNOS appidd-mx application-identification daemon [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services URL Filter package [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services TLB Service PIC package [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services Telemetry [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services TCP-LOG [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services SSL [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services SOFTWIRE [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services Stateful Firewall [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services RTCOM [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services RPM [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services PCEF package [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services NAT [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services Mobile Subscriber Service Container package [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services MobileNext Software package [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services Logging Report Framework package [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services LL-PDF Container package [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services Jflow Container package [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services Deep Packet Inspection package [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services IPSec [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services IDS [20220206.163424_builder_junos_204_r3_s2]
JUNOS IDP Services [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services HTTP Content Management package [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services Crypto [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services Captive Portal and Content Delivery Container package [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services COS [20220206.163424_builder_junos_204_r3_s2]
JUNOS AppId Services [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services Application Level Gateways [20220206.163424_builder_junos_204_r3_s2]
JUNOS Services AACL Container package [20220206.163424_builder_junos_204_r3_s2]
JUNOS SDN Software Suite [20220206.163424_builder_junos_204_r3_s2]
JUNOS Extension Toolkit [20220206.163424_builder_junos_204_r3_s2]
JUNOS Packet Forwarding Engine Support (wrlinux9) [20220206.163424_builder_junos_204_r3_s2]
JUNOS Packet Forwarding Engine Support (MXSPC3) [20.4R3-S2.6]
JUNOS Packet Forwarding Engine Support (MX/EX92XX Common) [20220206.163424_builder_junos_204_r3_s2]
JUNOS Packet Forwarding Engine Support (M/T Common) [20220206.163424_builder_junos_204_r3_s2]
JUNOS Packet Forwarding Engine Support (aft) [20220206.163424_builder_junos_204_r3_s2]
JUNOS Packet Forwarding Engine Support (MX Common) [20220206.163424_builder_junos_204_r3_s2]
JUNOS Juniper Malware Removal Tool (JMRT) [1.0.0+20220206.163424_builder_junos_204_r3_s2]
JUNOS J-Insight [20220206.163424_builder_junos_204_r3_s2]
JUNOS jfirmware [20220206.163424_builder_junos_204_r3_s2]
JUNOS Online Documentation [20220206.163424_builder_junos_204_r3_s2]
JUNOS jail runtime [20211117.c779bdc_builder_stable_11-204ab]
```

### Steps to Reproduce the Issue

```
from napalm import get_network_driver
import json
auth_info = {"username": "user", "password": "pass"}
d = "router1"
dev_os = "junos"
driver = get_network_driver(dev_os)
dev = driver(d, auth_info["username"], auth_info["password"])
dev.open()

bgp_config = dev.get_bgp_config()
print(json.dumps(bgp_config, indent=2))
```

### Error Traceback
(Paste the complete traceback of the exception between quotes below)

```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/napalm_test/env/lib/python3.9/site-packages/napalm/junos/junos.py", line 1304, in get_bgp_config
    {key: napalm.base.helpers.convert(datatype, value, default)}
  File "/napalm_test/env/lib/python3.9/site-packages/napalm/base/helpers.py", line 464, in convert
    raise ValueError(
ValueError: Can't convert with callable None - no default is defined for this type.
```



Discussion:

Resolving patch:
diff --git a/napalm/junos/junos.py b/napalm/junos/junos.py
--- a/napalm/junos/junos.py
+++ b/napalm/junos/junos.py
@@ -1335,9 +1335,10 @@ def build_prefix_limit(**args):
                 if key == "neighbors":
                     bgp_group_peers = value
                     continue
-                bgp_config[bgp_group_name].update(
-                    {key: napalm.base.helpers.convert(datatype, value, default)}
-                )
+                if datatype:
+                    bgp_config[bgp_group_name].update(
+                        {key: napalm.base.helpers.convert(datatype, value, default)}
+                    )
             prefix_limit_fields = {}
             for key, value in bgp_group_details:
                 if "_prefix_limit" in key and value is not None:


Test patch: