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