Skip to content

feat: support refresh command for latest FITELnet - #3871

Open
SeiyaFunaokaJP wants to merge 2 commits into
ktbyers:developfrom
SeiyaFunaokaJP:feat-fitelnet-refresh
Open

feat: support refresh command for latest FITELnet#3871
SeiyaFunaokaJP wants to merge 2 commits into
ktbyers:developfrom
SeiyaFunaokaJP:feat-fitelnet-refresh

Conversation

@SeiyaFunaokaJP

Copy link
Copy Markdown
Contributor

Summary

FITELnet routers keep an uncommitted candidate configuration (working.cfg) that has to be
applied before it becomes the running configuration (running.cfg). Depending on the model /
firmware, the CLI command that performs this is either commit or refresh.

The driver currently implements commit() only. On platforms where commit is not available,
users have to fall back to send_command("refresh") and re-implement the confirmation-prompt
handling and the FITELnet-specific error detection themselves.

This PR extracts the shared apply logic into a private helper and adds a refresh() method
next to the existing commit().

Testing

  • verification on a real device: FITELnet F220 / FITELnet vFX-R
  • Github CI (linters) failed because of below PYSEC. This is pre-existing on latest develop.
pyasn1 0.6.0   PYSEC-2026-3457 0.6.4  
pyasn1 0.6.0   PYSEC-2026-3456 0.6.4  
pyasn1 0.6.0   PYSEC-2026-3455 0.6.4  
sample code for testing Sample code
from netmiko import ConnectHandler

device = {
    'device_type': 'furukawa_fitelnet',
    'host': 'xxx',
    'username': 'xxx',
    'password': 'xxx',
    'secret': 'xxx',
}

conn = None
try:
    conn = ConnectHandler(**device)

    conn.send_config_set([
        "interface GigaEthernet 1/1",
        "no description"
    ])
    conn.refresh()
    
    conn.send_config_set([
        "interface GigaEthernet 1/1",
        "description TEST"
    ])

    print("--- Diff ---")
    output = conn.send_command('diff running.cfg working.cfg')
    print(output)

except Exception as e:
    print(f"error: {e}")

finally:
    conn.disconnect()

Result:

python .\sample2.py
--- Diff ---
1c1
< !  LAST EDIT    19:59:04 2026/05/17 by admin
---
> !  LAST EDIT    19:59:17 2026/05/17 by admin
94a95
>  description TEST
ruff and mypy pass log
ubuntu@ubuntu-Virtual-Machine:~/netmiko$ uv run --frozen ruff format --check .
345 files already formatted
ubuntu@ubuntu-Virtual-Machine:~/netmiko$ uv run --frozen ruff check .
All checks passed!
ubuntu@ubuntu-Virtual-Machine:~/netmiko$ uv run --frozen mypy netmiko/
Success: no issues found in 270 source files
ubuntu@ubuntu-Virtual-Machine:~/netmiko$ uv run --frozen pytest tests/unit
======================================= test session starts ========================================
platform linux -- Python 3.11.15, pytest-9.1.1, pluggy-1.6.0
rootdir: /home/ubuntu/netmiko
configfile: pyproject.toml
plugins: cov-4.1.0
collected 123 items                                                                                

tests/unit/test_base_connection.py ................................                          [ 26%]
tests/unit/test_clitools_helpers.py ..........                                               [ 34%]
tests/unit/test_clitools_outputters.py .......                                               [ 39%]
tests/unit/test_connection.py ....                                                           [ 43%]
tests/unit/test_encryption_hanlding.py ....                                                  [ 46%]
tests/unit/test_entry_points.py .                                                            [ 47%]
tests/unit/test_session_log.py ..........................                                    [ 68%]
tests/unit/test_ssh_autodetect.py .                                                          [ 69%]
tests/unit/test_utilities.py ..............s.......................                          [100%]

========================================= warnings summary =========================================
tests/unit/test_utilities.py::test_ntc_templates_discovery
  /home/ubuntu/netmiko/netmiko/utilities.py:321: DeprecationWarning: path is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
    with pkg_resources.path(package="ntc_templates", resource="parse.py") as posix_path:

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================== short test summary info ======================================
SKIPPED [1] tests/unit/test_utilities.py:331: ~/ntc-templates not found on this machine; please install ntc-templates into your home dir!
============================ 122 passed, 1 skipped, 1 warning in 10.07s ============================

@ktbyers

ktbyers commented Jul 23, 2026

Copy link
Copy Markdown
Owner

@SeiyaFunaokaJP Are there any documents from the vendor on this behavior?

"refresh" is a bit of a strange command here.

@ktbyers

ktbyers commented Jul 23, 2026

Copy link
Copy Markdown
Owner

@SeiyaFunaokaJP I have separately fixed the pyasn issue.

@SeiyaFunaokaJP

Copy link
Copy Markdown
Contributor Author

@ktbyers Thank you for reviewing.
'refresh' and 'commit' are completely same function.
Depending on the specific device model, the commit command is not supported.

test#commit

commit
 ^^^^^^
 % Invalid input detected at '^' marker.

test#refresh
 refresh ok?[y/N]:yes
 ....................Done

This is the vendor document. (There is not the English version)
https://www.furukawaelectric.com/fitelnet/f/man/70_220/pdf/cmd_refe_ope.pdf

translation:

2.9.4 commit/refresh
[Function] 
Applying configuration information during operation

[Input Format] 
commit [{ | ftp://[:]@/[#] [passive] | scp://@/[#] [{/ipv4 | /ipv6}]} [{append | load}]]refresh [{ [{append | load}] [moff] | ftp://[:]@/[#] [passive] [{append | load}] | scp://@/[#] [{/ipv4 | /ipv6}] [{append | load}]}]

refresh [{ [{append | load}] [moff] | ftp://[:]@/[#] [passive] [{append | load}] | scp://@/[#] [{/ipv4 | /ipv6}] [{append | load}]}]

[Operation Mode]
Privileged user mode (Command level 14), All configuration modes (Arguments cannot be specified)

[Description]
Applies changes to the active configuration information (current.cfg).In privileged user mode, if a file, FTP server, or SCP server is specified, the configuration information is read and applied simultaneously.When FTP is specified, file transfer is performed in binary mode.In each individual configuration mode, specifying a file, FTP server, or SCP server is not supported.If refresh or commit is executed when the number of configurations in working.cfg exceeds 90% of the maximum limit, or exceeds the maximum limit, a warning or error message will be output respectively (The values in parentheses indicate the current number of configurations / the maximum number of configurations).When an error message is output, the commit command will not be executed.
#commit
ERROR:'Tunnel mode ipsec' exceeds max configurations. (20001/20000)% Can not refresh

[Execution Example]
Applies changes to the active configuration information (current.cfg).
#commit

Workflow:
https://www.furukawaelectric.com/fitelnet/f/man/60/command-ope/operation/refresh.htm

running.cfg = Running configuration
working.cfg = Candidate configuration
boot.cfg = Startup configuration

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants