-
Notifications
You must be signed in to change notification settings - Fork 390
/
vn_ovsdb.cc
92 lines (73 loc) · 2.41 KB
/
vn_ovsdb.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
*/
extern "C" {
#include <ovsdb_wrapper.h>
};
#include <oper/vn.h>
#include <oper/vrf.h>
#include <ovsdb_types.h>
#include <unicast_mac_local_ovsdb.h>
#include <vn_ovsdb.h>
using OVSDB::OvsdbDBEntry;
using OVSDB::VnOvsdbEntry;
using OVSDB::VnOvsdbObject;
VnOvsdbEntry::VnOvsdbEntry(VnOvsdbObject *table,
const boost::uuids::uuid &uuid) : OvsdbDBEntry(table), uuid_(uuid) {
}
void VnOvsdbEntry::AddMsg(struct ovsdb_idl_txn *txn) {
VnEntry *vn = static_cast<VnEntry *>(GetDBEntry());
vrf_ = vn->GetVrf();
}
void VnOvsdbEntry::ChangeMsg(struct ovsdb_idl_txn *txn) {
}
void VnOvsdbEntry::DeleteMsg(struct ovsdb_idl_txn *txn) {
UnicastMacLocalOvsdb *uc_obj =
table_->client_idl()->unicast_mac_local_ovsdb();
// Entries in Unicast Mac Local Table are dependent on vn/vrf
// on delete of this entry trigger Vrf re-eval for entries in
// Unicast Mac Local Table
uc_obj->VrfReEvalEnqueue(vrf_.get());
vrf_ = NULL;
}
bool VnOvsdbEntry::Sync(DBEntry *db_entry) {
return false;
}
bool VnOvsdbEntry::IsLess(const KSyncEntry &entry) const {
const VnOvsdbEntry &vn_entry = static_cast<const VnOvsdbEntry&>(entry);
return uuid_ < vn_entry.uuid_;
}
KSyncEntry *VnOvsdbEntry::UnresolvedReference() {
return NULL;
}
VnOvsdbObject::VnOvsdbObject(OvsdbClientIdl *idl, DBTable *table) :
OvsdbDBObject(idl, table) {
}
VnOvsdbObject::~VnOvsdbObject() {
}
void VnOvsdbObject::OvsdbNotify(OvsdbClientIdl::Op op,
struct ovsdb_idl_row *row) {
}
KSyncEntry *VnOvsdbObject::Alloc(const KSyncEntry *key, uint32_t index) {
const VnOvsdbEntry *k_entry =
static_cast<const VnOvsdbEntry *>(key);
VnOvsdbEntry *entry = new VnOvsdbEntry(this, k_entry->uuid_);
return entry;
}
KSyncEntry *VnOvsdbObject::DBToKSyncEntry(const DBEntry* db_entry) {
const VnEntry *entry = static_cast<const VnEntry *>(db_entry);
VnOvsdbEntry *key = new VnOvsdbEntry(this, entry->GetUuid());
return static_cast<KSyncEntry *>(key);
}
OvsdbDBEntry *VnOvsdbObject::AllocOvsEntry(struct ovsdb_idl_row *row) {
return NULL;
}
KSyncDBObject::DBFilterResp VnOvsdbObject::DBEntryFilter(
const DBEntry *entry) {
const VnEntry *vn = static_cast<const VnEntry *>(entry);
// only accept Virtual Networks with non-NULL vrf.
if (vn->GetVrf() == NULL) {
return DBFilterDelete;
}
return DBFilterAccept;
}