Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Binary
pathvector

# Test Build
build-test.sh
pathvector-test

# Output files
output/*

Expand Down Expand Up @@ -29,4 +33,4 @@ test-cache/
test-conf.yml
nohup.out
coverage.txt
tests/bird-matrix/v*
tests/bird-matrix/v*
26 changes: 26 additions & 0 deletions docs/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,14 @@ Configuration template
|------|---------|------------|
| string | | |

### `comments`

Extra comments in configuration file

| Type | Default | Validation |
|------|---------|------------|
| []string | | |

### `description`

Peer description
Expand Down Expand Up @@ -775,6 +783,15 @@ Should an explicit local pref be set?
|------|---------|------------|
| bool | true | |

### `bgp-med`

BGP default bgp_med
Value of the Multiple Exit Discriminator to be used during route selection when the MED attribute is missing. Default: 0.

| Type | Default | Validation |
|------|---------|------------|
| int | 0 | |

### `multihop`

Should BGP multihop be enabled? (255 max hops)
Expand All @@ -783,6 +800,15 @@ Should BGP multihop be enabled? (255 max hops)
|------|---------|------------|
| bool | false | |

### `interface`

Interface of BGP listen address

| Type | Default | Validation |
|------|---------|------------|
| string | | |


### `listen4`

IPv4 BGP listen address
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ type Peer struct {
Template *string `yaml:"template" description:"Configuration template" default:"-"`

Description *string `yaml:"description" description:"Peer description" default:"-"`
Comments *[]string `yaml:"comments" comment:"Comments in file" default:"-"`
Tags *[]string `yaml:"tags" description:"Peer tags" default:"-"`
Disabled *bool `yaml:"disabled" description:"Should the sessions be disabled?" default:"false"`

Expand All @@ -111,6 +112,7 @@ type Peer struct {
LocalPref6 *int `yaml:"local-pref6" description:"IPv6 BGP local preference (overrides local-pref, not included in optimizer)" default:"-"`
SetLocalPref *bool `yaml:"set-local-pref" description:"Should an explicit local pref be set?" default:"true"`
Multihop *bool `yaml:"multihop" description:"Should BGP multihop be enabled? (255 max hops)" default:"false"`
Interface *string `yaml:"interface" description:"Interface of BGP listen address" default:"-"`
Listen4 *string `yaml:"listen4" description:"IPv4 BGP listen address" default:"-"`
Listen6 *string `yaml:"listen6" description:"IPv6 BGP listen address" default:"-"`
LocalASN *int `yaml:"local-asn" description:"Local ASN as defined in the global ASN field" default:"-"`
Expand All @@ -137,6 +139,7 @@ type Peer struct {
TTLSecurity *bool `yaml:"ttl-security" description:"RFC 5082 Generalized TTL Security Mechanism" default:"false"`
InterpretCommunities *bool `yaml:"interpret-communities" description:"Should well-known BGP communities be interpreted by their intended action?" default:"true"`
DefaultLocalPref *int `yaml:"default-local-pref" description:"Default value for local preference" default:"-"`
DefaultBgpMed *int `yaml:"bgp-med" description:"Value of the Multiple Exit Discriminator to be used during route selection when the MED attribute is missing." default:"0"`
AdvertiseHostname *bool `yaml:"advertise-hostname" description:"Advertise hostname capability" default:"false"`
DisableAfterError *bool `yaml:"disable-after-error" description:"Disable peer after error" default:"false"`
PreferOlderRoutes *bool `yaml:"prefer-older-routes" description:"Prefer older routes instead of comparing router IDs (RFC 5004)" default:"false"`
Expand Down
20 changes: 20 additions & 0 deletions pkg/embed/templates/peer.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
{{ $peer := .Peer }}{{ $peerName := .Name }}{{ $global := .Config }}

# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!! THIS FILE IS AUTOGENERATED BY PATHVECTOR !!!
# !!! DO NOT EDIT THIS FILE, CHANGES WILL BE OVERRIDEN ON NEXT GENERATION !!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


{{ if not (Empty $peer.Comments) }}
#####
# BGP Session: {{ .Name }} AS{{ $peer.ASN }}
#
{{ range $i, $comment := $peer.Comments }}
# {{ StrDeref $comment }}
{{ end }}
#
#####
{{ else }}
# {{ .Name }} AS{{ $peer.ASN }}
{{ end }}


define AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_IMPORT_v4 = {{ $peer.ImportLimit4 }};
define AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_IMPORT_v6 = {{ $peer.ImportLimit6 }};
Expand Down Expand Up @@ -37,6 +55,7 @@ define AS{{ $peer.ASN }}_{{ $peer.ProtocolName }}_AS_SET_MEMBERS = [
{{ $neighborNoIface := SplitFirst $neighbor "%" }}
protocol bgp {{ UniqueProtocolName $peer.ProtocolName $peerName $af $peer.ASN $peer.Tags }} {
local{{ if eq $af "4" }}{{ if $peer.Listen4 }} {{ $peer.Listen4 }}{{ end }}{{ else }}{{ if $peer.Listen6 }} {{ $peer.Listen6 }}{{ end }}{{ end }} as {{ if IntDeref $peer.LocalASN }}{{ IntDeref $peer.LocalASN }}{{ else }}ASN{{ end }}{{ if $peer.LocalPort }} port {{ $peer.LocalPort }}{{ end }};
{{ if StrDeref $peer.Interface }}interface "{{ StrDeref $peer.Interface }}";{{ end }}
neighbor {{ $neighbor }} as {{ $peer.ASN }}{{ if $peer.NeighborPort }} port {{ $peer.NeighborPort }}{{ end }};
{{ if StrDeref $peer.Description }}description "{{ StrDeref $peer.Description }}";{{ end }}
{{ if BoolDeref $peer.Disabled }}disabled;{{ end }}
Expand All @@ -56,6 +75,7 @@ protocol bgp {{ UniqueProtocolName $peer.ProtocolName $peerName $af $peer.ASN $p
{{ if not (BoolDeref $peer.InterpretCommunities) }}interpret communities off;{{ end }}
{{ if IntDeref $peer.Confederation }}confederation {{ IntDeref $peer.Confederation }};{{ end }}
{{ if IntDeref $peer.DefaultLocalPref }}default bgp_local_pref {{ IntDeref $peer.DefaultLocalPref }};{{ end }}
{{ if IntDeref $peer.DefaultBgpMed }}default bgp_med {{ IntDeref $peer.DefaultBgpMed }};{{ end }}
{{ StrDeref $peer.SessionGlobal }}
{{ $protocols := MakeSlice }}
{{ if BoolDeref $peer.MPUnicast46 }}
Expand Down