CESNET / netopeer2

NETCONF toolset
BSD 3-Clause "New" or "Revised" License
299 stars 188 forks source link

How do I set ’ly2 schema mount‘ of netopeer-cli? #1317

Closed rydy closed 1 year ago

rydy commented 1 year ago

Hi, I tested get-config via netopeer-cli.

> get-config --source running --filter-xpath /o-ran-aggregation-base:aggregated-o-ru/aggregation/ietf-interfaces-model
ly ERROR: Ext plugin "ly2 schema mount v1": Failed to get extension data, no callback set.
nc ERROR: Received an invalid message (Ext plugin "ly2 schema mount v1": Failed to get extension data, no callback set.).
cli_send_recv: Failed to receive a reply.

How do I set ’ly2 schema mount‘ of netopeer-cli?

michalvasko commented 1 year ago

You must provide the ietf-yang-library and ietf-yang-schema-mount operational data in a file, set it using the ext-data command.

rydy commented 1 year ago

You must provide the ietf-yang-library and ietf-yang-schema-mount operational data in a file, set it using the ext-data command.

Is the --path is invalid?

> ext-data -h
ext-data [--help] [--path <file>]
> ext-data --path
cmd_extdata: Unable to access file "--path" (No such file or directory).
> ext-data --path /root/yangr/O1/testcase/TestcaseOfSysrepoForO-DU/ietf-yang-schema-mount.xml
cmd_extdata: Unable to access file "--path" (No such file or directory).
> ext-data --path=/root/yangr/O1/testcase/TestcaseOfSysrepoForO-DU/ietf-yang-schema-mount.xml
cmd_extdata: Unable to access file "--path=/root/yangr/O1/testcase/TestcaseOfSysrepoForO-DU/ietf-yang-schema-mount.xml" (No such file or directory).
> ext-data --path/root/yangr/O1/testcase/TestcaseOfSysrepoForO-DU/ietf-yang-schema-mount.xml
cmd_extdata: Unable to access file "--path/root/yangr/O1/testcase/TestcaseOfSysrepoForO-DU/ietf-yang-schema-mount.xml" (No such file or directory).
> ext-data --path /root/yangr/O1/testcase/TestcaseOfSysrepoForO-DU/ietf-yang-schema-mount.xml
cmd_extdata: Unable to access file "--path" (No such file or directory).

I tried setting ietf-yang-schema-mount.xml, The following log has occurred.

> user-rpc --content aggregation-reset-interface-counters.xml --rpc-timeout 30
ly ERROR: Ext plugin "ly2 schema mount v1": Failed to get extension data, no callback set.
nc ERROR: Failed to create RPC, perhaps a required feature is disabled.
cli_send_recv: Failed to send the RPC.
> ext-data /root/yangr/O1/testcase/TestcaseOfSysrepoForO-DU/ietf-yang-schema-mount.xml
> user-rpc --content aggregation-reset-interface-counters.xml --rpc-timeout 30
ly ERROR: Data model "sysrepo@2021-10-08" not found in local searchdirs.
ly ERROR: Loading "sysrepo" module failed. (Data location "/o-ran-aggregation-base:aggregated-o-ru/aggregation[ru-instance='Baciells_sRU67XXX_B122601202134000326']/o-ran-agg-interfaces:interfaces-model", line number 6.)
ly ERROR: Unable to load module sysrepo@2021-10-08 specified by yang library data.
ly ERROR: Ext plugin "ly2 schema mount v1": Failed to create context for the schema-mount data.
nc ERROR: Failed to create RPC, perhaps a required feature is disabled.
cli_send_recv: Failed to send the RPC.

ietf-yang-schema-mount.xml

<schema-mounts xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount">
    <namespace>
        <prefix>or-agg-ietf-if</prefix>
        <uri>urn:o-ran:agg-ietf-interfaces:1.0</uri>
    </namespace>
    <namespace>
        <prefix>or-agg-int</prefix>
        <uri>urn:o-ran:agg-interfaces:1.0</uri>
    </namespace>
    <mount-point>
        <module>o-ran-agg-ietf-interfaces</module>
        <label>ietf-interfaces-root</label>
        <config>true</config>
        <inline/>
    </mount-point>
    <mount-point>
        <module>o-ran-agg-interfaces</module>
        <label>interfaces-root</label>
        <config>true</config>
        <inline/>
    </mount-point>
</schema-mounts>
<yang-library xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
michalvasko commented 1 year ago

Is the --path is invalid?

Sorry about that but the help is obviously wrong, no --path is actually expected. I am improving schema mount support right now and ext-data command will be removed, it will no longer be needed.

I tried setting ietf-yang-schema-mount.xml, The following log has occurred.

That does seem like a problem, I will try to reproduce it and fix together with the improvements I am doing.

rydy commented 1 year ago

Is the --path is invalid?

Sorry about that but the help is obviously wrong, no --path is actually expected. I am improving schema mount support right now and ext-data command will be removed, it will no longer be needed.

I tried setting ietf-yang-schema-mount.xml, The following log has occurred.

That does seem like a problem, I will try to reproduce it and fix together with the improvements I am doing.

Ok, Let me know when it is fixed. Thanks

michalvasko commented 1 year ago

Should now be improved and the specific problem fixed.

rydy commented 1 year ago

Should now be improved and the specific problem fixed.

I tried to test after updating the latest devel of all project.

Pre-condition: Ensure o-ran-interfaces, o-ran-aggregation-base , o-ran-agg-ietf-interfaces , and o-ran-agg-interfacesare installed. o-ran-agg-ietf-interfaces

module o-ran-aggregation-base {
  yang-version 1.1;
  namespace "urn:o-ran:agg-base:1.0";
  prefix "or-agg-base";

  import o-ran-operations {
    prefix "or-ops";
  }

........

  typedef ru-ref {
    type leafref {
      path "/or-ops:operational-info/or-ops:declarations/or-ops:ru-instance-id";
    }
    description
      "A type defintion for the ru-instance-id. Although the type used in
      o-ran-operations is only a 'string', this leafref is used to indicate
      that the type 'ru-ref' is used to encode ru-instance-id values.

      These will typically have been recovered using the NETCONF client in an
      O-DU which has a NETCONF session with an O-RU which implements the
      o-ran-operations.yang model. ";
  }

