openconfig / public

Repository for publishing OpenConfig models, documentation, and other material for the community.
Apache License 2.0
899 stars 656 forks source link

Not able to compile openconfig-platform-transceiver yang #160

Open rdpravin1895 opened 6 years ago

rdpravin1895 commented 6 years ago

I am using confdc to compile the openconfig yangs. When trying to compile the openconfig-platform-transceiver yang, I get the following error:

openconfig-platform-transceiver.yang:476: error: the node 'transceiver' from module 'openconfig-platform-transceiver' (in node 'component' from 'openconfig-platform') is not found

The line corresponding to the error is:

augment "/oc-if:interfaces/oc-if:interface/oc-if:state" {
    //TODO: add 'when' or other condition to make sure this
    //leafref points to a component of type TRANSCEIVER.
    description
      "Adds a reference from the base interface to its corresponding
      physical channels.";

    leaf-list physical-channel {
      type leafref {
        path "/oc-platform:components/" +
          "oc-platform:component[oc-platform:name=current()/../oc-port:hardware-port]/" +
          "oc-transceiver:transceiver/" +
          "oc-transceiver:physical-channels/oc-transceiver:channel/" +
          "oc-transceiver:index";
      }
      description
        "For a channelized interface, list of references to the
        physical channels (lanes) corresponding to the interface.";
    }
  }

There is a container called 'transceiver' in the openconfig-platform-transceiver yang, but it is present inside the grouping 'port-transceiver-top'.

grouping port-transceiver-top {
    description
      "Top-level grouping for client port transceiver data";

    container transceiver {
      description
        "Top-level container for client port transceiver data";

      container config {
        description
          "Configuration data for client port transceivers";

        uses port-transceiver-config;
      }

      container state {

        config false;

        description
          "Operational state data for client port transceivers";

        uses port-transceiver-config;
        uses port-transceiver-state;
      }
      // physical channels are associated with a transceiver
      // component
      uses physical-channel-top;
    }
  }

This grouping is used in another augment statement.

augment "/oc-platform:components/oc-platform:component" {
    description
      "Adding transceiver data to physical inventory";

    uses port-transceiver-top {
      when "current()/oc-platform:state/" +
        "oc-platform:type = 'TRANSCEIVER'" {
        description
          "Augment is active when component is of type TRANSCEIVER";
      }
    }
  }

How to point to a leaf inside a grouping that is used in an augment statement? Is this the reason why the error is thrown?

nkitchen commented 6 years ago

I believe the error is reported because the component augment is conditional but the interfaces augment is not yet -- the when statement for the augment of "/oc-if:interfaces/oc-if:interface/oc-if:state" is still TODO. The compiler tries to add the physical-channel list for a non-TRANSCEIVER component and can't.

rdpravin1895 commented 6 years ago

Ok. What changes have to be made so that the yang compiles successfully? Since the when statement is TODO, do I have to define them manually? Could you help me with that?

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 180 days with no activity. If you wish to keep this issue active, please remove the stale label or add a comment, otherwise will be closed in 14 days.

nkitchen commented 4 months ago

Fixed by commit da9a74575fc48be24f23d6018c5efabd9896ef93