Skip to content

Commit

Permalink
bgp.network.[].prefix は bgp.ipv4.network.[].prefix が正しい。
Browse files Browse the repository at this point in the history
また、BGP のひととおりの設定を変換するテストを追加した。
  • Loading branch information
tsahara committed Oct 16, 2024
1 parent 8656936 commit fff3035
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion seil2recipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -4134,7 +4134,7 @@ Converter.rules['route'] = {

'network': (conv, tokens) => {
// route dynamic bgp network add <network_IPv4address/prefixlen>
const k1 = conv.get_index('bgp.network');
const k1 = conv.get_index('bgp.ipv4.network');
conv.add(`${k1}.prefix`, tokens[5]);
},

Expand Down
26 changes: 26 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2261,6 +2261,32 @@ describe('route', () => {
`);
});

it('bgp full', () => {
assertconv(`
route dynamic route-filter add A network 1.1.1.1/32 pass
route dynamic route-filter add B network 2.2.2.2/32 pass
route dynamic bgp my-as-number 65001
route dynamic bgp router-id 192.168.0.1
route dynamic bgp enable
route dynamic bgp neighbor add 192.168.0.2 remote-as 65002 hold-timer 3 weight 1 in-route-filter A out-route-filter B authentication md5 PASSWORD enable
route dynamic bgp neighbor add 192.168.0.3 remote-as 65003 disable
route dynamic bgp network add 192.168.0.0/24
---
bgp.ipv4.network.100.prefix: 192.168.0.0/24
bgp.my-as-number: 65001
bgp.neighbor.100.address: 192.168.0.2
bgp.neighbor.100.authentication.password: PASSWORD
bgp.neighbor.100.filter.in.100.action: pass
bgp.neighbor.100.filter.in.100.match.prefix: 1.1.1.1/32
bgp.neighbor.100.filter.out.100.action: pass
bgp.neighbor.100.filter.out.100.match.prefix: 2.2.2.2/32
bgp.neighbor.100.hold-timer: 3
bgp.neighbor.100.remote-as: 65002
bgp.neighbor.100.weight: 1
bgp.router-id: 192.168.0.1
`);
});

it('can prepend AS-path to routes from neighbors', () => {
assertconv(`
route dynamic route-filter add ASPATH network 10.0.0.0/8 pass set-as-path-prepend 65009,65008
Expand Down

0 comments on commit fff3035

Please sign in to comment.