OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vm_interface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef vnsw_agent_vm_interface_hpp
6 #define vnsw_agent_vm_interface_hpp
7 
9 #include <oper/audit_list.h>
10 #include <oper/ecmp_load_balance.h>
12 // VmInterface is implementation of VM Port interfaces
13 //
14 // All modification to an VmInterface is done only thru the DBTable Request
15 // handling.
16 //
17 // The DBTable request can be generated from multiple events.
18 // Example : Config update, link-state change, port-ipc message etc.
19 //
20 // Only two types of DBTable request can create/delete a VmInterface
21 // - VmInterfaceConfigData :
22 // This request type is generated from config processing
23 // Request of this type of mandatory for all interfaces
24 // - VmInterfaceNovaData :
25 // This request type is generated from port-ipc messages to agent
26 // Request of this type are optional
27 //
28 // An VmInterface can be of many types. Different type of VmInterfaces with
29 // corresponding values of DeviceType and VmiType are given below,
30 //
31 // DeviceType = VM_ON_TAP, VmiType = INSTANCE
32 // Typically represents an interface inside a VM/Container.
33 // Examples:QEMU VM, Containers, Service-Chain interface etc.
34 // It will have a TAP interface associated with it. The interface be
35 // created only by port-ipc message. The config message only updates the
36 // attributes and does not create interface of this type
37 //
38 // DeviceType = VM_PHYSICAL_VLAN, VmiType = INTANCE
39 // This configuration is used in case of VmWare ESXi.
40 // Each ESXi VM is assigned a VLAN (by nova-compute). The compute node has
41 // an uplink port that is member of all VLANs. Agent/VRouter can identify
42 // VmInterface by tuple <uplink-port, vlan>. The uplink port is seen as a
43 // phyiscal port on compute node
44 // The agent->hypervisor_mode_ is also set to ESXi in this case
45 //
46 // DeviceType = VM_PHYSICAL_MAC, VmiType = INTANCE and
47 // This configuration is used in VmWare VCenter
48 // VCenter:
49 // Contrail uses distributed vswitch to support VCenter. Each VN is
50 // allocated a PVLAN. The port on compute node is member of primary-vlan
51 // and VMs are member of secondary-vlans. Packets from all VMs are
52 // received on primary-vlan on compute node, hence they are classified
53 // using source-mac address (which is unique to every VM)
54 // agent->hypervisor_mode_ is set to VCENTER
55 // DeviceType = LOCAL_DEVICE, VmiType = GATEWAY
56 // This configuraiton is used in case of Gateway interfaces connected locally
57 //
58 // DeviceType = REMOTE_VM_VLAN_ON_VMI, VmiType = REMOTE_VM
59 // This configuration is used to model an end-point connected on local
60 // interface
61 // The VmInterface is classified based on vlan-tag of packet
62 //
63 // DeviceType = TOR, VmiType = BAREMETAL
64 // This configuration is used to model ToR ports managed with OVS
65 //
66 // DeviceType = VM_VLAN_ON_VMI, VmiType = INSTANCE
67 // This configuration is used to model vlan sub-interfaces and
68 // Nested Containers (both K8S and Mesos)
69 // Sub-Interfaces:
70 // Typically, the sub-interfaces are created over other VmInterfaces with
71 // DeviceType = VM_ON_TAP
72 // The VmInterface is classified based on vlan-tag
73 //
74 // Nested Containers:
75 // In case of nested-containers, the first level Container ports are
76 // created as regular tap-interfaces. The second level containers are
77 // created as MAC-VLAN ports. Since all second level containers share same
78 // tap-interface, they are classified using vlan-tag
79 //
80 // DBRequest Handling
81 // ------------------
82 // All DBRequest are handed off to VmInterface module via methods
83 // VmInterface::Add() and VmInterface::Delete(). VmInterface modules processes
84 // request in following stages,
85 // 1. Config Processing
86 // This stage is responsible to update VmInterface fields with latest
87 // information according. The fields updated will depend on type of
88 // request.
89 //
90 // Every DBRequest type implements a method "OnResync". This method must
91 // update VmInterface fields according to the request
92 // The same OnResync() is called for both "Add", "Change" and "Resync"
93 // operation
94 //
95 // 2. Apply Config
96 // This stage is responsible to generated other oper-db states including
97 // MPLS Labels, NextHops, Routes etc... based on the latest configuration
98 // It must also take care of removing derived states based on old-state
99 //
100 // VmInterfaceState() class is responsible to manage derived states
101 // such as routes, nexthops, labels etc...).
102 // old states and create new states based on latest interface configuration
104 
105 typedef std::vector<boost::uuids::uuid> SgUuidList;
106 typedef std::vector<SgEntryRef> SgList;
107 typedef std::vector<AclDBEntryConstRef> FirewallPolicyList;
108 struct VmInterfaceData;
109 struct VmInterfaceConfigData;
110 struct VmInterfaceNovaData;
113 struct VmInterfaceMirrorData;
114 class OperDhcpOptions;
115 class PathPreference;
116 class MetaDataIp;
119 
120 class LocalVmPortPeer;
121 class VmInterface;
122 
124 // VmInterfaceState manages dervied states from VmInterface. On any config
125 // change to interface, this VmInterfaceState gets invoked after modifying
126 // VmInterface with latest configuration. Each VmInterfaceState must be
127 // self-contained and idempotent. The class must store old variables it needs.
128 //
129 // There are 2 type of states managed by the class L2-State (EVPN-Route,
130 // L2-NextHop etc..) and L3-State(inet-route, l3-nexthop etc...). The class
131 // assumes each both L2 and L3 states are managed by each attribute. However,
132 // one of them can be dummy as necessary
133 //
134 // The class supports 3 different operations,
135 // - ADD : Must Add state resulting from this attribute
136 // - DEL : Must Delete state resulting from this attribute
137 // - DEL_ADD :
138 // DEL_ADD operation results if there is change in key for the state
139 // resulting from the attribute. In this case, the old state must be
140 // Delete and then followed by Addd of state
141 //
142 // Guildelines for GetOpL2 and GetOpL3:
143 // - Compute DEL cases
144 // - Compute DEL_ADD cases next
145 // - Compute ADD cases last
146 // - Return INVALID to ignore the operation
147 //
148 // The DEL operation must be based on latest configuration on interface
149 // The ADD operation must be based on latest configuration on interface
150 // The DEL_ADD operation must be based on old values stored in the class and
151 // latest value in the interface
154  // Keep order of Operation in enum sorted. RecomputeOp relies on it
155  enum Op {
160  };
161 
162  explicit VmInterfaceState() :
163  l2_installed_(false), l3_installed_(false) {
164  }
165  VmInterfaceState(bool l2_installed, bool l3_installed) :
166  l2_installed_(l2_installed), l3_installed_(l3_installed) {
167  }
168  virtual ~VmInterfaceState() {
169  }
170 
171  bool Installed() const {
172  return l3_installed_ || l2_installed_;
173  }
174 
175  virtual bool Update(const Agent *agent, VmInterface *vmi,
176  Op l2_force_op, Op l3_force_op) const;
177 
178  // Update Operation. In cases where operations are computed in stages,
179  // computes operation based on old value and new value
180  static Op RecomputeOp(Op old_op, Op new_op);
181 
182  // Get operation for Layer-2 state. Generally,
183  // ADD/DEL operaton are based on current state of VmInterface
184  // ADD_DEL operation is based on old-value and new value in VmInterface
185  virtual Op GetOpL2(const Agent *agent, const VmInterface *vmi) const {
186  return INVALID;
187  }
188 
189  // Get operation for Layer-3 state. Generally,
190  // ADD/DEL operaton are based on current state of VmInterface
191  // ADD_DEL operation is based on old-value and new value in VmInterface
192  virtual Op GetOpL3(const Agent *agent, const VmInterface *vmi) const {
193  return INVALID;
194  }
195 
196  // Copy attributes from VmInterface to local copy
197  virtual void Copy(const Agent *agent, const VmInterface *vmi) const {
198  return;
199  }
200 
201  virtual bool AddL2(const Agent *agent, VmInterface *vmi) const {
202  assert(0);
203  return false;
204  }
205 
206  virtual bool DeleteL2(const Agent *agent, VmInterface *vmi) const {
207  assert(0);
208  return false;
209  }
210 
211  virtual bool AddL3(const Agent *agent, VmInterface *vmi) const {
212  assert(0);
213  return false;
214  }
215 
216  virtual bool DeleteL3(const Agent *agent, VmInterface *vmi) const {
217  assert(0);
218  return false;
219  }
220 
221  mutable bool l2_installed_;
222  mutable bool l3_installed_;
223 };
224 
227  virtual ~MacVmBindingState();
228 
229  VmInterfaceState::Op GetOpL3(const Agent *agent,
230  const VmInterface *vmi) const;
231  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
232  void Copy(const Agent *agent, const VmInterface *vmi) const;
233  bool AddL3(const Agent *agent, VmInterface *vmi) const;
234 
235  mutable const VrfEntry *vrf_;
236  mutable bool dhcp_enabled_;
237  mutable bool dhcp_enabled_v6_;
238 };
239 
242  virtual ~VrfTableLabelState();
243 
244  VmInterfaceState::Op GetOpL3(const Agent *agent,
245  const VmInterface *vmi) const;
246  bool AddL3(const Agent *agent, VmInterface *vmi) const;
247 };
248 
250  NextHopState();
251  virtual ~NextHopState();
252 
253  VmInterfaceState::Op GetOpL2(const Agent *agent,
254  const VmInterface *vmi) const;
255  bool DeleteL2(const Agent *agent, VmInterface *vmi) const;
256  bool AddL2(const Agent *agent, VmInterface *vmi) const;
257 
258  VmInterfaceState::Op GetOpL3(const Agent *agent,
259  const VmInterface *vmi) const;
260  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
261  bool AddL3(const Agent *agent, VmInterface *vmi) const;
262 
263  uint32_t l2_label() const { return l2_label_; }
264  uint32_t l3_label() const { return l3_label_; }
265 
268  mutable uint32_t l2_label_;
269 
272  mutable uint32_t l3_label_;
273 
275 
277 };
278 
280 
282  MetaDataIpState(bool ipv4 = true);
283  virtual ~MetaDataIpState();
284 
285  VmInterfaceState::Op GetOpL3(const Agent *agent,
286  const VmInterface *vmi) const;
287  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
288  bool AddL3(const Agent *agent, VmInterface *vmi) const;
289 
290  mutable std::unique_ptr<MetaDataIp> mdata_ip_;
291  bool ipv4_;
292 };
293 
296  virtual ~ResolveRouteState();
297 
298  VmInterfaceState::Op GetOpL2(const Agent *agent,
299  const VmInterface *vmi) const;
300  bool DeleteL2(const Agent *agent, VmInterface *vmi) const;
301  bool AddL2(const Agent *agent, VmInterface *vmi) const;
302  VmInterfaceState::Op GetOpL3(const Agent *agent,
303  const VmInterface *vmi) const;
304  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
305  bool AddL3(const Agent *agent, VmInterface *vmi) const;
306  void Copy(const Agent *agent, const VmInterface *vmi) const;
307 
308  mutable const VrfEntry *vrf_;
310  mutable uint8_t plen_;
311 };
312 
314  VmiRouteState();
315  virtual ~VmiRouteState();
316 
317  VmInterfaceState::Op GetOpL2(const Agent *agent,
318  const VmInterface *vmi) const;
319  bool DeleteL2(const Agent *agent, VmInterface *vmi) const;
320  bool AddL2(const Agent *agent, VmInterface *vmi) const;
321  VmInterfaceState::Op GetOpL3(const Agent *agent,
322  const VmInterface *vmi) const;
323  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
324  bool AddL3(const Agent *agent, VmInterface *vmi) const;
325  void Copy(const Agent *agent, const VmInterface *vmi) const;
326 
327  mutable const VrfEntry *vrf_;
328  mutable Ip4Address ip_;
329  mutable uint32_t ethernet_tag_;
330  mutable bool do_dhcp_relay_;
331 };
332 
334 // Definition for VmInterface
335 // Agent supports multiple type of VMInterfaces
336 // - VMI for a virtual-machine spawned on KVM compute node. It will have a TAP
337 // interface associated with it. Agent also expects a INSTANCE_MSG from
338 // nova-compute/equivalent to add this port
339 // DeviceType = VM_ON_TAP, VmiType = INSTANCE
340 // - VMI for a virtual-machine spawned on VMware ESXi. All virtual-machines
341 // are connected on a physical-port and VLAN is used to distinguish them
342 // DeviceType = VM_PHYSICAL_VLAN, VmiType = INTANCE, agent->hypervisor_mode = ESXi
343 // - VMI for a virtual-machine spawned on VMWare VCenter . All virtual-machines
344 // are connected on a physical-port and they are classified by the smac
345 // DeviceType = VM_PHYSICAL_MAC, VmiType = INTANCE and
346 // agent hypervisor mode = VCenter
347 // - VMI for service-chain virtual-machines
348 // - VMI for service-chain virtual-machine spawned on KVM compute node.
349 // It will have a TAP interface associated with it. Agent also expects a
350 // INSTANCE_MSG from interface associated with it.
351 // DeviceType = VM_ON_TAP, VmiType = SERVICE_CHAIN
352 // - VMI for service-instances spawned by agent itself.
353 // It will have a TAP interface associated with it. Agent also expects a
354 // INSTANCE_MSG from interface associated with it.
355 // DeviceType = VM, VmiType = SERVICE_INTANCE
356 //
358 class VmInterface : public Interface {
359 public:
360  static const uint32_t kInvalidVlanId = 0xFFFF;
361  static const uint32_t kInvalidPmdId = 0xFFFF;
362  static const uint32_t kInvalidIsid = 0xFFFFFF;
363  static const uint8_t vHostUserClient = 0;
364  static const uint8_t vHostUserServer = 1;
365  static const uint32_t kMaxMacIpLimit = 50;
366 
367  // Interface route type
368  static const char *kInterface;
369  static const char *kServiceInterface;
370  static const char *kInterfaceStatic;
371 
372  enum Configurer {
375  };
376 
377  // Type of VMI Port
378  enum DeviceType {
380  VM_ON_TAP, // VMI on TAP/physial port interface
381  // VMI is created based on the INSTANCE_MSG
382  VM_VLAN_ON_VMI, // VMI on TAP port with VLAN as classifier
383  // VMI is created based on config message
384  VM_PHYSICAL_VLAN, // VMI classified with VLAN on a physical-port
385  // (used in VMWare ESXi)
386  // VMI is created based on the INSTANCE_MSG
387  VM_PHYSICAL_MAC, // VMI classified with MAC on a physical-port
388  // (used in VMWare VCenter)
389  // VMI is created based on the INSTANCE_MSG
390  TOR, // Baremetal connected to ToR
391  LOCAL_DEVICE, // VMI on a local port. Used in GATEWAY
392  REMOTE_VM_VLAN_ON_VMI, // VMI on a local phy-port with VLAN as classifier
393  VM_SRIOV, // VMI on an SRIOV VM
394  VMI_ON_LR // VMI configured on logical-router
395  };
396 
397  // Type of VM on the VMI
398  enum VmiType {
409  };
410 
411  // Interface uses different type of labels. Enumeration of different
412  // types is given below
413  enum LabelType {
420  };
421 
426  };
427 
428  /*
429  * NOTE: This value should be in sync with vrouter code.
430  * THe order of elements is important since it is used
431  * while searching the rules in the set in agent.
432  */
439  };
440 
441  /*
442  * NOTE: This value should be in sync with vrouter code.
443  * THe order of elements is important since it is used
444  * while searching the rules in the set in agent.
445  */
456  };
457 
458  enum HbsIntfType {
463  };
464 
465  typedef std::map<IpAddress, MetaDataIp*> MetaDataIpMap;
466  typedef std::set<HealthCheckInstanceBase *> HealthCheckInstanceSet;
467 
468  struct List {
469  };
470 
471  struct ListEntry {
472  ListEntry() : del_pending_(false) { }
473  ListEntry(bool del_pending) : del_pending_(del_pending) { }
474  virtual ~ListEntry() {}
475 
476  bool del_pending() const { return del_pending_; }
477  void set_del_pending(bool val) const { del_pending_ = val; }
478 
480  mutable bool del_pending_;
481  };
482 
483  struct FloatingIpList;
484  // A unified structure for storing FloatingIp information for both
485  // operational and config elements
487  enum Direction {
492  };
493 
494  struct PortMapKey {
495  uint8_t protocol_;
496  uint16_t port_;
497  PortMapKey(): protocol_(0), port_(0) { }
498  PortMapKey(uint8_t protocol, uint16_t port) :
499  protocol_(protocol), port_(port) { }
501 
502  bool operator()(const PortMapKey &lhs, const PortMapKey &rhs) const {
503  if (lhs.protocol_ != rhs.protocol_)
504  return lhs.protocol_ < rhs.protocol_;
505  return lhs.port_ < rhs.port_;
506  }
507  };
508 
509  typedef std::map<PortMapKey, uint16_t, PortMapKey> PortMap;
510  typedef PortMap::iterator PortMapIterator;
511  FloatingIp();
512  FloatingIp(const FloatingIp &rhs);
513  FloatingIp(const IpAddress &addr, const std::string &vrf,
514  const boost::uuids::uuid &vn_uuid, const IpAddress &ip,
515  Direction direction, bool port_mappng_enabled,
516  const PortMap &src_port_map, const PortMap &dst_port_map,
517  bool port_nat);
518  virtual ~FloatingIp();
519 
520  bool operator() (const FloatingIp &lhs, const FloatingIp &rhs) const;
521  bool IsLess(const FloatingIp *rhs) const;
522 
523  bool port_map_enabled() const;
524  Direction direction() const { return direction_; }
525 
526  const IpAddress GetFixedIp(const VmInterface *) const;
527  uint32_t PortMappingSize() const;
528  int32_t GetSrcPortMap(uint8_t protocol, uint16_t src_port) const;
529  int32_t GetDstPortMap(uint8_t protocol, uint16_t dst_port) const;
530  // direction_ is based on packet direction. Allow DNAT if direction is
531  // "both or ingress"
532  bool AllowDNat() const {
533  return (direction_ == DIRECTION_BOTH ||
535  }
536  // direction_ is based on packet direction. Allow SNAT if direction is
537  // "both or egress"
538  bool AllowSNat() const {
539  return (direction_ == DIRECTION_BOTH ||
541  }
542 
543  void Copy(const Agent *agent, const VmInterface *vmi) const;
545  const VmInterface *vmi) const;
546  bool AddL3(const Agent *agent, VmInterface *vmi) const;
547  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
549  const VmInterface *vmi) const;
550  bool AddL2(const Agent *agent, VmInterface *vmi) const;
551  bool DeleteL2(const Agent *agent, VmInterface *vmi) const;
552  bool port_nat() const;
553 
555  mutable VnEntryRef vn_;
556  mutable VrfEntryRef vrf_;
557  std::string vrf_name_;
561  mutable bool port_map_enabled_;
564  mutable uint32_t ethernet_tag_;
565  mutable bool port_nat_;
566  };
567  typedef std::set<FloatingIp, FloatingIp> FloatingIpSet;
568 
569  struct FloatingIpList : public List {
571  List(), v4_count_(0), v6_count_(0), list_() {
572  }
574 
575  void Insert(const FloatingIp *rhs);
576  void Update(const FloatingIp *lhs, const FloatingIp *rhs);
577  void Remove(FloatingIpSet::iterator &it);
578  bool UpdateList(const Agent *agent, VmInterface *vmi,
579  VmInterfaceState::Op l2_force_op,
580  VmInterfaceState::Op l3_force_op);
581 
582  uint16_t v4_count_;
583  uint16_t v6_count_;
585  };
586 
587  // A unified structure for storing AliasIp information for both
588  // operational and config elements
589  struct AliasIpList;
590  struct AliasIp : public ListEntry, VmInterfaceState {
591  AliasIp();
592  AliasIp(const AliasIp &rhs);
593  AliasIp(const IpAddress &addr, const std::string &vrf,
594  const boost::uuids::uuid &vn_uuid);
595  virtual ~AliasIp();
596 
597  bool operator() (const AliasIp &lhs, const AliasIp &rhs) const;
598  bool IsLess(const AliasIp *rhs) const;
599 
601  const VmInterface *vmi) const;
602  bool AddL3(const Agent *agent, VmInterface *vmi) const;
603  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
604  void Copy(const Agent *agent, const VmInterface *vmi) const;
605 
607  mutable VnEntryRef vn_;
608  mutable VrfEntryRef vrf_;
609  std::string vrf_name_;
611  };
612  typedef std::set<AliasIp, AliasIp> AliasIpSet;
613 
614  struct AliasIpList : public List {
617 
618  void Insert(const AliasIp *rhs);
619  void Update(const AliasIp *lhs, const AliasIp *rhs);
620  void Remove(AliasIpSet::iterator &it);
621  bool UpdateList(const Agent *agent, VmInterface *vmi,
622  VmInterfaceState::Op l2_force_op,
623  VmInterfaceState::Op l3_force_op);
624 
625  uint16_t v4_count_;
626  uint16_t v6_count_;
628  };
629 
631  ServiceVlan();
632  ServiceVlan(const ServiceVlan &rhs);
633  ServiceVlan(uint16_t tag, const std::string &vrf_name,
634  const Ip4Address &addr, const Ip6Address &addr6,
635  const MacAddress &smac, const MacAddress &dmac);
636  virtual ~ServiceVlan();
637 
638  bool operator() (const ServiceVlan &lhs, const ServiceVlan &rhs) const;
639  bool IsLess(const ServiceVlan *rhs) const;
640  void Update(const Agent *agent, VmInterface *vmi) const;
641  void DeleteCommon(const VmInterface *vmi) const;
642  void AddCommon(const Agent *agent, const VmInterface *vmi) const;
643 
644  void Copy(const Agent *agent, const VmInterface *vmi) const;
645  VmInterfaceState::Op GetOpL3(const Agent *agent,
646  const VmInterface *vmi) const;
647  bool AddL3(const Agent *agent, VmInterface *vmi) const;
648  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
649 
650  uint16_t tag_;
651  mutable std::string vrf_name_;
652  mutable Ip4Address addr_;
656  mutable MacAddress smac_;
657  mutable MacAddress dmac_;
658  mutable VrfEntryRef vrf_;
659  mutable uint32_t label_;
660  mutable bool v4_rt_installed_;
661  mutable bool v6_rt_installed_;
662  mutable bool del_add_;
663  };
664  typedef std::set<ServiceVlan, ServiceVlan> ServiceVlanSet;
665 
669  void Insert(const ServiceVlan *rhs);
670  void Update(const ServiceVlan *lhs, const ServiceVlan *rhs);
671  void Remove(ServiceVlanSet::iterator &it);
672  bool UpdateList(const Agent *agent, VmInterface *vmi,
673  VmInterfaceState::Op l2_force_op,
674  VmInterfaceState::Op l3_force_op);
675 
677  };
678 
680  StaticRoute();
681  StaticRoute(const StaticRoute &rhs);
682  StaticRoute(const IpAddress &addr, uint32_t plen, const AddressList &gw_list,
683  const CommunityList &communities);
684  virtual ~StaticRoute();
685 
686  bool operator() (const StaticRoute &lhs, const StaticRoute &rhs) const;
687  bool IsLess(const StaticRoute *rhs) const;
688 
689  void Copy(const Agent *agent, const VmInterface *vmi) const;
690  VmInterfaceState::Op GetOpL3(const Agent *agent,
691  const VmInterface *vmi) const;
692  bool AddL3(const Agent *agent, VmInterface *vmi) const;
693  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
694 
695  mutable const VrfEntry *vrf_;
697  uint32_t plen_;
700  };
701  typedef std::set<StaticRoute, StaticRoute> StaticRouteSet;
702 
706  void Insert(const StaticRoute *rhs);
707  void Update(const StaticRoute *lhs, const StaticRoute *rhs);
708  void Remove(StaticRouteSet::iterator &it);
709 
710  bool UpdateList(const Agent *agent, VmInterface *vmi,
711  VmInterfaceState::Op l2_force_op,
712  VmInterfaceState::Op l3_force_op);
714  };
715 
719  AllowedAddressPair(const IpAddress &addr, uint32_t plen, bool ecmp,
720  const MacAddress &mac);
721  virtual ~AllowedAddressPair();
722 
723  bool operator() (const AllowedAddressPair &lhs,
724  const AllowedAddressPair &rhs) const;
725  bool operator == (const AllowedAddressPair &rhs) const {
726  return ((mac_ == rhs.mac_) && (addr_ == rhs.addr_) &&
727  (plen_ == rhs.plen_));
728  }
729  bool IsLess(const AllowedAddressPair *rhs) const;
730 
731  void Copy(const Agent *agent, const VmInterface *vmi) const;
733  const VmInterface *vmi) const;
734  bool AddL3(const Agent *agent, VmInterface *vmi) const;
735  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
737  const VmInterface *vmi) const;
738  bool AddL2(const Agent *agent, VmInterface *vmi) const;
739  bool DeleteL2(const Agent *agent, VmInterface *vmi) const;
740 
742  uint32_t plen_;
743  mutable bool ecmp_;
745  mutable bool ecmp_config_changed_;
747  mutable uint32_t label_;
750  mutable VrfEntry *vrf_;
751  mutable uint32_t ethernet_tag_;
752  };
753  typedef std::set<AllowedAddressPair, AllowedAddressPair>
755 
756  struct AllowedAddressPairList : public List {
759  void Insert(const AllowedAddressPair *rhs);
760  void Update(const AllowedAddressPair *lhs,
761  const AllowedAddressPair *rhs);
762  void Remove(AllowedAddressPairSet::iterator &it);
763 
764  bool UpdateList(const Agent *agent, VmInterface *vmi,
765  VmInterfaceState::Op l2_force_op,
766  VmInterfaceState::Op l3_force_op);
767 
769  };
770 
775  virtual ~SecurityGroupEntry();
776 
777  bool operator == (const SecurityGroupEntry &rhs) const;
778  bool operator() (const SecurityGroupEntry &lhs,
779  const SecurityGroupEntry &rhs) const;
780  bool IsLess(const SecurityGroupEntry *rhs) const;
781 
783  const VmInterface *vmi) const;
784  bool AddL3(const Agent *agent, VmInterface *vmi) const;
785  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
786 
787  mutable SgEntryRef sg_;
789  };
790  typedef std::set<SecurityGroupEntry, SecurityGroupEntry>
792  typedef std::vector<boost::uuids::uuid> SecurityGroupUuidList;
793 
797 
798  void Insert(const SecurityGroupEntry *rhs);
799  void Update(const SecurityGroupEntry *lhs,
800  const SecurityGroupEntry *rhs);
801  void Remove(SecurityGroupEntrySet::iterator &it);
802  bool UpdateList(const Agent *agent, VmInterface *vmi,
803  VmInterfaceState::Op l2_force_op,
804  VmInterfaceState::Op l3_force_op);
805 
807  };
808 
810  TagEntry();
811  TagEntry(const TagEntry &rhs);
812  TagEntry(uint32_t tag_type, const boost::uuids::uuid &uuid);
813  virtual ~TagEntry();
814 
815  bool operator == (const TagEntry &rhs) const;
816  bool operator() (const TagEntry &lhs, const TagEntry &rhs) const;
817  bool IsLess(const TagEntry *rhs) const;
818 
820  const VmInterface *vmi) const;
821  bool AddL3(const Agent *agent, VmInterface *vmi) const;
822  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
823 
824  mutable TagEntryRef tag_;
825  uint32_t type_;
827  };
828  typedef std::set<TagEntry, TagEntry> TagEntrySet;
829  typedef std::vector<boost::uuids::uuid> TagGroupUuidList;
830 
831  struct TagEntryList {
832  TagEntryList() : list_() { }
834 
835  void Insert(const TagEntry *rhs);
836  void Update(const TagEntry *lhs,
837  const TagEntry *rhs);
838  void Remove(TagEntrySet::iterator &it);
839  bool UpdateList(const Agent *agent, VmInterface *vmi,
840  VmInterfaceState::Op l2_force_op,
841  VmInterfaceState::Op l3_force_op);
842 
844  };
845 
847  VrfAssignRule();
848  VrfAssignRule(const VrfAssignRule &rhs);
849  VrfAssignRule(uint32_t id,
850  const autogen::MatchConditionType &match_condition_,
851  const std::string &vrf_name, bool ignore_acl);
852  ~VrfAssignRule();
853  bool operator == (const VrfAssignRule &rhs) const;
854  bool operator() (const VrfAssignRule &lhs,
855  const VrfAssignRule &rhs) const;
856  bool IsLess(const VrfAssignRule *rhs) const;
857  void Update(const Agent *agent, VmInterface *vmi);
858 
859  const uint32_t id_;
860  mutable std::string vrf_name_;
861  mutable bool ignore_acl_;
862  mutable autogen::MatchConditionType match_condition_;
863  };
864  typedef std::set<VrfAssignRule, VrfAssignRule> VrfAssignRuleSet;
865 
866  struct VrfAssignRuleList : public List {
868  List(), list_(), vrf_assign_acl_(NULL) {
869  }
871  void Insert(const VrfAssignRule *rhs);
872  void Update(const VrfAssignRule *lhs, const VrfAssignRule *rhs);
873  void Remove(VrfAssignRuleSet::iterator &it);
874  bool UpdateList(const Agent *agent, VmInterface *vmi,
875  VmInterfaceState::Op l2_force_op,
876  VmInterfaceState::Op l3_force_op);
877 
880  };
881 
882  struct InstanceIpList;
884  InstanceIp();
885  InstanceIp(const InstanceIp &rhs);
886  InstanceIp(const IpAddress &ip, uint8_t plen, bool ecmp,
887  bool is_primary, bool is_service_ip,
888  bool is_service_health_check_ip,
889  bool is_local, const IpAddress &tracking_ip);
890  ~InstanceIp();
891  bool operator == (const InstanceIp &rhs) const;
892  bool operator() (const InstanceIp &lhs,
893  const InstanceIp &rhs) const;
894  InstanceIp operator = (const InstanceIp &rhs) const {
895  InstanceIp ret(rhs);
896  return ret;
897  }
898  bool IsLess(const InstanceIp *rhs) const;
899 
900  void Update(const Agent *agent, VmInterface *vmi,
901  const VmInterface::InstanceIpList *list) const;
902  void SetPrefixForAllocUnitIpam(VmInterface *intrface) const;
903 
905  const VmInterface *vmi) const;
906  bool AddL3(const Agent *agent, VmInterface *vmi) const;
907  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
909  const VmInterface *vmi) const;
910  bool AddL2(const Agent *agent, VmInterface *vmi) const;
911  bool DeleteL2(const Agent *agent, VmInterface *vmi) const;
912  void Copy(const Agent *agent, const VmInterface *vmi) const;
913 
914  bool is_force_policy() const {
916  }
917 
918  bool IsL3Only() const {
920  }
921 
922  const IpAddress ip_;
923  mutable uint8_t plen_;
924  mutable bool ecmp_;
925  mutable bool is_primary_;
926  mutable bool is_service_ip_; // used for service chain nexthop
928  mutable bool is_local_;
930  mutable const VrfEntry *vrf_;
931  mutable uint32_t ethernet_tag_;
932  };
933  typedef std::set<InstanceIp, InstanceIp> InstanceIpSet;
934 
935  struct InstanceIpList : public List {
936  InstanceIpList(bool is_ipv4) :
937  List(), is_ipv4_(is_ipv4), list_() {
938  }
940  void Insert(const InstanceIp *rhs);
941  void Update(const InstanceIp *lhs, const InstanceIp *rhs);
942  void Remove(InstanceIpSet::iterator &it);
943 
944  virtual bool UpdateList(const Agent *agent, VmInterface *vmi,
945  VmInterfaceState::Op l2_force_op,
946  VmInterfaceState::Op l3_force_op);
947 
948  bool is_ipv4_;
950  };
951  struct LearntMacIpList;
953  LearntMacIp();
954  LearntMacIp(const LearntMacIp &rhs);
955  LearntMacIp(const IpAddress &ip, const MacAddress &mac);
956  ~LearntMacIp();
957  bool operator == (const LearntMacIp &rhs) const;
958  bool operator() (const LearntMacIp &lhs,
959  const LearntMacIp &rhs) const;
960  LearntMacIp operator = (const LearntMacIp &rhs) const {
961  LearntMacIp ret(rhs);
962  return ret;
963  }
964  bool IsLess(const LearntMacIp *rhs) const;
965 
966  void Update(const Agent *agent, VmInterface *vmi,
967  const VmInterface::InstanceIpList *list) const;
969  const VmInterface *vmi) const;
970  bool AddL3(const Agent *agent, VmInterface *vmi) const;
971  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
973  const VmInterface *vmi) const;
974  bool AddL2(const Agent *agent, VmInterface *vmi) const;
975  bool DeleteL2(const Agent *agent, VmInterface *vmi) const;
976  void Copy(const Agent *agent, const VmInterface *vmi) const;
977 
978  const IpAddress ip_;
980  mutable const VrfEntry *vrf_;
981  mutable uint32_t ethernet_tag_;
984  mutable uint32_t l2_label_;
987  mutable uint32_t l3_label_;
988  };
989  typedef std::set<LearntMacIp, LearntMacIp> LearntMacIpSet;
990 
991  struct LearntMacIpList : public List {
993  List(), list_() {
994  }
996  void Insert(const LearntMacIp *rhs);
997  void Update(const LearntMacIp *lhs, const LearntMacIp *rhs);
998  void Remove(const LearntMacIp *rhs);
999 
1000  virtual bool UpdateList(const Agent *agent, VmInterface *vmi,
1001  VmInterfaceState::Op l2_force_op,
1002  VmInterfaceState::Op l3_force_op);
1003 
1005  };
1006 
1007  typedef std::map<std::string, FatFlowIgnoreAddressType> IgnoreAddressMap;
1008 
1010 
1011 #define FAT_FLOW_ENTRY_MIN_PREFIX_LEN 8
1012 
1017 
1019  protocol(rhs.protocol), port(rhs.port),
1023 
1024  FatFlowEntry(const uint8_t proto, const uint16_t p) :
1025  protocol(proto), port(p),
1030 
1031  FatFlowEntry(const uint8_t proto, const uint16_t p,
1032  FatFlowIgnoreAddressType ignore_addr,
1033  FatFlowPrefixAggregateType prefix_aggr) :
1034  protocol(proto), port(p),
1035  ignore_address(ignore_addr),
1036  prefix_aggregate(prefix_aggr),
1039 
1040  FatFlowEntry(const uint8_t proto, const uint16_t p,
1041  std::string ignore_addr, FatFlowPrefixAggregateType prefix_aggregate,
1044 
1045  static FatFlowEntry MakeFatFlowEntry(const std::string &protocol, const int &port,
1046  const std::string &ignore_addr_str,
1047  const std::string &src_prefix_str, const int &src_prefix_mask,
1048  const int &src_aggregate_plen,
1049  const std::string &dst_prefix_str, const int &dst_prefix_mask,
1050  const int &dst_aggregate_plen);
1051 
1052  virtual ~FatFlowEntry(){}
1053  bool operator == (const FatFlowEntry &rhs) const {
1054  return (rhs.protocol == protocol && rhs.port == port &&
1060  }
1061 
1062  bool operator() (const FatFlowEntry &lhs,
1063  const FatFlowEntry &rhs) const {
1064  return lhs.IsLess(&rhs);
1065  }
1066 
1067  bool IsLess(const FatFlowEntry *rhs) const {
1068  if (protocol != rhs->protocol) {
1069  return protocol < rhs->protocol;
1070  }
1071  if (port != rhs->port) {
1072  return port < rhs->port;
1073  }
1074  if (ignore_address != rhs->ignore_address) {
1075  return ignore_address < rhs->ignore_address;
1076  }
1077  if (prefix_aggregate != rhs->prefix_aggregate) {
1078  return prefix_aggregate < rhs->prefix_aggregate;
1079  }
1080  if (src_prefix != rhs->src_prefix) {
1081  return src_prefix < rhs->src_prefix;
1082  }
1083  if (src_prefix_mask != rhs->src_prefix_mask) {
1084  return src_prefix_mask < rhs->src_prefix_mask;
1085  }
1086  if (src_aggregate_plen != rhs->src_aggregate_plen) {
1087  return src_aggregate_plen < rhs->src_aggregate_plen;
1088  }
1089  if (dst_prefix != rhs->dst_prefix) {
1090  return dst_prefix < rhs->dst_prefix;
1091  }
1092  if (dst_prefix_mask != rhs->dst_prefix_mask) {
1093  return dst_prefix_mask < rhs->dst_prefix_mask;
1094  }
1095  return dst_aggregate_plen < rhs->dst_aggregate_plen;
1096  }
1097  void print(void) const;
1098 
1099  uint8_t protocol;
1100  uint16_t port;
1104  mutable uint8_t src_prefix_mask;
1105  mutable uint8_t src_aggregate_plen;
1107  mutable uint8_t dst_prefix_mask;
1108  mutable uint8_t dst_aggregate_plen;
1109  };
1110  /* All the fields in FatFlowEntry are considered as part of key */
1111  typedef std::set<FatFlowEntry, FatFlowEntry> FatFlowEntrySet;
1112 
1113  struct FatFlowList {
1116  void Insert(const FatFlowEntry *rhs);
1117  void Update(const FatFlowEntry *lhs, const FatFlowEntry *rhs);
1118  void Remove(FatFlowEntrySet::iterator &it);
1119  bool UpdateList(const Agent *agent, VmInterface *vmi);
1120  void DumpList() const;
1121 
1123  };
1124 
1126  std::vector<uint64_t> fat_flow_v4_exclude_list_;
1127  std::vector<uint64_t> fat_flow_v6_exclude_upper_list_;
1128  std::vector<uint64_t> fat_flow_v6_exclude_lower_list_;
1129  std::vector<uint16_t> fat_flow_v6_exclude_plen_list_;
1130  void Clear() {
1131  fat_flow_v4_exclude_list_.clear();
1135  }
1136  };
1138  BridgeDomain(): uuid_(boost::uuids::nil_uuid()), vlan_tag_(0),
1139  bridge_domain_(NULL) {}
1141  uuid_(rhs.uuid_), vlan_tag_(rhs.vlan_tag_),
1143  BridgeDomain(const boost::uuids::uuid &uuid, uint32_t vlan_tag):
1144  uuid_(uuid), vlan_tag_(vlan_tag), bridge_domain_(NULL) {}
1145  virtual ~BridgeDomain(){}
1146  bool operator == (const BridgeDomain &rhs) const {
1147  return (uuid_ == rhs.uuid_);
1148  }
1149 
1150  bool operator() (const BridgeDomain &lhs,
1151  const BridgeDomain &rhs) const {
1152  return lhs.IsLess(&rhs);
1153  }
1154 
1155  bool IsLess(const BridgeDomain *rhs) const {
1156  return uuid_ < rhs->uuid_;
1157  }
1158 
1160  uint32_t vlan_tag_;
1162  };
1163  typedef std::set<BridgeDomain, BridgeDomain> BridgeDomainEntrySet;
1164 
1168  void Insert(const BridgeDomain *rhs);
1169  void Update(const BridgeDomain *lhs, const BridgeDomain *rhs);
1170  void Remove(BridgeDomainEntrySet::iterator &it);
1171 
1172  bool Update(const Agent *agent, VmInterface *vmi);
1174  };
1175 
1177  VmiReceiveRoute();
1178  VmiReceiveRoute(const VmiReceiveRoute &rhs);
1179  VmiReceiveRoute(const IpAddress &addr, uint32_t plen, bool add_l2);
1180  virtual ~VmiReceiveRoute() {}
1181 
1182  bool operator() (const VmiReceiveRoute &lhs,
1183  const VmiReceiveRoute &rhs) const;
1184  bool IsLess(const VmiReceiveRoute *rhs) const;
1185 
1187  const VmInterface *vmi) const;
1188  bool DeleteL2(const Agent *agent, VmInterface *vmi) const;
1189  bool AddL2(const Agent *agent, VmInterface *vmi) const;
1190 
1191  void Copy(const Agent *agent, const VmInterface *vmi) const;
1193  const VmInterface *vmi) const;
1194  bool AddL3(const Agent *agent, VmInterface *vmi) const;
1195  bool DeleteL3(const Agent *agent, VmInterface *vmi) const;
1196 
1198  uint32_t plen_;
1199  bool add_l2_; //Pick mac from interface and then add l2 route
1201  };
1202 
1203  typedef std::set<VmiReceiveRoute, VmiReceiveRoute> VmiReceiveRouteSet;
1204 
1208  void Insert(const VmiReceiveRoute *rhs);
1209  void Update(const VmiReceiveRoute *lhs, const VmiReceiveRoute *rhs);
1210  void Remove(VmiReceiveRouteSet::iterator &it);
1211 
1212  bool UpdateList(const Agent *agent, VmInterface *vmi,
1213  VmInterfaceState::Op l2_force_op,
1214  VmInterfaceState::Op l3_force_op);
1216  };
1217 
1218  enum Trace {
1231  };
1232 
1234  const std::string &name,
1235  bool os_oper_state,
1237  VmInterface(const boost::uuids::uuid &uuid, const std::string &name,
1238  const Ip4Address &addr, const MacAddress &mac,
1239  const std::string &vm_name,
1241  uint16_t rx_vlan_id, Interface *parent,
1242  const Ip6Address &addr6, DeviceType dev_type, VmiType vmi_type,
1243  uint8_t vhostuser_mode, bool os_oper_state,
1245  virtual ~VmInterface();
1246 
1247  virtual bool CmpInterface(const DBEntry &rhs) const;
1248  virtual void GetOsParams(Agent *agent);
1249  void SendTrace(const AgentDBTable *table, Trace event) const;
1250  bool Delete(const DBRequest *req);
1251  void Add();
1252 
1253  // DBEntry virtual methods
1254  KeyPtr GetDBRequestKey() const;
1255  std::string ToString() const;
1256  bool Resync(const InterfaceTable *table, const VmInterfaceData *data);
1257  bool OnChange(VmInterfaceData *data);
1258  void PostAdd();
1259 
1260  // get/set accessor functions
1261  const VmEntry *vm() const { return vm_.get(); }
1262  const VnEntry *vn() const { return vn_.get(); }
1263  VnEntry *GetNonConstVn() const { return vn_.get(); }
1264  const Ip4Address &primary_ip_addr() const { return primary_ip_addr_; }
1265  void set_primary_ip_addr(const Ip4Address &addr) { primary_ip_addr_ = addr; }
1266 
1267  bool policy_enabled() const { return policy_enabled_; }
1270  const Ip6Address &primary_ip6_addr() const { return primary_ip6_addr_; }
1271  const MacAddress &vm_mac() const { return vm_mac_; }
1272  void set_vm_mac(const MacAddress &mac) { vm_mac_ = mac; }
1273  bool fabric_port() const { return fabric_port_; }
1274  bool need_linklocal_ip() const { return need_linklocal_ip_; }
1275  bool drop_new_flows() const { return drop_new_flows_; }
1281  bool admin_state() const { return admin_state_; }
1282  const AclDBEntry* vrf_assign_acl() const {
1284  }
1285  const Peer *peer() const;
1286  uint32_t ethernet_tag() const {return ethernet_tag_;}
1287  Ip4Address dhcp_addr() const { return dhcp_addr_; }
1290  bool is_vn_qos_config() const { return is_vn_qos_config_; }
1291 
1292  bool learning_enabled() const { return learning_enabled_; }
1293  void set_learning_enabled(bool val) { learning_enabled_ = val; }
1294 
1295  bool etree_leaf() const { return etree_leaf_; }
1296  void set_etree_leaf(bool val) { etree_leaf_ = val; }
1297 
1299  bool pbb_interface() const { return pbb_interface_; }
1300  void set_pbb_interface(bool val) { pbb_interface_= val;}
1301 
1304 
1305  const NextHop* l3_interface_nh_no_policy() const;
1306  const NextHop* l2_interface_nh_no_policy() const;
1307  const NextHop* l2_interface_nh_policy() const;
1308 
1309  const std::string &cfg_name() const { return cfg_name_; }
1310  uint16_t tx_vlan_id() const { return tx_vlan_id_; }
1311  uint16_t rx_vlan_id() const { return rx_vlan_id_; }
1312  uint8_t vhostuser_mode() const { return vhostuser_mode_; }
1313  const Interface *parent() const {
1314  if (agent()->is_l3mh() == false &&
1315  vmi_type_ == VHOST &&
1316  parent_list_.empty() == false) {
1317  return parent_list_[0];
1318  }
1319  return parent_.get();
1320  }
1321  bool ecmp() const { return ecmp_;}
1322  bool ecmp6() const { return ecmp6_;}
1324  bool service_ip_ecmp() const { return service_ip_ecmp_;}
1326  bool service_ip_ecmp6() const { return service_ip_ecmp6_;}
1328  bool bridging() const { return bridging_; }
1329  bool layer3_forwarding() const { return layer3_forwarding_; }
1330  void set_layer3_forwarding(bool val) { layer3_forwarding_ = val; }
1331  const std::string &vm_name() const { return vm_name_; }
1332  const std::string &vrf_name() const { return vrf_name_; }
1334 
1335  uint32_t local_preference() const { return local_preference_; }
1336  void SetPathPreference(PathPreference *pref, bool ecmp,
1337  const IpAddress &dependent_ip) const;
1338 
1340  return oper_dhcp_options_;
1341  }
1342  bool dhcp_enable_config() const { return dhcp_enable_; }
1343  void set_dhcp_enable_config(bool dhcp_enable) {dhcp_enable_= dhcp_enable;}
1344  bool dhcp_enable_v6_config() const { return dhcp_enable_v6_; }
1345  void set_dhcp_enable_v6_config(bool dhcp_enable_v6) {dhcp_enable_v6_= dhcp_enable_v6;}
1346  bool do_dhcp_relay() const { return do_dhcp_relay_; }
1347 
1348  bool cfg_igmp_enable() const { return cfg_igmp_enable_; }
1349  bool igmp_enabled() const { return igmp_enabled_; }
1351  uint32_t max_flows() const { return max_flows_; }
1352  void set_max_flows( uint32_t val) { max_flows_ = val;}
1354  bool IsUnrestrictedProxyArp() const {
1356  }
1357 
1358  int vxlan_id() const { return vxlan_id_; }
1360  bool IsVxlanMode() const;
1361 
1362  uint8_t configurer() const {return configurer_;}
1366  bool CanBeDeleted() const {return (configurer_ == 0);}
1367 
1368  const Ip4Address& subnet() const { return subnet_;}
1369  const uint8_t subnet_plen() const { return subnet_plen_;}
1370  const MacAddress& GetVifMac(const Agent*) const;
1372  return logical_interface_;
1373  }
1374 
1375  const MirrorEntry *mirror_entry() const { return mirror_entry_.get(); }
1376  void set_mirror_entry (MirrorEntry *entry) { mirror_entry_ = entry; }
1377  bool IsMirrorEnabled() const { return mirror_entry_.get() != NULL; }
1379  return mirror_direction_;
1380  }
1383  }
1384 
1385  uint32_t FloatingIpCount() const {return floating_ip_list_.list_.size();}
1387  bool HasFloatingIp(Address::Family family) const;
1388  bool HasFloatingIp() const;
1389  bool IsFloatingIp(const IpAddress &ip) const;
1390  size_t GetFloatingIpCount() const {return floating_ip_list_.list_.size();}
1391 
1392  const AliasIpList &alias_ip_list() const {
1393  return alias_ip_list_;
1394  }
1395  VrfEntry *GetAliasIpVrf(const IpAddress &ip) const;
1396  size_t GetAliasIpCount() const { return alias_ip_list_.list_.size(); }
1397  void CleanupAliasIpList();
1398 
1400  return static_route_list_;
1401  }
1403  return sg_list_;
1404  }
1405  void CopySgIdList(SecurityGroupList *sg_id_list) const;
1406  void CopyTagIdList(TagList *tag_id_list) const;
1407 
1408  const TagEntryList &tag_list() const {
1409  return tag_list_;
1410  }
1411 
1413  return vrf_assign_rule_list_;
1414  }
1415 
1418  }
1419 
1421  return instance_ipv4_list_;
1422  }
1423 
1425  return instance_ipv6_list_;
1426  }
1427 
1428  const FatFlowList &fat_flow_list() const {
1429  return fat_flow_list_;
1430  }
1432  return learnt_mac_ip_list_;
1433  }
1434  bool IsFatFlowPortBased(uint8_t protocol, uint16_t port,
1435  FatFlowIgnoreAddressType *ignore_addr) const;
1436  bool ExcludeFromFatFlow(Address::Family family, const IpAddress &sip,
1437  const IpAddress &dip) const;
1438  bool MatchSrcPrefixPort(uint8_t protocol, uint16_t port, IpAddress *src_ip,
1439  FatFlowIgnoreAddressType *ignore_addr) const;
1440  bool MatchSrcPrefixRule(uint8_t protocol, uint16_t *sport,
1441  uint16_t *dport, bool *same_port_num,
1442  IpAddress *SrcIP,
1443  FatFlowIgnoreAddressType *ignore_addr) const;
1444  bool MatchDstPrefixPort(uint8_t protocol, uint16_t port, IpAddress *dst_ip,
1445  FatFlowIgnoreAddressType *ignore_addr) const;
1446  bool MatchDstPrefixRule(uint8_t protocol, uint16_t *sport,
1447  uint16_t *dport, bool *same_port_num,
1448  IpAddress *DstIP,
1449  FatFlowIgnoreAddressType *ignore_addr) const;
1450  bool MatchSrcDstPrefixPort(uint8_t protocol, uint16_t port, IpAddress *src_ip,
1451  IpAddress *dst_ip) const;
1452  bool MatchSrcDstPrefixRule(uint8_t protocol, uint16_t *sport,
1453  uint16_t *dport, bool *same_port_num,
1454  IpAddress *SrcIP, IpAddress *DstIP) const;
1455  bool IsFatFlowPrefixAggregation(bool ingress, uint8_t protocol, uint16_t *sport,
1456  uint16_t *dport, bool *same_port_num,
1457  IpAddress *SrcIP, IpAddress *DstIP,
1458  bool *is_src_prefix, bool *is_dst_prefix,
1459  FatFlowIgnoreAddressType *ignore_addr) const;
1460 
1462  return bridge_domain_list_;
1463  }
1464 
1466  return receive_route_list_;
1467  }
1468 
1469  void set_subnet_bcast_addr(const Ip4Address &addr) {
1470  subnet_bcast_addr_ = addr;
1471  }
1472 
1474  return forwarding_vrf_.get();
1475  }
1476 
1477  Ip4Address mdata_ip_addr() const;
1478  Ip6Address mdata_ip6_addr() const;
1479  MetaDataIp *GetMetaDataIp(const IpAddress &ip) const;
1480  void InsertMetaDataIpInfo(MetaDataIp *mip);
1481  void DeleteMetaDataIpInfo(MetaDataIp *mip);
1482  void UpdateMetaDataIpInfo();
1483 
1486  const HealthCheckInstanceSet &hc_instance_set() const;
1487  bool IsHealthCheckEnabled() const;
1489 
1491  return service_vlan_list_;
1492  }
1493  bool HasServiceVlan() const { return service_vlan_list_.list_.size() != 0; }
1494 
1495  Agent *agent() const {
1496  return (static_cast<InterfaceTable *>(get_table()))->agent();
1497  }
1498  uint32_t GetServiceVlanLabel(const VrfEntry *vrf) const;
1499  const VrfEntry* GetServiceVlanVrf(uint16_t vlan_tag) const;
1502  const IpAddress &service_ip) const;
1503 
1504  const UuidList &slo_list() const {
1505  return slo_list_;
1506  }
1507 
1508  const std::string GetAnalyzer() const;
1509  bool IsL2Active() const;
1510  bool IsIpv6Active() const;
1511 
1512  bool WaitForTraffic() const;
1514  std::vector<autogen::DhcpOptionType> *options) const;
1515  bool GetSubnetDhcpOptions(
1516  std::vector<autogen::DhcpOptionType> *options, bool ipv6) const;
1517  bool GetIpamDhcpOptions(
1518  std::vector<autogen::DhcpOptionType> *options, bool ipv6) const;
1519  IpAddress GetServiceIp(const IpAddress &ip) const;
1520  IpAddress GetGatewayIp(const IpAddress &ip) const;
1521 
1522  bool NeedDevice() const;
1523  bool NeedOsStateWithoutDevice() const;
1524  bool IsActive() const;
1525  bool InstallBridgeRoutes() const;
1526  bool IsBareMetal() const {return (vmi_type_ == BAREMETAL);}
1527 
1528  bool NeedMplsLabel() const;
1529  bool SgExists(const boost::uuids::uuid &id, const SgList &sg_l);
1530  const MacAddress& GetIpMac(const IpAddress &,
1531  const uint8_t plen) const;
1532  bool MatchAapIp(const IpAddress &ip, uint8_t plen) const;
1533  void BuildIpStringList(Address::Family family,
1534  std::vector<std::string> *vect) const;
1535 
1536  uint32_t GetIsid() const;
1537  uint32_t GetPbbVrf() const;
1538  uint32_t GetPbbLabel() const;
1539 
1540  // Label for opposite policy mode (old label before toggling policy mode)
1541  uint32_t label_op() const;
1542 
1543  void GetNextHopInfo();
1544  bool UpdatePolicySet(const Agent *agent);
1546  return fw_policy_list_;
1547  }
1549  return fwaas_fw_policy_list_;
1550  }
1552  return vmi_cfg_uuid_;
1553  }
1554 
1555  bool is_left_si() const { return is_left_si_; }
1561  };
1562  uint32_t service_mode() {
1563  return service_mode_;
1564  }
1566  return si_other_end_vmi_;
1567  }
1568  const std::string &service_intf_type() const { return service_intf_type_; }
1571  void BuildFatFlowExcludeList(FatFlowExcludeList *list) const;
1572  bool IsMaxMacIpLearnt() const;
1573 
1574  // Static methods
1575  // Add a vm-interface
1576  static void NovaAdd(InterfaceTable *table,
1577  const boost::uuids::uuid &intf_uuid,
1578  const std::string &os_name, const Ip4Address &addr,
1579  const std::string &mac, const std::string &vn_name,
1581  uint16_t tx_vlan_id, uint16_t rx_vlan_id,
1582  const std::string &parent, const Ip6Address &ipv6,
1583  uint8_t vhostuser_mode,
1584  Interface::Transport transport, uint8_t link_state);
1585  // Del a vm-interface
1586  static void Delete(InterfaceTable *table,
1587  const boost::uuids::uuid &intf_uuid,
1589  static void SetIfNameReq(InterfaceTable *table,
1590  const boost::uuids::uuid &uuid,
1591  const std::string &ifname);
1592  static void DeleteIfNameReq(InterfaceTable *table,
1593  const boost::uuids::uuid &uuid);
1594  void update_flow_count(int val) const;
1595  uint32_t flow_count() const { return flow_count_; }
1597 
1598 
1599 private:
1600  friend struct VmInterfaceConfigData;
1601  friend struct VmInterfaceNovaData;
1604  friend struct VmInterfaceMirrorData;
1608  friend struct ResolveRouteState;
1609  friend struct VmiRouteState;
1611 
1612  virtual void ObtainOsSpecificParams(const std::string &name, Agent *agent);
1613 
1614  bool IsMetaDataL2Active() const;
1615  bool IsMetaDataIPActive() const;
1616  bool IsIpv4Active() const;
1617  bool PolicyEnabled() const;
1618  void FillV4ExcludeIp(uint64_t plen, const Ip4Address &ip,
1619  FatFlowExcludeList *list) const;
1620  void FillV6ExcludeIp(uint16_t plen, const IpAddress &ip,
1621  FatFlowExcludeList *list) const;
1622 
1623  bool CopyConfig(const InterfaceTable *table,
1624  const VmInterfaceConfigData *data, bool *sg_changed,
1625  bool *ecmp_changed, bool *local_pref_changed,
1626  bool *ecmp_load_balance_changed,
1627  bool *static_route_config_changed,
1628  bool *etree_leaf_mode_changed,
1629  bool *tag_changed);
1630  void ApplyConfig(bool old_ipv4_active,bool old_l2_active,
1631  bool old_ipv6_active,
1632  const Ip4Address &old_subnet,
1633  const uint8_t old_subnet_plen);
1634 
1635  void UpdateL2();
1636  void DeleteL2();
1637 
1638  void AddRoute(const std::string &vrf_name, const IpAddress &ip,
1639  uint32_t plen, const std::string &vn_name, bool force_policy,
1640  bool ecmp, bool is_local, bool proxy_arp,
1641  const IpAddress &service_ip, const IpAddress &dependent_ip,
1642  const CommunityList &communties, uint32_t label,
1643  const string &intf_route_type, bool is_learnt_route = false);
1644  void DeleteRoute(const std::string &vrf_name, const IpAddress &ip,
1645  uint32_t plen);
1646 
1648  bool new_ipv4_active);
1649  bool ResyncIpAddress(const VmInterfaceIpAddressData *data);
1651  bool ResyncConfig(VmInterfaceConfigData *data);
1652  bool CopyIpAddress(Ip4Address &addr);
1653  bool CopyIp6Address(const Ip6Address &addr);
1654  bool ResetVrfDelete(const InterfaceTable *table, const std::string &vrf_name);
1655 
1656  void CleanupFloatingIpList();
1657 
1658  bool OnResyncStaticRoute(VmInterfaceConfigData *data, bool new_ipv4_active);
1659 
1660  void AddL2InterfaceRoute(const IpAddress &ip, const MacAddress &mac,
1661  const IpAddress &dependent_ip) const;
1662  void DeleteL2InterfaceRoute(const VrfEntry *vrf, uint32_t ethernet_tag,
1663  const IpAddress &ip,
1664  const MacAddress &mac) const;
1665 
1668 
1669  bool UpdateState(const VmInterfaceState *attr,
1670  VmInterfaceState::Op l2_force_op,
1671  VmInterfaceState::Op l3_force_op);
1672  bool DeleteState(VmInterfaceState *attr);
1674  IgnoreAddressMap value;
1675  value[""] = IGNORE_NONE;
1676  value["none"] = IGNORE_NONE;
1677  value["source"] = IGNORE_SOURCE;
1678  value["destination"] = IGNORE_DESTINATION;
1679  return value;
1680  }
1681 
1682  void SetInterfacesDropNewFlows(bool drop_new_flows) const;
1683  bool copyMacIpData(const VmInterfaceLearntMacIpData *data);
1684 
1685 private:
1696  std::string cfg_name_;
1700  mutable bool drop_new_flows_vmi_;
1701  // DHCP flag - set according to the dhcp option in the ifmap subnet object.
1702  // It controls whether the vrouter sends the DHCP requests from VM interface
1703  // to agent or if it would flood the request in the VN.
1706  // true if IP is to be obtained from DHCP Relay and not learnt from fabric
1708  // Proxy ARP mode for interface
1710  // VM-Name. Used by DNS
1711  std::string vm_name_;
1712  std::string vrf_name_;
1713  // project uuid of the vm to which the interface belongs
1719  bool mac_set_;
1720  bool ecmp_;
1721  bool ecmp6_;
1726  // disable-policy configuration on VMI. When this is configured, policy
1727  // dependent features like flows, floating-IP and SG will not work on this
1728  // VMI. However metadata-services will work because metadata route will
1729  // still point to policy enabled NH.
1731  // VLAN Tag and the parent interface when VLAN is enabled
1732  uint16_t tx_vlan_id_;
1733  uint16_t rx_vlan_id_;
1736  // DHCP options defined for the interface
1738  // IGMP Configuration
1742  // Max flows for VMI
1743  uint32_t max_flows_;
1744  mutable tbb::atomic<int> flow_count_;
1745 
1746  // Attributes
1747  std::unique_ptr<MacVmBindingState> mac_vm_binding_state_;
1748  std::unique_ptr<NextHopState> nexthop_state_;
1749  std::unique_ptr<VrfTableLabelState> vrf_table_label_state_;
1750  std::unique_ptr<MetaDataIpState> metadata_ip_state_;
1751  std::unique_ptr<MetaDataIpState> metadata_ip6_state_;
1752  std::unique_ptr<ResolveRouteState> resolve_route_state_;
1753  std::unique_ptr<VmiRouteState> interface_route_state_;
1754 
1755  // Lists
1770 
1771  // Peer for interface routes
1772  std::unique_ptr<LocalVmPortPeer> peer_;
1777  uint8_t configurer_;
1779  uint8_t subnet_plen_;
1781  // Logical interface uuid to which the interface belongs
1795  //Includes global policy apply and application policy set
1800  // vhostuser mode
1802  // indicates if the VMI is the left interface of a service instance
1804  uint32_t service_mode_;
1805  /* If current interface is SI VMI, then the below field indicates the VMI
1806  * uuid of the other end of SI. If current VMI is left VMI of SI si1, then
1807  * below field indicates right VMI of SI si1 and vice versa. This will have
1808  * nil_uuid if current VMI is not SI VMI.
1809  */
1811  //In case Vhost interface, uuid_ is stored here
1813  std::string service_intf_type_;
1816 };
1817 
1819 // Key for VM Interfaces
1821 struct VmInterfaceKey : public InterfaceKey {
1823  const boost::uuids::uuid &uuid, const std::string &name);
1824  virtual ~VmInterfaceKey() { }
1825 
1826  Interface *AllocEntry(const InterfaceTable *table) const;
1827  Interface *AllocEntry(const InterfaceTable *table,
1828  const InterfaceData *data) const;
1829  InterfaceKey *Clone() const;
1830 };
1831 
1833 // The base class for different type of InterfaceData used for VmInterfaces.
1834 //
1835 // Request for VM-Interface data are of 3 types
1836 // - ADD_DEL_CHANGE
1837 // Message for ADD/DEL/CHANGE of an interface
1838 // - MIRROR
1839 // Data for mirror enable/disable
1840 // - IP_ADDR
1841 // In one of the modes, the IP address for an interface is not got from IFMap
1842 // or Nova. Agent will relay DHCP Request in such cases to IP Fabric network.
1843 // The IP address learnt with DHCP in this case is confgured with this type
1844 // - OS_OPER_STATE
1845 // Update to oper state of the interface
1848  enum Type {
1857  };
1858 
1860  Interface::Transport transport) :
1861  InterfaceData(agent, node, transport), type_(type) {
1862  VmPortInit();
1863  }
1864  virtual ~VmInterfaceData() { }
1865 
1866  virtual VmInterface *OnAdd(const InterfaceTable *table,
1867  const VmInterfaceKey *key) const {
1868  return NULL;
1869  }
1870  virtual bool OnDelete(const InterfaceTable *table,
1871  VmInterface *entry) const {
1872  return true;
1873  }
1874  virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi,
1875  bool *force_update) const = 0;
1876 
1878 };
1879 
1880 // Structure used when type=IP_ADDR. Used to update IP-Address of VM-Interface
1881 // The IP Address is picked up from the DHCP Snoop table
1884  Interface::TRANSPORT_INVALID) { }
1886  virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi,
1887  bool *force_update) const;
1888 };
1889 
1890 // Structure used when type=OS_OPER_STATE Used to update interface os oper-state
1891 // The current oper-state is got by querying the device
1894  VmInterfaceData(NULL, NULL, OS_OPER_STATE,
1895  Interface::TRANSPORT_INVALID), oper_state_(status) { }
1897  virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi,
1898  bool *force_update) const;
1900 };
1901 
1902 // Structure used when type=MIRROR. Used to update IP-Address of VM-Interface
1904  VmInterfaceMirrorData(bool mirror_enable, const std::string &analyzer_name):
1905  VmInterfaceData(NULL, NULL, MIRROR, Interface::TRANSPORT_INVALID),
1906  mirror_enable_(mirror_enable),
1907  analyzer_name_(analyzer_name) {
1908  }
1910  virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi,
1911  bool *force_update) const;
1912 
1914  std::string analyzer_name_;
1915 };
1916 
1917 // Definition for structures when request queued from IFMap config.
1921  virtual VmInterface *OnAdd(const InterfaceTable *table,
1922  const VmInterfaceKey *key) const;
1923  virtual bool OnDelete(const InterfaceTable *table,
1924  VmInterface *entry) const;
1925  virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi,
1926  bool *force_update) const;
1927  autogen::VirtualMachineInterface *GetVmiCfg() const;
1928  void CopyVhostData(const Agent *agent);
1929 
1932  std::string vm_mac_;
1933  std::string cfg_name_;
1935  std::string vm_name_;
1937  std::string vrf_name_;
1938 
1939  // Is this port on IP Fabric
1941  // Does the port need link-local IP to be allocated
1946  //Is interface in active-active mode or active-backup mode
1947  bool ecmp_;
1948  bool ecmp6_;
1949  bool dhcp_enable_; // is DHCP enabled for the interface (from subnet config)
1954  std::string analyzer_name_;
1958  // IGMP Configuration
1962  uint32_t max_flows_;
1963 
1980  // Parent physical-interface. Used in VMWare/ ToR logical-interface
1981  std::string physical_interface_;
1982  // Parent VMI. Set only for VM_VLAN_ON_VMI
1985  uint8_t subnet_plen_;
1986  uint16_t rx_vlan_id_;
1987  uint16_t tx_vlan_id_;
2000  uint32_t service_mode_;
2003  std::string service_intf_type_;
2004  // Parent physical-interface-list. Used in case of l3mh Vhost0
2005  std::vector<std::string> physical_interface_list_;
2006 };
2007 
2008 // Definition for structures when request queued from Nova
2011  VmInterfaceNovaData(const Ip4Address &ipv4_addr,
2012  const Ip6Address &ipv6_addr,
2013  const std::string &mac_addr,
2014  const std::string vm_name,
2015  boost::uuids::uuid vm_uuid,
2016  boost::uuids::uuid vm_project_uuid,
2017  const std::string &parent,
2018  uint16_t tx_vlan_id,
2019  uint16_t rx_vlan_id,
2020  VmInterface::DeviceType device_type,
2021  VmInterface::VmiType vmi_type,
2022  uint8_t vhostuser_mode,
2023  Interface::Transport transport,
2024  uint8_t link_state);
2025  virtual ~VmInterfaceNovaData();
2026  virtual VmInterface *OnAdd(const InterfaceTable *table,
2027  const VmInterfaceKey *key) const;
2028  virtual bool OnDelete(const InterfaceTable *table,
2029  VmInterface *entry) const;
2030  virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi,
2031  bool *force_update) const;
2032 
2035  std::string mac_addr_;
2036  std::string vm_name_;
2039  std::string physical_interface_;
2040  uint16_t tx_vlan_id_;
2041  uint16_t rx_vlan_id_;
2045  uint8_t link_state_;
2046 };
2047 
2050  bool layer3_forwarding,
2051  int vxlan_id) :
2052  VmInterfaceData(NULL, NULL, GLOBAL_VROUTER, Interface::TRANSPORT_INVALID),
2053  bridging_(bridging),
2054  layer3_forwarding_(layer3_forwarding),
2055  vxlan_id_(vxlan_id) {
2056  }
2058  virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi,
2059  bool *force_update) const;
2060 
2064 };
2065 
2068  virtual ~VmInterfaceHealthCheckData();
2069  virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi,
2070  bool *force_update) const;
2071 };
2072 
2074  VmInterfaceNewFlowDropData(bool drop_new_flows);
2075  virtual ~VmInterfaceNewFlowDropData();
2076  virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi,
2077  bool *force_update) const;
2078 
2080 };
2081 
2082 // Data used when interface added with only ifname in data
2085  VmInterfaceIfNameData(const std::string &ifname);
2086  virtual ~VmInterfaceIfNameData();
2087 
2088  virtual VmInterface *OnAdd(const InterfaceTable *table,
2089  const VmInterfaceKey *key) const;
2090  virtual bool OnDelete(const InterfaceTable *table, VmInterface *vmi) const;
2091  virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi,
2092  bool *force_update) const;
2093 
2094  std::string ifname_;
2095 };
2098  virtual ~VmInterfaceLearntMacIpData();
2099  virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi,
2100  bool *force_update) const;
2101  bool is_add;
2103 
2104 };
2105 #endif // vnsw_agent_vm_interface_hpp
std::set< AliasIp, AliasIp > AliasIpSet
Definition: vm_interface.h:612
virtual VmInterface * OnAdd(const InterfaceTable *table, const VmInterfaceKey *key) const
boost::intrusive_ptr< SgEntry > SgEntryRef
Definition: agent.h:74
bool IsHealthCheckEnabled() const
bool GetIpamDhcpOptions(std::vector< autogen::DhcpOptionType > *options, bool ipv6) const
VrfEntry * GetAliasIpVrf(const IpAddress &ip) const
void BuildFatFlowExcludeList(FatFlowExcludeList *list) const
virtual bool UpdateList(const Agent *agent, VmInterface *vmi, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
void Insert(const ServiceVlan *rhs)
void DeleteL2()
VmInterfaceState::Op GetOpL2(const Agent *agent, const VmInterface *vmi) const
VmInterface::FloatingIpList floating_ip_list_
std::string analyzer_name_
bool drop_new_flows_
bool IsLess(const InstanceIp *rhs) const
virtual bool OnDelete(const InterfaceTable *table, VmInterface *vmi) const
void set_etree_leaf(bool val)
PortMapKey(uint8_t protocol, uint16_t port)
Definition: vm_interface.h:498
bool DeleteL2(const Agent *agent, VmInterface *vmi) const
VmInterface::StaticRouteList static_route_list_
bool DeleteL2(const Agent *agent, VmInterface *vmi) const
void Update(const SecurityGroupEntry *lhs, const SecurityGroupEntry *rhs)
BridgeDomainEntrySet list_
bool pbb_interface() const
std::unique_ptr< LocalVmPortPeer > peer_
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
std::vector< Interface * > InterfaceList
Definition: agent.h:218
void set_pbb_interface(bool val)
int vxlan_id() const
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
void SetPathPreference(PathPreference *pref, bool ecmp, const IpAddress &dependent_ip) const
bool ecmp6() const
void set_vm_mac(const MacAddress &mac)
const VrfEntry * vrf_
Definition: vm_interface.h:980
bool IsMirrorEnabled() const
boost::uuids::uuid parent_vmi_
const MacAddress & vm_mac() const
static const uint32_t kInvalidIsid
Definition: vm_interface.h:362
void CleanupFloatingIpList()
bool AddL3(const Agent *agent, VmInterface *vmi) const
Type type() const
Definition: interface.h:112
virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi, bool *force_update) const
VmInterface::VrfAssignRuleList vrf_assign_rule_list_
bool DeleteL2(const Agent *agent, VmInterface *vmi) const
void GetNextHopInfo()
bool UpdateList(const Agent *agent, VmInterface *vmi, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
VnEntry * GetNonConstVn() const
virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi, bool *force_update) const
bool dhcp_enable_v6_config() const
VmInterfaceState::Op GetOpL2(const Agent *agent, const VmInterface *vmi) const
virtual VmInterface * OnAdd(const InterfaceTable *table, const VmInterfaceKey *key) const
boost::uuids::uuid qos_config_uuid_
std::set< VrfAssignRule, VrfAssignRule > VrfAssignRuleSet
Definition: vm_interface.h:864
bool AddL2(const Agent *agent, VmInterface *vmi) const
const VrfEntry * vrf_
Definition: vm_interface.h:695
AliasIpList alias_ip_list_
std::string cfg_name_
void Copy(const Agent *agent, const VmInterface *vmi) const
void SetInterfacesDropNewFlows(bool drop_new_flows) const
bool HasServiceVlan() const
std::unique_ptr< MetaDataIpState > metadata_ip6_state_
void Insert(const AllowedAddressPair *rhs)
NextHopRef l3_nh_no_policy_
Definition: vm_interface.h:271
virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi, bool *force_update) const
void Update(const Agent *agent, VmInterface *vmi, const VmInterface::InstanceIpList *list) const
void set_subnet_bcast_addr(const Ip4Address &addr)
boost::uuids::uuid uuid_
Definition: vm_interface.h:826
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
bool AddL3(const Agent *agent, VmInterface *vmi) const
Definition: vrf.h:86
const boost::uuids::uuid & vm_project_uuid() const
uint8_t configurer() const
bool IsFloatingIp(const IpAddress &ip) const
std::set< InstanceIp, InstanceIp > InstanceIpSet
Definition: vm_interface.h:933
void Remove(SecurityGroupEntrySet::iterator &it)
boost::uuids::uuid logical_interface_
bool etree_leaf() const
const NextHop * l2_interface_nh_policy() const
uint16_t rx_vlan_id() const
bool IsLess(const VmiReceiveRoute *rhs) const
bool IsLess(const StaticRoute *rhs) const
Interface::MirrorDirection mirror_direction_
bool port_map_enabled() const
OperDhcpOptions oper_dhcp_options_
Ip4Address subnet_bcast_addr_
virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi, bool *force_update) const
bool AddL3(const Agent *agent, VmInterface *vmi) const
VmInterfaceOsOperStateData(bool status)
void SendTrace(const AgentDBTable *table, Trace event) const
void Update(const VrfAssignRule *lhs, const VrfAssignRule *rhs)
uint8_t vhostuser_mode_
DISALLOW_COPY_AND_ASSIGN(VmInterface)
virtual bool CmpInterface(const DBEntry &rhs) const
std::vector< uint16_t > fat_flow_v6_exclude_plen_list_
bool cfg_igmp_enable_
boost::uuids::uuid vmi_cfg_uuid_
static const uint32_t kMaxMacIpLimit
Definition: vm_interface.h:365
static IgnoreAddressMap InitIgnoreAddressMap()
const ServiceVlanList & service_vlan_list() const
bool operator()(const FatFlowEntry &lhs, const FatFlowEntry &rhs) const
VmInterface::VmiType vmi_type_
bool IsVxlanMode() const
virtual VmInterface * OnAdd(const InterfaceTable *table, const VmInterfaceKey *key) const
NextHopRef l2_nh_policy_
Definition: vm_interface.h:266
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
bool GetSubnetDhcpOptions(std::vector< autogen::DhcpOptionType > *options, bool ipv6) const
bool is_force_policy() const
Definition: vm_interface.h:914
bool MatchSrcPrefixPort(uint8_t protocol, uint16_t port, IpAddress *src_ip, FatFlowIgnoreAddressType *ignore_addr) const
DBTableBase * get_table() const
Definition: db_entry.cc:119
void ResetConfigurer(VmInterface::Configurer type)
uint16_t rx_vlan_id_
bool learning_enabled_
bool AddL3(const Agent *agent, VmInterface *vmi) const
bool UpdateList(const Agent *agent, VmInterface *vmi, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
Ip4Address nova_ip_addr_
Ip6Address primary_ip6_addr_
void Remove(InstanceIpSet::iterator &it)
bool AddL2(const Agent *agent, VmInterface *vmi) const
Ip4Address mdata_ip_addr() const
VmInterfaceState::Op GetOpL2(const Agent *agent, const VmInterface *vmi) const
bool service_ip_ecmp6() const
void Remove(FatFlowEntrySet::iterator &it)
VmInterface::DeviceType device_type_
VmInterfaceState(bool l2_installed, bool l3_installed)
Definition: vm_interface.h:165
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
bool dhcp_enable_config() const
bool operator()(const BridgeDomain &lhs, const BridgeDomain &rhs) const
bool AddL3(const Agent *agent, VmInterface *vmi) const
bool OnResyncServiceVlan(VmInterfaceConfigData *data)
const LearntMacIpList & learnt_mac_ip_list() const
VmInterface::DeviceType device_type() const
bool do_dhcp_relay_
bool operator==(const SecurityGroupEntry &rhs) const
Family
Definition: address.h:24
void InsertHealthCheckInstance(HealthCheckInstanceBase *hc_inst)
bool igmp_enabled_
uint32_t GetServiceVlanLabel(const VrfEntry *vrf) const
void Remove(BridgeDomainEntrySet::iterator &it)
std::vector< uint64_t > fat_flow_v4_exclude_list_
AllowedAddressPairList allowed_address_pair_list_
std::set< BridgeDomain, BridgeDomain > BridgeDomainEntrySet
boost::asio::ip::address IpAddress
Definition: address.h:13
std::string physical_interface_
VmInterface::InstanceIpList instance_ipv4_list_
const MacAddress & GetVifMac(const Agent *) const
bool operator()(const VmiReceiveRoute &lhs, const VmiReceiveRoute &rhs) const
Definition: vm.h:32
Interface::Transport transport() const
Definition: interface.h:138
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
VmInterfaceState::Op GetOpL2(const Agent *agent, const VmInterface *vmi) const
bool InstallBridgeRoutes() const
bool GetInterfaceDhcpOptions(std::vector< autogen::DhcpOptionType > *options) const
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
bool AddL3(const Agent *agent, VmInterface *vmi) const
IpAddress service_health_check_ip_
void Update(const FatFlowEntry *lhs, const FatFlowEntry *rhs)
const VrfAssignRuleList & vrf_assign_rule_list() const
void BuildIpStringList(Address::Family family, std::vector< std::string > *vect) const
bool ResyncOsOperState(const VmInterfaceOsOperStateData *data)
const Ip4Address & vm_ip_service_addr() const
tbb::atomic< int > flow_count_
std::vector< int > SecurityGroupList
Definition: agent.h:201
VmInterface::InstanceIpList instance_ipv6_list_
const NextHop * l3_interface_nh_no_policy() const
const UuidList & slo_list() const
FatFlowEntry(const uint8_t proto, const uint16_t p, FatFlowIgnoreAddressType ignore_addr, FatFlowPrefixAggregateType prefix_aggr)
virtual ~VrfTableLabelState()
void set_layer3_forwarding(bool val)
bool operator()(const FloatingIp &lhs, const FloatingIp &rhs) const
std::string ToString() const
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
InterfaceKey * Clone() const
void Remove(const LearntMacIp *rhs)
ProxyArpMode proxy_arp_mode_
bool IsBareMetal() const
const NextHop * l2_interface_nh_no_policy() const
uint32_t l3_label_
Definition: vm_interface.h:272
Interface::MirrorDirection mirror_direction_
ProxyArpMode proxy_arp_mode() const
IpAddress service_health_check_ip() const
Ip4Address ip_
Definition: vm_interface.h:328
void Copy(const Agent *agent, const VmInterface *vmi) const
std::unique_ptr< MetaDataIpState > metadata_ip_state_
VmInterface::HbsIntfType hbs_intf_type() const
const Ip4Address & subnet() const
std::unique_ptr< NextHopState > nexthop_state_
const boost::uuids::uuid & si_other_end_vmi() const
void FillV4ExcludeIp(uint64_t plen, const Ip4Address &ip, FatFlowExcludeList *list) const
bool service_ip_ecmp() const
boost::uuids::uuid vm_project_uuid_
std::set< VmiReceiveRoute, VmiReceiveRoute > VmiReceiveRouteSet
bool need_linklocal_ip_
boost::uuids::uuid uuid
bool UpdateList(const Agent *agent, VmInterface *vmi, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
void CopyEcmpLoadBalance(EcmpLoadBalance &ecmp_load_balance)
bool AddL2(const Agent *agent, VmInterface *vmi) const
virtual bool DeleteL3(const Agent *agent, VmInterface *vmi) const
Definition: vm_interface.h:216
virtual ~VmiRouteState()
uint32_t l2_label() const
Definition: vm_interface.h:263
Direction direction() const
Definition: vm_interface.h:524
void set_layer2_control_word(bool val)
std::map< IpAddress, MetaDataIp * > MetaDataIpMap
Definition: vm_interface.h:465
static const uint32_t kInvalidPmdId
Definition: vm_interface.h:361
bool AddL2(const Agent *agent, VmInterface *vmi) const
FatFlowEntry(const uint8_t proto, const uint16_t p)
VmInterface::ProxyArpMode proxy_arp_mode_
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
uint32_t GetPbbLabel() const
const MacAddress & mac() const
Definition: interface.h:131
bool AddL2(const Agent *agent, VmInterface *vmi) const
int32_t GetSrcPortMap(uint8_t protocol, uint16_t src_port) const
void Copy(const Agent *agent, const VmInterface *vmi) const
bool IsL3Only() const
Definition: vm_interface.h:918
Ip4Address subnet_
Definition: vm_interface.h:309
VmInterfaceData(Agent *agent, IFMapNode *node, Type type, Interface::Transport transport)
void DeleteCommon(const VmInterface *vmi) const
static void SetIfNameReq(InterfaceTable *table, const boost::uuids::uuid &uuid, const std::string &ifname)
StaticRouteList static_route_list_
VmInterfaceNewFlowDropData(bool drop_new_flows)
bool AddL2(const Agent *agent, VmInterface *vmi) const
bool policy_enabled_
VmInterfaceState::Op GetOpL2(const Agent *agent, const VmInterface *vmi) const
VmInterfaceState::Op GetOp(VmInterfaceState::Op op) const
const Peer * peer() const
boost::uuids::uuid vm_uuid_
IpAddress GetServiceIp(const IpAddress &ip) const
FatFlowPrefixAggregateType prefix_aggregate
size_t GetAliasIpCount() const
bool operator==(const BridgeDomain &rhs) const
VrfEntry * vrf() const
Definition: interface.h:115
bool operator()(const AliasIp &lhs, const AliasIp &rhs) const
BridgeDomainConstRef bridge_domain_
bool CopyIp6Address(const Ip6Address &addr)
bool admin_state() const
const boost::uuids::uuid & logical_router_uuid() const
Definition: interface.h:146
boost::uuids::uuid vm_project_uuid_
Ip4Address subnet_
bool operator()(const VrfAssignRule &lhs, const VrfAssignRule &rhs) const
bool operator==(const VrfAssignRule &rhs) const
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
std::unique_ptr< DBRequestKey > KeyPtr
Definition: db_entry.h:25
bool CanBeDeleted() const
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
VmInterface::BridgeDomainList bridge_domain_list_
uint32_t service_mode_
bool AddL3(const Agent *agent, VmInterface *vmi) const
VrfAssignRuleList vrf_assign_rule_list_
bool AddL3(const Agent *agent, VmInterface *vmi) const
VmInterface(const boost::uuids::uuid &uuid, const std::string &name, bool os_oper_state, const boost::uuids::uuid &logical_router_uuid)
Definition: vm_interface.cc:48
std::vector< AclDBEntryConstRef > FirewallPolicyList
Definition: vm_interface.h:107
uint32_t max_flows_
const VmiReceiveRouteList & receive_route_list() const
const VrfEntry * vrf_
Definition: vm_interface.h:308
std::unique_ptr< VrfTableLabelState > vrf_table_label_state_
Ip4Address dhcp_addr() const
bool learning_enabled() const
int32_t GetDstPortMap(uint8_t protocol, uint16_t dst_port) const
void Copy(const Agent *agent, const VmInterface *vmi) const
VmInterface::LearntMacIpList mac_ip_list_
void Update(const StaticRoute *lhs, const StaticRoute *rhs)
uint8_t vhostuser_mode() const
const std::string & service_intf_type() const
bool DeleteL2(const Agent *agent, VmInterface *vmi) const
virtual ~VmInterfaceMirrorData()
uint32_t service_mode()
std::set< StaticRoute, StaticRoute > StaticRouteSet
Definition: vm_interface.h:701
bool is_left_si() const
void set_device_type(VmInterface::DeviceType type)
bool AddL2(const Agent *agent, VmInterface *vmi) const
void SetPrefixForAllocUnitIpam(VmInterface *intrface) const
void SetServiceVlanPathPreference(PathPreference *pref, const IpAddress &service_ip) const
bool UpdatePolicySet(const Agent *agent)
bool ResyncConfig(VmInterfaceConfigData *data)
const VmiEcmpLoadBalance & ecmp_load_balance() const
void Update(const ServiceVlan *lhs, const ServiceVlan *rhs)
const IpAddress ip_
Definition: vm_interface.h:922
void set_service_intf_type(std::string type)
static FatFlowEntry MakeFatFlowEntry(const std::string &protocol, const int &port, const std::string &ignore_addr_str, const std::string &src_prefix_str, const int &src_prefix_mask, const int &src_aggregate_plen, const std::string &dst_prefix_str, const int &dst_prefix_mask, const int &dst_aggregate_plen)
bool UpdateList(const Agent *agent, VmInterface *vmi, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
void set_mirror_entry(MirrorEntry *entry)
uint32_t label() const
Definition: interface.h:127
VmEntryBackRef vm_
void Remove(AliasIpSet::iterator &it)
bool operator==(const AllowedAddressPair &rhs) const
Definition: vm_interface.h:725
void Update(const VmiReceiveRoute *lhs, const VmiReceiveRoute *rhs)
bool AddL2(const Agent *agent, VmInterface *vmi) const
void Copy(const Agent *agent, const VmInterface *vmi) const
virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi, bool *force_update) const
bool pbb_interface_
uint16_t tx_vlan_id() const
virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi, bool *force_update) const
void Insert(const BridgeDomain *rhs)
std::vector< uint64_t > fat_flow_v6_exclude_upper_list_
void SetConfigurer(VmInterface::Configurer type)
uint32_t FloatingIpCount() const
bool WaitForTraffic() const
BridgeDomainList bridge_domain_list_
FatFlowPrefixAggregateType
Definition: vm_interface.h:446
VmInterface::VmiType vmi_type_
virtual bool OnDelete(const InterfaceTable *table, VmInterface *entry) const
ListEntry(bool del_pending)
Definition: vm_interface.h:473
void Update(const Agent *agent, VmInterface *vmi, const VmInterface::InstanceIpList *list) const
Ip4Address service_ip_
bool operator()(const LearntMacIp &lhs, const LearntMacIp &rhs) const
virtual bool OnDelete(const InterfaceTable *table, VmInterface *entry) const
std::vector< SgEntryRef > SgList
Definition: vm_interface.h:106
virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi, bool *force_update) const
VmInterfaceState::Op GetOpL2(const Agent *agent, const VmInterface *vmi) const
MirrorEntryRef mirror_entry_
bool IsActive() const
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
void print(void) const
bool AddL3(const Agent *agent, VmInterface *vmi) const
void ApplyConfig(bool old_ipv4_active, bool old_l2_active, bool old_ipv6_active, const Ip4Address &old_subnet, const uint8_t old_subnet_plen)
std::string vrf_name_
Definition: vm_interface.h:609
VmInterfaceMirrorData(bool mirror_enable, const std::string &analyzer_name)
bool layer3_forwarding_
void Insert(const TagEntry *rhs)
void Insert(const StaticRoute *rhs)
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
uint32_t local_preference() const
const SecurityGroupEntryList & sg_list() const
void CleanupAliasIpList()
void Update(const TagEntry *lhs, const TagEntry *rhs)
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
bool OnChange(VmInterfaceData *data)
void Insert(const LearntMacIp *rhs)
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
virtual VmInterface * OnAdd(const InterfaceTable *table, const VmInterfaceKey *key) const
bool is_vn_qos_config_
bool IsLess(const SecurityGroupEntry *rhs) const
uint8_t type
Definition: load_balance.h:109
static const uint8_t vHostUserClient
Definition: vm_interface.h:363
KeyPtr GetDBRequestKey() const
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
void Remove(TagEntrySet::iterator &it)
NextHopRef l3_mcast_nh_no_policy_
Definition: vm_interface.h:274
boost::intrusive_ptr< VnEntry > VnEntryRef
Definition: agent.h:68
bool IsConfigurerSet(VmInterface::Configurer type)
static const uint32_t kInvalidVlanId
Definition: vm_interface.h:360
uint32_t l2_label_
Definition: vm_interface.h:268
VrfEntryRef forwarding_vrf_
virtual ~VmInterfaceData()
VmiReceiveRouteList receive_route_list_
Definition: agent.h:358
bool flood_unknown_unicast() const
virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi, bool *force_update) const =0
std::unique_ptr< MacVmBindingState > mac_vm_binding_state_
Ip6Address service_ip6_
const std::string GetAnalyzer() const
boost::uuids::uuid si_other_end_vmi_
VmInterface::HbsIntfType hbs_intf_type_
std::vector< boost::uuids::uuid > SecurityGroupUuidList
Definition: vm_interface.h:792
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
LearntMacIp operator=(const LearntMacIp &rhs) const
Definition: vm_interface.h:960
bool need_linklocal_ip() const
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
const FirewallPolicyList & fwaas_fw_policy_list() const
uint32_t label_op() const
virtual ~VmInterfaceIpAddressData()
static Options options
VnEntryRef vn_
MetaDataIpMap metadata_ip_map_
bool fabric_port() const
uint32_t l3_label() const
Definition: vm_interface.h:264
const HealthCheckInstanceSet & hc_instance_set() const
virtual void GetOsParams(Agent *agent)
BridgeDomain(const BridgeDomain &rhs)
Ip4Address vm_ip_service_addr_
boost::asio::ip::address_v6 Ip6Address
Definition: address.h:15
uint32_t PortMappingSize() const
Ip4Address service_ip()
bool flood_unknown_unicast_
bool operator()(const StaticRoute &lhs, const StaticRoute &rhs) const
bool UpdateState(const VmInterfaceState *attr, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
std::map< std::string, FatFlowIgnoreAddressType > IgnoreAddressMap
bool IsUnrestrictedProxyArp() const
std::string vrf_name_
ServiceVlanList service_vlan_list_
boost::intrusive_ptr< AclDBEntry > AclDBEntryRef
Definition: agent.h:141
std::unique_ptr< ResolveRouteState > resolve_route_state_
void Copy(const Agent *agent, const VmInterface *vmi) const
bool IsMaxMacIpLearnt() const
void Update(const BridgeDomain *lhs, const BridgeDomain *rhs)
bool NeedOsStateWithoutDevice() const
void set_dhcp_enable_config(bool dhcp_enable)
bool Installed() const
Definition: vm_interface.h:171
const TagEntryList & tag_list() const
std::string service_intf_type_
VmInterface::SecurityGroupEntryList sg_list_
bool layer3_forwarding() const
Definition: trace.h:220
VmInterface::AliasIpList alias_ip_list_
virtual ~VmInterfaceState()
Definition: vm_interface.h:168
VmInterface::AllowedAddressPairList allowed_address_pair_list_
virtual bool DeleteL2(const Agent *agent, VmInterface *vmi) const
Definition: vm_interface.h:206
bool cfg_igmp_enable() const
const InstanceIpList & instance_ipv6_list() const
bool IsIpv4Active() const
std::set< HealthCheckInstanceBase * > HealthCheckInstanceSet
Definition: vm_interface.h:466
LearntMacIpList learnt_mac_ip_list_
virtual bool OnDelete(const InterfaceTable *table, VmInterface *entry) const
boost::uuids::uuid si_other_end_vmi_
virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi, bool *force_update) const
uint16_t tx_vlan_id_
bool os_oper_state() const
Definition: interface.h:132
bool AddL3(const Agent *agent, VmInterface *vmi) const
const OperDhcpOptions & oper_dhcp_options() const
void Copy(const Agent *agent, const VmInterface *vmi) const
bool IsLess(const TagEntry *rhs) const
VmInterface::VmiType vmi_type_
bool UpdateList(const Agent *agent, VmInterface *vmi)
void set_hbs_intf_type(VmInterface::HbsIntfType val)
bool DeleteState(VmInterfaceState *attr)
const MacAddress mac_
Definition: vm_interface.h:979
bool bridging() const
virtual ~VmInterfaceConfigData()
bool AddL3(const Agent *agent, VmInterface *vmi) const
void DeleteRoute(const std::string &vrf_name, const IpAddress &ip, uint32_t plen)
OperDhcpOptions oper_dhcp_options_
uint8_t subnet_plen_
uint32_t GetPbbVrf() const
IpAddress service_health_check_ip_
void AddCommon(const Agent *agent, const VmInterface *vmi) const
const VrfEntry * vrf_
Definition: vm_interface.h:930
const VrfEntry * vrf_
Definition: vm_interface.h:235
virtual ~VmInterface()
void Update(const AllowedAddressPair *lhs, const AllowedAddressPair *rhs)
bool admin_state_
Definition: interface.h:178
VmInterface::DeviceType device_type_
HealthCheckInstanceSet hc_instance_set_
FirewallPolicyList fwaas_fw_policy_list_
void Remove(VrfAssignRuleSet::iterator &it)
std::set< SecurityGroupEntry, SecurityGroupEntry > SecurityGroupEntrySet
Definition: vm_interface.h:791
const VnEntry * vn() const
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
void Update(const InstanceIp *lhs, const InstanceIp *rhs)
bool policy_enabled() const
FatFlowEntry(const FatFlowEntry &rhs)
void set_dhcp_enable_v6_config(bool dhcp_enable_v6)
std::vector< std::string > CommunityList
Definition: bgp_config.h:347
void update_flow_count(int val) const
void set_learning_enabled(bool val)
boost::intrusive_ptr< TagEntry > TagEntryRef
Definition: agent.h:80
std::unique_ptr< MetaDataIp > mdata_ip_
Definition: vm_interface.h:290
std::string mac_addr_
std::vector< Ip4Address > AddressList
Definition: agent.h:217
Ip6Address mdata_ip6_addr() const
FatFlowList fat_flow_list_
bool del_pending() const
Definition: vm_interface.h:476
Interface::MirrorDirection mirror_direction() const
std::vector< std::string > physical_interface_list_
uint32_t flow_count() const
void Remove(VmiReceiveRouteSet::iterator &it)
uint32_t GetIsid() const
Ip4Address primary_ip_addr_
Definition: peer.h:44
boost::uuids::uuid logical_interface_
FatFlowIgnoreAddressType ignore_address
void VmPortInit()
Definition: interface.h:256
void set_del_pending(bool val) const
Definition: vm_interface.h:477
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)
BridgeDomain(const boost::uuids::uuid &uuid, uint32_t vlan_tag)
InterfaceBackRef parent_
bool disable_policy_
bool AddL3(const Agent *agent, VmInterface *vmi) const
VmInterfaceGlobalVrouterData(bool bridging, bool layer3_forwarding, int vxlan_id)
bool PolicyEnabled() const
bool IsLess(const ServiceVlan *rhs) const
void UpdateInterfaceHealthCheckService()
const AclDBEntry * vrf_assign_acl() const
uint8_t configurer_
TagEntryList tag_list_
void Remove(ServiceVlanSet::iterator &it)
void CopyVhostData(const Agent *agent)
bool ExcludeFromFatFlow(Address::Family family, const IpAddress &sip, const IpAddress &dip) const
bool DeleteL2(const Agent *agent, VmInterface *vmi) const
void Insert(const VrfAssignRule *rhs)
bool service_ip_ecmp6_
std::vector< boost::uuids::uuid > UuidList
Definition: agent.h:203
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi, bool *force_update) const
Definition: vn.h:151
const BridgeDomainList & bridge_domain_list() const
void DeleteMetaDataIpInfo(MetaDataIp *mip)
std::map< PortMapKey, uint16_t, PortMapKey > PortMap
Definition: vm_interface.h:509
const FatFlowList & fat_flow_list() const
bool layer2_control_word_
bool CopyIpAddress(Ip4Address &addr)
void Delete()
Definition: db_entry.cc:131
std::string physical_interface_
VmInterfaceState::Op GetOpL2(const Agent *agent, const VmInterface *vmi) const
void PostAdd()
void DeleteHealthCheckInstance(HealthCheckInstanceBase *hc_inst)
std::string vm_name_
Ip4Address dhcp_addr_
VmInterfaceConfigData(Agent *agent, IFMapNode *node)
const Ip4Address & primary_ip_addr() const
const boost::uuids::uuid & logical_interface() const
VmInterface::HbsIntfType hbs_intf_type_
NextHopRef receive_nh_
Definition: vm_interface.h:276
bool DeleteL2(const Agent *agent, VmInterface *vmi) const
const StaticRouteList & static_route_list() const
bool AllowDNat() const
Definition: vm_interface.h:532
boost::uuids::uuid vn_uuid_
Definition: vm_interface.h:558
bool IsLess(const FatFlowEntry *rhs) const
FirewallPolicyList fw_policy_list_
MacAddress vm_mac_
virtual void ObtainOsSpecificParams(const std::string &name, Agent *agent)
const FloatingIpList & floating_ip_list() const
bool operator()(const PortMapKey &lhs, const PortMapKey &rhs) const
Definition: vm_interface.h:502
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
const std::string & vrf_name() const
PortMap::iterator PortMapIterator
Definition: vm_interface.h:510
uint32_t ethernet_tag_
Definition: vm_interface.h:329
void Copy(const Agent *agent, const VmInterface *vmi) const
const InstanceIpList & instance_ipv4_list() const
static const char * kInterfaceStatic
Definition: vm_interface.h:370
std::vector< uint64_t > fat_flow_v6_exclude_lower_list_
const MacAddress & GetIpMac(const IpAddress &, const uint8_t plen) const
bool dhcp_enable_v6_
std::set< TagEntry, TagEntry > TagEntrySet
Definition: vm_interface.h:828
bool Resync(const InterfaceTable *table, const VmInterfaceData *data)
bool drop_new_flows_vmi_
virtual ~MacVmBindingState()
boost::uuids::uuid vmi_cfg_uuid_
bool IsLess(const VrfAssignRule *rhs) const
static void DeleteIfNameReq(InterfaceTable *table, const boost::uuids::uuid &uuid)
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) 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
bool operator()(const AllowedAddressPair &lhs, const AllowedAddressPair &rhs) const
void Remove(StaticRouteSet::iterator &it)
size_t GetFloatingIpCount() const
VmInterface::TagEntryList tag_list_
const Agent * agent() const
Definition: oper_db.h:65
const std::string & vm_name() const
static const char * kInterface
Definition: vm_interface.h:368
void InsertMetaDataIpInfo(MetaDataIp *mip)
InterfaceList parent_list_
bool MatchSrcPrefixRule(uint8_t protocol, uint16_t *sport, uint16_t *dport, bool *same_port_num, IpAddress *SrcIP, FatFlowIgnoreAddressType *ignore_addr) const
bool ResyncIpAddress(const VmInterfaceIpAddressData *data)
void Update(const AliasIp *lhs, const AliasIp *rhs)
VmInterface::VmiType vmi_type() const
VmInterface::FatFlowList fat_flow_list_
std::set< ServiceVlan, ServiceVlan > ServiceVlanSet
Definition: vm_interface.h:664
bool MatchDstPrefixRule(uint8_t protocol, uint16_t *sport, uint16_t *dport, bool *same_port_num, IpAddress *DstIP, FatFlowIgnoreAddressType *ignore_addr) const
autogen::MatchConditionType match_condition_
Definition: vm_interface.h:862
bool operator==(const LearntMacIp &rhs) const
InstanceIpList instance_ipv4_list_
bool IsLess(const AliasIp *rhs) const
virtual bool AddL3(const Agent *agent, VmInterface *vmi) const
Definition: vm_interface.h:211
bool is_vn_qos_config() const
const Ip6Address & primary_ip6_addr() const
virtual bool AddL2(const Agent *agent, VmInterface *vmi) const
Definition: vm_interface.h:201
bool IsMetaDataIPActive() const
static IgnoreAddressMap fatflow_ignore_addr_map_
static const uint8_t vHostUserServer
Definition: vm_interface.h:364
bool AddL3(const Agent *agent, VmInterface *vmi) const
bool operator==(const TagEntry &rhs) const
virtual ~MetaDataIpState()
const boost::uuids::uuid & vmi_cfg_uuid() const
const VrfEntry * vrf_
Definition: vm_interface.h:327
uint32_t max_flows() const
boost::intrusive_ptr< MirrorEntry > MirrorEntryRef
Definition: agent.h:99
const uint8_t subnet_plen() const
bool mac_ip_learning_enable_
FloatingIpList floating_ip_list_
const std::string & cfg_name() const
InstanceIpList instance_ipv6_list_
std::unique_ptr< VmiRouteState > interface_route_state_
std::set< FloatingIp, FloatingIp > FloatingIpSet
Definition: vm_interface.h:567
std::set< FatFlowEntry, FatFlowEntry > FatFlowEntrySet
bool IsLess(const FloatingIp *rhs) const
bool igmp_enabled() const
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
DBSubOperation
Definition: agent_db.h:96
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
Agent * agent() const
virtual Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
Definition: vm_interface.h:192
uint32_t ethernet_tag() const
bool layer2_control_word() const
void AddL2InterfaceRoute(const IpAddress &ip, const MacAddress &mac, const IpAddress &dependent_ip) const
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
virtual bool Update(const Agent *agent, VmInterface *vmi, Op l2_force_op, Op l3_force_op) const
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
VmInterfaceKey(AgentKey::DBSubOperation sub_op, const boost::uuids::uuid &uuid, const std::string &name)
void Insert(const VmiReceiveRoute *rhs)
std::vector< boost::uuids::uuid > SgUuidList
Definition: vm_interface.h:105
const FirewallPolicyList & fw_policy_list() const
virtual void Copy(const Agent *agent, const VmInterface *vmi) const
Definition: vm_interface.h:197
bool NeedMplsLabel() 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
const std::string & name() const
Definition: interface.h:114
bool IsLess(const BridgeDomain *rhs) const
boost::uuids::uuid vn_uuid_
Definition: vm_interface.h:610
void Insert(const FloatingIp *rhs)
void Copy(const Agent *agent, const VmInterface *vmi) const
VmInterfaceState::Op GetOpL2(const Agent *agent, const VmInterface *vmi) const
bool HasFloatingIp() const
void set_max_flows(uint32_t val)
VmInterfaceState::Op GetOpL3(const Agent *agent, const VmInterface *vmi) const
bool IsMetaDataL2Active() const
bool IsFatFlowPortBased(uint8_t protocol, uint16_t port, FatFlowIgnoreAddressType *ignore_addr) const
VmInterface * PortTuplePairedInterface() const
Interface * AllocEntry(const InterfaceTable *table) const
IpAddress GetGatewayIp(const IpAddress &ip) const
bool copyMacIpData(const VmInterfaceLearntMacIpData *data)
bool do_dhcp_relay() const
MetaDataIpState(bool ipv4=true)
Creates a new instance of MetaDataIpState.
NextHopRef l2_nh_no_policy_
Definition: vm_interface.h:267
bool DeleteL2(const Agent *agent, VmInterface *vmi) const
std::set< AllowedAddressPair, AllowedAddressPair > AllowedAddressPairSet
Definition: vm_interface.h:754
VrfEntry * forwarding_vrf() const
Ip6Address service_ip6()
bool operator==(const FatFlowEntry &rhs) const
VmiEcmpLoadBalance ecmp_load_balance_
bool SgExists(const boost::uuids::uuid &id, const SgList &sg_l)
void set_primary_ip_addr(const Ip4Address &addr)
bool DeleteL2(const Agent *agent, VmInterface *vmi) const
static const char * kServiceInterface
Definition: vm_interface.h:369
autogen::VirtualMachineInterface * GetVmiCfg() const
bool IsLess(const LearntMacIp *rhs) const
virtual ~VmInterfaceKey()
InstanceIp operator=(const InstanceIp &rhs) const
Definition: vm_interface.h:894
bool UpdateList(const Agent *agent, VmInterface *vmi, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
bool UpdateList(const Agent *agent, VmInterface *vmi, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
virtual ~NextHopState()
VmInterface::DeviceType device_type_
bool AllowSNat() const
Definition: vm_interface.h:538
bool IsL2Active() const
virtual bool UpdateList(const Agent *agent, VmInterface *vmi, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
virtual bool OnResync(const InterfaceTable *table, VmInterface *vmi, bool *force_update) const
bool mac_ip_learning_enable() const
bool ResetVrfDelete(const InterfaceTable *table, const std::string &vrf_name)
void Update(const FloatingIp *lhs, const FloatingIp *rhs)
virtual Op GetOpL2(const Agent *agent, const VmInterface *vmi) const
Definition: vm_interface.h:185
void Remove(AllowedAddressPairSet::iterator &it)
void Insert(const SecurityGroupEntry *rhs)
const IpAddress GetFixedIp(const VmInterface *) const
std::string analyzer_name_
bool OnResyncSecurityGroupList(VmInterfaceConfigData *data, bool new_ipv4_active)
void set_vmi_type(VmInterface::VmiType type)
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
const AliasIpList & alias_ip_list() const
void Insert(const AliasIp *rhs)
bool ecmp() const
void Insert(const FatFlowEntry *rhs)
static void NovaAdd(InterfaceTable *table, const boost::uuids::uuid &intf_uuid, const std::string &os_name, const Ip4Address &addr, const std::string &mac, const std::string &vn_name, const boost::uuids::uuid &vm_project_uuid, uint16_t tx_vlan_id, uint16_t rx_vlan_id, const std::string &parent, const Ip6Address &ipv6, uint8_t vhostuser_mode, Interface::Transport transport, uint8_t link_state)
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
CommunityList communities_
Definition: vm_interface.h:699
std::string service_intf_type_
std::vector< boost::uuids::uuid > TagGroupUuidList
Definition: vm_interface.h:829
void set_vxlan_id(int vxlan_id)
void Update(const Agent *agent, VmInterface *vmi)
std::set< LearntMacIp, LearntMacIp > LearntMacIpSet
Definition: vm_interface.h:989
UuidList slo_list_
MirrorDirection
Definition: interface.h:55
void Remove(FloatingIpSet::iterator &it)
bool UpdateList(const Agent *agent, VmInterface *vmi, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
boost::intrusive_ptr< const BridgeDomainEntry > BridgeDomainConstRef
Definition: agent.h:190
bool UpdateList(const Agent *agent, VmInterface *vmi, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
NextHopRef l3_nh_policy_
Definition: vm_interface.h:270
void CopySgIdList(SecurityGroupList *sg_id_list) const
boost::uuids::uuid uuid_
bool IsLess(const AllowedAddressPair *rhs) const
InterfaceList parent_list() const
bool operator()(const InstanceIp &lhs, const InstanceIp &rhs) const
VmiEcmpLoadBalance ecmp_load_balance_
const Interface * parent() const
bool IsIpv6Active() const
static Op RecomputeOp(Op old_op, Op new_op)
VmInterface::ServiceVlanList service_vlan_list_
bool operator()(const SecurityGroupEntry &lhs, const SecurityGroupEntry &rhs) const
boost::uuids::uuid vm_uuid_
bool UpdateIsHealthCheckActive()
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
const AllowedAddressPairList & allowed_address_pair_list() const
bool AddL3(const Agent *agent, VmInterface *vmi) const
Ip6Address nova_ip6_addr_
VmInterface::VmiReceiveRouteList receive_route_list_
void Update(const LearntMacIp *lhs, const LearntMacIp *rhs)
bool DeleteL3(const Agent *agent, VmInterface *vmi) const
Definition: acl.h:92
SecurityGroupEntryList sg_list_
MetaDataIp * GetMetaDataIp(const IpAddress &ip) const
virtual ~ResolveRouteState()
boost::uuids::uuid vn_uuid_
void UpdateL2()
const VmEntry * vm() const
void Insert(const InstanceIp *rhs)
bool NeedDevice() const
bool UpdateList(const Agent *agent, VmInterface *vmi, VmInterfaceState::Op l2_force_op, VmInterfaceState::Op l3_force_op)
void Copy(const Agent *agent, const VmInterface *vmi) const
void Copy(const Agent *agent, const VmInterface *vmi) const
bool CopyConfig(const InterfaceTable *table, const VmInterfaceConfigData *data, bool *sg_changed, bool *ecmp_changed, bool *local_pref_changed, bool *ecmp_load_balance_changed, bool *static_route_config_changed, bool *etree_leaf_mode_changed, bool *tag_changed)
const Ip4Address & subnet_bcast_addr() const
bool operator==(const InstanceIp &rhs) const
bool AddL3(const Agent *agent, VmInterface *vmi) const
const MirrorEntry * mirror_entry() const
bool operator()(const ServiceVlan &lhs, const ServiceVlan &rhs) const
bool OnResyncStaticRoute(VmInterfaceConfigData *data, bool new_ipv4_active)
bool drop_new_flows() const
const VrfEntry * GetServiceVlanVrf(uint16_t vlan_tag) const
void set_mirror_direction(Interface::MirrorDirection mirror_direction)
std::string vm_name_
uint32_t local_preference_
bool AddL3(const Agent *agent, VmInterface *vmi) const
void Update(const Agent *agent, VmInterface *vmi) const
boost::intrusive_ptr< NextHop > NextHopRef
Definition: agent.h:124
void FillV6ExcludeIp(uint16_t plen, const IpAddress &ip, FatFlowExcludeList *list) const
std::vector< int > TagList
Definition: agent.h:202
bool operator()(const TagEntry &lhs, const TagEntry &rhs) const
void CopyTagIdList(TagList *tag_id_list) const
bool service_ip_ecmp_
bool DeleteL3(const Agent *agent, VmInterface *vmi) const