  grouping ru-grouping {
    list recovered-ru-instance-ids {
      key ru-instance-id;
      config false;
      description
        "a list of O-RU instance IDs that have  been recovered by an O-DU which
        either has:
        i) a NETCONF session with an O-RU using the O-RAN WG4 fronthaul
        defined NETCONF/YANG interface, or
        ii) some vendor proprietary scheme for a managed element that integrates
        both O-DU and O-RU functionality.";

      leaf ru-instance-id {
        type ru-ref;
        config false;
      }
    }
    list aggregation {
      key ru-instance;
      description
        "a list used to aggregate the configuration and operational state of
        multiple O-RUs.";

      leaf ru-instance {
        type leafref {
          path "/aggregated-o-ru/recovered-ru-instance-ids/ru-instance-id";
          require-instance false;
        }
      }
    }
  }

  container aggregated-o-ru {
    description
      "The top level container used to hold all the aggregated information related
      to a set of O-RUs.";

    uses ru-grouping;
  }
}

o-ran-agg-ietf-interfaces

module o-ran-agg-ietf-interfaces {
  yang-version 1.1;
  namespace "urn:o-ran:agg-ietf-interfaces:1.0";
  prefix "or-agg-ietf-if";

  import o-ran-aggregation-base {
    prefix "agg";
  }

  import ietf-yang-schema-mount {
    prefix "yangmnt";
  }

.......

  augment "/agg:aggregated-o-ru/agg:aggregation" {
    container ietf-interfaces-model {
      yangmnt:mount-point "ietf-interfaces-root" {
        description
          "Root for ietf-interfaces.yang model supported per O-RU instance";
      }
    }
  }
}

o-ran-agg-interfaces

module o-ran-agg-interfaces {
  yang-version 1.1;
  namespace "urn:o-ran:agg-interfaces:1.0";
  prefix "or-agg-int";

  import o-ran-aggregation-base {
    prefix "agg";
  }

  import ietf-yang-schema-mount {
    prefix "yangmnt";
  }

......

  augment "/agg:aggregated-o-ru/agg:aggregation" {
    container interfaces-model {
      yangmnt:mount-point "interfaces-root" {
        description
          "Root for o-ran-interfaces.yang model supported per O-RU instance";
      }
    }
  }
}

Post-condition netopeer2-server -d -c MSG -t 30 -x $CURRENT_DIR/config/schema_mount_extension/ietf-yang-schema-mount.xml ietf-yang-schema-mount.xml

<schema-mounts xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount">
    <mount-point>
        <module>o-ran-agg-ietf-interfaces</module>
        <label>ietf-interfaces-root</label>
        <config>true</config>
        <inline/>
    </mount-point>
    <mount-point>
        <module>o-ran-agg-interfaces</module>
        <label>interfaces-root</label>
        <config>true</config>
        <inline/>
    </mount-point>
</schema-mounts>

Test case 1, Subscribe to /o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-interfaces:interfaces-model/o-ran-interfaces:reset-interface-counters via sr_rpc_subscribe, The rpc is successfully triggered by sysrepcfg,

sysrepocfg --rpc=aggregation-reset-interface-counters.xml  -v 3
[INF] Connection 67 created.
[INF] Published event "operational get" "/ietf-yang-schema-mount:schema-mounts" with ID 12.
[INF] Event "operational get" with ID 12 succeeded.
[INF] Session 470 (user "root", CID 67) created.
[INF] Published event "rpc" "/o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-interfaces:interfaces-model/o-ran-interfaces:reset-interface-counters" with ID 7 priority 0 for 1 subscribers.
[INF] Event "rpc" with ID 7 priority 0 succeeded.
[INF] No datastore changes to apply.

Failed to trigger rpc through netopeer2-cli.

user-rpc --content aggregation-reset-interface-counters.xml --rpc-timeout 30
ly ERROR: Data model "o-ran-wg4-features@2021-12-01" not found in local searchdirs.
ly ERROR: Loading "o-ran-wg4-features" module failed. (/)
ly ERROR: Unable to load module o-ran-wg4-features@2021-12-01 specified by yang library data.
ly ERROR: Ext plugin "ly2 schema mount v1": Failed to create context for the schema-mount data.
nc ERROR: Failed to create RPC, perhaps a required feature is disabled.
cli_send_recv: Failed to send the RPC.
>

2, Subscribe to /o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-interfaces:ietf-interfaces-model/ietf-interfaces:interfaces via sr_oper_get_subscribe, The sysrepocfg -X -f xml -d operational -x /o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-interfaces:ietf-interfaces-model/ietf-interfaces:interfaces -t 10 -v 3 cannot trigger the callback.

sysrepocfg -X -f xml -d operational -x /o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-interfaces:ietf-interfaces-model/ietf-interfaces:interfaces -t 10 -v 3
[INF] Connection 70 created.
[INF] Published event "operational get" "/ietf-yang-schema-mount:schema-mounts" with ID 18.
[INF] Event "operational get" with ID 18 succeeded.
[INF] Session 552 (user "root", CID 70) created.
[INF] No datastore changes to apply.

3, Subscribe to /o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-interfaces:ietf-interfaces-model/ietf-interfaces:interfaces via sr_module_change_subscribe, Cannot trigger callback and The following error occurs.

sysrepocfg --import=o-ran-agg-ietf-interfaces.xml -d running -t 10 -v 3
[INF] Connection 71 created.
[INF] Published event "operational get" "/ietf-yang-schema-mount:schema-mounts" with ID 19.
[INF] Event "operational get" with ID 19 succeeded.
[INF] Session 554 (user "root", CID 71) created.
sysrepocfg error: Data parsing failed
[INF] No datastore changes to apply.

Is there something wrong with my test case?

rydy commented 1 year ago

Should now be improved and the specific problem fixed.

I tried to test after updating the latest devel of all project.

Pre-condition: Ensure o-ran-interfaces, o-ran-aggregation-base , o-ran-agg-ietf-interfaces , and o-ran-agg-interfacesare installed. o-ran-agg-ietf-interfaces

module o-ran-aggregation-base {
  yang-version 1.1;
  namespace "urn:o-ran:agg-base:1.0";
  prefix "or-agg-base";

  import o-ran-operations {
    prefix "or-ops";
  }

........

