OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ksync_vxlan_bridge.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef vnsw_agent_ksync_vxlan_bridge_h
6 #define vnsw_agent_ksync_vxlan_bridge_h
7 
8 /**************************************************************************
9  * KSync object to manage VxLan bridge.
10  * Registers as client to VxLan DBTable in oper-db.
11  **************************************************************************/
13 public:
15  virtual ~KSyncVxlanBridgeObject();
16 
17  void Init();
18  void Shutdown();
19  void RegisterDBClients();
20 
21  // Method to allocate the inherited KSyncVxlanBridgeEntry
22  // Must populate the KSyncEntry from DBEntry passed.
23  // DBEntry will be of type VxLanId
24  virtual KSyncEntry *DBToKSyncEntry(const DBEntry *e) = 0;
25 
26  // Method to allocate the inherited KSyncVxlanBridgeEntry.
27  // The fields in "key" must be copied into the newly allocated object
28  virtual KSyncEntry *Alloc(const KSyncEntry *key, uint32_t index) = 0;
29 
30  KSyncVxlan *ksync() const { return ksync_; }
31 private:
34 };
35 
36 /**************************************************************************
37  * KSync representation of every Vxlan Bridge created.
38  * A KSyncVxlanBridgeEntry is created for every Vxlan entry in oper-db
39  **************************************************************************/
41 public:
43  const KSyncVxlanBridgeEntry *entry);
46 
47  KSyncDBObject *GetObject() const;
48 
49  virtual std::string ToString() const;
50  virtual bool Sync(DBEntry *e);
51  virtual bool IsLess(const KSyncEntry &rhs) const;
53 
54  // Virtual method invoked when a Vxlan Bridge is to be created
55  virtual bool Add() = 0;
56  // Virtual method invoked by KSync to handle change to Vxlan Bridge.
57  // Vxlan-Id is the only member of vxlan bridge and it should never change.
58  // Assert to catch any unexpected scenarios.
59  virtual bool Change() {
60  assert(0);
61  return true;
62  }
63  // Virtual method invoked to delete a Vxlan Bridge
64  virtual bool Delete() = 0;
65 
66  uint32_t vxlan_id() const { return vxlan_id_; }
67 private:
68  uint32_t vxlan_id_;
71 };
72 #endif // vnsw_agent_ksync_vxlan_bridge_h
DISALLOW_COPY_AND_ASSIGN(KSyncVxlanBridgeEntry)
KSyncDBObject * GetObject() const
uint32_t vxlan_id() const
virtual bool Add()=0
Definition: vxlan.h:14
virtual KSyncEntry * DBToKSyncEntry(const DBEntry *e)=0
KSyncVxlanBridgeObject * ksync_obj_
virtual bool Sync(DBEntry *e)
virtual std::string ToString() const
KSyncVxlanBridgeObject(KSyncVxlan *ksync)
DISALLOW_COPY_AND_ASSIGN(KSyncVxlanBridgeObject)
virtual bool Delete()=0
KSyncVxlan * ksync() const
KSyncVxlanBridgeEntry(KSyncVxlanBridgeObject *obj, const KSyncVxlanBridgeEntry *entry)
virtual KSyncEntry * UnresolvedReference()
virtual bool IsLess(const KSyncEntry &rhs) const
virtual KSyncEntry * Alloc(const KSyncEntry *key, uint32_t index)=0