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