Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Scrapli 'core' and platform migration [part 1] (#306)
* Implement Scrapli 'core' and platform migration (#297) * AOS-CX: Update CPU and MEM values for newer versions (#294) Co-authored-by: Stefano Sasso <stefano.sasso@hpe.com> * backdoor to reset VR or specific VMs (#285) * backdoor to reset VR * option to reset specific VMs * give ocnos some time to boot in the login routine (#295) * Add vrnetlab base image * Add `cidfile` to gitignore * Implement Scrapli - Implement scrapli for telnet console and qemu monitor - Add scrapli for core funcs (wait_write, read_until, expect) - Add conditional use of scrapli via 'use_scrapli' var. Default is disabled - Add colours to logging - Log env vars - Log if transparent mgmt intf is in use - Log if scrapli is in use - Log overlay image creation - Log defined SMP and RAM * cat8kv: Migrate to Scrapli - Use Scrapli IOSXEDriver for config - Update install VM var name to 'cat8kv' from 'csr' - Fix installer class init so overlay image is only created once * cat9kv: Migrate to Scrapli - Remove license check - Send bootstrap config via day0/CVAC config (mounted file to cdrom) - Send startup config via Scrapli IOSXEDriver * csr1kv: Migrate to Scrapli - Use Scrapli IOSXEDriver for sending bootstrap and startup configs * xrv: Migrate to Scrapli - Use Scrapli IOSXRDriver to send bootstrap and startup configs * xrv: Add convert-image target in Makefile - Converts the qcow2 image into required vmdk format for vrnetlab via qemu-img. * xrv9k: Migrate to Scrapli - Use Scrapli IOSXRDriver for bootstrap and startup configs - Change class names to 'XRv9k' instead of 'XRv' - Explicitly wait for SDR baking to complete in install process - Remove call home/LC check * xrv: Remove env var printing * n9kv: Migrate to Scrapli - Use NXOSDriver for bootstrap and startup configs * nxos: Migrate to Scrapli - Use NXOSDriver for bootstrap and startup configs * vios: Migrate to Scrapli - Use IOSXEDriver for bootstrap and startup configs * vrnetlab: Support scrapli qemu monitor option for VM reset * vrnetlab: Move logging colour config outside of class init method * cat8kv: Fix logger warning (log.warning -> logger.warning) * vrnetlab: Remove scrpali logging import * Cisco devices: Add/tweak configuration saving: - vios, csr, cat8kv, cat9kv -- add configuration saving - XRv, XRv9k -- log configuration saving * xrv, xrv9k: Return to root at end of bootstrap cfg * vrnetlab: add bool formatter func * sros: Migrate to Scrapli - Use scrapli community 'nokia_sros' platform - Remove wait_write clean_buffer override - Check if tftpboot conifg exists *before* opening Scrapli connection - Log command outputs with 'DEBUG_SCRAPLI' env var (defaults to false) * Use kaelemc/scrapli_community in base image * Disable eager mode for config saving on Cisco devices * cat8kv: Migrate to CVAC configuration * cat8kv: add log message and block while generating cfg ISO * cat9kv: Migrate startup config to CVAC * Remove erroneous Scrapli Community submodule * sros: fix typos for classic CLI * csr: Migrate to CVAC * Switch back to scrapli/scrapli-community * added uv lock/venv and env file for pylance resolve sequence (#303) * added uv dep for scrapli * use ruff formatting * update base image with pinned scrapli community * close sros driver connection to invoke on_exit commands (quit-config) * added local deps * use uv in the base image * ruff formatting * use single const for scrapli timeout * Close the commandeered connection so the on close actions are run * Connection error log type from info->error * extracting image edit * persist bof and config after bootstrap config is applied and close sros con regardless if config was provided or not * Configure scrapli variant if startup config is classic If the startup-configuration provided is classic then the default configuration engine will be set to classic mode. In this case the scrapli device variant should also be set to classic so the scrapli magic can do it's thing with the correct prompt matching. * Use a global var to determine when to send classic configs As classic startup configurations are now supported for MD-CLI defaulting versions, the classic CLI will mean the default config engine is classic on node boot. In this commit all logic that determined when to send/not send config for classic versions is now replaced with a single 'classic_cfg' global variable. Most of the logic across the code had repeated statements checking if the version was <= 22 or magc. 'classic_cfg' is set to True in this case. Else it is False. * Use explicit `quit-config` and move persistBofAndConfig back to end of bootstrap. * Don't enforce MD-CLI on versions older than 19.x --------- Co-authored-by: Stefano Sasso <852093+ssasso@users.noreply.github.com> Co-authored-by: Stefano Sasso <stefano.sasso@hpe.com> Co-authored-by: João Machado <63718541+jcpvdm@users.noreply.github.com> Co-authored-by: Roman Dodin <dodin.roman@gmail.com> * Resolve merge conflicts for #306 (#311) * AOS-CX: Update CPU and MEM values for newer versions (#294) Co-authored-by: Stefano Sasso <stefano.sasso@hpe.com> * backdoor to reset VR or specific VMs (#285) * backdoor to reset VR * option to reset specific VMs * give ocnos some time to boot in the login routine (#295) * Fix mgmt route VRF name on cat9kv (#296) * fix vmx dockerfile * vJunos-EVO: remove error in init file that prevents loading it (#301) * Fix routeros (#302) * update ubuntu version for routeros * change base image --------- Co-authored-by: Félix Gaudin <felix.gaudin@inmanta.com> * Fix for OcNOS 6.5.2-101 (#300) * Add Cisco vIOS L2 support (#299) * update veos for bookworm * added uv lock/venv and env file for pylance resolve sequence (#303) * Update Dockerfile to install qemu-utils (#304) * AOS-CX: Update base image and cpu (#305) * Update vqfx Makefile (#289) * Update Makefile In the last line is calling the variable $(VR_NAME) but it wasn't defined before so i update the variable NAME to VR_NAME * try vqfx with the common workflow * Revert "try vqfx with the common workflow" This reverts commit c1f8866. --------- Co-authored-by: Roman Dodin <dodin.roman@gmail.com> * lowercase things * update vqfx base image * bump num nics (#308) --------- Co-authored-by: Stefano Sasso <852093+ssasso@users.noreply.github.com> Co-authored-by: Stefano Sasso <stefano.sasso@hpe.com> Co-authored-by: João Machado <63718541+jcpvdm@users.noreply.github.com> Co-authored-by: Roman Dodin <dodin.roman@gmail.com> Co-authored-by: FelixGaudin <44848675+FelixGaudin@users.noreply.github.com> Co-authored-by: Félix Gaudin <felix.gaudin@inmanta.com> Co-authored-by: Xinyu Wei <xinyuwe@cisco.com> Co-authored-by: Thomas Balzer <65245605+tjbalzer@users.noreply.github.com> Co-authored-by: tdebruyn <5540603+tdebruyn@users.noreply.github.com> Co-authored-by: Voyageur <167977253+Zegroj@users.noreply.github.com> * Merge conflicts #2 (#313) * AOS-CX: Update CPU and MEM values for newer versions (#294) Co-authored-by: Stefano Sasso <stefano.sasso@hpe.com> * backdoor to reset VR or specific VMs (#285) * backdoor to reset VR * option to reset specific VMs * give ocnos some time to boot in the login routine (#295) * Fix mgmt route VRF name on cat9kv (#296) * fix vmx dockerfile * vJunos-EVO: remove error in init file that prevents loading it (#301) * Fix routeros (#302) * update ubuntu version for routeros * change base image --------- Co-authored-by: Félix Gaudin <felix.gaudin@inmanta.com> * Fix for OcNOS 6.5.2-101 (#300) * Add Cisco vIOS L2 support (#299) * update veos for bookworm * added uv lock/venv and env file for pylance resolve sequence (#303) * Update Dockerfile to install qemu-utils (#304) * AOS-CX: Update base image and cpu (#305) * Update vqfx Makefile (#289) * Update Makefile In the last line is calling the variable $(VR_NAME) but it wasn't defined before so i update the variable NAME to VR_NAME * try vqfx with the common workflow * Revert "try vqfx with the common workflow" This reverts commit c1f8866. --------- Co-authored-by: Roman Dodin <dodin.roman@gmail.com> * lowercase things * update vqfx base image * bump num nics (#308) * DHCP and static MAC support for management interface (#310) * common/vrnetlab.py: added DHCP support for management interface If CLAB_MGMT_DHCP environment variable is set, we assume that a DHCP client inside of the VM will take care about setting the management IP and gateway. From the implementation point of view the IPv4 and IPv6 addresses and gateways are simply set to 'dhcp', and the platform specific `launch.py` script needs to check it to decide if the interface needs to be configured manually or to to enable dhcp (if not enabled by default). The initial implementation has been tested with Broadcom Enterprise SONiC 4.4.0 using the "dell_sonic" kind (which actually is a rebranded Broadcom SONiC). The primary focus is the ability to test the Zero Touch Provisioning feature of SONiC but could also be used for testing PXE boot scenarios of other systems using containerlab. Note: This feature is only working when CLAB_MGMT_PASSTHROUGH is true. The feature needs to be defined explicitely within the node configuration like this: -------------------------------- env: CLAB_MGMT_PASSTHROUGH: "true" CLAB_MGMT_DHCP: "true" -------------------------------- * dell_sonic: changed to check if dhcp is enabled for the management interface Manually set IPv4/IPv6 addresses and gateways only if dhcp is not enabled. * common/vrnetlab.py: added get_mgmt_mac method to VM class get_mgmt_mac() checks for the environment variable 'CLAB_MGMT_MAC' which can be used to provide a static MAC address for the management interface. If there is no static MAC address set the former behavior is preserved by calling gen_mac(0) generating a MAC address. * vrnetlab: Refactor mgmt MAC generation, handle exceptions for CSR1000v/ROS/SROS * compresss env var based var assignment --------- Co-authored-by: vista <vista@birb.network> Co-authored-by: Roman Dodin <dodin.roman@gmail.com> --------- Co-authored-by: Stefano Sasso <852093+ssasso@users.noreply.github.com> Co-authored-by: Stefano Sasso <stefano.sasso@hpe.com> Co-authored-by: João Machado <63718541+jcpvdm@users.noreply.github.com> Co-authored-by: Roman Dodin <dodin.roman@gmail.com> Co-authored-by: FelixGaudin <44848675+FelixGaudin@users.noreply.github.com> Co-authored-by: Félix Gaudin <felix.gaudin@inmanta.com> Co-authored-by: Xinyu Wei <xinyuwe@cisco.com> Co-authored-by: Thomas Balzer <65245605+tjbalzer@users.noreply.github.com> Co-authored-by: tdebruyn <5540603+tdebruyn@users.noreply.github.com> Co-authored-by: Voyageur <167977253+Zegroj@users.noreply.github.com> Co-authored-by: Christian Wiese <morfoh@opensde.org> Co-authored-by: vista <vista@birb.network> * remove doubled func --------- Co-authored-by: Kaelem Chandra <kc@kaelem.net> Co-authored-by: Stefano Sasso <852093+ssasso@users.noreply.github.com> Co-authored-by: Stefano Sasso <stefano.sasso@hpe.com> Co-authored-by: João Machado <63718541+jcpvdm@users.noreply.github.com> Co-authored-by: FelixGaudin <44848675+FelixGaudin@users.noreply.github.com> Co-authored-by: Félix Gaudin <felix.gaudin@inmanta.com> Co-authored-by: Xinyu Wei <xinyuwe@cisco.com> Co-authored-by: Thomas Balzer <65245605+tjbalzer@users.noreply.github.com> Co-authored-by: tdebruyn <5540603+tdebruyn@users.noreply.github.com> Co-authored-by: Voyageur <167977253+Zegroj@users.noreply.github.com> Co-authored-by: Christian Wiese <morfoh@opensde.org> Co-authored-by: vista <vista@birb.network>
- Loading branch information