From cd4b0107c3b6855a8bf495cb972d04f8863d95c9 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Tue, 16 Aug 2016 19:27:39 +0000 Subject: 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 --- config/bgp_configs.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'config/bgp_configs.go') 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 { -- cgit v1.2.3