OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cfg_mirror.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include <base/address.h>
6 
7 #if defined(__GNUC__)
8 #include "base/compiler.h"
9 #if __GNUC_PREREQ(4, 5)
10 #pragma GCC diagnostic push
11 #pragma GCC diagnostic ignored "-Wunused-result"
12 #endif
13 #endif
14 
15 #include <boost/uuid/random_generator.hpp>
16 
17 #if defined(__GNUC__)
18 #if __GNUC_PREREQ(4, 6)
19 #pragma GCC diagnostic pop
20 #endif
21 #endif
22 
23 #include <ifmap/ifmap_table.h>
24 #include <ifmap/ifmap_link.h>
25 #include <base/logging.h>
26 
27 #include <cmn/agent_cmn.h>
28 #include <agent_types.h>
29 
30 #include <cfg/cfg_init.h>
31 #include <cfg/cfg_mirror.h>
32 #include <oper/config_manager.h>
33 
34 #include <oper/vn.h>
35 #include <oper/mirror_table.h>
36 #include <oper/interface_common.h>
37 
38 #include <filter/traffic_action.h>
39 #include <filter/acl_entry_match.h>
40 #include <filter/acl_entry_spec.h>
41 #include <filter/acl.h>
42 
44 }
45 
47  return;
48 }
49 
50 const char *MirrorCfgTable::Add(const MirrorCreateReq &cfg) {
51  MirrorCfgKey key;
52  boost::system::error_code ec;
53  IpAddress sip;
54  IpAddress dest_ip;
56  key.handle = cfg.get_handle();
57  if (key.handle.empty()) {
58  return "Invalid Handle";
59  }
60 
61  MirrorCfgTree::iterator it;
62  it = mc_tree_.find(key);
63  if (it != mc_tree_.end()) {
64  return "Update not supported";
65  }
66 
67  MirrorCfgEntry *entry = new MirrorCfgEntry;
68  entry->key = key;
69  if (cfg.get_nic_assisted_mirroring()) {
70  if (cfg.get_nic_assisted_mirroring_vlan() == 0 ||
71  cfg.get_nic_assisted_mirroring_vlan() >= 4095) {
72  delete entry;
73  return "Invalid Vlan";
74  }
76  cfg.get_nic_assisted_mirroring_vlan());
77  goto update_acl;
78  }
79 
80  entry->data.apply_vn = cfg.get_apply_vn();
81  entry->data.src_vn = cfg.get_src_vn();
82  entry->data.src_ip_prefix = cfg.get_src_ip_prefix();
83  entry->data.src_ip_prefix_len = cfg.get_src_ip_prefix_len();
84 
85  entry->data.dst_vn = cfg.get_dst_vn();
86  entry->data.dst_ip_prefix = cfg.get_dst_ip_prefix();
87  entry->data.dst_ip_prefix_len = cfg.get_dst_ip_prefix_len();
88 
89  entry->data.start_src_port = cfg.get_start_src_port();
90  entry->data.end_src_port = cfg.get_end_src_port();
91 
92  entry->data.start_dst_port = cfg.get_start_dst_port();
93  entry->data.end_dst_port = cfg.get_end_dst_port();
94 
95  entry->data.protocol = cfg.get_protocol();
96 
97  entry->data.ip = cfg.get_ip();
98  entry->data.udp_port = cfg.get_udp_port();
99 
100  entry->data.time_period = cfg.get_time_period();
101  if (cfg.get_mirror_vrf().empty()) {
103  } else {
104  entry->data.mirror_vrf = cfg.get_mirror_vrf();
105  }
106 
107  // Send create request to Mirror Index table
108  dest_ip = IpAddress::from_string(entry->data.ip, ec);
109  if (ec.value() != 0) {
110  delete entry;
111  return "Invalid mirror destination address ";
112  }
113 
114  if (entry->data.udp_port == 0) {
115  delete entry;
116  return "Invalid mirror destination port ";
117  }
118 
119  sip = agent_cfg_->agent()->GetMirrorSourceIp(dest_ip);
120  mirror_flag = MirrorTable::DecodeMirrorFlag(cfg.get_nhmode(),
121  cfg.get_juniperheader());
122  if (mirror_flag == MirrorEntryData::DynamicNH_With_JuniperHdr) {
124  entry->data.mirror_vrf, sip,
126  dest_ip, entry->data.udp_port);
127  } else if (mirror_flag == MirrorEntryData::DynamicNH_Without_JuniperHdr) {
128  MacAddress mac = MacAddress::FromString(cfg.get_analyzer_vm_mac());
130  sip, agent_cfg_->agent()->mirror_port(),
131  dest_ip, entry->data.udp_port, 0,
132  mirror_flag, mac);
133  } else if (mirror_flag == MirrorEntryData::StaticNH_Without_JuniperHdr) {
134 
135  dest_ip = IpAddress::from_string(cfg.get_vtep_dst_ip(), ec);
136  if (ec.value() != 0) {
137  delete entry;
138  return "Invalid mirror destination address ";
139  }
140  sip = agent_cfg_->agent()->GetMirrorSourceIp(dest_ip);
142  sip, agent_cfg_->agent()->mirror_port(),
143  dest_ip, entry->data.udp_port,
144  cfg.get_vni(), mirror_flag,
146  } else {
147  delete entry;
148  return "Mode not supported";
149  }
150 
151 update_acl:
152  // Update ACL
153  VnAclMap::iterator va_it;
154  va_it = vn_acl_map_.find(entry->data.apply_vn);
155  AclUuid dyn_acl_uuid;
156  const char *str = NULL;
157  int ace_id = 0;
158  if (va_it == vn_acl_map_.end()) {
159  dyn_acl_uuid = boost::uuids::random_generator() ();
160  AclIdInfo acl_info;
161  acl_info.id = dyn_acl_uuid;
162  acl_info.num_of_entries++;
163  ace_id = ++acl_info.ace_id_latest;
164  vn_acl_map_.insert(std::pair<VnIdStr, AclIdInfo>(entry->data.apply_vn, acl_info));
165  // Create ACL with given dyn_acl_uuid
166  str = UpdateAclEntry(dyn_acl_uuid, true, entry, ace_id);
167  } else {
168  dyn_acl_uuid = va_it->second.id;
169  va_it->second.num_of_entries++;
170  ace_id = ++va_it->second.ace_id_latest;
171  str = UpdateAclEntry(dyn_acl_uuid, false, entry, ace_id);
172  }
173 
174  if (str != NULL) {
175  delete entry;
176  return str;
177  } else {
178  entry->ace_info.acl_id = dyn_acl_uuid;
179  entry->ace_info.id = ace_id;
180  }
181 
182  mc_tree_.insert(std::pair<MirrorCfgKey, MirrorCfgEntry *>(key, entry));
183 
184 
185  IFMapNode *vn_node = agent_cfg_->cfg_vn_table()->FindNode(entry->data.apply_vn);
186  if (vn_node && agent_cfg_->agent()->config_manager()->CanUseNode(vn_node)) {
187  DBRequest req;
189  agent_cfg_->agent()->vn_table()->IFNodeToUuid(vn_node, id);
190  assert(agent_cfg_->agent()->vn_table()->IFNodeToReq(vn_node,
191  req, id) == false);
192  }
193  return NULL;
194 }
195 
196 const char *MirrorCfgTable::UpdateAclEntry (AclUuid &uuid, bool create,
197  MirrorCfgEntry *entry,
198  int ace_id) {
199  AclSpec acl_spec;
200  AclEntrySpec ace_spec;
201 
202  acl_spec.acl_id = uuid;
203  ace_spec.terminal = false;
204  ace_spec.id = ace_id;
205 
206  if (!(entry->data.src_ip_prefix.empty())) {
208  ace_spec.BuildAddressInfo(entry->data.src_ip_prefix,
209  entry->data.src_ip_prefix_len,
210  &ace_spec.src_ip_list);
211  } else {
213  ace_spec.src_policy_id_str = entry->data.src_vn;
214  }
215 
216  if (!(entry->data.dst_ip_prefix.empty())) {
218  ace_spec.BuildAddressInfo(entry->data.dst_ip_prefix,
219  entry->data.dst_ip_prefix_len,
220  &ace_spec.dst_ip_list);
221  } else {
223  ace_spec.dst_policy_id_str = entry->data.dst_vn;
224  }
225 
226  RangeSpec rs;
227  rs.min = entry->data.start_src_port;
228  rs.max = entry->data.end_src_port;
229  if ((rs.min == (uint16_t)-1) && (rs.max == (uint16_t)-1)) {
230  rs.min = 0;
231  }
232  ace_spec.src_port.push_back(rs);
233 
234  rs.min = entry->data.start_dst_port;
235  rs.max = entry->data.end_dst_port;
236  if ((rs.min == (uint16_t)-1) && (rs.max == (uint16_t)-1)) {
237  rs.min = 0;
238  }
239  ace_spec.dst_port.push_back(rs);
240 
241  if (entry->data.protocol == -1) {
242  rs.min = 0x0;
243  rs.max = 0xff;
244  } else {
245  rs.min = rs.max = entry->data.protocol;
246  }
247  ace_spec.protocol.push_back(rs);
248 
249  // Fill action part later
250  ActionSpec action_spec;
252  boost::system::error_code ec;
253  action_spec.ma.ip = Ip4Address::from_string(entry->data.ip, ec);
254  if (ec.value() != 0) {
255  return "Invalid mirror destination address ";
256  }
257  action_spec.ma.port = entry->data.udp_port;
258  action_spec.ma.vrf_name = entry->data.mirror_vrf;
259  action_spec.ma.analyzer_name = entry->key.handle;
260  ace_spec.action_l.push_back(action_spec);
261  // Add the ace to the acl
262  acl_spec.acl_entry_specs_.push_back(ace_spec);
263 
264  // Enqueue ACL request
265  DBRequest req;
266  AclKey *key = new AclKey(uuid);
267  AclData *data = new AclData(agent_cfg_->agent(), NULL, acl_spec);
268  data->ace_add = true;
269  LOG(DEBUG, "Ace add: " << data->ace_add << ", Ace spec id:"
270  << ace_spec.id.id_);
272  req.key.reset(key);
273  req.data.reset(data);
274  agent_cfg_->agent()->acl_table()->Enqueue(&req);
275 
276  return NULL;
277 }
278 
280  MirrorCfgTree::iterator it;
281  it = mc_tree_.find(key);
282  if (it == mc_tree_.end()) {
283  return;
284  }
285 
286  MirrorCfgEntry *entry = it->second;
288 
289  // Update ACL
290  VnAclMap::iterator va_it;
291  va_it = vn_acl_map_.find(entry->data.apply_vn);
292  va_it->second.num_of_entries--;
293  if (va_it->second.num_of_entries) {
294  DBRequest areq;
296  AclKey *akey = new AclKey(va_it->second.id);
297  AclData *adata = new AclData(agent_cfg_->agent(),
298  NULL, entry->ace_info.id);
299  areq.key.reset(akey);
300  areq.data.reset(adata);
301  agent_cfg_->agent()->acl_table()->Enqueue(&areq);
302 
303  // delete entry from mv map
304  delete entry;
305  mc_tree_.erase(it);
306  return;
307  }
308 
309  DBRequest areq;
311  AclKey *akey = new AclKey(va_it->second.id);
312  areq.key.reset(akey);
313  areq.data.reset(NULL);
314  agent_cfg_->agent()->acl_table()->Enqueue(&areq);
315 
316  mc_tree_.erase(it);
317 
318  // delete from vn_acl map
319  vn_acl_map_.erase(va_it);
320 
321  IFMapNode *vn_node = agent_cfg_->cfg_vn_table()->FindNode(entry->data.apply_vn);
322  if (vn_node && agent_cfg_->agent()->config_manager()->CanUseNode(vn_node)) {
323  DBRequest req;
325  agent_cfg_->agent()->vn_table()->IFNodeToUuid(vn_node, id);
326  assert(agent_cfg_->agent()->vn_table()->IFNodeToReq(vn_node,
327  req, id) == false);
328  }
329 
330  // delete entry from mv map
331  delete entry;
332  return;
333 }
334 
335 const boost::uuids::uuid MirrorCfgTable::GetMirrorUuid(const string &vn_name) const {
336  VnAclMap::const_iterator va_it;
337  va_it = vn_acl_map_.find(vn_name);
338  if (va_it == vn_acl_map_.end()) {
339  return boost::uuids::nil_uuid();
340  }
341 
342  return va_it->second.id;
343 }
344 
346  MirrorCfgDisplayResp &resp) {
347  MirrorCfgTree::iterator it;
348 
349  std::vector<MirrorCfgSandesh> mc_l;
350  for (it = mc_tree_.begin(); it != mc_tree_.end(); ++it) {
351  MirrorCfgEntry *mc_entry = it->second;
352  if (!handle.empty() && (handle != mc_entry->key.handle)) {
353  continue;
354  }
355  MirrorCfgSandesh mc_s;
356  mc_s.set_handle(mc_entry->key.handle);
357  mc_s.set_apply_vn(mc_entry->data.apply_vn);
358  mc_s.set_src_vn(mc_entry->data.src_vn);
359  mc_s.set_src_ip_prefix(mc_entry->data.src_ip_prefix);
360  mc_s.set_src_ip_prefix_len(mc_entry->data.src_ip_prefix_len);
361  mc_s.set_dst_vn(mc_entry->data.dst_vn);
362  mc_s.set_dst_ip_prefix(mc_entry->data.dst_ip_prefix);
363  mc_s.set_dst_ip_prefix_len(mc_entry->data.dst_ip_prefix_len);
364  mc_s.set_start_src_port(mc_entry->data.start_src_port);
365  mc_s.set_end_src_port(mc_entry->data.end_src_port);
366  mc_s.set_start_dst_port(mc_entry->data.start_dst_port);
367  mc_s.set_end_dst_port(mc_entry->data.end_dst_port);
368  mc_s.set_protocol(mc_entry->data.protocol);
369  mc_s.set_ip(mc_entry->data.ip);
370  mc_s.set_udp_port(mc_entry->data.udp_port);
371  mc_s.set_time_period(mc_entry->data.time_period);
372  mc_s.set_mirror_vrf(mc_entry->data.mirror_vrf);
373  mc_l.push_back(mc_s);
374  }
375  resp.set_mcfg_l(mc_l);
376 }
377 
379  MirrorCfgVnInfoResp &resp) {
380  VnAclMap::iterator it;
381  std::vector<VnAclInfo> vn_l;
382  for (it = vn_acl_map_.begin(); it != vn_acl_map_.end(); ++it) {
383  if (!vn_name.empty() && (vn_name != it->first)) {
384  continue;
385  }
386  VnAclInfo vn_acl_info;
387  vn_acl_info.set_vn_name(it->first);
388  vn_acl_info.set_dyn_acl_uuid(UuidToString(it->second.id));
389  vn_acl_info.set_num_of_entries(it->second.num_of_entries);
390  vn_l.push_back(vn_acl_info);
391  }
392  resp.set_vn_acl_info_l(vn_l);
393 }
394 
395 void MirrorCreateReq::HandleRequest() const {
396  const char *str = Agent::GetInstance()->mirror_cfg_table()->Add(*this);
397  MirrorCfgResp *resp = new MirrorCfgResp();
398  resp->set_context(context());
399  if (str == NULL) {
400  str = "Success";
401  }
402  resp->set_resp(str);
403  resp->Response();
404  return;
405 }
406 
407 void MirrorDeleteReq::HandleRequest() const {
408  MirrorCfgKey key;
409  key.handle = get_handle();
411  MirrorCfgResp *resp = new MirrorCfgResp();
412  resp->set_context(context());
413  resp->Response();
414  return;
415 }
416 
417 void MirrorCfgDisplayReq::HandleRequest() const {
418  std::string handle = get_handle();
419  MirrorCfgDisplayResp *resp = new MirrorCfgDisplayResp();
421  resp->set_context(context());
422  resp->Response();
423  return;
424 }
425 
426 void MirrorCfgVnInfoReq::HandleRequest() const {
427  std::string vn_name = get_vn_name();
428  MirrorCfgVnInfoResp *resp = new MirrorCfgVnInfoResp();
430  resp->set_context(context());
431  resp->Response();
432  return;
433 }
434 
436 }
437 
439  return;
440 }
441 
442 const char *IntfMirrorCfgTable::Add(const IntfMirrorCreateReq &intf_mirror) {
443  MirrorCfgKey key;
444  boost::system::error_code ec;
446  //const IntfMirrorCfgSandesh &intf_mirror = cfg.get_intf_mirr();
447  key.handle = intf_mirror.get_handle();
448  if (key.handle.empty()) {
449  return "Invalid Handle";
450  }
451 
452  IntfMirrorCfgTree::iterator it;
453  it = intf_mc_tree_.find(key);
454  if (it != intf_mc_tree_.end()) {
455  return "Update not supported";
456  }
457 
459  entry->key = key;
460  if (intf_mirror.get_nic_assisted_mirroring()) {
461  if (intf_mirror.get_nic_assisted_mirroring_vlan() == 0 ||
462  intf_mirror.get_nic_assisted_mirroring_vlan() >= 4095) {
463  delete entry;
464  return "Invalid Vlan";
465  }
467  intf_mirror.get_nic_assisted_mirroring_vlan());
468  goto intf_update;
469  }
470  entry->data.intf_id = StringToUuid(intf_mirror.get_intf_uuid());
471  entry->data.intf_name = intf_mirror.get_intf_name();
472  entry->data.mirror_dest.handle = intf_mirror.get_handle();
473  entry->data.mirror_dest.dip = IpAddress::from_string(intf_mirror.get_ip(),
474  ec);
475  if (ec.value() != 0) {
476  delete entry;
477  return "Invalid mirror destination address ";
478  }
479  if (intf_mirror.get_udp_port() == 0) {
480  delete entry;
481  return "Invald mirror destination port ";
482  }
483  entry->data.mirror_dest.dport = intf_mirror.get_udp_port();
484  entry->data.mirror_dest.sip = agent_cfg_->agent()->
485  GetMirrorSourceIp(entry->data.mirror_dest.dip);
487  entry->data.mirror_dest.time_period = intf_mirror.get_time_period();
488  entry->data.mirror_dest.mirror_vrf = intf_mirror.get_mirror_vrf();
489 
490  mirror_flag = MirrorTable::DecodeMirrorFlag (intf_mirror.get_nhmode(),
491  intf_mirror.get_juniperheader());
492  if (mirror_flag == MirrorEntryData::DynamicNH_With_JuniperHdr) {
494  entry->data.mirror_dest.mirror_vrf,
495  entry->data.mirror_dest.sip,
496  entry->data.mirror_dest.sport,
497  entry->data.mirror_dest.dip,
498  entry->data.mirror_dest.dport);
499  } else if (mirror_flag == MirrorEntryData::DynamicNH_Without_JuniperHdr) {
500  MacAddress mac = MacAddress::FromString(intf_mirror.get_analyzer_vm_mac());
502  entry->data.mirror_dest.mirror_vrf,
503  entry->data.mirror_dest.sip,
504  entry->data.mirror_dest.sport,
505  entry->data.mirror_dest.dip,
506  entry->data.mirror_dest.dport, 0,
507  mirror_flag, mac);
508  } else if (mirror_flag == MirrorEntryData::StaticNH_Without_JuniperHdr) {
509  IpAddress dst_ip = IpAddress::from_string(intf_mirror.get_vtep_dst_ip(), ec);
510  if (ec.value() != 0) {
511  delete entry;
512  return "Invalid mirror destination address ";
513  }
515  entry->data.mirror_dest.mirror_vrf,
516  entry->data.mirror_dest.sip,
517  entry->data.mirror_dest.sport,
518  dst_ip, entry->data.mirror_dest.dport,
519  intf_mirror.get_vni(), mirror_flag,
521  } else {
522  delete entry;
523  return "not supported";
524  }
525 intf_update:
526  intf_mc_tree_.insert(std::pair<MirrorCfgKey, IntfMirrorCfgEntry *>(key, entry));
527 
529  entry->data.intf_id,
530  entry->data.intf_name);
531  Interface *intf;
532  intf = static_cast<Interface *>(agent_cfg_->agent()->interface_table()->FindActiveEntry(intf_key));
533  if (intf) {
534  DBRequest req;
536  req.key.reset(intf_key);
537  VmInterfaceMirrorData *intf_data =
538  new VmInterfaceMirrorData(true, entry->key.handle);
539  req.data.reset(intf_data);
541  } else {
542  delete intf_key;
543  }
544 
545  return NULL;
546 }
547 
549  IntfMirrorCfgTree::iterator it;
550  it = intf_mc_tree_.find(key);
551  if (it == intf_mc_tree_.end()) {
552  return;
553  }
554  IntfMirrorCfgEntry *entry = it->second;
556 
558  entry->data.intf_id,
559  entry->data.intf_name);
560  Interface *intf;
561  intf = static_cast<Interface *>(agent_cfg_->agent()->interface_table()->FindActiveEntry(intf_key));
562  if (intf) {
563  DBRequest req;
565  req.key.reset(intf_key);
566  VmInterfaceMirrorData *intf_data =
567  new VmInterfaceMirrorData(false, std::string());
568  req.data.reset(intf_data);
570  } else {
571  delete intf_key;
572  }
573 
574  delete entry;
575  intf_mc_tree_.erase(it);
576 }
577 
578 void IntfMirrorCreateReq::HandleRequest() const {
579  const char *str = Agent::GetInstance()->interface_mirror_cfg_table()->Add(*this);
580  MirrorCfgResp *resp = new MirrorCfgResp();
581  resp->set_context(context());
582  if (str == NULL) {
583  str = "Success";
584  }
585  resp->set_resp(str);
586  resp->Response();
587  return;
588 }
589 
590 void IntfMirrorDeleteReq::HandleRequest() const {
591  MirrorCfgKey key;
592  key.handle = get_handle();
594  MirrorCfgResp *resp = new MirrorCfgResp();
595  resp->set_context(context());
596  resp->set_resp("Success");
597  resp->Response();
598  return;
599 }
600 
602  IntfMirrorCfgDisplayResp &resp) {
603  IntfMirrorCfgTree::iterator it;
604  std::vector<IntfMirrorCfgSandesh> mc_l;
605  for (it = intf_mc_tree_.begin(); it != intf_mc_tree_.end(); ++it) {
606  IntfMirrorCfgEntry *mc_entry = it->second;
607  if (!handle.empty() && (handle != mc_entry->key.handle)) {
608  continue;
609  }
610  IntfMirrorCfgSandesh mc_s;
611  mc_s.set_handle(mc_entry->key.handle);
612  mc_s.set_intf_uuid(UuidToString(mc_entry->data.intf_id));
613  mc_s.set_intf_name(mc_entry->data.intf_name);
614  mc_s.set_ip(mc_entry->data.mirror_dest.dip.to_string());
615  mc_s.set_udp_port(mc_entry->data.mirror_dest.dport);
616  mc_s.set_time_period(mc_entry->data.mirror_dest.time_period);
617  mc_s.set_mirror_vrf(mc_entry->data.mirror_dest.mirror_vrf);
618  mc_l.push_back(mc_s);
619  }
620  resp.set_imcfg_l(mc_l);
621 }
622 
623 void IntfMirrorCfgDisplayReq::HandleRequest() const {
624  std::string handle = get_handle();
625  IntfMirrorCfgDisplayResp *resp = new IntfMirrorCfgDisplayResp();
627  resp->set_context(context());
628  resp->Response();
629  return;
630 }
void SetMirrorCfgVnSandeshData(std::string &vn_name, MirrorCfgVnInfoResp &resp)
Definition: cfg_mirror.cc:378
MirrorCfgKey key
Definition: cfg_mirror.h:65
static const MacAddress & ZeroMac()
Definition: mac_address.h:158
int ace_id_latest
Definition: cfg_mirror.h:82
std::string handle
Definition: cfg_mirror.h:119
std::string mirror_vrf
Definition: cfg_mirror.h:127
const char * Add(const MirrorCreateReq &cfg)
Definition: cfg_mirror.cc:50
std::string dst_policy_id_str
IpAddress GetMirrorSourceIp(const IpAddress &dest)
Definition: agent.cc:76
static Agent * GetInstance()
Definition: agent.h:436
static boost::uuids::uuid StringToUuid(const std::string &str)
Definition: string_util.h:145
AddressMatch::AddressType dst_addr_type
virtual bool IFNodeToUuid(IFMapNode *node, boost::uuids::uuid &u)
Definition: vn.cc:1140
std::vector< AclEntrySpec > acl_entry_specs_
void SetMirrorCfgSandeshData(std::string &handle, MirrorCfgDisplayResp &resp)
Definition: cfg_mirror.cc:345
MirrorCfgKey key
Definition: cfg_mirror.h:139
IntfMirrorCfgTree intf_mc_tree_
Definition: cfg_mirror.h:157
int src_ip_prefix_len
Definition: cfg_mirror.h:29
int end_src_port
Definition: cfg_mirror.h:39
std::string src_ip_prefix
Definition: cfg_mirror.h:28
ConfigManager * config_manager() const
Definition: agent.cc:889
std::string dst_vn
Definition: cfg_mirror.h:32
boost::asio::ip::address IpAddress
Definition: address.h:13
Definition: acl.h:62
int id
Definition: cfg_mirror.h:61
Definition: acl.h:69
std::unique_ptr< DBRequestData > data
Definition: db_table.h:49
std::string apply_vn
Definition: cfg_mirror.h:24
bool ace_add
Definition: acl.h:82
AgentDBEntry * FindActiveEntry(const DBEntry *key)
Definition: agent_db.cc:110
InterfaceTable * interface_table() const
Definition: agent.h:465
bool Enqueue(DBRequest *req)
Definition: db_table.cc:194
boost::uuids::uuid uuid
bool CanUseNode(IFMapNode *node)
std::string vrf_name
VnTable * vn_table() const
Definition: agent.h:495
std::vector< RangeSpec > protocol
std::vector< AclAddressInfo > dst_ip_list
static std::string UuidToString(const boost::uuids::uuid &id)
Definition: string_util.h:138
std::string id_
Definition: acl_entry.h:81
int start_dst_port
Definition: cfg_mirror.h:43
std::vector< ActionSpec > action_l
std::vector< RangeSpec > src_port
std::string handle
Definition: cfg_mirror.h:15
std::string src_vn
Definition: cfg_mirror.h:27
void SetIntfMirrorCfgSandeshData(std::string &handle, IntfMirrorCfgDisplayResp &resp)
Definition: cfg_mirror.cc:601
const std::string & fabric_vrf_name() const
Definition: agent.h:903
int dst_ip_prefix_len
Definition: cfg_mirror.h:34
int num_of_entries
Definition: cfg_mirror.h:81
boost::uuids::uuid intf_id
Definition: cfg_mirror.h:133
MirrorActionSpec ma
void BuildAddressInfo(const std::string &prefix, int plen, std::vector< AclAddressInfo > *list)
Definition: acl.cc:1042
IFMapNode * FindNode(const std::string &name)
Definition: ifmap_table.cc:23
std::unique_ptr< DBRequestKey > key
Definition: db_table.h:48
DBOperation oper
Definition: db_table.h:42
void Delete(MirrorCfgKey &key)
Definition: cfg_mirror.cc:548
static MirrorEntryData::MirrorEntryFlags DecodeMirrorFlag(const std::string &nh_mode, bool juniper_header)
std::string ip
Definition: cfg_mirror.h:50
uint16_t max
boost::uuids::uuid AclUuid
Definition: cfg_mirror.h:88
int start_src_port
Definition: cfg_mirror.h:38
static void DelMirrorEntry(const std::string &analyzer_name)
std::string analyzer_name
static void AddMirrorEntry(const std::string &analyzer_name, const std::string &vrf_name, const IpAddress &sip, uint16_t sport, const IpAddress &dip, uint16_t dport)
void Delete(MirrorCfgKey &key)
Definition: cfg_mirror.cc:279
AgentConfig * agent_cfg_
Definition: cfg_mirror.h:108
IntfMirrorCfgTable * interface_mirror_cfg_table() const
Definition: agent.h:571
void Shutdown()
Definition: cfg_mirror.cc:43
int end_dst_port
Definition: cfg_mirror.h:44
std::string mirror_vrf
Definition: cfg_mirror.h:54
std::string intf_name
Definition: cfg_mirror.h:134
const char * UpdateAclEntry(AclUuid &id, bool create, MirrorCfgEntry *e, int ace_id)
Definition: cfg_mirror.cc:196
AclEntryID id
std::string dst_ip_prefix
Definition: cfg_mirror.h:33
uint16_t min
AgentConfig * agent_cfg_
Definition: cfg_mirror.h:156
MirrorCfgTable * mirror_cfg_table() const
Definition: agent.h:470
#define LOG(_Level, _Msg)
Definition: logging.h:33
VnAclMap vn_acl_map_
Definition: cfg_mirror.h:110
MirrorCfgData data
Definition: cfg_mirror.h:66
IFMapAgentTable * cfg_vn_table() const
Definition: cfg_init.h:26
AceInfo ace_info
Definition: cfg_mirror.h:67
AddressMatch::AddressType src_addr_type
const char * Add(const IntfMirrorCreateReq &cfg)
Definition: cfg_mirror.cc:442
boost::uuids::uuid id
Definition: cfg_mirror.h:80
IntfMirrorCfgData data
Definition: cfg_mirror.h:140
static MacAddress FromString(const std::string &str, boost::system::error_code *error=NULL)
Definition: mac_address.cc:71
AclTable * acl_table() const
Definition: agent.h:515
MirrorDestination mirror_dest
Definition: cfg_mirror.h:135
TrafficAction::TrafficActionType ta_type
virtual bool IFNodeToReq(IFMapNode *node, DBRequest &req, const boost::uuids::uuid &u)
Definition: vn.cc:1148
Agent * agent() const
Definition: cfg_init.h:162
std::string src_policy_id_str
std::vector< AclAddressInfo > src_ip_list
const boost::uuids::uuid GetMirrorUuid(const std::string &vn_name) const
Definition: cfg_mirror.cc:335
uint16_t mirror_port() const
Definition: agent.h:1111
boost::uuids::uuid acl_id
Definition: cfg_mirror.h:60
std::vector< RangeSpec > dst_port
MirrorCfgTree mc_tree_
Definition: cfg_mirror.h:109