1) Throw error is VIP is not attached to any pool
2) If source and destination machines are connected to same switch node, routing service returns null as a path between same node. Fixed this scenario by adding a check.
Change-Id: I8399bf40af2e1c90501240249802f8d89cc480e7
Signed-off-by: Anil Vishnoi <avishnoi@in.ibm.com>
if(configManager.vipExists(vip)){
VIP vipWithPoolName = configManager.getVIPWithPoolName(vip);
String poolMemberIp = null;
if(configManager.vipExists(vip)){
VIP vipWithPoolName = configManager.getVIPWithPoolName(vip);
String poolMemberIp = null;
+ if(vipWithPoolName.getPoolName() == null){
+ lbsLogger.error("No pool attached. Please attach pool with the VIP -- {}",vip);
+ return PacketResult.IGNORED;
+ }
if(configManager.getPool(vipWithPoolName.getPoolName()).getLbMethod().equalsIgnoreCase(LBConst.ROUND_ROBIN_LB_METHOD)){
poolMemberIp = rrLBMethod.getPoolMemberForClient(client,vipWithPoolName);
if(configManager.getPool(vipWithPoolName.getPoolName()).getLbMethod().equalsIgnoreCase(LBConst.ROUND_ROBIN_LB_METHOD)){
poolMemberIp = rrLBMethod.getPoolMemberForClient(client,vipWithPoolName);
lbsLogger.debug("Destination pool machine is connected to switch : {}",destNode.toString());
//Get path between both the nodes
lbsLogger.debug("Destination pool machine is connected to switch : {}",destNode.toString());
//Get path between both the nodes
- Path route = this.routing.getRoute(clientNode, destNode);
+ NodeConnector forwardPort = null;
+
+ if(clientNode.getNodeIDString().equals(destNode.getNodeIDString())){
+
+ forwardPort = hnConnector.getnodeConnector();
- lbsLogger.info("Path between source (client) and destination switch nodes : {}",route.toString());
+ lbsLogger.info("Both source (client) and destination pool machine is connected to same switch nodes. Respective ports are - {},{}",forwardPort,inPkt.getIncomingNodeConnector());
+
+ }else{
- NodeConnector forwardPort = route.getEdges().get(0).getTailNodeConnector();
+ Path route = this.routing.getRoute(clientNode, destNode);
+
+ lbsLogger.info("Path between source (client) and destination switch nodes : {}",route.toString());
+
+ forwardPort = route.getEdges().get(0).getTailNodeConnector();
+
+ }
if(installLoadBalancerFlow(client,
vip,
if(installLoadBalancerFlow(client,
vip,