11 #include "vr_mirror.h"
17 sip_(entry->sip_), sport_(entry->sport_), dip_(entry->dip_),
18 dport_(entry->dport_), analyzer_name_(entry->analyzer_name_),
19 mirror_flag_(entry->mirror_flag_), vni_(entry->vni_),
20 nic_assisted_mirroring_(entry->nic_assisted_mirroring_),
21 nic_assisted_mirroring_vlan_(entry->nic_assisted_mirroring_vlan_),
22 mirror_index_(entry->mirror_index_) {
29 dip_(dip), dport_(dport) {
35 vrf_id_(mirror_entry->vrf_id()), sip_(*mirror_entry->GetSip()),
36 sport_(mirror_entry->GetSPort()), dip_(*mirror_entry->GetDip()),
37 dport_(mirror_entry->GetDPort()), nh_(NULL),
38 analyzer_name_(mirror_entry->GetAnalyzerName()),
39 mirror_flag_(mirror_entry->GetMirrorFlag()), vni_(mirror_entry->GetVni()),
40 nic_assisted_mirroring_(mirror_entry->nic_assisted_mirroring()),
41 nic_assisted_mirroring_vlan_(mirror_entry->nic_assisted_mirroring_vlan()),
42 mirror_index_(mirror_entry->mirror_index()) {
46 std::string &analyzer_name) :
47 ksync_obj_(obj), analyzer_name_(analyzer_name),
66 s <<
"Mirror Entry : " <<
dip_.to_string() <<
":" <<
dport_;
70 s <<
" Vrf : " << vrf->
GetName();
109 if (mirror->
GetNH() == NULL) {
110 LOG(DEBUG,
"nexthop in Mirror entry is null");
117 if (old_nh !=
nh()) {
130 vr_mirror_req encoder;
133 encoder.set_h_op(op);
134 encoder.set_mirr_rid(0);
137 encoder.set_mirr_nhid(nh_entry->
nh_id());
138 encoder.set_mirr_vni(
vni_);
140 encoder.set_mirr_flags(VR_MIRROR_FLAG_DYNAMIC);
144 encoder.set_mirr_flags(VR_MIRROR_FLAG_HW_ASSISTED);
147 encode_len = encoder.WriteBinary((uint8_t *)buf, buf_len, &error);
149 assert(encode_len <= buf_len);
155 LOG(DEBUG,
"MirrorEntry: Add");
156 return Encode(sandesh_op::ADD, buf, buf_len);
160 return AddMsg(buf, buf_len);
164 LOG(DEBUG,
"MirrorEntry: Delete");
165 return Encode(sandesh_op::DEL, buf, buf_len);
181 KSyncDBObject(
"KSync Mirror", kMirrorIndexCount), ksync_(ksync) {
boost::asio::ip::address IpAddress
virtual void MirrorMsgHandler(vr_mirror_req *req)=0
MirrorTable * mirror_table() const
VrfTable * vrf_table() const
void RegisterDb(DBTableBase *table)
KSyncEntry * Find(const KSyncEntry *key)
KSyncEntry * GetReference(const KSyncEntry *key)
NHKSyncObject * nh_ksync_obj() const
uint16_t nic_assisted_mirroring_vlan() const
const NextHop * GetNH() const
bool nic_assisted_mirroring() const
uint8_t GetMirrorFlag() const
uint32_t mirror_index() const
std::string analyzer_name_
NHKSyncEntry * nh() const
virtual int ChangeMsg(char *buf, int buf_len)
uint16_t nic_assisted_mirroring_vlan_
virtual bool Sync(DBEntry *e)
int Encode(sandesh_op::type op, char *buf, int buf_len)
bool nic_assisted_mirroring_
virtual int AddMsg(char *buf, int buf_len)
virtual ~MirrorKSyncEntry()
virtual int DeleteMsg(char *buf, int buf_len)
virtual bool IsLess(const KSyncEntry &rhs) const
KSyncDBObject * GetObject() const
virtual std::string ToString() const
MirrorKSyncObject * ksync_obj_
virtual KSyncEntry * UnresolvedReference()
MirrorKSyncEntry(MirrorKSyncObject *obj, const MirrorEntry *)
virtual ~MirrorKSyncObject()
virtual KSyncEntry * Alloc(const KSyncEntry *entry, uint32_t index)
MirrorKSyncObject(KSync *ksync)
virtual KSyncEntry * DBToKSyncEntry(const DBEntry *e)
uint32_t GetIdx(std::string analyzer_name)
static const uint8_t kInvalidIndex
const string & GetName() const
VrfEntry * FindVrfFromId(size_t index)
#define LOG(_Level, _Msg)
@ DynamicNH_With_JuniperHdr