3 template <
class ItType>
5 std::vector<IpAddress> nh_addr;
6 const uint32_t n_items = item->entry.next_hops.next_hop.size();
7 for (uint32_t i_nh=0; i_nh < n_items; i_nh++) {
8 const IpAddress nh_ip = IpAddress::from_string(
9 item->entry.next_hops.next_hop[i_nh].address);
10 nh_addr.insert(nh_addr.end(), nh_ip);
25 const Interface *
interface = intf_nh->GetInterface();
52 for (uint32_t i=0; i < n_comps; i++) {
54 if (c_nh !=
nullptr &&
62 template<
typename NhType>
64 const std::string& vrf_name,
65 const NhType &nh_item,
67 std::vector<std::string> &peer_sources) {
69 for (
const auto &nexthop_addr : peer_sources) {
73 boost::system::error_code ec;
76 nh_ip = Ip4Address::from_string(
ipv4_prefix(nexthop_addr), ec);
79 nh_ip = Ip6Address::from_string(
ipv6_prefix(nexthop_addr), ec);
82 LOG(ERROR,
"Error in VxlanRoutingManager"
83 <<
"::AddBgpaasInterfaceComponentToList"
84 <<
", nexthop_addr = " << nexthop_addr
85 <<
" is not an IPv4 or IPv6 prefix");
95 if (loc_path ==
nullptr) {
98 if (loc_path->
nexthop() ==
nullptr) {
106 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
109 std::move(nh_key_ptr)));
110 comp_nh_list.push_back(component_nh_key);
119 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
121 if (nh_key ==
nullptr){
122 LOG(ERROR,
"Error in VxlanRoutingManager::"
123 <<
"::AddBgpaasInterfaceComponentToList"
129 for (
auto &component_nh : component_nh_list) {
130 std::unique_ptr<const NextHopKey> nh_key_ptr;
132 if (component_nh.get() ==
nullptr) {
136 component_nh.get()->nh()->GetDBRequestKey();
139 nh_key_ptr.reset(nh_key);
140 component_nh_key.reset(
142 std::move(nh_key_ptr)));
144 comp_nh_list.push_back(component_nh_key);
150 template<
typename NhType>
152 const std::string& prefix_str,
153 const std::string& vrf_name,
154 const NhType &nh_item,
156 std::vector<std::string> &peer_sources) {
160 boost::system::error_code ec;
163 ip_addr = Ip4Address::from_string(
ipv4_prefix(prefix_str), ec);
168 ip_addr = Ip6Address::from_string(addr_str, ec);
170 LOG(ERROR,
"Error in VxlanRoutingManager::AddInterfaceComponentToList"
171 <<
", prefix_str = " << prefix_str
172 <<
" is not an IPv4 or IPv6 prefix");
177 LOG(ERROR,
"Possible error in "
178 <<
"VxlanRoutingManager::AddInterfaceComponentToList"
179 <<
", cannot convert prefix_str = " << prefix_str
180 <<
" to IPv4 or IPv6 address");
186 if (intf_rt == NULL) {
194 if (loc_path == NULL) {
199 if (loc_path->
nexthop() == NULL) {
211 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
213 std::move(nh_key_ptr)));
214 comp_nh_list.push_back(component_nh_key);
229 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
232 LOG(ERROR,
"Error in VxlanRoutingManager::AddInterfaceComponentToList"
234 assert(nh_key != NULL);
240 for (ComponentNHList::const_iterator
241 it_nh = component_nh_list.begin();
242 it_nh != component_nh_list.end(); it_nh++) {
245 std::unique_ptr<const NextHopKey> nh_key_ptr;
247 if (it_nh->get() == NULL) {
251 it_nh->get()->nh()->GetDBRequestKey();
254 nh_key_ptr.reset(nh_key);
255 component_nh_key.reset(
258 comp_nh_list.push_back(component_nh_key);
static Agent * GetInstance()
static uint32_t ipv4_prefix_len(const std::string &prefix_str)
Extracts length of IPv4 subnet address from the prefix string.
static std::string ipv4_prefix(const std::string &prefix_str)
Extracts an IPv4 address string from the prefix string.
boost::asio::ip::address IpAddress
static bool IsBgpaasCompositeNexthop(const Agent *agent, const NextHop *nh)
boost::shared_ptr< const ComponentNHKey > ComponentNHKeyPtr
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 bool is_ipv4_string(const std::string &prefix_str)
Determines whether the address string contains an IPv4 address as substring or not.
std::unique_ptr< DBRequestKey > KeyPtr
Base class for all Route entries in agent.
static void AddBgpaasInterfaceComponentToList(const std::string &vrf_name, const NhType &nh_item, ComponentNHKeyList &comp_nh_list, std::vector< std::string > &peer_sources)
std::vector< ComponentNHKeyPtr > ComponentNHKeyList
static std::vector< IpAddress > ItemNexthopsToVector(ItType *item)
Templates.
NextHop * nexthop() const
BgpAsAService * bgp_as_a_service() const
static bool is_ipv6_string(const std::string &prefix_str)
Determines whether the address string contains an IPv6 address as substring or not.
boost::asio::ip::address_v6 Ip6Address
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 ...
const ComponentNHList & component_nh_list() const
virtual KeyPtr GetDBRequestKey() const =0
boost::asio::ip::address_v4 Ip4Address
static const uint32_t kInvalidLabel
const AgentPath * FindIntfOrCompLocalVmPortPath() const
Finds path to an interface or a composite of interfaces and returns it. The priority is given to comp...
const Ip4Address & primary_ip_addr() const
const Ip6Address & primary_ip6_addr() const
size_t ComponentNHCount() const
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
const NextHop * GetNH(uint32_t idx) const
static bool IsBgpaasInterfaceNexthop(const Agent *agent, const NextHop *nh)
static std::string ipv6_prefix(const std::string &prefix_str)
Extracts an IPv6 address string from the prefix string.
virtual KeyPtr GetDBRequestKey() const
const MplsLabel * mpls_label() const