protected OFTableFeaturesStatsReply createTableFeaturesStatsReply() { OFTableFeaturesStatsReply statsReply = factory.buildTableFeaturesStatsReply() .setEntries(Collections.singletonList(factory.buildTableFeatures() .setConfig(0) .setMaxEntries(100) .setMetadataMatch(U64.NO_MASK) .setMetadataWrite(U64.NO_MASK) .setName("MyTable") .setTableId(TableId.of(1)) .setProperties(Collections.singletonList((OFTableFeatureProp)factory.buildTableFeaturePropMatch() .setOxmIds(Collections.singletonList(U32.of(100))) .build()) ).build() ) ).build(); return statsReply; }
private static OFTableFeaturePropType getTableFeaturePropType(OFTableFeatureProp p) { switch (p.getVersion()) { case OF_13: return OFTableFeaturePropTypeSerializerVer13.ofWireValue((short) p.getType()); case OF_14: return OFTableFeaturePropTypeSerializerVer14.ofWireValue((short) p.getType()); default: throw new IllegalArgumentException("OFVersion " + p.getVersion().toString() + " does not support OFTableFeature messages."); } }
private TableFeatures(OFTableFeatures tf) { /* * First, get the properties. */ List<OFTableFeatureProp> properties = tf.getProperties(); for (OFTableFeatureProp p : properties) { OFTableFeaturePropType pt = getTableFeaturePropType(p); switch (pt) { case APPLY_ACTIONS: aa = (OFTableFeaturePropApplyActions) p; break; case APPLY_ACTIONS_MISS: aam = (OFTableFeaturePropApplyActionsMiss) p; break; case APPLY_SETFIELD: asf = (OFTableFeaturePropApplySetfield) p; break; case APPLY_SETFIELD_MISS: asfm = (OFTableFeaturePropApplySetfieldMiss) p; break; case EXPERIMENTER: e = (OFTableFeaturePropExperimenter) p; break; case EXPERIMENTER_MISS: em = (OFTableFeaturePropExperimenterMiss) p; break; case INSTRUCTIONS: i = (OFTableFeaturePropInstructions) p; break; case INSTRUCTIONS_MISS: im = (OFTableFeaturePropInstructionsMiss) p; break; case MATCH: m = (OFTableFeaturePropMatch) p; break; case NEXT_TABLES: nt = (OFTableFeaturePropNextTables) p; break; case NEXT_TABLES_MISS: ntm = (OFTableFeaturePropNextTablesMiss) p; break; case TABLE_SYNC_FROM: tsf = (OFTableFeaturePropTableSyncFrom) p; break; case WILDCARDS: w = (OFTableFeaturePropWildcards) p; break; case WRITE_ACTIONS: wa = (OFTableFeaturePropWriteActions) p; break; case WRITE_ACTIONS_MISS: wam = (OFTableFeaturePropWriteActionsMiss) p; break; case WRITE_SETFIELD: wsf = (OFTableFeaturePropWriteSetfield) p; break; case WRITE_SETFIELD_MISS: wsfm = (OFTableFeaturePropWriteSetfieldMiss) p; break; default: throw new UnsupportedOperationException("OFTableFeaturePropType " + pt.toString() + " not accounted for in " + this.getClass().getCanonicalName()); } } /* * Next, get the other info e.g. name, ID, etc. */ config = tf.getConfig(); maxEntries = tf.getMaxEntries(); metadataMatch = tf.getMetadataMatch(); metadataWrite = tf.getMetadataWrite(); tableId = tf.getTableId(); tableName = tf.getName(); }