Line data Source code
1 : /* 2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef __AGENT_OPER_GLOBAL_SYSTEM_CONFIG_H 6 : #define __AGENT_OPER_GLOBAL_SYSTEM_CONFIG_H 7 : 8 : #include <cmn/agent_cmn.h> 9 : #include <oper/oper_db.h> 10 : 11 : class IFMapNode; 12 : namespace autogen { 13 : class GlobalSystemConfig; 14 : } 15 : 16 : struct BGPaaServiceParameters { 17 : typedef std::pair<uint16_t, uint16_t> BGPaaServicePortRangePair; 18 : void Reset(); 19 : 20 : int port_start; 21 : int port_end; 22 : }; 23 : 24 : struct GracefulRestartParameters { 25 : public: 26 : typedef boost::function<void()> Callback; 27 : typedef std::vector<Callback> CallbackList; 28 : void Reset(); 29 : void Update(autogen::GlobalSystemConfig *cfg); 30 : void Register(GracefulRestartParameters::Callback cb); 31 0 : bool enable() const { return enable_; } 32 0 : bool xmpp_helper_enable() const { return xmpp_helper_enable_; } 33 0 : bool config_seen() const { return config_seen_; } 34 0 : uint32_t end_of_rib_time() { return end_of_rib_time_; } 35 2 : uint32_t long_lived_restart_time() { return long_lived_restart_time_; } 36 4 : uint64_t llgr_stale_time() { return (long_lived_restart_time_ + 37 4 : end_of_rib_time_); } 38 19 : bool IsEnabled() const { 39 19 : return (config_seen_ && enable_ && xmpp_helper_enable_); 40 : } 41 : 42 : private: 43 : void Notify(); 44 : 45 : bool enable_; 46 : uint64_t end_of_rib_time_; 47 : uint64_t long_lived_restart_time_; 48 : bool xmpp_helper_enable_; 49 : CallbackList callbacks_; 50 : bool config_seen_; 51 : }; 52 : 53 : struct FastConvergenceParameters { 54 : void Reset(); 55 : 56 : uint8_t xmpp_hold_time; 57 : bool enable; 58 : }; 59 : 60 : class GlobalSystemConfig : public OperIFMapTable { 61 : public: 62 : GlobalSystemConfig(Agent *agent); 63 : virtual ~GlobalSystemConfig(); 64 : 65 : void ConfigDelete(IFMapNode *node); 66 : void ConfigAddChange(IFMapNode *node); 67 : void ConfigManagerEnqueue(IFMapNode *node); 68 0 : BGPaaServiceParameters::BGPaaServicePortRangePair bgpaas_port_range() const { 69 0 : return std::make_pair(bgpaas_parameters_.port_start, 70 0 : bgpaas_parameters_.port_end); 71 : } 72 : void Reset(); 73 : GracefulRestartParameters &gres_parameters(); 74 5 : FastConvergenceParameters &fc_params() { return fc_params_; } 75 : bool cfg_igmp_enable() const; 76 : void FillSandeshInfo(GlobalSystemConfigResp *resp); 77 : 78 : private: 79 : BGPaaServiceParameters bgpaas_parameters_; 80 : GracefulRestartParameters gres_parameters_; 81 : FastConvergenceParameters fc_params_; 82 : bool cfg_igmp_enable_; 83 : DISALLOW_COPY_AND_ASSIGN(GlobalSystemConfig); 84 : }; 85 : #endif