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