summaryrefslogtreecommitdiffhomepage
path: root/table/policy.go
AgeCommit message (Collapse)Author
2016-07-30all logging is done with log.WithFieldsdsp
Signed-off-by: dsp <dsp@2f30.org> Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-07-20remove gRPC dependency from table/FUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-07-20table: remove ToApiStruct methods from policy.goFUJITA Tomonori
Preparation for removing gRPC dependency. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-05-26policy: add support setting self ip address as next-hopISHIDA Wataru
from configuration file [policy-definitions.statements.actions.bgp-actions] set-next-hop = "self" from cli $ gobgp policy statement stmt1 add action next-hop self Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-05-25policy: add local-pref actionISHIDA Wataru
$ gobgp policy statement st01 add action local-pref 110 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-04-26policy: don't apply policy when path is withdrawalISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-04-21policy: fix as-path match optimizationISHIDA Wataru
following as-path pattern will be optimized - ^<asn>_ # left-most - _<asn>$ # origin - _<asn>_ # include - ^<asn>$ # only Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-04-21config: add set-next-hop optiontamihiro
2016-04-20policy: check duplicated policy nameISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-04-20policy: don't allow same policy assigned twiceISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-04-20Revert "policy: remove unnecessary regexp special charactor"tamihiro
This reverts commit 76525a966bdfdfd10195e72fffcffbc3a6c69d78.
2016-04-20fix community-set match all evaluation and remove regexp special chars from ↵tamihiro
cli output of community strings
2016-03-31move packet/*.go to packet/bgp/*.go for Go's conventionFUJITA Tomonori
Later, we move non-bgp protocol stuff like mrt under their own direcotries. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-03-09policy: fix crash to remove statement from policy without statementsFUJITA Tomonori
https://github.com/osrg/gobgp/issues/754 Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2016-02-19policy: remove unnecessary regexp special charactorISHIDA Wataru
Since communities/ext-communities are tested one by one in policy-condition, we don't need '^' and '$' around match condition items. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-25config: add openconfig identity structs in bgp_configs.goISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-16server: reduce number of path.Clone() call to reduce memory footprintISHIDA Wataru
the result of memory profile (500 route-server-clients each of them advertises 100 routes) before: (pprof) top5 3913.02MB of 3978.69MB total (98.35%) Dropped 148 nodes (cum <= 19.89MB) Showing top 10 nodes out of 11 (cum >= 21MB) flat flat% sum% cum cum% 2970.30MB 74.66% 74.66% 2975.80MB 74.79% github.com/osrg/gobgp/server.filterpath 810.09MB 20.36% 95.02% 810.59MB 20.37% github.com/osrg/gobgp/table.(*AdjRib).Update 115.60MB 2.91% 97.92% 119.10MB 2.99% github.com/osrg/gobgp/table.createUpdateMsgFromPath 10MB 0.25% 98.17% 1878.02MB 47.20% github.com/osrg/gobgp/server.(*BgpServer).propagateUpdate 4.50MB 0.11% 98.29% 144.60MB 3.63% github.com/osrg/gobgp/table.CreateUpdateMsgFromPaths after: (pprof) top5 1259.49MB of 1284.27MB total (98.07%) Dropped 175 nodes (cum <= 6.42MB) Showing top 10 nodes out of 26 (cum >= 36.51MB) flat flat% sum% cum cum% 975.81MB 75.98% 75.98% 976.31MB 76.02% github.com/osrg/gobgp/table.(*AdjRib).Update 198.67MB 15.47% 91.45% 208.17MB 16.21% github.com/osrg/gobgp/table.createUpdateMsgFromPath 22MB 1.71% 93.16% 22MB 1.71% github.com/osrg/gobgp/packet.(*IPAddrPrefix).Serialize 20MB 1.56% 94.72% 707.19MB 55.07% github.com/osrg/gobgp/server.(*BgpServer).propagateUpdate 13.50MB 1.05% 95.77% 13.50MB 1.05% github.com/osrg/gobgp/table.NewPath Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-16policy: introduce policy option infraISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-16table: remove unnecessary copy of path attributesISHIDA Wataru
the result of memory profile (500 route-server-clients each of them advertises 100 routes) before: (pprof) top5 9330.48MB of 9367.53MB total (99.60%) Dropped 157 nodes (cum <= 46.84MB) Showing top 10 nodes out of 17 (cum >= 9334.17MB) flat flat% sum% cum cum% 6163.04MB 65.79% 65.79% 6163.04MB 65.79% github.com/osrg/gobgp/table.NewPath 1155.05MB 12.33% 78.12% 7302.59MB 77.96% github.com/osrg/gobgp/table.(*Path).Clone 986.31MB 10.53% 88.65% 1388.81MB 14.83% github.com/osrg/gobgp/table.(*AdjRib).Update 402.51MB 4.30% 92.95% 402.51MB 4.30% fmt.Sprintf 402.51MB 4.30% 97.24% 402.51MB 4.30% net.parseIPv4 after: (pprof) top 3913.02MB of 3978.69MB total (98.35%) Dropped 148 nodes (cum <= 19.89MB) Showing top 10 nodes out of 11 (cum >= 21MB) flat flat% sum% cum cum% 2970.30MB 74.66% 74.66% 2975.80MB 74.79% github.com/osrg/gobgp/server.filterpath 810.09MB 20.36% 95.02% 810.59MB 20.37% github.com/osrg/gobgp/table.(*AdjRib).Update 115.60MB 2.91% 97.92% 119.10MB 2.99% github.com/osrg/gobgp/table.createUpdateMsgFromPath 10MB 0.25% 98.17% 1878.02MB 47.20% github.com/osrg/gobgp/server.(*BgpServer).propagateUpdate 4.50MB 0.11% 98.29% 144.60MB 3.63% github.com/osrg/gobgp/table.CreateUpdateMsgFromPaths Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-10policy: support an action to add origin-validation ext-communityISHIDA Wataru
you can implement https://tools.ietf.org/html/draft-kklf-sidr-route-server-rpki-light-00 by following commands $ gobgp policy statement st0 add condition rpki valid $ gobgp policy statement st0 add action ext-community add valid $ gobgp policy statement st1 add condition rpki not-found $ gobgp policy statement st1 add action ext-community add not-found $ gobgp policy statement st2 add condition rpki invalid $ gobgp policy statement st2 add action ext-community add invalid $ gobgp policy p0 add st0 st1 st2 $ gobgp policy p0 Name p0: StatementName st0: Conditions: RPKI result: valid Actions: ExtCommunity: COMMUNITY_ADD[valid] NONE StatementName st1: Conditions: RPKI result: not-found Actions: ExtCommunity: COMMUNITY_ADD[not-found] NONE StatementName st2: Conditions: RPKI result: invalid Actions: ExtCommunity: COMMUNITY_ADD[invalid] NONE Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-10policy: fix NewRpkiValidationConditionFromApiStruct()ISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-09config: refactor config structureISHIDA Wataru
- change config variable name to chaincase from camelcase - remove unnecessary wrapper structs which only contain one slice field Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-09config: add FromInt() method to config typedefISHIDA Wataru
use for the translation between api structs Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-09config: change enum value type to string for ease of configurationISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-09tools: avoid adding a new option to bgpyang2golang.py and fix gobgp.yangISHIDA Wataru
pyang has an internal flag "multiple_modules" to handle multiple yang modules. use it instead of introducing a new option --augment also, fix warnings and errors in gobgp.yang which were there but not has been detected for a while due to the usage of --augment. by using "multiple_modules" flag, pyang detected them. most notable error is wrong usage of list, which needs a key in its substatement. this patch adds key to some of them, and for others uses leaf-list instead. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-01-06policy: remove heavy debug msgISHIDA Wataru
Sprintf() to stringify Fields is heavy Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-12-29config: use viper and support multiple configuration formatsISHIDA Wataru
// toml by default $ gobgpd -f gobgpd.toml // use -t to change configuration type $ gobgpd -t yaml -f gobgpd.yaml Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-12-28config: make config/state variable name simpleISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-12-24policy: fix insufficient nil checkISHIDA Wataru
RouteAction is interface. we have to check the contained value is also nil. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-12-08server/table: use only one rib for multiple route server clientsISHIDA Wataru
speed up and reduce memory footprint Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-24policy: use radix-tree for prefix-list matchingISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-24policy: modify path.GetAsSeqList() to insert 0 for non-seq-as-elemsISHIDA Wataru
GetAsSeqList() is used for AsPathSet matching and AsPathPrepend action. Just eliminating non-seq-as-elems from what GetAsSeqList() returns cause wrong results for these two match/action. e.g path A's as-path: {100, 200} 300 currently, action 'as-path-prepend left-most repeat 2' will alter as-path to 300 300 {100, 200} 300, which is not expected behavior. To fix this, insert 0 for non-seq-as-elems. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-24policy: speed up as-path matchingISHIDA Wataru
when matching with single as-path, stop using regexp for speed up Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-21policy: add missing argHiroshi Yokoi
Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
2015-10-21policy: add field keysHiroshi Yokoi
Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
2015-10-20policy: name statement automatically also via grpcISHIDA Wataru
fix an incomplete commit 204eacc5c0503cecc796a74fd0c1948ad6a28051 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20policy: avoid null pointer dereferenceISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20api: stop using raw flag values and define grpc dedicated flagsISHIDA Wataru
make it easy to use grpc api Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20policy: fix how to apply policy to follow openconfig descriptionISHIDA Wataru
OpenConfig model says for Route policy evaluation: Evaluation of each policy definition proceeds by evaluating its corresponding individual policy statements in order. When a condition statement in a policy statement is satisfied, the corresponding action statement is executed. If the action statement has either accept-route or reject-route actions, policy evaluation of the current policy definition stops, and no further policy definitions in the chain are evaluated. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20policy: remove debug logHiroshi Yokoi
2015-10-20api: support policy assignment modification via grpcISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20policy: name statement automatically when name is not givenISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20api: support policy modification via grpcISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20api/cli: refactor api to retrieve policyISHIDA Wataru
make it similar to other policy api Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20cli: support statement configurationISHIDA Wataru
- create statement $ gobgp policy statement add st01 - add community condition $ gobgp policy statement st01 condition add community c1 - add route action $ gobgp policy statement st01 action add accept - add set-community action $ gobgp policy statement st01 action add community 100:100 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20api: support statement modification via grpcISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20api/cli: add api to retrieve statements and support showing them via cliISHIDA Wataru
$ gobgp policy statement $ gobgp policy statement st0 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20cli: support defined-set configurationISHIDA Wataru
prefix-set modification gobgp policy prefix add p0 10.0.0.0/24 10..15 neighbor-set modification gobgp policy neighbor add n0 10.0.0.1 as-path-set modification gobgp policy aspath add a0 '^100_200_300$' community-set modification gobgp policy community add c0 100:100 ext-community-set modification gobgp policy community add e0 rt:100:100 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20api: support defined set modification via grpcISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2015-10-20policy: another cleanupISHIDA Wataru
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>