10 using boost::uuids::nil_uuid;
16 : uve_prouter_map_(), uve_phy_interface_map_(), agent_(agent),
17 physical_device_listener_id_(
DBTableBase::kInvalidId),
19 pr_timer_last_visited_(nil_uuid()),
21 (*(agent->event_manager())->io_service(),
24 pi_timer_last_visited_(
""),
26 (*(agent->event_manager())->io_service(),
29 li_timer_last_visited_(nil_uuid()),
31 (*(agent->event_manager())->io_service(),
68 UveProuterMap::iterator prev = it;
114 string cfg_name = it->first;
115 UvePhyInterfaceMap::iterator prev = it;
161 LogicalInterfaceMap::iterator prev = it;
195 if (time != timer->
time()) {
202 uuid_(pintf->GetUuid()), logical_interface_set_(), changed_(true),
203 deleted_(false), renewed_(false) {
211 name_(p->name()), uuid_(p->
uuid()), physical_interface_set_(),
212 changed_(true), deleted_(false), renewed_(false), mastership_(p->master()) {
217 vmi_list_(), changed_(true), deleted_(false), renewed_(false) {
226 vlan_ = vlif->
vlan();
237 physical_interface_set_.clear();
238 logical_interface_set_.clear();
245 InterfaceSet::iterator it = physical_interface_set_.find(itf->
name());
246 if (it == physical_interface_set_.end()) {
247 physical_interface_set_.insert(itf->
name());
254 InterfaceSet::iterator it = physical_interface_set_.find(itf->
name());
255 if (it != physical_interface_set_.end()) {
256 physical_interface_set_.erase(it);
263 LogicalInterfaceSet::iterator it = logical_interface_set_.find
265 if (it == logical_interface_set_.end()) {
266 logical_interface_set_.insert(itf->
GetUuid());
272 bool deleted =
false;
273 LogicalInterfaceSet::iterator it = logical_interface_set_.find(itf->
275 if (it != logical_interface_set_.end()) {
276 logical_interface_set_.erase(it);
294 return it->second.get();
301 return it->second.get();
334 (vector<string> &vmi_list)
const {
335 ProuterUveTable::InterfaceSet::iterator vit = vmi_list_.begin();
336 while (vit != vmi_list_.end()) {
337 vmi_list.push_back((*vit));
344 (vector<string> &list)
const {
345 ProuterUveTable::LogicalInterfaceSet::iterator it =
346 logical_interface_set_.begin();
347 while (it != logical_interface_set_.end()) {
348 list.push_back((to_string(*it)));
355 ProuterData *uve)
const {
356 vector<string> phy_if_list;
357 vector<string> logical_list;
358 vector<string> empty_agent_list;
362 uve->set_name(entry->
name_);
363 uve->set_uuid(to_string(entry->
uuid_));
367 phy_if_list.push_back(*pit);
370 uve->set_physical_interface_list(phy_if_list);
377 logical_list.push_back(to_string(*lit));
380 uve->set_logical_interface_list(logical_list);
382 vector<string> agent_list;
385 uve->set_tsn_agent_list(agent_list);
387 uve->set_connected_agent_list(agent_list);
392 uve->set_tsn_agent_list(empty_agent_list);
394 uve->set_connected_agent_list(empty_agent_list);
397 vnsConstants vnsVrouterType;
399 uve->set_gateway_mode(vnsVrouterType.VrouterAgentGatewayModeMap.at
400 (VrouterAgentGatewayMode::VCPE));
403 uve->set_gateway_mode(vnsVrouterType.VrouterAgentGatewayModeMap.at
404 (VrouterAgentGatewayMode::SERVER));
406 uve->set_gateway_mode(vnsVrouterType.VrouterAgentGatewayModeMap.at
420 uve.set_name(e->
name_);
421 uve.set_deleted(
true);
440 UveProuterAgent::Send(uve);
444 vector<string> plist;
448 plist.push_back(entry->
name_);
457 pair<UveProuterMap::iterator, bool> ret;
459 UveProuterMap::iterator it = ret.first;
512 entry = it->second.get();
526 ientry = entry.get();
528 ientry = it->second.get();
633 if (u == nil_uuid()) {
654 entry = it->second.get();
679 ProuterUveTable::InterfaceSet::iterator vit = entry->
vmi_list_.find
722 const Interface *physical_interface = NULL;
776 pde_uuid = pde->
uuid();
779 if (physical_interface) {
780 pname = physical_interface->
name();
788 if (physical_interface) {
798 if (!physical_interface && pde) {
842 UveLogicalInterfaceAgent uve;
843 uve.set_name(config_name);
844 uve.set_deleted(
true);
850 UveLogicalInterfaceAgent uve;
853 uve.set_name(to_string(u));
854 uve.set_config_name(entry->
name_);
855 uve.set_vlan(entry->
vlan_);
858 uve.set_vm_interface_list(list);
864 (
const UveLogicalInterfaceAgent &uve) {
865 UveLogicalInterfaceAgentTrace::Send(uve);
869 UvePhysicalInterfaceAgent uve;
870 uve.set_name(cfg_name);
871 uve.set_deleted(
true);
877 UvePhysicalInterfaceAgent uve;
880 uve.set_name(cfg_name);
881 uve.set_uuid(to_string(entry->
uuid_));
884 uve.set_logical_interface_list(list);
890 (
const UvePhysicalInterfaceAgent &uve) {
891 UvePhysicalInterfaceAgentTrace::Send(uve);
898 string status =
" false";
900 status.assign(
" true");
902 string msg =
"Mastership update failed for " + to_string(u) + status;
AgentDBEntry * FindActiveEntry(const DBEntry *key)
static const uint32_t kUveCountPerTimer
uint32_t incremental_interval() const
VrouterUveEntryBase * vrouter_uve_entry() const
uint32_t default_interval() const
InterfaceTable * interface_table() const
bool pbb_gateway_mode() const
const std::string & agent_name() const
AgentUveBase * uve() const
bool vcpe_gateway_mode() const
PhysicalDeviceTable * physical_device_table() const
bool server_gateway_mode() const
bool tor_agent_enabled() const
DBState * GetState(DBTableBase *tbl_base, ListenerId listener) const
void ClearState(DBTableBase *tbl_base, ListenerId listener)
void SetState(DBTableBase *tbl_base, ListenerId listener, DBState *state)
ListenerId Register(ChangeCallback callback, const std::string &name="unspecified")
static const int kInvalidId
void Unregister(ListenerId listener)
const std::string & name() const
const boost::uuids::uuid & GetUuid() const
PhysicalDevice * physical_device() const
Interface * physical_interface() const
const boost::uuids::uuid & uuid() const
PhysicalDevice * physical_device() const
void DeleteHandler(const PhysicalDevice *p)
boost::shared_ptr< PhyInterfaceUveEntry > PhyInterfaceUveEntryPtr
const PhysicalDevice * InterfaceToProuter(const Interface *intf)
boost::uuids::uuid pr_timer_last_visited_
ProuterUveEntry * AddHandler(const PhysicalDevice *p)
void FrameProuterMsg(ProuterUveEntry *entry, ProuterData *uve) const
void MarkDeletedPhysical(const Interface *pintf)
ProuterUveEntry * PDEntryToProuterUveEntry(const boost::uuids::uuid &u) const
void AddProuterLogicalInterface(const PhysicalDevice *p, const LogicalInterface *intf)
std::pair< boost::uuids::uuid, ProuterUveEntryPtr > UveProuterPair
bool SendProuterMsg(ProuterUveEntry *entry)
DBTableBase::ListenerId interface_listener_id_
boost::uuids::uuid li_timer_last_visited_
std::pair< std::string, PhyInterfaceUveEntryPtr > UvePhyInterfacePair
void InterfaceNotify(DBTablePartBase *partition, DBEntryBase *e)
UveProuterMap uve_prouter_map_
LogicalInterfaceMap uve_logical_interface_map_
void VmInterfaceHandler(DBTablePartBase *partition, DBEntryBase *e)
void AddUpdateLogicalInterface(const LogicalInterface *i)
boost::shared_ptr< LogicalInterfaceUveEntry > LogicalInterfaceUveEntryPtr
void SendProuterDeleteMsg(ProuterUveEntry *e)
void set_expiry_time(int time, Timer *timer)
static const uint16_t kInvalidVlanId
DBTableBase::ListenerId physical_device_listener_id_
void MarkDeletedLogical(const LogicalInterface *pintf)
ProuterUveTable(Agent *agent, uint32_t default_intvl)
boost::shared_ptr< ProuterUveEntry > ProuterUveEntryPtr
void SendLogicalInterfaceDeleteMsg(const std::string &config_name)
void SendPhysicalInterfaceMsg(const std::string &name, PhyInterfaceUveEntry *entry)
void MarkPhysicalDeviceChanged(const PhysicalDevice *pde)
virtual ~ProuterUveTable()
virtual void DispatchProuterMsg(const ProuterData &uve)
void AddLogicalToPhysical(const Interface *p, const LogicalInterface *i)
void TimerCleanup(Timer *timer)
void PhysicalDeviceNotify(DBTablePartBase *partition, DBEntryBase *e)
ProuterUveEntryPtr Allocate(const PhysicalDevice *pr)
void UpdateMastership(const boost::uuids::uuid &u, bool value)
PhyInterfaceUveEntry * NameToPhyInterfaceUveEntry(const std::string &name) const
void DeletePhysicalFromProuter(const Interface *i, const boost::uuids::uuid &u)
virtual void DispatchPhysicalInterfaceMsg(const UvePhysicalInterfaceAgent &uve)
std::pair< boost::uuids::uuid, LogicalInterfaceUveEntryPtr > LogicalInterfacePair
virtual void DispatchLogicalInterfaceMsg(const UveLogicalInterfaceAgent &u)
void SendProuterVrouterAssociation()
void SendLogicalInterfaceMsg(const boost::uuids::uuid &u, LogicalInterfaceUveEntry *entry)
std::string pi_timer_last_visited_
void VMInterfaceAdd(const VmInterface *vmi)
void DeleteLogicalFromPhysical(const std::string &name, const LogicalInterface *i)
void DeleteProuterLogicalInterface(const boost::uuids::uuid &u, const LogicalInterface *intf)
void SendProuterMsgFromPhyInterface(const Interface *pi)
UvePhyInterfaceMap uve_phy_interface_map_
void SendPhysicalInterfaceDeleteMsg(const std::string &cfg_name)
void PhysicalInterfaceHandler(const Interface *i, const boost::uuids::uuid &u)
const Interface * NameToInterface(const std::string &name) const
void VMInterfaceRemove(const boost::uuids::uuid &li, const VmInterface *vmi)
void AddUpdatePhysicalInterface(const Interface *intf)
PhysicalDevice * physical_device() const
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
static bool DeleteTimer(Timer *Timer)
bool Start(int time, Handler handler, ErrorHandler error_handler=NULL)
bool Reschedule(int time)
const boost::uuids::uuid & logical_interface() const
const std::string & cfg_name() const
void SendVrouterProuterAssociation(const std::vector< std::string > &list)
SandeshTraceBufferPtr ProuterUveTraceBuf(SandeshTraceBufferCreate("ProuterUve", 500))
#define PROUTER_UVE_TRACE(...)
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
SandeshTraceBufferPtr SandeshTraceBufferCreate(const std::string &buf_name, size_t buf_size, bool trace_enable=true)
void FillVmInterfaceList(std::vector< std::string > &vmi_list) const
void Update(const LogicalInterface *li)
LogicalInterfaceUveEntry(const LogicalInterface *li)
void Update(const Interface *pintf)
PhyInterfaceUveEntry(const Interface *pintf)
void FillLogicalInterfaceList(std::vector< std::string > &list) const
LogicalInterfaceSet logical_interface_set_
boost::uuids::uuid physical_device_
std::string physical_interface_
bool DeleteLogicalInterface(const LogicalInterface *itf)
void AddPhysicalInterface(const Interface *itf)
ProuterUveEntry(const PhysicalDevice *p)
void AddLogicalInterface(const LogicalInterface *itf)
void DeletePhysicalInterface(const Interface *itf)
LogicalInterfaceSet logical_interface_set_
InterfaceSet physical_interface_set_
boost::uuids::uuid logical_interface_