  typedef ru-ref {
    type leafref {
      path "/or-ops:operational-info/or-ops:declarations/or-ops:ru-instance-id";
    }
    description
      "A type defintion for the ru-instance-id. Although the type used in
      o-ran-operations is only a 'string', this leafref is used to indicate
      that the type 'ru-ref' is used to encode ru-instance-id values.

      These will typically have been recovered using the NETCONF client in an
      O-DU which has a NETCONF session with an O-RU which implements the
      o-ran-operations.yang model. ";
  }

  grouping ru-grouping {
    list recovered-ru-instance-ids {
      key ru-instance-id;
      config false;
      description
        "a list of O-RU instance IDs that have  been recovered by an O-DU which
        either has:
        i) a NETCONF session with an O-RU using the O-RAN WG4 fronthaul
        defined NETCONF/YANG interface, or
        ii) some vendor proprietary scheme for a managed element that integrates
        both O-DU and O-RU functionality.";

      leaf ru-instance-id {
        type ru-ref;
        config false;
      }
    }
    list aggregation {
      key ru-instance;
      description
        "a list used to aggregate the configuration and operational state of
        multiple O-RUs.";

      leaf ru-instance {
        type leafref {
          path "/aggregated-o-ru/recovered-ru-instance-ids/ru-instance-id";
          require-instance false;
        }
      }
    }
  }

  container aggregated-o-ru {
    description
      "The top level container used to hold all the aggregated information related
      to a set of O-RUs.";

    uses ru-grouping;
  }
}

o-ran-agg-ietf-interfaces

module o-ran-agg-ietf-interfaces {
  yang-version 1.1;
  namespace "urn:o-ran:agg-ietf-interfaces:1.0";
  prefix "or-agg-ietf-if";

  import o-ran-aggregation-base {
    prefix "agg";
  }

  import ietf-yang-schema-mount {
    prefix "yangmnt";
  }

.......

  augment "/agg:aggregated-o-ru/agg:aggregation" {
    container ietf-interfaces-model {
      yangmnt:mount-point "ietf-interfaces-root" {
        description
          "Root for ietf-interfaces.yang model supported per O-RU instance";
      }
    }
  }
}

o-ran-agg-interfaces

module o-ran-agg-interfaces {
  yang-version 1.1;
  namespace "urn:o-ran:agg-interfaces:1.0";
  prefix "or-agg-int";

  import o-ran-aggregation-base {
    prefix "agg";
  }

  import ietf-yang-schema-mount {
    prefix "yangmnt";
  }

......

  augment "/agg:aggregated-o-ru/agg:aggregation" {
    container interfaces-model {
      yangmnt:mount-point "interfaces-root" {
        description
          "Root for o-ran-interfaces.yang model supported per O-RU instance";
      }
    }
  }
}

Post-condition netopeer2-server -d -c MSG -t 30 -x $CURRENT_DIR/config/schema_mount_extension/ietf-yang-schema-mount.xml ietf-yang-schema-mount.xml

<schema-mounts xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount">
  <mount-point>
      <module>o-ran-agg-ietf-interfaces</module>
      <label>ietf-interfaces-root</label>
      <config>true</config>
      <inline/>
  </mount-point>
  <mount-point>
      <module>o-ran-agg-interfaces</module>
      <label>interfaces-root</label>
      <config>true</config>
      <inline/>
  </mount-point>
</schema-mounts>

Test case 1, Subscribe to /o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-interfaces:interfaces-model/o-ran-interfaces:reset-interface-counters via sr_rpc_subscribe, The rpc is successfully triggered by sysrepcfg,

sysrepocfg --rpc=aggregation-reset-interface-counters.xml  -v 3
[INF] Connection 67 created.
[INF] Published event "operational get" "/ietf-yang-schema-mount:schema-mounts" with ID 12.
[INF] Event "operational get" with ID 12 succeeded.
[INF] Session 470 (user "root", CID 67) created.
[INF] Published event "rpc" "/o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-interfaces:interfaces-model/o-ran-interfaces:reset-interface-counters" with ID 7 priority 0 for 1 subscribers.
[INF] Event "rpc" with ID 7 priority 0 succeeded.
[INF] No datastore changes to apply.

Failed to trigger rpc through netopeer2-cli.

user-rpc --content aggregation-reset-interface-counters.xml --rpc-timeout 30
ly ERROR: Data model "o-ran-wg4-features@2021-12-01" not found in local searchdirs.
ly ERROR: Loading "o-ran-wg4-features" module failed. (/)
ly ERROR: Unable to load module o-ran-wg4-features@2021-12-01 specified by yang library data.
ly ERROR: Ext plugin "ly2 schema mount v1": Failed to create context for the schema-mount data.
nc ERROR: Failed to create RPC, perhaps a required feature is disabled.
cli_send_recv: Failed to send the RPC.
>

2, Subscribe to /o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-interfaces:ietf-interfaces-model/ietf-interfaces:interfaces via sr_oper_get_subscribe, The sysrepocfg -X -f xml -d operational -x /o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-interfaces:ietf-interfaces-model/ietf-interfaces:interfaces -t 10 -v 3 cannot trigger the callback.

sysrepocfg -X -f xml -d operational -x /o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-interfaces:ietf-interfaces-model/ietf-interfaces:interfaces -t 10 -v 3
[INF] Connection 70 created.
[INF] Published event "operational get" "/ietf-yang-schema-mount:schema-mounts" with ID 18.
[INF] Event "operational get" with ID 18 succeeded.
[INF] Session 552 (user "root", CID 70) created.
[INF] No datastore changes to apply.

3, Subscribe to /o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-interfaces:ietf-interfaces-model/ietf-interfaces:interfaces via sr_module_change_subscribe, Cannot trigger callback and The following error occurs.

sysrepocfg --import=o-ran-agg-ietf-interfaces.xml -d running -t 10 -v 3
[INF] Connection 71 created.
[INF] Published event "operational get" "/ietf-yang-schema-mount:schema-mounts" with ID 19.
[INF] Event "operational get" with ID 19 succeeded.
[INF] Session 554 (user "root", CID 71) created.
sysrepocfg error: Data parsing failed
[INF] No datastore changes to apply.

Is there something wrong with my test case?

Hi, @michalvasko

I have updated the latest of all project, These test cases still fail, Is there a problem with my test ?

Looking forward to your reply. thank you.

michalvasko commented 1 year ago

