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
      • latency

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

        public BasicLinkConfig latency​(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​(Long bandwidth)
        Sets the link bandwidth.
        Parameters:
        bandwidth - new bandwidth; null to clear
        Returns:
        self
      • isDurable

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

        public BasicLinkConfig isDurable​(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​(Boolean isBidirectional)
        Sets durability for this link.
        Parameters:
        isBidirectional - true for directional, false otherwise
        Returns:
        this BasicLinkConfig
      • jitter

        public double jitter()
        Returns link jitter in terms of seconds.
        Returns:
        link jitter valuer; -1 if not set
      • jitter

        public BasicLinkConfig jitter​(Double jitter)
        Sets the link jitter.
        Parameters:
        jitter - new jitter value; null to clear
        Returns:
        self
      • delay

        public double delay()
        Returns link delay in terms of seconds.
        Returns:
        link delay value; -1 if not set
      • delay

        public BasicLinkConfig delay​(Double delay)
        Sets the link delay.
        Parameters:
        delay - new delay value; null to clear
        Returns:
        self
      • loss

        public double loss()
        Returns link loss in terms of Percentage.
        Returns:
        link loss value; -1 if not set
      • loss

        public BasicLinkConfig loss​(Double loss)
        Sets the link loss.
        Parameters:
        loss - new loss value; null to clear
        Returns:
        self
      • availability

        public double availability()
        Returns link availability in terms of percentage.
        Returns:
        link availability value; -1 if not set
      • availability

        public BasicLinkConfig availability​(Double availability)
        Sets the link availability.
        Parameters:
        availability - new availability value; null to clear
        Returns:
        self
      • flapping

        public double flapping()
        Returns link flapping in terms of percentage.
        Returns:
        link flapping value; -1 if not set
      • flapping

        public BasicLinkConfig flapping​(Double flapping)
        Sets the link flapping.
        Parameters:
        flapping - new flapping value; null to clear
        Returns:
        self
      • isMetered

        public Boolean isMetered()
        Returns if link is metered in the network model or not.
        Returns:
        true for metered, false otherwise
      • isMetered

        public BasicLinkConfig isMetered​(Boolean isMetered)
        Sets metered flag for this link.
        Parameters:
        isMetered - true for metered, false otherwise
        Returns:
        this BasicLinkConfig
      • tier

        public long tier()
        Returns link tier.
        Returns:
        link tier value; -1 if not set
      • tier

        public BasicLinkConfig tier​(Long tier)
        Sets the link tier.
        Parameters:
        tier - new link tier value; null to clear
        Returns:
        self
      • meteredUsage

        public double meteredUsage()
        Returns metered link usage in terms of percentage.
        Returns:
        metered link usage value; -1 if not set
      • meteredUsage

        public BasicLinkConfig meteredUsage​(Double meteredUsage)
        Sets the metered link usage.
        Parameters:
        meteredUsage - new metered usage value; null to clear
        Returns:
        self