Skip to content

Commit

Permalink
Merge the following commits from R2.1 branch (final).
Browse files Browse the repository at this point in the history
        Perf improvements for Logical Interface delete handling

        Follow up on commit b4af4d6 for delete
        handling

        When a link delete is notified to config listener, the IFMapNode in link
        can be NULL. We used to ignore links with left/right node deleted.

        Modified the link handler to pass the node-type when left/right node is
        deleted. This way, the IFLinkToReq handler can take action based on the
        type of node being deleted
        (cherry picked from commit f1d7816)

        Conflicts:
            src/vnsw/agent/test-xml/test_xml_oper.cc

        Holding the UUID from ID_PERMS in config DBState in DB Add and using it
        for Config Delete
        closes-bug: #1420209
        (cherry picked from commit 6a9b4be)

        * Send ARP request packet on VMI interface instead of parent interface
          such that vlan gets added, based on transmit vlan id
        * If vlan-id is 0, then its treated as untagged interface, in agent
          while framing the packet we were setting the tag in packet 0
          avoiding the same same setting vlan id as invalid and programming
          it as vlan-id 0 only in vrouter
        Closes-bug:#1423122
        (cherry picked from commit 38f1405)

        * If arp route is deleted twice, then we arp nexthop was not
          getting deleted, since upon each arp route delete we enqueue
          a request to modify nexthop to invalid and this might
          result in arp entry creation, hence use operation RESYNC
          instead of add/change
        * Check for vrf while parsing on subnet address change, since
          we might modify next vrf subnet routes if prefixx matches
        Test case for same
        Closes-bug:#1423502
        (cherry picked from commit a65d557)

        Conflicts:
            src/vnsw/agent/test/test_route.cc

        reverting the unwated checkin of modifying the notify_count_ to bool

        (cherry picked from commit 975f507)

        * Whenever ICMP error packet is trapped for flow setup,
          parse the inner payload and frame the flow key
        Closes-bug:#1423848
        (cherry picked from commit 81ee647)

        * ARP route behind gateway should have proxy flag set
          such that arp request on VM would be proxied by vrouter
        Closes-bug:#1423122
        (cherry picked from commit e72443e)

        Remove unused UVEs

        Remove UVE generated on add/delete of a link
        Remove UVE generated on change of physical-device-vn entry.
        Added a UT for physical-device-vn to validate add/delete of VMI to VN link

        (cherry picked from commit 452b934)

        Holding the metadata of link while storing it in defer list. While
        adding the link to Graph from defer list, the metadata also added back
        to graph which makes the dependency tracker to work correctly

        (cherry picked from commit 43d7a71)

        Optimize config handling for SG and ACL

        Follow up to commit
        b4af4d6

        On any change or link add/delete to a SG, we are invoking IFNodeToReq
        for all connected VMI. Fix this by registering link handler for SG and
        invoke IFNodeToReq only for peer VMI

        On any change or link add/delete to a ACL, we are invoking IFNodeToReq
        for all connected SG and VN. Fix this by registering link handler for ACL
        and invoke IFNodeToReq only for peer SG / VN
        (cherry picked from commit 0d33ec1)

        * In a scenario where there are 2 vgw exporting same subnet route,
          and traffic session gets initiated from external domain to
          VM, then for setting reverse flow agent was trying to get policy
          enabled interface nexthop for vgw, and for vgw we would only
          create policy disabled nh. Fixing the same to pick
          policy disabled nexthop for vgw destination
        Closes-bug:#1425856

        (cherry picked from commit f000a7f)

        Fix Tor-Agent assert for KSyncEntry GetReference

        Issue:
        ------
        On connection close delete is triggered for all the KSync
        Objects, creation of entry after this deletion in not
        allowed.
        Here Logical Switch Object is deleted and Unicast Remote
        Entry Table is yet to receive a delete, in the meanwhile
        a route table entry get notified and tries to take create
        a temp entry for reference in Logical Switch Entry which
        is already deleted

        Fix:
        ----
        Since delete trigger for Unicast Remote Entry Table happens
        in context of VRF table walk, which will have a yeild in
        between. during this time if a notification for route table
        happens, it needs to be ignored.

        Also fixing a memory leak in idl deletion path

        Closes-Bug: 1424531
        (cherry picked from commit d4ba989)

DHCP enable/disable bug fixes

