Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openconfig-terminal-device module : bad augment when statement #40

Closed
mberroug opened this issue Jan 11, 2017 · 8 comments
Closed

openconfig-terminal-device module : bad augment when statement #40

mberroug opened this issue Jan 11, 2017 · 8 comments
Labels

Comments

@mberroug
Copy link

Hello,

I can't validate data with this defintion:

augment "/oc-platform:components/oc-platform:component" {
when "/oc-platform:components/oc-platform:component/" +
"oc-platform:state/oc-platform:type = 'OPTICAL_CHANNEL'" {
description
"Augment is active when component is of type
OPTICAL_CHANNEL";
}
description
"Adding optical channel data to physical inventory";

uses terminal-optical-channel-top {
}

}
In fact 'OPTICAL_CHANNEL' is not typed oc-platform-types:OPENCONFIG_HARDWARE_COMPONENT or oc-platform-types:OPENCONFIG_SOFTWARE_COMPONENT

type in openconfig-platorm.yang module is defined like
leaf type {
type union {
type identityref {
base oc-platform-types:OPENCONFIG_HARDWARE_COMPONENT;
}
type identityref {
base oc-platform-types:OPENCONFIG_SOFTWARE_COMPONENT;
}
}

@einarnn
Copy link

einarnn commented Jan 11, 2017 via email

@aashaikh
Copy link
Contributor

@mberroug can you please say more about how you're doing your module validation ? I just want to try to reproduce. We recently fixed a couple of XPATH and when statement bugs in the terminal optics model but may have missed this.

@mberroug
Copy link
Author

Hello,

Thanks for your reply.

I am using yang2dsdl tool for data validation.

Following is what I have:

== Using pre-generated schemas

== Validating grammar and datatypes ...
openconfig-terminal-device.data validates.

== Adding default values... done.

== Validating semantic constraints ...
--- Validity error at "/nc:data/oc-platform:components/oc-platform:component":
Found nodes that are valid only when "$root/oc-platform:components/oc-platform:component/oc-platform:state/oc-platform:type = 'OPTICAL_CHANNEL'"

@einarnn has right , I think we should have 'oc-opt-types:OPTICAL_CHANNEL' in the when statement instead of only 'OPTICAL_CHANNEL' .

Regards,

@fnchooft
Copy link

Confirmed to work if the when-statement is altered. Is there any change to get an update for these issues?
There are some of these which would really be helpful for people starting with OpenConfig.
Kind regards, and thanks for sharing.

@fnchooft
Copy link

Afternoon, i changed the when-statement to make sure it is valid for only those components with config/type = 'OPTICAL_CHANNEL'.
This showed up during tests with ConfD-5.4.10.

augment "/oc-platform:components/oc-platform:component" {
    when "./oc-platform:config/oc-platform:type = 'oc-opt-types:OPTICAL_CHANNEL'" {
      description
        "Augment is active when component is of type
        OPTICAL_CHANNEL";
    }
    description
      "Adding optical channel data to physical inventory";

    uses terminal-optical-channel-top {
    }
  }

@venkataraghavan19
Copy link

Adding Type string as one of the types supported in the union will help us solve the issue. Need not change the augment statement.
grouping platform-component-state {
description
"Operational state data for device components.";

leaf type {
  type union {
    **type string;**
    type identityref {
      base oc-platform-types:OPENCONFIG_HARDWARE_COMPONENT;
    }
    type identityref {
      base oc-platform-types:OPENCONFIG_SOFTWARE_COMPONENT;
    }
  }
  description
    "Type of component as identified by the system";
}

@venkataraghavan19
Copy link

There is one more issue with respect to discussed augment , the Optical channel container(inside uses terminal-optical-channel-top group) will be listed for all components when any one optical channel component is created .
grouping terminal-operational-mode-top {
description
"Top-level grouping for vendor-supported operational modes";

container operational-modes {
  description
    "Enclosing container for list of operational modes";

  list mode {
    key "mode-id";
    config false;
    description
      "List of operational modes supported by the platform.
      The operational mode provides a platform-defined summary
      of information such as symbol rate, modulation, pulse
      shaping, etc.";

    leaf mode-id {
      type leafref {
        path "../state/mode-id";
      }
      description
        "Reference to mode-id";
    }

    container config {
      description
        "Configuration data for operational mode";

      uses terminal-operational-mode-config;
    }

    container state {

      config false;

      description
        "Operational state data for the platform-defined
        operational mode";

      uses terminal-operational-mode-config;
      uses terminal-operational-mode-state;
    }
  }
}

}

Copy link

github-actions bot commented Jul 4, 2024

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.

@github-actions github-actions bot added the Stale label Jul 4, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants