diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-08-16 19:27:39 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-08-17 21:23:08 +0900 |
commit | cd4b0107c3b6855a8bf495cb972d04f8863d95c9 (patch) | |
tree | b08e45d6ae97205d09ba942cdf3a3f546e9dcd45 /config/bgp_configs.go | |
parent | 60241ab6ad8c8290d8745388eaed5e6b0efd965f (diff) |
policy: support route-type condition
// match with routes locally generated
$ gobgp policy statement s0 add condition route-type local
// match with routes received from eBGP peers
$ gobgp policy statement s0 add condition route-type external
// match with routes received from iBGP peers
$ gobgp policy statement s0 add condition route-type internal
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config/bgp_configs.go')
-rw-r--r-- | config/bgp_configs.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index 2ecaae86..c2353c8f 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -584,13 +584,17 @@ func (v AttributeComparison) Validate() error { type RouteType string const ( + ROUTE_TYPE_NONE RouteType = "none" ROUTE_TYPE_INTERNAL RouteType = "internal" ROUTE_TYPE_EXTERNAL RouteType = "external" + ROUTE_TYPE_LOCAL RouteType = "local" ) var RouteTypeToIntMap = map[RouteType]int{ - ROUTE_TYPE_INTERNAL: 0, - ROUTE_TYPE_EXTERNAL: 1, + ROUTE_TYPE_NONE: 0, + ROUTE_TYPE_INTERNAL: 1, + ROUTE_TYPE_EXTERNAL: 2, + ROUTE_TYPE_LOCAL: 3, } func (v RouteType) ToInt() int { @@ -602,8 +606,10 @@ func (v RouteType) ToInt() int { } var IntToRouteTypeMap = map[int]RouteType{ - 0: ROUTE_TYPE_INTERNAL, - 1: ROUTE_TYPE_EXTERNAL, + 0: ROUTE_TYPE_NONE, + 1: ROUTE_TYPE_INTERNAL, + 2: ROUTE_TYPE_EXTERNAL, + 3: ROUTE_TYPE_LOCAL, } func (v RouteType) Validate() error { |