7 #include <boost/uuid/uuid_io.hpp>
17 using namespace boost::uuids;
25 return std::unique_ptr<DBEntry>(
static_cast<DBEntry *
>(AllocWithKey(k)));
35 (agent()->interface_table()->Find(&intf_key,
true));
41 assign =
static_cast<VrfAssign *
>(vlan_assign);
68 return (
static_cast<VrfAssign *
>(entry))->Change(req);
73 vrf_assign_table_->Init();
74 return vrf_assign_table_;
88 const std::string &vrf_name, uint16_t vlan_tag) {
99 vrf_assign_table_->Enqueue(&req);
112 req.
data.reset(NULL);
113 vrf_assign_table_->Enqueue(&req);
118 const std::string &vrf_name, uint16_t vlan_tag) {
127 req.
data.reset(data);
129 vrf_assign_table_->Process(req);
142 req.
data.reset(NULL);
143 vrf_assign_table_->Process(req);
151 return static_cast<VrfAssign *
>(vrf_assign_table_->FindActiveEntry(&key));
159 if (type_ != vassign.
type_) {
160 return type_ < vassign.
type_;
163 if (interface_.get() != vassign.
interface_.get()) {
164 return interface_.get() < vassign.
interface_.get();
167 return VrfAssignIsLess(vassign);
176 if (vrf_.get() != vrf) {
181 if (VrfAssignChange(req)) {
209 return (vlan_tag_ < rhs_vassign.
vlan_tag_);
214 key->
VlanInit(interface_->GetUuid(), vlan_tag_);
226 VrfAssignResp *resp =
static_cast<VrfAssignResp *
> (sresp);
228 if (!name.empty() && interface_->name().find(name) != string::npos) {
232 VrfAssignSandeshData data;
235 data.set_vlan_tag(vlan_tag_);
236 data.set_itf(interface_->name());
238 data.set_vrf(vrf_->GetName());
240 data.set_vrf(
"--ERROR--");
242 std::vector<VrfAssignSandeshData> &list =
243 const_cast<std::vector<VrfAssignSandeshData>&
>
244 (resp->get_vrf_assign_list());
245 list.push_back(data);
249 void VrfAssignReq::HandleRequest()
const {
251 sand->DoSandesh(sand);
255 const std::string &context) {
class boost::shared_ptr< AgentSandesh > AgentSandeshPtr
AgentDBEntry * FindActiveEntry(const DBEntry *key)
std::string GetString(const std::string &key) const
InterfaceTable * interface_table() const
VrfTable * vrf_table() const
NextHopTable * nexthop_table() const
static Agent * GetInstance()
std::unique_ptr< DBRequestKey > KeyPtr
KeyPtr GetDBRequestKey() const
bool DBEntrySandesh(Sandesh *sresp, std::string &name) const
virtual bool VrfAssignChange(const DBRequest *req)
void SetKey(const DBRequestKey *key)
bool VrfAssignIsLess(const VrfAssign &rhs) const
static VrfEntry * FindVrf(const std::string &name)
virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args, const std::string &context)
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *k) const
virtual bool OnChange(DBEntry *entry, const DBRequest *req)
static VrfAssignTable * vrf_assign_table_
static void DeleteVlan(const boost::uuids::uuid &intf_uuid, uint16_t vlan_tag)
static DBTableBase * CreateTable(DB *db, const std::string &name)
static void CreateVlan(const boost::uuids::uuid &intf_uuid, const std::string &vrf_name, uint16_t vlan_tag)
static VrfAssignTable * GetInstance()
static void CreateVlanReq(const boost::uuids::uuid &intf_uuid, const std::string &vrf_name, uint16_t vlan_tag)
static VrfAssign * FindVlanReq(const boost::uuids::uuid &intf_uuid, uint16_t vlan_tag)
static void DeleteVlanReq(const boost::uuids::uuid &intf_uuid, uint16_t vlan_tag)
virtual DBEntry * Add(const DBRequest *req)
static Interface * FindInterface(const boost::uuids::uuid &intf_uuid)
VrfAssign * AllocWithKey(const DBRequestKey *k) const
bool Change(const DBRequest *req)
bool IsLess(const DBEntry &rhs) const
VrfEntry * FindVrfFromName(const string &name)
std::unique_ptr< DBRequestKey > key
std::unique_ptr< DBRequestData > data
const std::string vrf_name_
void VlanInit(const boost::uuids::uuid intf_uuid, uint16_t vlan_tag)
boost::uuids::uuid intf_uuid_