To fix iosxr_l3_interfaces module zuul tests (#61592)

* fix 61540

* fix utils
This commit is contained in:
Sumit Jaiswal 2019-08-31 05:06:15 +05:30 committed by Paul Belanger
parent aaa8835311
commit 24ad1dffc9
8 changed files with 44 additions and 123 deletions

View file

@ -96,6 +96,10 @@ def filter_dict_having_none_value(want, have):
if each.get('secondary') and diff_ip is True:
test_key_dict.update({'secondary': True})
test_dict.update({'ipv4': test_key_dict})
# Checks if want doesn't have secondary IP but have has secondary IP set
elif have.get('ipv4'):
if [True for each_have in have.get('ipv4') if 'secondary' in each_have]:
test_dict.update({'ipv4': {'secondary': True}})
if k == 'l2protocol':
if want[k] != have.get('l2protocol') and have.get('l2protocol'):
test_dict.update({k: v})

View file

@ -4,13 +4,9 @@
config: "{{ lines }}"
vars:
lines: |
interface GigabitEthernet 0/0/0/1
interface GigabitEthernet 0/0/0/0
ipv4 address 198.51.100.1 255.255.255.0
interface GigabitEthernet 0/0/0/2
ipv6 address 2001:db8::/32
interface GigabitEthernet 0/0/0/1
ipv4 address 192.0.2.1 255.255.255.0
ipv4 address 192.0.2.2 255.255.255.0 secondary
interface GigabitEthernet 0/0/0/3
ipv4 address 203.0.110.1 255.255.255.0
ipv6 address 2001:db8::/32
interface GigabitEthernet 0/0/0/3.100
ipv4 address 203.0.113.1 255.255.255.0

View file

@ -4,10 +4,9 @@
config: "{{ lines }}"
vars:
lines: |
interface GigabitEthernet 0/0/0/0
no ipv4 address
no ipv6 address
interface GigabitEthernet 0/0/0/1
no ipv4 address
no ipv6 address
no interface GigabitEthernet 0/0/0/2
no interface GigabitEthernet 0/0/0/3
no interface GigabitEthernet 0/0/0/3.100
no interface GigabitEthernet 0/0/0/4

View file

@ -10,10 +10,8 @@
- name: Delete attributes of all configured interfaces
iosxr_l3_interfaces: &deleted
config:
- name: GigabitEthernet0/0/0/0
- name: GigabitEthernet0/0/0/1
- name: GigabitEthernet0/0/0/2
- name: GigabitEthernet0/0/0/3
- name: GigabitEthernet0/0/0/3.100
state: deleted
register: result

View file

@ -8,26 +8,16 @@
- name: Merge provided configuration with device configuration
iosxr_l3_interfaces: &merged
config:
- name: GigabitEthernet0/0/0/1
- name: GigabitEthernet0/0/0/0
ipv4:
- address: 198.51.100.1/24
- name: GigabitEthernet0/0/0/2
- name: GigabitEthernet0/0/0/1
ipv6:
- address: 2001:db8:0:3::/64
ipv4:
- address: 192.0.2.1/24
- address: 192.0.2.2/24
secondary: True
- name: GigabitEthernet0/0/0/3
ipv4:
- address: 203.0.110.1/24
- address: 203.0.110.5/24
secondary: True
- name: GigabitEthernet0/0/0/3.100
ipv4:
- address: 198.51.100.14/24
ipv6:
- address: 2001:db8:0:4::/64
state: merged
register: result

View file

@ -10,10 +10,7 @@
- name: Override device configuration of all interfaces with provided configuration
iosxr_l3_interfaces: &overridden
config:
- name: GigabitEthernet0/0/0/3
ipv4:
- address: 203.0.112.24/24
- name: GigabitEthernet0/0/0/3.100
- name: GigabitEthernet0/0/0/1
ipv4:
- address: 198.51.102.1/24
ipv6:

View file

@ -10,17 +10,11 @@
- name: Replaces device configuration of listed interfaces with provided configuration
iosxr_l3_interfaces: &replaced
config:
- name: GigabitEthernet0/0/0/1
- name: GigabitEthernet0/0/0/0
ipv4:
- address: 203.0.113.27/24
- name: GigabitEthernet0/0/0/2
ipv4:
- address: 203.0.115.2/24
- address: 203.0.114.1/24
secondary: True
- name: GigabitEthernet0/0/0/3.100
ipv4:
- address: 192.0.2.10/24
state: replaced
register: result

View file

@ -5,42 +5,26 @@ merged:
- name: Loopback999
commands:
- "interface GigabitEthernet0/0/0/1"
- "interface GigabitEthernet0/0/0/0"
- "ipv4 address 198.51.100.1 255.255.255.0"
- "interface GigabitEthernet0/0/0/2"
- "interface GigabitEthernet0/0/0/1"
- "ipv4 address 192.0.2.2 255.255.255.0 secondary"
- "ipv4 address 192.0.2.1 255.255.255.0"
- "ipv6 address 2001:db8:0:3::/64"
- "interface GigabitEthernet0/0/0/3"
- "ipv4 address 203.0.110.1 255.255.255.0"
- "ipv4 address 203.0.110.5 255.255.255.0 secondary"
- "interface GigabitEthernet0/0/0/3.100"
- "ipv4 address 198.51.100.14 255.255.255.0"
- "ipv6 address 2001:db8:0:4::/64"
after:
- name: Loopback888
- name: Loopback999
- ipv4:
- address: 198.51.100.1 255.255.255.0
name: GigabitEthernet0/0/0/1
name: GigabitEthernet0/0/0/0
- ipv4:
- address: 192.0.2.1 255.255.255.0
- address: 192.0.2.2 255.255.255.0
secondary: true
ipv6:
- address: 2001:db8:0:3::/64
name: GigabitEthernet0/0/0/2
- ipv4:
- address: 203.0.110.1 255.255.255.0
- address: 203.0.110.5 255.255.255.0
secondary: true
name: GigabitEthernet0/0/0/3
- ipv4:
- address: 198.51.100.14 255.255.255.0
ipv6:
- address: 2001:db8:0:4::/64
name: GigabitEthernet0/0/0/3.100
name: GigabitEthernet0/0/0/1
replaced:
before:
@ -48,50 +32,34 @@ replaced:
- name: Loopback999
- ipv4:
- address: 198.51.100.1 255.255.255.0
name: GigabitEthernet0/0/0/1
ipv6:
- address: 2001:db8::/32
name: GigabitEthernet0/0/0/0
- ipv4:
- address: 192.0.2.1 255.255.255.0
- address: 192.0.2.2 255.255.255.0
secondary: true
name: GigabitEthernet0/0/0/2
- ipv4:
- address: 203.0.110.1 255.255.255.0
ipv6:
- address: 2001:db8::/32
name: GigabitEthernet0/0/0/3
- ipv4:
- address: 203.0.113.1 255.255.255.0
name: GigabitEthernet0/0/0/3.100
name: GigabitEthernet0/0/0/1
commands:
- "interface GigabitEthernet0/0/0/1"
- "interface GigabitEthernet0/0/0/0"
- "no ipv6 address"
- "ipv4 address 203.0.113.27 255.255.255.0"
- "interface GigabitEthernet0/0/0/2"
- "no ipv4 address"
- "ipv4 address 203.0.115.2 255.255.255.0"
- "ipv4 address 203.0.114.1 255.255.255.0 secondary"
- "interface GigabitEthernet0/0/0/3.100"
- "ipv4 address 192.0.2.10 255.255.255.0"
after:
- name: Loopback888
- name: Loopback999
- ipv4:
- address: 203.0.113.27 255.255.255.0
name: GigabitEthernet0/0/0/1
- ipv4:
- address: 203.0.115.2 255.255.255.0
- address: 203.0.114.1 255.255.255.0
secondary: true
name: GigabitEthernet0/0/0/2
name: GigabitEthernet0/0/0/0
- ipv4:
- address: 203.0.110.1 255.255.255.0
ipv6:
- address: 2001:db8::/32
name: GigabitEthernet0/0/0/3
- ipv4:
- address: 192.0.2.10 255.255.255.0
name: GigabitEthernet0/0/0/3.100
- address: 192.0.2.1 255.255.255.0
- address: 192.0.2.2 255.255.255.0
secondary: true
name: GigabitEthernet0/0/0/1
overridden:
before:
@ -99,45 +67,32 @@ overridden:
- name: Loopback999
- ipv4:
- address: 198.51.100.1 255.255.255.0
name: GigabitEthernet0/0/0/1
ipv6:
- address: 2001:db8::/32
name: GigabitEthernet0/0/0/0
- ipv4:
- address: 192.0.2.1 255.255.255.0
- address: 192.0.2.2 255.255.255.0
secondary: true
name: GigabitEthernet0/0/0/2
- ipv4:
- address: 203.0.110.1 255.255.255.0
ipv6:
- address: 2001:db8::/32
name: GigabitEthernet0/0/0/3
- ipv4:
- address: 203.0.113.1 255.255.255.0
name: GigabitEthernet0/0/0/3.100
name: GigabitEthernet0/0/0/1
commands:
- "interface GigabitEthernet0/0/0/0"
- "no ipv4 address"
- "no ipv6 address"
- "interface GigabitEthernet0/0/0/1"
- "no ipv4 address"
- "interface GigabitEthernet0/0/0/2"
- "no ipv4 address"
- "interface GigabitEthernet0/0/0/3"
- "no ipv6 address"
- "ipv4 address 203.0.112.24 255.255.255.0"
- "interface GigabitEthernet0/0/0/3.100"
- "ipv4 address 198.51.102.1 255.255.255.0"
- "ipv6 address 2001:db8:1::/64"
after:
- name: Loopback888
- name: Loopback999
- name: GigabitEthernet0/0/0/2
- ipv4:
- address: 203.0.112.24 255.255.255.0
name: GigabitEthernet0/0/0/3
- ipv4:
- address: 198.51.102.1 255.255.255.0
ipv6:
- address: 2001:db8:1::/64
name: GigabitEthernet0/0/0/3.100
name: GigabitEthernet0/0/0/1
deleted:
before:
@ -145,34 +100,22 @@ deleted:
- name: Loopback999
- ipv4:
- address: 198.51.100.1 255.255.255.0
name: GigabitEthernet0/0/0/1
ipv6:
- address: 2001:db8::/32
name: GigabitEthernet0/0/0/0
- ipv4:
- address: 192.0.2.1 255.255.255.0
- address: 192.0.2.2 255.255.255.0
secondary: true
name: GigabitEthernet0/0/0/2
- ipv4:
- address: 203.0.110.1 255.255.255.0
ipv6:
- address: 2001:db8::/32
name: GigabitEthernet0/0/0/3
- ipv4:
- address: 203.0.113.1 255.255.255.0
name: GigabitEthernet0/0/0/3.100
name: GigabitEthernet0/0/0/1
commands:
- "interface GigabitEthernet0/0/0/1"
- "no ipv4 address"
- "interface GigabitEthernet0/0/0/2"
- "no ipv4 address"
- "interface GigabitEthernet0/0/0/3"
- "interface GigabitEthernet0/0/0/0"
- "no ipv4 address"
- "no ipv6 address"
- "interface GigabitEthernet0/0/0/3.100"
- "interface GigabitEthernet0/0/0/1"
- "no ipv4 address"
after:
- name: Loopback888
- name: Loopback999
- name: GigabitEthernet0/0/0/3
- name: GigabitEthernet0/0/0/3.100