OFPortDesc: add convenience method to access BsnPortGenerationId
diff --git a/java_gen/templates/custom/OFPortDesc.java b/java_gen/templates/custom/OFPortDesc.java
index 3be1b70..ccfbedb 100644
--- a/java_gen/templates/custom/OFPortDesc.java
+++ b/java_gen/templates/custom/OFPortDesc.java
@@ -8,4 +8,27 @@
public boolean isEnabled() {
return (!state.contains(OFPortState.LINK_DOWN) && !config.contains(OFPortConfig.PORT_DOWN));
}
-
\ No newline at end of file
+
+ /**
+ * Returns the current generation ID of this port.
+ *
+ * The generationId is reported by the switch as a @{link OFPortDescProp} in
+ * @link{OFPortDescStatsReply} and @link{OFPortStatus} messages. If the
+ * current OFPortDesc does not contain a generation Id, returns U64.ZERO;
+ *
+ * For OpenFlow versions earlier than 1.4, always returns U64.ZERO;
+ *
+ * @return the generation ID or U64.NULL if not reported
+ * @since 1.4
+ */
+ @Nonnull
+ public U64 getBsnGenerationId() {
+ //:: if msg.member_by_name("properties"):
+ for(OFPortDescProp prop: getProperties()) {
+ if(prop instanceof OFPortDescPropBsnGenerationId) {
+ return ((OFPortDescPropBsnGenerationId) prop).getGenerationId();
+ }
+ }
+ //:: #endif
+ return U64.ZERO;
+ }