300-435 exam dumps

300-435 practice question 41 of 322

Automating Cisco Enterprise Solutions. Professional level, Cisco. Free question with the correct answer and a full explanation.

300-435 Question 41

Single answer

You are using Cisco's YANG Suite to validate a JSON instance document against a YANG model for a network configuration. The YANG model specifies the following structure:

module example-config {
  namespace "http://cisco.com/example-config";
  prefix ec;

  container network {
    leaf hostname {
      type string;
    }
    leaf ip-address {
      type string;
    }
  }
}

Which of the following JSON instances correctly conforms to the YANG model?

  1. A

    { "network": { "hostname": "router1", "ip-address": "192.168.1.1" } }

  2. B

    { "example-config": { "hostname": "router1", "ip-address": "192.168.1.1" } }

  3. C

    { "network": { "hostname": 12345, "ip-address": "192.168.1.1" } }

  4. D

    { "network": { "hostname": "router1" } }

Show answer and explanation

Correct answer: A

Explanation

To validate a JSON instance against a YANG model, the structure, field names, and data types in the JSON must match those defined in the YANG model. The correct JSON instance must include the 'network' container with both 'hostname' and 'ip-address' leaves, and their values must conform to the expected types (string in this case).

  • A. Correct.

    This JSON instance is correctly structured to match the YANG model. It includes the 'network' container and both required leaves ('hostname' and 'ip-address') with valid types (string).

  • B. Incorrect.

    This JSON instance uses an incorrect top-level container name ('example-config') instead of 'network', so it does not conform to the model.

  • C. Incorrect.

    This JSON instance contains an invalid type for the 'hostname' field. The YANG model requires it to be a string, but a number is provided.

  • D. Incorrect.

    This JSON instance is missing the required 'ip-address' field, which is defined as mandatory in the YANG model.

Timed practice exam

Take a 300-435 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam