1 template <
class ItType>
3 std::vector<IpAddress> nh_addr;
4 const uint32_t n_items = item->entry.next_hops.next_hop.size();
5 for (uint32_t i_nh=0; i_nh < n_items; i_nh++) {
6 const IpAddress nh_ip = IpAddress::from_string(
7 item->entry.next_hops.next_hop[i_nh].address);
8 nh_addr.insert(nh_addr.end(), nh_ip);
14 template<
typename NhType>
16 const std::string& prefix_str,
17 const std::string& vrf_name,
18 const NhType &nh_item,
23 boost::system::error_code ec;
26 ip_addr = Ip4Address::from_string(
ipv4_prefix(prefix_str), ec);
31 ip_addr = Ip6Address::from_string(addr_str, ec);
33 LOG(ERROR,
"Error in VxlanRoutingManager::AddInterfaceComponentToList"
34 <<
", prefix_str = " << prefix_str
35 <<
" is not an IPv4 or IPv6 prefix");
40 LOG(ERROR,
"Possible error in "
41 <<
"VxlanRoutingManager::AddInterfaceComponentToList"
42 <<
", cannot convert prefix_str = " << prefix_str
43 <<
" to IPv4 or IPv6 address");
49 if (intf_rt == NULL) {
55 if (loc_path == NULL) {
58 if (loc_path->
nexthop() == NULL) {
68 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
70 std::move(nh_key_ptr)));
71 comp_nh_list.push_back(component_nh_key);
86 std::unique_ptr<const NextHopKey> nh_key_ptr(nh_key);
89 LOG(ERROR,
"Error in VxlanRoutingManager::AddInterfaceComponentToList"
91 assert(nh_key != NULL);
97 for (ComponentNHList::const_iterator
98 it_nh = component_nh_list.begin();
99 it_nh != component_nh_list.end(); it_nh++) {
102 std::unique_ptr<const NextHopKey> nh_key_ptr;
104 if (it_nh->get() == NULL) {
108 it_nh->get()->nh()->GetDBRequestKey();
111 nh_key_ptr.reset(nh_key);
112 component_nh_key.reset(
115 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
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.
std::vector< ComponentNHKeyPtr > ComponentNHKeyList
static std::vector< IpAddress > ItemNexthopsToVector(ItType *item)
Templates.
NextHop * nexthop() const
static void AddInterfaceComponentToList(const std::string &prefix_str, const std::string &vrf_name, const NhType &nh_item, ComponentNHKeyList &comp_nh_list)
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.
const ComponentNHList & component_nh_list() const
virtual KeyPtr GetDBRequestKey() const =0
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...
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
static std::string ipv6_prefix(const std::string &prefix_str)
Extracts an IPv6 address string from the prefix string.
virtual KeyPtr GetDBRequestKey() const