Sovietaced | 476bef4 | 2014-12-01 19:27:35 -0500 | [diff] [blame] | 1 | |
| 2 | /** |
| 3 | * Returns true if the port is up, i.e., it's neither administratively |
| 4 | * down nor link down. It currently does NOT take STP state into |
| 5 | * consideration |
| 6 | * @return whether the port is up |
| 7 | */ |
| 8 | public boolean isEnabled() { |
| 9 | return (!state.contains(OFPortState.LINK_DOWN) && !config.contains(OFPortConfig.PORT_DOWN)); |
| 10 | } |
Andreas Wundsam | 75c09dc | 2015-07-22 18:23:29 -0700 | [diff] [blame] | 11 | |
| 12 | /** |
| 13 | * Returns the current generation ID of this port. |
| 14 | * |
| 15 | * The generationId is reported by the switch as a @{link OFPortDescProp} in |
| 16 | * @link{OFPortDescStatsReply} and @link{OFPortStatus} messages. If the |
| 17 | * current OFPortDesc does not contain a generation Id, returns U64.ZERO; |
| 18 | * |
| 19 | * For OpenFlow versions earlier than 1.4, always returns U64.ZERO; |
| 20 | * |
| 21 | * @return the generation ID or U64.NULL if not reported |
| 22 | * @since 1.4 |
| 23 | */ |
| 24 | @Nonnull |
| 25 | public U64 getBsnGenerationId() { |
| 26 | //:: if msg.member_by_name("properties"): |
| 27 | for(OFPortDescProp prop: getProperties()) { |
| 28 | if(prop instanceof OFPortDescPropBsnGenerationId) { |
| 29 | return ((OFPortDescPropBsnGenerationId) prop).getGenerationId(); |
| 30 | } |
| 31 | } |
| 32 | //:: #endif |
| 33 | return U64.ZERO; |
| 34 | } |