6 #include <boost/uuid/uuid_io.hpp>
7 #include <vnc_cfg_types.h>
20 using boost::assign::map_list_of;
21 using boost::assign::list_of;
74 if (
vn !=
vn_.get()) {
107 return std::unique_ptr<DBEntry>(
static_cast<DBEntry *
>(entry));
118 entry->
Copy(
this, data);
127 bool ret = entry->
Copy(
this, data);
135 bool ret = entry->
Copy(
this, data);
151 const std::string &name) {
167 req.
data.reset(NULL);
195 using boost::uuids::nil_uuid;
198 if (vmi == nil_uuid() || dev == nil_uuid() || vn == nil_uuid())
209 using boost::uuids::nil_uuid;
212 if (vmi == nil_uuid() || dev == nil_uuid() || vn == nil_uuid())
218 ConfigTree::iterator it =
220 bool del_entry =
false;
223 else if (it->dev_ != dev)
225 else if (it->vn_ != vn)
249 const std::string &dev,
250 const std::string &vn)
264 if (
vn_str_.empty() ==
false) {
285 resp_ =
new SandeshPhysicalDeviceVnListResp();
295 SandeshPhysicalDeviceVn *data) {
300 data->set_device(
"INVALID");
306 data->set_vn(
"INVALID");
308 data->set_vxlan_id(entry->
vxlan_id());
313 SandeshPhysicalDeviceVnListResp *port_resp =
314 static_cast<SandeshPhysicalDeviceVnListResp *
>(resp);
316 SandeshPhysicalDeviceVn data;
318 std::vector<SandeshPhysicalDeviceVn> &list =
319 const_cast<std::vector<SandeshPhysicalDeviceVn>&
>
320 (port_resp->get_port_list());
321 list.push_back(data);
325 void SandeshPhysicalDeviceVnReq::HandleRequest()
const {
329 sand->DoSandesh(sand);
340 PhysicalDeviceVnObjectLogInfo info;
344 case AgentLogEvent::ADD:
345 str.assign(
"Addition ");
347 case AgentLogEvent::DEL:
348 str.assign(
"Deletion ");
350 case AgentLogEvent::CHANGE:
351 str.assign(
"Modification ");
354 str.assign(
"INVALID");
361 info.set_device(
device_->name());
363 info.set_device(
"INVALID");
367 info.set_vn(
vn_->GetName());
369 info.set_vn(
"INVALID");
372 PHYSICAL_DEVICE_VN_OBJECT_LOG_LOG(
"PhysicalDeviceVn",
373 SandeshLevel::SYS_INFO, info);
382 const string &key,
const string &context) :
387 std::string
Description()
const {
return "ConfigPhysicalDeviceVnSandesh"; }
397 SandeshConfigPhysicalDeviceVnListResp *resp =
398 new SandeshConfigPhysicalDeviceVnListResp();
399 std::vector<SandeshConfigPhysicalDeviceVn> &list =
400 const_cast<std::vector<SandeshConfigPhysicalDeviceVn>&
>
401 (resp->get_device_vn_list());
403 PhysicalDeviceVnTable::ConfigTree::const_iterator it =
406 SandeshConfigPhysicalDeviceVn entry;
410 list.push_back(entry);
414 resp->set_more(
false);
419 void SandeshConfigPhysicalDeviceVnReq::HandleRequest()
const {
424 get_device(), context());
#define AGENT_SANDESH_TASKNAME
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
virtual void Process(DBRequest &req)
virtual bool FilterToArgs(AgentSandeshArguments *args)
boost::uuids::uuid vn_uuid_
boost::uuids::uuid dev_uuid_
AgentPhysicalDeviceVnSandesh(const std::string &context, const std::string &dev, const std::string &vn)
virtual bool Filter(const DBEntryBase *entry)
DBTable * AgentGetTable()
bool Add(const std::string &key, const std::string &val)
std::string GetString(const std::string &key) const
std::string context() const
ConfigManager * config_manager() const
VnTable * vn_table() const
PhysicalDeviceVnTable * physical_device_vn_table() const
PhysicalDeviceTable * physical_device_table() const
TaskScheduler * task_scheduler() const
static Agent * GetInstance()
void AddPhysicalDeviceVn(const boost::uuids::uuid &dev, const boost::uuids::uuid &vn)
void DelPhysicalDeviceVn(const boost::uuids::uuid &dev, const boost::uuids::uuid &vn)
ConfigPhysicalDeviceVnSandesh(Agent *agent, PhysicalDeviceVnTable *table, const string &key, const string &context)
DISALLOW_COPY_AND_ASSIGN(ConfigPhysicalDeviceVnSandesh)
virtual bool Run()
Code to execute in a task. Returns true if task is completed. Return false to reschedule the task.
PhysicalDeviceVnTable * table_
std::string Description() const
Gives a description of the task.
~ConfigPhysicalDeviceVnSandesh()
std::unique_ptr< DBRequestKey > KeyPtr
bool Enqueue(DBRequest *req)
const std::string & name() const
void WalkAgain(DBTableWalkRef walk)
DBTableWalkRef AllocWalker(WalkFn walk_fn, WalkCompleteFn walk_complete)
void ReleaseWalker(DBTableWalkRef &walk)
boost::intrusive_ptr< DBTableWalk > DBTableWalkRef
PhysicalDevice * Find(const boost::uuids::uuid &u)
void UpdateVxLanNetworkIdentifierMode()
DBTable::DBTableWalkRef vxlan_id_walk_ref_
void DeviceVnWalkDone(DBTable::DBTableWalkRef walk_ref, DBTableBase *partition)
virtual bool Resync(DBEntry *entry, const DBRequest *req)
static DBTableBase * CreateTable(DB *db, const std::string &name)
const ConfigTree & config_tree() const
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
bool DeviceVnWalk(DBTablePartBase *partition, DBEntryBase *entry)
void ProcessConfig(const boost::uuids::uuid &dev, const boost::uuids::uuid &vn)
bool DeleteConfigEntry(const boost::uuids::uuid &vmi, const boost::uuids::uuid &dev, const boost::uuids::uuid &vn)
virtual bool OnChange(DBEntry *entry, const DBRequest *req)
PhysicalDeviceVnTable(DB *db, const std::string &name)
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *k) const
virtual DBEntry * Add(const DBRequest *req)
bool AddConfigEntry(const boost::uuids::uuid &vmi, const boost::uuids::uuid &dev, const boost::uuids::uuid &vn)
virtual bool Delete(DBEntry *entry, const DBRequest *req)
virtual bool IFNodeToReq(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
DBEntryBase::KeyPtr GetDBRequestKey() const
uint32_t GetRefCount() const
bool DBEntrySandesh(Sandesh *sresp, std::string &name) const
PhysicalDevice * device() const
boost::uuids::uuid device_uuid_
const boost::uuids::uuid & vn_uuid() const
virtual std::string ToString() const
virtual void SetKey(const DBRequestKey *key)
PhysicalDeviceRef device_
void SendObjectLog(AgentLogEvent::type event) const
boost::uuids::uuid vn_uuid_
virtual bool IsLess(const DBEntry &rhs) const
const boost::uuids::uuid & device_uuid() const
std::string device_display_name_
bool Copy(PhysicalDeviceVnTable *table, const PhysicalDeviceVnData *data)
const IpAddress & ip() const
const std::string & name() const
void Enqueue(Task *task)
Enqueues a task for running. Starts task if all policy rules are met else puts task in waitq....
Task is a class to describe a computational task within OpenSDN control plane applications....
const string & GetName() const
VnEntry * Find(const boost::uuids::uuid &vn_uuid)
static void SetPhysicalDeviceVnSandeshData(const PhysicalDeviceVn *entry, SandeshPhysicalDeviceVn *data)
static boost::uuids::uuid StringToUuid(const std::string &str)
static std::string UuidToString(const boost::uuids::uuid &id)
std::unique_ptr< DBRequestKey > key
std::unique_ptr< DBRequestData > data
boost::uuids::uuid vn_uuid_
boost::uuids::uuid device_uuid_