As a workaround, I did the following:
vyos@VyOS1:~$ sudo vi /usr/libexec/vyos/conf_mode/protocols_bgp.py
# Only checks for ipv4 and ipv6 neighbors
# Check if neighbor address is assigned as system interface address
if is_ip(peer) and is_addr_assigned(peer):
#raise ConfigError(f'Can not configure a local address as neighbor "{peer}"') <-- Comment out
pass <--Insert
vyos@VyOS1:~$ reboot
The following settings have been made and it is working fine.
vyos@VyOS1:~$ sh conf com | grep bgp
set vrf name R1 protocols bgp local-as '65001'
set vrf name R1 protocols bgp neighbor 192.168.15.5 address-family ipv4-unicast
set vrf name R1 protocols bgp neighbor 192.168.15.5 remote-as '65005'
set vrf name R1 protocols bgp parameters router-id '1.1.1.1'
set vrf name R5 protocols bgp address-family ipv4-unicast network 10.0.0.0/24
set vrf name R5 protocols bgp local-as '65005'
set vrf name R5 protocols bgp neighbor 192.168.15.1 address-family ipv4-unicast
set vrf name R5 protocols bgp neighbor 192.168.15.1 remote-as '65001'
set vrf name R5 protocols bgp parameters router-id '5.5.5.5'
vyos@VyOS1:~$ sh int | grep 192.168.15
eth1.915 192.168.15.1/24 u/u R1--R5
eth2.915 192.168.15.5/24 u/u R5--R1
vyos@VyOS1:~$ sh ip bgp vrf R1 summary
IPv4 Unicast Summary (VRF R1):
BGP router identifier 1.1.1.1, local AS number 65001 vrf-id 5
BGP table version 5
RIB entries 2, using 368 bytes of memory
Peers 1, using 723 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
192.168.15.5 4 65005 23 22 0 0 0 00:01:12 1 1 N/A
Total number of neighbors 1
Could someone please fix it correctly?