Skip to content

Commit

Permalink
added test for changing tag value
Browse files Browse the repository at this point in the history
  • Loading branch information
sugetha24 committed Feb 13, 2024
1 parent 41248a0 commit 52999a3
Show file tree
Hide file tree
Showing 6 changed files with 262 additions and 8 deletions.
67 changes: 62 additions & 5 deletions ansible_collections/arista/avd/molecule/deploy_to_cv/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
structured_config_dir: "{{ playbook_dir }}/intended/structured_configs"
strict_configuration_dir: "{{ playbook_dir }}/intended/configs/strict_tags"
strict_structured_config_dir: "{{ playbook_dir }}/intended/structured_configs/strict_tags"
value_configuration_dir: "{{ playbook_dir }}/intended/configs/change_tags"
value_structured_config_dir: "{{ playbook_dir }}/intended/structured_configs/change_tags"
intended_tag_device: s1-leaf1
intended_tags: "{{ lookup('file', structured_config_dir ~ '/' ~ intended_tag_device ~ '.yml')|from_yaml }}"
# intended_strict_tag_device: s1-leaf1-strict_tags
intended_strict_tags: "{{ lookup('file', strict_structured_config_dir ~ '/' ~ intended_tag_device ~ '.yml')|from_yaml }}"
intended_value_tags: "{{ lookup('file', value_structured_config_dir ~ '/' ~ intended_tag_device ~ '.yml')|from_yaml }}"


tasks:
Expand Down Expand Up @@ -147,9 +150,9 @@
run_once: true
vars:
configs: ['{{ configuration_dir }}/s1-leaf1.cfg',
'{{ configuration_dir }}/s1-leaf2.cfg',
'{{ configuration_dir }}/s1-leaf3.cfg',
'{{ configuration_dir }}/s1-leaf4.cfg'
'{{ configuration_dir }}/s1-leaf2.cfg',
'{{ configuration_dir }}/s1-leaf3.cfg',
'{{ configuration_dir }}/s1-leaf4.cfg'
]
set_fact:
response_configlet: "{{ response_configlet | default({}) | combine({item.0.json[0].value.body | trim: item.1}) }}"
Expand Down Expand Up @@ -201,7 +204,7 @@
label: "{{ item.tags[0].name }}"
value: "{{ item.tags[0].value }}"
deviceId: "{{ intended_tag_device }}"
interfaceId: "{{ item.interface }}"
interfaceId: "{{ item.interface }}"
loop:
"{{ intended_tags.metadata.cv_tags.interface_tags }}"

Expand Down Expand Up @@ -255,4 +258,58 @@
value: "{{ item.value }}"
deviceId: "{{ intended_tag_device }}"
loop:
"{{ intended_strict_tags.metadata.cv_tags.device_tags }}"
"{{ intended_strict_tags.metadata.cv_tags.device_tags }}"

- name: Test tags = Value change
run_once: true
delegate_to: localhost
vars:
ws_name_value: avd-static-studio-tag-value-change-{{ r }}
ws_description_value: sample description
ws_req_state_value: submitted
ws_force_value: true
cc_name_value: cc_avd-static-studio-tag-value-change-{{ r }}
cc_requested_state_value: running
cc_desctiption_value: sample description
arista.avd.deploy_to_cv:
configuration_dir: "{{ value_configuration_dir }}"
structured_config_dir: "{{ value_structured_config_dir }}"
device_list: ["s1-leaf1"]
strict_tags: true
cv_servers: [ '{{ cv_server }}' ]
cv_token: '{{ token }}'
workspace:
name: '{{ ws_name_value }}'
description: '{{ ws_description_value }}'
id: '{{ ws_name_value }}'
requested_state: '{{ ws_req_state_value }}'
force: '{{ ws_force_value }}'
change_control:
name: '{{ cc_name_value }}'
description: '{{ cc_desctiption_value }}'
requested_state: '{{ cc_requested_state_value }}'
return_details: true
register: CVP_VALUE_TAGS_RESULTS

