OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
physical_port_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_PORT_OVSDB_H_
6 #define SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_PHYSICAL_PORT_OVSDB_H_
7 
8 #include <ovsdb_entry.h>
9 #include <ovsdb_object.h>
10 
11 namespace OVSDB {
12 class PhysicalPortEntry;
13 
15 public:
16  typedef std::map<struct ovsdb_idl_row *, PhysicalPortEntry *> IdlEntryMap;
18  virtual ~PhysicalPortTable();
19 
20  void Notify(OvsdbClientIdl::Op, struct ovsdb_idl_row *);
21  KSyncEntry *Alloc(const KSyncEntry *key, uint32_t index);
22 
23  void CreatePortEntry(struct ovsdb_idl_row *row,
24  const std::string &physical_device);
25  PhysicalPortEntry *FindPortEntry(struct ovsdb_idl_row *row);
26  void DeletePortEntry(struct ovsdb_idl_row *row);
27 
28  void set_stale_create_done();
29 
30 private:
32 
36 };
37 
38 class PhysicalPortEntry : public OvsdbEntry {
39 public:
40  typedef std::map<uint32_t, LogicalSwitchEntry *> VlanLSTable;
41  typedef std::map<uint32_t, struct ovsdb_idl_row *> VlanStatsTable;
42  PhysicalPortEntry(PhysicalPortTable *table, const std::string &dev_name,
43  const std::string &name);
45 
46  virtual bool Add();
47  virtual bool Change();
48  virtual bool Delete();
49 
50  bool IsLess(const KSyncEntry&) const;
51  std::string ToString() const {return "Physical Port";}
53  void TriggerUpdate();
54  void AddBinding(int16_t vlan, LogicalSwitchEntry *ls);
55  void DeleteBinding(int16_t vlan, LogicalSwitchEntry *ls);
56 
57  const std::string &name() const;
58  const std::string &dev_name() const;
59  const VlanLSTable &binding_table() const;
60  const VlanLSTable &ovs_binding_table() const;
61  const VlanStatsTable &stats_table() const;
62 
63 private:
64  friend class PhysicalPortTable;
65  void Encode(struct ovsdb_idl_txn *);
66  bool OverrideOvs();
67  std::string name_;
68  std::string dev_name_;
73 };
74 };
75 
76 #endif //SRC_VNSW_AGENT_OVS_TOR_AGENT_OVSDB_CLIENT_PHYSICAL_PORT_OVSDB_H_
77 
DISALLOW_COPY_AND_ASSIGN(PhysicalPortTable)
const VlanLSTable & binding_table() const
const std::string & dev_name() const
bool IsLess(const KSyncEntry &) const
void EntryOvsdbUpdate(PhysicalPortEntry *entry)
PhysicalPortTable(OvsdbClientIdl *idl)
std::map< uint32_t, struct ovsdb_idl_row * > VlanStatsTable
std::map< struct ovsdb_idl_row *, PhysicalPortEntry * > IdlEntryMap
std::string ToString() const
KSyncEntry * Alloc(const KSyncEntry *key, uint32_t index)
void DeletePortEntry(struct ovsdb_idl_row *row)
void CreatePortEntry(struct ovsdb_idl_row *row, const std::string &physical_device)
const VlanLSTable & ovs_binding_table() const
void Encode(struct ovsdb_idl_txn *)
std::map< uint32_t, LogicalSwitchEntry * > VlanLSTable
void AddBinding(int16_t vlan, LogicalSwitchEntry *ls)
void DeleteBinding(int16_t vlan, LogicalSwitchEntry *ls)
PhysicalPortEntry(PhysicalPortTable *table, const std::string &dev_name, const std::string &name)
void Notify(OvsdbClientIdl::Op, struct ovsdb_idl_row *)
DISALLOW_COPY_AND_ASSIGN(PhysicalPortEntry)
const std::string & name() const
const VlanStatsTable & stats_table() const
PhysicalPortEntry * FindPortEntry(struct ovsdb_idl_row *row)