Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions ansible/README.test.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ ansible-playbook test_sonic.yml -i {INVENTORY} --limit {DUT_NAME} -e testcase_na
```
- Requires switch connected to a PTF testbed

##### Incremental Config Test
```
ansible-playbook test_sonic.yml -i {INVENTORY} --limit {DUT_NAME} -e testcase_name=incremental_config -e testbed_name={TESTBED_NAME}
```
- Requires 2 active Ethernet interfaces on the DUT


##### LAG test
```
ansible-playbook test_sonic.yml -i {INVENTORY} --limit {DUT_NAME} -e testcase_name=lag_2 -e testbed_name={TESTBED_NAME}
Expand Down
60 changes: 60 additions & 0 deletions ansible/roles/test/tasks/incremental_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
- debug: msg="Tests for the incremental configuration features of the cli"

- name: gather interface facts
interface_facts:

- name: set initial variables
set_fact:
test_ipv4_address: 10.200.4.5/24
test_ipv6_address: fc00::aa07/126
test_port_channel_name: PortChannel0999
test_vlan: 999

- name: Get a list of active Ethernet interface names
set_fact:
test_interfaces: "{{ test_interfaces|default([]) }} + ['{{ item.device }}']"
when: item.active == True and "Ethernet" in item.device
with_items: "{{ ansible_interface_facts.values() }}"

- name: verify that there are at least 2 interfaces that we can test with
assert:
that: (test_interfaces | length) >= 2
msg: This test requires at least two active Ethernet interfaces

- name: Add and remove an IPv4 address from an interface
include: incremental_config/incremental_config_ip.yml
vars:
ip_type: 'ipv4'
address: "{{ test_ipv4_address }}"
interface: "{{ test_interfaces[0] }}"

- name: Add and remove an IPv6 address from an interface
include: incremental_config/incremental_config_ip.yml
vars:
ip_type: 'ipv6'
address: "{{ test_ipv6_address }}"
interface: "{{ test_interfaces[0] }}"

- name: Add and remove VLAN membership from an interface
include: incremental_config/incremental_config_vlan.yml
vars:
interface: "{{ test_interfaces[0] }}"

- name: Add and remove a portchannel interface
include: incremental_config/incremental_config_portchannel.yml
vars:
name: "{{ test_port_channel_name }}"
members: "{{ test_interfaces[:2] }}"

- name: Add and remove some acl rules via the incremental updated command
include: incremental_config/incremental_config_acl_incremental_update.yml

- name: Do basic sanity check and allow recovery
include: base_sanity.yml
vars:
recover: "{{ allow_recover }}"

- name: Validate all interfaces are up and allow recovery
include: interface.yml
vars:
recover: "{{ allow_recover }}"
241 changes: 241 additions & 0 deletions ansible/roles/test/tasks/incremental_config/ic_test_rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
{
"acl": {
"acl-sets": {
"acl-set": {
"dataacl": {
"acl-entries": {
"acl-entry": {
"1": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 1
},
"ip": {
"config": {
"source-ip-address": "10.0.0.2/32"
}
}
},
"2": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 2
},
"ip": {
"config": {
"destination-ip-address": "192.168.0.16/32"
}
}
},
"3": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 3
},
"ip": {
"config": {
"destination-ip-address": "172.16.2.0/32"
}
}
},
"4": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 4
},
"transport": {
"config": {
"source-port": "4661"
}
}
},
"5": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 5
},
"ip": {
"config": {
"protocol": 126
}
}
},
"6": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 6
},
"transport": {
"config": {
"tcp-flags": ["TCP_ACK", "TCP_SYN"]
}
}
},
"7": {
"actions": {
"config": {
"forwarding-action": "DROP"
}
},
"config": {
"sequence-id": 7
},
"ip": {
"config": {
"source-ip-address": "10.0.0.3/32"
}
}
},
"8": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 8
},
"ip": {
"config": {
"source-ip-address": "10.0.0.3/32"
}
}
},
"9": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 9
},
"transport": {
"config": {
"destination-port": "4661"
}
}
},
"10": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 10
},
"transport": {
"config": {
"source-port": "4656..4671"
}
}
},
"11": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 11
},
"transport": {
"config": {
"destination-port": "4640..4687"
}
}
},
"12": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 12
},
"ip": {
"config": {
"protocol":1,
"source-ip-address": "10.0.0.2/32"
}
}
},
"13": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 13
},
"ip": {
"config": {
"protocol":17,
"source-ip-address": "10.0.0.2/32"
}
}
},
"14": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 27
},
"transport": {
"config": {
"source-port": "179"
}
}
},
"15": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 28
},
"transport": {
"config": {
"destination-port": "179"
}
}
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"acl": {
"acl-sets": {
"acl-set": {
"dataacl": {
"acl-entries": {
"acl-entry": {
"1": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 1
},
"l2": {
"config": {
"ethertype": "2048"
}
}
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"acl": {
"acl-sets": {
"acl-set": {
}
}
}
}

Loading