8 template <
class ItType>
10 std::vector<IpAddress> nh_addr;
11 const uint32_t n_items = item->entry.next_hops.next_hop.size();
12 for (uint32_t i_nh=0; i_nh < n_items; i_nh++) {
13 const IpAddress nh_ip = IpAddress::from_string(
14 item->entry.next_hops.next_hop[i_nh].address);
15 nh_addr.insert(nh_addr.end(), nh_ip);
30 const Interface *
interface = intf_nh->GetInterface();
57 for (uint32_t i=0; i < n_comps; i++) {
59 if (c_nh !=
nullptr &&
67 template<
typename NhType>
69 const std::string& vrf_name,
70 const NhType &nh_item,
72 std::vector<std::string> &peer_sources) {
74 for (
const auto &nexthop_addr : peer_sources) {
78 boost::system::error_code ec;
81 nh_ip = Ip4Address::from_string(
ipv4_prefix(nexthop_addr), ec);
84 nh_ip = Ip6Address::from_string(
ipv6_prefix(nexthop_addr), ec);
87 LOG(ERROR,
"Error in VxlanRoutingManager"
88 <<
"::AddBgpaasInterfaceComponentToList"
89 <<
", nexthop_addr = " << nexthop_addr
90 <<
" is not an IPv4 or IPv6 prefix");
98 if (intf_rt ==
nullptr) {
103 if (loc_path ==
nullptr) {
106 if (loc_path->
nexthop() ==
nullptr) {
114 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
117 std::move(nh_key_ptr)));
118 comp_nh_list.push_back(component_nh_key);
127 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
129 if (nh_key ==
nullptr){
130 LOG(ERROR,
"Error in VxlanRoutingManager::"
131 <<
"::AddBgpaasInterfaceComponentToList"
137 for (
auto &component_nh : component_nh_list) {
138 std::unique_ptr<const NextHopKey> nh_key_ptr;
140 if (component_nh.get() ==
nullptr) {
144 component_nh.get()->nh()->GetDBRequestKey();
147 nh_key_ptr.reset(nh_key);
148 component_nh_key.reset(
150 std::move(nh_key_ptr)));
152 comp_nh_list.push_back(component_nh_key);
158 template<
typename NhType>
160 const std::string& prefix_str,
161 const std::string& vrf_name,
162 const NhType &nh_item,
164 std::vector<std::string> &peer_sources) {
168 boost::system::error_code ec;
171 ip_addr = Ip4Address::from_string(
ipv4_prefix(prefix_str), ec);
176 ip_addr = Ip6Address::from_string(addr_str, ec);
178 LOG(ERROR,
"Error in VxlanRoutingManager::AddInterfaceComponentToList"
179 <<
", prefix_str = " << prefix_str
180 <<
" is not an IPv4 or IPv6 prefix");
185 LOG(ERROR,
"Possible error in "
186 <<
"VxlanRoutingManager::AddInterfaceComponentToList"
187 <<
", cannot convert prefix_str = " << prefix_str
188 <<
" to IPv4 or IPv6 address");
194 if (intf_rt == NULL) {
202 if (loc_path == NULL) {
207 if (loc_path->
nexthop() == NULL) {
219 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
221 std::move(nh_key_ptr)));
222 comp_nh_list.push_back(component_nh_key);
237 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
240 LOG(ERROR,
"Error in VxlanRoutingManager::AddInterfaceComponentToList"
242 assert(nh_key != NULL);
248 for (ComponentNHList::const_iterator
249 it_nh = component_nh_list.begin();
250 it_nh != component_nh_list.end(); it_nh++) {
253 std::unique_ptr<const NextHopKey> nh_key_ptr;
255 if (it_nh->get() == NULL) {
259 it_nh->get()->nh()->GetDBRequestKey();
262 nh_key_ptr.reset(nh_key);
263 component_nh_key.reset(
266 comp_nh_list.push_back(component_nh_key);
boost::asio::ip::address_v6 Ip6Address
boost::asio::ip::address IpAddress
boost::asio::ip::address_v4 Ip4Address
NextHop * nexthop() const
Base class for all Route entries in agent.
const AgentPath * FindIntfOrCompLocalVmPortPath() const
Finds path to an interface or a composite of interfaces and returns it. The priority is given to comp...
static Agent * GetInstance()
size_t ComponentNHCount() const
const ComponentNHList & component_nh_list() const
const NextHop * GetNH(uint32_t idx) const
virtual KeyPtr GetDBRequestKey() const
std::unique_ptr< DBRequestKey > KeyPtr
virtual KeyPtr GetDBRequestKey() const =0
static const uint32_t kInvalidLabel
const MplsLabel * mpls_label() const
BgpAsAService * bgp_as_a_service() const
const Ip4Address & primary_ip_addr() const
const Ip6Address & primary_ip6_addr() const
static void AddBgpaasInterfaceComponentToList(const std::string &vrf_name, const NhType &nh_item, ComponentNHKeyList &comp_nh_list, std::vector< std::string > &peer_sources)
static bool is_ipv4_string(const std::string &prefix_str)
Determines whether the address string contains an IPv4 address as substring or not.
static AgentRoute * FindEvpnOrInetRoute(const Agent *agent, const std::string &vrf_name, const IpAddress &ip_addr, uint32_t prefix_len, const autogen::EnetNextHopType &nh_item)
Finds a route with the given prefix address and len in the EVPN table.
static std::string ipv6_prefix(const std::string &prefix_str)
Extracts an IPv6 address string from the prefix string.
static std::vector< IpAddress > ItemNexthopsToVector(ItType *item)
Templates.
static uint32_t ipv4_prefix_len(const std::string &prefix_str)
Extracts length of IPv4 subnet address from the prefix string.
static void AddInterfaceComponentToList(const std::string &prefix_str, const std::string &vrf_name, const NhType &nh_item, ComponentNHKeyList &comp_nh_list, std::vector< std::string > &peer_sources)
Adds an interface or a composite of interfaces nexthops to the list of components NH keys needed for ...
static bool is_ipv6_string(const std::string &prefix_str)
Determines whether the address string contains an IPv6 address as substring or not.
static std::string ipv4_prefix(const std::string &prefix_str)
Extracts an IPv4 address string from the prefix string.
static uint32_t ipv6_prefix_len(const std::string &prefix_str)
Extracts length of IPv6 subnet address from the prefix string.
#define LOG(_Level, _Msg)
std::vector< ComponentNHPtr > ComponentNHList
boost::shared_ptr< const ComponentNHKey > ComponentNHKeyPtr
std::vector< ComponentNHKeyPtr > ComponentNHKeyList
static bool IsBgpaasCompositeNexthop(const Agent *agent, const NextHop *nh)
static bool IsBgpaasInterfaceNexthop(const Agent *agent, const NextHop *nh)