Skip to content

Add bgp speaker test#209

Merged
stcheng merged 3 commits intosonic-net:masterfrom
sihuihan88:dev/sihan/mux
Jul 17, 2017
Merged

Add bgp speaker test#209
stcheng merged 3 commits intosonic-net:masterfrom
sihuihan88:dev/sihan/mux

Conversation

@sihuihan88
Copy link
Copy Markdown
Contributor

@sihuihan88 sihuihan88 commented Jul 6, 2017

This is to test support for BGP speaker which requires bgp dynamic neighbor configuration in quagga.
We use three exabgp instances to simulate three BGP speakers in ptf, which will create bgp sessions and
announce routes to DUT. DUT has dynamic neighbor bgp configuration for bgp speakers, and should
have bgp speakers shown as dynamic neighbors after exbagp instances announce routes.
We use bgp facts to valid the behavior.

@msftclas
Copy link
Copy Markdown

msftclas commented Jul 6, 2017

@sihuihan88,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

Copy link
Copy Markdown
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor issues

m_args = self.module.params
exclude_ips = []
if m_args['exclude_ips'] is not None:
ip_list = m_args['exclude_ips'].split()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can define this parameter as a list. Something like this:
exclude_ips=dict(required=False, default=[], type='list'),

# Run BGP Speaker test
#========================================

- fail: msg="Information about tested missing"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check you have ptf host defined

import os
import time
import sys
from sets import Set
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious. Why? ;)

s = set() working without importing anything

bgp_peers_with_range.append({
'name': name,
'ip_range': ip_range
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert tab into whitespaces


- name: set bgp speaker asn number
set_fact:
bgp_speaker_asn={{deployment_id_asn_map[deployment_id]}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be consistent on the space, in line 19, you have space between braces and word. here you do not.


- name: Generate configuration for the first exabgp instance
template: src=roles/test/templates/exabgp/config.j2 dest=/tmp/exabgp/{{item.file_name}}
with_items:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not combine them using

with_items:

  • item1
  • item2
  • item3?

?

connection: local

- name: Generate start file for exabgp instances
template: src=roles/test/templates/exabgp/start.j2 dest=/tmp/exabgp/{{item.file_name}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

template allows you to deploy the file to remove host, wonder why you choose not? it can also set the mode.

http://docs.ansible.com/ansible/template_module.html

delegate_to: "{{ptf_host}}"

- name: Start exabgp instances
shell: chmod +x /root/exabgp/start.sh && sh /root/exabgp/start.sh
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can do the chmod in the template module.

with_items: "['{{slb_ips[0].split('/')[0]}}', '{{slb_ips[1].split('/')[0]}}', '{{vlan_ips[0].split('/')[0]}}'] "


- name: Kill exabgp instances
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use killall to kill the process by name, you do not really need the get the pid first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or use pkill


- name: Copy helper files to ptf container
copy: src=roles/test/files/helpers/announce_routes.py dest={{exabgp_dir}}
delegate_to: "{{ptf_host}}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can copy the the whole directory to the dest using copy module. do not need to specify file one-by-one.

Copy link
Copy Markdown
Contributor

@lguohan lguohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as comments

@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Jul 14, 2017

👍

@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Jul 14, 2017

@pavel-shirshov , can you check if there is anything need to change or approve?

@stcheng stcheng merged commit d231911 into sonic-net:master Jul 17, 2017
lguohan pushed a commit that referenced this pull request Aug 3, 2017
* Add BGP speaker test
* support the case when multiple peer range in single group
@sihuihan88 sihuihan88 deleted the dev/sihan/mux branch August 3, 2017 22:51
auspham pushed a commit to auspham/sonic-mgmt that referenced this pull request May 30, 2025
<!--
Please make sure you've read and understood our contributing guidelines;
https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md

Please provide following information to help code review process a bit easier:
-->
### Description of PR
<!--
- Please include a summary of the change and which issue is fixed.
- Please also include relevant motivation and context. Where should reviewer start? background context?
- List any dependencies that are required for this change.
-->

Summary:
Fixes # (issue)

### Type of change

<!--
- Fill x for your type of change.
- e.g.
- [x] Bug fix
-->

- [ ] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [ ] New Test case
 - [ ] Skipped for non-supported platforms
- [ ] Test case improvement

### Back port request
- [ ] 202012
- [ ] 202205
- [ ] 202305
- [ ] 202311
- [ ] 202405
- [ ] 202411

### Approach
#### What is the motivation for this PR?
The eos default cred is all digits. It may be interpreted as an integer and raise below error during tests:
```
 File "/var/src/sonic-mgmt/tests/common/devices/eos.py", line 85, in shutdown
 out = self.eos_config(
 File "/var/src/sonic-mgmt/tests/common/devices/base.py", line 131, in _run
 raise RunAnsibleModuleFail("run module {} failed".format(self.module_name), res)
tests.common.errors.RunAnsibleModuleFail: run module eos_config failed, Ansible Results =>
failed = True
module_stdout =
module_stderr = Expected unicode or bytes, got 123456
msg = MODULE FAILURE
See stdout/stderr for the exact error
_ansible_no_log = None
changed = False
stdout =
stderr =
```
#### How did you do it?
Add quote to the all digits default cred to force string type.
#### How did you verify/test it?

#### Any platform specific information?

#### Supported testbed topology if it's a new test case?

### Documentation
<!--
(If it's a new feature, new test case)
Did you update documentation/Wiki relevant to your implementation?
Link to the wiki page?
-->
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
sonic-net#15654)

#### Why I did it
src/linkmgrd
```
* 3f89fce - (HEAD -> 202012, origin/202012) [202012] Use Vlan MAC as src MAC for link prober by default sonic-net#93 (sonic-net#209) (6 weeks ago) [Jing Zhang]
```
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…lly (sonic-net#18574)

#### Why I did it
src/sonic-gnmi
```
* 4b12af9 - (HEAD -> 202305, origin/202305) Merge pull request sonic-net#209 from zbud-msft/revert_pfcwd_202305 (2 minutes ago) [StormLiangMS]
* 802dbb7 - Revert "Replace PFC_WD_TABLE with PFC_WD (sonic-net#173)" (28 hours ago) [Zain Budhwani]
* e1397c4 - Revert "Account for GLOBAL key in PFC_WD (sonic-net#178)" (28 hours ago) [Zain Budhwani]
```
#### How I did it
#### How to verify it
#### Description for the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants