21 #include <ovsdb_types.h>
23 using namespace OVSDB;
26 const std::string &dev_name,
const std::string &name) :
27 OvsdbEntry(table), name_(name), dev_name_(dev_name), binding_table_(),
28 ovs_binding_table_() {
83 struct ovsdb_idl_row *ls = it->second->ovs_entry();
86 binding[i].
vlan = it->first;
125 struct ovsdb_idl_txn *txn =
154 struct ovsdb_idl_row *row) {
174 const std::string &physical_device) {
232 for (std::size_t i = 0; i < count; i++) {
238 if (ls_entry != NULL) {
245 PhysicalPortEntry::VlanLSTable::iterator it =
247 PhysicalPortEntry::VlanLSTable::iterator ovs_it =
250 bool ret_override =
false;
252 if (it != entry->
binding_table_.end() && it->first == ovs_it->first) {
253 if (it->second != ovs_it->second) {
267 if (it == entry->
binding_table_.end() || it->first > ovs_it->first) {
270 entry->
name(), ovs_it->first,
271 ovs_it->second->name());
289 for (std::size_t i = 0; i < count; i++) {
305 if (
false == args.
Get(
"name", &
name_)) {
311 const std::string &ip,
313 const std::string &name) :
321 if (!
name_.empty()) {
328 if (!
name_.empty()) {
330 if (entry->
name().find(
name_) != std::string::npos) {
341 OvsdbPhysicalPortEntry pentry;
343 pentry.set_switch_name(entry->
dev_name());
344 pentry.set_name(entry->
name());
349 PhysicalPortEntry::VlanLSTable::const_iterator it =
351 std::vector<OvsdbPhysicalPortVlanInfo> vlan_list;
352 for (; it != bindings.end(); it++) {
353 OvsdbPhysicalPortVlanInfo
vlan;
354 vlan.set_vlan(it->first);
355 vlan.set_logical_switch(it->second->name());
356 PhysicalPortEntry::VlanStatsTable::const_iterator stats_it =
357 stats_table.find(it->first);
358 if (stats_it != stats_table.end()) {
359 int64_t in_pkts, in_bytes, out_pkts, out_bytes;
361 &in_pkts, &in_bytes, &out_pkts, &out_bytes);
362 vlan.set_in_pkts(in_pkts);
363 vlan.set_in_bytes(in_bytes);
364 vlan.set_out_pkts(out_pkts);
365 vlan.set_out_bytes(out_bytes);
368 vlan.set_in_bytes(0);
369 vlan.set_out_pkts(0);
370 vlan.set_out_bytes(0);
372 vlan_list.push_back(
vlan);
374 pentry.set_vlans(vlan_list);
376 OvsdbPhysicalPortResp *port_resp =
377 static_cast<OvsdbPhysicalPortResp *
>(resp);
378 std::vector<OvsdbPhysicalPortEntry> &port_list =
379 const_cast<std::vector<OvsdbPhysicalPortEntry>&
>(
380 port_resp->get_port());
381 port_list.push_back(pentry);
393 void OvsdbPhysicalPortReq::HandleRequest()
const {
396 get_session_remote_port(),
bool Add(const std::string &key, const std::string &val)
bool Get(const std::string &key, std::string *val) const
std::string StateString() const
KSyncEntry * Find(const KSyncEntry *key)
void Change(KSyncEntry *entry)
KSyncEntry * CreateStale(const KSyncEntry *key)
KSyncEntry * Create(const KSyncEntry *key)
void Delete(KSyncEntry *entry)
PhysicalPortTable * physical_port_table()
struct ovsdb_idl_txn * CreateTxn(OvsdbEntryBase *entry, KSyncEntry::KSyncEvent ack_event=KSyncEntry::ADD_ACK)
void TxnScheduleJsonRpc(struct jsonrpc_msg *msg)
void DeleteTxn(struct ovsdb_idl_txn *txn)
void Register(EntryType type, NotifyCB cb)
OvsdbClientIdl * client_idl()
struct ovsdb_idl_row * ovs_entry_
struct ovsdb_idl_row * ovs_entry()
OvsdbClientIdlPtr client_idl_
OvsdbClientIdl * client_idl()
const VlanStatsTable & stats_table() const
void Encode(struct ovsdb_idl_txn *)
PhysicalPortEntry(PhysicalPortTable *table, const std::string &dev_name, const std::string &name)
void DeleteBinding(int16_t vlan, LogicalSwitchEntry *ls)
KSyncEntry * UnresolvedReference()
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
VlanLSTable binding_table_
const std::string & dev_name() const
std::map< uint32_t, LogicalSwitchEntry * > VlanLSTable
const std::string & name() const
bool IsLess(const KSyncEntry &) const
VlanLSTable ovs_binding_table_
VlanStatsTable stats_table_
void EncodeArgs(AgentSandeshArguments &args)
FilterResp Filter(KSyncEntry *entry)
void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp)
SandeshResponse * Alloc()
virtual ~PhysicalPortSandeshTask()
PhysicalPortSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
KSyncObject * GetObject(OvsdbClientSession *session)
PhysicalPortTable(OvsdbClientIdl *idl)
IdlEntryMap idl_entry_map_
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)
virtual ~PhysicalPortTable()
void EntryOvsdbUpdate(PhysicalPortEntry *entry)
PhysicalPortEntry * FindPortEntry(struct ovsdb_idl_row *row)
void set_stale_create_done()
void Notify(OvsdbClientIdl::Op, struct ovsdb_idl_row *)
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
void Enqueue(Task *task)
Enqueues a task for running. Starts task if all policy rules are met else puts task in waitq....
static TaskScheduler * GetInstance()
#define OVSDB_TRACE(obj,...)
void ovsdb_wrapper_get_logical_binding_stats(struct ovsdb_idl_row *row, int64_t *in_pkts, int64_t *in_bytes, int64_t *out_pkts, int64_t *out_bytes)
size_t ovsdb_wrapper_physical_port_vlan_stats_count(struct ovsdb_idl_row *row)
size_t ovsdb_wrapper_physical_port_vlan_binding_count(struct ovsdb_idl_row *row)
char * ovsdb_wrapper_physical_port_name(struct ovsdb_idl_row *row)
void ovsdb_wrapper_update_physical_port(struct ovsdb_idl_txn *, struct ovsdb_idl_row *, struct ovsdb_wrapper_port_vlan_binding *, size_t binding_count)
void ovsdb_wrapper_physical_port_vlan_stats(struct ovsdb_idl_row *row, struct ovsdb_wrapper_port_vlan_stats *)
char * ovsdb_wrapper_logical_switch_name(struct ovsdb_idl_row *row)
void ovsdb_wrapper_physical_port_vlan_binding(struct ovsdb_idl_row *row, struct ovsdb_wrapper_port_vlan_binding *)
struct jsonrpc_msg * ovsdb_wrapper_idl_txn_encode(struct ovsdb_idl_txn *txn)
struct ovsdb_idl_row * ls
struct ovsdb_idl_row * stats