Firstly, not sure why I have not responded to your previous post, sorry about that. I have tested all these use-cases and now they should all work:

  1. The only problem should be that when using netopeer2-cli, you need to set its searchdir correctly so that all the mounted YANG modules can be found. If you use .../repository/yang, you should be fine.
  2. You need to create an instance of /o-ran-aggregation-base:aggregated-o-ru/aggregation for it to be in the operational datastore, otherwise the callback will never be called because its parent does not exist. If you do, it should work (although it did not originally, there was a minor problem in sysrepo that should now be fixed).
  3. In this case you cannot see the actual problem, which should now be improved in libyang and the error correctly printed. But the cause of the error will likely be your mistake, in my case it was non-implemented iana-if-type module.
rydy commented 1 year ago

Firstly, not sure why I have not responded to your previous post, sorry about that. I have tested all these use-cases and now they should all work:

  1. The only problem should be that when using netopeer2-cli, you need to set its searchdir correctly so that all the mounted YANG modules can be found. If you use .../repository/yang, you should be fine.
  2. You need to create an instance of /o-ran-aggregation-base:aggregated-o-ru/aggregation for it to be in the operational datastore, otherwise the callback will never be called because its parent does not exist. If you do, it should work (although it did not originally, there was a minor problem in sysrepo that should now be fixed).
  3. In this case you cannot see the actual problem, which should now be improved in libyang and the error correctly printed. But the cause of the error will likely be your mistake, in my case it was non-implemented iana-if-type module.

Thanks for your response,

1. I have set searchpath of the netopeer2-cli, but this problem still exists, The searchpath can only take effect after restarting netopeer2-cli.

