5 #include <boost/uuid/uuid_io.hpp>
6 #include <vnc_cfg_types.h>
19 using boost::assign::map_list_of;
20 using boost::assign::list_of;
73 if (vn !=
vn_.get()) {
106 return std::unique_ptr<DBEntry>(
static_cast<DBEntry *
>(entry));
117 entry->
Copy(
this, data);
126 bool ret = entry->
Copy(
this, data);
134 bool ret = entry->
Copy(
this, data);
150 const std::string &name) {
166 req.
data.reset(NULL);
194 using boost::uuids::nil_uuid;
197 if (vmi == nil_uuid() || dev == nil_uuid() || vn == nil_uuid())
208 using boost::uuids::nil_uuid;
211 if (vmi == nil_uuid() || dev == nil_uuid() || vn == nil_uuid())
217 ConfigTree::iterator it =
219 bool del_entry =
false;
222 else if (it->dev_ != dev)
224 else if (it->vn_ != vn)
248 const std::string &dev,
249 const std::string &vn)
263 if (
vn_str_.empty() ==
false) {
284 resp_ =
new SandeshPhysicalDeviceVnListResp();
294 SandeshPhysicalDeviceVn *data) {
299 data->set_device(
"INVALID");
305 data->set_vn(
"INVALID");
307 data->set_vxlan_id(entry->
vxlan_id());
312 SandeshPhysicalDeviceVnListResp *port_resp =
313 static_cast<SandeshPhysicalDeviceVnListResp *
>(resp);
315 SandeshPhysicalDeviceVn data;
317 std::vector<SandeshPhysicalDeviceVn> &list =
318 const_cast<std::vector<SandeshPhysicalDeviceVn>&
>
319 (port_resp->get_port_list());
320 list.push_back(data);
324 void SandeshPhysicalDeviceVnReq::HandleRequest()
const {
328 sand->DoSandesh(sand);
339 PhysicalDeviceVnObjectLogInfo info;
343 case AgentLogEvent::ADD:
344 str.assign(
"Addition ");
346 case AgentLogEvent::DEL:
347 str.assign(
"Deletion ");
349 case AgentLogEvent::CHANGE:
350 str.assign(
"Modification ");
353 str.assign(
"INVALID");
360 info.set_device(
device_->name());
362 info.set_device(
"INVALID");
366 info.set_vn(
vn_->GetName());
368 info.set_vn(
"INVALID");
371 PHYSICAL_DEVICE_VN_OBJECT_LOG_LOG(
"PhysicalDeviceVn",
372 SandeshLevel::SYS_INFO, info);
381 const string &key,
const string &context) :
386 std::string
Description()
const {
return "ConfigPhysicalDeviceVnSandesh"; }
396 SandeshConfigPhysicalDeviceVnListResp *resp =
397 new SandeshConfigPhysicalDeviceVnListResp();
398 std::vector<SandeshConfigPhysicalDeviceVn> &list =
399 const_cast<std::vector<SandeshConfigPhysicalDeviceVn>&
>
400 (resp->get_device_vn_list());
402 PhysicalDeviceVnTable::ConfigTree::const_iterator it =
405 SandeshConfigPhysicalDeviceVn entry;
409 list.push_back(entry);
413 resp->set_more(
false);
418 void SandeshConfigPhysicalDeviceVnReq::HandleRequest()
const {
423 get_device(), context());
DBTable::DBTableWalkRef vxlan_id_walk_ref_
AgentPhysicalDeviceVnSandesh(const std::string &context, const std::string &dev, const std::string &vn)
virtual bool Run()
Code to execute. Returns true if task is completed. Return false to reschedule the task...
void DeviceVnWalkDone(DBTable::DBTableWalkRef walk_ref, DBTableBase *partition)
const boost::uuids::uuid & vn_uuid() const
void ProcessConfig(const boost::uuids::uuid &dev, const boost::uuids::uuid &vn)
static Agent * GetInstance()
static boost::uuids::uuid StringToUuid(const std::string &str)
std::string device_display_name_
std::string GetString(const std::string &key) const
PhysicalDeviceTable * physical_device_table() const
~ConfigPhysicalDeviceVnSandesh()
ConfigManager * config_manager() const
DBEntryBase::KeyPtr GetDBRequestKey() const
virtual DBEntry * Add(const DBRequest *req)
std::unique_ptr< DBRequestData > data
DBTableWalkRef AllocWalker(WalkFn walk_fn, WalkCompleteFn walk_complete)
bool Enqueue(DBRequest *req)
VnTable * vn_table() const
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *k) const
void AddPhysicalDeviceVn(const boost::uuids::uuid &dev, const boost::uuids::uuid &vn)
std::string Description() const
static std::string UuidToString(const boost::uuids::uuid &id)
bool DeviceVnWalk(DBTablePartBase *partition, DBEntryBase *entry)
std::unique_ptr< DBRequestKey > KeyPtr
boost::uuids::uuid vn_uuid_
const IpAddress & ip() const
void ReleaseWalker(DBTableWalkRef &walk)
bool DBEntrySandesh(Sandesh *sresp, std::string &name) const
virtual std::string ToString() const
PhysicalDevice * device() const
PhysicalDevice * Find(const boost::uuids::uuid &u)
void WalkAgain(DBTableWalkRef walk)
ConfigPhysicalDeviceVnSandesh(Agent *agent, PhysicalDeviceVnTable *table, const string &key, const string &context)
TaskScheduler * task_scheduler() const
PhysicalDeviceRef device_
PhysicalDeviceVnTable * table_
void Enqueue(Task *task)
Enqueues a task for running. Starts task if all policy rules are met else puts task in waitq...
boost::uuids::uuid device_uuid_
std::unique_ptr< DBRequestKey > key
virtual bool Filter(const DBEntryBase *entry)
void SendObjectLog(AgentLogEvent::type event) const
PhysicalDeviceVnTable * physical_device_vn_table() const
bool Copy(PhysicalDeviceVnTable *table, const PhysicalDeviceVnData *data)
virtual bool IFNodeToReq(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
virtual void Process(DBRequest &req)
DBTable * AgentGetTable()
bool Add(const std::string &key, const std::string &val)
void UpdateVxLanNetworkIdentifierMode()
static void SetPhysicalDeviceVnSandeshData(const PhysicalDeviceVn *entry, SandeshPhysicalDeviceVn *data)
const ConfigTree & config_tree() const
VnEntry * Find(const boost::uuids::uuid &vn_uuid)
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
bool AddConfigEntry(const boost::uuids::uuid &vmi, const boost::uuids::uuid &dev, const boost::uuids::uuid &vn)
virtual void SetKey(const DBRequestKey *key)
virtual bool OnChange(DBEntry *entry, const DBRequest *req)
virtual bool Delete(DBEntry *entry, const DBRequest *req)
uint32_t GetRefCount() const
const std::string & name() const
virtual bool IsLess(const DBEntry &rhs) const
virtual bool FilterToArgs(AgentSandeshArguments *args)
virtual bool Resync(DBEntry *entry, const DBRequest *req)
#define AGENT_SANDESH_TASKNAME
boost::uuids::uuid device_uuid_
void DelPhysicalDeviceVn(const boost::uuids::uuid &dev, const boost::uuids::uuid &vn)
const string & GetName() const
boost::uuids::uuid dev_uuid_
boost::intrusive_ptr< DBTableWalk > DBTableWalkRef
DISALLOW_COPY_AND_ASSIGN(ConfigPhysicalDeviceVnSandesh)
bool DeleteConfigEntry(const boost::uuids::uuid &vmi, const boost::uuids::uuid &dev, const boost::uuids::uuid &vn)
Task is a wrapper over tbb::task to support policies.
std::string context() const
static DBTableBase * CreateTable(DB *db, const std::string &name)
const boost::uuids::uuid & device_uuid() const
boost::uuids::uuid vn_uuid_
boost::uuids::uuid vn_uuid_
PhysicalDeviceVnTable(DB *db, const std::string &name)