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