OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
physical_switch_ovsdb.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_PHYSICAL_SWITCH_OVSDB_H_
6 #define SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_PHYSICAL_SWITCH_OVSDB_H_
7 
8 #include <ovsdb_entry.h>
9 #include <ovsdb_object.h>
10 
11 namespace OVSDB {
12 class PhysicalSwitchEntry;
13 
15 public:
16  typedef std::map<struct ovsdb_idl_row *, PhysicalSwitchEntry *> IdlEntryMap;
18  virtual ~PhysicalSwitchTable();
19 
20  void Notify(OvsdbClientIdl::Op, struct ovsdb_idl_row *);
21  KSyncEntry *Alloc(const KSyncEntry *key, uint32_t index);
22 
23  void StartUpdatePorts();
24 
25 private:
27  void UpdatePorts(PhysicalSwitchEntry *entry);
28  PhysicalSwitchEntry *FindSwitchEntry(struct ovsdb_idl_row *row);
29 
30  // By default update ports is set to false to avoid updation
31  // of physical port entries in ovsdb client context, which
32  // helps to ignore partial updates on physical ports from
33  // ovsdb library to avoid useless processing on half cooked
34  // information. once the initial monitor request processing
35  // is complete OvsdbClientIdl triggers StartUpdatePorts to
36  // update the pending ports and allow further ports updation
38  // map to store corelation between ovsdb_idl_row and
39  // PhysicalSwitchEntry, used to ensure appropriate handling
40  // when physical switch name is changed for the same
41  // ovsdb_idl_row
44 };
45 
47 public:
48  typedef std::set<struct ovsdb_idl_row *> InterfaceList;
49 
50  enum Trace {
51  ADD,
52  DEL,
53  };
54 
55  PhysicalSwitchEntry(PhysicalSwitchTable *table, const std::string &name);
57 
58  bool Add();
59  bool Delete();
61  const std::string &name();
62  void set_tunnel_ip(std::string ip);
63  bool IsLess(const KSyncEntry&) const;
64  std::string ToString() const {return "Physical Switch";}
66 
67 private:
68  friend class PhysicalSwitchTable;
69  void SendTrace(Trace event) const;
70 
71  std::string name_;
75 };
76 };
77 
78 #endif //SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_PHYSICAL_SWITCH_OVSDB_H_
79 
bool IsLess(const KSyncEntry &) const
std::set< struct ovsdb_idl_row * > InterfaceList
PhysicalSwitchTable(OvsdbClientIdl *idl)
void TriggerDelete(PhysicalSwitchEntry *entry)
DISALLOW_COPY_AND_ASSIGN(PhysicalSwitchTable)
PhysicalSwitchEntry * FindSwitchEntry(struct ovsdb_idl_row *row)
DISALLOW_COPY_AND_ASSIGN(PhysicalSwitchEntry)
PhysicalSwitchEntry(PhysicalSwitchTable *table, const std::string &name)
Definition: trace.h:220
void UpdatePorts(PhysicalSwitchEntry *entry)
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
std::map< struct ovsdb_idl_row *, PhysicalSwitchEntry * > IdlEntryMap
void Notify(OvsdbClientIdl::Op, struct ovsdb_idl_row *)
void SendTrace(Trace event) const
KSyncEntry * Alloc(const KSyncEntry *key, uint32_t index)
void set_tunnel_ip(std::string ip)