hellt / vrnetlab

Make VM-based Network OSes run in Containerlab
https://containerlab.dev
MIT License
129 stars 88 forks source link

Add support for Huawei NE40E #250

Closed rafabr closed 1 month ago

rafabr commented 2 months ago

This pull request introduces support for the Huawei NE40E router running Huawei Versatile Routing Platform (VRP) version 8. This image can be easily found on Huawei's official forum..

Key Changes:

Containerlab

Matching containerlab PR - https://github.com/srl-labs/containerlab/pull/2197

Discord

Discussion thread in discord

hellt commented 2 months ago

Thanks @rafabr I confirmed that this works. Did a few slight changes - simplified the sed expression to parse out the version and reused the gen_mgmt of a parent.

Again, thanks a lot for your contribution, I will add the necessary piece in containerlab to complete the integration

hellt commented 2 months ago

@rafabr I think I only need some help regarding the startup config syntax.

If I use the whole config file, then I see some errors during the apply:

2024-09-20 11:09:52,834: launch     TRACE    read from serial console: 'load configuration file containerlab.cfg merge
Line 16: 
icmp rate-limit disable
     ^
Error[1]'
2024-09-20 11:09:52,834: vrnetlab   DEBUG    writing to serial console: 'return'
2024-09-20 11:09:52,834: launch     TRACE    waiting for '>' on serial console
2024-09-20 11:09:54,158: launch     TRACE    read from serial console: ': Unrecognized command found at '^' position.

Line 32: 
 authentication-scheme default1
 ^
Error[1]: Unrecognized command found at '^' position.
rafabr commented 2 months ago

@hellt Thank you for the opportunity to contribute!

The full configuration shown by the router contains lines that are invalid as configuration commands, such as icmp rate-limit disable. Since we're using the merge option when loading the config file, the system processes the commands line by line, raising errors when it encounters invalid commands, but still applies the valid ones.

The alternative option is replace, which requires the user to provide the complete configuration file. I opted not to use this because, based on my understanding from the vSRX implementation, the expected behavior is for the user-provided config to run on top of the bootstrap config.

rafabr commented 2 months ago

An alternative approach would be to accept a different file format as input, with each line containing a command to be executed, and then loop through the lines using the wait_write function, similar to other implementations. This would remove the need for the SFTP step and prevent the reported errors. The expected file format would need to be documented.

rafabr commented 1 month ago

@hellt The startup_config function has been rewritten to resolve the reported errors. It now supports both partial and full configurations. Support for the CE12800 has also been added.

hellt commented 1 month ago

thanks a million, @rafabr merging this