summaryrefslogtreecommitdiffhomepage
path: root/docs/sources
diff options
context:
space:
mode:
Diffstat (limited to 'docs/sources')
-rw-r--r--docs/sources/cli-command-syntax.md25
-rw-r--r--docs/sources/cli-operations.md36
-rw-r--r--docs/sources/evpn.md34
-rw-r--r--docs/sources/filter-detail.md663
-rw-r--r--docs/sources/filter.md118
-rw-r--r--docs/sources/getting-started.md22
-rw-r--r--docs/sources/mrt.md15
7 files changed, 534 insertions, 379 deletions
diff --git a/docs/sources/cli-command-syntax.md b/docs/sources/cli-command-syntax.md
index fdbfcac6..a1ade65f 100644
--- a/docs/sources/cli-command-syntax.md
+++ b/docs/sources/cli-command-syntax.md
@@ -313,10 +313,16 @@ If you want to remove one element(extended community) of ExtCommunitySet, to spe
#### - example
If you want to add the RoutePolicy:
```shell
-% gobgp policy routepolicy add policy1 state1 --c-prefix=ps1 --c-neighbor=ns1 --c-aspath=ass1 --c-community=cs1 --c-extcommunity=ecs1 --c-aslen=eq,3 --c-option=all --a-route=reject --a-community=ADD[65100:20] --a-med=+100 --a-asprepend=65100,10
+% gobgp policy routepolicy add policy1 state1 --c-prefix=ANY[ps1] --c-neighbor=INVERT[ns1] --c-aspath=ALL[ass1] --c-community=ALL[cs1] --c-extcommunity=ANY[ecs1] --c-aslen=eq,3 --a-route=reject --a-community=ADD[65100:20] --a-med=+100 --a-asprepend=65100,10
```
However, it is not necessary to specify all of the options at once.
+For the condition of the following option in order to evaluate for each condition, match option(ANY, ALL or INVERT) is set as the ANY[\<each set name\>]
+ - c-prefix
+ - c-neighbor
+ - c-aspath
+ - c-community
+ - c-extcommunity
A RoutePolicy it is possible to have multiple statement, if you want to remove the RoutePolicy to specify only RoutePolicy name.
```shell
@@ -331,15 +337,14 @@ If you want to remove one element(statement) of RoutePolicy, to specify a statem
The following options can be specified in the policy subcommand:
- options of condition
-| short |long | description |
-|--------|---------------|---------------------------------------------------------------------------------|
-|- |c-prefix |specify the name that added prefix set in PrefixSet subcommand |
-|- |c-neighbor |specify the name that added neighbor set in NeighborSet subcommand |
-|- |c-aspath |specify the name that added as path set in AsPathSet subcommand |
-|- |c-community |specify the name that added community set in CommunitySet subcommand |
-|- |c-extcommunity |specify the name that added extended community set in ExtCommunitySet subcommand |
-|- |c-aslen |specify the operator(eq, ge, le) and value(numric) |
-|- |c-option |specify the match option(any, all, invert) |
+| short |long | description |
+|--------|---------------|-----------------------------------------------------------------------------------------------------------------------------------|
+|- |c-prefix |specify the name that added prefix set in PrefixSet subcommand <br> match option: ”ANY or INVERT” can be set |
+|- |c-neighbor |specify the name that added neighbor set in NeighborSet subcommand <br> match option: ”ANY or INVERT” can be set |
+|- |c-aspath |specify the name that added as path set in AsPathSet subcommand <br> match option: ”ANY, ALL or INVERT” can be set |
+|- |c-community |specify the name that added community set in CommunitySet subcommand <br> match option: ”ANY, ALL or INVERT” can be set |
+|- |c-extcommunity |specify the name that added extended community set in ExtCommunitySet subcommand <br> match option: ”ANY, ALL or INVERT” can be set|
+|- |c-aslen |specify the operator(eq, ge, le) and value(numric) |
- options of action
diff --git a/docs/sources/cli-operations.md b/docs/sources/cli-operations.md
index 3a1267ea..2af84e1a 100644
--- a/docs/sources/cli-operations.md
+++ b/docs/sources/cli-operations.md
@@ -31,17 +31,31 @@ should be like the following.
```
[Global]
- As = 64512
- RouterId = "192.168.255.1"
-[[NeighborList]]
- NeighborAddress = "10.0.255.1"
- PeerAs = 65001
-[[NeighborList]]
- NeighborAddress = "10.0.255.2"
- PeerAs = 65002
-[[NeighborList]]
- NeighborAddress = "10.0.255.3"
- PeerAs = 65003
+ [Global.GlobalConfig]
+ As = 64512
+ RouterId = "192.168.255.1"
+
+[Neighbors]
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.1"
+ PeerAs = 65001
+ [Neighbors.NeighborList.RouteServer]
+ RouteServerClient = true
+
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.2"
+ PeerAs = 65002
+ [Neighbors.NeighborList.RouteServer]
+ RouteServerClient = true
+
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.3"
+ PeerAs = 65003
+ [Neighbors.NeighborList.RouteServer]
+ RouteServerClient = true
```
After you send `HUP` signal (`kill` command), you should see 10.0.255.3 peer.
diff --git a/docs/sources/evpn.md b/docs/sources/evpn.md
index 403f9adb..fb5d156f 100644
--- a/docs/sources/evpn.md
+++ b/docs/sources/evpn.md
@@ -20,20 +20,26 @@ implementations can interchange EVPN messages.
```
[Global]
- As = 64512
- RouterId = "192.168.255.1"
-
-[[NeighborList]]
- NeighborAddress = "10.0.255.1"
- PeerAs = 64512
- [[NeighborList.AfiSafiList]]
- AfiSafiName = "l2vpn-evpn"
-
-[[NeighborList]]
- NeighborAddress = "10.0.255.2"
- PeerAs = 64512
- [[NeighborList.AfiSafiList]]
- AfiSafiName = "l2vpn-evpn"
+ [Global.GlobalConfig]
+ As = 64512
+ RouterId = "192.168.255.1"
+
+[Neighbors]
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.1"
+ PeerAs = 64512
+ [Neighbors.NeighborList.AfiSafis]
+ [[Neighbors.NeighborList.AfiSafis.AfiSafiList]]
+ AfiSafiName = "l2vpn-evpn"
+
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.2"
+ PeerAs = 64512
+ [Neighbors.NeighborList.AfiSafis]
+ [[Neighbors.NeighborList.AfiSafis.AfiSafiList]]
+ AfiSafiName = "l2vpn-evpn"
```
The point is that route families to be advertised need to be
diff --git a/docs/sources/filter-detail.md b/docs/sources/filter-detail.md
index 6ae42a0e..9a6ba111 100644
--- a/docs/sources/filter-detail.md
+++ b/docs/sources/filter-detail.md
@@ -15,6 +15,7 @@ Basically a policy has condition part and an action part. The condition part can
- aspath
- aspath length
- community
+ - extended community
A action part is below:
- accept or reject
@@ -23,15 +24,15 @@ A action part is below:
- prepend AS number in the AS_PATH attribute
-GoBGP's configuration file has two parts named DefinedSets and PolicyDefinitionList as its policy configuration.
+GoBGP's configuration file has two parts named DefinedSets and PolicyDefinitions as its policy configuration.
- DefinedSets
- A single DefinedSets entry has prefix match that is named PrefixSetList and neighbor match part that is named NeighborSetList. It also has BgpDefinedSets, a subset of DefinedSets that defines conditions referring to BGP attributes such as aspath. This DefinedSets has a name and it's used to refer to DefinedSets items from outside.
+ A single DefinedSets entry has prefix match that is named PrefixSets and neighbor match part that is named NeighborSets. It also has BgpDefinedSets, a subset of DefinedSets that defines conditions referring to BGP attributes such as aspath. This DefinedSets has a name and it's used to refer to DefinedSets items from outside.
- - PolicyDefinitionList
+ - PolicyDefinitions
- PolicyDefinitionList is a list of policy.
+ PolicyDefinitions has PolicyDefinitionList, it's a list of policy.
A single element of PolicyDefinitionList has a statement part that combines conditions with an action.
@@ -40,51 +41,56 @@ GoBGP's configuration file has two parts named DefinedSets and PolicyDefinitionL
These are steps to define policy:
1. define DefinedSets
- 1. define PrefixSetList
- 1. define NeighborSetList
+ 1. define PrefixSets
+ 1. define NeighborSets
1. define BgpDefinedSets
- 1. define CommunitySetList
+ 1. define CommunitySets
+ 1. define ExtCommunitySets
1. define AsPathSetList
-1. define PolicyDefinitionList
+1. define PolicyDefinitions
1. attach policies to a neighbor
----
### 1. Defining DefinedSets
-DefineSets has prefix information and neighbor information in PrefixSetList and NeighborSetList section, and GoBGP uses these information to evaluate routes.
+DefineSets has prefix information and neighbor information in PrefixSets and NeighborSets section, and GoBGP uses these information to evaluate routes.
Defining DefinedSets is needed at first.
-PrefixSetList and NeighborSetList section are prefix match part and neighbor match part.
+PrefixSets and NeighborSets section are prefix match part and neighbor match part.
- DefinedSets example
```
- [[DefinedSets.PrefixSetList]]
- PrefixSetName = "ps1"
- # prefix match part
- [[DefinedSets.PrefixSetList.PrefixList]]
- Address = "10.33.0.0"
- Masklength = 16
- MasklengthRange = 21...24
- # neighbor match part
- [[DefinedSets.NeighborSetList]]
- NeighborSetName = "ns1"
- [[DefinedSets.NeighborSetList.NeighborInfoList]]
- Address = "10.0.255.1"
+ # prefix match part
+ [DefinedSets.PrefixSets]
+ [[DefinedSets.PrefixSets.PrefixSetList]]
+ PrefixSetName = "ps1"
+ [[DefinedSets.PrefixSets.PrefixSetList.PrefixList]]
+ MasklengthRange = "21..24"
+ [DefinedSets.PrefixSets.PrefixSetList.PrefixList.IpPrefix]
+ IP = "10.33.0.0
+ Mask = [255, 255, 0, 0]
+
+ # neighbor match part
+ [DefinedSets.NeighborSets]
+ [[DefinedSets.NeighborSetList]]
+ NeighborSetName = "ns1"
+ [[DefinedSets.NeighborSetList.NeighborInfoList]]
+ Address = "10.0.255.1"
```
----
- #### PrefixSetList
- PrefixSetList has PrefixList as its element. PrefixList has prefix information to match destination's address and we can specify route's NLRI inside.
+ #### PrefixSets
+ PrefixSets has PrefixSetList, and PrefixSetList has PrefixList as its element. PrefixList has prefix information to match destination's address and we can specify route's NLRI inside.
- PrefixList has 3 elements.
+ PrefixSetList has 3 elements.
| Element |Description | Example | Optional |
|-----------------|-------------------|------------|------------|
| PrefixSetName | name of PrefixSet | "10.33.0.0"| |
- | Address | prefix address | "10.33.0.0"| |
- | Masklength | prefix length | 16 | |
- | MasklengthRange | range of length | "25..28" | Yes |
+ | IP | prefix address | "10.33.0.0"| |
+ | MASK | prefix length | 16 | |
+ | MasklengthRange | range of length | "21..24" | Yes |
##### Examples
@@ -93,12 +99,14 @@ PrefixSetList and NeighborSetList section are prefix match part and neighbor mat
```
# example 1
- [[DefinedSets.PrefixSetList]]
- PrefixSetName = "ps1"
- [[DefinedSets.PrefixSetList.PrefixList]]
- Address = "10.33.0.0"
- Masklength = 16
- MasklengthRange = "21...24"
+ [DefinedSets.PrefixSets]
+ [[DefinedSets.PrefixSets.PrefixSetList]]
+ PrefixSetName = "ps1"
+ [[DefinedSets.PrefixSets.PrefixSetList.PrefixList]]
+ MasklengthRange = "21..24"
+ [DefinedSets.PrefixSets.PrefixSetList.PrefixList.IpPrefix]
+ IP = "10.33.0.0"
+ Mask = [255, 255, 0, 0]
```
- If you define a PrefixList that doesn't have MasklengthRange, it matches routes that have just 10.33.0.0/16 as NLRI.
@@ -109,16 +117,19 @@ PrefixSetList and NeighborSetList section are prefix match part and neighbor mat
```
# example 2
- [[DefinedSets.PrefixSetList]]
- PrefixSetName = "ps1"
- [[DefinedSets.PrefixSetList.PrefixList]]
- Address = "10.33.0.0"
- Masklength = 16
- MasklengthRange = "21...24"
- [[DefinedSets.PrefixSetList.PrefixList]]
- Address = "10.50.0.0"
- Masklength = 16
- MasklengthRange = "21...24"
+ [DefinedSets.PrefixSets]
+ [[DefinedSets.PrefixSets.PrefixSetList]]
+ PrefixSetName = "ps1"
+ [[DefinedSets.PrefixSets.PrefixSetList.PrefixList]]
+ MasklengthRange = "21..24"
+ [DefinedSets.PrefixSets.PrefixSetList.PrefixList.IpPrefix]
+ IP = "10.33.0.0"
+ Mask = [255, 255, 0, 0]
+ [[DefinedSets.PrefixSets.PrefixSetList.PrefixList]]
+ MasklengthRange = "21..24"
+ [DefinedSets.PrefixSets.PrefixSetList.PrefixList.IpPrefix]
+ IP = "10.50.0.0"
+ Mask = [255, 255, 0, 0]
```
- This prefix match checks if a route has 10.33.0.0/21 to 24 **or** 10.50.0.0/21 to 24.
@@ -129,30 +140,33 @@ PrefixSetList and NeighborSetList section are prefix match part and neighbor mat
```
# example 3
- # PrefixSetList
- [[DefinedSets.PrefixSetList]]
- PrefixSetName = "ps1"
- [[DefinedSets.PrefixSetList.PrefixList]]
- Address = "10.33.0.0"
- Masklength = 16
- MasklengthRange = "21...24"
- # another PrefixSetList
- [[DefinedSets.PrefixSetList]]
- PrefixSetName = "ps2"
- [[DefinedSets.PrefixSetList.PrefixList]]
- Address = "10.50.0.0"
- Masklength = 16
- MasklengthRange = "21...24"
+ [DefinedSets.PrefixSets]
+ # PrefixSetList
+ [[DefinedSets.PrefixSets.PrefixSetList]]
+ PrefixSetName = "ps1"
+ [[DefinedSets.PrefixSets.PrefixSetList.PrefixList]]
+ MasklengthRange = "21..24"
+ [DefinedSets.PrefixSets.PrefixSetList.PrefixList.IpPrefix]
+ IP = "10.33.0.0"
+ Mask = [255, 255, 0, 0]
+ # another PrefixSetList
+ [[DefinedSets.PrefixSets.PrefixSetList]]
+ PrefixSetName = "ps2"
+ [[DefinedSets.PrefixSets.PrefixSetList.PrefixList]]
+ MasklengthRange = "21..24"
+ [DefinedSets.PrefixSets.PrefixSetList.PrefixList.IpPrefix]
+ IP = "10.50.0.0
+ Mask = [255, 255, 0, 0]
```
----
- #### NeighborSetList
+ #### NeighborSets
- NeighborSetList has NeighborInfoList as its element and NeighborInfoList has neighbor information to match the sender of the routes.
+ NeighborSets has NeighborSetList, and NeighborSetList has NeighborInfoList as its element and NeighborInfoList has neighbor information to match the sender of the routes.
It is necessary to specify a neighbor address in NeighborInfoList.
- NeighborInfoList has 2 elements.
+ NeighborSetList has 2 elements.
| Element |Description | Example | Optional |
|-----------------|---------------------|--------------|------------|
@@ -166,75 +180,81 @@ PrefixSetList and NeighborSetList section are prefix match part and neighbor mat
```
# example 1
- [[DefinedSets.NeighborSetList]]
- NeighborSetName = "ns1"
- [[DefinedSets.NeighborSetList.NeighborInfoList]]
- Address = "10.0.255.1"
+ [DefinedSets.NeighborSets]
+ [[DefinedSets.NeighborSets.NeighborSetList]]
+ NeighborSetName = "ns1"
+ [[DefinedSets.NeighborSets.NeighborSetList.NeighborInfoList]]
+ Address = "10.0.255.1"
```
- example 2
- - Match routes which come from the neighbor 10.0.255.1
+ - Match routes which come from the neighbor 10.0.255.2
```
# example 2
- [[DefinedSets.NeighborSetList]]
- NeighborSetName = "ns2"
- [[DefinedSets.NeighborSetList.NeighborInfoList]]
- Address = "10.0.255.1"
+ [DefinedSets.NeighborSets]
+ [[DefinedSets.NeighborSets.NeighborSetList]]
+ NeighborSetName = "ns2"
+ [[DefinedSets.NeighborSets.NeighborSetList.NeighborInfoList]]
+ Address = "10.0.255.2"
```
- example 3
- - As with PrefixSet, NeighborSet can have multiple NeighborInfoList like this.
+ - As with PrefixSetList, NeighborSetList can have multiple NeighborInfoList like this.
- This example checks if a route comes from neighbor 10.0.255.1 **or** 10.0.255.2.
```
# example 3
- [[DefinedSets.NeighborSetList]]
- NeighborSetName = "ns3"
- [[DefinedSets.NeighborSetList.NeighborInfoList]]
- Address = "10.0.255.1"
- [[DefinedSets.NeighborSetList.NeighborInfoList]]
- Address = "10.0.255.2"
+ [DefinedSets.NeighborSets]
+ [[DefinedSets.NeighborSets.NeighborSetList]]
+ NeighborSetName = "ns3"
+ [[DefinedSets.NeighborSets.NeighborSetList.NeighborInfoList]]
+ Address = "10.0.255.1"
+ [[DefinedSets.NeighborSets.NeighborSetList.NeighborInfoList]]
+ Address = "10.0.255.2"
```
---
### 2. Defining BgpDefinedSets
-BgpDefinedSets has Community information, Extended Community information and AS_PATH information in each SetList section respectively. And it is a child element of DefinedSets.
-CommunitySetList, ExtCommunitySetList and AsPathSetList section are each match part.
+BgpDefinedSets has Community information, Extended Community information and AS_PATH information in each Sets section respectively. And it is a child element of DefinedSets.
+CommunitySets, ExtCommunitySets and AsPathSets section are each match part.
- BgpDefinedSets example
```
- [DefinedSets.BgpDefinedSets]
- # Community match part
- [[DefinedSets.BgpDefinedSets.CommunitySetList]]
- CommunitySetName = "community1"
- CommunityMembers = ["65100:10"]
- # Extended Community match part
- [[DefinedSets.BgpDefinedSets.ExtCommunitySetList]]
- ExtCommunitySetName = "ecommunity1"
- ExtCommunityMembers = ["RT:65001:200"]
- # AS_PATH match part
- [[DefinedSets.BgpDefinedSets.AsPathSetList]]
- AsPathSetName = "aspath1"
- AsPathSetMembers = ["^65100"]
+ [DefinedSets.BgpDefinedSets]
+ # Community match part
+ [DefinedSets.BgpDefinedSets.CommunitySets]
+ [[DefinedSets.BgpDefinedSets.CommunitySets.CommunitySetList]]
+ CommunitySetName = "community1"
+ CommunityMember = ["65100:10"]
+ # Extended Community match part
+ [DefinedSets.BgpDefinedSets.ExtCommunitySets]
+ [[DefinedSets.BgpDefinedSets.ExtCommunitySets.ExtCommunitySetList]]
+ ExtCommunitySetName = "ecommunity1"
+ ExtCommunityMember = ["RT:65001:200"]
+ # AS_PATH match part
+ [DefinedSets.BgpDefinedSets.AsPathSets]
+ [[DefinedSets.BgpDefinedSets.AsPathSets.AsPathSetList]]
+ AsPathSetName = "aspath1"
+ AsPathSetMember = ["^65100"]
```
----
- #### CommunitySetList
- CommunitySetList has Community value as its element. The values are used to evaluate communities held by the destination.
+ #### CommunitySets
+ CommunitySets has CommunitySetList, and CommunitySetList has Community value as its element. The values are used to evaluate communities held by the destination.
CommunitySetList has 2 elements.
| Element | Description | Example | Optional |
|------------------|-------------------------|--------------|----------|
| CommunitySetName | name of CommunitySet | "community1" | |
- | CommunityMembers | list of Community value | ["65100:10"] | |
+ | CommunityMember | list of Community value | ["65100:10"] | |
- You can use regular expressions to specify communities in CommunityMembers element.
+ You can use regular expressions to specify communities in CommunityMember element.
##### Examples
- example 1
@@ -242,10 +262,11 @@ CommunitySetList, ExtCommunitySetList and AsPathSetList section are each match p
```
# example 1
- [DefinedSets.BgpDefinedSets]
- [[DefinedSets.BgpDefinedSets.CommunitySetList]]
- CommunitySetName = "community1"
- CommunityMembers = ["65100:10"]
+ [DefinedSets.BgpDefinedSets]
+ [DefinedSets.BgpDefinedSets.CommunitySets]
+ [[DefinedSets.BgpDefinedSets.CommunitySets.CommunitySetList]]
+ CommunitySetName = "community1"
+ CommunityMember = ["65100:10"]
```
- example 2
@@ -255,24 +276,25 @@ CommunitySetList, ExtCommunitySetList and AsPathSetList section are each match p
```
# example 2
[DefinedSets.BgpDefinedSets]
- [[DefinedSets.BgpDefinedSets.CommunitySetList]]
- CommunitySetName = "community2"
- CommunityMembers = ["6[0-9]+:[0-9]+"]
+ [DefinedSets.BgpDefinedSets.CommunitySets]
+ [[DefinedSets.BgpDefinedSets.CommunitySets.CommunitySetList]]
+ CommunitySetName = "community2"
+ CommunityMember = ["6[0-9]+:[0-9]+"]
```
----
- #### ExtCommunitySetList
- ExtCommunitySetList has Extended Community value as its element. The values are used to evaluate extended communities held by the destination.
+ #### ExtCommunitySets
+ ExtCommunitySets has ExtCommunitySetList, and ExtCommunitySetList has Extended Community value as its element. The values are used to evaluate extended communities held by the destination.
ExtCommunitySetList has 2 elements.
| Element | Description | Example | Optional |
|---------------------|----------------------------|------------------|----------|
| ExtCommunitySetName | name of ExtCommunitySet | "ecommunity1" | |
- | ExtCommunityMembers | list of ExtCommunity value | ["RT:65001:200"] | |
+ | ExtCommunityMember | list of ExtCommunity value | ["RT:65001:200"] | |
- You can use regular expressions to specify extended communities in ExtCommunityMembers element.
- However: the first one element separated by (part of "RT") does not support to the regular expression.
+ You can use regular expressions to specify extended communities in ExtCommunityMember element.
+ However, the first one element separated by (part of "RT") does not support to the regular expression.
part of "RT" indicate sub type of extended community and using sub type as follows:
- RT: mean the route target.
@@ -285,10 +307,11 @@ CommunitySetList, ExtCommunitySetList and AsPathSetList section are each match p
```
# example 1
- [DefinedSets.BgpDefinedSets]
- [[DefinedSets.BgpDefinedSets.ExtCommunitySetList]]
- ExtCommunitySetName = "ecommunity1"
- ExtCommunityMembers = ["RT:65001:200"]
+ [DefinedSets.BgpDefinedSets]
+ [DefinedSets.BgpDefinedSets.ExtCommunitySets]
+ [[DefinedSets.BgpDefinedSets.ExtCommunitySets.ExtCommunitySetList]]
+ ExtCommunitySetName = "ecommunity1"
+ ExtCommunityMember = ["RT:65001:200"]
```
- example 2
@@ -297,24 +320,25 @@ CommunitySetList, ExtCommunitySetList and AsPathSetList section are each match p
```
# example 2
- [DefinedSets.BgpDefinedSets]
- [[DefinedSets.BgpDefinedSets.ExtCommunitySetList]]
- ExtCommunitySetName = "ecommunity1"
- ExtCommunityMembers = ["RT:6[0-9]+:[0-9]+"]
+ [DefinedSets.BgpDefinedSets]
+ [DefinedSets.BgpDefinedSets.ExtCommunitySets]
+ [[DefinedSets.BgpDefinedSets.ExtCommunitySets.ExtCommunitySetList]]
+ ExtCommunitySetName = "ecommunity1"
+ ExtCommunityMember = ["RT:6[0-9]+:[0-9]+"]
```
----
- #### AsPathSetList
- AsPathSetList has AS numbers as its element. The numbers are used to evaluate AS numbers in the destination's AS_PATH attribute.
+ #### AsPathSets
+ AsPathSets has AsPathSetList, and AsPathSetList has AS numbers as its element. The numbers are used to evaluate AS numbers in the destination's AS_PATH attribute.
- CommunitySetList has 2 elements.
+ AsPathSetList has 2 elements.
| Element | Description | Example | Optional |
|------------------|-------------------|------------|----------|
| AsPathSetName | name of AsPathSet | "aspath1" | |
- | AsPathSetMembers | list of AS number | ["^65100"] | |
+ | AsPathSetMember | list of AS number | ["^65100"] | |
You can specify the position using regexp-like expression as follows:
- From: "^65100" means the route is passed from AS 65100 directly.
@@ -322,115 +346,148 @@ CommunitySetList, ExtCommunitySetList and AsPathSetList section are each match p
- Origin: "65100$" means the route is originated by AS 65100.
- Only: "^65100$" means the route is originated by AS 65100 and comes from it directly.
- ##### Examples
- - example 1
- - Match routes which come from AS 65100.
+ ##### Examples
+ - example 1
+ - Match routes which come from AS 65100.
- ```
- # example 1
- [DefinedSets.BgpDefinedSets]
- [[DefinedSets.BgpDefinedSets.AsPathSetList]]
- AsPathSetName = "aspath1"
- AsPathSetMembers = ["^65100"]
- ```
+ ```
+ # example 1
+ [DefinedSets.BgpDefinedSets]
+ [DefinedSets.BgpDefinedSets.AsPathSets]
+ [[DefinedSets.BgpDefinedSets.AsPathSets.AsPathSetList]]
+ AsPathSetName = "aspath1"
+ AsPathSetMember = ["^65100"]
+ ```
---
-### 3. Defining PolicyDefinitionList
-PolicyDefinitionList consists of condition and action of the policy. The condition part evaluates routes from neighbors and applies action if the routes match conditions. You can use DefinedSets above and other conditions to specify conditions in the PolicyDefinitionList.
+### 3. Defining PolicyDefinitions
+PolicyDefinitions has PolicyDefinitionList, and PolicyDefinitionList consists of condition and action of the policy. The condition part evaluates routes from neighbors and applies action if the routes match conditions. You can use DefinedSets above and other conditions to specify conditions in the PolicyDefinitions.
-PolicyDefinitionList has PolicyDefinition as its element and the PolicyDefinition is a policy itself.
-You can write condition and action under StatementList.
+PolicyDefinitions has PolicyDefinition as its element and the PolicyDefinition is a policy itself.
+You can write condition and action under Statements.
- - an example of PolicyDefinitionList
+ - an example of PolicyDefinitions
```
- [[PolicyDefinitionList]]
- Name = "example-policy"
- [[PolicyDefinitionList.StatementList]]
- Name = "statement1"
- [PolicyDefinitionList.StatementList.Conditions]
- MatchPrefixSet = "ps2"
- MatchNeighborSet = "ns1"
- MatchSetOptions = 1
- [PolicyDefinitionList.StatementList.Conditions.BgpConditions]
- MatchCommunitySet = "community1"
- MatchAsPathSet = "aspath1"
- [PolicyDefinitionList.StatementList.Conditions.BgpConditions.AsPathLength]
- Operator = "eq"
- Value = 2
- [PolicyDefinitionList.StatementList.Actions]
- AcceptRoute = true
- [PolicyDefinitionList.StatementList.Actions.BgpActions]
- SetMed = "-200"
- [PolicyDefinitionList.StatementList.Actions.BgpActions.SetCommunity]
- Communities = ["65100:20"]
- Options = "ADD"
- [PolicyDefinitionList.StatementList.Actions.BgpActions.SetAsPathPrepend]
- As = "65005"
- RepeatN = 5
+[PolicyDefinitions]
+ [[PolicyDefinitions.PolicyDefinitionList]]
+ Name = "example-policy"
+ [PolicyDefinitions.PolicyDefinitionList.Statements]
+ [[PolicyDefinitions.PolicyDefinitionList.Statements.StatementList]]
+ Name = "statement1"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchPrefixSet]
+ PrefixSet = "ps1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchNeighborSet]
+ NeighborSet = "ns1"
+ MatchSetOptions = 1
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.MatchCommunitySet]
+ CommunitySet = "community1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.MatchExtCommunitySet]
+ ExtCommunitySet = "ecommunity1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.MatchAsPathSet]
+ AsPathSet = "aspath1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.AsPathLength]
+ Operator = "eq"
+ Value = 2
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.RouteDisposition]
+ AcceptRoute = true
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.BgpActions]
+ SetMed = "-200"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.BgpActions.SetAsPathPrepend]
+ As = "65005"
+ RepeatN = 5
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.BgpActions.SetCommunity]
+ Options = "ADD"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.BgpActions.SetCommunity.SetCommunityMethod]
+ Communities = ["65100:20"]
+
```
The elements of PolicyDefinitionList are as follows:
- - PolicyDefinitionList
+ - PolicyDefinitions.PolicyDefinitionList
| Element | Description | Example |
|---------|---------------|------------------|
| name | policy's name | "example-policy" |
- - PolicyDefinitionList.StatementList
+ - PolicyDefinitionsPolicyDefinitionList.StatementList
- | Element | Description | Example |
- |---------|---------------|--------------------|
+ | Element | Description | Example |
+ |---------|-------------------|----------------|
| name | statements's name | "statement1" |
- - PolicyDefinitionList.StatementList.Conditions
+ - PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchPrefixSet
+
+ | Element | Description | Example |
+ |------------------|---------------------------------------------------------------------------|---------|
+ | PrefixSet | name for DefinedSets.PrefixSets.PrefixSetList that is used in this policy | "ps1" |
+ | MatchSetOptions | option for the check:<br> 0 means **ANY**,<br> 1 means **INVERT** | 0 |
+
+ - PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchNegihborSet
- | Element | Description | Example |
- |------------------|------------------------------------------------------------------------------------------|---------|
- | MatchPrefixSet | name for DefinedSets.PrefixSetList that is used in this policy | "ps2" |
- | MatchNeighborSet | name for DefinedSets.NeighborSetList that is used in this policy | "ns1" |
- | MatchSetOptions | option for the check:<br> 0 means **ANY**,<br> 1 means **ALL**,<br> 2 means **INVERT** | 1 |
+ | Element | Description | Example |
+ |------------------|-------------------------------------------------------------------------------|---------|
+ | NegihborSet | name for DefinedSets.NeighborSets.NeighborSetList that is used in this policy | "ns1" |
+ | MatchSetOptions | option for the check:<br> 0 means **ANY**,<br> 1 means **INVERT** | 1 |
+ - PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.MatchCommunitySet
- - PolicyDefinitionList.StatementList.Conditions.BgpConditions
+ | Element | Description | Example |
+ |------------------|------------------------------------------------------------------------------------------------|----------------|
+ | CommunitySet | name for DefinedSets.BgpDefinedSets.CommunitySets.CommunitySetList that is used in this policy | "community1" |
+ | MatchSetOptions | option for the check:<br> 0 means **ANY**,<br> 1 means **ALL**,<br> 2 means **INVERT** | 0 |
- | Element | Description | Example |
- |-------------------|----------------------------------------------------------------------------------|--------------|
- | MatchCommunitySet | name for DefinedSets.BgpDefinedSets.CommunitySetList that is used in this policy | "community1" |
- | MatchAsPathSet | name for DefinedSets.BgpDefinedSets.AsPathSetList that is used in this policy | "aspath1" |
+ - PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.MatchExtCommunitySet
+ | Element | Description | Example |
+ |------------------|------------------------------------------------------------------------------------------------------|---------------|
+ | ExtCommunitySet | name for DefinedSets.BgpDefinedSets.ExtCommunitySets.ExtCommunitySetList that is used in this policy | "ecommunity1" |
+ | MatchSetOptions | option for the check:<br> 0 means **ANY**,<br> 1 means **ALL**,<br> 2 means **INVERT** | 1 |
- - PolicyDefinitionList.StatementList.Conditions.BgpConditions.AsPathLength
+ - PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.MatchAsPathSet
+
+ | Element | Description | Example |
+ |------------------|------------------------------------------------------------------------------------------------|-----------|
+ | AsPathSet | name for DefinedSets.BgpDefinedSets.AsPathSets.AsPathSetList that is used in this policy | "aspath1" |
+ | MatchSetOptions | option for the check:<br> 0 means **ANY**,<br> 1 means **ALL**,<br> 2 means **INVERT** | 0 |
+
+ - PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.AsPathLength
| Element | Description | Example |
|----------|----------------------------------------------------------------------------------------------------|---------|
| Operator | operator to compare the length of AS number in AS_PATH attribute. <br> "eq","ge","le" can be used. <br> "eq" means that length of AS number is equal to Value element <br> "ge" means that length of AS number is equal or greater than the Value element <br> "le" means that length of AS number is equal or smaller than the Value element| "eq" |
| Value | value used to compare with the length of AS number in AS_PATH attribute | 2 |
-
- - PolicyDefinitionList.StatementList.Actions
+ - PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.RouteDisposition
| Element | Description | Example |
|-------------|-----------------------------------------------------------------------------------|---------|
| AcceptRoute | action to accept the route if matches conditions. If true, this route is accepted | true |
- - PolicyDefinitionList.StatementList.Actions.BgpActions
+ - PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.BgpActions
- | Element | Description | Example |
- |---------|----------------------------------------------------------------------------------|---------|
+ | Element | Description | Example |
+ |---------|---------------------------------------------------------------------------------------|---------|
| SetMed | SetMed used to change the med value of the route. <br> If only numbers have been specified, replace the med value of route.<br> if number and operater(+ or -) have been specified, adding or subtracting the med value of route. | "-200" |
- - PolicyDefinitionList.StatementList.Actions.BgpActions.SetCommunity
+ - PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.BgpActions.SetCommunity
+
+ | Element | Description | Example |
+ |-------------|----------------------------------------------------------------------------------|------------|
+ | Options | operator to manipulate Community attribute in the route | "ADD" |
+ | Communities | communities used to manipulate the route's community accodriong to Options below | "65100:20" |
- | Element | Description | Example |
- |-------------|----------------------------------------------------------------------------------|---------|
- | Communities | communities used to manipulate the route's community accodriong to Options below | "65100:20" |
- | Options | operator to manipulate Community attribute in the route | "ADD" |
+ - PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.BgpActions.SetAsPathPrepend
- - PolicyDefinitionList.StatementList.Actions.BgpActions.SetAsPathPrepend
-
| Element | Description | Example |
|---------|-------------------------------------------------------------------------------------------------------|---------|
| As | AS number to prepend. You can use "last-as" to prepend the leftmost AS number in the aspath attribute.| "65100" |
@@ -444,16 +501,22 @@ You can write condition and action under StatementList.
```
# example 1
- [[PolicyDefinitionList]]
- Name = "policy1"
- [[PolicyDefinitionList.StatementList]]
- Name = "statement1"
- [PolicyDefinitionList.StatementList.Conditions]
- MatchPrefixSet = "ps2"
- MatchNeighborSet = "ns1"
- MatchSetOptions = 1
- [PolicyDefinitionList.StatementList.Actions]
- RejectRoute = true
+[PolicyDefinitions]
+ [[PolicyDefinitions.PolicyDefinitionList]]
+ Name = "policy1"
+ [PolicyDefinitions.PolicyDefinitionList.Statements]
+ [[PolicyDefinitions.PolicyDefinitionList.Statements.StatementList]]
+ Name = "statement1"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchPrefixSet]
+ PrefixSet = "ps1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchNeighborSet]
+ NeighborSet = "ns1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.RouteDisposition]
+ RejectRoute = true
```
- example 2
@@ -461,26 +524,36 @@ You can write condition and action under StatementList.
```
# example 2
- [[PolicyDefinitionList]]
- Name = "policy1"
- # first statement - (1)
- [[PolicyDefinitionList.StatementList]]
- Name = "statement1"
- [PolicyDefinitionList.StatementList.Conditions]
- MatchPrefixSet = "ps1"
- MatchNeighborSet = "ns1"
- MatchSetOptions = 1
- [PolicyDefinitionList.StatementList.Actions]
- RejectRoute = true
- # second statement - (2)
- [[PolicyDefinitionList.StatementList]]
- Name = "statement2"
- [PolicyDefinitionList.StatementList.Conditions]
- MatchPrefixSet = "ps2"
- MatchNeighborSet = "ns2"
- MatchSetOptions = 1
- [PolicyDefinitionList.StatementList.Actions]
- RejectRoute = true
+[PolicyDefinitions]
+ [[PolicyDefinitions.PolicyDefinitionList]]
+ Name = "policy1"
+ [PolicyDefinitions.PolicyDefinitionList.Statements]
+ # first statement - (1)
+ [[PolicyDefinitions.PolicyDefinitionList.Statements.StatementList]]
+ Name = "statement1"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchPrefixSet]
+ PrefixSet = "ps1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchNeighborSet]
+ NeighborSet = "ns1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.RouteDisposition]
+ RejectRoute = true
+ # second statement - (2)
+ [[PolicyDefinitions.PolicyDefinitionList.Statements.StatementList]]
+ Name = "statement2"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchPrefixSet]
+ PrefixSet = "ps2"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchNeighborSet]
+ NeighborSet = "ns2"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.RouteDisposition]
+ RejectRoute = true
```
- if a route matches the condition inside the first statement(1), GoBGP applies its action and quits the policy evaluation.
@@ -491,30 +564,38 @@ You can write condition and action under StatementList.
```
# example 3
# first policy
- [[PolicyDefinitionList]]
- Name = "policy1"
-
- [[PolicyDefinitionList.StatementList]]
- Name = "statement1"
- [PolicyDefinitionList.StatementList.Conditions]
- MatchPrefixSet = "ps1"
- MatchNeighborSet = "ns1"
- MatchSetOptions = 1
- [PolicyDefinitionList.StatementList.Actions]
- RejectRoute = true
-
- # second policy
- [[PolicyDefinitionList]]
- Name = "policy2"
-
- [[PolicyDefinitionList.StatementList]]
- Name = "statement2"
- [PolicyDefinitionList.StatementList.Conditions]
- MatchPrefixSet = "ps2"
- MatchNeighborSet = "ns2"
- MatchSetOptions = 1
- [PolicyDefinitionList.StatementList.Actions]
- RejectRoute = true
+[PolicyDefinitions]
+ [[PolicyDefinitions.PolicyDefinitionList]]
+ Name = "policy1"
+ [PolicyDefinitions.PolicyDefinitionList.Statements]
+ [[PolicyDefinitions.PolicyDefinitionList.Statements.StatementList]]
+ Name = "statement1"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchPrefixSet]
+ PrefixSet = "ps1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchNeighborSet]
+ NeighborSet = "ns1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.RouteDisposition]
+ RejectRoute = true
+ # second policy
+ [[PolicyDefinitions.PolicyDefinitionList]]
+ Name = "policy2"
+ [PolicyDefinitions.PolicyDefinitionList.Statements]
+ [[PolicyDefinitions.PolicyDefinitionList.Statements.StatementList]]
+ Name = "statement2"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchPrefixSet]
+ PrefixSet = "ps2"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchNeighborSet]
+ NeighborSet = "ns2"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.RouteDisposition]
+ RejectRoute = true
```
- example 4
@@ -522,6 +603,7 @@ You can write condition and action under StatementList.
- PrefixSet: *ps1*
- NeighborSet: *ns1*
- CommunitySet: *community1*
+ - ExtCommunitySet: *ecommunity1*
- AsPathSet: *aspath1*
- AsPath length: *equal 2*
@@ -529,30 +611,44 @@ You can write condition and action under StatementList.
```
# example 4
- [[PolicyDefinitionList]]
- Name = "policy1"
- [[PolicyDefinitionList.StatementList]]
- Name = "statement1"
- [PolicyDefinitionList.StatementList.Conditions]
- MatchPrefixSet = "ps1"
- MatchNeighborSet = "ns1"
- MatchSetOptions = 1
- [PolicyDefinitionList.StatementList.Conditions.BgpConditions]
- MatchCommunitySet = "community1"
- MatchAsPathSet = "aspath1"
- [PolicyDefinitionList.StatementList.Conditions.BgpConditions.AsPathLength]
- Operator = "eq"
- Value = 2
- [PolicyDefinitionList.StatementList.Actions]
- AcceptRoute = true
- [PolicyDefinitionList.StatementList.Actions.BgpActions]
- SetMed = "-200"
- [PolicyDefinitionList.StatementList.Actions.BgpActions.SetCommunity]
- Communities = ["65100:20"]
- Options = "ADD"
- [PolicyDefinitionList.StatementList.Actions.BgpActions.SetAsPathPrepend]
- As = "65005"
- RepeatN = 5
+[PolicyDefinitions]
+ [[PolicyDefinitions.PolicyDefinitionList]]
+ Name = "policy1"
+ [PolicyDefinitions.PolicyDefinitionList.Statements]
+ [[PolicyDefinitions.PolicyDefinitionList.Statements.StatementList]]
+ Name = "statement1"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchPrefixSet]
+ PrefixSet = "ps1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchNeighborSet]
+ NeighborSet = "ns1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.MatchCommunitySet]
+ CommunitySet = "community1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.MatchExtCommunitySet]
+ ExtCommunitySet = "ecommunity1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.MatchAsPathSet]
+ AsPathSet = "aspath1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.BgpConditions.AsPathLength]
+ Operator = "eq"
+ Value = 2
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.RouteDisposition]
+ AcceptRoute = true
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.BgpActions]
+ SetMed = "-200"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.BgpActions.SetAsPathPrepend]
+ As = "65005"
+ RepeatN = 5
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.BgpActions.SetCommunity]
+ Options = "ADD"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.BgpActions.SetCommunity.SetCommunityMethod]
+ Communities = ["65100:20"]
```
@@ -564,32 +660,35 @@ attaching them to neighbors.
Note: The distribute policy is applied only when the peer is Route Server client.
-To attach policies to neighbors, you need to add policy's name to NeighborList.ApplyPolicy in the neighbor's setting.
+To attach policies to neighbors, you need to add policy's name to Neighbors.NeighborList.ApplyPolicy in the neighbor's setting.
This example attatches *policy1* to import policy and *policy2* to export policy and *policy3* is used as the distribute policy.
```
-[[NeighborList]]
-NeighborAddress = "10.0.255.2"
-PeerAs = 65002
-[NeighborList.RouteServer]
-RouteServerClient = true
-[NeighborList.ApplyPolicy]
-ImportPolicies = ["policy1"]
-ExportPolicies = ["policy2"]
-DistributePolicies = ["policy3"]
-DefaultImportPolicy = 0
-DefaultExportPolicy = 0
-DefaultDistributePolicy = 0
+[Neighbors]
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.2"
+ PeerAs = 65002
+ [Neighbors.NeighborList.RouteServer]
+ RouteServerClient = true
+ [Neighbors.NeighborList.ApplyPolicy]
+ [Neighbors.NeighborList.ApplyPolicy.ApplyPolicyConfig]
+ ImportPolicy = ["policy1"]
+ ExportPolicy = ["policy2"]
+ DistributedPolicy = ["policy3"]
+ DefaultImportPolicy = 0
+ DefaultExportPolicy = 0
+ DefaultDistributePolicy = 0
```
-NeighborList has a section to specify policies and the section's name is ApplyPolicy.
+Neighbors.NeighborList has a section to specify policies and the section's name is ApplyPolicy.
The ApplyPolicy has 6 elements.
| Element | Description | Example |
|-------------------------|---------------------------------------------------------------------------------------------|------------|
-| ImportPolicies | PolicyDefinitionList.name for import policy | "policy1" |
-| ExportPolicies | PolicyDefinitionList.name for export policy | "policy2" |
-| DistributePolicies | PolicyDefinitionList.name for distribute policy | "policy3" |
+| ImportPolicy | PolicyDefinitions.PolicyDefinitionList.name for import policy | "policy1" |
+| ExportPolicy | PolicyDefinitions.PolicyDefinitionList.name for export policy | "policy2" |
+| DistributedPolicy | PolicyDefinitions.PolicyDefinitionList.name for distribute policy | "policy3" |
| DefaultImportPolicy | action when the route doesn't match any policy:<br> 0 means import,<br> 1 means reject | 0 |
| DefaultExportPolicy | action when the route doesn't match any policy:<br> 0 means export,<br> 1 means discard | 0 |
| DefaultDistributePolicy | action when the route doesn't match any policy:<br> 0 means distribute,<br> 1 means reject | 0 |
diff --git a/docs/sources/filter.md b/docs/sources/filter.md
index 7e186f95..d87e9735 100644
--- a/docs/sources/filter.md
+++ b/docs/sources/filter.md
@@ -32,60 +32,80 @@ define an import policy for neighbor 10.0.255.2 that drops
```
[Global]
- As = 64512
- RouterId = "192.168.255.1"
-
-[[NeighborList]]
- NeighborAddress = "10.0.255.1"
- PeerAs = 65001
- [NeighborList.RouteServer]
- RouteServerClient = true
-
-[[NeighborList]]
- NeighborAddress = "10.0.255.2"
- PeerAs = 65002
- [NeighborList.RouteServer]
- RouteServerClient = true
- [NeighborList.ApplyPolicy]
- ImportPolicies = ["pd2"]
- ExportPolicies = []
-
-[[NeighborList]]
- NeighborAddress = "10.0.255.3"
- PeerAs = 65003
- [NeighborList.RouteServer]
- RouteServerClient = true
+ [Global.GlobalConfig]
+ As = 64512
+ RouterId = "192.168.255.1"
+
+[Neighbors]
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.1"
+ PeerAs = 65001
+ [Neighbors.NeighborList.RouteServer]
+ RouteServerClient = true
+
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.2"
+ PeerAs = 65002
+ [Neighbors.NeighborList.RouteServer]
+ RouteServerClient = true
+ [Neighbors.NeighborList.ApplyPolicy]
+ [Neighbors.NeighborList.ApplyPolicy.ApplyPolicyConfig]
+ ImportPolicy = ["pd2"]
+
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.3"
+ PeerAs = 65003
+ [Neighbors.NeighborList.RouteServer]
+ RouteServerClient = true
[DefinedSets]
- [[DefinedSets.PrefixSetList]]
- PrefixSetName = "ps2"
-
- [[DefinedSets.PrefixSetList.PrefixList]]
- Address = "10.33.0.0"
- Masklength = 16
-
- [[DefinedSets.NeighborSetList]]
- NeighborSetName = "ns1"
- [[DefinedSets.NeighborSetList.NeighborInfoList]]
- Address = "10.0.255.1"
-
-[[PolicyDefinitionList]]
- Name = "pd2"
- [[PolicyDefinitionList.StatementList]]
- Name = "statement1"
- [PolicyDefinitionList.StatementList.Conditions]
- MatchPrefixSet = "ps2"
- MatchNeighborSet = "ns1"
- MatchSetOptions = 1
- [PolicyDefinitionList.StatementList.Actions]
- RejectRoute = true
+ [DefinedSets.PrefixSets]
+ [[DefinedSets.PrefixSets.PrefixSetList]]
+ PrefixSetName = "ps2"
+ [[DefinedSets.PrefixSets.PrefixSetList.PrefixList]]
+ [DefinedSets.PrefixSets.PrefixSetList.PrefixList.IpPrefix]
+ IP = "10.33.0.0
+ Mask = [255, 255, 0, 0]
+ [[DefinedSets.PrefixSets.PrefixSetList.PrefixList]]
+ [DefinedSets.PrefixSets.PrefixSetList.PrefixList.IpPrefix]
+ IP = "10.50.0.0"
+ Mask = [255, 255, 0, 0]
+
+
+ [DefinedSets.NeighborSets]
+ [[DefinedSets.NeighborSetList]]
+ NeighborSetName = "ns1"
+ [[DefinedSets.NeighborSetList.NeighborInfoList]]
+ Address = "10.0.255.1"
+
+[PolicyDefinitions]
+ [[PolicyDefinitions.PolicyDefinitionList]]
+ Name = "pd2"
+ [PolicyDefinitions.PolicyDefinitionList.Statements]
+ [[PolicyDefinitions.PolicyDefinitionList.Statements.StatementList]]
+ Name = "statement1"
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchPrefixSet]
+ PrefixSet = "ps2"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Conditions.MatchNeighborSet]
+ NeighborSet = "ns1"
+ MatchSetOptions = 0
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions]
+ [PolicyDefinitions.PolicyDefinitionList.Statements.StatementList.Actions.RouteDisposition]
+ RejectRoute = true
```
-Neighbor 10.0.255.2 has *pd2* policy. The *pd2* policy consists of *ps2* prefix match and *ns1* neighbor match. The *ps2* specifies 10.33.0.0/16 prefix. The ps2 specifies the exact mask length with **Masklength** keyword. **MasklengthRange** keyword can specify the range of mask length like ```MasklengthRange 24..26```. The *ns1* specifies neighbor 10.0.255.1.
+Neighbor 10.0.255.2 has pd2 policy. The pd2 policy consists of ps2 prefix match and ns1 neighbor match. The ps2 specifies 10.33.0.0 and 10.50.0.0 address. The ps2 specifies the mask with **MASK** keyword. **MasklengthRange** keyword can specify the range of mask length like ```MasklengthRange 24..26```. The *ns1* specifies neighbor 10.0.255.1.
-The *pd2* sets *MatchSetOptions* to 1. This means that only when all match conditions meets, the policy will be applied. In this case, this policy will be applied to only 10.33.0.0/16 route from neighbor 10.0.255.1.
+The pd2 sets multiple condition, This means that only when all match conditions meets, the policy will be applied.
-If the *pd2* sets *MatchSetOptions* to 0, any of match conditions meets, the policy will be applied. With the above example, the policy will be applied to any routes from neighbor 10.0.255.1 and 10.33.0.16 route from any neighbors.
+The MatchPrefixSet sets MatchSetOptions to 0. This means that when match to any of PrefixList, the policy will be applied. the policy will be applied to 10.33.0.0/16 or 10.50.0.0 route from neighbor 10.0.255.1.
+
+If the MatchPrefixSet sets MatchSetOptions to 1, It does not match to any of PrefixList, the policy will be applied. the policy will be applied to other than 10.33.0.0/16 or 10.50.0.0 route from neighbor 10.0.255.1
## Checking
@@ -99,7 +119,7 @@ $ gobgp neighbor 10.0.255.1 adj-in
```
Now let's check out if the policy works as expected.
-
+
```
$ gobgp neighbor 10.0.255.2 local
Network Next Hop AS_PATH Age Attrs
diff --git a/docs/sources/getting-started.md b/docs/sources/getting-started.md
index 2d309bfc..700703fc 100644
--- a/docs/sources/getting-started.md
+++ b/docs/sources/getting-started.md
@@ -36,14 +36,20 @@ uses the following very simple configuration file, `gobgpd.conf`:
```
$ cat gobgpd.conf
[Global]
- As = 64512
- RouterId = "192.168.255.1"
-[[NeighborList]]
- NeighborAddress = "10.0.255.1"
- PeerAs = 65001
-[[NeighborList]]
- NeighborAddress = "10.0.255.2"
- PeerAs = 65002
+ [Global.GlobalConfig]
+ As = 64512
+ RouterId = "192.168.255.1"
+
+[Neighbors]
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.1"
+ PeerAs = 65001
+
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.2"
+ PeerAs = 65002
```
## Starting GoBGP
diff --git a/docs/sources/mrt.md b/docs/sources/mrt.md
index f2610330..98a441b0 100644
--- a/docs/sources/mrt.md
+++ b/docs/sources/mrt.md
@@ -21,11 +21,16 @@ you don't need any special configuration for mrt
```
$ cat gobgpd.conf
[Global]
- As = 64512
- RouterId = "192.168.255.1"
-[[NeighborList]]
- NeighborAddress = "10.0.255.1"
- PeerAs = 65001
+ [Global.GlobalConfig]
+ As = 64512
+ RouterId = "192.168.255.1"
+
+[Neighbors]
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.255.1"
+ PeerAs = 65001
+
```
## Start GoBGP