Genie provides a very powerful ability to create mock devices so that you can run test without physical infrastructure. Quite often there's a lot of files that are generated during the mock creation process. The utilities in this repo helps build the mock files.
Referencing Hank Preston's DEVNET tutorial. The repo tutorial leverages the capabilities of Genie to use a mock device without the need to access physical infrastructure. More information can be found referencing the pyATS docs.
Genie1.1.py creates the commands to build the recordings. You'll need to update the device_list in the python file for your topology. You'll also need a base testbed.yaml file. I used VIRL to create my topology. VIRL can auto generate a testbed.yaml file; running virl generate pyats. If you don't use VIRL, you'll need to create this testbed. See the pyATS docs on how to do this. I've provided an example output from VIRL in the cp-testbeds directory.
The script create_testbed_mocks-1.2.py builds the testbeds yaml files after the recordings are built that you can use for your mocked environment.
For reference the outputs directory holds samples from the script outputs.
- Python 3
- I suggest (as a best practice) running in a virtual environment.
- run
pip install -r requirements.txt
- Build a topology in VIRL
- Run
virl auto generate pyatsto create the connectivity testbed yaml file. - Use Genie
learn allto create a baseline. You'll then need to make changes to your topology and rerungenie learn all, saving the output to different directories. See the above mentioned DevNet tutorial on how do to this. - Once you're done making changes and completed the learning phase, you'll need to start creating your mock devices. Update the
genie1.1.pyscript to reference your files. Comments are in the python script indicating the changes that might be required. Please note that thegenie1.1.pyscript doesn't actually run the commmands. It creates a text file that you can use to run these manually. - Next, edit the excel sheet in the
srcdirectory for your topology; save a.csvfile in MS-DOS format. Edit thecreate_testbed_mocks-1.2.pyto point to these files. - Refer back to the DevNet lab on how to use.
Note: The jinja2 templates are pretty rudimentary; there's probably better ways to do this... The templates are built to output proper yaml format, including spaces and line returns. If you edit these template files, please check your yaml output.