Skip to content

Commit

Permalink
Vm project UUID should be optional for Port Add requests.
Browse files Browse the repository at this point in the history
Currently the REST interface of contrail-vrouter-agent for Port Adds, makes it mandatory for vm-project-uuid to be specified when the port type is NovaVMPort. In case of thrift interface this was not mandatory. To ensure backward compatibility, vm-project-uuid should be optional even in REST interface.
Also change the default value for port-type in vrouter_api.py to NameSpacePort to ensure backward compatibility.

Change-Id: Ifc434992f87d8d8cff2da169d6bfeb308b9903bb
Closes-Bug: #1664819
  • Loading branch information
ashoksr committed Feb 21, 2017
1 parent 603d222 commit de72baf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
7 changes: 1 addition & 6 deletions src/vnsw/agent/port_ipc/port_ipc_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ bool PortIpcHandler::AddPort(const PortIpcHandler::AddPortParams &r,
if (r.vn_id.length() != 0) {
vn_uuid = StringToUuid(r.vn_id);
}
/* VM Project UUID is optional for CfgIntNameSpacePort */
/* VM Project UUID is optional */
uuid vm_project_uuid = nil_uuid();
if (r.vm_project_id.length() != 0) {
vm_project_uuid = StringToUuid(r.vm_project_id);
Expand Down Expand Up @@ -226,11 +226,6 @@ bool PortIpcHandler::AddPort(const PortIpcHandler::AddPortParams &r,
resp_str += "invalid VN uuid, ";
err = true;
}
if ((intf_type == CfgIntEntry::CfgIntVMPort) &&
(vm_project_uuid == nil_uuid())) {
resp_str += "invalid VM project uuid, ";
err = true;
}
if (!ValidateMac(r.mac_address)) {
resp_str += "Invalid MAC, Use xx:xx:xx:xx:xx:xx format";
err = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@ def add_port(self, vm_uuid_str, vif_uuid_str, interface_name, mac_address,

if 'vm_project_id' in kwargs:
vm_project_id = kwargs['vm_project_id']
if ('port_type' in kwargs and
kwargs['port_type'] in [0,1]):
if ('port_type' in kwargs):
if (kwargs['port_type'] == 0):
port_type = "NovaVMPort"
elif (kwargs['port_type'] == 1):
port_type = "NameSpacePort"
elif (kwargs['port_type'] == 'NameSpacePort'):
port_type = "NameSpacePort"
else:
elif (kwargs['port_type'] == 'NovaVMPort'):
port_type = "NovaVMPort"
else:
port_type = "NameSpacePort"
else:
port_type = "NameSpacePort"

Expand Down

0 comments on commit de72baf

Please sign in to comment.