예제 #1
0
파일: policy.go 프로젝트: ttaanngg/gobgp
func (a *CommunityAction) apply(path *table.Path) *table.Path {

	list := a.Values
	switch a.action {
	case config.BGP_SET_COMMUNITY_OPTION_TYPE_ADD:
		path.SetCommunities(list, false)
	case config.BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE:
		path.RemoveCommunities(list)
	case config.BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE:
		path.SetCommunities(list, true)
	case config.BGP_SET_COMMUNITY_OPTION_TYPE_NULL:
		path.ClearCommunities()
	}
	return path
}