20 #include <ovsdb_types.h>
22 using namespace OVSDB;
25 const std::string &dev_name,
const std::string &name) :
26 OvsdbEntry(table), name_(name), dev_name_(dev_name), binding_table_(),
27 ovs_binding_table_() {
79 VlanLSTable::iterator it = binding_table_.begin();
81 for ( ; it != binding_table_.end(); it++) {
82 struct ovsdb_idl_row *ls = it->second->ovs_entry();
85 binding[i].
vlan = it->first;
124 struct ovsdb_idl_txn *txn =
153 struct ovsdb_idl_row *row) {
173 const std::string &physical_device) {
231 for (std::size_t i = 0; i < count; i++) {
237 if (ls_entry != NULL) {
244 PhysicalPortEntry::VlanLSTable::iterator it =
246 PhysicalPortEntry::VlanLSTable::iterator ovs_it =
249 bool ret_override =
false;
251 if (it != entry->
binding_table_.end() && it->first == ovs_it->first) {
252 if (it->second != ovs_it->second) {
266 if (it == entry->
binding_table_.end() || it->first > ovs_it->first) {
269 entry->
name(), ovs_it->first,
270 ovs_it->second->name());
288 for (std::size_t i = 0; i < count; i++) {
304 if (
false == args.
Get(
"name", &
name_)) {
310 const std::string &ip,
312 const std::string &name) :
320 if (!
name_.empty()) {
327 if (!
name_.empty()) {
329 if (entry->
name().find(
name_) != std::string::npos) {
340 OvsdbPhysicalPortEntry pentry;
342 pentry.set_switch_name(entry->
dev_name());
343 pentry.set_name(entry->
name());
348 PhysicalPortEntry::VlanLSTable::const_iterator it =
350 std::vector<OvsdbPhysicalPortVlanInfo> vlan_list;
351 for (; it != bindings.end(); it++) {
352 OvsdbPhysicalPortVlanInfo
vlan;
353 vlan.set_vlan(it->first);
354 vlan.set_logical_switch(it->second->name());
355 PhysicalPortEntry::VlanStatsTable::const_iterator stats_it =
356 stats_table.find(it->first);
357 if (stats_it != stats_table.end()) {
358 int64_t in_pkts, in_bytes, out_pkts, out_bytes;
360 &in_pkts, &in_bytes, &out_pkts, &out_bytes);
361 vlan.set_in_pkts(in_pkts);
362 vlan.set_in_bytes(in_bytes);
363 vlan.set_out_pkts(out_pkts);
364 vlan.set_out_bytes(out_bytes);
367 vlan.set_in_bytes(0);
368 vlan.set_out_pkts(0);
369 vlan.set_out_bytes(0);
371 vlan_list.push_back(vlan);
373 pentry.set_vlans(vlan_list);
375 OvsdbPhysicalPortResp *port_resp =
376 static_cast<OvsdbPhysicalPortResp *
>(resp);
377 std::vector<OvsdbPhysicalPortEntry> &port_list =
378 const_cast<std::vector<OvsdbPhysicalPortEntry>&
>(
379 port_resp->get_port());
380 port_list.push_back(pentry);
392 void OvsdbPhysicalPortReq::HandleRequest()
const {
395 get_session_remote_port(),
void UpdateResp(KSyncEntry *kentry, SandeshResponse *resp)
#define OVSDB_TRACE(obj,...)
void Change(KSyncEntry *entry)
KSyncEntry * UnresolvedReference()
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
const VlanLSTable & binding_table() const
void ovsdb_wrapper_physical_port_vlan_stats(struct ovsdb_idl_row *row, struct ovsdb_wrapper_port_vlan_stats *)
std::string StateString() const
char * ovsdb_wrapper_logical_switch_name(struct ovsdb_idl_row *row)
const std::string & dev_name() const
bool IsLess(const KSyncEntry &) const
void Delete(KSyncEntry *entry)
void EntryOvsdbUpdate(PhysicalPortEntry *entry)
PhysicalPortTable(OvsdbClientIdl *idl)
std::map< uint32_t, struct ovsdb_idl_row * > VlanStatsTable
void ovsdb_wrapper_physical_port_vlan_binding(struct ovsdb_idl_row *row, struct ovsdb_wrapper_port_vlan_binding *)
void Register(EntryType type, NotifyCB cb)
VlanStatsTable stats_table_
struct ovsdb_idl_row * stats
void EncodeArgs(AgentSandeshArguments &args)
void set_stale_create_done()
virtual ~PhysicalPortTable()
void DeleteTxn(struct ovsdb_idl_txn *txn)
struct ovsdb_idl_row * ovs_entry_
KSyncEntry * Alloc(const KSyncEntry *key, uint32_t index)
void DeletePortEntry(struct ovsdb_idl_row *row)
bool Get(const std::string &key, std::string *val) const
KSyncObject * GetObject(OvsdbClientSession *session)
static TaskScheduler * GetInstance()
FilterResp Filter(KSyncEntry *entry)
void Enqueue(Task *task)
Enqueues a task for running. Starts task if all policy rules are met else puts task in waitq...
struct ovsdb_idl_row * ls
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)
IdlEntryMap idl_entry_map_
VlanLSTable binding_table_
OvsdbClientIdl * client_idl()
virtual ~PhysicalPortSandeshTask()
KSyncEntry * Find(const KSyncEntry *key)
void CreatePortEntry(struct ovsdb_idl_row *row, const std::string &physical_device)
struct ovsdb_idl_row * ovs_entry()
PhysicalPortSandeshTask(std::string resp_ctx, AgentSandeshArguments &args)
const VlanLSTable & ovs_binding_table() const
bool Add(const std::string &key, const std::string &val)
void Encode(struct ovsdb_idl_txn *)
KSyncEntry * Create(const KSyncEntry *key)
size_t ovsdb_wrapper_physical_port_vlan_stats_count(struct ovsdb_idl_row *row)
std::map< uint32_t, LogicalSwitchEntry * > VlanLSTable
void AddBinding(int16_t vlan, LogicalSwitchEntry *ls)
char * ovsdb_wrapper_physical_port_name(struct ovsdb_idl_row *row)
KSyncEntry * CreateStale(const KSyncEntry *key)
PhysicalPortTable * physical_port_table()
void DeleteBinding(int16_t vlan, LogicalSwitchEntry *ls)
struct jsonrpc_msg * ovsdb_wrapper_idl_txn_encode(struct ovsdb_idl_txn *txn)
PhysicalPortEntry(PhysicalPortTable *table, const std::string &dev_name, const std::string &name)
void Notify(OvsdbClientIdl::Op, struct ovsdb_idl_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)
size_t ovsdb_wrapper_physical_port_vlan_binding_count(struct ovsdb_idl_row *row)
void TxnScheduleJsonRpc(struct jsonrpc_msg *msg)
const std::string & name() const
const VlanStatsTable & stats_table() const
PhysicalPortEntry * FindPortEntry(struct ovsdb_idl_row *row)
OvsdbClientIdlPtr client_idl_
struct ovsdb_idl_txn * CreateTxn(OvsdbEntryBase *entry, KSyncEntry::KSyncEvent ack_event=KSyncEntry::ADD_ACK)
VlanLSTable ovs_binding_table_
SandeshResponse * Alloc()
OvsdbClientIdl * client_idl()