Skip to content
Merged
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
30 changes: 29 additions & 1 deletion ansible/README.test.md
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
# Placeholder for SONiC tests
# ansible playbooks for SONiC testing

## Requirements
- A testbed needed to be set up before hand. See [Testbed Readme](README_testbed.md) for more information.
-- Depending on the test, either a PTF testbed or a VM set testbed might be required.

## Run Tests
- Replace {DUT_NAME} in each command line with the host name of switch under test.

### NTP Test
```
ansible-playbook test_sonic.yml -i inventory --limit {DUT_NAME} --become --tags ntp
```

### Syslog Test
```
ansible-playbook test_sonic.yml -i inventory --limit {DUT_NAME} --become --tags syslog
```

### SNMP Tests
```
ansible-playbook test_sonic.yml -i inventory --limit {DUT_NAME} --become --tags snmp,snmp_cpu,snmp_interfaces
```

### LLDP Test
```
ansible-playbook test_sonic.yml -i inventory --limit {DUT_NAME},lldp_neighbors --become --tags lldp
```
- Required switch connected to a VM set testbed.
15 changes: 8 additions & 7 deletions ansible/README.testbed.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,22 +260,23 @@ sent to the vlan interface. It allows us to inject packets from the PTF host to
### Deploy testbed with one VM set
1. clone sonic-mgmt repo to local directory
2. Edit 'ansible/veos' file. Put ip address of your server after 'ansible_host='
3. Edit 'ansible/group_vars/vm_host'. Put your credentials to reach the server
4. Check, that you can reach the server by running command 'ansible -i veos -m ping vm_host_1' from ansible directory. The output should contain 'pong'
5. Edit 'ansible/group_vars/vm_host/main.yml'.
3. Edit 'ansible/group_vars/eos/eos.yml' file. Put your internal snmp community string after 'snmp_rocommunity:'.
4. Edit 'ansible/group_vars/vm_host'. Put your credentials to reach the server
5. Check, that you can reach the server by running command 'ansible -i veos -m ping vm_host_1' from ansible directory. The output should contain 'pong'
6. Edit 'ansible/group_vars/vm_host/main.yml'.
* 'root_path': path where VMs virtual disks resides
* 'vm_images_url': URL where VM images could be downloaded
* 'cd_image_filename': filename of cd image of veos
* 'hdd_image_filename': filename of hdd image of veos
* 'http_proxy': your http_proxy
* 'http_proxy': your https_proxy
6. Edit 'ansible/host_vars/STR-ACS-SERV-01.yml'. It contains settings for STR-ACS-SERV-01. STR-ACS-SERV-02 contains similar settings which are applied to STR-ACS-SERV-02
7. Edit 'ansible/host_vars/STR-ACS-SERV-01.yml'. It contains settings for STR-ACS-SERV-01. STR-ACS-SERV-02 contains similar settings which are applied to STR-ACS-SERV-02
* 'mgmt_gw': ip address of gateway for management interfaces of VM. See 3.2
* 'vm_X_enabled': true, if you want to run X vm set
* 'vm_X_vlan_base': vlan number which is used for connection to first port of DUT.
* 'vlans': list of vlan offsets for the VM FP ports. For example: if vlans equal to "5,6" it means that the VM frontpanel port 0 will be connected to vlan {{ vm_X_vlan_base + 5 - 1 }} and VM frontpanel port 1 will be connected to vlan {{ vm_X_vlan_base + 6 - 1 }}
7. Edit 'ansible/minigraph/*.xml' files. You need to adjust following xml nodes to settings of your network:
8. Edit 'ansible/minigraph/*.xml' files. You need to adjust following xml nodes to settings of your network:
* DeviceMiniGraph/DpgDec/DeviceDataPlaneInfo/ManagementIPInterfaces/ManagementIPInterface/Prefix/IPPrefix
* DeviceMiniGraph/DpgDec/DeviceDataPlaneInfo/ManagementIPInterfaces/ManagementIPInterface/PrefixStr
8. Start testbed with command 'ANSIBLE_SCP_IF_SSH=y ansible-playbook -i veos start_vm_sets.yml --limit server_1 -e vm_set_1=true'
9. Stop testbed with command 'ANSIBLE_SCP_IF_SSH=y ansible-playbook -i veos stop_vm_sets.yml --limit server_1 -e vm_set_1=true'
9. Start testbed with command 'ANSIBLE_SCP_IF_SSH=y ansible-playbook -i veos start_vm_sets.yml --limit server_1 -e vm_set_1=true'
10. Stop testbed with command 'ANSIBLE_SCP_IF_SSH=y ansible-playbook -i veos stop_vm_sets.yml --limit server_1 -e vm_set_1=true'
3 changes: 3 additions & 0 deletions ansible/group_vars/eos/eos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# snmp variables
snmp_rocommunity: public

7 changes: 7 additions & 0 deletions ansible/library/lldp_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def __init__(self,dotprefix=False):

# From LLDP-MIB
self.lldp_rem_port_id = dp + "1.0.8802.1.1.2.1.4.1.1.7"
self.lldp_rem_port_desc = dp + "1.0.8802.1.1.2.1.4.1.1.8"
self.lldp_rem_sys_desc = dp + "1.0.8802.1.1.2.1.4.1.1.10"
self.lldp_rem_sys_name = dp + "1.0.8802.1.1.2.1.4.1.1.9"
self.lldp_rem_chassis_id = dp + "1.0.8802.1.1.2.1.4.1.1.5"
Expand Down Expand Up @@ -207,6 +208,7 @@ def main():
snmp_auth,
cmdgen.UdpTransportTarget((host, 161)),
cmdgen.MibVariable(p.lldp_rem_port_id,),
cmdgen.MibVariable(p.lldp_rem_port_desc,),
cmdgen.MibVariable(p.lldp_rem_sys_desc,),
cmdgen.MibVariable(p.lldp_rem_sys_name,),
cmdgen.MibVariable(p.lldp_rem_chassis_id,),
Expand All @@ -217,6 +219,7 @@ def main():

lldp_rem_sys = dict()
lldp_rem_port_id = dict()
lldp_rem_port_desc = dict()
lldp_rem_chassis_id = dict()
lldp_rem_sys_desc = dict()

Expand All @@ -243,6 +246,9 @@ def main():
if v.lldp_rem_port_id in current_oid:
lldp_rem_port_id[if_name] = current_val
continue
if v.lldp_rem_port_desc in current_oid:
lldp_rem_port_desc[if_name] = current_val
continue
if v.lldp_rem_chassis_id in current_oid:
lldp_rem_chassis_id[if_name] = current_val
continue
Expand All @@ -254,6 +260,7 @@ def main():

for intf in lldp_rem_sys.viewkeys():
lldp_data[intf] = {'neighbor_sys_name': lldp_rem_sys[intf],
'neighbor_port_desc': lldp_rem_port_desc[intf],
'neighbor_port_id': lldp_rem_port_id[intf],
'neighbor_sys_desc': lldp_rem_sys_desc[intf],
'neighbor_chassis_id': lldp_rem_chassis_id[intf]}
Expand Down
Loading