9 template <
class ItType>
11 std::vector<IpAddress> nh_addr;
12 const uint32_t n_items = item->entry.next_hops.next_hop.size();
13 for (uint32_t i_nh=0; i_nh < n_items; i_nh++) {
14 const IpAddress nh_ip = IpAddress::from_string(
15 item->entry.next_hops.next_hop[i_nh].address);
16 nh_addr.insert(nh_addr.end(), nh_ip);
31 const Interface *
interface = intf_nh->GetInterface();
58 for (uint32_t i=0; i < n_comps; i++) {
60 if (c_nh !=
nullptr &&
68 template<
typename NhType>
70 const std::string& vrf_name,
71 const NhType &nh_item,
73 std::vector<std::string> &peer_sources) {
75 for (
const auto &nexthop_addr : peer_sources) {
79 boost::system::error_code ec;
82 nh_ip = Ip4Address::from_string(
ipv4_prefix(nexthop_addr), ec);
85 nh_ip = Ip6Address::from_string(
ipv6_prefix(nexthop_addr), ec);
88 LOG(ERROR,
"Error in VxlanRoutingManager"
89 <<
"::AddBgpaasInterfaceComponentToList"
90 <<
", nexthop_addr = " << nexthop_addr
91 <<
" is not an IPv4 or IPv6 prefix");
101 if (loc_path ==
nullptr) {
104 if (loc_path->
nexthop() ==
nullptr) {
112 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
115 std::move(nh_key_ptr)));
116 comp_nh_list.push_back(component_nh_key);
125 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
127 if (nh_key ==
nullptr){
128 LOG(ERROR,
"Error in VxlanRoutingManager::"
129 <<
"::AddBgpaasInterfaceComponentToList"
135 for (
auto &component_nh : component_nh_list) {
136 std::unique_ptr<const NextHopKey> nh_key_ptr;
138 if (component_nh.get() ==
nullptr) {
142 component_nh.get()->nh()->GetDBRequestKey();
145 nh_key_ptr.reset(nh_key);
146 component_nh_key.reset(
148 std::move(nh_key_ptr)));
150 comp_nh_list.push_back(component_nh_key);
156 template<
typename NhType>
158 const std::string& prefix_str,
159 const std::string& vrf_name,
160 const NhType &nh_item,
162 std::vector<std::string> &peer_sources) {
166 boost::system::error_code ec;
169 ip_addr = Ip4Address::from_string(
ipv4_prefix(prefix_str), ec);
174 ip_addr = Ip6Address::from_string(addr_str, ec);
176 LOG(ERROR,
"Error in VxlanRoutingManager::AddInterfaceComponentToList"
177 <<
", prefix_str = " << prefix_str
178 <<
" is not an IPv4 or IPv6 prefix");
183 LOG(ERROR,
"Possible error in "
184 <<
"VxlanRoutingManager::AddInterfaceComponentToList"
185 <<
", cannot convert prefix_str = " << prefix_str
186 <<
" to IPv4 or IPv6 address");
192 if (intf_rt == NULL) {
200 if (loc_path == NULL) {
205 if (loc_path->
nexthop() == NULL) {
217 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
219 std::move(nh_key_ptr)));
220 comp_nh_list.push_back(component_nh_key);
235 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
238 LOG(ERROR,
"Error in VxlanRoutingManager::AddInterfaceComponentToList"
240 assert(nh_key != NULL);
246 for (ComponentNHList::const_iterator
247 it_nh = component_nh_list.begin();
248 it_nh != component_nh_list.end(); it_nh++) {
251 std::unique_ptr<const NextHopKey> nh_key_ptr;
253 if (it_nh->get() == NULL) {
257 it_nh->get()->nh()->GetDBRequestKey();
260 nh_key_ptr.reset(nh_key);
261 component_nh_key.reset(
264 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)