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