5 #include <boost/uuid/uuid_io.hpp> 
    6 #include <vnc_cfg_types.h> 
   24 #include <multicast_types.h> 
   27 using boost::assign::map_list_of;
 
   28 using boost::assign::list_of;
 
   47     if (strcasecmp(proto.c_str(), 
"ovs"))
 
   76     bool ip_updated = 
false;
 
  131     return std::unique_ptr<DBEntry>(
static_cast<DBEntry *
>(dev));
 
  139     dev->
Copy(
this, data);
 
  149     bool ret = dev->
Copy(
this, data);
 
  196                                      const autogen::PhysicalRouter *router) {
 
  197     boost::system::error_code ec;
 
  200     ip = IpAddress::from_string(router->dataplane_ip(), ec);
 
  201     mip = IpAddress::from_string(router->management_ip(), ec);
 
  203                                   router->vendor_name(), ip, mip, 
"OVS", node);
 
  207     autogen::PhysicalRouter *router = 
static_cast <autogen::PhysicalRouter *
> 
  209     autogen::IdPermsType id_perms = router->id_perms();
 
  210     CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong, u);
 
  216     autogen::PhysicalRouter *router = 
static_cast <autogen::PhysicalRouter *
> 
  235     autogen::PhysicalRouter *router = 
static_cast <autogen::PhysicalRouter *
> 
  265         resp_ = 
