com.h3c.of.lib.msg

## Class MutablePort

- java.lang.Object
- - com.h3c.of.lib.OpenflowStructure
  - - com.h3c.of.lib.msg.Port
    - - com.h3c.of.lib.msg.MutablePort

- All Implemented Interfaces:
    MutableObject, MutableStructure, Structure

      public class MutablePort
      extends Port
      implements MutableStructure

  Mutable subclass of `Port`.

- - ### Field Summary

    - ### Fields inherited from class com.h3c.of.lib.msg.Port

      `ALL, ANY, CONTROLLER, FLOOD, IN_PORT, LOCAL, MAX, NONE, NORMAL, TABLE`

    - ### Fields inherited from class com.h3c.of.lib.OpenflowStructure

      `version`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MutablePort(ProtocolVersion pv)` Constructs a mutable OpenFlow port structure.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MutablePort` | `advertised(Set<PortFeature> advertised)` Sets the port advertised features flags, (may be null); Since 1.0.
    `MutablePort` | `config(Set<PortConfig> config)` Sets the port configuration flags, (may be null); Since 1.0.
    `MutablePort` | `current(Set<PortFeature> current)` Sets the port current features flags, (may be null); Since 1.0.
    `MutablePort` | `currentSpeed(long currentSpeed)` Sets the port current speed (bitrate) in kbps; Since 1.1.
    `MutablePort` | `hwAddress(MacAddress hwAddress)` Sets the hardware address for this port; Since 1.0.
    `MutablePort` | `maxSpeed(long maxSpeed)` Sets the port maximum speed (bitrate) in kbps; Since 1.1.
    `MutablePort` | `name(String name)` Sets the friendly name for this port; Since 1.0.
    `MutablePort` | `peer(Set<PortFeature> peer)` Sets the port peer features flags, (may be null); Since 1.0.
    `MutablePort` | `portNumber(BigPortNumber portNumber)` Sets the port number for this port; Since 1.0.
    `MutablePort` | `state(Set<PortState> state)` Sets the port state flags, (may be null); Since 1.0.
    `MutablePort` | `supported(Set<PortFeature> supported)` Sets the port supported features flags, (may be null); Since 1.0.
    `OpenflowStructure` | `toImmutable()` Returns an immutable instance of this structure.
    `String` | `toString()`
    `boolean` | `writable()` Returns true if this mutable object is still writable.

    - ### Methods inherited from class com.h3c.of.lib.msg.Port

      `equivalentSpecial, equivalentSpecial, getAdvertised, getBigPortNumber, getConfig, getCurrent, getCurrentSpeed, getHwAddress, getMaxSpeed, getName, getPeer, getPortNumber, getPortNumber, getState, getSupported, isBlocked, isEnabled, isLinkUp, isStandardPort, logicalName, portNumberToString, portNumberToString, portNumberToString, setAbnormal, toDebugString, toDebugString, validate, validatePortValue`

    - ### Methods inherited from class com.h3c.of.lib.OpenflowStructure

      `getVersion, hex, hex`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.h3c.of.lib.Structure

      `getVersion, toDebugString`

