40 using namespace boost::uuids;
41 using namespace autogen;
47 IpAddress::from_string(
"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
64 VmiToPhysicalDeviceVnTree::iterator iter =
65 vmi_to_physical_device_vn_tree_.find(vmi);
66 if (iter == vmi_to_physical_device_vn_tree_.end()) {
67 vmi_to_physical_device_vn_tree_.insert
69 iter = vmi_to_physical_device_vn_tree_.find(vmi);
72 if (iter->second.dev_ != dev || iter->second.vn_ != vn) {
73 agent()->physical_device_vn_table()->DeleteConfigEntry
74 (vmi, iter->second.dev_, iter->second.vn_);
77 iter->second.dev_ = dev;
78 iter->second.vn_ = vn;
79 agent()->physical_device_vn_table()->AddConfigEntry(vmi, dev, vn);
83 VmiToPhysicalDeviceVnTree::iterator iter =
84 vmi_to_physical_device_vn_tree_.find(vmi);
85 if (iter == vmi_to_physical_device_vn_tree_.end())
88 agent()->physical_device_vn_table()->DeleteConfigEntry
89 (vmi, iter->second.dev_, iter->second.vn_);
90 vmi_to_physical_device_vn_tree_.erase(iter);
100 if (device_type_ == TOR)
103 if (device_type_ == VM_VLAN_ON_VMI)
106 if (vmi_type_ != VHOST && subnet_.is_unspecified() ==
false) {
110 if (transport_ != TRANSPORT_ETHERNET) {
128 if (transport_ == TRANSPORT_PMD) {
133 return NeedDefaultOsOperStateDisabled(table->
agent());
139 if (NeedDevice() || NeedOsStateWithoutDevice()) {
145 os_params_.mac_ = agent->
vrrp_mac();
149 if (!NeedDefaultOsOperStateDisabled(agent)) {
150 os_params_.os_oper_state_ =
true;
177 if (device_type_ == VM_VLAN_ON_VMI) {
178 if (parentIntf == NULL)
180 else if (parentIntf->
IsActive() ==
false) {
185 if (device_type_ == REMOTE_VM_VLAN_ON_VMI) {
188 parent_.get() == NULL)
192 if (vmi_type_ == VHOST) {
196 if (vrf_.get() == NULL) {
199 }
else if ((vn_.get() == NULL) || (vrf_.get() == NULL)) {
203 if (vn_.get() && !vn_.get()->admin_state()) {
207 if (NeedOsStateWithoutDevice() && os_oper_state() ==
false) {
209 agent()->ksync()->vnsw_interface_listner();
211 if ((transport_ == TRANSPORT_PMD) && link_status &&
217 agent()->interface_table()->Enqueue(&req);
223 if (NeedDevice() ==
false) {
227 if (os_index() == kInvalidIndex)
230 if (os_oper_state() ==
false)
237 if (vmi_type_ == VHOST) {
241 if (!layer3_forwarding()) {
245 if (primary_ip6_addr_.is_unspecified()) {
246 if (subnet_.is_unspecified() && primary_ip_addr_.to_ulong() == 0) {
250 if (subnet_.is_unspecified() ==
false && parent_ == NULL) {
267 if (vmi_type_ == VHOST) {
271 if (!layer3_forwarding()) {
275 if (subnet_.is_unspecified() && primary_ip_addr_.to_ulong() == 0) {
279 if (subnet_.is_unspecified() ==
false && parent_ == NULL) {
283 if (!is_hc_active_) {
291 if (vmi_type_ == VHOST) {
295 if (!layer3_forwarding() || (primary_ip6_addr_.is_unspecified())) {
299 if (!is_hc_active_) {
307 if (vmi_type_ == VHOST) {
315 if (!is_hc_active_) {
329 if (local_preference_ != 0) {
332 }
else if (ecmp ==
true) {
336 pref->
set_vrf(vrf()->GetName());
342 bool ecmp_mode =
false;
352 if (service_ip.is_v4()) {
354 dependent_ip = service_ip_;
355 ecmp_mode = service_ip_ecmp_;
357 dependent_ip = primary_ip_addr_;
365 if (service_ip.is_v6()) {
367 dependent_ip = service_ip6_;
368 ecmp_mode = service_ip_ecmp6_;
370 dependent_ip = primary_ip6_addr_;
376 if (local_preference_ != 0) {
379 }
else if (ecmp_mode ==
true) {
384 pref->
set_vrf(vrf()->GetName());
388 if (ecmp_load_balance_.use_global_vrouter() ==
false)
389 return ecmp_load_balance.
Copy(ecmp_load_balance_);
390 return ecmp_load_balance.
Copy(agent()->oper_db()->global_vrouter()->
391 ecmp_load_balance());
407 CopySgIdList(&sg_id_list);
410 CopyTagIdList(&tag_list);
413 SetPathPreference(&path_preference,
false, dependent_ip);
415 uint32_t label = l2_label_;
416 if (pbb_interface()) {
417 label = GetPbbLabel();
422 vn_name = vn()->GetName();
425 table->AddLocalVmRoute(peer_.get(), vrf_->GetName(), mac,
this, ip,
426 label, vn_name, sg_id_list,
427 tag_list, path_preference,
428 ethernet_tag_, etree_leaf_, name());
433 uint32_t ethernet_tag,
448 uint32_t plen,
const std::string &dest_vn,
449 bool force_policy,
bool ecmp,
bool is_local,
450 bool is_health_check_service,
454 const std::string &intf_route_type,
455 bool is_learnt_route) {
458 CopySgIdList(&sg_id_list);
461 CopyTagIdList(&tag_list);
464 SetPathPreference(&path_preference, ecmp, dependent_rt);
467 bool native_encap =
false;
475 vn_list.insert(dest_vn);
477 CopyEcmpLoadBalance(ecmp_load_balance);
479 (peer_.get(), vrf_name, addr, plen, GetUuid(), vn_list, label,
480 sg_id_list, tag_list, communities, force_policy, path_preference,
481 service_ip, ecmp_load_balance, is_local, is_health_check_service,
482 name(), native_encap, intf_route_type, is_learnt_route);
497 (std::vector<autogen::DhcpOptionType> *
options)
const {
498 if (oper_dhcp_options().are_dhcp_options_set()) {
499 *options = oper_dhcp_options().dhcp_options();
508 (std::vector<autogen::DhcpOptionType> *options,
bool ipv6)
const {
510 const std::vector<VnIpam> &vn_ipam = vn()->GetVnIpam();
512 for (index = 0; index < vn_ipam.size(); ++index) {
513 if (!ipv6 && vn_ipam[index].IsSubnetMember(primary_ip_addr())) {
516 if (ipv6 && vn_ipam[index].IsSubnetMember(primary_ip6_addr())) {
520 if (index < vn_ipam.size() &&
521 vn_ipam[index].oper_dhcp_options.are_dhcp_options_set()) {
522 *options = vn_ipam[index].oper_dhcp_options.dhcp_options();
532 (std::vector<autogen::DhcpOptionType> *options,
bool ipv6)
const {
534 std::string ipam_name;
535 autogen::IpamType ipam_type;
537 vn()->GetIpamData(primary_ip_addr(), &ipam_name, &ipam_type)) {
538 *options = ipam_type.dhcp_option_list.dhcp_option;
542 vn()->GetIpamData(primary_ip6_addr(), &ipam_name, &ipam_type)) {
543 *options = ipam_type.dhcp_option_list.dhcp_option;
553 AllowedAddressPairSet::const_iterator it =
554 allowed_address_pair_list_.list_.begin();
555 while (it != allowed_address_pair_list_.list_.end()) {
556 if (it->addr_ == ip && it->plen_ == plen &&
562 LearntMacIpSet::const_iterator mac_ip_it =
563 learnt_mac_ip_list_.list_.begin();
564 while (mac_ip_it != learnt_mac_ip_list_.list_.end()) {
565 if (mac_ip_it->ip_ == ip &&
567 return mac_ip_it->mac_;
580 AllowedAddressPairSet::const_iterator it =
581 allowed_address_pair_list_.list_.begin();
582 while (it != allowed_address_pair_list_.list_.end()) {
583 if (it->addr_ == ip && it->plen_ == plen) {
593 if (IsActive() ==
false || vrf_->IsDeleted()) {
599 primary_ip_addr_, 32);
601 (vrf_->GetInet4UnicastRouteTable()->FindActiveEntry(&rt_key));
606 if (rt->FindPath(peer_.get()) == NULL) {
610 return rt->
FindPath(peer_.get())->path_preference().wait_for_traffic();
617 }
else if (vm_ip.is_v6()) {
620 if (vn_.get() == NULL) {
624 const VnIpam *ipam = NULL;
625 if (subnet_.is_unspecified()) {
626 ipam = vn_->GetIpam(vm_ip);
628 ipam = vn_->GetIpam(subnet_);
632 if ((vm_ip.is_v4() && ipam->
dns_server.is_v4()) ||
633 (vm_ip.is_v6() && ipam->
dns_server.is_v6())) {
642 if (vn_.get() == NULL) {
646 const VnIpam *ipam = NULL;
647 if (subnet_.is_unspecified()) {
648 ipam = vn_->GetIpam(vm_ip);
650 ipam = vn_->GetIpam(subnet_);
654 if ((vm_ip.is_v4() && ipam->
default_gw.is_v4()) ||
655 (vm_ip.is_v6() && ipam->
default_gw.is_v6())) {
664 SecurityGroupEntrySet::const_iterator it;
665 for (it = sg_list_.list_.begin(); it != sg_list_.list_.end(); ++it) {
666 if (it->del_pending_)
668 if (it->sg_.get() == NULL)
670 sg_id_list->push_back(it->sg_->GetSgId());
675 ServiceVlanSet::const_iterator it = service_vlan_list_.list_.begin();
676 while (it != service_vlan_list_.list_.end()) {
677 if (it->vrf_.get() == vrf) {
686 ServiceVlanSet::const_iterator it = service_vlan_list_.list_.begin();
687 while (it != service_vlan_list_.list_.end()) {
688 if (it->tag_ == vlan_tag) {
689 return it->vrf_.get();
698 return floating_ip_list_.v4_count_ > 0;
700 return floating_ip_list_.v6_count_ > 0;
705 return floating_ip_list_.list_.size() != 0;
709 VmInterface::FloatingIpSet::const_iterator it =
710 floating_ip_list_.list_.begin();
711 while(it != floating_ip_list_.list_.end()) {
712 if ((*it).floating_ip_ == ip) {
722 VmInterface::AliasIpSet::const_iterator it =
723 alias_ip_list_.list_.begin();
724 for (; it != alias_ip_list_.list_.end(); ++it) {
725 if (it->vrf_.get() == NULL) {
729 if (ip == it->alias_ip_) {
730 return it->vrf_.get();
737 std::pair<HealthCheckInstanceSet::iterator, bool> ret;
738 ret = hc_instance_set_.insert(hc_inst);
748 if(hc_instance_set_.find(hc_inst) != hc_instance_set_.end()) {
749 std::size_t ret = hc_instance_set_.erase(hc_inst);
756 return hc_instance_set_;
760 return hc_instance_set_.size() != 0;
767 if (!IsHealthCheckEnabled() || !is_hc_active()) {
771 HealthCheckInstanceSet::const_iterator it = hc_instance_set_.begin();
772 while (it != hc_instance_set_.end()) {
776 if (hc_service == NULL)
798 if (mirror_entry()) {
799 return mirror_entry()->GetAnalyzerName();
801 return std::string();
812 FatFlowEntrySet::iterator start = fat_flow_list_.list_.lower_bound(
814 IGNORE_ADDRESS_MIN_VAL,
815 AGGREGATE_PREFIX_MIN_VAL));
816 FatFlowEntrySet::iterator end = fat_flow_list_.list_.upper_bound(
818 IGNORE_ADDRESS_MAX_VAL,
819 AGGREGATE_PREFIX_MIN_VAL));
821 if (start != fat_flow_list_.list_.end()) {
822 while (start != end) {
823 if ((start->protocol == protocol) && (start->port == port) &&
824 (start->prefix_aggregate == AGGREGATE_NONE)) {
825 *ignore_addr = start->ignore_address;
841 uint8_t max_mask, max_plen;
846 if (src_ip->is_v4()) {
847 prefix_type = AGGREGATE_SRC_IPV4;
849 max_prefix_type = AGGREGATE_SRC_DST_IPV4;
855 prefix_type = AGGREGATE_SRC_IPV6;
856 max_prefix_type = AGGREGATE_SRC_DST_IPV6;
875 FatFlowEntrySet::iterator start = fat_flow_list_.list_.lower_bound(lbffe);
880 *src_ip, max_mask, max_plen,
886 FatFlowEntrySet::iterator end = fat_flow_list_.list_.upper_bound(ubffe);
888 if ((start != fat_flow_list_.list_.end()) &&
889 (start->protocol == protocol) && (start->port == port)) {
890 while (start != end) {
891 if (src_ip->is_v4() && start->src_prefix.is_v4() &&
893 start->src_prefix_mask) &&
894 (start->protocol == protocol) && (start->port == port)) {
897 match_ffe = &(*start);
899 }
else if (src_ip->is_v6() && start->src_prefix.is_v6() &&
901 start->src_prefix_mask) &&
902 (start->protocol == protocol) && (start->port == port)) {
905 match_ffe = &(*start);
912 if (src_ip->is_v4()) {
929 uint16_t *dport,
bool *same_port_num,
933 if ((*sport) < (*dport)) {
934 if (MatchSrcPrefixPort(protocol, *sport, SrcIP, ignore_addr)) {
938 if (MatchSrcPrefixPort(protocol, *dport, SrcIP, ignore_addr)) {
943 if (MatchSrcPrefixPort(protocol, *dport, SrcIP, ignore_addr)) {
944 if ((*sport) == (*dport)) {
945 *same_port_num =
true;
950 if (MatchSrcPrefixPort(protocol, *sport, SrcIP, ignore_addr)) {
955 if (MatchSrcPrefixPort(protocol, 0, SrcIP, ignore_addr)) {
969 uint8_t max_mask, max_plen;
974 if (dst_ip->is_v4()) {
975 prefix_type = AGGREGATE_DST_IPV4;
981 prefix_type = AGGREGATE_DST_IPV6;
1000 FatFlowEntrySet::iterator start = fat_flow_list_.list_.lower_bound(lbffe);
1008 *dst_ip, max_mask, max_plen);
1010 FatFlowEntrySet::iterator end = fat_flow_list_.list_.upper_bound(ubffe);
1012 if ((start != fat_flow_list_.list_.end()) &&
1013 (start->protocol == protocol) && (start->port == port)) {
1014 while (start != end) {
1015 if (dst_ip->is_v4() && start->dst_prefix.is_v4() &&
1017 start->dst_prefix_mask) &&
1018 (start->protocol == protocol) && (start->port == port)) {
1021 match_ffe = &(*start);
1023 }
else if (dst_ip->is_v6() && start->dst_prefix.is_v6() &&
1025 start->dst_prefix_mask) &&
1026 (start->protocol == protocol) && (start->port == port)) {
1029 match_ffe = &(*start);
1036 if (dst_ip->is_v4()) {
1054 uint16_t *dport,
bool *same_port_num,
1058 if ((*sport) < (*dport)) {
1059 if (MatchDstPrefixPort(protocol, *sport, DstIP, ignore_addr)) {
1063 if (MatchDstPrefixPort(protocol, *dport, DstIP, ignore_addr)) {
1068 if (MatchDstPrefixPort(protocol, *dport, DstIP, ignore_addr)) {
1069 if ((*sport) == (*dport)) {
1070 *same_port_num =
true;
1075 if (MatchDstPrefixPort(protocol, *sport, DstIP, ignore_addr)) {
1080 if (MatchDstPrefixPort(protocol, 0, DstIP, ignore_addr)) {
1081 *sport = *dport = 0;
1093 Ip4Address Ipv4_src_subnet, Ipv4_src_ret_subnet;
1094 Ip4Address Ipv4_dst_subnet, Ipv4_dst_ret_subnet;
1095 Ip6Address Ipv6_src_subnet, Ipv6_src_ret_subnet;
1096 Ip6Address Ipv6_dst_subnet, Ipv6_dst_ret_subnet;
1097 uint8_t max_mask, max_plen;
1100 if (src_ip->is_v4()) {
1101 prefix_type = AGGREGATE_SRC_DST_IPV4;
1109 prefix_type = AGGREGATE_SRC_DST_IPV6;
1132 FatFlowEntrySet::iterator start = fat_flow_list_.list_.lower_bound(lbffe);
1135 *src_ip, max_mask, max_plen,
1136 *dst_ip, max_mask, max_plen);
1138 FatFlowEntrySet::iterator end = fat_flow_list_.list_.upper_bound(ubffe);
1140 if ((start != fat_flow_list_.list_.end()) &&
1141 (start->protocol == protocol) && (start->port == port)) {
1142 while (start != end) {
1143 if (src_ip->is_v4() && start->src_prefix.is_v4() &&
1144 start->dst_prefix.is_v4() &&
1146 start->src_prefix_mask) &&
1148 start->dst_prefix_mask) &&
1149 (start->protocol == protocol) && (start->port == port)) {
1150 match_ffe = &(*start);
1151 }
else if (src_ip->is_v6() && start->src_prefix.is_v6() &&
1152 start->dst_prefix.is_v6() &&
1154 start->src_prefix_mask) &&
1156 start->dst_prefix_mask) &&
1157 (start->protocol == protocol) && (start->port == port)) {
1158 match_ffe = &(*start);
1164 if (src_ip->is_v4()) {
1165 Ipv4_src_ret_subnet =
1168 Ipv4_dst_ret_subnet =
1171 *src_ip =
IpAddress(Ipv4_src_ret_subnet);
1172 *dst_ip =
IpAddress(Ipv4_dst_ret_subnet);
1174 Ipv6_src_ret_subnet =
1177 Ipv6_dst_ret_subnet =
1180 *src_ip =
IpAddress(Ipv6_src_ret_subnet);
1181 *dst_ip =
IpAddress(Ipv6_dst_ret_subnet);
1190 uint16_t *dport,
bool *same_port_num,
1193 if ((*sport) < (*dport)) {
1194 if (MatchSrcDstPrefixPort(protocol, *sport, SrcIP, DstIP)) {
1198 if (MatchSrcDstPrefixPort(protocol, *dport, SrcIP, DstIP)) {
1203 if (MatchSrcDstPrefixPort(protocol, *dport, SrcIP, DstIP)) {
1204 if ((*sport) == (*dport)) {
1205 *same_port_num =
true;
1210 if (MatchSrcDstPrefixPort(protocol, *sport, SrcIP, DstIP)) {
1215 if (MatchSrcDstPrefixPort(protocol, 0, SrcIP, DstIP)) {
1216 *sport = *dport = 0;
1224 uint16_t *sport, uint16_t *dport,
1225 bool *same_port_num,
1227 bool *is_fat_flow_src_prefix,
1228 bool *is_fat_flow_dst_prefix,
1232 uint16_t *src_port = sport,
1234 IpAddress *src_ip = (ingress? SrcIP: DstIP),
1235 *dst_ip = (ingress? DstIP: SrcIP);
1236 bool *is_src_prefix = (ingress? is_fat_flow_src_prefix : is_fat_flow_dst_prefix);
1237 bool *is_dst_prefix = (ingress? is_fat_flow_dst_prefix : is_fat_flow_src_prefix);
1241 *is_src_prefix =
false;
1242 *is_dst_prefix =
false;
1245 if (MatchSrcPrefixRule(protocol, src_port, dst_port, same_port_num,
1246 src_ip, &ign_addr)) {
1247 *is_src_prefix =
true;
1248 *ignore_addr = ign_addr;
1252 if (MatchDstPrefixRule(protocol, src_port, dst_port, same_port_num,
1253 dst_ip, &ign_addr)) {
1254 *is_dst_prefix =
true;
1255 *ignore_addr = ign_addr;
1259 ret = MatchSrcDstPrefixRule(protocol, src_port, dst_port, same_port_num,
1262 *is_src_prefix =
true;
1263 *is_dst_prefix =
true;
1274 IpAddress gw_ip = GetGatewayIp(primary_ip_addr_);
1275 if ((sip == gw_ip) || (dip == gw_ip)) {
1278 IpAddress service_ip = GetServiceIp(primary_ip_addr_);
1279 if ((sip == service_ip) || (dip == service_ip)) {
1282 boost::system::error_code ec;
1283 Ip4Address ll_subnet = Ip4Address::from_string
1284 (agent()->v4_link_local_subnet(), ec);
1286 agent()->v4_link_local_plen())) {
1290 agent()->v4_link_local_plen())) {
1294 IpAddress gw_ip = GetGatewayIp(primary_ip6_addr_);
1295 if ((sip == gw_ip) || (dip == gw_ip)) {
1298 IpAddress service_ip = GetServiceIp(primary_ip6_addr_);
1299 if ((sip == service_ip) || (dip == service_ip)) {
1302 boost::system::error_code ec;
1303 Ip6Address ll6_subnet = Ip6Address::from_string
1304 (agent()->v6_link_local_subnet(), ec);
1306 agent()->v6_link_local_plen())) {
1310 agent()->v6_link_local_plen())) {
1320 if (!ip.is_unspecified()) {
1321 value = plen | htonl(ip.to_ulong());
1328 if (ip.is_v6() && !ip.is_unspecified()) {
1343 IpAddress gw_ip = GetGatewayIp(primary_ip_addr_);
1345 FillV4ExcludeIp(plen, gw_ip.to_v4(), list);
1346 IpAddress service_ip = GetServiceIp(primary_ip_addr_);
1347 FillV4ExcludeIp(plen, service_ip.to_v4(), list);
1348 boost::system::error_code ec;
1349 Ip4Address ll_subnet = Ip4Address::from_string
1350 (agent()->v4_link_local_subnet(), ec);
1351 plen = (uint64_t(agent()->v4_link_local_plen()) << 32);
1352 FillV4ExcludeIp(plen, ll_subnet, list);
1355 IpAddress gw6_ip = GetGatewayIp(primary_ip6_addr_);
1356 FillV6ExcludeIp(128, gw6_ip, list);
1357 IpAddress service6_ip = GetServiceIp(primary_ip6_addr_);
1358 FillV6ExcludeIp(128, service6_ip, list);
1359 Ip6Address ll6_subnet = Ip6Address::from_string
1360 (agent()->v6_link_local_subnet(), ec);
1361 FillV6ExcludeIp(agent()->v6_link_local_plen(), ll6_subnet, list);
1366 if (device_type_ == VM_VLAN_ON_VMI) {
1371 return parent()->mac();
1378 return (l2_active_ & is_hc_active_);
1385 if (disable_policy_) {
1390 if (layer3_forwarding_ ==
false) {
1403 return vxlan_id_ != 0;
1407 std::vector<std::string> *vect)
const {
1410 list = instance_ipv4_list_.list_;
1412 list = instance_ipv6_list_.list_;
1414 InstanceIpSet::iterator it = list.begin();
1415 while (it != list.end()) {
1418 vect->push_back(rt.
ip_.to_string());
1423 BridgeDomainEntrySet::const_iterator it = bridge_domain_list_.list_.begin();
1424 for (; it != bridge_domain_list_.list_.end(); it++) {
1425 return it->bridge_domain_->isid();
1427 return kInvalidIsid;
1431 BridgeDomainEntrySet::const_iterator it = bridge_domain_list_.list_.begin();
1432 for (; it != bridge_domain_list_.list_.end(); it++) {
1433 if (it->bridge_domain_->vrf()) {
1434 return it->bridge_domain_->vrf()->vrf_id();
1441 BridgeDomainEntrySet::const_iterator it = bridge_domain_list_.list_.begin();
1442 for (; it != bridge_domain_list_.list_.end(); it++) {
1443 if (it->bridge_domain_->vrf()) {
1444 return it->bridge_domain_->vrf()->table_label();
1454 MetaDataIpMap::const_iterator it = metadata_ip_map_.find(ip);
1455 if (it != metadata_ip_map_.end()) {
1463 std::pair<MetaDataIpMap::iterator, bool> ret;
1464 ret = metadata_ip_map_.insert(std::pair<IpAddress, MetaDataIp*>
1472 LOG(DEBUG,
"Return code for Metadata IP Map Erase: " <<ret<<
" for MetaDataIp: " <<mip->
GetLinkLocalIp());
1477 MetaDataIpMap::iterator it = metadata_ip_map_.begin();
1478 while (it != metadata_ip_map_.end()) {
1479 it->second->UpdateInterfaceCb();
1489 do_dhcp_relay_ = (fabric_port_ && addr.to_ulong() == 0 && vrf() &&
1492 if (do_dhcp_relay_) {
1502 if (addr.to_ulong() == 0) {
1503 addr = primary_ip_addr_;
1506 if (primary_ip_addr_ != addr) {
1507 primary_ip_addr_ = addr;
1515 if (si_other_end_vmi_ == nil_uuid()) {
1525 InterfaceInfo intf_info;
1526 intf_info.set_name(name());
1527 intf_info.set_index(id_);
1530 case ACTIVATED_IPV4:
1531 intf_info.set_op(
"IPV4 Activated");
1533 case DEACTIVATED_IPV4:
1534 intf_info.set_op(
"IPV4 Deactivated");
1536 case ACTIVATED_IPV6:
1537 intf_info.set_op(
"IPV6 Activated");
1539 case DEACTIVATED_IPV6:
1540 intf_info.set_op(
"IPV6 Deactivated");
1543 intf_info.set_op(
"L2 Activated");
1545 case DEACTIVATED_L2:
1546 intf_info.set_op(
"L2 Deactivated");
1549 intf_info.set_op(
"Add");
1552 intf_info.set_op(
"Delete");
1555 case FLOATING_IP_CHANGE: {
1556 intf_info.set_op(
"Floating IP change");
1557 std::vector<FloatingIPInfo> fip_list;
1558 FloatingIpSet::iterator it = floating_ip_list_.list_.begin();
1559 while (it != floating_ip_list_.list_.end()) {
1563 fip.set_vrf_name(ip.
vrf_->GetName());
1564 fip_list.push_back(fip);
1567 intf_info.set_fip(fip_list);
1570 case SERVICE_CHANGE:
1574 intf_info.set_op(
"VMI reuse");
1575 intf_info.set_vrf_on_delete(vrf_name_);
1579 intf_info.set_op(
"VRF reuse");
1580 intf_info.set_vrf_on_delete(vrf_name_);
1584 intf_info.set_ip_address(primary_ip_addr_.to_string());
1589 intf_info.set_vn(vn_->GetName());
1592 intf_info.set_vrf(vrf_->GetName());
1594 intf_info.set_vm_project(
UuidToString(vm_project_uuid_));
bool IsHealthCheckEnabled() const
bool GetIpamDhcpOptions(std::vector< autogen::DhcpOptionType > *options, bool ipv6) const
VrfEntry * GetAliasIpVrf(const IpAddress &ip) const
void BuildFatFlowExcludeList(FatFlowExcludeList *list) const
void ResyncHealthCheckInterface(const HealthCheckService *service, const VmInterface *intf)
uint8_t dst_aggregate_plen
#define FAT_FLOW_ENTRY_MIN_PREFIX_LEN
void SetPathPreference(PathPreference *pref, bool ecmp, const IpAddress &dependent_ip) const
std::set< InstanceIp, InstanceIp > InstanceIpSet
bool IsFloatingIp(const IpAddress &ip) const
AgentRouteTable * GetEvpnRouteTable() const
VrfEntry * fabric_vrf() const
void SendTrace(const AgentDBTable *table, Trace event) const
std::vector< uint16_t > fat_flow_v6_exclude_plen_list_
HealthCheckService * service() const
bool GetSubnetDhcpOptions(std::vector< autogen::DhcpOptionType > *options, bool ipv6) const
bool MatchSrcPrefixPort(uint8_t protocol, uint16_t port, IpAddress *src_ip, FatFlowIgnoreAddressType *ignore_addr) const
IpAddress destination_ip() const
bool IsIp4SubnetMember(const Ip4Address &ip, const Ip4Address &prefix_ip, uint16_t plen)
static IpAddress ipv4_max_addr
void DelLocalVmRoute(const Peer *peer, const std::string &vrf_name, const MacAddress &mac, const VmInterface *intf, const IpAddress &ip, uint32_t ethernet_tag)
void InsertHealthCheckInstance(HealthCheckInstanceBase *hc_inst)
static IpAddress ipv4_empty_addr
uint32_t GetServiceVlanLabel(const VrfEntry *vrf) const
std::vector< uint64_t > fat_flow_v4_exclude_list_
boost::asio::ip::address IpAddress
static const MacAddress & vrrp_mac()
const MacAddress & GetVifMac(const Agent *) const
static const MacAddress kZeroMac
bool InstallBridgeRoutes() const
bool GetInterfaceDhcpOptions(std::vector< autogen::DhcpOptionType > *options) const
void BuildIpStringList(Address::Family family, std::vector< std::string > *vect) const
void DelPhysicalDeviceVnEntry(const boost::uuids::uuid &vmi)
~VmiToPhysicalDeviceVnData()
std::vector< int > SecurityGroupList
std::unique_ptr< DBRequestData > data
void UpdateMetaDataIpInfo()
void FillV4ExcludeIp(uint64_t plen, const Ip4Address &ip, FatFlowExcludeList *list) const
void CopyEcmpLoadBalance(EcmpLoadBalance &ecmp_load_balance)
static const uint8_t kMaxV4PrefixLen
VmiToPhysicalDeviceVnData(const boost::uuids::uuid &dev, const boost::uuids::uuid &vn)
const string & GetName() const
uint32_t GetPbbLabel() const
static std::string UuidToString(const boost::uuids::uuid &id)
void set_vrf(const std::string &vrf)
bool IsHostLinkStateUp(const std::string &name) const
const Peer * peer() const
IpAddress GetServiceIp(const IpAddress &ip) const
FatFlowPrefixAggregateType prefix_aggregate
static IpAddress ipv6_max_addr
static Ip4Address GetIp4SubnetAddress(const Ip4Address &prefix, uint16_t plen)
static Ip6Address GetIp6SubnetAddress(const Ip6Address &prefix, uint16_t plen)
void SetServiceVlanPathPreference(PathPreference *pref, const IpAddress &service_ip) const
const std::string & fabric_vrf_name() const
std::vector< uint64_t > fat_flow_v6_exclude_upper_list_
bool WaitForTraffic() const
FatFlowPrefixAggregateType
static void Delete(const Peer *peer, const string &vrf_name, const IpAddress &addr, uint8_t plen)
void set_dependent_ip(const IpAddress &ip)
static const uint32_t kInvalidVlanId
const std::string GetAnalyzer() const
void DhcpSnoopSetConfigSeen(const std::string &ifname)
const HealthCheckInstanceSet & hc_instance_set() const
virtual void GetOsParams(Agent *agent)
boost::asio::ip::address_v6 Ip6Address
uint8_t src_aggregate_plen
std::unique_ptr< DBRequestKey > key
bool NeedOsStateWithoutDevice() const
bool IsIpv4Active() const
std::set< HealthCheckInstanceBase * > HealthCheckInstanceSet
static const std::string & NullString()
static TypeBmap AllType()
void DeleteRoute(const std::string &vrf_name, const IpAddress &ip, uint32_t plen)
uint32_t GetPbbVrf() const
#define OPER_TRACE_ENTRY(obj, table,...)
VrfEntry * FindVrfRef(const std::string &name) const
void set_preference(uint32_t preference)
IpAddress get_source_ip() const
void UpdatePhysicalDeviceVnEntry(const boost::uuids::uuid &vmi, boost::uuids::uuid &dev, boost::uuids::uuid &vn, IFMapNode *vn_node)
std::vector< std::string > CommunityList
void Ip6AddressToU64Array(const Ip6Address &addr, uint64_t *arr, int size)
AgentDBEntry * Find(const DBEntry *key, bool ret_del)
FatFlowIgnoreAddressType ignore_address
void AddRoute(const std::string &vrf_name, const IpAddress &ip, uint32_t plen, const std::string &vn_name, bool force_policy, bool ecmp, bool is_local, bool proxy_arp, const IpAddress &service_ip, const IpAddress &dependent_ip, const CommunityList &communties, uint32_t label, const string &intf_route_type, bool is_learnt_route=false)
std::set< std::string > VnListType
bool PolicyEnabled() const
void UpdateInterfaceHealthCheckService()
static Type ComputeType(TypeBmap bmap)
bool ExcludeFromFatFlow(Address::Family family, const IpAddress &sip, const IpAddress &dip) const
boost::asio::ip::address_v4 Ip4Address
static const uint32_t kInvalidLabel
void DeleteMetaDataIpInfo(MetaDataIp *mip)
bool CopyIpAddress(Ip4Address &addr)
void DeleteHealthCheckInstance(HealthCheckInstanceBase *hc_inst)
static IpAddress ipv6_empty_addr
virtual void Copy(const EcmpLoadBalance &rhs)
std::vector< uint64_t > fat_flow_v6_exclude_lower_list_
const MacAddress & GetIpMac(const IpAddress &, const uint8_t plen) const
bool MatchSrcDstPrefixRule(uint8_t protocol, uint16_t *sport, uint16_t *dport, bool *same_port_num, IpAddress *SrcIP, IpAddress *DstIP) const
bool MatchDstPrefixPort(uint8_t protocol, uint16_t port, IpAddress *dst_ip, FatFlowIgnoreAddressType *ignore_addr) const
void InsertMetaDataIpInfo(MetaDataIp *mip)
bool MatchSrcPrefixRule(uint8_t protocol, uint16_t *sport, uint16_t *dport, bool *same_port_num, IpAddress *SrcIP, FatFlowIgnoreAddressType *ignore_addr) const
bool MatchDstPrefixRule(uint8_t protocol, uint16_t *sport, uint16_t *dport, bool *same_port_num, IpAddress *DstIP, FatFlowIgnoreAddressType *ignore_addr) const
HealthCheckType health_check_type() const
static const uint32_t kInvalidIndex
bool IsMetaDataIPActive() const
void set_static_preference(bool static_pref)
VrfEntry * forwarding_vrf() const
static const uint32_t kInvalidIndex
static void AddLocalVmRoute(const Peer *peer, const string &vm_vrf, const IpAddress &addr, uint8_t plen, const boost::uuids::uuid &intf_uuid, const VnListType &vn_list, uint32_t label, const SecurityGroupList &sg_list, const TagList &tag_list, const CommunityList &communities, bool force_policy, const PathPreference &path_preference, const IpAddress &subnet_service_ip, const EcmpLoadBalance &ecmp_load_balance, bool is_local, bool is_health_check_service, const std::string &intf_name, bool native_encap, const std::string &intf_route_type=VmInterface::kInterface, bool is_learnt_route=false)
#define LOG(_Level, _Msg)
void AddL2InterfaceRoute(const IpAddress &ip, const MacAddress &mac, const IpAddress &dependent_ip) const
bool IsFatFlowPrefixAggregation(bool ingress, uint8_t protocol, uint16_t *sport, uint16_t *dport, bool *same_port_num, IpAddress *SrcIP, IpAddress *DstIP, bool *is_src_prefix, bool *is_dst_prefix, FatFlowIgnoreAddressType *ignore_addr) const
bool HasFloatingIp() const
bool IsMetaDataL2Active() const
bool IsFatFlowPortBased(uint8_t protocol, uint16_t port, FatFlowIgnoreAddressType *ignore_addr) const
VmInterface * PortTuplePairedInterface() const
IpAddress GetGatewayIp(const IpAddress &ip) const
virtual AgentPath * FindPath(const Peer *peer) const
void DeleteL2InterfaceRoute(const VrfEntry *vrf, uint32_t ethernet_tag, const IpAddress &ip, const MacAddress &mac) const
bool MatchAapIp(const IpAddress &ip, uint8_t plen) const
bool MatchSrcDstPrefixPort(uint8_t protocol, uint16_t port, IpAddress *src_ip, IpAddress *dst_ip) const
virtual void GetOsParams(Agent *agent)
const Ip4Address GetDhcpSnoopEntry(const std::string &ifname)
void CopySgIdList(SecurityGroupList *sg_id_list) const
bool IsIp6SubnetMember(const Ip6Address &ip, const Ip6Address &subnet, uint8_t plen)
bool IsIpv6Active() const
MetaDataIp * GetMetaDataIp(const IpAddress &ip) const
const VrfEntry * GetServiceVlanVrf(uint16_t vlan_tag) const
void FillV6ExcludeIp(uint16_t plen, const IpAddress &ip, FatFlowExcludeList *list) const
std::vector< int > TagList