new SandeshDeviceListResp();
 
  270                                       SandeshDevice *data) {
 
  272     data->set_fq_name(entry->
fq_name());
 
  273     data->set_name(entry->
name());
 
  274     data->set_vendor(entry->
vendor());
 
  275     data->set_ip_address(entry->
ip().to_string());
 
  277     data->set_master(entry->
master());
 
  282     SandeshDeviceListResp *dev_resp =
 
  283         static_cast<SandeshDeviceListResp *
> (resp);
 
  289         std::vector<SandeshDevice> &list =
 
  290             const_cast<std::vector<SandeshDevice>&
> 
  291             (dev_resp->get_device_list());
 
  292         list.push_back(data);
 
  299 void SandeshDeviceReq::HandleRequest()
 const {
 
  301     sand->DoSandesh(sand);
 
  310     DeviceObjectLogInfo info;
 
  314         case AgentLogEvent::ADD:
 
  315             str.assign(
"Addition ");
 
  317         case AgentLogEvent::DEL:
 
  318             str.assign(
"Deletion ");
 
  320         case AgentLogEvent::CHANGE:
 
  321             str.assign(
"Modification ");
 
  324             str.assign(
"INVALID");
 
  331     info.set_name(
name_);
 
  333     info.set_ip_address(
ip_.to_string());
 
  336     DEVICE_OBJECT_LOG_LOG(
"Device", SandeshLevel::SYS_INFO, info);
 
  342     if (!new_ip.is_unspecified()) {
 
  343         IpToDeviceMap::iterator it = 
ip_tree_.find(new_ip);
 
  351     if (!ip.is_unspecified()) {
 
  352         IpToDeviceMap::iterator it = 
ip_tree_.find(ip);
 
  360     if (!ip.is_unspecified()) {
 
  361         IpToDeviceMap::iterator it = 
ip_tree_.find(ip);
 
  381                                               const std::string &vrf) {
 
  389     VrfSet &vrf_set = it->second;
 
  390     VrfSet::iterator vit = vrf_set.find(vrf);
 
  391     if (vit == vrf_set.end()) {
 
  401                                                  const std::string &vrf) {
 
  406     VrfSet &vrf_set = it->second;
 
  407     VrfSet::iterator vit = vrf_set.find(vrf);
 
  408     if (vit == vrf_set.end()) {
 
  413     if (vrf_set.size() == 1) {
 
  422                                                 const std::string &vrf) {
 
  448         PhysicalDeviceSet::iterator pit = dev_set.begin();
 
  449         while (pit != dev_set.end()) {
 
  457     ComponentNHList::const_iterator comp_nh_it = clist.begin();
 
  458     for(;comp_nh_it != clist.end(); comp_nh_it++) {
 
  459         if ((*comp_nh_it) == NULL) {
 
  467             ((*comp_nh_it)->nh());
 
  482         new_set.insert(dev->
uuid());
 
  494     PhysicalDeviceSet::iterator pit = dev_set.begin();
 
  495     while (pit != dev_set.end()) {
 
  498         PhysicalDeviceSet::iterator dit = new_set.find(u);
 
  499         if (dit == new_set.end()) {
 
  507     it->second = new_set;
 
  510 void MasterPhysicalDevicesReq::HandleRequest()
 const {
 
  511     MasterPhysicalDevicesResp *resp = 
new MasterPhysicalDevicesResp();
 
  512     resp->set_context(context());
 
  518     PhysicalDeviceTable::PhysicalDeviceSet::const_iterator it =
 
  520     std::vector<PDeviceData> list;
 
  521     while (it != dev_list.end()) {
 
  523         data.set_uuid(to_string(*it));
 
  524         list.push_back(data);
 
  527     resp->set_dev_list(list);
 
  528     resp->set_more(
false);
 
boost::asio::ip::address IpAddress
static void CfgUuidSet(uint64_t ms_long, uint64_t ls_long, boost::uuids::uuid &u)
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
AgentDBEntry * FindActiveEntry(const DBEntry *key)
std::string GetString(const std::string &key) const
std::string context() const
ConfigManager * config_manager() const
PhysicalDeviceTable * physical_device_table() const
static Agent * GetInstance()
void AddPhysicalDeviceNode(IFMapNode *node)
std::unique_ptr< DBRequestKey > KeyPtr
bool Enqueue(DBRequest *req)
const std::string & name() const
DBTable * AgentGetTable()
DeviceSandesh(std::string context, const std::string &name)
const std::string & name() const
IFMapObject * GetObject()
void ResetDeviceMastership(const boost::uuids::uuid &u, const std::string &vrf)
virtual bool IFNodeToReq(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
VrfDevicesMap vrf2devices_map_
void AddDeviceToVrfEntry(const boost::uuids::uuid &u, const std::string &vrf)
std::set< boost::uuids::uuid > PhysicalDeviceSet
std::pair< const std::string, PhysicalDeviceSet > VrfDevicesPair
std::pair< const boost::uuids::uuid, VrfSet > DeviceVrfPair
void RegisterDBClients(IFMapDependencyManager *dep)
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *k) const
PhysicalDevice * IpToPhysicalDevice(IpAddress ip)
PhysicalDevice * Find(const boost::uuids::uuid &u)
void DeleteIpToDevEntry(IpAddress ip)
virtual bool OperDBOnChange(DBEntry *entry, const DBRequest *req)
PhysicalDeviceSet managed_pd_set_
static DBTableBase * CreateTable(DB *db, const std::string &name)
std::pair< IpAddress, PhysicalDevice * > IpToDevicePair
virtual bool OperDBResync(DBEntry *entry, const DBRequest *req)
void UpdateIpToDevMap(IpAddress old, IpAddress new_ip, PhysicalDevice *p)
DeviceVrfMap device2vrf_map_
void UpdateDeviceMastership(const std::string &vrf, ComponentNHList clist, bool del)
virtual bool IFNodeToUuid(IFMapNode *node, boost::uuids::uuid &u)
std::set< std::string > VrfSet
virtual bool OperDBDelete(DBEntry *entry, const DBRequest *req)
const PhysicalDeviceSet & managed_pd_set() const
virtual DBEntry * OperDBAdd(const DBRequest *req)
bool RemoveDeviceToVrfEntry(const boost::uuids::uuid &u, const std::string &vrf)
PhysicalDeviceTable(DB *db, const std::string &name)
void EnqueueDeviceChange(const boost::uuids::uuid &u, bool master)
bool ProcessConfig(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
const boost::uuids::uuid & uuid() const
const IpAddress & ip() const
bool Copy(PhysicalDeviceTable *table, const PhysicalDeviceData *data)
ManagementProtocol protocol_
bool DBEntrySandesh(Sandesh *resp, std::string &name) const
const std::string & name() const
virtual std::string ToString() const
virtual void SetKey(const DBRequestKey *key)
uint32_t GetRefCount() const
ManagementProtocol protocol() const
virtual KeyPtr GetDBRequestKey() const
const std::string & fq_name() const
void SendObjectLog(AgentLogEvent::type event) const
void set_master(bool value)
virtual bool IsLess(const DBEntry &rhs) const
const std::string & vendor() const
const Ip4Address * GetDip() const
std::vector< ComponentNHPtr > ComponentNHList
static PhysicalDeviceData * BuildData(Agent *agent, IFMapNode *node, const autogen::PhysicalRouter *router)
static PhysicalDeviceKey * BuildKey(const autogen::PhysicalRouter *router, const boost::uuids::uuid &u)
static PhysicalDevice::ManagementProtocol FromString(const string &proto)
static void SetDeviceSandeshData(const PhysicalDevice *entry, SandeshDevice *data)
static string ToString(PhysicalDevice::ManagementProtocol proto)
static std::string UuidToString(const boost::uuids::uuid &id)
std::unique_ptr< DBRequestKey > key
std::unique_ptr< DBRequestData > data