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