diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-12-28 21:02:03 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-12-28 21:02:03 +0900 |
commit | 58946b7924840f1effc993e95440266479c668d5 (patch) | |
tree | ac6fe1387af028f49a93f9f74f5bcf6ae694a376 /table | |
parent | 7a2b3951160804c6895714621099168e8e56aa74 (diff) |
config: make config/state variable name simple
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r-- | table/destination.go | 12 | ||||
-rw-r--r-- | table/path.go | 18 | ||||
-rw-r--r-- | table/policy.go | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/table/destination.go b/table/destination.go index f83e92e6..ca3a39f0 100644 --- a/table/destination.go +++ b/table/destination.go @@ -99,13 +99,13 @@ func (i *PeerInfo) String() string { } func NewPeerInfo(g *config.Global, p *config.Neighbor) *PeerInfo { - id := net.ParseIP(string(p.RouteReflector.RouteReflectorConfig.RouteReflectorClusterId)).To4() + id := net.ParseIP(string(p.RouteReflector.Config.RouteReflectorClusterId)).To4() return &PeerInfo{ - AS: p.NeighborConfig.PeerAs, - LocalAS: g.GlobalConfig.As, - LocalID: g.GlobalConfig.RouterId, - Address: p.NeighborConfig.NeighborAddress, - RouteReflectorClient: p.RouteReflector.RouteReflectorConfig.RouteReflectorClient, + AS: p.Config.PeerAs, + LocalAS: g.Config.As, + LocalID: g.Config.RouterId, + Address: p.Config.NeighborAddress, + RouteReflectorClient: p.RouteReflector.Config.RouteReflectorClient, RouteReflectorClusterID: id, } } diff --git a/table/path.go b/table/path.go index df84645a..bfc967d2 100644 --- a/table/path.go +++ b/table/path.go @@ -86,17 +86,17 @@ func cloneAsPath(asAttr *bgp.PathAttributeAsPath) *bgp.PathAttributeAsPath { func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor) { - if peer.RouteServer.RouteServerConfig.RouteServerClient { + if peer.RouteServer.Config.RouteServerClient { return } - localAddress := peer.Transport.TransportConfig.LocalAddress - if peer.NeighborConfig.PeerType == config.PEER_TYPE_EXTERNAL { + localAddress := peer.Transport.Config.LocalAddress + if peer.Config.PeerType == config.PEER_TYPE_EXTERNAL { // NEXTHOP handling path.SetNexthop(localAddress) // AS_PATH handling - path.PrependAsn(global.GlobalConfig.As, 1) + path.PrependAsn(global.Config.As, 1) // MED Handling idx, _ := path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC) @@ -110,7 +110,7 @@ func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor) path.pathAttrs = append(path.pathAttrs[:idx], path.pathAttrs[idx+1:]...) } - } else if peer.NeighborConfig.PeerType == config.PEER_TYPE_INTERNAL { + } else if peer.Config.PeerType == config.PEER_TYPE_INTERNAL { // NEXTHOP handling for iBGP // if the path generated locally set local address as nexthop. // if not, don't modify it. @@ -142,7 +142,7 @@ func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor) // RFC4456: BGP Route Reflection // 8. Avoiding Routing Information Loops info := path.source - if peer.RouteReflector.RouteReflectorConfig.RouteReflectorClient { + if peer.RouteReflector.Config.RouteReflectorClient { // This attribute will carry the BGP Identifier of the originator of the route in the local AS. // A BGP speaker SHOULD NOT create an ORIGINATOR_ID attribute if one already exists. idx, _ = path.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGINATOR_ID) @@ -153,7 +153,7 @@ func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor) // When an RR reflects a route, it MUST prepend the local CLUSTER_ID to the CLUSTER_LIST. // If the CLUSTER_LIST is empty, it MUST create a new one. idx, _ = path.getPathAttr(bgp.BGP_ATTR_TYPE_CLUSTER_LIST) - id := string(peer.RouteReflector.RouteReflectorConfig.RouteReflectorClusterId) + id := string(peer.RouteReflector.Config.RouteReflectorClusterId) if idx < 0 { p := bgp.NewPathAttributeClusterList([]string{id}) path.pathAttrs = append(path.pathAttrs, p) @@ -170,8 +170,8 @@ func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor) } else { log.WithFields(log.Fields{ "Topic": "Peer", - "Key": peer.NeighborConfig.NeighborAddress, - }).Warnf("invalid peer type: %d", peer.NeighborConfig.PeerType) + "Key": peer.Config.NeighborAddress, + }).Warnf("invalid peer type: %d", peer.Config.PeerType) } } diff --git a/table/policy.go b/table/policy.go index 6e688ba6..52d6900c 100644 --- a/table/policy.go +++ b/table/policy.go @@ -2724,7 +2724,7 @@ func (r *RoutingPolicy) GetAssignmentFromConfig(dir PolicyDirection, a config.Ap var names []string var cdef config.DefaultPolicyType def := ROUTE_TYPE_ACCEPT - c := a.ApplyPolicyConfig + c := a.Config switch dir { case POLICY_DIRECTION_IN: names = c.InPolicy |