Beispiel #1
0
 public String toString() {
   StringBuffer sb = new StringBuffer();
   for (DatapathId n : links.keySet()) {
     sb.append("[" + n.toString() + ": cost=" + costs.get(n) + ", " + links.get(n) + "]");
   }
   return sb.toString();
 }
  /**
   * Set the mock expectations for sw when sw is passed to addSwitch The same expectations can be
   * used when a new SwitchSyncRepresentation is created from the given mocked switch
   */
  protected void setupSwitchForAddSwitch(
      IOFSwitch sw,
      DatapathId datapathId,
      SwitchDescription description,
      OFFeaturesReply featuresReply) {
    String dpidString = datapathId.toString();
    if (description == null) {
      description = createSwitchDescription();
    }
    if (featuresReply == null) {
      featuresReply = createOFFeaturesReply(datapathId);
    }
    List<OFPortDesc> ports = featuresReply.getPorts();

    expect(sw.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_10)).anyTimes();
    expect(sw.getId()).andReturn(datapathId).anyTimes();
    expect(sw.getId().toString()).andReturn(dpidString).anyTimes();
    expect(sw.getSwitchDescription()).andReturn(description).atLeastOnce();
    expect(sw.getBuffers()).andReturn(featuresReply.getNBuffers()).atLeastOnce();
    expect(sw.getTables()).andReturn(featuresReply.getNTables()).atLeastOnce();
    expect(sw.getCapabilities()).andReturn(featuresReply.getCapabilities()).atLeastOnce();
    expect(sw.getActions()).andReturn(featuresReply.getActions()).atLeastOnce();
    expect(sw.getPorts()).andReturn(ports).atLeastOnce();
    expect(sw.attributeEquals(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true)).andReturn(false).anyTimes();
    expect(sw.getInetAddress()).andReturn(null).anyTimes();
  }
Beispiel #3
0
 @Override
 @LogMessageDoc(
     level = "WARN",
     message = "Switch {switch} flow table is full",
     explanation =
         "The controller received flow table full "
             + "message from the switch, could be caused by increased "
             + "traffic pattern",
     recommendation = LogMessageDoc.REPORT_CONTROLLER_BUG)
 public void setTableFull(boolean isFull) {
   if (isFull && !flowTableFull) {
     switchManager.addSwitchEvent(
         this.datapathId, "SWITCH_FLOW_TABLE_FULL " + "Table full error from switch", false);
     log.warn("Switch {} flow table is full", datapathId.toString());
   }
   flowTableFull = isFull;
 }
Beispiel #4
0
 /* (non-Javadoc)
  * @see java.lang.Object#toString()
  */
 @Override
 public String toString() {
   return "OFSwitchBase DPID[" + ((datapathId != null) ? datapathId.toString() : "?") + "]";
 }