clicon / clixon

YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI
http://www.clicon.org/
Other
208 stars 70 forks source link

Error's for mandatory leaf #480

Closed temabeloglinski closed 7 months ago

temabeloglinski commented 7 months ago

Hi Olof! I have a problem with mandatory leaf's. For example I'm using openconfig-aaa.yang

  grouping aaa-authentication-user-top {
    description
      "Top-level grouping for local users";

    container users {
      description
        "Enclosing container list of local users";

      list user {
        key "username";
        description
          "user's";

        leaf username {
          type string;
          description
            "username";
        }

        container config {
          description
            "Configuration data for local users";

          uses aaa-authentication-user-config;
        }

        container state {
          config false;

          description
            "Operational state data for local users";

          uses aaa-authentication-user-config;
          uses aaa-authentication-user-state;
        }
      }

    }
  }
  grouping aaa-authentication-user-config {
    description
      "Configuration data for local users";

    // leaf username {
    //   type string;
    //   description
    //     "username";
    // }

    // leaf password {
    //   type string;
    //   oc-ext:openconfig-hashed-value;
    //   description
    //     "password";
    // }

    leaf password-hashed {
      type string;
      description
        "password-hashed";
    }

    // leaf ssh-key {
    //   type string;
    //   description
    //     "ssh-key";
    // }

    leaf role {
      type enumeration {
        enum administrator {
          description
            "user role";
        }
        enum operator {
          description
            "user role";
        }
      }
      description
        "user role";
    }
  }

And my general yang-model

    grouping system-top {
    description
      "Top level system data containers";

    container system {
      description
        "system-setting's";

//      uses mount-points-top;
      uses dhcp-server;
      uses oc-aaa:aaa-top;
//      uses oc-alarms:alarms-top;
//      uses oc-log:logging-top;
//      uses oc-proc:procmon-processes-top;
//      uses oc-messages:messages-top;
//      uses oc-license:license-top;
      uses oc-sys-term:system-ssh-server-top;
//      uses oc-sys-term:system-telnet-server-top;
      uses system-clock-top;
//      uses system-cpu-top;
      uses system-dns-top;
//      uses system-macaddr-top;
//      uses system-memory-top;

    }
  }

If I'm changing leaf as below

    leaf password-hashed {
      type string;
      mandatory true;
      description
        "password-hashed";
    } 

then I get an error

root@cli/> set system aaa authentication user admin
root@cli/> comm
 cancel               confirmed            persist-id
root@cli/> commit
Jan 22 13:42:28: clicon_connect_unix: 249: Config error: connecting unix socket: /var/run/clixon/clixon-ngfw.sock: Connection refused
CLI command error

What could be the problem?

temabeloglinski commented 7 months ago

problem solved