Class BasicLinkConfig

    • Constructor Detail

      • BasicLinkConfig

        public BasicLinkConfig​(LinkKey linkKey)
        Create a BasicLinkConfig for specified Device.

        Note: created instance is not bound to NetworkConfigService, cannot use Config.apply(). Must be passed to the service using NetworkConfigService#applyConfig

        Parameters:
        linkKey - subject of this Config
      • BasicLinkConfig

        public BasicLinkConfig()
        Create a BasicLinkConfig instance.

        Note: created instance needs to be initialized by #init(..) before using.

    • Method Detail

      • isValid

        public boolean isValid()
        Description copied from class: Config
        Indicates whether or not the backing JSON node contains valid data.

        Default implementation returns true. Subclasses are expected to override this with their own validation. Implementations are free to throw a RuntimeException if data is invalid.

        Overrides:
        isValid in class Config<LinkKey>
        Returns:
        true if the data is valid; false otherwise
      • isTypeConfigured

        public boolean isTypeConfigured()
        Returns if the link type is configured.
        Returns:
        true if config contains link type
      • type

        public Link.Type type()
        Returns the link type.
        Returns:
        link type override
      • type

        public BasicLinkConfig type​(Link.Type type)
        Sets the link type.
        Parameters:
        type - link type override
        Returns:
        self
      • metric

        public double metric()
        Returns link metric value for use by MetricLinkWeight function.
        Returns:
        link metric; -1 if not set
      • metric

        public BasicLinkConfig metric​(java.lang.Double metric)
        Sets the link metric for use by MetricLinkWeight function.
        Parameters:
        metric - new metric; null to clear
        Returns:
        self
      • latency

        public java.time.Duration latency()
        Returns link latency in terms of nanos.
        Returns:
        link latency; -1 if not set
      • latency

        public BasicLinkConfig latency​(java.time.Duration latency)
        Sets the link latency.
        Parameters:
        latency - new latency; null to clear
        Returns:
        self
      • bandwidth

        public long bandwidth()
        Returns link bandwidth in terms of Mbps.
        Returns:
        link bandwidth; -1 if not set
      • bandwidth

        public BasicLinkConfig bandwidth​(java.lang.Long bandwidth)
        Sets the link bandwidth.
        Parameters:
        bandwidth - new bandwidth; null to clear
        Returns:
        self
      • isDurable

        public java.lang.Boolean isDurable()
        Returns if link is durable in the network model or not.
        Returns:
        true for durable, false otherwise
      • isDurable

        public BasicLinkConfig isDurable​(java.lang.Boolean isDurable)
        Sets durability for this link.
        Parameters:
        isDurable - true for durable, false otherwise
        Returns:
        this BasicLinkConfig
      • isBidirectional

        public boolean isBidirectional()
        Returns if link is bidirectional in the network model or not.
        Returns:
        true for bidirectional, false otherwise
      • isBidirectional

        public BasicLinkConfig isBidirectional​(java.lang.Boolean isBidirectional)
        Sets durability for this link.
        Parameters:
        isBidirectional - true for directional, false otherwise
        Returns:
        this BasicLinkConfig