Skip to content

Commit

Permalink
Remove duplicate handling of flow drop reason string
Browse files Browse the repository at this point in the history
Closes-Bug: #1549624
Please enter the commit message for your changes. Lines starting

Change-Id: Id8069cb9c4a5c4d5e57cd29e8aec5b4997b67776
  • Loading branch information
krharsh committed Mar 2, 2016
1 parent 960617b commit 5ec1a0f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 74 deletions.
40 changes: 20 additions & 20 deletions src/vnsw/agent/pkt/flow_entry.cc
Expand Up @@ -61,30 +61,30 @@ const std::map<uint16_t, const char*>
FlowEntry::FlowDropReasonStr = boost::assign::map_list_of
((uint16_t)DROP_UNKNOWN, "UNKNOWN")
((uint16_t)SHORT_UNAVIALABLE_INTERFACE,
"SHORT_UNAVIALABLE_INTERFACE")
((uint16_t)SHORT_IPV4_FWD_DIS, "SHORT_IPV4_FWD_DIS")
"Short flow Interface unavialable")
((uint16_t)SHORT_IPV4_FWD_DIS, "Short flow Ipv4 forwarding disabled")
((uint16_t)SHORT_UNAVIALABLE_VRF,
"SHORT_UNAVIALABLE_VRF")
((uint16_t)SHORT_NO_SRC_ROUTE, "SHORT_NO_SRC_ROUTE")
((uint16_t)SHORT_NO_DST_ROUTE, "SHORT_NO_DST_ROUTE")
((uint16_t)SHORT_AUDIT_ENTRY, "SHORT_AUDIT_ENTRY")
((uint16_t)SHORT_VRF_CHANGE, "SHORT_VRF_CHANGE")
((uint16_t)SHORT_NO_REVERSE_FLOW, "SHORT_NO_REVERSE_FLOW")
"Short flow VRF unavailable")
((uint16_t)SHORT_NO_SRC_ROUTE, "Short flow No Source route")
((uint16_t)SHORT_NO_DST_ROUTE, "Short flow No Destination route")
((uint16_t)SHORT_AUDIT_ENTRY, "Short flow Audit Entry")
((uint16_t)SHORT_VRF_CHANGE, "Short flow VRF CHANGE")
((uint16_t)SHORT_NO_REVERSE_FLOW, "Short flow No Reverse flow")
((uint16_t)SHORT_REVERSE_FLOW_CHANGE,
"SHORT_REVERSE_FLOW_CHANGE")
((uint16_t)SHORT_NAT_CHANGE, "SHORT_NAT_CHANGE")
((uint16_t)SHORT_FLOW_LIMIT, "SHORT_FLOW_LIMIT")
"Short flow Reverse flow change")
((uint16_t)SHORT_NAT_CHANGE, "Short flow NAT Changed")
((uint16_t)SHORT_FLOW_LIMIT, "Short flow Flow Limit Reached")
((uint16_t)SHORT_LINKLOCAL_SRC_NAT,
"SHORT_LINKLOCAL_SRC_NAT")
"Short flow Linklocal source NAT failed")
((uint16_t)SHORT_FAILED_VROUTER_INSTALL,
"SHORT_FAILED_VROUTER_INST")
((uint16_t)SHORT_INVALID_L2_FLOW, "SHORT_INVALID_L2_FLOW")
((uint16_t)DROP_POLICY, "DROP_POLICY")
((uint16_t)DROP_OUT_POLICY, "DROP_OUT_POLICY")
((uint16_t)DROP_SG, "DROP_SG")
((uint16_t)DROP_OUT_SG, "DROP_OUT_SG")
((uint16_t)DROP_REVERSE_SG, "DROP_REVERSE_SG")
((uint16_t)DROP_REVERSE_OUT_SG, "DROP_REVERSE_OUT_SG");
"Short flow vrouter install failed")
((uint16_t)SHORT_INVALID_L2_FLOW, "Short flow invalid L2 flow")
((uint16_t)DROP_POLICY, "Flow drop Policy")
((uint16_t)DROP_OUT_POLICY, "Flow drop Out Policy")
((uint16_t)DROP_SG, "Flow drop SG")
((uint16_t)DROP_OUT_SG, "Flow drop OUT SG")
((uint16_t)DROP_REVERSE_SG, "Flow drop REVERSE SG")
((uint16_t)DROP_REVERSE_OUT_SG, "Flow drop REVERSE OUT SG");

