0

我有以下拓扑: 拓扑

我正在尝试从 server2 到 server4 执行 iperf,但出现了一个问题:似乎(通过使用 wireshark 分析流量)它没有在目标交换机上安装任何规则。如果我在同一交换机的两台服务器之间尝试 iperf,一切正常。我不明白为什么会出现这个问题。谁能帮我?任何建议都可能有用。在交换机上安装流的代码如下:

//source Switch != destination Switch
IOFSwitch srcSwitch = sw;
IOFSwitch dstSwitch = this.floodlightProvider.getSwitch(destSwitchID);

/* Create match:                        
* source Mac: always host mac  
* dest Mac: always dest host mac 
* source Ip: vIP or external 
* dest Ip: rIP or vIP */

int srcIp = IPv4.toIPv4Address(toVirtualIp(sourceIp));

//get inPort of dest Switch on the inter-switch link 
  short inPort = topology.getInterSwitchPort(destSwitchID);

  OFMatch matchDst = createMatch(srcHostMac, destHostMac, srcIp, destIp, inPort);

  short[] actionsLengthDst = {0};

  int dstIp = IPv4.toIPv4Address(toRealIp(destIp));

  // Initialize list of actions
  //realSrcToVirtualSrc = false because sourceIp has not to be translated to realIp in the dest switch
  ArrayList<OFAction> actionsDst = createActions(false, 0, //vIP                                                              
                                                 virtualDestToRealDest, dstIp, //rIP
                                                 destHostMac, destSwitchID, actionsLengthDst,
                                                 false);

  OFFlowMod ruleDst = createRule(matchDst, actionsDst, actionsLengthDst[0]);

   System.out.println("Installing flows to dest OF switch ID " + dstSwitch.getId());
   try {
       dstSwitch.write(ruleDst, cntx);
   } catch (Exception e) {
        e.printStackTrace();
        return false;
    }

     /* Create match:                        
     * source Mac: always host mac  
     * dest Mac: gateway MAC or host MAC  
     * source Ip: rIP  
     * dest Ip: rIP or vIP */

     OFMatch matchSrc = createMatch(srcHostMac, destMac, sourceIp, destIp, pi.getInPort());

      short[] actionsLengthSrc = {0};

      // Initialize list of actions
      //virtualDestToRealDest = false because destIp has not to be translated to realIp int the source switch
      ArrayList<OFAction> actionsSrc = createActions(realSrcToVirtualSrc, sourceIp, //not translated (always)     
                                          false, 0, //not translated (rIP or vIP)                                 
                                          destHostMac, sw.getId(), actionsLengthSrc,                           
                                          false);

     OFFlowMod ruleSrc = createRule(matchSrc, actionsSrc, actionsLengthSrc[0]);

     System.out.println("Installing flows to source OF switch ID " + srcSwitch.getId());
      try {
           srcSwitch.write(ruleSrc, cntx);
      } catch (Exception e) {
           e.printStackTrace();
            return false;
      }

提前致谢。

4

0 回答 0