Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

Revision history [back]

click to hide/show revision 1
initial version

dataBroker how to put list data to the data tree

I used yang to create a container to store list data, just like as node-connector data tree.

  container device-info {
  leaf name {
    type string;
    config false;
  }

  leaf description {
    type string;
    config false;
  }

  list node {
      key "id";
      leaf id {
          type string;
      }
      leaf description {
          type string;
      }
  }
} /* End container */

If it is leaf node, I can use below

    DeviceInfo operationalData = new DeviceInfoBuilder()
        .setName("Test Name")
        .setDescription("Test Desc")
        .build();
    WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
    tx.put(LogicalDatastoreType.OPERATIONAL, Identifier, operationalData);

but I don't know how to put list data into the list node.

dataBroker how to put list data to the data tree

I used yang to create a container to store list data, just like as node-connector data tree.

  container device-info {
  leaf name {
    type string;
    config false;
  }

  leaf description {
    type string;
    config false;
  }

  list node {
      key "id";
      leaf id {
          type string;
      }
      leaf description {
          type string;
      }
  }
} /* End container */

If it is leaf node, I can use below

    DeviceInfo operationalData = new DeviceInfoBuilder()
        .setName("Test Name")
        .setDescription("Test Desc")
        .build();
    WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
    tx.put(LogicalDatastoreType.OPERATIONAL, Identifier, operationalData);

but I don't know how to put list data into the list node.

dataBroker how to put list data to the data tree

I used yang to create a container to store list data, just like as node-connector data tree.

  container device-info {
  leaf name {
    type string;
    config false;
  }

  leaf description {
    type string;
    config false;
  }

  list node {
      key "id";
      leaf id {
          type string;
      }
      leaf description {
          type string;
      }
  }
} /* End container */

If it is leaf node, I can use below

    DeviceInfo operationalData = new DeviceInfoBuilder()
        .setName("Test Name")
        .setDescription("Test Desc")
        .build();
    WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
    tx.put(LogicalDatastoreType.OPERATIONAL, Identifier, operationalData);

but I don't know how to put list data into the list node.