-
Notifications
You must be signed in to change notification settings - Fork 331
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
wlb: T4470: Migrate WAN Load Balancer to XML/Python #4108
base: current
Are you sure you want to change the base?
Conversation
👍 |
✅ No issues found in unused-imports check.. Please refer the workflow run |
b43023b
to
a139da3
Compare
f201240
to
bc76249
Compare
rc = run(cmd_str) | ||
return rc != 0 | ||
|
||
def parse_dhcp_nexthop(ifname): |
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.
Will PPPoE interfaces also work?
I didn't find any code regarding PPP.
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.
Good question, let me look into that.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
f8176d7
to
b740f3e
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
CI integration ❌ failed! Details
|
run(f'ip route replace table {table_num} default dev {ifname} via {health_conf["nexthop"]}') | ||
|
||
run(f'ip route delete table {table_num}') | ||
run(f'ip rule add fwmark {hex(table_num)} table {table_num}') |
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.
The ip rule
are not deleted
vyos@router:~$ show conf com | match wan
set load-balancing wan interface-health eth0 nexthop '10.0.1.1'
set load-balancing wan interface-health eth1 nexthop '10.0.2.1'
vyos@router:~$
vyos@router:~$
vyos@router:~$ ip rule
0: from all lookup local
32756: from all fwmark 0xca lookup 202
32757: from all fwmark 0xc9 lookup 201
32758: from all fwmark 0xca lookup 202
32759: from all fwmark 0xc9 lookup 201
32760: from all fwmark 0xca lookup 202
32761: from all fwmark 0xc9 lookup 201
32762: from all fwmark 0xca lookup 202
32763: from all fwmark 0xc9 lookup 201
32764: from all fwmark 0xca lookup 202
32765: from all fwmark 0xc9 lookup 201
32766: from all lookup main
32767: from all lookup default
vyos@router:~$
vyos@router# delete load-balancing
[edit]
vyos@router# commit
[edit]
vyos@router# ip rule
0: from all lookup local
32756: from all fwmark 0xca lookup 202
32757: from all fwmark 0xc9 lookup 201
32758: from all fwmark 0xca lookup 202
32759: from all fwmark 0xc9 lookup 201
32760: from all fwmark 0xca lookup 202
32761: from all fwmark 0xc9 lookup 201
32762: from all fwmark 0xca lookup 202
32763: from all fwmark 0xc9 lookup 201
32764: from all fwmark 0xca lookup 202
32765: from all fwmark 0xc9 lookup 201
32766: from all lookup main
32767: from all lookup default
[edit]
vyos@router#
vyos@router# set load-balancing wan interface-health eth0 nexthop '10.0.1.1'
[edit]
vyos@router# set load-balancing wan interface-health eth1 nexthop '10.0.2.1'
[edit]
vyos@router# commit
[edit]
vyos@router# ip rule
0: from all lookup local
32746: from all fwmark 0xca lookup 202
32747: from all fwmark 0xc9 lookup 201
32748: from all fwmark 0xca lookup 202
32749: from all fwmark 0xc9 lookup 201
32750: from all fwmark 0xca lookup 202
32751: from all fwmark 0xc9 lookup 201
32752: from all fwmark 0xca lookup 202
32753: from all fwmark 0xc9 lookup 201
32754: from all fwmark 0xca lookup 202
32755: from all fwmark 0xc9 lookup 201
32756: from all fwmark 0xca lookup 202
32757: from all fwmark 0xc9 lookup 201
32758: from all fwmark 0xca lookup 202
32759: from all fwmark 0xc9 lookup 201
32760: from all fwmark 0xca lookup 202
32761: from all fwmark 0xc9 lookup 201
32762: from all fwmark 0xca lookup 202
32763: from all fwmark 0xc9 lookup 201
32764: from all fwmark 0xca lookup 202
32765: from all fwmark 0xc9 lookup 201
32766: from all lookup main
32767: from all lookup default
[edit]
vyos@router#
rules:
check:
Check:
|
'ifname': ifname, | ||
'status': "active" if if_data['state'] else "failed", | ||
'last_change': change_dt.strftime("%Y-%m-%d %H:%M:%S") if change_dt else 'N/A', | ||
'last_success': str(now - success_dt) if success_dt else 'N/A', |
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.
What does the output format mean for Last Interface Success:
?
vyos@router:~$ show wan-load-balance
Interface: eth0
Status: active
Last Status Change: 2024-11-05 14:21:30
Last Interface Success: 0:03:48.162705
Last Interface Failure: N/A
Interface Failures: 0
Interface: eth1
Status: failed
Last Status Change: 2024-11-05 14:21:35
Last Interface Success: 0:03:53.167816
Last Interface Failure: 0:03:43.160109
Interface Failures: 1
vyos@router:~$
else: | ||
cmd('sudo sysctl -w net.netfilter.nf_conntrack_acct=1') | ||
cmd(f'systemctl restart {systemd_service}') | ||
cmd(f'systemctl restart {service}') | ||
|
||
call_dependents() |
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.
I think, call to call_dependents() remains valuable even when the load balancer configuration is empty. It can handle cases where an old configuration has been removed, ensuring all dependencies are correctly updated.
|
||
from vyos.utils.process import run | ||
|
||
dhclient_lease = '/var/lib/dhcp/dhclient_{0}.lease' |
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.
This path seems incorrect:
vyos@router# ls -la /var/lib/dhcp/
total 8
drwxr-xr-x 2 root root 3 Oct 20 2023 .
drwxr-xr-x 1 root root 4096 Nov 5 13:30 ..
[edit]
vyos@router#
The correct path:
vyos@router# cat /run/dhclient/dhclient_eth0.lease
Tue Nov 5 16:19:41 UTC 2024
reason='BOUND'
interface='eth0'
new_expiry='1730909981'
new_dhcp_lease_time='86400'
medium=''
alias_ip_address=''
new_ip_address='10.0.1.10'
new_broadcast_address='10.0.1.255'
new_subnet_mask='255.255.255.0'
new_domain_name=''
new_network_number='10.0.1.0'
new_domain_name_servers='1.1.1.1'
new_routers='10.0.1.1'
new_static_routes=''
new_dhcp_server_identifier='10.0.1.1'
new_dhcp_message_type='5'
old_ip_address=''
old_subnet_mask=''
old_domain_name=''
old_domain_name_servers=''
old_routers=''
old_static_routes=''
Change Summary
This PR migrates the last remaining Vyatta perl module to XML/Python standard.
Types of changes
Related Task(s)
Related PR(s)
Component(s) name
wanloadbalance
Proposed changes
How to test
Smoketest result
Checklist: