OpenSDN source code
vm_uve_entry_base.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_uve_entry_base_h
6 #define vnsw_agent_vm_uve_entry_base_h
7 
8 #include <string>
9 #include <vector>
10 #include <set>
11 #include <map>
12 #include <mutex>
13 
14 #include <virtual_machine_types.h>
15 #include <uve/l4_port_bitmap.h>
16 #include <uve/vm_stat.h>
17 #include <uve/vm_stat_data.h>
18 #include <oper/interface_common.h>
19 #include <oper/interface.h>
20 #include <oper/vm.h>
21 
22 //The class that defines data-structures to store VirtualMachine information
23 //required for sending VirtualMachine UVE.
25 public:
26 
27  typedef std::set<std::string> InterfaceSet;
28 
29  VmUveEntryBase(Agent *agent, const std::string &vm_name);
30  virtual ~VmUveEntryBase();
31  const std::string &vm_config_name() const { return vm_config_name_; }
32  bool add_by_vm_notify() const { return add_by_vm_notify_; }
33  void set_add_by_vm_notify(bool value) { add_by_vm_notify_ = value; }
34 
35  void InterfaceAdd(const std::string &intf_cfg_name);
36  void InterfaceDelete(const std::string &intf_cfg_name);
37  bool FrameVmMsg(const boost::uuids::uuid &u, UveVirtualMachineAgent *uve);
38  bool Update(const VmEntry *vm);
39  void set_changed(bool val) { changed_ = val; }
40  bool changed() const { return changed_; }
41  void set_deleted(bool value) { deleted_ = value; }
42  bool deleted() const { return deleted_; }
43  void set_renewed(bool value) { renewed_ = value; }
44  bool renewed() const { return renewed_; }
45  void set_vm_name(const std::string name) { vm_name_.assign(name); }
46  virtual void Reset();
47 protected:
48 
51  UveVirtualMachineAgent uve_info_;
52  // UVE entry is changed. Timer must generate UVE for this entry
53  bool changed_;
54  bool deleted_;
55  bool renewed_;
56  /* For exclusion between kTaskFlowStatsCollector and Agent::Uve */
57  std::mutex mutex_;
58 private:
60  (const std::vector<std::string> &new_l) const;
61  bool UveVmVRouterChanged(const std::string &new_value) const;
62 
64  std::string vm_config_name_;
65  std::string vm_name_; /* Name given by Nova during port notification */
67 };
68 #endif // vnsw_agent_vm_uve_entry_base_h
Definition: agent.h:360
Definition: vm.h:34
VmUveEntryBase(Agent *agent, const std::string &vm_name)
void set_changed(bool val)
bool renewed() const
void set_vm_name(const std::string name)
DISALLOW_COPY_AND_ASSIGN(VmUveEntryBase)
bool add_by_vm_notify() const
UveVirtualMachineAgent uve_info_
InterfaceSet interface_tree_
bool changed() const
void set_add_by_vm_notify(bool value)
void set_deleted(bool value)
void InterfaceAdd(const std::string &intf_cfg_name)
std::string vm_config_name_
bool UveVmVRouterChanged(const std::string &new_value) const
bool Update(const VmEntry *vm)
std::string vm_name_
bool UveVmInterfaceListChanged(const std::vector< std::string > &new_l) const
bool deleted() const
const std::string & vm_config_name() const
virtual ~VmUveEntryBase()
virtual void Reset()
void set_renewed(bool value)
bool FrameVmMsg(const boost::uuids::uuid &u, UveVirtualMachineAgent *uve)
void InterfaceDelete(const std::string &intf_cfg_name)
std::set< std::string > InterfaceSet
boost::uuids::uuid uuid