Vcenter plugin to vrouter rest interface

Registered by Rudra Rugge on 2016-05-06

Currently vcenter plugin uses Thrift connections to each of the vrouters. This will be replaced with the new REST API provided by the vrouter agent.

Implementation
------------------------

Vcenter plugin will re-use the code from java-api library for interactions with both vrouter agent and Contrail's API server.

Since Thrift will be removed, vcenter-plugin will need to serialize Port objects in json.

All HTTP requests will contain a field called "type=2", to indicate the client is the vcenter-plugin.
VCenter plugin will send upon restart a "sync" request to vrouter agent (HTTP POST /syncports)

Vrouter-agent will save all the added ports info in a file, and it will read it upon its restart. From the vcenter-plugin's perspective, add/delete operations are atomic, and vrouter-agent will return success only after the port has been saved.

Vcenter plugin will implement a retry mechanism for failed requests (add, delete,sync) and keep track of ports to be added or deleted.

- Vcenter plugin restart case:
After vcenter-plugin is restarted, it will send a HTTP PORT /syncports request. If vrouter-agent receives the sync request, it will mark all the ports as “NOT seen”. Vcenter-plugin will send “add” requests for all ports already present. When vrouter-agent receives “add” for a port, it will mark the port as “Seen”. After a timeout since the reception of "sync" request, vrouter-agent will delete all the ports for which it has not seen “add” (Ports still in “NOT seen” state).

-Vrouter-agent restart case:
Vrouter-agent saves all the added ports info in a file, which is read upon vrouter-agent restarts.
While vrouter-agent is down, if the vcenter-plugin sends any request, the request will fail. Vcenter-plugin will add the failed ports to a retry list.

Test impact
------------------
This change is applicable to both vcenter-only mode and vcenter-as-compute mode.
Power on/off can be used to trigger the add/delete operation.
Verify ping between VMs works as expected.

Following scenarios need to be covered:
1. Plugin start with empty ports
2. Plugin restart with empty ports
3. Add port
4. Delete port
5. Plugin restart with active ports
6. Vrouter stop (or crash) add one port, vrouter start
7. Vrouter stop (or crash), delete one port, vrouter start
8. Vrouter stop (or crash) add several ports, vrouter start
9. Vrouter stop (or crash), delete several ports, vrouter start
10. Plugin stop, add port , plugin start
11. Plugin stop, delete port , plugin start
12. vrouter and plugin stop, add port, vrouter and plugin start in any order
13. vrouter and plugin stop, delete port, vrouter and plugin start in any order
14. Add a second nw adapter to two of the VM, in a different network, and verify ping works.
15. Delete these two second adapters.

Blueprint information

Status:
Started
Approver:
Rudra Rugge
Priority:
High
Drafter:
Andra Cismaru
Direction:
Needs approval
Assignee:
Andra Cismaru
Definition:
Drafting
Series goal:
Accepted for trunk
Implementation:
Started
Milestone target:
None
Started by
Rudra Rugge on 2016-05-11

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.