-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New test to create l2vpns and check connectivity #8
base: main
Are you sure you want to change the base?
Changes from 12 commits
d5e5f85
dff4489
fc9d54d
4aaf29c
41ab816
156f18a
1db8e18
59cd4a5
ecb3982
db7ee21
382b6e4
2c7be24
c874d09
ae4286b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,3 +267,72 @@ def test_050_delete_l2vpn_successfully(self): | |
## -> tenet | ||
response = requests.get("http://tenet:8181/api/kytos/mef_eline/v2/evc/") | ||
assert len(response.json()) == 0, response.text | ||
|
||
def test_060_link_convergency_with_l2vpn_with_alternative_paths(self): | ||
""" | ||
Test a simple link convergency with L2VPNs that have alternative paths: | ||
- Create 3 L2VPN, | ||
- test connectivity, | ||
- set one link to down, | ||
- wait a few seconds for convergency, | ||
- test connectivity again | ||
""" | ||
api_url = SDX_CONTROLLER + '/l2vpn/1.0' | ||
payload = {"name": "Text", | ||
"endpoints": [ | ||
{"port_id": "urn:sdx:port:ampath.net:Ampath1:50", "vlan": "100",}, | ||
{"port_id": "urn:sdx:port:tenet.ac.za:Tenet03:50", "vlan": "100",} | ||
] | ||
} | ||
response = requests.post(api_url, json=payload) | ||
assert response.status_code == 201, response.text | ||
h1, h8 = self.net.net.get('h1', 'h8') | ||
h1.cmd('ip link add link %s name vlan100 type vlan id 100' % (h1.intfNames()[0])) | ||
h1.cmd('ip link set up vlan100') | ||
h1.cmd('ip addr add 10.1.1.1/24 dev vlan100') | ||
h8.cmd('ip link add link %s name vlan100 type vlan id 100' % (h8.intfNames()[0])) | ||
h8.cmd('ip link set up vlan100') | ||
h8.cmd('ip addr add 10.1.1.8/24 dev vlan100') | ||
|
||
payload = {"name": "Text", | ||
"endpoints": [ | ||
{"port_id": "urn:sdx:port:ampath.net:Ampath1:50", "vlan": "101",}, | ||
{"port_id": "urn:sdx:port:tenet.ac.za:Tenet03:50", "vlan": "101",} | ||
] | ||
} | ||
response = requests.post(api_url, json=payload) | ||
assert response.status_code == 201, response.text | ||
h1.cmd('ip link add link %s name vlan101 type vlan id 101' % (h1.intfNames()[0])) | ||
h1.cmd('ip link set up vlan101') | ||
h1.cmd('ip addr add 10.1.1.1/24 dev vlan101') | ||
h8.cmd('ip link add link %s name vlan100 type vlan id 101' % (h8.intfNames()[0])) | ||
h8.cmd('ip link set up vlan101') | ||
h8.cmd('ip addr add 10.1.1.8/24 dev vlan101') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
|
||
payload = {"name": "Text", | ||
"endpoints": [ | ||
{"port_id": "urn:sdx:port:ampath.net:Ampath1:50", "vlan": "102",}, | ||
{"port_id": "urn:sdx:port:tenet.ac.za:Tenet03:50", "vlan": "102",} | ||
] | ||
} | ||
response = requests.post(api_url, json=payload) | ||
assert response.status_code == 201, response.text | ||
h1.cmd('ip link add link %s name vlan102 type vlan id 102' % (h1.intfNames()[0])) | ||
h1.cmd('ip link set up vlan102') | ||
h1.cmd('ip addr add 10.1.1.1/24 dev vlan102') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here regarding the IP address |
||
h8.cmd('ip link add link %s name vlan102 type vlan id 102' % (h8.intfNames()[0])) | ||
h8.cmd('ip link set up vlan102') | ||
h8.cmd('ip addr add 10.1.1.8/24 dev vlan102') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here regarding the IP address |
||
|
||
# test connectivity after create 3 L2VPN | ||
result = h1.cmd('ping -c4 10.1.1.8') | ||
assert ', 0% packet loss,' in result | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recommend that the assert goes in the end, to allow the VLAN interfaces be removed before actually checking for the results (and possibly failing, leaving the clean up incomplete). |
||
|
||
h1.cmd('ip link del vlan102') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. leave this to the end |
||
|
||
# wait a few seconds for convergency | ||
time.sleep(30) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure if I understood the convergency here. From the previous commands, there was no links going down There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, the comment is confusing. This is some time after removing a link. |
||
|
||
# test connectivity again | ||
result = h1.cmd('ping -c4 10.1.1.8') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest you to have different variables to store the ping result from each VLAN:
|
||
assert ', 0% packet loss,' in result | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After testing all the connectivity, I suggest you to remove all the interfaces from h1 and h8:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gretel, can you please update the IP address assigned to VLAN 101 to something different? Example: 10.1.2.1/24