- - ### Constructor Detail

    - #### MutablePort

          public MutablePort(ProtocolVersion pv)

      Constructs a mutable OpenFlow port structure.
      Parameters:
        `pv` - the protocol version

  - ### Method Detail

    - #### toImmutable

          public OpenflowStructure toImmutable()

      Description copied from interface: `MutableStructure`
      Returns an immutable instance of this structure. In essence, converts this structure to be read-only.

      It is expected that the reference to this mutable structure will be dropped. Note that all method calls invoked on a `MutableStructure` after `toImmutable()` has been invoked will result in an `InvalidMutableException` being thrown.

      Specified by:
        `toImmutable` in interface `MutableStructure`
      Returns:
        an immutable instance of this structure.

    - #### writable

          public boolean writable()

      Description copied from interface: `MutableObject`
      Returns true if this mutable object is still writable. That is, the `#toImmutable()` method (defined on a sub-interface) has not yet been invoked.
      Specified by:
        `writable` in interface `MutableObject`
      Returns:
        true if this mutable object is still writable

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Port`

    - #### portNumber

          public MutablePort portNumber(BigPortNumber portNumber)

      Sets the port number for this port; Since 1.0.

      Note that in 1.0, port numbers are u16.

      Parameters:
        `portNumber` - the port number
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `NullPointerException` - if the argument is null
        `IllegalArgumentException` - if the port number is invalid

    - #### hwAddress

          public MutablePort hwAddress(MacAddress hwAddress)

      Sets the hardware address for this port; Since 1.0.
      Parameters:
        `hwAddress` - the hardware address
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `NullPointerException` - if the argument is null

    - #### name

          public MutablePort name(String name)

      Sets the friendly name for this port; Since 1.0. Note that the maximum allowed length of the name is 15 characters; an exception is thrown if the argument exceeds this length.
      Parameters:
        `name` - the friendly name
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `NullPointerException` - if name is null
        `IllegalArgumentException` - if name length is >15

    - #### config

          public MutablePort config(Set<PortConfig> config)

      Sets the port configuration flags, (may be null); Since 1.0. The specified flags are validated against the protocol version of this port structure. An exception is thrown if there is a flag present that is not supported by the protocol version.
      Parameters:
        `config` - the port configuration flags
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if an unsupported flag is present

    - #### state

          public MutablePort state(Set<PortState> state)

      Sets the port state flags, (may be null); Since 1.0. The specified flags are validated against the protocol version of this port structure. An exception is thrown if there is a flag present that is not supported by the protocol version.
      Parameters:
        `state` - the port state flags
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if an unsupported flag is present

    - #### current

          public MutablePort current(Set<PortFeature> current)

      Sets the port current features flags, (may be null); Since 1.0. The specified flags are validated against the protocol version of this port structure. An exception is thrown if there is a flag present that is not supported by the protocol version.
      Parameters:
        `current` - the port current features flags
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if an unsupported flag is present

    - #### advertised

          public MutablePort advertised(Set<PortFeature> advertised)

      Sets the port advertised features flags, (may be null); Since 1.0. The specified flags are validated against the protocol version of this port structure. An exception is thrown if there is a flag present that is not supported by the protocol version.
      Parameters:
        `advertised` - the port advertised features flags
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if an unsupported flag is present

    - #### supported

          public MutablePort supported(Set<PortFeature> supported)

      Sets the port supported features flags, (may be null); Since 1.0. The specified flags are validated against the protocol version of this port structure. An exception is thrown if there is a flag present that is not supported by the protocol version.
      Parameters:
        `supported` - the port supported features flags
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if an unsupported flag is present

    - #### peer

          public MutablePort peer(Set<PortFeature> peer)

      Sets the port peer features flags, (may be null); Since 1.0. The specified flags are validated against the protocol version of this port structure. An exception is thrown if there is a flag present that is not supported by the protocol version.
      Parameters:
        `peer` - the port peer features flags
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if an unsupported flag is present

    - #### currentSpeed

          public MutablePort currentSpeed(long currentSpeed)

      Sets the port current speed (bitrate) in kbps; Since 1.1.

      The number should be rounded to match common usage. For example an optical 10 Gb Ethernet port should have this field set to `10000000` (instead of `10312500`), and an OC-192 port should have this field set to `10000000` (instead of `9953280`).

      Parameters:
        `currentSpeed` - the current speed
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if protocol version is < 1.1
        `IllegalArgumentException` - if value is not u32

    - #### maxSpeed

          public MutablePort maxSpeed(long maxSpeed)

      Sets the port maximum speed (bitrate) in kbps; Since 1.1.

      The number should be rounded to match common usage. For example an optical 10 Gb Ethernet port should have this field set to `10000000` (instead of `10312500`), and an OC-192 port should have this field set to `10000000` (instead of `9953280`).

      Parameters:
        `maxSpeed` - the maximum speed
      Returns:
        self, for chaining
      Throws:
        `InvalidMutableException` - if this instance is no longer writable
        `VersionMismatchException` - if protocol version is < 1.1
        `IllegalArgumentException` - if value is not u32

Copyright © 2014. All Rights Reserved.