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