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