9 using boost::uuids::nil_uuid;
15 : uve_prouter_map_(), uve_phy_interface_map_(), agent_(agent),
16 physical_device_listener_id_(
DBTableBase::kInvalidId),
18 pr_timer_last_visited_(nil_uuid()),
20 (*(agent->event_manager())->io_service(),
23 pi_timer_last_visited_(
""),
25 (*(agent->event_manager())->io_service(),
28 li_timer_last_visited_(nil_uuid()),
30 (*(agent->event_manager())->io_service(),
67 UveProuterMap::iterator prev = it;
113 string cfg_name = it->first;
114 UvePhyInterfaceMap::iterator prev = it;
160 LogicalInterfaceMap::iterator prev = it;
194 if (time != timer->
time()) {
201 uuid_(pintf->
GetUuid()), logical_interface_set_(), changed_(
true),
202 deleted_(
false), renewed_(
false) {
210 name_(p->name()), uuid_(p->
uuid()), physical_interface_set_(),
211 changed_(true), deleted_(false), renewed_(false), mastership_(p->master()) {
216 vmi_list_(), changed_(
true), deleted_(
false), renewed_(
false) {
225 vlan_ = vlif->
vlan();
236 physical_interface_set_.clear();
237 logical_interface_set_.clear();
244 InterfaceSet::iterator it = physical_interface_set_.find(itf->
name());
245 if (it == physical_interface_set_.end()) {
246 physical_interface_set_.insert(itf->
name());
253 InterfaceSet::iterator it = physical_interface_set_.find(itf->
name());
254 if (it != physical_interface_set_.end()) {
255 physical_interface_set_.erase(it);
262 LogicalInterfaceSet::iterator it = logical_interface_set_.find
264 if (it == logical_interface_set_.end()) {
265 logical_interface_set_.insert(itf->
GetUuid());
271 bool deleted =
false;
272 LogicalInterfaceSet::iterator it = logical_interface_set_.find(itf->
274 if (it != logical_interface_set_.end()) {
275 logical_interface_set_.erase(it);
293 return it->second.get();
300 return it->second.get();
333 (vector<string> &vmi_list)
const {
334 ProuterUveTable::InterfaceSet::iterator vit = vmi_list_.begin();
335 while (vit != vmi_list_.end()) {
336 vmi_list.push_back((*vit));
343 (vector<string> &list)
const {
344 ProuterUveTable::LogicalInterfaceSet::iterator it =
345 logical_interface_set_.begin();
346 while (it != logical_interface_set_.end()) {
347 list.push_back((to_string(*it)));
354 ProuterData *uve)
const {
355 vector<string> phy_if_list;
356 vector<string> logical_list;
357 vector<string> empty_agent_list;
361 uve->set_name(entry->
name_);
362 uve->set_uuid(to_string(entry->
uuid_));
366 phy_if_list.push_back(*pit);
369 uve->set_physical_interface_list(phy_if_list);
376 logical_list.push_back(to_string(*lit));
379 uve->set_logical_interface_list(logical_list);
381 vector<string> agent_list;
384 uve->set_tsn_agent_list(agent_list);
386 uve->set_connected_agent_list(agent_list);
391 uve->set_tsn_agent_list(empty_agent_list);
393 uve->set_connected_agent_list(empty_agent_list);
396 vnsConstants vnsVrouterType;
398 uve->set_gateway_mode(vnsVrouterType.VrouterAgentGatewayModeMap.at
399 (VrouterAgentGatewayMode::VCPE));
402 uve->set_gateway_mode(vnsVrouterType.VrouterAgentGatewayModeMap.at
403 (VrouterAgentGatewayMode::SERVER));
405 uve->set_gateway_mode(vnsVrouterType.VrouterAgentGatewayModeMap.at
419 uve.set_name(e->
name_);
420 uve.set_deleted(
true);
439 UveProuterAgent::Send(uve);
443 vector<string> plist;
447 plist.push_back(entry->
name_);
456 pair<UveProuterMap::iterator, bool> ret;
458 UveProuterMap::iterator it = ret.first;
511 entry = it->second.get();
525 ientry = entry.get();
527 ientry = it->second.get();
632 if (u == nil_uuid()) {
653 entry = it->second.get();
678 ProuterUveTable::InterfaceSet::iterator vit = entry->
vmi_list_.find
721 const Interface *physical_interface = NULL;
775 pde_uuid = pde->
uuid();
778 if (physical_interface) {
779 pname = physical_interface->
name();
787 if (physical_interface) {
797 if (!physical_interface && pde) {
841 UveLogicalInterfaceAgent uve;
842 uve.set_name(config_name);
843 uve.set_deleted(
true);
849 UveLogicalInterfaceAgent uve;
852 uve.set_name(to_string(u));
853 uve.set_config_name(entry->
name_);
854 uve.set_vlan(entry->
vlan_);
857 uve.set_vm_interface_list(list);
863 (
const UveLogicalInterfaceAgent &uve) {
864 UveLogicalInterfaceAgentTrace::Send(uve);
868 UvePhysicalInterfaceAgent uve;
869 uve.set_name(cfg_name);
870 uve.set_deleted(
true);
876 UvePhysicalInterfaceAgent uve;
879 uve.set_name(cfg_name);
880 uve.set_uuid(to_string(entry->
uuid_));
883 uve.set_logical_interface_list(list);
889 (
const UvePhysicalInterfaceAgent &uve) {
890 UvePhysicalInterfaceAgentTrace::Send(uve);
897 string status =
" false";
899 status.assign(
" true");
901 string msg =
"Mastership update failed for " + to_string(u) + status;
void VMInterfaceRemove(const boost::uuids::uuid &li, const VmInterface *vmi)
virtual void DispatchProuterMsg(const ProuterData &uve)
uint32_t incremental_interval() const
VrouterUveEntryBase * vrouter_uve_entry() const
PhysicalDevice * physical_device() const
virtual void DispatchPhysicalInterfaceMsg(const UvePhysicalInterfaceAgent &uve)
void MarkPhysicalDeviceChanged(const PhysicalDevice *pde)
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
void SendPhysicalInterfaceDeleteMsg(const std::string &cfg_name)
LogicalInterfaceSet logical_interface_set_
DBState * GetState(DBTableBase *tbl_base, ListenerId listener) const
boost::shared_ptr< ProuterUveEntry > ProuterUveEntryPtr
uint32_t default_interval() const
bool tor_agent_enabled() const
const PhysicalDevice * InterfaceToProuter(const Interface *intf)
const boost::uuids::uuid & GetUuid() const
void AddLogicalInterface(const LogicalInterface *itf)
void SendLogicalInterfaceDeleteMsg(const std::string &config_name)
boost::uuids::uuid pr_timer_last_visited_
AgentUveBase * uve() const
void DeleteHandler(const PhysicalDevice *p)
PhysicalDeviceTable * physical_device_table() const
std::pair< std::string, PhyInterfaceUveEntryPtr > UvePhyInterfacePair
void SetState(DBTableBase *tbl_base, ListenerId listener, DBState *state)
void Update(const Interface *pintf)
void SendLogicalInterfaceMsg(const boost::uuids::uuid &u, LogicalInterfaceUveEntry *entry)
#define PROUTER_UVE_TRACE(...)
bool pbb_gateway_mode() const
static const uint32_t kUveCountPerTimer
AgentDBEntry * FindActiveEntry(const DBEntry *key)
InterfaceTable * interface_table() const
Interface * physical_interface() const
static const uint16_t kInvalidVlanId
ProuterUveTable(Agent *agent, uint32_t default_intvl)
const boost::uuids::uuid & uuid() const
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
SandeshTraceBufferPtr ProuterUveTraceBuf
void MarkDeletedLogical(const LogicalInterface *pintf)
void InterfaceNotify(DBTablePartBase *partition, DBEntryBase *e)
boost::shared_ptr< LogicalInterfaceUveEntry > LogicalInterfaceUveEntryPtr
void Unregister(ListenerId listener)
void TimerCleanup(Timer *timer)
void UpdateMastership(const boost::uuids::uuid &u, bool value)
bool server_gateway_mode() const
ListenerId Register(ChangeCallback callback, const std::string &name="unspecified")
std::pair< boost::uuids::uuid, ProuterUveEntryPtr > UveProuterPair
UveProuterMap uve_prouter_map_
ProuterUveEntry * PDEntryToProuterUveEntry(const boost::uuids::uuid &u) const
void AddUpdatePhysicalInterface(const Interface *intf)
ProuterUveEntry * AddHandler(const PhysicalDevice *p)
UvePhyInterfaceMap uve_phy_interface_map_
void FillVmInterfaceList(std::vector< std::string > &vmi_list) const
void DeletePhysicalInterface(const Interface *itf)
DBTableBase::ListenerId interface_listener_id_
void DeletePhysicalFromProuter(const Interface *i, const boost::uuids::uuid &u)
const Interface * NameToInterface(const std::string &name) const
bool vcpe_gateway_mode() const
void MarkDeletedPhysical(const Interface *pintf)
PhysicalDevice * physical_device() const
void Update(const LogicalInterface *li)
void AddPhysicalInterface(const Interface *itf)
void FillLogicalInterfaceList(std::vector< std::string > &list) const
boost::uuids::uuid li_timer_last_visited_
boost::uuids::uuid logical_interface_
void AddUpdateLogicalInterface(const LogicalInterface *i)
boost::uuids::uuid physical_device_
const std::string & agent_name() const
void PhysicalDeviceNotify(DBTablePartBase *partition, DBEntryBase *e)
void ClearState(DBTableBase *tbl_base, ListenerId listener)
DBTableBase::ListenerId physical_device_listener_id_
void SendPhysicalInterfaceMsg(const std::string &name, PhyInterfaceUveEntry *entry)
void DeleteLogicalFromPhysical(const std::string &name, const LogicalInterface *i)
std::pair< boost::uuids::uuid, LogicalInterfaceUveEntryPtr > LogicalInterfacePair
const boost::uuids::uuid & logical_interface() const
bool DeleteLogicalInterface(const LogicalInterface *itf)
void set_expiry_time(int time, Timer *timer)
void PhysicalInterfaceHandler(const Interface *i, const boost::uuids::uuid &u)
void SendProuterVrouterAssociation()
boost::shared_ptr< PhyInterfaceUveEntry > PhyInterfaceUveEntryPtr
void SendProuterDeleteMsg(ProuterUveEntry *e)
void VmInterfaceHandler(DBTablePartBase *partition, DBEntryBase *e)
bool Start(int time, Handler handler, ErrorHandler error_handler=NULL)
void SendVrouterProuterAssociation(const std::vector< std::string > &list)
void FrameProuterMsg(ProuterUveEntry *entry, ProuterData *uve) const
const std::string & cfg_name() const
static const int kInvalidId
PhyInterfaceUveEntry * NameToPhyInterfaceUveEntry(const std::string &name) const
bool SendProuterMsg(ProuterUveEntry *entry)
const std::string & name() const
InterfaceSet physical_interface_set_
PhysicalDevice * physical_device() const
LogicalInterfaceMap uve_logical_interface_map_
LogicalInterfaceSet logical_interface_set_
bool Reschedule(int time)
void VMInterfaceAdd(const VmInterface *vmi)
virtual void DispatchLogicalInterfaceMsg(const UveLogicalInterfaceAgent &u)
std::string pi_timer_last_visited_
void SendProuterMsgFromPhyInterface(const Interface *pi)
void DeleteProuterLogicalInterface(const boost::uuids::uuid &u, const LogicalInterface *intf)
std::string physical_interface_
ProuterUveEntry(const PhysicalDevice *p)
PhyInterfaceUveEntry(const Interface *pintf)
ProuterUveEntryPtr Allocate(const PhysicalDevice *pr)
void AddLogicalToPhysical(const Interface *p, const LogicalInterface *i)
LogicalInterfaceUveEntry(const LogicalInterface *li)
void AddProuterLogicalInterface(const PhysicalDevice *p, const LogicalInterface *intf)
virtual ~ProuterUveTable()
SandeshTraceBufferPtr SandeshTraceBufferCreate(const std::string &buf_name, size_t buf_size, bool trace_enable=true)
static bool DeleteTimer(Timer *Timer)