- name: Get Value Device Tag information
delegate_to: localhost
run_once: true
vars:
ws_name_value: avd-static-studio-tag-value-change-{{ r }}
ansible.builtin.uri:
url: '{{ tag_url }}'
return_content: true
validate_certs: false
headers:
Cookie: "access_token={{ token }}"
method: POST
body_format: json
body:
key:
workspaceId: '{{ ws_name_value }}'
elementType: 1
label: "{{ item.name }}"
value: "{{ item.value }}"
deviceId: "{{ intended_tag_device }}"
loop:
"{{ intended_value_tags.metadata.cv_tags.device_tags }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
!RANCID-CONTENT-TYPE: arista
!
no aaa root
!
username cvpadmin privilege 15 role network-admin secret sha512 $6$zWeb8jvKJY8ZtQkD$QzZDALGL1yDmjOxiGUNVJNyBU2la8AXPW04OmxaBt7JEfAgNU9QULOkG2HmwD3x8hFoo2LnwtjbX.Muj/dXlH0
username netadmin privilege 15 role network-admin secret sha512 $6$wdCCRfpWoyE3pTFJ$sMePFNrFSFKUVFxlxMTkB7E90tgwiz7BDtcUpBH5ga4Co/N59tsselElTZyYA.LDuSnVl2t/FH.qc1FX9fzNM/
username arista privilege 15 role network-admin secret arista123!
!
daemon TerminAttr
exec /usr/bin/TerminAttr -cvaddr=apiserver.cv-staging.corp.arista.io:443 -cvauth=token-secure,/mnt/flash/cv-onboarding-token -smashexcludes=ale,flexCounter,hardware,kni,pulse,strata -ingestexclude=/Sysdb/cell/1/agent,/Sysdb/cell/2/agent -cvvrf=MGMT -taillogs
no shutdown
!
vlan internal order ascending range 3900 4000
!
transceiver qsfp default-mode 4x10G
!
service routing protocols model multi-agent
!
hostname s1-leaf1
ip name-server vrf MGMT 172.22.22.40
!
platform tfa
personality arfa
!
spanning-tree mode mstp
!
system l1
unsupported speed action error
unsupported error-correction action error
!
vrf instance MGMT
!
management api http-commands
no shutdown
!
vrf MGMT
no shutdown
!
interface Ethernet1
description test
!
interface Ethernet2
!
interface Ethernet3
!
interface Ethernet4
!
interface Ethernet6
!
interface Management0
vrf MGMT
ip address 172.20.20.2/24
ipv6 address 2001:172:20:20::2/64
!
no ip routing
no ip routing vrf MGMT
!
ip route vrf MGMT 0.0.0.0/0 172.20.20.1
!
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
hostname: s1-leaf1
is_deployed: true
static_routes:
- vrf: default
destination_address_prefix: 0.0.0.0/0
gateway: 192.168.0.1
service_routing_protocols_model: multi-agent
vlan_internal_order:
allocation: ascending
range:
beginning: 1006
ending: 1199
spanning_tree:
mode: mstp
mst_instances:
- id: '0'
priority: 16384
no_spanning_tree_vlan: '4094'
local_users:
- name: arista
privilege: 15
role: network-admin
sha512_password: $6$rounds=656000$workshop$2J0sPzNX5gJs0tOf/ynK.X3f3fTTInXVX1wO0cmY/5ZTTg4GCFu3lvX9SggLk7W2.xD73cm5EA/R69iMBlfJt.
vrfs:
- name: default
ip_routing: false
management_interfaces:
- name: Management0
description: oob_management
shutdown: false
vrf: default
ip_address: 192.168.0.12/24
gateway: 192.168.0.1
type: oob
management_api_http:
enable_vrfs:
- name: default
enable_https: true
vlans:
- id: 4094
tenant: system
name: MLAG_PEER
trunk_groups:
- MLAG
- id: 10
name: Ten
tenant: MY_FABRIC
vlan_interfaces:
- name: Vlan4094
description: MLAG_PEER
shutdown: false
ip_address: 10.1.253.4/31
no_autostate: true
mtu: 1500
port_channel_interfaces:
- name: Port-Channel1
description: MLAG_PEER_s1-leaf2_Po1
type: switched
shutdown: false
mode: trunk
trunk_groups:
- MLAG
- name: Port-Channel2
description: SPINES_Po2
type: switched
shutdown: false
mode: trunk
vlans: '10'
mlag: 2
ethernet_interfaces:
- name: Ethernet1
peer: s1-leaf2
peer_interface: Ethernet1
peer_type: mlag_peer
description: MLAG_PEER_s1-leaf2_Ethernet1
type: port-channel-member
shutdown: false
channel_group:
id: 1
mode: active
- name: Ethernet6
peer: s1-leaf2
peer_interface: Ethernet6
peer_type: mlag_peer
description: MLAG_PEER_s1-leaf2_Ethernet6
type: port-channel-member
shutdown: false
channel_group:
id: 1
mode: active
- name: Ethernet2
peer: s1-spine1
peer_interface: Ethernet2
peer_type: l3spine
description: S1-SPINE1_Ethernet2
shutdown: false
type: port-channel-member
channel_group:
id: 2
mode: active
- name: Ethernet3
peer: s1-spine2
peer_interface: Ethernet2
peer_type: l3spine
description: S1-SPINE2_Ethernet2
shutdown: false
type: port-channel-member
channel_group:
id: 2
mode: active
mlag_configuration:
domain_id: RACK1
local_interface: Vlan4094
peer_address: 10.1.253.5
peer_link: Port-Channel1
reload_delay_mlag: '300'
reload_delay_non_mlag: '330'
ip_igmp_snooping:
globally_enabled: true
metadata:
cv_tags:
device_tags:
- name: Role
value: border
interface_tags:
- interface: Ethernet1
tags:
- name: Type
value: wan
- interface: Ethernet2
tags:
- name: Type
value: wan
- interface: Ethernet3
tags:
- name: Type
value: wan
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@ metadata:
- interface: Ethernet3
tags:
- name: Type
value: wan
value: wan
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ metadata:
# - name: Carrier
# value: Comcast-5G
# - name: Circuit
# value: AF830
# value: AF830
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ metadata:
- interface: Ethernet3
tags:
- name: Type
value: wan
value: wan

0 comments on commit 52999a3

Please sign in to comment.