Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First templating tests #62

Merged
merged 81 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
4e634ac
init templates
ankudinov Nov 14, 2024
6b2cdf8
fix vars in post gen hook
ankudinov Nov 14, 2024
5e1dc41
fix clab version
ankudinov Nov 14, 2024
b419681
update templates
ankudinov Nov 14, 2024
d6e5af8
add cv_api_token_required
ankudinov Nov 14, 2024
fd59d76
add more templates
ankudinov Nov 14, 2024
c0bdd6f
fix readme template
ankudinov Nov 14, 2024
2ea897f
fix ceos-lab version
ankudinov Nov 14, 2024
c812c73
add more templates
ankudinov Nov 15, 2024
071baee
add more templates
ankudinov Nov 15, 2024
05d7fdd
update templates
ankudinov Nov 15, 2024
ba4c023
update templates
ankudinov Nov 15, 2024
eb31193
update lab description section
ankudinov Nov 15, 2024
5e18c19
trim whitespaces
ankudinov Nov 15, 2024
4f08dd3
template updates
ankudinov Nov 15, 2024
dc026b7
conditional marp slides links
ankudinov Nov 15, 2024
9f4204c
j2 and whitespaces
ankudinov Nov 15, 2024
957ab22
update templates
ankudinov Nov 15, 2024
be44a74
update how to run
ankudinov Nov 15, 2024
7f65321
init slides dir
ankudinov Nov 15, 2024
cdaa208
init slide template
ankudinov Nov 15, 2024
b4ada54
update slides template
ankudinov Nov 15, 2024
7237e8d
move and add assets
ankudinov Nov 15, 2024
dc65756
update slide templates
ankudinov Nov 15, 2024
4906894
add make inspect
ankudinov Nov 17, 2024
307eb49
add ansible.cfg template
ankudinov Nov 17, 2024
f9e8a5f
fix ansible.cfg template
ankudinov Nov 17, 2024
c1600dc
conditional avd inventory
ankudinov Nov 17, 2024
5be474c
add playbook templates
ankudinov Nov 17, 2024
b848b2c
add slides and lab archives to forks
ankudinov Nov 17, 2024
8e60219
fix cc.py code
ankudinov Nov 18, 2024
2653c45
update pages build workflow
ankudinov Nov 18, 2024
5e5e66c
add avd inventory and docs
ankudinov Nov 18, 2024
fd88953
fix slides img path
ankudinov Nov 18, 2024
8298508
create assets dir
ankudinov Nov 18, 2024
bedab9c
fix lab download
ankudinov Nov 18, 2024
527bcf5
fix tar directory
ankudinov Nov 18, 2024
7538685
fix tar path
ankudinov Nov 18, 2024
36186e1
move -C (directory) option
ankudinov Nov 18, 2024
e5e502b
fix tar again
ankudinov Nov 18, 2024
8c2c845
add mkdocs section
ankudinov Nov 18, 2024
318e165
change demos to labs
ankudinov Nov 18, 2024
69fafb5
fix topology
ankudinov Nov 18, 2024
55e120c
add ceos-lab
ankudinov Nov 18, 2024
7932832
fix extras indent
ankudinov Nov 18, 2024
033ab89
update makefile template
ankudinov Nov 18, 2024
3269cfc
remove data conversion mode
ankudinov Nov 19, 2024
bc29ce0
add evpn_vlan_bundles
ankudinov Nov 19, 2024
2ea91f0
remove use anta
ankudinov Nov 19, 2024
1d4c389
fix clab topology
ankudinov Nov 19, 2024
7796807
move telemetry
ankudinov Nov 19, 2024
698c930
add nbsp
ankudinov Nov 19, 2024
9fa8697
update templates and docs
ankudinov Nov 19, 2024
76d5377
add slides
ankudinov Nov 19, 2024
43cd2d4
add make tags
ankudinov Nov 19, 2024
b5a0788
update init configs
ankudinov Nov 19, 2024
cef4a71
add addAliases.sh
ankudinov Nov 19, 2024
78ec4a2
fix path
ankudinov Nov 19, 2024
ccf26a1
.
ankudinov Nov 19, 2024
162ca1a
update onCreate
ankudinov Nov 19, 2024
56eda8c
delete cc templates
ankudinov Nov 25, 2024
ae0293d
add copier templates
ankudinov Nov 25, 2024
ad271ff
update container
ankudinov Nov 25, 2024
459efbd
temporary switch to fork container
ankudinov Nov 25, 2024
53e9eb7
move csvs
ankudinov Nov 25, 2024
96e6758
exclude more dirs
ankudinov Nov 25, 2024
bff562f
fix exclude in grep
ankudinov Nov 25, 2024
0a5a181
fix grep exclude in the main publish workflow
ankudinov Nov 25, 2024
da5c75f
rename handwritten templates
ankudinov Nov 25, 2024
6545114
fix issue with handwritten templates
ankudinov Nov 25, 2024
e0932cc
update templates and cvaas evpn mlag
ankudinov Nov 25, 2024
0a21c35
minor fixes and changes
ankudinov Nov 25, 2024
4995145
fix readme template
ankudinov Nov 25, 2024
55f4551
remove handwritten logic
ankudinov Nov 25, 2024
1814191
add _message_after_copy
ankudinov Nov 25, 2024
46d3875
fix numbering
ankudinov Nov 26, 2024
7f58265
add note about make deploy
ankudinov Nov 26, 2024
2d3b60e
update avd stars and contributors
ankudinov Nov 26, 2024
9f15187
update template and docs for cvaas mlag
ankudinov Nov 26, 2024
203dd47
add lab inventory
ankudinov Nov 26, 2024
4315eb6
switch back to ghcr.io/aristanetworks/aclabs/dev:latest
ankudinov Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .cp/_macros/slugify.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{# slugify names to make unique lab ids -#}
{% macro slugify(value) -%}
{{ value|lower|replace(' ', '-')|replace('.','-')|replace(',','-')|replace('[','')|replace(']','') }}
{%- endmacro %}
181 changes: 181 additions & 0 deletions .cp/copier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
---
_jinja_extensions:
- copier_templates_extensions.TemplateExtensionLoader
- extensions/issubset.py:SubsetExtension
- extensions/_in.py:InExtension

_exclude:
- extra-vars
- extensions
- _macros
- include
- copier.yml
# exclude handwritten files copied by python script
- handwritten/docs
- handwritten/slides

lab_name:
type: str
help: |
lab_name:
The name of the lab. Can be any string without line breaks.
default: "A New Lab"

lab_group:
type: str
help: |
lab_group:
A short string used to create a MkDocs tab.
Use existing categories if possible.
default: "unsorted"

lab_slug:
type: str
help: |
lab_slug:
The formatted name for the lab that will be used to create directory prefixes.
default: "{{lab_group|lower()}}-{% from '_macros/slugify.jinja' import slugify %}{{ slugify(lab_name) }}"
when: false # do not prompt

templates:
type: str
multiselect: True
help: |
templates:
Select the templates you want to use.
choices:
- lab
- docs
- slides

lab_features:
type: str
multiselect: True
help: Please select required lab features
when: "{{ 'lab' | _in(templates) }}"
choices:
- avd
- cvaas
- git
- slides
- addAliases

lab_author:
type: str
help: Please enter the lab author name.
default: Petr Ankudinov
when: "{{ 'docs' | _in(templates) }}"

python_version:
type: str
help: Please pick required Python version.
when: "{{ 'lab' | _in(templates) }}"
choices: ["3.11", "3.12", "3.13"]

avd_version:
type: str
help: Pick required AVD version.
when: "{{ 'lab' | _in(templates) }}"
choices: ["5.0.0", "4.10.2"]

lab_container_revision:
type: str
help: Please select lab container revision.
choices: ["1.1"]
default: "1.1"
when: false # no need to display this question due to a single choice

container_size:
help: |
container_size:
The size of the container to be used for the lab.
when: "{{ 'lab,docs' | _in(templates) }}"
choices: [
{"cpus": 2, "memory": "8 GB", "storage": "32 GB"},
{"cpus": 4, "memory": "16 GB", "storage": "32 GB"},
{"cpus": 8, "memory": "32 GB", "storage": "64 GB"},
{"cpus": 16, "memory": "64 GB", "storage": "128 GB"},
{"cpus": 32, "memory": "128 GB", "storage": "128 GB"}
]

ceos_lab_version:
type: str
help: Please select the cEOS-lab version.
when: "{{ 'lab' | _in(templates) }}"
choices: ["4.32.3M"]

clab_version:
type: str
help: Please select the Containerlab version.
when: "{{ 'lab' | _in(templates) }}"
choices: ["0.59.0", "0.57.5"]

clab_user:
type: str
help: Username for all lab devices.
when: "{{ 'lab' | _in(templates) }}"
default: arista

clab_password:
type: str
help: Password for all lab devices.
when: "{{ 'lab' | _in(templates) }}"
default: arista

clab_mgmt_subnet:
type: str
help: Password for all lab devices.
when: "{{ 'lab' | _in(templates) }}"
default: "10.0.0.0"

clab_mgmt_mask:
type: str
help: Password for all lab devices.
when: "{{ 'lab' | _in(templates) }}"
default: "16"

clab_mgmt_gw:
type: str
help: Password for all lab devices.
when: "{{ 'lab' | _in(templates) }}"
default: "10.0.0.1"

marp_theme:
type: str
help: Please select the Marp theme.
when: "{{ 'slides' | _in(templates) }}"
choices: ["default", "beam", "jobs", "einstein"]

lab_topology:
type: str
help: Please select the lab topology you are going to use. Select `custom` if it's not standard.
when: "{{ 'docs' | _in(templates) }}"
choices: ["atd-l3ls", "minimalistic-l3ls-aa", "minimalistic-l3ls-mlag", "small-l3ls-aa", "small-l3ls-mlag", "custom"]

marp_class:
type: str
help: Please select the Marp class.
when: "{{ 'slides' | _in(templates) }}"
choices: ["none", "invert"]

validate_vars:
help: Verify answers provided by user.
validator: >-
{% if not templates %}
ERROR: `templates` variable is mandatory!
{% endif %}

_message_after_copy: |
Copier successfully generated {{ templates }} files for "{{ lab_name }}"".
Please review them before committing.

Before testing a new lab on your fork, please check if all container images were created.
Go to the `Actions` section of your fork and trigger required container build workflows manually if required.

If you generated a new Markdown document for MkDocs, please do not forget to reference it in the 'nav' section of 'mkdocs.yml'

Example:

nav:
- {{ lab_group }}:
- {{ lab_name }}: {{ lab_slug }}.md
13 changes: 13 additions & 0 deletions .cp/extensions/_in.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from jinja2.ext import Extension

def _in(value, a_longer_list):
return_value = False
for v in value.split(','):
if v in a_longer_list:
return_value = True
return return_value

class InExtension(Extension):
def __init__(self, environment):
super().__init__(environment)
environment.filters["_in"] = _in
9 changes: 9 additions & 0 deletions .cp/extensions/issubset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from jinja2.ext import Extension

def issubset(value, a_longer_list):
return set(value).issubset(set(a_longer_list))

class SubsetExtension(Extension):
def __init__(self, environment):
super().__init__(environment)
environment.filters["issubset"] = issubset
Loading