1) Fix bug where dhcp enable flag toggling was not reflected in route -
Toggling of DHCP enable in interface results in route rebake. Also flag for
handle_dhcp is now moved from path to route.
2) Remove mac VM binding, instead add a route with DHCP peer path which can be
used to get binding. This path is having discard NH.
Closes-bug: #1417131

Conflicts:

	src/vnsw/agent/oper/operdb_init.h
	src/vnsw/agent/test-xml/test_xml_oper.cc
	src/vnsw/agent/test/test_route.cc

Rename Dhcp path/peer to MacVmBinding.

Change-Id: I0643612ca907b85c548d4132502e00ca1498fdc1
  • Loading branch information
haripk committed Mar 5, 2015
1 parent ed4b9da commit 9d44b8f
Show file tree
Hide file tree
Showing 90 changed files with 2,022 additions and 660 deletions.
1 change: 1 addition & 0 deletions src/ifmap/ifmap_agent.sandesh
Expand Up @@ -19,6 +19,7 @@ struct IFMapAgentDefLink {
1: i64 seq_num;
2: string left_node;
3: string right_node;
4: string metadata;
}

response sandesh ShowIFMapAgentDefLinkResp {
Expand Down
13 changes: 8 additions & 5 deletions src/ifmap/ifmap_agent_sandesh.cc
Expand Up @@ -288,8 +288,8 @@ void ShowIFMapAgentDefLinkReq::HandleRequest() const {
ShowIFMapAgentTable::db_->FindTable(IFMAP_AGENT_LINK_DB_NAME));

IFMapAgentLinkTable::LinkDefMap::const_iterator dlist_it;
std::list<IFMapTable::RequestKey> *ent;
std::list<IFMapTable::RequestKey>::iterator it;
std::list<IFMapAgentLinkTable::DeferredNode> *ent;
std::list<IFMapAgentLinkTable::DeferredNode>::iterator it;

//Get linktables's deferred list
const IFMapAgentLinkTable::LinkDefMap &def_list = link_table->GetLinkDefMap();
Expand All @@ -306,9 +306,12 @@ void ShowIFMapAgentDefLinkReq::HandleRequest() const {
//Iterate the right nodes corresponding to above left node
for(it = ent->begin(); it != ent->end(); it++) {
IFMapAgentDefLink data;
data.set_seq_num((*it).id_seq_num);
data.set_left_node(temp.id_type + ":" + temp.id_name);
data.set_right_node((*it).id_type + ":" + (*it).id_name);
data.set_seq_num((*it).node_key.id_seq_num);
data.set_left_node(temp.id_type + ":" +
temp.id_name);
data.set_metadata((*it).link_metadata);
data.set_right_node((*it).node_key.id_type + ":" +
(*it).node_key.id_name);
list.push_back(data);
}
}
Expand Down
83 changes: 48 additions & 35 deletions src/ifmap/ifmap_agent_table.cc
Expand Up @@ -109,6 +109,7 @@ void IFMapAgentTable::HandlePendingLinks(IFMapNode *node) {
iter++;
edge = graph_->GetEdge(node, right);
assert(edge);
IFMapLink *l = static_cast<IFMapLink *>(edge);

// Create both the request keys
auto_ptr <IFMapAgentLinkTable::RequestKey> req_key (new IFMapAgentLinkTable::RequestKey);
Expand All @@ -119,6 +120,7 @@ void IFMapAgentTable::HandlePendingLinks(IFMapNode *node) {
req_key->right_key.id_name = right->name();
req_key->right_key.id_type = right->table()->Typename();
req_key->right_key.id_seq_num = right->GetObject()->sequence_number();
req_key->metadata = l->metadata();

DBRequest req;
req.oper = DBRequest::DB_ENTRY_ADD_CHANGE;
Expand Down Expand Up @@ -159,14 +161,14 @@ void IFMapAgentTable::NotifyNode(IFMapNode *node) {
void IFMapAgentLinkTable::LinkDefAdd(DBRequest *request) {
RequestKey *key = static_cast<RequestKey *>(request->key.get());

std::list<IFMapTable::RequestKey>::iterator it;
std::list<DeferredNode>::iterator it;

std::list<IFMapTable::RequestKey> *left = NULL;
std::list<DeferredNode> *left = NULL;
LinkDefMap::iterator left_it = link_def_map_.find(key->left_key);
if (link_def_map_.end() != left_it)
left = left_it->second;

std::list<IFMapTable::RequestKey> *right = NULL;
std::list<DeferredNode> *right = NULL;
LinkDefMap::iterator right_it = link_def_map_.find(key->right_key);
if (link_def_map_.end() != right_it)
right = right_it->second;
Expand All @@ -175,8 +177,8 @@ void IFMapAgentLinkTable::LinkDefAdd(DBRequest *request) {
// remove left->right entry
if (left) {
for(it = left->begin(); it != left->end(); it++) {
if (((*it).id_type == key->right_key.id_type) &&
((*it).id_name == key->right_key.id_name)) {
if (((*it).node_key.id_type == key->right_key.id_type) &&
((*it).node_key.id_name == key->right_key.id_name)) {
left->erase(it);
break;
}
Expand All @@ -187,8 +189,8 @@ void IFMapAgentLinkTable::LinkDefAdd(DBRequest *request) {
// remove right->left entry
if (right) {
for(it = right->begin(); it != right->end(); it++) {
if (((*it).id_type == key->left_key.id_type) &&
((*it).id_name == key->left_key.id_name)) {
if (((*it).node_key.id_type == key->left_key.id_type) &&
((*it).node_key.id_name == key->left_key.id_name)) {
right->erase(it);
break;
}
Expand All @@ -205,15 +207,16 @@ void IFMapAgentLinkTable::LinkDefAdd(DBRequest *request) {
if (left) {
// If list already contains, just update the seq number
for(it = left->begin(); it != left->end(); it++) {
if (((*it).id_type == key->right_key.id_type) &&
((*it).id_name == key->right_key.id_name)) {
(*it).id_seq_num = key->right_key.id_seq_num;
if (((*it).node_key.id_type == key->right_key.id_type) &&
((*it).node_key.id_name == key->right_key.id_name)) {
(*it).node_key.id_seq_num = key->right_key.id_seq_num;
(*it).link_metadata = key->metadata;
push_left = false;
break;
}
}
} else {
left = new std::list<IFMapTable::RequestKey>();
left = new std::list<DeferredNode>();
link_def_map_[key->left_key] = left;
}

Expand All @@ -222,23 +225,30 @@ void IFMapAgentLinkTable::LinkDefAdd(DBRequest *request) {
if (right) {
// If list already contains, just update the seq number
for(it = right->begin(); it != right->end(); it++) {
if (((*it).id_type == key->left_key.id_type) &&
((*it).id_name == key->left_key.id_name)) {
(*it).id_seq_num = key->left_key.id_seq_num;
if (((*it).node_key.id_type == key->left_key.id_type) &&
((*it).node_key.id_name == key->left_key.id_name)) {
(*it).node_key.id_seq_num = key->left_key.id_seq_num;
(*it).link_metadata = key->metadata;
push_right = false;
break;
}
}
} else {
right = new std::list<IFMapTable::RequestKey>();
right = new std::list<DeferredNode>();
link_def_map_[key->right_key] = right;
}

// Add it to the end of the list
if (push_left)
left->push_back(key->right_key);
if (push_right)
right->push_back(key->left_key);
struct DeferredNode dn;
dn.link_metadata = key->metadata;
if (push_left) {
dn.node_key = key->right_key;
left->push_back(dn);
}
if (push_right) {
dn.node_key = key->left_key;
right->push_back(dn);
}
return;
}

Expand Down Expand Up @@ -449,9 +459,9 @@ void IFMapAgentLinkTable::Input(DBTablePartition *partition, DBClient *client,

bool IFMapAgentLinkTable::RemoveDefListEntry
(LinkDefMap *map, LinkDefMap::iterator &map_it,
std::list<IFMapTable::RequestKey>::iterator *list_it) {
std::list<DeferredNode>::iterator *list_it) {

std::list<IFMapTable::RequestKey> *list = map_it->second;
std::list<DeferredNode> *list = map_it->second;
if (list_it) {
list->erase(*list_it);
}
Expand All @@ -475,36 +485,38 @@ void IFMapAgentLinkTable::EvalDefLink(IFMapTable::RequestKey *key) {
if (link_def_map_.end() == link_defmap_it)
return;

std::list<IFMapTable::RequestKey> *left_list = link_defmap_it->second;
std::list<IFMapTable::RequestKey>::iterator left_it, left_list_entry;
std::list<DeferredNode> *left_list = link_defmap_it->second;
std::list<DeferredNode>::iterator left_it, left_list_entry;
for(left_it = left_list->begin(); left_it != left_list->end();) {
left_list_entry = left_it++;

// If link seq is older, dont consider the link.
if ((*left_list_entry).id_seq_num < key->id_seq_num)
if ((*left_list_entry).node_key.id_seq_num < key->id_seq_num)
continue;

// Skip if right-node is not yet present
if (IFMapAgentTable::TableEntryLookup(database(), &(*left_list_entry))
if (IFMapAgentTable::TableEntryLookup(database(),
&((*left_list_entry).node_key))
== NULL) {
continue;
}

// left->right entry found defer-list. Find the right->left entry
LinkDefMap::iterator right_defmap_it = link_def_map_.find(*left_list_entry);
LinkDefMap::iterator right_defmap_it =
link_def_map_.find((*left_list_entry).node_key);
assert(link_def_map_.end() != right_defmap_it);

std::list<IFMapTable::RequestKey> *right_list = right_defmap_it->second;
std::list<IFMapTable::RequestKey>::iterator right_it, right_list_entry;
std::list<DeferredNode> *right_list = right_defmap_it->second;
std::list<DeferredNode>::iterator right_it, right_list_entry;
for(right_it = right_list->begin(); right_it != right_list->end();) {
right_list_entry = right_it++;

// If link seq is older, dont consider the link.
if ((*right_list_entry).id_seq_num < key->id_seq_num)
if ((*right_list_entry).node_key.id_seq_num < key->id_seq_num)
continue;

if ((*right_list_entry).id_type == key->id_type &&
(*right_list_entry).id_name == key->id_name) {
if ((*right_list_entry).node_key.id_type == key->id_type &&
(*right_list_entry).node_key.id_name == key->id_name) {
RemoveDefListEntry(&link_def_map_, right_defmap_it,
&right_list_entry);
break;
Expand All @@ -514,7 +526,8 @@ void IFMapAgentLinkTable::EvalDefLink(IFMapTable::RequestKey *key) {
//Remove from deferred list before enqueing
auto_ptr <RequestKey> req_key (new RequestKey);
req_key->left_key = *key;
req_key->right_key = *left_list_entry;
req_key->right_key = (*left_list_entry).node_key;
req_key->metadata = (*left_list_entry).link_metadata;
// Dont delete left_list_entry. Its passed in req structure
left_list->erase(left_list_entry);

Expand All @@ -529,8 +542,8 @@ void IFMapAgentLinkTable::EvalDefLink(IFMapTable::RequestKey *key) {
}

void IFMapAgentLinkTable::DestroyDefLink(uint64_t seq) {
std::list<IFMapTable::RequestKey> *ent;
std::list<IFMapTable::RequestKey>::iterator it, list_entry;
std::list<DeferredNode> *ent;
std::list<DeferredNode>::iterator it, list_entry;
IFMapAgentLinkTable::LinkDefMap::iterator dlist_it, temp;

for(dlist_it = link_def_map_.begin(); dlist_it != link_def_map_.end(); ) {
Expand All @@ -540,7 +553,7 @@ void IFMapAgentLinkTable::DestroyDefLink(uint64_t seq) {
list_entry = it++;

//Delete the deferred link if it is old seq
if ((*list_entry).id_seq_num < seq) {
if ((*list_entry).node_key.id_seq_num < seq) {
if (RemoveDefListEntry(&link_def_map_, temp,
&list_entry) == true) {
//The list has been deleted. Move to the next map
Expand Down
10 changes: 8 additions & 2 deletions src/ifmap/ifmap_agent_table.h
Expand Up @@ -29,6 +29,7 @@ class IFMapNode;

class IFMapAgentTable : public IFMapTable {
public:

struct IFMapAgentData : DBRequestData {
std::auto_ptr<IFMapObject>content;
};
Expand Down Expand Up @@ -66,6 +67,11 @@ class IFMapAgentLinkTable : public IFMapLinkTable {
std::string metadata;
};

struct DeferredNode {
IFMapTable::RequestKey node_key;
std::string link_metadata;
};

class comp {
public:
bool operator()(const IFMapTable::RequestKey &left,
Expand All @@ -78,15 +84,15 @@ class IFMapAgentLinkTable : public IFMapLinkTable {
};

IFMapAgentLinkTable(DB *db, const std::string &name, DBGraph *graph);
typedef std::map<IFMapTable::RequestKey, std::list<IFMapTable::RequestKey> *, comp> LinkDefMap;
typedef std::map<IFMapTable::RequestKey, std::list<DeferredNode> *, comp> LinkDefMap;
virtual void Input(DBTablePartition *partition, DBClient *client,
DBRequest *req);
void IFMapAgentLinkTable_Init(DB *db, DBGraph *graph);
static DBTable *CreateTable(DB *db, const std::string &name,
DBGraph *graph);
void EvalDefLink(IFMapTable::RequestKey *key);
bool RemoveDefListEntry(LinkDefMap *map, LinkDefMap::iterator &map_it,
std::list<IFMapTable::RequestKey>::iterator *list_it);
std::list<DeferredNode>::iterator *list_it);
void DestroyDefLink(uint64_t);
const LinkDefMap &GetLinkDefMap() const {
return link_def_map_;
Expand Down
2 changes: 0 additions & 2 deletions src/ifmap/ifmap_link_table.cc
Expand Up @@ -66,7 +66,6 @@ void IFMapLinkTable::AddLink(DBGraphBase::edge_descriptor edge,
}
link->SetProperties(edge, left, right, metadata, sequence_number, origin);
graph_->SetEdgeProperty(link);
IFMAP_DEBUG(IFMapLinkOperation, "Creating", link->ToString());
}

IFMapLink *IFMapLinkTable::FindLink(const string &name) {
Expand All @@ -80,7 +79,6 @@ IFMapLink *IFMapLinkTable::FindLink(const string &name) {

void IFMapLinkTable::DeleteLink(DBGraphEdge *edge) {
IFMapLink *link = static_cast<IFMapLink *>(edge);
IFMAP_DEBUG(IFMapLinkOperation, "Deleting", link->ToString());
link->set_last_change_at_to_now();
link->ClearNodes();
DBTablePartition *partition =
Expand Down
35 changes: 31 additions & 4 deletions src/vnsw/agent/cfg/cfg_filter.cc
Expand Up @@ -66,23 +66,50 @@ bool CfgFilter::CheckProperty(DBTable *table, IFMapNode *node, DBRequest *req,

void CfgFilter::Init() {
agent_cfg_->cfg_vm_table()->RegisterPreFilter
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
VirtualMachine::ID_PERMS));

agent_cfg_->cfg_vn_table()->RegisterPreFilter
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
VirtualNetwork::ID_PERMS));

agent_cfg_->cfg_vm_interface_table()->RegisterPreFilter
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
VirtualMachineInterface::ID_PERMS));

agent_cfg_->cfg_acl_table()->RegisterPreFilter
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
AccessControlList::ID_PERMS));

agent_cfg_->cfg_loadbalancer_table()->RegisterPreFilter
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
LoadbalancerPool::ID_PERMS));

agent_cfg_->cfg_service_instance_table()->RegisterPreFilter
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
ServiceInstance::ID_PERMS));

agent_cfg_->cfg_security_group_table()->RegisterPreFilter
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
SecurityGroup::ID_PERMS));

agent_cfg_->cfg_logical_port_table()->RegisterPreFilter
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
LogicalInterface::ID_PERMS));

agent_cfg_->cfg_physical_device_table()->RegisterPreFilter
(boost::bind(&CfgFilter::CheckProperty, this, _1, _2, _3,
PhysicalRouter::ID_PERMS));
}

void CfgFilter::Shutdown() {
agent_cfg_->cfg_vm_table()->RegisterPreFilter(NULL);
agent_cfg_->cfg_vn_table()->RegisterPreFilter(NULL);
agent_cfg_->cfg_vm_interface_table()->RegisterPreFilter(NULL);
agent_cfg_->cfg_acl_table()->RegisterPreFilter(NULL);
agent_cfg_->cfg_loadbalancer_table()->RegisterPreFilter(NULL);
agent_cfg_->cfg_service_instance_table()->RegisterPreFilter(NULL);
agent_cfg_->cfg_security_group_table()->RegisterPreFilter(NULL);
agent_cfg_->cfg_logical_port_table()->RegisterPreFilter(NULL);
agent_cfg_->cfg_physical_device_table()->RegisterPreFilter(NULL);
}

0 comments on commit 9d44b8f

Please sign in to comment.