summaryrefslogtreecommitdiffhomepage
path: root/policy
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-07-31 18:51:05 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-08-08 20:56:46 +0900
commitbf9e135ba85cad641c3812abace9221cbf5a2615 (patch)
tree435728bd72e93ddfea7a3c02d78cfb1a9c65f16f /policy
parentecd079e318e1c5d5aa2d2f1348a4ad1a37daec37 (diff)
server: support vrf
to add/delete vrf $ gobgp vrf [add|del] <vrf-name> rd <rd> rt [import|export|both] <rt>... show vrf $ gobgp vrf to add/delete a path to a specific vrf $ gobgp vrf <vrf-name> rib [add|del] <prefix> -a <address-family> show paths contained in a specific vrf $ gobgp vrf <vrf-name> rib -a <address-family> Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'policy')
-rw-r--r--policy/policy.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/policy/policy.go b/policy/policy.go
index 70d1bbc3..5d0dc631 100644
--- a/policy/policy.go
+++ b/policy/policy.go
@@ -2062,3 +2062,24 @@ func PoliciesToString(reqPolicies []*api.PolicyDefinition) []string {
}
return policies
}
+
+func CanImportToVrf(v *table.Vrf, path *table.Path) bool {
+ f := func(arg []bgp.ExtendedCommunityInterface) []config.ExtCommunity {
+ ret := make([]config.ExtCommunity, 0, len(arg))
+ for _, a := range arg {
+ ret = append(ret, config.ExtCommunity{
+ ExtCommunity: fmt.Sprintf("RT:%s", a.String()),
+ })
+ }
+ return ret
+ }
+ set := config.ExtCommunitySet{
+ ExtCommunitySetName: v.Name,
+ ExtCommunityList: f(v.ImportRt),
+ }
+ matchSet := config.MatchExtCommunitySet{
+ ExtCommunitySet: v.Name,
+ MatchSetOptions: config.MATCH_SET_OPTIONS_TYPE_ANY,
+ }
+ return NewExtCommunityCondition(matchSet, []config.ExtCommunitySet{set}).evaluate(path)
+}