6 #include <vnc_cfg_types.h>
7 #include <agent_types.h>
36 std::ostringstream buffer;
42 AgentQosConfigSandeshResp *resp =
43 static_cast<AgentQosConfigSandeshResp *
>(sresp);
44 AgentQosConfigSandeshData data;
50 data.set_type(
"vhost");
52 data.set_type(
"fabric");
54 data.set_type(
"default");
57 std::vector<QosForwardingClassSandeshPair> dscp_list;
58 AgentQosConfig::QosIdForwardingClassMap::const_iterator it =
61 QosForwardingClassSandeshPair pair;
62 pair.set_qos_value(it->first);
63 pair.set_forwarding_class_id(it->second);
64 dscp_list.push_back(pair);
67 std::vector<QosForwardingClassSandeshPair> vlan_priority_list;
70 QosForwardingClassSandeshPair pair;
71 pair.set_qos_value(it->first);
72 pair.set_forwarding_class_id(it->second);
73 vlan_priority_list.push_back(pair);
76 std::vector<QosForwardingClassSandeshPair> mpls_exp_list;
79 QosForwardingClassSandeshPair pair;
80 pair.set_qos_value(it->first);
81 pair.set_forwarding_class_id(it->second);
82 mpls_exp_list.push_back(pair);
85 data.set_dscp_list(dscp_list);
86 data.set_vlan_priority_list(vlan_priority_list);
87 data.set_mpls_exp_list(mpls_exp_list);
90 std::vector<AgentQosConfigSandeshData> &list =
91 const_cast<std::vector<AgentQosConfigSandeshData>&
>(resp->get_qc_list());
108 AgentQosIdForwardingClassMap::const_iterator it = data_map.begin();
109 for (; it != data_map.end(); it++) {
113 if (map != new_map) {
139 if (deleted ==
false) {
164 req.
data.reset(qos_data);
171 if (deleted ==
false) {
196 req.
data.reset(qos_data);
273 DB *db,
const std::string &name):
284 (
static_cast<DBTable *
>(qos_table))->Init();
288 std::unique_ptr<DBEntry>
293 return std::unique_ptr<DBEntry>(
static_cast<DBEntry *
>(fc));
303 Allocate(rkey).get())->index();
308 return static_cast<DBEntry *
>(qc);
350 autogen::QosConfig *cfg =
static_cast <autogen::QosConfig *
> (node->
GetObject());
352 autogen::IdPermsType id_perms = cfg->id_perms();
353 CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong, u);
373 autogen::QosConfig *cfg =
static_cast <autogen::QosConfig *
> (node->
GetObject());
375 std::vector<QosIdForwardingClassPair>::const_iterator it =
376 cfg->dscp_entries().begin();
377 for(; it != cfg->dscp_entries().end(); it++) {
378 qcd->
dscp_map_[it->key] = it->forwarding_class_id;
381 for(it = cfg->vlan_priority_entries().begin();
382 it != cfg->vlan_priority_entries().end(); it++) {
386 for(it = cfg->mpls_exp_entries().begin();
387 it != cfg->mpls_exp_entries().end(); it++) {
392 if (cfg->type() ==
"vhost") {
394 }
else if (cfg->type() ==
"fabric") {
407 const std::string &context) {
413 void AgentQosConfigSandeshReq::HandleRequest()
const {
415 get_name(), get_id()));
416 sand->DoSandesh(sand);
419 void AddQosConfig::HandleRequest()
const {
420 QosResponse *resp =
new QosResponse();
421 resp->set_context(context());
424 sprintf(str,
"00000000-0000-0000-0000-00%010x", get_uuid());
430 get_dscp_forwarding_class_id()));
432 get_vlan_priority_forwarding_class_id()));
434 get_mpls_exp_forwarding_class_id()));
435 data->
name_ = get_name();
437 if (get_type() ==
"vhost") {
439 }
else if (get_type() ==
"fabric") {
450 req.
data.reset(data);
452 resp->set_resp(
"Success");
456 void DeleteQosConfig::HandleRequest()
const {
457 QosResponse *resp =
new QosResponse();
458 resp->set_context(context());
461 sprintf(str,
"00000000-0000-0000-0000-00%010x", get_uuid());
468 req.
data.reset(NULL);
470 resp->set_resp(
"Success");
static void CfgUuidSet(uint64_t ms_long, uint64_t ls_long, boost::uuids::uuid &u)
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
IFMapAgentTable * cfg_global_qos_table() const
void set_agent(Agent *agent)
virtual bool IFNodeToUuid(IFMapNode *node, boost::uuids::uuid &u)
virtual bool OperDBDelete(DBEntry *entry, const DBRequest *req)
void EraseFabricQosConfig(const boost::uuids::uuid &uuid)
static DBTableBase * CreateTable(Agent *agent, DB *db, const std::string &name)
virtual bool OperDBResync(DBEntry *entry, const DBRequest *req)
static const uint32_t kInvalidIndex
AgentQosConfigData * BuildData(IFMapNode *node)
virtual bool IFNodeToReq(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
const boost::uuids::uuid GetActiveFabricQosConfig()
virtual bool OperDBOnChange(DBEntry *entry, const DBRequest *req)
void ReleaseIndex(AgentQosConfig *qc)
void InsertVhostQosConfig(const boost::uuids::uuid &uuid)
void InsertFabricQosConfig(const boost::uuids::uuid &uuid)
AgentQosConfigNameMap name_map_
AgentQosConfigTable(Agent *agent, DB *db, const std::string &name)
virtual bool ProcessConfig(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
void EraseVhostQosConfig(const boost::uuids::uuid &uuid)
const boost::uuids::uuid GetActiveVhostQosConfig()
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
std::pair< std::string, AgentQosConfig * > AgentQosConfigNamePair
IndexVector< AgentQosConfig * > index_table_
virtual DBEntry * OperDBAdd(const DBRequest *req)
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *k) const
virtual ~AgentQosConfigTable()
boost::uuids::uuid uuid() const
bool HandleQosForwardingMapChange(const Agent *agent, QosIdForwardingClassMap &map, const AgentQosIdForwardingClassMap &data_map)
virtual void Delete(const DBRequest *req)
virtual void SetKey(const DBRequestKey *key)
void HandleVhostQosConfig(const Agent *agent, const AgentQosConfigData *data, bool deleted)
KeyPtr GetDBRequestKey() const
virtual bool IsLess(const DBEntry &rhs) const
QosIdForwardingClassMap dscp_map_
std::map< uint32_t, uint32_t > QosIdForwardingClassMap
virtual bool Change(const DBRequest *req)
AgentQosConfig(const boost::uuids::uuid uuid)
std::string ToString() const
std::pair< uint32_t, uint32_t > QosIdForwardingClassPair
virtual ~AgentQosConfig()
void HandleGlobalQosConfig(const AgentQosConfigData *data)
bool VerifyLinkToGlobalQosConfig(const Agent *agent, const AgentQosConfigData *data)
QosIdForwardingClassMap mpls_exp_map_
virtual bool DBEntrySandesh(Sandesh *resp, std::string &name) const
uint32_t default_forwarding_class_
void HandleFabricQosConfig(const Agent *agent, const AgentQosConfigData *data, bool deleted)
QosIdForwardingClassMap vlan_priority_map_
std::string GetString(const std::string &key) const
InterfaceTable * interface_table() const
ConfigManager * config_manager() const
ResourceManager * resource_manager() const
AgentQosConfigTable * qos_config_table() const
AgentConfig * cfg() const
const std::string & vhost_interface_name() const
static Agent * GetInstance()
const std::string & fabric_interface_name() const
void AddQosConfigNode(IFMapNode *node)
std::unique_ptr< DBRequestKey > KeyPtr
DBTableBase * get_table() const
adjacency_iterator end(DBGraph *graph)
adjacency_iterator begin(DBGraph *graph)
bool Enqueue(DBRequest *req)
const std::string & name() const
const DBGraph * GetGraph() const
const std::string & name() const
IFMapObject * GetObject()
size_t InsertAtIndex(uint32_t index, EntryType entry)
void Remove(size_t index)
boost::shared_ptr< ResourceKey > KeyPtr
std::map< uint32_t, uint32_t > AgentQosIdForwardingClassMap
std::pair< uint32_t, uint32_t > AgentQosIdForwardingClassPair
static boost::uuids::uuid StringToUuid(const std::string &str)
static std::string UuidToString(const boost::uuids::uuid &id)
const Agent * agent() const
IFMapNode * ifmap_node() const
AgentQosConfig::Type type_
AgentQosIdForwardingClassMap mpls_exp_map_
AgentQosIdForwardingClassMap vlan_priority_map_
uint32_t default_forwarding_class_
AgentQosIdForwardingClassMap dscp_map_
std::unique_ptr< DBRequestKey > key
std::unique_ptr< DBRequestData > data