CML2 Plugin: Enhanced pyATS integration with CML2 (Cisco Modeling Labs) #110
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR provides a comprehensive CML2 (Cisco Modeling Labs 2) plugin for pyATS that enables automatic lab creation, management, and device connectivity from pyATS testbed definitions.
Features
Core Functionality
CLI Arguments
--cml2-enable--cml2-url--cml2-username--cml2-password--cml2-keep-labPlatform Support
Automatic platform inference and node definition mapping for:
Default Credentials
Automatic application of CML2 default credentials based on node definition:
genie.testbed.load()Link Verification
RuntimeErrorif expected links are missingTopology Summary Display
Displays comprehensive lab topology information before
pre_jobcompletion:Implementation Details
Key Methods
CML2LabBuilder.build()- Creates CML2 lab from testbedCML2LabBuilder.verify_links()- Validates lab link topologyCML2Plugin.pre_job()- Handles lab creation and startupCML2Plugin.post_job()- Handles lab cleanupCML2Plugin._update_testbed_in_place()- Updates testbed with CML2 infoCML2Plugin._display_topology_summary()- Shows topology summaryHelper Functions
infer_platform()- Infers CML2 platform from device attributesget_node_definition()- Maps platform to CML2 node definitionFiles Changed
src/pyats/contrib/plugins/cml2_plugin/cml2.pyTesting
Usage Example
pyats run job my_job.py \ --testbed-file testbed.yaml \ --cml2-enable \ --cml2-url https://cml2-server/ \ --cml2-username admin \ --cml2-password 'password' \ --cml2-keep-lab