> searchpath
/root/yangr/O1/bin/O-DU/Baicells_O-DU_O1/sysrepo_repository/yang/
>
> searchpath
/root/yangr/O1/bin/O-DU/Baicells_O-DU_O1/sysrepo_repository/yang/
> get --filter-xpath /o-ran-aggregation-base:aggregated-o-ru/*
ly ERROR: Data model "o-ran-wg4-features@2021-12-01" not found in local searchdirs.
ly ERROR: Loading "o-ran-wg4-features" module failed. (/)
ly ERROR: Unable to load module o-ran-wg4-features@2021-12-01 specified by yang library data.
ly ERROR: Ext plugin "ly2 schema mount v1": Failed to create context for the schema-mount data.
nc ERROR: Received an invalid message (Ext plugin "ly2 schema mount v1": Failed to create context for the schema-mount data.).
cli_send_recv: Failed to receive a reply.
>

restarting netopeer2-cli

> searchpath
/root/yangr/O1/bin/O-DU/Baicells_O-DU_O1/sysrepo_repository/yang/
> get --filter-xpath /o-ran-aggregation-base:aggregated-o-ru/*
DATA
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <aggregated-o-ru xmlns="urn:o-ran:agg-base:1.0">
    <recovered-ru-instance-ids>
      <ru-instance-id>Baciells_sRU67XXX_B122601202134000326</ru-instance-id>
    </recovered-ru-instance-ids>
    <aggregation>
      <ru-instance>Baciells_sRU67XXX_B122601202134000326</ru-instance>
      <ietf-interfaces-model xmlns="urn:o-ran:agg-ietf-interfaces:1.0">
        <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
          <interface>
            <name>eth2</name>
            <enabled>true</enabled>
            <oper-status>unknown</oper-status>
            <phys-address>00:11:22:33:44:55</phys-address>
            <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
              <enabled>true</enabled>
            </ipv4>
            <l2-mtu xmlns="urn:o-ran:interfaces:1.0">1514</l2-mtu>
            <vlan-tagging xmlns="urn:o-ran:interfaces:1.0">true</vlan-tagging>
            <mac-address xmlns="urn:o-ran:interfaces:1.0">00:11:22:33:44:55</mac-address>
          </interface>
        </interfaces>
      </ietf-interfaces-model>
    </aggregation>
  </aggregated-o-ru>
</data>

but introduced a new problem:

user-rpc --content aggregation-reset-interface-counters.xml --rpc-timeout 30
ERROR
        type:     application
        tag:      operation-failed
        severity: error
        message:  Data trees must be created using the session connection libyang context.

>

netopeer2-server.log

[DBG]: LN: Session 1: Received message:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="5"><action xmlns="urn:ietf:params:xml:ns:yang:1"><aggregated-o-ru xmlns="urn:o-ran:agg-base:1.0"><aggregation><ru-instance>Baciells_sRU67XXX_B122601202134000326</ru-instance><interfaces-model xmlns="urn:o-ran:agg-interfaces:1.0"><reset-interface-counters xmlns="urn:o-ran:interfaces:1.0"/></interfaces-model></aggregation></aggregated-o-ru></action></rpc>

[ERR]: SR: Data trees must be created using the session connection libyang context.
[ERR]: NP: Failed to send an RPC (Invalid argument).
[DBG]: LN: Session 1: Sending message:

#339

[DBG]: LN: Session 1: Sending message:
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="5"><rpc-error><error-type>application</error-type><error-tag>operation-failed</error-tag><error-severity>error</error-severity><error-message xml:lang="en">Data trees must be created using the session connection libyang context.</error-message></rpc-error></rpc-reply>

[DBG]: LN: Session 1: Sending message:

##

[INF]: NP: Session 1: thread 1 event new RPC.
[INF]: NP: Session 1: thread 1 event reply error.

3, I tried to import the data via sysrepocfg.

sysrepocfg --import=o-ran-agg-ietf-interfaces.xml -d running -t 10 -v 3
[INF] Connection 5 created.
[INF] EV ORIGIN: "/ietf-yang-schema-mount:schema-mounts" "oper get" ID 4 published.
[INF] EV ORIGIN: "/ietf-yang-schema-mount:schema-mounts" "oper get" ID 4 succeeded.
[INF] Session 39 (user "root", CID 5) created.
libyang error: Invalid identityref "ianaift:ethernetCsmacd" value - identity found in non-implemented module "iana-if-type". (Data location "/o-ran-aggregation-base:aggregated-o-ru/aggregation[ru-instance='Baciells_sRU67XXX_B122601202134000326']/o-ran-agg-ietf-interfaces:ietf-interfaces-model/ietf-interfaces:interfaces/interface[name='eth2-UPlane-VLAN']/type", line number 8.)
sysrepocfg error: Data parsing failed
[INF] No datastore changes to apply.

o-ran-agg-ietf-interfaces.xml

<aggregated-o-ru xmlns="urn:o-ran:agg-base:1.0">
  <aggregation>
    <ru-instance>Baciells_sRU67XXX_B122601202134000326</ru-instance>
    <ietf-interfaces-model xmlns="urn:o-ran:agg-ietf-interfaces:1.0">
        <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
          <interface>
            <name>eth2-UPlane-VLAN</name>
            <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
            <enabled>true</enabled>
            <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
              <enabled>false</enabled>
            </ipv4>
            <vlan-id xmlns="urn:o-ran:interfaces:1.0">5</vlan-id>
            <mac-address xmlns="urn:o-ran:interfaces:1.0">02:11:22:33:44:55</mac-address>
          </interface>
        </interfaces>
    </ietf-interfaces-model>
  </aggregation>
</aggregated-o-ru>

The iana-if-type YANG has been successfully installed. I don't understand what "non-implemented iana-if-type module" means?

sysrepoctl -l
Sysrepo repository: /root/yangr/O1/bin/O-DU/Baicells_O-DU_O1/sysrepo_repository

Module Name                   | Revision   | Flags | Owner     | Startup Perms | Submodules | Features
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iana-crypt-hash               | 2014-08-06 | i     |           |               |            |
iana-hardware                 | 2018-03-13 | i     |           |               |            |
iana-if-type                  | 2017-01-19 | i     |           |               |            |
ietf-crypto-types             | 2019-07-02 | i     |           |               |            |
ietf-datastores               | 2018-02-14 | I     | root:root | 666           |            |
ietf-dhcpv6-types             | 2018-09-04 | i     |           |               |            |
ietf-hardware                 | 2018-03-13 | I     | root:root | 600           |            |
ietf-inet-types               | 2013-07-15 | i     |           |               |            |
ietf-interfaces               | 2018-02-20 | I     | root:root | 600           |            |
ietf-ip                       | 2018-02-22 | I     | root:root | 600           |            |
ietf-keystore                 | 2019-07-02 | I     | root:root | 600           |            | keystore-supported
ietf-netconf                  | 2013-09-29 | I     | root:root | 600           |            | writable-running candidate confirmed-commit rollback-on-error validate startup url xpath
ietf-netconf-acm              | 2018-02-14 | I     | root:root | 666           |            |
ietf-netconf-monitoring       | 2010-10-04 | I     | root:root | 600           |            |
ietf-netconf-nmda             | 2019-01-07 | I     | root:root | 600           |            | origin with-defaults
ietf-netconf-notifications    | 2012-02-06 | I     | root:root | 666           |            |
ietf-netconf-server           | 2019-07-02 | I     | root:root | 600           |            | ssh-listen tls-listen ssh-call-home tls-call-home
ietf-netconf-with-defaults    | 2011-06-01 | I     | root:root | 666           |            |
ietf-network-instance         | 2019-01-21 | I     | root:root | 600           |            |
ietf-origin                   | 2018-02-14 | I     | root:root | 666           |            |
ietf-restconf                 | 2017-01-26 | i     |           |               |            |
ietf-ssh-common               | 2019-07-02 | i     |           |               |            |
ietf-ssh-server               | 2019-07-02 | I     | root:root | 600           |            | local-client-auth-supported
ietf-subscribed-notifications | 2019-09-09 | I     | root:root | 600           |            | encode-xml replay subtree xpath
ietf-tcp-client               | 2019-07-02 | i     |           |               |            |
ietf-tcp-common               | 2019-07-02 | I     | root:root | 600           |            | keepalives-supported
ietf-tcp-server               | 2019-07-02 | i     |           |               |            |
ietf-tls-common               | 2019-07-02 | i     |           |               |            |
ietf-tls-server               | 2019-07-02 | I     | root:root | 600           |            | local-client-auth-supported
ietf-truststore               | 2019-07-02 | I     | root:root | 600           |            | truststore-supported x509-certificates
ietf-x509-cert-to-name        | 2014-12-10 | I     | root:root | 600           |            |
ietf-yang-library             | 2019-01-04 | I     | root:root | 666           |            |
ietf-yang-metadata            | 2016-08-05 | i     |           |               |            |
ietf-yang-patch               | 2017-02-22 | i     |           |               |            |
ietf-yang-push                | 2019-09-09 | I     | root:root | 600           |            | on-change
ietf-yang-schema-mount        | 2019-01-14 | I     | root:root | 666           |            |
ietf-yang-structure-ext       | 2020-06-17 | i     |           |               |            |
ietf-yang-types               | 2013-07-15 | i     |           |               |            |
nc-notifications              | 2008-07-14 | I     | root:root | 600           |            |
notifications                 | 2008-07-14 | I     | root:root | 600           |            |
o-ran-agg-ald                 | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-ald-port            | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-antenna-calibration | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-beamforming         | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-dhcp                | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-ecpri-delay         | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-ethernet-forwarding | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-externalio          | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-fan                 | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-hardware            | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-ietf-hardware       | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-ietf-interfaces     | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-ietf-ip             | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-ietf-netconf-acm    | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-interfaces          | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-laa                 | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-laa-operations      | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-lbm                 | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-module-cap          | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-mplane-int          | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-operations          | 2019-09-26 | I     | root:root | 600           |            |
o-ran-agg-processing-element  | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-software-management | 2019-12-13 | I     | root:root | 600           |            |
o-ran-agg-supervision         | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-transceiver         | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-udp-echo            | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-uplane-conf         | 2020-06-12 | I     | root:root | 600           |            |
o-ran-agg-usermgmt            | 2020-06-12 | I     | root:root | 600           |            |
o-ran-aggregation-base        | 2019-09-26 | I     | root:root | 600           |            |
o-ran-ald                     | 2021-12-01 | I     | root:root | 600           |            |
o-ran-ald-port                | 2021-12-01 | I     | root:root | 600           |            |
o-ran-antenna-calibration     | 2021-12-01 | I     | root:root | 600           |            |
o-ran-beamforming             | 2021-12-01 | I     | root:root | 600           |            |
o-ran-c-plane-tnl             | 2020-09-08 | I     | root:root | 600           |            |
o-ran-compression-factors     | 2021-12-01 | I     | root:root | 600           |            |
o-ran-dhcp                    | 2021-12-01 | I     | root:root | 600           |            |
o-ran-ecpri-delay             | 2021-12-01 | I     | root:root | 600           |            |
o-ran-ethernet-forwarding     | 2021-12-01 | I     | root:root | 600           |            |
o-ran-externalio              | 2019-07-03 | I     | root:root | 600           |            |
o-ran-fan                     | 2021-12-01 | I     | root:root | 600           |            |
o-ran-file-management         | 2021-12-01 | I     | root:root | 600           |            |
o-ran-hardware                | 2021-12-01 | I     | root:root | 600           |            |
o-ran-interfaces              | 2021-12-01 | I     | root:root | 600           |            | UDPIP-BASED-CU-PLANE
o-ran-laa                     | 2019-07-03 | I     | root:root | 600           |            |
o-ran-laa-operations          | 2021-12-01 | I     | root:root | 600           |            |
o-ran-lbm                     | 2021-12-01 | I     | root:root | 600           |            |
o-ran-module-cap              | 2021-12-01 | I     | root:root | 600           |            |
o-ran-mplane-int              | 2021-12-01 | I     | root:root | 600           |            |
o-ran-operations              | 2021-12-01 | I     | root:root | 600           |            |
o-ran-performance-management  | 2021-12-01 | I     | root:root | 600           |            |
o-ran-processing-element      | 2021-12-01 | I     | root:root | 600           |            |
o-ran-software-management     | 2021-12-01 | I     | root:root | 600           |            |
o-ran-supervision             | 2021-12-01 | I     | root:root | 600           |            |
o-ran-synchronization         | 2020-02-12 | I     | root:root | 600           |            |
o-ran-trace                   | 2021-12-01 | I     | root:root | 600           |            |
o-ran-transceiver             | 2021-12-01 | I     | root:root | 600           |            |
o-ran-troubleshooting         | 2021-12-01 | I     | root:root | 600           |            |
o-ran-u-plane-tnl             | 2020-09-08 | I     | root:root | 600           |            |
o-ran-udp-echo                | 2019-02-04 | I     | root:root | 600           |            |
o-ran-uplane-conf             | 2021-12-01 | I     | root:root | 600           |            |
o-ran-usermgmt                | 2021-12-01 | I     | root:root | 600           |            |
o-ran-wg4-features            | 2021-12-01 | I     | root:root | 600           |            |
sysrepo-monitoring            | 2022-08-19 | I     | root:root | 666           |            |
sysrepo-plugind               | 2022-08-26 | I     | root:root | 666           |            |
yang                          | 2022-06-16 | I     | root:root | 666           |            |

Flags meaning: I - Installed/i - Imported; R - Replay support
michalvasko commented 1 year ago
  1. You just have to disconnect and create a new session, existing sessions are never modified in any way. However, I have reproduced the problem with the RPC and there were some other problems as well. They should now all be fixed in current sysrepo, I have successfully executed the RPC using NETCONF.
  2. Pay attention to the i in the falgs of the module. It means (legends at the end) that it is only imported, not installed. So install it, and it will work.
rydy commented 1 year ago
  1. You just have to disconnect and create a new session, existing sessions are never modified in any way. However, I have reproduced the problem with the RPC and there were some other problems as well. They should now all be fixed in current sysrepo, I have successfully executed the RPC using NETCONF.
  2. Pay attention to the i in the falgs of the module. It means (legends at the end) that it is only imported, not installed. So install it, and it will work.

I see, these use cases have been passed on the devel, I have a new question about notification. The netopeer-cli can receive notification of the 'hardware-state-change'. netopeer2-server.log

[DBG]: LN: Session 2: Sending message:
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>2023-01-31T21:18:27.670951952-05:00</eventTime><hardware-state-change xmlns="urn:ietf:params:xml:ns:yang:ietf-hardware"/></notification>

[DBG]: LN: Session 2: Sending message:

netopeer2-cli.log

> subscribe
OK
>
>
notification (2023-01-31T21:18:15.572196365-05:00)
<hardware-state-change xmlns="urn:ietf:params:xml:ns:yang:ietf-hardware"/>

>

The same test step and the netopeer-cli can't receive notification of the hardware-state-change in o-ran-agg-ietf-hardware. Key log:

[INF] There are no subscribers for "o-ran-aggregation-base" notifications.
[2023-01-31 21:18:27.669][YangDataStore][info][thread 65874] SYSREPO: There are no subscribers for "o-ran-aggregation-base" notifications.
[2023-01-31 21:18:27.669][YangDataStore][debug][thread 65874] Session 156 completed send notif
<aggregated-o-ru xmlns="urn:o-ran:agg-base:1.0">
    <aggregation>
        <ru-instance>Baciells_sRU67XXX_B122601202134000326</ru-instance>
        <ietf-hardware-model xmlns="urn:o-ran:agg-ietf-hardware:1.0">
            <hardware-state-change xmlns="urn:ietf:params:xml:ns:yang:ietf-hardware">
            </hardware-state-change>
        </ietf-hardware-model>
    </aggregation>
</aggregated-o-ru>

o-ran-agg-ietf-hardware.yang

module o-ran-agg-ietf-hardware {
  yang-version 1.1;
  namespace "urn:o-ran:agg-ietf-hardware:1.0";
  prefix "or-agg-ietf-hw";

  import o-ran-aggregation-base {
    prefix "agg";
  }

  import ietf-yang-schema-mount {
    prefix "yangmnt";
  }

 ......

  augment "/agg:aggregated-o-ru/agg:aggregation" {
    container ietf-hardware-model {
      yangmnt:mount-point "ietf-hardware-root" {
        description
          "Root for ietf-hardware.yang model supported per O-RU instance";
      }
    }
  }
}
michalvasko commented 1 year ago

Fine, update sysrepo and netopeer2 and the notifications should work as well.

rydy commented 1 year ago

Fine, update sysrepo and netopeer2 and the notifications should work as well.

This user-case has been passed.

rydy commented 1 year ago

I tried subscribing to changes of multiple different nodes(o-ran-agg-ietf-interfaces:ietf-interfaces-model and o-ran-agg-ietf-hardware:ietf-hardware-model) in the same YANG model(o-ran-aggregation-base), Then I edited o-ran-agg-ietf-interfaces:ietf-interfaces-model data via sysrepocfg,

 sysrepocfg --edit=o-ran-agg-ietf-interfaces.xml -d running -t 10 -v 3
[INF] Connection 3 created.
[INF] EV ORIGIN: "/ietf-yang-schema-mount:schema-mounts" "oper get" ID 2 published.
[INF] EV ORIGIN: "/ietf-yang-schema-mount:schema-mounts" "oper get" ID 2 succeeded.
[INF] Session 38 (user "root", CID 3) created.
[INF] EV ORIGIN: "o-ran-aggregation-base" "change" ID 1 priority 0 for 2 subscribers published.
[INF] EV ORIGIN: "o-ran-aggregation-base" "change" ID 1 priority 0 succeeded.
[INF] EV ORIGIN: "o-ran-aggregation-base" "done" ID 1 priority 0 for 2 subscribers published.
[INF] EV ORIGIN: "o-ran-aggregation-base" "done" ID 1 priority 0 succeeded.
[INF] No datastore changes to apply.
[root@localhost TestcaseOfSysrepoForO-DU]#

o-ran-agg-ietf-interfaces.xml

<aggregated-o-ru xmlns="urn:o-ran:agg-base:1.0">
  <aggregation>
    <ru-instance>Baciells_sRU67XXX_B122601202134000326</ru-instance>
    <ietf-interfaces-model xmlns="urn:o-ran:agg-ietf-interfaces:1.0">
        <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
          <interface>
            <name>eth2-UPlane-VLAN</name>
            <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:l2vlan</type>
            <enabled>true</enabled>
            <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
              <enabled>false</enabled>
            </ipv4>
            <vlan-id xmlns="urn:o-ran:interfaces:1.0">5</vlan-id>
            <mac-address xmlns="urn:o-ran:interfaces:1.0">02:11:22:33:44:55</mac-address>
          </interface>
        </interfaces>
    </ietf-interfaces-model>
  </aggregation>
</aggregated-o-ru>

but subscription of the o-ran-agg-ietf-hardware:ietf-hardware-model was also triggered. Key log:

[INF] EV LISTEN: "o-ran-aggregation-base" "change" ID 1 priority 0 processing (remaining 2 subscribers).
[2023-02-02 01:07:01.874][YangDataStore][info][thread 93373] SYSREPO: EV LISTEN: "o-ran-aggregation-base" "change" ID 1 priority 0 processing (remaining 2 subscribers).
[2023-02-02 01:07:01.874][YangDataStore][trace][thread 93373] static int baicells::YangDataStoreForSysrepo::OnModuleChangeCallback(sr_session_ctx_t*, uint32_t, const char*, const char*, sr_event_t, uint32_t, void*)
[2023-02-02 01:07:01.875][plugins][trace][thread 93373] baicells::IYangDataStore::ErrorCode baicells::ORanAggHardwareHandler::ModuleChangeHandler(std::string, std::string, baicells::IYangDataStore::Event, std::string&, baicells::IYangDataStore::DataFormat)
[2023-02-02 01:07:01.875][plugins][info][thread 93373] ModuleChange[CHANGE] 'o-ran-aggregation-base'&'/o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-hardware:ietf-hardware-model' callback, '/o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-hardware:ietf-hardware-model' data:
<aggregated-o-ru xmlns="urn:o-ran:agg-base:1.0">
  <aggregation>
    <ru-instance>Baciells_sRU67XXX_B122601202134000326</ru-instance>
  </aggregation>
</aggregated-o-ru>

[2023-02-02 01:07:01.875][YangDataStore][trace][thread 93373] static int baicells::YangDataStoreForSysrepo::OnModuleChangeCallback(sr_session_ctx_t*, uint32_t, const char*, const char*, sr_event_t, uint32_t, void*)
[2023-02-02 01:07:01.876][plugins][trace][thread 93373] baicells::IYangDataStore::ErrorCode baicells::ORanAggInterfacesHandler::ModuleChangeHandler(std::string, std::string, baicells::IYangDataStore::Event, std::string&, baicells::IYangDataStore::DataFormat)
[2023-02-02 01:07:01.876][plugins][info][thread 93373] ModuleChange[CHANGE] 'o-ran-aggregation-base'&'/o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-interfaces:ietf-interfaces-model' callback, '/o-ran-aggregation-base:aggregated-o-ru/aggregation/o-ran-agg-ietf-interfaces:ietf-interfaces-model' data:
<aggregated-o-ru xmlns="urn:o-ran:agg-base:1.0">
  <aggregation>
    <ru-instance>Baciells_sRU67XXX_B122601202134000326</ru-instance>
    <ietf-interfaces-model xmlns="urn:o-ran:agg-ietf-interfaces:1.0">
      <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
        <interface>
          <name>eth2-UPlane-VLAN</name>
          <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:l2vlan</type>
          <enabled>true</enabled>
          <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
            <enabled>false</enabled>
          </ipv4>
          <vlan-id xmlns="urn:o-ran:interfaces:1.0">5</vlan-id>
          <mac-address xmlns="urn:o-ran:interfaces:1.0">02:11:22:33:44:55</mac-address>
        </interface>
      </interfaces>
    </ietf-interfaces-model>
  </aggregation>
</aggregated-o-ru>

[INF] EV LISTEN: "o-ran-aggregation-base" "change" ID 1 priority 0 success (remaining 0 subscribers).
[2023-02-02 01:07:01.877][YangDataStore][info][thread 93373] SYSREPO: EV LISTEN: "o-ran-aggregation-base" "change" ID 1 priority 0 success (remaining 0 subscribers).
[INF] EV LISTEN: "o-ran-aggregation-base" "done" ID 1 priority 0 processing (remaining 2 subscribers).
[2023-02-02 01:07:01.882][YangDataStore][info][thread 93373] SYSREPO: EV LISTEN: "o-ran-aggregation-base" "done" ID 1 priority 0 processing (remaining 2 subscribers).
[2023-02-02 01:07:01.882][YangDataStore][trace][thread 93373] static int baicells::YangDataStoreForSysrepo::OnModuleChangeCallback(sr_session_ctx_t*, uint32_t, const char*, const char*, sr_event_t, uint32_t, void*)
[2023-02-02 01:07:01.885][plugins][trace][thread 93373] baicells::IYangDataStore::ErrorCode baicells::ORanAggHardwareHandler::ModuleChangeHandler(std::string, std::string, baicells::IYangDataStore::Event, std::string&, baicells::IYangDataStore::DataFormat)
[2023-02-02 01:07:01.885][YangDataStore][trace][thread 93373] static int baicells::YangDataStoreForSysrepo::OnModuleChangeCallback(sr_session_ctx_t*, uint32_t, const char*, const char*, sr_event_t, uint32_t, void*)
[2023-02-02 01:07:01.888][plugins][trace][thread 93373] baicells::IYangDataStore::ErrorCode baicells::ORanAggInterfacesHandler::ModuleChangeHandler(std::string, std::string, baicells::IYangDataStore::Event, std::string&, baicells::IYangDataStore::DataFormat)
[INF] EV LISTEN: "o-ran-aggregation-base" "done" ID 1 priority 0 success (remaining 0 subscribers).
[2023-02-02 01:07:01.888][YangDataStore][info][thread 93373] SYSREPO: EV LISTEN: "o-ran-aggregation-base" "done" ID 1 priority 0 success (remaining 0 subscribers).

I only edit o-ran-agg-ietf-interfaces:ietf-interfaces-model , I don't expect that subscription of the o-ran-agg-ietf-hardware:ietf-hardware-model is triggered. what should i do?

michalvasko commented 1 year ago

Before I test this, there is a chance it is working as intended. If you have no data and create these

<aggregated-o-ru xmlns="urn:o-ran:agg-base:1.0">
  <aggregation>
    <ru-instance>Baciells_sRU67XXX_B122601202134000326</ru-instance>
    <ietf-interfaces-model xmlns="urn:o-ran:agg-ietf-interfaces:1.0">
        <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
          <interface>
            <name>eth2-UPlane-VLAN</name>
            <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:l2vlan</type>
            <enabled>true</enabled>
            <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
              <enabled>false</enabled>
            </ipv4>
            <vlan-id xmlns="urn:o-ran:interfaces:1.0">5</vlan-id>
            <mac-address xmlns="urn:o-ran:interfaces:1.0">02:11:22:33:44:55</mac-address>
          </interface>
        </interfaces>
    </ietf-interfaces-model>
  </aggregation>
</aggregated-o-ru>

it means you are creating /o-ran-aggregation-base:aggregated-o-ru/aggregation list instance (among other nodes). And when default values are being added, all NP containers with their parents are created, which includes ietf-hardware-model. ietf-interfaces-model is created explicitly in the edit.

To ignore such a change you can either call sr_get_changes_iter() with xpath that excludes the container (selects only its descendants) or subscribe to the descendants directly.

rydy commented 1 year ago

Before I test this, there is a chance it is working as intended. If you have no data and create these

<aggregated-o-ru xmlns="urn:o-ran:agg-base:1.0">
  <aggregation>
    <ru-instance>Baciells_sRU67XXX_B122601202134000326</ru-instance>
    <ietf-interfaces-model xmlns="urn:o-ran:agg-ietf-interfaces:1.0">
      <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
        <interface>
          <name>eth2-UPlane-VLAN</name>
          <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:l2vlan</type>
          <enabled>true</enabled>
          <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
            <enabled>false</enabled>
          </ipv4>
          <vlan-id xmlns="urn:o-ran:interfaces:1.0">5</vlan-id>
          <mac-address xmlns="urn:o-ran:interfaces:1.0">02:11:22:33:44:55</mac-address>
        </interface>
      </interfaces>
    </ietf-interfaces-model>
  </aggregation>
</aggregated-o-ru>

it means you are creating /o-ran-aggregation-base:aggregated-o-ru/aggregation list instance (among other nodes). And when default values are being added, all NP containers with their parents are created, which includes ietf-hardware-model. ietf-interfaces-model is created explicitly in the edit.

To ignore such a change you can either call sr_get_changes_iter() with xpath that excludes the container (selects only its descendants) or subscribe to the descendants directly.

In this scenario, would it be inefficient if there were a lot of nodes(hundreds of) and every node would be triggered(callback handling)? By the way, Is there an API to get all the changed nodes directly at once?

michalvasko commented 1 year ago

In this scenario, would it be inefficient if there were a lot of nodes(hundreds of) and every node would be triggered(callback handling)?

Yes, it could be. It is up to you to subscribe in a way that this does not occur.

By the way, Is there an API to get all the changed nodes directly at once?

No, there is not currently. You can only iterate over the changes or get a whole subtree of updated data using standard getters.

rydy commented 1 year ago

Ok, i see, thanks.

rydy commented 1 year ago

In this scenario, would it be inefficient if there were a lot of nodes(hundreds of) and every node would be triggered(callback handling)?

Yes, it could be. It is up to you to subscribe in a way that this does not occur.

By the way, Is there an API to get all the changed nodes directly at once?

No, there is not currently. You can only iterate over the changes or get a whole subtree of updated data using standard getters.

I want to get changes of the root's lyd_node, Which APIs should i use?

michalvasko commented 1 year ago

The same API as always, sr_get_changes_iter() first with whatever XPath you want to limit the changes and then iterate over them using sr_get_change_tree_next().

rydy commented 1 year ago

The same API as always, sr_get_changes_iter() first with whatever XPath you want to limit the changes and then iterate over them using sr_get_change_tree_next().

I know that, I expect to get the root(parent lyd_node) of the changed lyd_node, Instead of fetching changed child nodes one by one, ls there a way ?

michalvasko commented 1 year ago

I have already replied.

By the way, Is there an API to get all the changed nodes directly at once?

No, there is not currently. You can only iterate over the changes or get a whole subtree of updated data using standard getters.

rydy commented 1 year ago

I have already replied.

By the way, Is there an API to get all the changed nodes directly at once?

No, there is not currently. You can only iterate over the changes or get a whole subtree of updated data using standard getters.

Sorry, I still don't quite understand, I can get multiple changed nodes(lyd_node) via sr_get_change_tree_next, but I don't convert from multiple changed nodes to root-node(lyd_node), Is there a way to do this conversion?

michalvasko commented 1 year ago

Why do I have to keep repeating what I said? No, strictly speaking, there is no API for getting the tree of all the changes. However, an inside note, the changes are actually always in a tree so whatever node you get from the changes iterator, it is a part of the whole tree.

rydy commented 1 year ago

I see, thanks.