6 #include <boost/uuid/uuid_io.hpp>
10 #include <vnc_cfg_types.h>
22 using namespace autogen;
33 std::stringstream uuidstring;
34 uuidstring << sg_uuid_;
35 return uuidstring.str();
44 const SgKey *k =
static_cast<const SgKey *
>(key);
49 const SgKey *key =
static_cast<const SgKey *
>(k);
51 return std::unique_ptr<DBEntry>(
static_cast<DBEntry *
>(sg));
57 ChangeHandler(sg, req);
63 bool ret = ChangeHandler(entry, req);
65 sg->
SendObjectLog(GetOperDBTraceBuf(), AgentLogEvent::CHANGE);
86 acl =
static_cast<AclDBEntry *
>(agent()->acl_table()->FindActiveEntry(&key));
101 sg_table_ =
new SgTable(db, name);
109 autogen::IdPermsType id_perms = cfg->id_perms();
110 CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong, u);
124 agent()->sg_table()->Enqueue(&req);
128 agent()->config_manager()->AddSgNode(node);
142 uint32_t sg_id = cfg->id();
158 if (agent()->config_manager()->SkipNode(adj_node)) {
162 if (adj_node->
table() == agent()->cfg()->cfg_acl_table()) {
163 AccessControlList *acl_cfg =
static_cast<AccessControlList *
>
166 autogen::IdPermsType id_perms = acl_cfg->id_perms();
167 if (adj_node->
name().find(
"egress-access-control-list") != std::string::npos) {
168 CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong,
171 if (adj_node->
name().find(
"ingress-access-control-list") != std::string::npos) {
172 CfgUuidSet(id_perms.uuid.uuid_mslong, id_perms.uuid.uuid_lslong,
177 data =
new SgData(agent(), node, sg_id, egress_acl_uuid, ingress_acl_uuid);
179 req.
data.reset(data);
180 agent()->sg_table()->Enqueue(&req);
185 SgListResp *resp =
static_cast<SgListResp *
>(sresp);
188 (str_uuid == name) ||
191 data.set_ref_count(GetRefCount());
192 data.set_sg_uuid(str_uuid);
193 data.set_sg_id(GetSgId());
194 if (GetEgressAcl()) {
195 data.set_egress_acl_uuid(
UuidToString(GetEgressAcl()->GetUuid()));
197 if (GetIngressAcl()) {
198 data.set_ingress_acl_uuid(
UuidToString(GetIngressAcl()->GetUuid()));
200 std::vector<SgSandeshData> &list =
201 const_cast<std::vector<SgSandeshData>&
>(resp->get_sg_list());
202 list.push_back(data);
210 SgObjectLogInfo info;
214 case AgentLogEvent::ADD:
215 str.assign(
"Addition");
217 case AgentLogEvent::DEL:
218 str.assign(
"Deletion");
220 case AgentLogEvent::CHANGE:
221 str.assign(
"Modification");
230 info.set_uuid(sg_uuid);
231 info.set_id(GetSgId());
232 if (GetEgressAcl()) {
233 info.set_egress_acl_uuid(
UuidToString(GetEgressAcl()->GetUuid()));
235 if (GetIngressAcl()) {
236 info.set_ingress_acl_uuid(
UuidToString(GetIngressAcl()->GetUuid()));
238 info.set_ref_count(GetRefCount());
239 SG_OBJECT_LOG_LOG(
"AgentSg", SandeshLevel::SYS_INFO, info);
240 SG_OBJECT_TRACE_TRACE(buf, info);
243 void SgListReq::HandleRequest()
const {
245 sand->DoSandesh(sand);
249 const std::string &context) {
AclDBEntryRef egress_acl_
static const uint32_t kInvalidSgId
virtual DBEntry * OperDBAdd(const DBRequest *req)
boost::uuids::uuid egress_acl_id_
static void CfgUuidSet(uint64_t ms_long, uint64_t ls_long, boost::uuids::uuid &u)
std::string GetString(const std::string &key) const
#define OPER_TRACE(obj,...)
bool DBEntrySandesh(Sandesh *sresp, std::string &name) const
boost::uuids::uuid sg_uuid_
std::unique_ptr< DBRequestData > data
virtual bool IFNodeToReq(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
virtual bool OperDBOnChange(DBEntry *entry, const DBRequest *req)
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
adjacency_iterator end(DBGraph *graph)
static std::string UuidToString(const boost::uuids::uuid &id)
void SendObjectLog(SandeshTraceBufferPtr ptr, AgentLogEvent::type event) const
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
std::unique_ptr< DBRequestKey > KeyPtr
AclDBEntryRef ingress_acl_
const DBGraph * GetGraph() const
virtual void SetKey(const DBRequestKey *key)
virtual bool IsLess(const DBEntry &rhs) const
bool ProcessConfig(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
static const std::string integerToString(const NumberType &num)
std::unique_ptr< DBRequestKey > key
virtual KeyPtr GetDBRequestKey() const
boost::uuids::uuid ingress_acl_id_
virtual bool OperDBDelete(DBEntry *entry, const DBRequest *req)
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
const std::string & name() const
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *k) const
IFMapObject * GetObject()
bool ChangeHandler(DBEntry *entry, const DBRequest *req)
static DBTableBase * CreateTable(DB *db, const std::string &name)
static SgTable * sg_table_
virtual string ToString() const
virtual bool IFNodeToUuid(IFMapNode *node, boost::uuids::uuid &u)
boost::uuids::uuid sg_uuid_
adjacency_iterator begin(DBGraph *graph)