Skip to content

Commit

Permalink
Feat: request add support for access point provisioning (aristanetwor…
Browse files Browse the repository at this point in the history
…ks#527)

* Feature request add support for access point provisioning

* Feature request add support for access point provisioning

* Feat request add support for access point provisioning

* Feat: request add support for access point provisioning

* Feature request add support for access point provisioning

* Feature request add support for access point provisioning

* Test: fix molecule dependencies and scenario

* Test: remove need for AVD in the role

* Test: make sure intendend folder is not deleted for dhcp_management_offline scenario

* add missing defined to template

* remove docker dependency from offline molecule test

Co-authored-by: gmuloc <[email protected]>
  • Loading branch information
pvinci-arista and gmuloc authored Oct 26, 2022
1 parent 0d6977e commit c8f495d
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,6 @@ venv.bak/
*.log
*.log.*
ansible_collections/arista/cvp/tests/output

# ignore temporary dhcpd.conf.<timestamp>~ files
**/dhcpd.conf.*~
9 changes: 5 additions & 4 deletions ansible_collections/arista/cvp/molecule/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

MOLECULE ?= cv_configlet_loose
ANSIBLE_OPTIONS ?=

.PHONY: help
help: ## Display help message
Expand All @@ -12,20 +13,20 @@ help: ## Display help message
.PHONY: run
run: ## Execute molecule TEST sequence. By default eos_cli_config_gen. Can be set with MOLECULE=
cd .. && \
molecule test --scenario-name $(MOLECULE)
molecule test --scenario-name $(MOLECULE) -- $(ANSIBLE_OPTIONS)

.PHONY: converge
converge: ## Execute molecule CONVERGE sequence. By default eos_cli_config_gen. Can be set with MOLECULE=
cd .. && \
molecule converge --scenario-name $(MOLECULE)
molecule converge --scenario-name $(MOLECULE) -- $(ANSIBLE_OPTIONS)

.PHONY: refresh-facts
refresh-facts: ## Run all molecule scenarios
@for MOLECULE_SCENARIO in * ; do \
if [ -d "$$MOLECULE_SCENARIO" ]; then\
echo "Run scenrario for "$$MOLECULE_SCENARIO && \
cd .. ; \
molecule converge --scenario-name $$MOLECULE_SCENARIO ; \
molecule converge --scenario-name $$MOLECULE_SCENARIO -- $(ANSIBLE_OPTIONS) ; \
cd ./molecule ; \
fi \
done
Expand All @@ -49,7 +50,7 @@ destroy: ## destroy all molecule scenarios
if [ -d "$$MOLECULE_SCENARIO" ]; then\
echo "Run scenrario for "$$MOLECULE_SCENARIO && \
cd .. ; \
molecule cleanup --scenario-name $$MOLECULE_SCENARIO ; \
molecule cleanup --scenario-name $$MOLECULE_SCENARIO -- $(ANSIBLE_OPTIONS) ; \
cd ./molecule ; \
fi \
done

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
state: absent
with_items:
- documentation
- intended
- config_backup
- reports
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@

# Ansible managed: Do NOT edit this file manually! - dhcp_server01

# dhcpd raw configuration
class "vendor-class" {
match option vendor-class-identifier;
}
option option-242 code 242 = string;

# Subnet of ZTP interface
subnet 172.17.0.0 netmask 255.255.0.0 {
range 172.17.255.200 172.17.255.200;
authoritative;
option option-242 "MCIPADD=192.168.190.1,HTTPSRVR=192.168.190.4,HTTP DIR=/,L2QVLAN=190,L2Q=1";
}

# Remote Subnet
subnet 10.255.0.0 netmask 255.255.255.0 {
range 10.255.0.200 10.255.0.250;
option routers 10.255.0.3;
option domain-name-servers 10.255.0.3;
option domain-name arista.com;
max-lease-time 300;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,26 @@ ztp:
nameservers:
- '10.255.0.3'
general:
dhcpd_raw: |
class "vendor-class" {
match option vendor-class-identifier;
}
option option-242 code 242 = string;
subnets:
- network: 172.17.0.0
netmask: 255.255.0.0
start: 172.17.255.200
end: 172.17.255.200
dhcpd_raw: |
authoritative;
option option-242 "MCIPADD=192.168.190.1,HTTPSRVR=192.168.190.4,HTTP DIR=/,L2QVLAN=190,L2Q=1";
- name: Remote Subnet
network: 10.255.0.0
netmask: 255.255.255.0
gateway: 10.255.0.3
nameservers:
- '10.255.0.3'
domain_name: arista.com
start: 10.255.0.200
end: 10.255.0.250
lease_time: 300
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,23 @@
scenario:
create_sequence:
- dependency
- create
- prepare
converge_sequence:
- dependency
- create
- prepare
- converge
test_sequence:
- dependency
- syntax
- create
- converge
- idempotence
- verify
cleanup_sequence:
- destroy
dependency:
name: galaxy
options:
ignore-certs: True
ignore-errors: True
requirements-file: molecule/dhcp_management_offline/collections.yml
driver:
name: docker
name: delegated
platforms:
- name: dhcp_server01
image: avdteam/base:3.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,18 @@ ztp:
nameservers: < List of default NS to use on a per host basis >
use_system_mac: < true | false Configure DHCP for system-mac-address provided in show version (default false) >
general: < Section to define subnets parameters >
dhcpd_raw: < Multi-line string of raw configuration >
subnets:
- name: < Descriptive name, added as a comment in config file >
network: < * Subnet where DHCP will listen for request >
netmask: < * Netmask of given subnet >
gateway: < Gateway to configure for given subnet >
nameservers: < List of name-servers to configure for given subnet >
domain_name: < Domain name to be appended to name lookups >
start: < First IP available in the pool >
end: < Last IP available in the pool >
lease_time: < Maximum lease time before device loose IP. Renewal is max/2 >
dhcpd_raw: < Multi-line string of raw configuration >
clients: < List of clients on a mac-address basis >
- name: < * Hostname to provide when device do a DHCP request >
mac: < * Mac address of the host. Mac address value MUST be protected by either single or dual quotes >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

# {{ ansible_managed }} - {{ inventory_hostname }}
{% if ztp.general.dhcpd_raw is defined %}

# dhcpd raw configuration
{{ ztp.general.dhcpd_raw }}
{% endif %}
# Subnet of ZTP interface
{% for subnet in ztp.general.subnets %}
{% if subnet.name is defined %}
Expand All @@ -16,12 +21,18 @@ subnet {{ subnet.network }} netmask {{ subnet.netmask }} {
{% if subnet.nameservers is defined and subnet.nameservers is iterable %}
option domain-name-servers {% for nameserver in subnet.nameservers %}{{ nameserver }}{% if not loop.last %}, {% endif %}{% endfor %};
{% endif %}
{% if subnet.domain_name is defined %}
option domain-name {{subnet.domain_name }};
{% endif %}
{% if subnet.registration is defined %}
option bootfile-name "{{ subnet.registration }}";
{% endif %}
{% if subnet.lease_time is defined %}
max-lease-time {{ subnet.lease_time }};
{% endif %}
{% if subnet.dhcpd_raw is defined %}
{% filter indent(width=4,) %} {{ subnet.dhcpd_raw }}{% endfilter %}
{% endif %}
}
{% endfor %}

Expand Down Expand Up @@ -49,5 +60,4 @@ host {{ client.name }} {
option domain-name-servers {% for nameserver in ztp.default.nameservers %}{{ nameserver }}{% if not loop.last %}, {% endif %}{% endfor %};
{% endif %}
}

{% endfor %}

0 comments on commit c8f495d

Please sign in to comment.