{"id":13715177,"url":"https://github.com/netreplica/templates","last_synced_at":"2026-03-04T19:03:01.181Z","repository":{"id":149901237,"uuid":"618906993","full_name":"netreplica/templates","owner":"netreplica","description":"Templates for Emulated Network Topologies","archived":false,"fork":false,"pushed_at":"2025-07-04T02:28:44.000Z","size":114,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-04T02:35:21.033Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/netreplica.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-25T17:37:24.000Z","updated_at":"2024-03-14T04:35:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"3588aeb2-0589-4707-a630-440a287015b8","html_url":"https://github.com/netreplica/templates","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/netreplica/templates","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netreplica%2Ftemplates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netreplica%2Ftemplates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netreplica%2Ftemplates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netreplica%2Ftemplates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netreplica","download_url":"https://codeload.github.com/netreplica/templates/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netreplica%2Ftemplates/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30090038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T18:31:08.343Z","status":"ssl_error","status_checked_at":"2026-03-04T18:31:07.708Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T00:00:55.329Z","updated_at":"2026-03-04T19:03:01.169Z","avatar_url":"https://github.com/netreplica.png","language":"Jinja","funding_links":[],"categories":["Configuration directory"],"sub_categories":[],"readme":"[![Discord](https://img.shields.io/discord/1075106069862416525?label=discord)](https://discord.gg/M2SkgSdKht)\n\n# Netreplica Templates to build Emulated Network Topologies\n\nWe created this repository as a collection of templates for [netreplica nrx](https://github.com/netreplica/nrx/blob/main/README.md) software. It might be useful outside of **nrx** for any other effort to automate creation of software network labs.\n\nThis repository provides a set of such templates as a starting point. You're welcome to clone and adopt to your needs. If you'd like to contribute back, it would be greatly appreciated.\n\nIf you have any feedback, questions or suggestions, please reach out to us via the Netreplica Discord server linked above, [#netreplica](https://netdev-community.slack.com/archives/C054GKBC4LB) channel in NetDev Community on Slack, or open a github issue in this repository.\n\n# Supported formats\n\n* [Containerlab](https://containerlab.dev/) – Open-source network emulation software using containers.\n* [Nvidia Air](https://docs.nvidia.com/networking-ethernet-software/nvidia-air/) - Cloud-hosted, data center emulation platform from Nvidia.\n* [Cisco Modeling Labs](https://developer.cisco.com/modeling-labs/) - Commercial network emulation software from Cisco.\n* [Graphite](https://github.com/netreplica/graphite) - Network topology visualization software from Netreplica.\n* [D2](https://d2lang.com/) – Declarative diagramming language.\n* **nrx** software also supports user-provided formats. You can [extend](docs/output_formats.md) this repository with your own set of templates.\n\n# What is included\n\n| Platform                 | Containerlab                                              | Nvidia Air                                         | CML                                                | Interface Mapping                                     | Startup Config |\n| --------------           | ------------                                              | --------                                           | --------                                           |  --------                                             | -------------- |\n| Arista EOS               | [`ceos`             ](clab/nodes/ceos.j2)                 | `no`                                               | `no`                                               | [Interface Map](clab/interface_maps/ceos.j2)          | `clab`         |\n| Cisco CSR1000v           | [`vr-cisco_csr1000v`](clab/nodes/vr-cisco_csr1000v.j2)    | `no`                                               | `no`                                               | Not supported                                         | `clab`         |\n| Cisco IOSv               | `no`                                                      | `no`                                               | [`iosv`                  ](cml/nodes/iosv.j2)      | [CML Node Template](cml/nodes/iosv.j2)                | `cml`          |\n| Cisco IOSvL2             | `no`                                                      | `no`                                               | [`iosvl2`                ](cml/nodes/iosvl2.j2)    | [CML Node Template](cml/nodes/iosvl2.j2)              | `cml`          |\n| Cisco NX-OSv9000         | `no`                                                      | `no`                                               | [`nxosv9000`             ](cml/nodes/nxosv9000.j2) | [CML Node Template](cml/nodes/nxosv9000.j2)           | `cml`          |\n| Cumulus                  | `no`                                                      | [`cumulus-vx`            ](air/nodes/default.j2)   | `no`                                               | Air                                                   | wanted         |\n| Linux                    | [`linux`            ](clab/nodes/linux.j2)                | `no`                                               | `no`                                               | Not supported                                         | wanted         |\n| [RARE/freeRtr][freertr]  | [`rare`             ](clab/nodes/rare.j2)                 | `no`                                               | `no`                                               | Not supported                                         | wanted         |\n| Nokia SR-Linux           | [`srl`              ](clab/nodes/srl.j2)                  | `no`                                               | `no`                                               | [Clab Interface Naming](clab/interface_names/srl.j2)  | `clab`         |\n| SONiC                    | [`sonic-vs`         ](clab/nodes/sonic-vs.j2)             | [`sonic-vs`              ](air/nodes/default.j2)   | `no`                                               | Air                                                   | wanted         |\n| Ubuntu                   | `ubuntu` -\u003e [`linux`](clab/nodes/linux.j2)                | [`ubuntu`                ](air/nodes/default.j2)   | [`ubuntu`                ](cml/nodes/ubuntu.j2)    | Air                                                   | wanted         |\n| Default                  | `default` -\u003e [`linux`](clab/nodes/linux.j2)               | `default` -\u003e [`ubuntu`   ](air/nodes/default.j2)   | `default` -\u003e [`iosvl2`   ](cml/nodes/iosvl2.j2)    | Not supported                                         | n/a            |\n\n# Template naming convention\n\nContainerlab artifacts:\n\n* [`clab/topology.j2`](clab/topology.j2): template for the final Containerlab topology file.\n* [`clab/nodes/\u003ckind\u003e.j2`](clab/nodes/): templates for individual device node entries in the topology file. Unique for each `kind`.\n* [`clab/nodes/default.j2`](clab/nodes/default.j2): default node template used when a template for a specific `kind` is not found.\n* [`clab/interface_names/\u003ckind\u003e.j2`](clab/interface_names/): templates for generating emulated interface names used by a specific `kind`.\n* [`clab/interface_names/default.j2`](clab/interface_names/default.j2): default template for generating emulated interface names.\n* [`clab/interface_maps/\u003ckind\u003e.j2`](clab/interface_maps/): templates for mapping between real interface names and emulated interface names used by the `kind`. Only a few `kinds` like [`ceos`](https://containerlab.dev/manual/kinds/ceos/#user-defined-interface-mapping) support such mapping.\n* [`clab/node_params.j2`](clab/node_params.j2): extended set of node parameters supported by all `kinds`. Always include this template at the end of each `clab/nodes/\u003ckind\u003e.j2` template to leverage these parameters. When some of the parameters needs to be rendered, define the values you need for each `kind` in [`platform_map.yaml`](platform_map.yaml).\n* [`clab/labels.j2`](clab/labels.j2): [custom labels](https://github.com/netreplica/graphite/blob/main/docs/LABELS.md) supported by Netreplica [Graphite](https://github.com/netreplica/graphite/) visualization software. Include this template at the end of the `clab/nodes/\u003ckind\u003e.j2` template to initialize these labels with data from NetBox.\n\nNvidia Air artifacts:\n\n* [`air/topology.j2`](air/topology.j2): template for the final Air topology file in JSON format.\n* [`air/nodes/default.j2`](air/nodes/default.j2): default node template, suitable for most types of OS variants.\n* [`air/interface_names/default.j2`](air/interface_names/default.j2): default template for generating emulated interface names.\n* [`air/node_params.j2`](air/node_params.j2): extended set of node parameters supported by all OS variants. When some of the parameters needs to be rendered, define the values you need for each `kind` in [`platform_map.yaml`](platform_map.yaml).\n\nCisco Modeling Labs artifacts:\n\n* `cml/topology.j2`: template for the final CML topology file.\n* `cml/nodes/\u003ckind\u003e.j2`: templates for individual CML node entries in the topology file.\n* `cml/interface_names/\u003ckind\u003e.j2`: templates for generating emulated interface names used by the NOS `kind` in CML.\n* `cml/configs/\u003cfamily\u003e.j2`: templates for embedding startup configuration in the topology file. Use `\u003cfamily\u003e` to denote NOS family like `ios`, `nxos`, etc.\n\nTo customize the way a topology file should be generated, first look if you can do that by redefining paramters in [`platform_map.yaml`](./platform_map.yaml). For example, you might want to modify `image` values depending on the `kind`. For more complicated changes, modify the J2 templates. You can also add new templates, if the platforms you have are not covered by the provided set of templates. Containerlab supports a long list of [kinds](https://containerlab.dev/manual/kinds/), and you can add templates for any of them. See the section below for more details on how to do that.\n\n# How to add a new template\n\n## Clone the repository\n\nSuppose you want to add a set of templates for a new node kind. The first step is to clone this repository:\n\n```Shell\ngit clone https://github.com/netreplica/templates.git\n```\n\n\u003e Note, if you would like to contribute your templates back to the community, please [fork](https://github.com/netreplica/templates/fork) the repository first and then clone the fork instead.\n\nAs a practical example, let's create templates for Containerlab `sonic-vs` kind. This kind represents [SONiC](https://sonic-net.github.io/SONiC/) open-source NOS.\n\nAs a next step, let's create a new development branch, for example `new-clab-kind-sonic-vs`:\n\n```Shell\ncd templates\ngit checkout -b new-clab-kind-sonic-vs\n```\n\n## Create a template under `nodes`\n\nNow, we need to create a template called `sonic-vs.j2` under `clab/nodes` directory:\n* `nrx` will pass the name of the node to the template as `name` variable\n* According to [documentation](https://containerlab.dev/manual/kinds/sonic-vs/), we should use `kind: sonic-vs` to describe SONiC nodes\n* As the Docker image tag let's use a generic `sonic-vs:latest`. We will initialize the `image` variable here as part of a conditional statement to allow overriding it with a different value\n* Including [`clab/node_params.j2`](clab/node_params.j2) provides a way to extend the node template with some common parameters, like `image` or `startup-config`. See the file for the full list of parameters.\n* Including [`clab/labels.j2`](clab/labels.j2) will add a few useful custom labels, like `graph-level` to [visually align](https://github.com/netreplica/graphite/blob/main/docs/CONTAINERLAB.md#improve-visualization-via-custom-labels-in-a-containerlab-yaml-file) nodes when showing the topology in [Graphite](https://github.com/netreplica/graphite)\n\n```Yaml\ncat \u003e clab/nodes/sonic-vs.j2 \u003c\u003c EOF\n        {{ name }}:\n            kind: sonic-vs\n            {% if image is not defined %}\n            {% set image = \"sonic-vs:latest\" %}\n            {% endif %}\n            {% include 'clab/node_params.j2' %}\n            {% include 'clab/labels.j2' %}\nEOF\n```\n\n## Create a template under `interface_names`\n\nThe next step is to create another template – for interface naming. Some Containerlab node kinds, like `srl`, use special naming conventions for interfaces. In case of `sonic-vs`, the [interface naming convention](https://containerlab.dev/manual/kinds/sonic-vs/#interfaces-mapping) uses default linux-based interface names. As there is already a [`default.j2`](clab/interface_names/default.j2) template for this naming convention, we don't need to add any templates here.\n\nIf the interface naming convention for the kind you are adding follows different rules, you will need to create a custom template for that kind. See [`srl.j2`](clab/interface_names/srl.j2) as an example. `nrx` passed the following variables to the interface naming templates you can leverage:\n* `interface` – original interface name exported from NetBox\n* `index` – position of the interface in the list of exported interfaces for this node, sorted by name\n\n\u003e It is possible that some interface naming conventions cannot be created using current set of variables. Consider creating a [Feature Request](https://github.com/netreplica/nrx/issues/new) for `nrx` to support such a kind.\n\n## Check NetBox `platform.slug` values\n\nNow that you created the template files, check relevant Device records in NetBox – specifically, what Platform is used in their configuration. If no Platform is configured currently, create a new Platform record that would describe NOS used on these devices. In our example, we should create a Platform record for SONiC NOS. Importing the CSV below into Platforms would do it:\n\n```CSV\nname,slug\nSONiC,sonic\n```\n\nNote, that although we used `sonic-vs` for our template names because this is how Containerlab identifies SONiC nodes, in NetBox you would typically use a `platform.name` and `platform.slug` that match NOS name on a physical device. For example, `eos` for Arista EOS, instead of `ceos` for Arista cEOSLab.\n\n## Update `platform_map.yaml`\n\nDifferent NetBox users may have very different Platform records. To support `platform.slug` values from your NetBox instance, we can map them to the kind `sonic-vs` using [`platform_map.yaml`](platform_map.yaml).\n\nFor our SONiC case, we need to map `sonic` to `sonic-vs`. Add the following entry to the `platform_map.yaml` under the `platforms` section:\n\n```Yaml\nplatforms:              # this line already exists, do not add it again\n  sonic:                # platform.slug value from NetBox\n    kinds:\n      clab: sonic-vs    # template name (kind) to use in Containerlab topologies\n```\n\nYou may also want to provide paths to the templates to be used for `sonic-vs` kind explicitly. If not provided, `nrx` will first look for `sonic-vs.j2` and then for `default.j2` files in the respective folders. The configuration below will tell `nrx` to skip looking for `sonic-vs.j2` when determining interface names, and use `default.j2` right away.\n\nYou can also override parameters used in the template. Most common example would be to use a different image tag. There is a [Docker image for SONiC](https://hub.docker.com/r/netreplica/docker-sonic-vs) hosted under [Netrepica Docker Hub](https://hub.docker.com/u/netreplica) with an image tag `netreplica/docker-sonic-vs:latest`, and this is what we are going to use.\n\n```Yaml\nkinds:                  # this line already exists, do not add it again\n  clab:                 # this line already exists, do not add it again\n    sonic-vs:           # kind value mapped under platforms section\n      nodes:            # template parameters used to render the nodes\n        template: clab/nodes/sonic-vs.j2\n        image: netreplica/docker-sonic-vs:latest\n      interface_names:  # template parameters used to render the interface names\n        template: clab/interface_names/default.j2\n```\n\n## Test your templates\n\nTime to test if your templates work as planned. It is recommended to export a topology from NetBox with devices you made the templates for into a `cyjs` file. This step doesn't actually require the templates to be present. Make sure to update API connection parameters in `nrx.conf`, as well as Device Roles to export:\n\n```Shell\ncd ..\nnrx.py --config nrx.conf --input netbox --site YOUR_SITE --output cyjs\n```\n\nNow you're ready to convert `cyjs` data into Containerlab topology using the new templates:\n\n```Shell\nnrx.py --input cyjs --file YOUR_SITE.cyjs --output clab --templates templates --debug\n```\n\nInspect resulting `YOUR_SITE.clab.yaml` and if looks good, try to deploy it with:\n\n```Shell\nsudo -E clab deploy -t YOUR_SITE.clab.yaml\n```\n\nYou might need to adjust your templates and run `nrx` again, using `cyjs` as input.\n\n## Commit your work\n\nOnce you are satisfied with the results, commit your work:\n\n```Shell\ncd templates\ngit add .\ngit commit -m \"new template for YOUR_DEVICE_PLATFORM\"\n```\n\nIn case your want to contribute your changes, create a Pull Request into [netreplica/templates](https://github.com/netreplica/templates/compare). Otherwise, just merge the development branch into the `main`:\n\n```Shell\ngit checkout main\ngit merge new-clab-kind-sonic-vs\n```\n\n# Copyright notice\n\nCopyright 2023, 2024, 2025 Netreplica Team\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n[freertr]: http://docs.freertr.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetreplica%2Ftemplates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetreplica%2Ftemplates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetreplica%2Ftemplates/lists"}