OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bgp_rib_policy.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_BGP_BGP_RIB_POLICY_H_
6 #define SRC_BGP_BGP_RIB_POLICY_H_
7 
8 #include "bgp/bgp_proto.h"
9 
10 //
11 // This class represents the export policy for a rib. Given that we do not
12 // currently support any real policy configuration, this is pretty trivial
13 // for now.
14 //
15 // Including the AS number as part of the policy results in creation of a
16 // different RibOut for every neighbor AS that we peer with. This allows a
17 // simplified implementation of the sender side AS path loop check. In most
18 // practical deployment scenarios all eBGP peers will belong to the same
19 // neighbor AS anyway.
20 //
21 // Including AS override as part of the policy results in creation of a
22 // different RibOuts for neighbors that need and don't AS override.
23 //
24 // Including the nexthop as part of the policy results in creation of a
25 // different RibOut for each set of BGPaaS clients that belong to the same
26 // subnet. This allows us to rewrite the nexthop to the specified value.
27 //
28 // Including the CPU affinity as part of the RibExportPolicy allows us to
29 // artificially create more RibOuts than otherwise necessary. This is used
30 // to achieve higher concurrency at the expense of creating more state.
31 //
32 // Including llgr as part of the policy results in the creation of a different
33 // ribout for each set of peers that do (or do not) support long lived
34 // graceful restart functionality. In order to ensure correctness, we need
35 // to not advertise LLGR_STALE community to peers who do not support LLGR.
36 // Instead, we should bring down the local pref to make the paths less
37 // preferable.
38 //
39 // Adding as4_supported so that peers who support 4 byte AS can be grouped
40 // together. For non AS4 neighbors, we need to add AS_TRANS in AS_PATH if
41 // local AS does not fit in 2 bytes.
42 //
44  enum Encoding {
45  BGP,
47  };
48 
51 
52  bool enabled;
53  bool all;
54  bool replace;
56  };
57 
59  explicit RibExportPolicy(uint32_t cluster_id);
61  int affinity, uint32_t cluster_id);
63  as_t as_number, bool as_override, bool llgr, bool as4_supported,
64  int affinity, uint32_t cluster_id, as_t local_as_number = 0);
66  as_t as_number, bool as_override, bool llgr, bool as4_supported,
67  IpAddress nexthop, int affinity, uint32_t cluster_id,
68  std::vector<std::string> &default_tunnel_encap_list,
69  as_t local_as_number = 0);
70  void SetRemovePrivatePolicy(bool all, bool replace, bool peer_loop_check);
71  bool operator<(const RibExportPolicy &rhs) const;
72 
79  int affinity;
80  bool llgr;
82  uint32_t cluster_id;
84  std::vector<std::string> default_tunnel_encap_list;
85 };
86 
87 #endif // SRC_BGP_BGP_RIB_POLICY_H_
IpAddress nexthop
boost::asio::ip::address IpAddress
Definition: address.h:13
void SetRemovePrivatePolicy(bool all, bool replace, bool peer_loop_check)
uint32_t as_t
Definition: bgp_common.h:21
bool operator<(const RibExportPolicy &rhs) const
BgpProto::BgpPeerType type
uint32_t cluster_id
RemovePrivatePolicy remove_private
std::vector< std::string > default_tunnel_encap_list