Skip to content

Commit

Permalink
Feat(avd_to_clab): Add support for SSH port mapping (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
titom73 authored May 27, 2022
1 parent 78ad6ad commit 6565ff8
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9021:443/tcp
- 7023:22/tcp
env:
TMODE: lacp
avd-agg02:
Expand All @@ -30,6 +31,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9022:443/tcp
- 7024:22/tcp
env:
TMODE: lacp
avd-l2leaf01:
Expand All @@ -41,6 +43,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9029:443/tcp
- 7021:22/tcp
env:
TMODE: lacp
avd-l2leaf02:
Expand All @@ -52,6 +55,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9030:443/tcp
- 7022:22/tcp
env:
TMODE: lacp
avd-bl01a:
Expand All @@ -63,6 +67,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9015:443/tcp
- 7017:22/tcp
env:
TMODE: lacp
avd-bl01b:
Expand All @@ -74,6 +79,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9016:443/tcp
- 7018:22/tcp
env:
TMODE: lacp
avd-cl01a:
Expand All @@ -85,6 +91,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9027:443/tcp
- 7019:22/tcp
env:
TMODE: lacp
avd-cl01b:
Expand All @@ -96,6 +103,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9028:443/tcp
- 7020:22/tcp
env:
TMODE: lacp
avd-leaf1a:
Expand All @@ -107,6 +115,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9011:443/tcp
- 7011:22/tcp
env:
TMODE: lacp
avd-leaf1b:
Expand All @@ -118,6 +127,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9012:443/tcp
- 7012:22/tcp
env:
TMODE: lacp
avd-leaf2a:
Expand All @@ -129,6 +139,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9013:443/tcp
- 7013:22/tcp
env:
TMODE: lacp
avd-leaf2b:
Expand All @@ -140,6 +151,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9014:443/tcp
- 7014:22/tcp
env:
TMODE: lacp
avd-leaf3a:
Expand All @@ -151,6 +163,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9017:443/tcp
- 7015:22/tcp
env:
TMODE: lacp
avd-leaf4a:
Expand All @@ -162,6 +175,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9018:443/tcp
- 7016:22/tcp
env:
TMODE: lacp
avd-rs01:
Expand All @@ -173,6 +187,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9033:443/tcp
- 10033:22/tcp
env:
TMODE: lacp
avd-rs02:
Expand All @@ -184,6 +199,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9034:443/tcp
- 10034:22/tcp
env:
TMODE: lacp
avd-spine1:
Expand All @@ -195,6 +211,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9001:443/tcp
- 10001:22/tcp
env:
TMODE: lacp
avd-spine2:
Expand All @@ -206,6 +223,7 @@ topology:
- /etc/sysctl.d/99-zceos.conf:/etc/sysctl.d/99-zceos.conf:ro
ports:
- 9002:443/tcp
- 10002:22/tcp
env:
TMODE: lacp
srv-pod01:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,36 @@ cvp:
cv_server:
ansible_host: 10.73.1.239
ansible_user: ansible
ansible_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
34396430613838346566316638623339643765633366356361616162326637363936333161313234
6134616333376433333737623931656234666465316237330a316162333136393266623765653166
32363736353335333834616433663463363237393565633866653039383664373832636437656535
6161643036653064370a633634616164336562653030383936343762353233313637666532396634
3037
ansible_password: demo
type: unset

tooling:
children:
endpoints:
hosts:
srv-pod01:
ansible_port: 9023
ansible_httpapi_port: 9023
ansible_port: 10023
ansible_host: 10.73.254.41
type: endpoint
srv-pod02:
ansible_port: 9024
ansible_httpapi_port: 9024
ansible_port: 10024
ansible_host: 10.73.254.42
type: endpoint
srv-pod03:
ansible_port: 9025
ansible_httpapi_port: 9025
ansible_port: 10025
ansible_host: 10.73.254.43
type: endpoint
# dci-rtr:
# ansible_port: 9026
# ansible_httpapi_port: 9026
# srv-pod05-23:
# ansible_port: 9031
# ansible_httpapi_port: 9031
# ansible_host: 10.73.254.45
# type: endpoint
# srv-pod05-24:
# ansible_port: 9032
# ansible_httpapi_port: 9032
# ansible_host: 10.73.254.46
# type: endpoint

Expand All @@ -49,20 +46,24 @@ avd:
type: route_server
hosts:
avd-rs01:
ansible_port: 9033
ansible_httpapi_port: 9033
ansible_port: 10033
ansible_host: 10.73.254.51
avd-rs02:
ansible_port: 9034
ansible_httpapi_port: 9034
ansible_port: 10034
ansible_host: 10.73.254.52
avd_spines:
vars:
type: spine
hosts:
avd-spine1:
ansible_port: 9001
ansible_httpapi_port: 9001
ansible_port: 10001
ansible_host: 10.73.254.101
avd-spine2:
ansible_port: 9002
ansible_httpapi_port: 9002
ansible_port: 10002
ansible_host: 10.73.254.102
avd_l3leafs:
vars:
Expand All @@ -71,43 +72,43 @@ avd:
avd_leaf1:
hosts:
avd-leaf1a:
ansible_port: 9011
ansible_httpapi_port: 9011
ansible_host: 10.73.254.11
avd-leaf1b:
ansible_port: 9012
ansible_httpapi_port: 9012
ansible_host: 10.73.254.12
avd_leaf2:
hosts:
avd-leaf2a:
ansible_port: 9013
ansible_httpapi_port: 9013
ansible_host: 10.73.254.13
avd-leaf2b:
ansible_port: 9014
ansible_httpapi_port: 9014
ansible_host: 10.73.254.14
avd_leaf_esi:
hosts:
avd-leaf3a:
ansible_port: 9017
ansible_httpapi_port: 9017
ansible_host: 10.73.254.17
avd-leaf4a:
ansible_port: 9018
ansible_httpapi_port: 9018
ansible_host: 10.73.254.18
avd_bl01:
hosts:
avd-bl01a:
ansible_port: 9015
ansible_httpapi_port: 9015
ansible_host: 10.73.254.15
avd-bl01b:
ansible_port: 9016
ansible_httpapi_port: 9016
ansible_host: 10.73.254.16
# nodes for central routing (l3 nodes)
avd_cl02:
hosts:
avd-cl01a:
ansible_port: 9027
ansible_httpapi_port: 9027
ansible_host: 10.73.254.19
avd-cl01b:
ansible_port: 9028
ansible_httpapi_port: 9028
ansible_host: 10.73.254.20
# nodes for central routing (l2 nodes)
avd_l2leafs:
Expand All @@ -117,10 +118,10 @@ avd:
avd_l2leaf1:
hosts:
avd-l2leaf01:
ansible_port: 9029
ansible_httpapi_port: 9029
ansible_host: 10.73.254.31
avd-l2leaf02:
ansible_port: 9030
ansible_httpapi_port: 9030
ansible_host: 10.73.254.32
avd_edge:
vars:
Expand All @@ -129,12 +130,12 @@ avd:
avd_edge_leaf1:
hosts:
avd-agg01:
ansible_port: 9021
ansible_httpapi_port: 9021
ansible_host: 10.73.254.21
avd_edge_leaf2:
hosts:
avd-agg02:
ansible_port: 9022
ansible_httpapi_port: 9022
ansible_host: 10.73.254.22
avd_services:
children:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ provisioner:
defaults:
jinja2_extensions: 'jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n'
gathering: explicit
inventory:
enable_plugins: yaml
inventory:
links:
hosts: 'inventory/inventory.yml'
Expand All @@ -51,4 +53,6 @@ verifier:
config_options:
defaults:
jinja2_extensions: 'jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n'
gathering: explicit
gathering: explicit
inventory:
enable_plugins: yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ The following default variables are defined, and can be modified as desired:
- `mgmt_network_v4`: Subnet for management IPs use for OOB
- `eapi_base`: Base port to use to expose eAPI from containers. Uses `eapi_base` + `device_id` from `arista.avd.eos_designs`
> If host has `ansible_port` defined and different than `443`, then, this value is used instead of an autogenerated one.
Port mapping logic:
- If host has `ansible_httpapi_port` defined and different than `443`, then, this value is used instead of an autogenerated one using `eapi_base`.
- If host has `ansible_port` defined and different than `22`, then, this value is used instead of an autogenerated one using `ssh_base`.
```yaml
# cEOS Image to use
Expand All @@ -48,6 +51,12 @@ containerlab_configuration: '{{ inventory_dir }}/containerlabs.yml'

# Default port to generate eAPI port mapping: eapi_base + device_id
eapi_base: 8000

# Default port to generate ssh port mapping: ssh_base + device_id
ssh_base: 7000

# Bind inotify settings for large topology
fs_inotify_fix: False
```
## Extend your topology
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ mgmt_network_v4: 192.168.1.0/24
# Default containerlabs configuration file generated
containerlab_configuration: '{{ inventory_dir }}/containerlabs.yml'

# eAPI base port to compute dynamic eAPI port mapping
eapi_base: 8000

# SSH base port to compute dynamic SSH port mapping
ssh_base: 7000

# Bind inotify settings for large topology
# sudo sh -c 'echo "fs.inotify.max_user_instances = 50000" > /etc/sysctl.d/99-zceos.conf'
# sudo sysctl -w fs.inotify.max_user_instances=50000
Expand Down
Loading

0 comments on commit 6565ff8

Please sign in to comment.