OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
controller_route_walker.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef vnsw_controller_route_walker_hpp
6 #define vnsw_controller_route_walker_hpp
7 
9 
10 /*
11  * Handles all kind of walks issued in context ofr controller i.e. bgp peer.
12  * This walker is existing per peer. Internally it uses agent_route_walker.
13  * Kind of walks supported are:
14  * 1) NOTIFYALL - Walks all VRF and corresponding route table to notify to peer
15  * 2) NOTIFYMULTICAST - Only sends multicast entries from all tables to peer.
16  * 3) DELPEER - Deletes path received from this peer from all.
17  * 4) DELSTALE - Marks the path/info from this peer as stale and does not delete
18  * it. In the case of unicast it marks peer path as stale and in multicast
19  * it doesnt delete the info sent by this peer.
20  */
22 public:
23  enum Type {
28  };
29 
30  ControllerRouteWalker(const std::string &name, Peer *peer);
31  virtual ~ControllerRouteWalker() { }
32 
33  //Starts the walk- walk_done_cb is used to get callback when walk is over
34  //i.e. all VRF and all corresponding route walks are over.
35  void Start(Type type, bool associate,
36  AgentRouteWalker::WalkDone walk_done_cb);
37  void StartRouteWalk(VrfEntry *vrf, bool associate, Type type);
38  //Callback for identifying walk complete of all route tables for given vrf
39  void RouteWalkDoneForVrf(VrfEntry *vrf);
41  uint64_t sequence_number() const {return sequence_number_;}
44  }
45 
46  //Override vrf notification
47  virtual bool VrfWalkNotify(DBTablePartBase *partition, DBEntryBase *e);
48  //Override route notification
49  virtual bool RouteWalkNotify(DBTablePartBase *partition, DBEntryBase *e);
50 
51 private:
52  //VRF notification handlers
53  bool VrfNotifyInternal(DBTablePartBase *partition, DBEntryBase *e);
54  bool VrfNotifyMulticast(DBTablePartBase *partition, DBEntryBase *e);
55  bool VrfNotifyAll(DBTablePartBase *partition, DBEntryBase *e);
56  bool VrfDelPeer(DBTablePartBase *partition, DBEntryBase *e);
57  bool VrfDelStale(DBTablePartBase *partition, DBEntryBase *e);
58 
59  //Route notification handlers
60  bool RouteNotifyInternal(DBTablePartBase *partition, DBEntryBase *e);
61  bool RouteNotifyAll(DBTablePartBase *partition, DBEntryBase *e);
63  bool RouteDelPeer(DBTablePartBase *partition, DBEntryBase *e);
64  bool RouteDelStale(DBTablePartBase *partition, DBEntryBase *e);
65 
66  //Helpers
67  bool IsDeleteWalk() const;
68  bool IgnoreNotify();
69 
71  bool associate_;
73  uint64_t sequence_number_;
75 };
76 
77 #endif
bool VrfNotifyAll(DBTablePartBase *partition, DBEntryBase *e)
Definition: vrf.h:86
void StartRouteWalk(VrfEntry *vrf, bool associate, Type type)
DISALLOW_COPY_AND_ASSIGN(ControllerRouteWalker)
bool RouteNotifyInternal(DBTablePartBase *partition, DBEntryBase *e)
virtual bool VrfWalkNotify(DBTablePartBase *partition, DBEntryBase *e)
bool RouteNotifyMulticast(DBTablePartBase *partition, DBEntryBase *e)
void set_sequence_number(uint64_t sequence_number)
bool RouteNotifyAll(DBTablePartBase *partition, DBEntryBase *e)
uint8_t type
Definition: load_balance.h:109
uint64_t sequence_number() const
ControllerRouteWalker(const std::string &name, Peer *peer)
Definition: peer.h:44
void Start(Type type, bool associate, AgentRouteWalker::WalkDone walk_done_cb)
virtual bool RouteWalkNotify(DBTablePartBase *partition, DBEntryBase *e)
void RouteWalkDoneForVrf(VrfEntry *vrf)
bool VrfDelStale(DBTablePartBase *partition, DBEntryBase *e)
bool RouteDelStale(DBTablePartBase *partition, DBEntryBase *e)
bool VrfNotifyInternal(DBTablePartBase *partition, DBEntryBase *e)
bool VrfNotifyMulticast(DBTablePartBase *partition, DBEntryBase *e)
boost::function< void()> WalkDone
bool RouteDelPeer(DBTablePartBase *partition, DBEntryBase *e)
bool VrfDelPeer(DBTablePartBase *partition, DBEntryBase *e)