diff --git a/pyntc/devices/eos_device.py b/pyntc/devices/eos_device.py index 24646a9e..7ee87a35 100644 --- a/pyntc/devices/eos_device.py +++ b/pyntc/devices/eos_device.py @@ -73,7 +73,10 @@ def __init__(self, host, username, password, transport="http", port=None, timeou self._connected = False log.init(host=host) - def _file_copy_instance(self, src, dest=None, file_system="flash:"): + def _file_copy_instance(self, src, dest=None, file_system="/mnt/flash"): + # "flash:" is only valid locally, "/mnt/flash" is used externally + if file_system == "flash:": + file_system = "/mnt/flash" if dest is None: dest = os.path.basename(src) @@ -175,7 +178,7 @@ def boot_options(self): dict: Key is ``sys`` with value being the image on the device. """ image = self.show("show boot-config")["softwareImage"] - image = image.replace("flash:", "") + image = image.replace("flash:/", "") log.debug("Host %s: the boot options are %s", self.host, {"sys": image}) return {"sys": image} @@ -375,7 +378,7 @@ def file_copy(self, src, dest=None, file_system=None): file_copy = self._file_copy_instance(src, dest, file_system=file_system) try: - file_copy.enable_scp() + # file_copy.enable_scp() file_copy.establish_scp_conn() file_copy.transfer_file() log.info("Host %s: File %s transferred successfully.", self.host, src) diff --git a/tests/unit/test_devices/device_mocks/eos/enable_json/show_boot-config b/tests/unit/test_devices/device_mocks/eos/enable_json/show_boot-config index 3ea642bb..03f27d2b 100644 --- a/tests/unit/test_devices/device_mocks/eos/enable_json/show_boot-config +++ b/tests/unit/test_devices/device_mocks/eos/enable_json/show_boot-config @@ -2,7 +2,7 @@ "command": "show boot-config", "result": { "memTestIterations": 0, - "softwareImage": "flash:EOS.swi", + "softwareImage": "EOS.swi", "abootPassword": "(not set)" }, "encoding": "json" diff --git a/tests/unit/test_devices/test_eos_device.py b/tests/unit/test_devices/test_eos_device.py index cc0bc78d..2d6bcdc2 100644 --- a/tests/unit/test_devices/test_eos_device.py +++ b/tests/unit/test_devices/test_eos_device.py @@ -237,8 +237,10 @@ def test_file_copy(self, mock_open, mock_close, mock_ssh, mock_ft): mock_ft_instance.check_file_exists.side_effect = [False, True] self.device.file_copy("path/to/source_file") - mock_ft.assert_called_with(self.device.native_ssh, "path/to/source_file", "source_file", file_system="flash:") - mock_ft_instance.enable_scp.assert_any_call() + mock_ft.assert_called_with( + self.device.native_ssh, "path/to/source_file", "source_file", file_system="/mnt/flash" + ) + # mock_ft_instance.enable_scp.assert_any_call() mock_ft_instance.establish_scp_conn.assert_any_call() mock_ft_instance.transfer_file.assert_any_call() @@ -255,8 +257,8 @@ def test_file_copy_different_dest(self, mock_open, mock_close, mock_ssh, mock_ft mock_ft_instance.check_file_exists.side_effect = [False, True] self.device.file_copy("source_file", "dest_file") - mock_ft.assert_called_with(self.device.native_ssh, "source_file", "dest_file", file_system="flash:") - mock_ft_instance.enable_scp.assert_any_call() + mock_ft.assert_called_with(self.device.native_ssh, "source_file", "dest_file", file_system="/mnt/flash") + # mock_ft_instance.enable_scp.assert_any_call() mock_ft_instance.establish_scp_conn.assert_any_call() mock_ft_instance.transfer_file.assert_any_call() @@ -289,7 +291,7 @@ def test_set_boot_options(self): [{"result": {"output": "flash:"}}], [{"result": {"output": "new_image.swi"}}], [{"result": {}}], - [{"result": {"softwareImage": "flash:new_image.swi"}}], + [{"result": {"softwareImage": "flash:/new_image.swi"}}], ] calls = [ mock.call(["dir"], encoding="text"),