7 #include <vnc_cfg_types.h>
8 #include <agent_types.h>
37 std::ostringstream buffer;
43 AgentQosConfigSandeshResp *resp =
44 static_cast<AgentQosConfigSandeshResp *
>(sresp);
45 AgentQosConfigSandeshData data;
51 data.set_type(
"vhost");
53 data.set_type(
"fabric");
55 data.set_type(
"default");
58 std::vector<QosForwardingClassSandeshPair> dscp_list;
59 AgentQosConfig::QosIdForwardingClassMap::const_iterator it =
62 QosForwardingClassSandeshPair pair;
63 pair.set_qos_value(it->first);
64 pair.set_forwarding_class_id(it->second);
65 dscp_list.push_back(pair);
68 std::vector<QosForwardingClassSandeshPair> vlan_priority_list;
71 QosForwardingClassSandeshPair pair;
72 pair.set_qos_value(it->first);
73 pair.set_forwarding_class_id(it->second);
74 vlan_priority_list.push_back(pair);
77 std::vector<QosForwardingClassSandeshPair> mpls_exp_list;
80 QosForwardingClassSandeshPair pair;
81 pair.set_qos_value(it->first);
82 pair.set_forwarding_class_id(it->second);
83 mpls_exp_list.push_back(pair);
86 data.set_dscp_list(dscp_list);
87 data.set_vlan_priority_list(vlan_priority_list);
88 data.set_mpls_exp_list(mpls_exp_list);
91 std::vector<AgentQosConfigSandeshData> &list =
92 const_cast<std::vector<AgentQosConfigSandeshData>&
>(resp->get_qc_list());
109 AgentQosIdForwardingClassMap::const_iterator it = data_map.begin();
110 for (; it != data_map.end(); it++) {
114 if (map != new_map) {
140 if (deleted ==
false) {
165 req.
data.reset(qos_data);
172 if (deleted ==
false) {
197 req.
data.reset(qos_data);
274 DB *db,
const std::string &name):
285 (
static_cast<DBTable *
>(qos_table))->Init();
289 std::unique_ptr<DBEntry>
294 return std::unique_ptr<DBEntry>(
static_cast<DBEntry *
>(fc));
304 Allocate(rkey).get())->index();
309 return static_cast<DBEntry *
>(qc);
351 autogen::QosConfig *cfg =
static_cast <autogen::QosConfig *
> (node->
GetObject());
353 autogen::IdPermsType id_perms = cfg->id_perms();
354 CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong, u);
374 autogen::QosConfig *cfg =
static_cast <autogen::QosConfig *
> (node->
GetObject());
376 std::vector<QosIdForwardingClassPair>::const_iterator it =
377 cfg->dscp_entries().begin();
378 for(; it != cfg->dscp_entries().end(); it++) {
379 qcd->
dscp_map_[it->key] = it->forwarding_class_id;
382 for(it = cfg->vlan_priority_entries().begin();
383 it != cfg->vlan_priority_entries().end(); it++) {
387 for(it = cfg->mpls_exp_entries().begin();
388 it != cfg->mpls_exp_entries().end(); it++) {
393 if (cfg->type() ==
"vhost") {
395 }
else if (cfg->type() ==
"fabric") {
408 const std::string &context) {
414 void AgentQosConfigSandeshReq::HandleRequest()
const {
416 get_name(), get_id()));
417 sand->DoSandesh(sand);
420 void AddQosConfig::HandleRequest()
const {
421 QosResponse *resp =
new QosResponse();
422 resp->set_context(context());
425 sprintf(str,
"00000000-0000-0000-0000-00%010x", get_uuid());
431 get_dscp_forwarding_class_id()));
433 get_vlan_priority_forwarding_class_id()));
435 get_mpls_exp_forwarding_class_id()));
436 data->
name_ = get_name();
438 if (get_type() ==
"vhost") {
440 }
else if (get_type() ==
"fabric") {
451 req.
data.reset(data);
453 resp->set_resp(
"Success");
457 void DeleteQosConfig::HandleRequest()
const {
458 QosResponse *resp =
new QosResponse();
459 resp->set_context(context());
462 sprintf(str,
"00000000-0000-0000-0000-00%010x", get_uuid());
469 req.
data.reset(NULL);
471 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