private List<U32> computeOurVersionBitmaps(Set<OFVersion> ofVersions){
  if (ofVersions == null || ofVersions.isEmpty()) {
    throw new IllegalStateException("OpenFlow version list should never be null or empty at this point. Make sure it's set in the OFSwitchManager.");
  }
  int pos=1;
  int size=32;
  int tempBitmap=0;
  List<U32> bitmaps=new ArrayList<U32>();
  ArrayList<OFVersion> sortedVersions=new ArrayList<OFVersion>(ofVersions);
  Collections.sort(sortedVersions);
  for (  OFVersion v : sortedVersions) {
    if (v.getWireVersion() > pos * size - 1) {
      bitmaps.add(U32.ofRaw(tempBitmap));
      tempBitmap=0;
      pos++;
    }
    tempBitmap=tempBitmap | (1 << (v.getWireVersion() % size));
  }
  if (tempBitmap != 0) {
    bitmaps.add(U32.ofRaw(tempBitmap));
  }
  log.info("Computed OpenFlow version bitmap as {}",Arrays.asList(tempBitmap));
  return bitmaps;
}

private List < U32 > computeOurVersionBitmaps ( Set < OFVersion > ofVersions ) { if ( ofVersions == null || ofVersions . isEmpty ( ) ) { throw new IllegalStateException ( "OpenFlow version list should never be null or empty at this point. Make sure it's set in the OFSwitchManager." ) ; } int pos = 1 ; int size = 32 ; int tempBitmap = 0 ; List < U32 > bitmaps = new ArrayList < U32 > ( ) ; ArrayList < OFVersion > sortedVersions = new ArrayList < OFVersion > ( ofVersions ) ; Collections . sort ( sortedVersions ) ; for ( OFVersion v : sortedVersions ) { if ( v . getWireVersion ( ) > pos * size - 1 ) { bitmaps . add ( U32 . ofRaw ( tempBitmap ) ) ; tempBitmap = 0 ; pos ++ ; } tempBitmap = tempBitmap | ( 1 << ( v . getWireVersion ( ) % size ) ) ; } if ( tempBitmap != 0 ) { bitmaps . add ( U32 . ofRaw ( tempBitmap ) ) ; } log . info ( "Computed OpenFlow version bitmap as {}" , Arrays . asList ( tempBitmap ) ) ; return bitmaps ; }
based on the list of ofversions provided as input ( or from loxi ) , create a list of bitmaps for use in version negotiation during a cross - version openflow handshake where both parties support openflow versions > = 1 . 3 . 1 . type set is used as input to guarantee all unique versions .
