OpenSDN source code
ksync_vxlan_port.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_agent_ksync_vxlan_port_h
7 #define vnsw_agent_ksync_vxlan_port_h
8 
9 /**************************************************************************
10  * KSync object to manage VxLan Ports
11  *
12  * Agent oper DBTable Interface drives VxLan Ports
13  * A vxlan port is created for every vm-interface in the table. Other
14  * interface types are ignored
15  **************************************************************************/
17 public:
19  virtual ~KSyncVxlanPortObject();
20 
21  void Init();
22  void RegisterDBClients();
23  void Shutdown();
24 
25  // Method to allocate the inherited KSyncVxlanPortEntry
26  // Must populate the KSyncEntry from DBEntry passed.
27  // DBEntry will be of type Interface
28  virtual KSyncEntry *DBToKSyncEntry(const DBEntry *e) = 0;
29 
30  // Method to allocate the inherited KSyncVxlanPortEntry.
31  // The fields in "key" must be copied into the newly allocated object
32  virtual KSyncEntry *Alloc(const KSyncEntry *key, uint32_t index) = 0;
33 
34  KSyncVxlan *ksync() const { return ksync_; }
35 private:
38 };
39 
40 /**************************************************************************
41  * KSync representation of every Vxlan Port created.
42  * A KSyncVxlanBridgeEntry is created for every interface of type VM_INTERFACE
43  **************************************************************************/
45 public:
47  const KSyncVxlanPortEntry *entry);
48  KSyncVxlanPortEntry(KSyncVxlanPortObject *obj, const Interface *intrface);
49  virtual ~KSyncVxlanPortEntry();
50 
51  KSyncDBObject *GetObject() const;
52 
53  virtual std::string ToString() const;
54  virtual bool Sync(DBEntry *e);
55  virtual bool IsLess(const KSyncEntry &rhs) const;
57 
58  // Virtual method invoked when a Vxlan Port is to be created
59  virtual bool Add() = 0;
60  // Virtual method invoked when a Vxlan Port is to be modified
61  virtual bool Change() = 0;
62  // Virtual method invoked when a Vxlan Port is to be deleted
63  virtual bool Delete() = 0;
64 
65  Interface::Type type() const { return type_; }
66  const std::string &port_name() const { return port_name_; }
67  const KSyncVxlanBridgeEntry *bridge() const { return bridge_; }
68 private:
70  std::string port_name_;
71  // Bridge for the port
75 };
76 #endif // vnsw_agent_ksync_vxlan_port_h
virtual bool Sync(DBEntry *e)
KSyncVxlanPortEntry(KSyncVxlanPortObject *obj, const KSyncVxlanPortEntry *entry)
KSyncVxlanBridgeEntry * bridge_
KSyncVxlanPortObject * ksync_obj_
Interface::Type type() const
virtual ~KSyncVxlanPortEntry()
DISALLOW_COPY_AND_ASSIGN(KSyncVxlanPortEntry)
const std::string & port_name() const
Interface::Type type_
virtual bool Add()=0
virtual std::string ToString() const
virtual bool Delete()=0
virtual bool IsLess(const KSyncEntry &rhs) const
virtual KSyncEntry * UnresolvedReference()
virtual bool Change()=0
const KSyncVxlanBridgeEntry * bridge() const
KSyncDBObject * GetObject() const
DISALLOW_COPY_AND_ASSIGN(KSyncVxlanPortObject)
KSyncVxlanPortObject(KSyncVxlan *ksync)
virtual KSyncEntry * Alloc(const KSyncEntry *key, uint32_t index)=0
KSyncVxlan * ksync() const
virtual KSyncEntry * DBToKSyncEntry(const DBEntry *e)=0