From 9d0635aa688925775bf101c8792d653313bb1c98 Mon Sep 17 00:00:00 2001 From: Vishnu Vardhan V Date: Wed, 23 Mar 2016 12:12:31 +0530 Subject: [PATCH] Floating IP issue: In case of floating IP,source and destination ip's of ingress and egress flows of introspect are not matching with the src and dest VN subnet, because of this while doing trace flow ip's are not reachable from the vRouter. Fix is we are picking the fip from the flow info and updating with source and destination IP based on the direction. Closes-Bug:#1549931 Change-Id: I7e7e86819216615a445714f8d924dc9daa823cff (cherry picked from commit e9a627038b08745c08ddbf44c53a471ac707dc0a) --- .../ui/js/views/TraceFlowResultView.js | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/webroot/monitor/infrastructure/underlay/ui/js/views/TraceFlowResultView.js b/webroot/monitor/infrastructure/underlay/ui/js/views/TraceFlowResultView.js index bd66105f1..43b7352c7 100644 --- a/webroot/monitor/infrastructure/underlay/ui/js/views/TraceFlowResultView.js +++ b/webroot/monitor/infrastructure/underlay/ui/js/views/TraceFlowResultView.js @@ -362,8 +362,8 @@ define([ showInfoWindow("Cannot Trace route for the selected flow", "Info"); return; } - constructVRFName (dataItem, postData, nwFqName); postData['action'] = 'Trace Flow'; + updateTraceFlowParams (dataItem, postData, nwFqName); if (postData['vrfId'] != null || postData['vrfName'] != null) { doTraceFlowRequest(postData, graphModel, deferredObj); } else { @@ -437,8 +437,8 @@ define([ showInfoWindow("Cannot Trace route for the selected flow", "Info"); return; } - constructVRFName (dataItem, postData, nwFqName); postData['action'] = 'Reverse Trace Flow'; + updateTraceFlowParams (dataItem, postData, nwFqName); if(postData['vrfId'] != null || postData['vrfName'] != null) { doTraceFlowRequest(postData, graphModel, deferredObj); } else { @@ -449,7 +449,7 @@ define([ // and Dest VN are different then based on the direction either source or dest vn // is used to construct the VRF name which is hack because of bug in vrouter // https://bugs.launchpad.net/juniperopenstack/+bug/1541794 - function constructVRFName (dataItem, postData, nwFqName) { + function updateTraceFlowParams (dataItem, postData, nwFqName) { var vrfName = null; if (dataItem['raw_json'] != null && dataItem['raw_json']['vrf'] != null && dataItem['raw_json']['dest_vrf'] != null && @@ -459,6 +459,31 @@ define([ vrfName = nwFqName + ':' + nwFqName.split(":")[2] postData['vrfName'] = vrfName; delete postData['vrfId']; + } else if (dataItem['raw_json'] != null && dataItem['raw_json']['vrf'] != null && + dataItem['raw_json']['dest_vrf'] != null && + dataItem['src_vn'] != null && dataItem['dst_vn'] != null && + dataItem['raw_json']['vrf'] != dataItem['raw_json']['dest_vrf'] && + dataItem['src_vn'] == dataItem['dst_vn'] && nwFqName != null) { + vrfName = nwFqName + ':' + nwFqName.split(":")[2] + postData['vrfName'] = vrfName; + delete postData['vrfId']; + } + // When we associate floating IP of VN2 to VM1(belongs to VN1) and do a ping from + // VM1 to a VM in VN2 we see the src and dest n/w's are VN2 and srcIP will be + // original(interface IP of VM) which belongs to VN1 for which trace flow fails. + // Hence we are updating the src/dest IP with floating IP based on direction. + if (dataItem['raw_json'] != null && dataItem['src_vn'] != null && + dataItem['dst_vn'] != null && dataItem['src_vn'] == dataItem['dst_vn'] + && dataItem['raw_json']['fip'] != null && + dataItem['raw_json']['fip'] != '0.0.0.0' && + dataItem['peer_vrouter'] != postData['resolveVrfId']) { + if ((dataItem['direction'] == 'ingress' && postData['action'] == 'Trace Flow') || + (dataItem['direction'] == 'egress' && postData['action'] == 'Reverse Trace Flow')) { + postData['srcIP'] = dataItem['raw_json']['fip']; + } else if ((dataItem['direction'] == 'ingress' && postData['action'] == 'Reverse Trace Flow') || + (dataItem['direction'] == 'egress' && postData['action'] == 'Trace Flow')) { + postData['destIP'] = dataItem['raw_json']['fip']; + } } return postData; }