7 #include <boost/uuid/uuid_io.hpp>
11 #include <vnc_cfg_types.h>
34 std::stringstream uuidstring;
35 uuidstring << sg_uuid_;
36 return uuidstring.str();
45 const SgKey *k =
static_cast<const SgKey *
>(key);
50 const SgKey *key =
static_cast<const SgKey *
>(k);
52 return std::unique_ptr<DBEntry>(
static_cast<DBEntry *
>(sg));
58 ChangeHandler(sg, req);
64 bool ret = ChangeHandler(entry, req);
66 sg->
SendObjectLog(GetOperDBTraceBuf(), AgentLogEvent::CHANGE);
87 acl =
static_cast<AclDBEntry *
>(agent()->acl_table()->FindActiveEntry(&key));
102 sg_table_ =
new SgTable(db, name);
110 autogen::IdPermsType id_perms = cfg->id_perms();
111 CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong, u);
125 agent()->sg_table()->Enqueue(&req);
129 agent()->config_manager()->AddSgNode(node);
143 uint32_t sg_id = cfg->id();
159 if (agent()->config_manager()->SkipNode(adj_node)) {
163 if (adj_node->
table() == agent()->cfg()->cfg_acl_table()) {
164 AccessControlList *acl_cfg =
static_cast<AccessControlList *
>
167 autogen::IdPermsType id_perms = acl_cfg->id_perms();
168 if (adj_node->
name().find(
"egress-access-control-list") != std::string::npos) {
169 CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong,
172 if (adj_node->
name().find(
"ingress-access-control-list") != std::string::npos) {
173 CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong,
178 data =
new SgData(agent(), node, sg_id, egress_acl_uuid, ingress_acl_uuid);
180 req.
data.reset(data);
181 agent()->sg_table()->Enqueue(&req);
186 SgListResp *resp =
static_cast<SgListResp *
>(sresp);
189 (str_uuid == name) ||
192 data.set_ref_count(GetRefCount());
193 data.set_sg_uuid(str_uuid);
194 data.set_sg_id(GetSgId());
195 if (GetEgressAcl()) {
196 data.set_egress_acl_uuid(
UuidToString(GetEgressAcl()->GetUuid()));
198 if (GetIngressAcl()) {
199 data.set_ingress_acl_uuid(
UuidToString(GetIngressAcl()->GetUuid()));
201 std::vector<SgSandeshData> &list =
202 const_cast<std::vector<SgSandeshData>&
>(resp->get_sg_list());
203 list.push_back(data);
211 SgObjectLogInfo info;
215 case AgentLogEvent::ADD:
216 str.assign(
"Addition");
218 case AgentLogEvent::DEL:
219 str.assign(
"Deletion");
221 case AgentLogEvent::CHANGE:
222 str.assign(
"Modification");
231 info.set_uuid(sg_uuid);
232 info.set_id(GetSgId());
233 if (GetEgressAcl()) {
234 info.set_egress_acl_uuid(
UuidToString(GetEgressAcl()->GetUuid()));
236 if (GetIngressAcl()) {
237 info.set_ingress_acl_uuid(
UuidToString(GetIngressAcl()->GetUuid()));
239 info.set_ref_count(GetRefCount());
240 SG_OBJECT_LOG_LOG(
"AgentSg", SandeshLevel::SYS_INFO, info);
241 SG_OBJECT_TRACE_TRACE(buf, info);
244 void SgListReq::HandleRequest()
const {
246 sand->DoSandesh(sand);
250 const std::string &context) {
static void CfgUuidSet(uint64_t ms_long, uint64_t ls_long, boost::uuids::uuid &u)
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
#define OPER_TRACE(obj,...)
std::string GetString(const std::string &key) const
std::unique_ptr< DBRequestKey > KeyPtr
adjacency_iterator end(DBGraph *graph)
adjacency_iterator begin(DBGraph *graph)
const DBGraph * GetGraph() const
const std::string & name() const
IFMapObject * GetObject()
bool DBEntrySandesh(Sandesh *sresp, std::string &name) const
AclDBEntryRef ingress_acl_
AclDBEntryRef egress_acl_
void SendObjectLog(SandeshTraceBufferPtr ptr, AgentLogEvent::type event) const
virtual void SetKey(const DBRequestKey *key)
virtual bool IsLess(const DBEntry &rhs) const
virtual string ToString() const
boost::uuids::uuid sg_uuid_
virtual KeyPtr GetDBRequestKey() const
bool ChangeHandler(DBEntry *entry, const DBRequest *req)
static DBTableBase * CreateTable(DB *db, const std::string &name)
virtual DBEntry * OperDBAdd(const DBRequest *req)
virtual bool OperDBDelete(DBEntry *entry, const DBRequest *req)
static SgTable * sg_table_
static const uint32_t kInvalidSgId
bool ProcessConfig(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
virtual bool OperDBOnChange(DBEntry *entry, const DBRequest *req)
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *k) const
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
virtual bool IFNodeToUuid(IFMapNode *node, boost::uuids::uuid &u)
virtual bool IFNodeToReq(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
static std::string UuidToString(const boost::uuids::uuid &id)
static const std::string integerToString(const NumberType &num)
std::unique_ptr< DBRequestKey > key
std::unique_ptr< DBRequestData > data
boost::uuids::uuid egress_acl_id_
boost::uuids::uuid ingress_acl_id_
boost::uuids::uuid sg_uuid_