Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

Code Block
titleinput YANG file
File : test.yang
module Test {
    yang-version 1;
    namespace http://huawei.com;
    prefix Ant;

    typedef MyDecimal {
        type decimal64 {
            fraction-digits 2;
            range "1 .. 3.14 | 10 | 20..max";
        }
    }
}
Code Block
titleGenerated java files
File: MyDecimal.java
package org.onosproject.yang.gen.v1.http.huawei.com.rev20160718.test;
import java.math.BigDecimal;
import java.util.Objects;
import com.google.common.base.MoreObjects;

public final class MyDecimal {
    private BigDecimal decimal64;

    private MyDecimal() {
    }

    public MyDecimal(BigDecimal value) {
        this.decimal64 = value;
    }

    public static MyDecimal of(BigDecimal value) {
        return new MyDecimal(value);
    }

    public BigDecimal decimal64() {
        return decimal64;
    }

    @Override
    public int hashCode() {
        return Objects.hash(decimal64);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof MyDecimal) {
            MyDecimal other = (MyDecimal) obj;
            return
                 Objects.equals(decimal64, other.decimal64);
        }
        return false;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(getClass())
            .add("decimal64", decimal64)
            .toString();
    }

    public static MyDecimal fromString(String valInString) {
        try {
            BigDecimal tmpVal = new BigDecimal(valInString);
            return of(tmpVal);
        } catch (Exception e) {
        }
        return null;
    }
}
 

 

Unknown Statement

Overview
If a YANG compiler does not support a particular extension, which appears in a YANG module as an unknown-statement, 
the entire unknown-statement is ignored by the onos-yang-tools and it is logged. 

Golden Eye Demo 

Link:   https://www.youtube.com/watch?v=ipbu0x0LcDk  

...