oxidized: Default values of 'enable' are ignored when its mapped in vars_map but not defined

Describe the problem The default values in the config are ignored if enable is specified in the vars_map of a jsonfile, even if the specific device does not have an enable-key specified. I can only test it with Cisco ASA devices, but I guess it should also appear with other models.

Expected behavior If the “enable” field is empty for a device in the json-file, the default values specified in the config should be used

Configuration

source:
  default: jsonfile
  jsonfile:
    file: "/home/oxidized/.config/oxidized/router.json"
    map:
      name: name
      model: model
      username: username
      password: password
    vars_map:
      cumulus_use_nvue: cumulus_use_nvue
      cumulus_use_nclu: cumulus_use_nclu
      enable: enable # This is the line that makes oxidized ignore all other enable definitions
[...]
models:
  asa:
    vars:
      enable: "ASAenablePW"

The router.json:

[
    {
        "name": "cisco-asa1.example.com",
        "model": "asa",
        "state": "up"
    },
    {
        "name": "cisco-asa2.example.com",
        "model": "asa",
        "enable": "enablePW2",
        "state": "up"
    }
]

Running environment (please complete the following information):

  • OS: Container version oxidized/oxidized:master-39aff85
  • oxidized version: see container version
  • oxidized-web version: see container version
  • Manufacturer model an software version: Cisco ASA, but should not matter
  • oxidized model name: asa

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 20 (18 by maintainers)

Commits related to this issue

Most upvoted comments

At any rate, we probably should use same method in node and for model vars to find the values, at least for the applicable part the code should be refactored to be shared as we expect them to behave same.