diff --git a/napalm_vyos/vyos.py b/napalm_vyos/vyos.py index 2cda003..d144440 100644 --- a/napalm_vyos/vyos.py +++ b/napalm_vyos/vyos.py @@ -146,7 +146,14 @@ class VyOSDriver(NetworkDriver): print self._device.send_command("cp "+self._BOOT_FILENAME+" "+self._BACKUP_FILENAME) self._new_config = f.read() cfg = [x for x in self._new_config.split("\n") if x is not ""] - self._device.send_config_set(cfg) + output_loadcmd = self._device.send_config_set(cfg) + match_setfailed = re.findall("Delete failed", output_loadcmd) + match_delfailed = re.findall("Set failed", output_loadcmd) + + if match_setfailed or match_delfailed: + raise MergeConfigException("Failed merge config: " + +output_loadcmd) + else: raise MergeConfigException("config file is not found") elif config is not None: diff --git a/test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json b/test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json index 75c97a6..b1390a7 100644 --- a/test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json +++ b/test/unit/mocked_data/test_get_bgp_neighbors/normal/expected_result.json @@ -1 +1 @@ -{"global": {"router_id": "10.2.2.2", "peers": {"10.0.12.1": {"is_enabled": true, "uptime": 864000, "remote_as": 65001, "description": "", "remote_id": "10.1.1.1", "local_as": 65002, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": -1, "accepted_prefixes": 4, "received_prefixes": 4}}}}}} +{"global": {"router_id": "10.2.2.2", "peers": {"10.0.12.1": {"is_enabled": true, "uptime": "...", "remote_as": 65001, "description": "", "remote_id": "10.1.1.1", "local_as": 65002, "is_up": true, "address_family": {"ipv4": {"sent_prefixes": -1, "accepted_prefixes": "...", "received_prefixes": "..."}}}}}} diff --git a/test/unit/mocked_data/test_get_environment/normal/expected_result.json b/test/unit/mocked_data/test_get_environment/normal/expected_result.json index 54abd07..602019c 100644 --- a/test/unit/mocked_data/test_get_environment/normal/expected_result.json +++ b/test/unit/mocked_data/test_get_environment/normal/expected_result.json @@ -1 +1 @@ -{"fans": {"invalid": {"status": false}}, "memory": {"available_ram": 250112, "used_ram": 228668}, "temperature": {"invalid": {"is_alert": false, "temperature": 0.0, "is_critical": false}}, "power": {"invalid": {"status": true, "output": 0.0, "capacity": 0.0}}, "cpu": {"0": {"%usage": 1.0}}} +{"fans": {"invalid": {"status": false}}, "memory": {"available_ram": 250112, "used_ram": "..."}, "temperature": {"invalid": {"is_alert": false, "temperature": 0.0, "is_critical": false}}, "power": {"invalid": {"status": true, "output": 0.0, "capacity": 0.0}}, "cpu": {"0": {"%usage": 1.0}}} diff --git a/test/unit/mocked_data/test_get_facts/normal/expected_result.json b/test/unit/mocked_data/test_get_facts/normal/expected_result.json index 0b4cd05..bb2280b 100644 --- a/test/unit/mocked_data/test_get_facts/normal/expected_result.json +++ b/test/unit/mocked_data/test_get_facts/normal/expected_result.json @@ -1 +1 @@ -{"os_version": "1.1.7", "uptime": 1043562, "interface_list": ["eth1", "eth0", "lo"], "vendor": "VyOS", "serial_number": "0", "model": "VirtualBox", "hostname": "vyos2", "fqdn": ""} +{"os_version": "1.1.7", "uptime": "...", "interface_list": ["eth1", "eth0", "lo"], "vendor": "VyOS", "serial_number": "0", "model": "VirtualBox", "hostname": "vyos2", "fqdn": ""} diff --git a/test/unit/mocked_data/test_get_interfaces_counters/normal/expected_result.json b/test/unit/mocked_data/test_get_interfaces_counters/normal/expected_result.json index d47db80..01b8b42 100644 --- a/test/unit/mocked_data/test_get_interfaces_counters/normal/expected_result.json +++ b/test/unit/mocked_data/test_get_interfaces_counters/normal/expected_result.json @@ -1 +1 @@ -{"eth1": {"tx_discards": 0, "tx_unicast_packets": 1124144, "rx_broadcast_packets": -1, "rx_discards": 0, "tx_multicast_packets": -1, "tx_octets": 128843591, "tx_errors": 0, "rx_octets": 128902602, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": 0, "rx_unicast_packets": 1123974}, "eth0": {"tx_discards": 0, "tx_unicast_packets": 1228025, "rx_broadcast_packets": -1, "rx_discards": 0, "tx_multicast_packets": -1, "tx_octets": 341284276, "tx_errors": 0, "rx_octets": 136039132, "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": 0, "rx_unicast_packets": 1231464}} +{"eth1": {"tx_discards": 0, "tx_unicast_packets": "...", "rx_broadcast_packets": -1, "rx_discards": 0, "tx_multicast_packets": -1, "tx_octets": "...", "tx_errors": 0, "rx_octets": "...", "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": 0, "rx_unicast_packets": "..."}, "eth0": {"tx_discards": 0, "tx_unicast_packets": "...", "rx_broadcast_packets": -1, "rx_discards": 0, "tx_multicast_packets": -1, "tx_octets": "...", "tx_errors": 0, "rx_octets": "...", "rx_errors": 0, "tx_broadcast_packets": -1, "rx_multicast_packets": 0, "rx_unicast_packets": "..."}} diff --git a/test/unit/mocked_data/test_ping/normal/expected_result.json b/test/unit/mocked_data/test_ping/normal/expected_result.json index 0621797..f45a8e4 100644 --- a/test/unit/mocked_data/test_ping/normal/expected_result.json +++ b/test/unit/mocked_data/test_ping/normal/expected_result.json @@ -1 +1 @@ -{"success": {"packet_loss": 0, "rtt_stddev": 0.123, "rtt_min": 0.086, "results": [{"rtt": 0.175, "ip_address": "8.8.8.8"}], "rtt_avg": 0.175, "rtt_max": 0.417, "probes_sent": 5}} +{"success": {"packet_loss": 0, "rtt_stddev": "...", "rtt_min": "...", "results": "...", "rtt_avg": "...", "rtt_max": "...", "probes_sent": "..."}}