tbb::atomic<int> FlowEntry::alloc_count_;
SecurityGroupList FlowEntry::default_sg_list_;
Expand Down
56 changes: 2 additions & 54 deletions src/vnsw/agent/pkt/pkt_sandesh_flow.cc
Expand Up @@ -25,7 +25,7 @@ using boost::system::error_code;
std::vector<ActionStr> action_str_l; \
SetActionStr(fe->match_p().action_info, action_str_l); \
if ((fe->match_p().action_info.action & TrafficAction::DROP_FLAGS) != 0) {\
data.set_drop_reason(GetFlowDropReason(fe)); \
data.set_drop_reason(fe->DropReasonStr(fe->data().drop_reason)); \
} \
data.set_action_str(action_str_l); \
std::vector<MirrorActionSpec>::const_iterator mait; \
Expand Down Expand Up @@ -66,7 +66,7 @@ using boost::system::error_code;
data.set_implicit_deny(fe->ImplicitDenyFlow() ? "yes" : "no"); \
data.set_short_flow( \
fe->is_flags_set(FlowEntry::ShortFlow) ? \
string("yes (") + GetShortFlowReason(fe->short_flow_reason()) + \
string("yes (") + fe->DropReasonStr(fe->short_flow_reason()) + \
")": "no"); \
data.set_local_flow(fe->is_flags_set(FlowEntry::LocalFlow) ? "yes" : "no"); \
data.set_src_vn_list(fe->data().SourceVnList()); \
Expand Down Expand Up @@ -99,58 +99,6 @@ const std::string PktSandeshFlow::start_key = "0-0-0-0-0.0.0.0-0.0.0.0";

////////////////////////////////////////////////////////////////////////////////

static const char * GetShortFlowReason(uint16_t reason) {
switch (reason) {
case FlowEntry::SHORT_UNAVIALABLE_INTERFACE:
return "Interface unavialable";
case FlowEntry::SHORT_IPV4_FWD_DIS:
return "Ipv4 forwarding disabled";
case FlowEntry::SHORT_UNAVIALABLE_VRF:
return "VRF unavailable";
case FlowEntry::SHORT_NO_SRC_ROUTE:
return "No Source route";
case FlowEntry::SHORT_NO_DST_ROUTE:
return "No Destination route";
case FlowEntry::SHORT_AUDIT_ENTRY:
return "Audit Entry";
case FlowEntry::SHORT_VRF_CHANGE:
return "VRF Change";
case FlowEntry::SHORT_NO_REVERSE_FLOW:
return "No Reverse flow";
case FlowEntry::SHORT_REVERSE_FLOW_CHANGE:
return "Reverse flow change";
case FlowEntry::SHORT_NAT_CHANGE:
return "NAT Changed";
case FlowEntry::SHORT_FLOW_LIMIT:
return "Flow Limit Reached";
case FlowEntry::SHORT_LINKLOCAL_SRC_NAT:
return "Linklocal source NAT failed";
default:
break;
}
return "Unknown";
}

static const char * GetFlowDropReason(FlowEntry *fe) {
switch (fe->data().drop_reason) {
case FlowEntry::DROP_POLICY:
return "Policy";
case FlowEntry::DROP_OUT_POLICY:
return "Out Policy";
case FlowEntry::DROP_SG:
return "SG";
case FlowEntry::DROP_OUT_SG:
return "Out SG";
case FlowEntry::DROP_REVERSE_SG:
return "Reverse SG";
case FlowEntry::DROP_REVERSE_OUT_SG:
return "Reverse Out SG";
default:
break;
}
return GetShortFlowReason(fe->data().drop_reason);;
}

static void SetOneAclInfo(FlowAclInfo *policy, uint32_t action,
const MatchAclParamsList &acl_list) {
MatchAclParamsList::const_iterator it;
Expand Down

0 comments on commit 5ec1a0f

Please sign in to comment.