Line data Source code
1 : /* 2 : * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. 3 : * Copyright Contributors to the OpenSDN project 4 : */ 5 : #ifndef __AGENT_FLOW_UVE_STATS_REQUEST_H__ 6 : #define __AGENT_FLOW_UVE_STATS_REQUEST_H__ 7 : 8 : #include "pkt/flow_table.h" 9 : #include "pkt/flow_event.h" 10 : 11 : struct FlowUveFwPolicyInfo { 12 : TagList local_tagset_; 13 : std::string fw_policy_; 14 : TagList remote_tagset_; 15 : std::string remote_prefix_; 16 : std::string remote_vn_; 17 : std::string local_vn_; 18 : bool initiator_; 19 : bool added_; 20 : std::string action_; 21 : bool short_flow_; 22 : bool is_valid_; 23 382 : FlowUveFwPolicyInfo() : is_valid_(false) {} 24 : }; 25 : 26 : struct FlowUveVnAcePolicyInfo { 27 : std::string vn_; 28 : std::string nw_ace_uuid_; 29 : bool is_valid_; 30 382 : FlowUveVnAcePolicyInfo() : is_valid_(false) {} 31 : }; 32 : 33 : //////////////////////////////////////////////////////////////////////////// 34 : // Request to the Uve module for Flow based statistics update 35 : //////////////////////////////////////////////////////////////////////////// 36 : class FlowUveStatsRequest { 37 : public: 38 : enum Event { 39 : INVALID, 40 : ADD_FLOW, 41 : DELETE_FLOW 42 : }; 43 : 44 230 : FlowUveStatsRequest(Event event, const boost::uuids::uuid &u, 45 : const std::string &intf, const std::string &sg_rule, 46 : const FlowUveVnAcePolicyInfo &vn_ace_info, 47 230 : const FlowUveFwPolicyInfo &fw_policy_info) : 48 230 : event_(event), uuid_(u), interface_(intf), sg_rule_uuid_(sg_rule), 49 230 : sg_info_valid_(false), vn_ace_info_(vn_ace_info), 50 230 : fw_policy_info_(fw_policy_info) { 51 230 : if (!intf.empty() && !sg_rule.empty()) { 52 184 : sg_info_valid_ = true; 53 : } 54 230 : } 55 : 56 152 : FlowUveStatsRequest(Event event, const boost::uuids::uuid &u, 57 : const std::string &intf, 58 152 : const FlowUveFwPolicyInfo &fw_policy_info) : 59 152 : event_(event), uuid_(u), interface_(intf), sg_info_valid_(false), 60 152 : fw_policy_info_(fw_policy_info) { 61 152 : } 62 : 63 382 : ~FlowUveStatsRequest() { } 64 : 65 378 : Event event() const { return event_; } 66 528 : const boost::uuids::uuid &uuid() const { return uuid_; } 67 603 : const std::string &interface() const { return interface_; } 68 424 : const std::string &sg_rule_uuid() const { return sg_rule_uuid_; } 69 409 : bool sg_info_valid() const { return sg_info_valid_; } 70 410 : const FlowUveVnAcePolicyInfo &vn_ace_info() const { return vn_ace_info_; } 71 46 : bool vn_ace_valid() const { return vn_ace_info_.is_valid_; } 72 376 : const FlowUveFwPolicyInfo &fw_policy_info() const { return fw_policy_info_;} 73 4 : bool fw_policy_valid() const { return fw_policy_info_.is_valid_; } 74 : 75 : private: 76 : Event event_; 77 : boost::uuids::uuid uuid_; 78 : std::string interface_; 79 : std::string sg_rule_uuid_; 80 : bool sg_info_valid_; 81 : FlowUveVnAcePolicyInfo vn_ace_info_; 82 : FlowUveFwPolicyInfo fw_policy_info_; 83 : 84 : DISALLOW_COPY_AND_ASSIGN(FlowUveStatsRequest); 85 : }; 86 : #endif // __AGENT_FLOW_UVE_STATS_REQUEST_H__