Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

oc-interfaces parser failing on Junos fxp interface #89

Closed
mirceaulinic opened this issue Aug 21, 2017 · 2 comments
Closed

oc-interfaces parser failing on Junos fxp interface #89

mirceaulinic opened this issue Aug 21, 2017 · 2 comments
Labels
Milestone

Comments

@mirceaulinic
Copy link
Member

$ sudo salt vmx1 napalm_yang.parse "['models.openconfig_interfaces']" config=True
vmx1:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1468, in _thread_return
        return_data = executor.execute()
      File "/usr/lib/python2.7/dist-packages/salt/executors/direct_call.py", line 28, in execute
        return self.func(*self.args, **self.kwargs)
      File "/usr/lib/python2.7/dist-packages/salt/utils/napalm.py", line 393, in func_wrapper
        return func(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/salt/modules/napalm_yang_mod.py", line 356, in parse
        root.parse_config(**parser_kwargs)
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/base.py", line 225, in parse_config
        parser.parse()
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parser.py", line 85, in parse
        self._parse(self._yang_name, self.model, self.mapping[self._yang_name])
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parser.py", line 91, in _parse
        self._parse_container(attribute, model, mapping)
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parser.py", line 132, in _parse_container
        self._parse(k, v, mapping[v._yang_name])
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parser.py", line 93, in _parse
        self._parse_list(attribute, model, mapping)
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parser.py", line 178, in _parse_list
        self._parse(key, obj, element_mapping)
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parser.py", line 91, in _parse
        self._parse_container(attribute, model, mapping)
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parser.py", line 132, in _parse_container
        self._parse(k, v, mapping[v._yang_name])
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parser.py", line 91, in _parse
        self._parse_container(attribute, model, mapping)
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parser.py", line 132, in _parse_container
        self._parse(k, v, mapping[v._yang_name])
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parser.py", line 95, in _parse
        self._parse_leaf(attribute, model, mapping)
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parser.py", line 194, in _parse_leaf
        value = self.parser.parse_leaf(mapping["_process"], self.bookmarks)
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parsers/base.py", line 99, in parse_leaf
        result = getattr(self, method_name)(m, data)
      File "/usr/local/lib/python2.7/dist-packages/napalm_yang/parsers/jsonp.py", line 116, in _parse_leaf_map
        return mapping['map'][v.lower()]
    KeyError: u'fxp'
$ sudo salt vmx1 net.cli "show configuration interfaces fxp0 | display set"
vmx1:
    ----------
    comment:
    out:
        ----------
        show configuration interfaces fxp0 | display set:

            set interfaces fxp0 unit 0 family inet address 10.0.0.15/24
    result:
        True

The XML at that level is the following:

    <interfaces>
        <interface>
            <name>fxp0</name>
            <unit>
                <name>0</name>
                <family>
                    <inet>
                        <address>
                            <name>10.0.0.15/24</name>
                        </address>
                    </inet>
                </family>
            </unit>
        </interface>
    </interfaces>

Very strange that the exception complains about the fxp key, when the interface name is called fxp0.

Logs:

[DEBUG   ] Parsing attribute: /interfaces
[DEBUG   ] Parsing attribute: /interfaces/interface
[DEBUG   ] Parsing attribute: /interfaces/interface
[DEBUG   ] Parsing element interface[fxp0]
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan
[DEBUG   ] Skipping attribute: openconfig-vlan:fxp0
[INFO    ] Finding parser for openconfig-vlan:routed-vlan
[DEBUG   ] Found on profile: junos, /usr/local/lib/python2.7/dist-packages/napalm_yang/mappings/junos/parsers/config/openconfig-vlan/routed-vlan.yaml
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/state
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/config/vlan
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/config/vlan
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4
[DEBUG   ] Skipping attribute: openconfig-if-ip:routed-vlan
[INFO    ] Finding parser for openconfig-if-ip:ipv4
[DEBUG   ] Found on profile: junos, /usr/local/lib/python2.7/dist-packages/napalm_yang/mappings/junos/parsers/config/openconfig-if-ip/ipv4.yaml
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/neighbors
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/neighbors
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/state
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/unnumbered
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/unnumbered
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/config/enabled
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/config/enabled
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/config/mtu
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/config/mtu
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/addresses
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv4/addresses
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/routed-vlan/ipv6
[DEBUG   ] Skipping attribute: openconfig-if-ip:routed-vlan
[INFO    ] Finding parser for openconfig-if-ip:ipv6
[ERROR   ] Couldn't find parsing file: /usr/local/lib/python2.7/dist-packages/napalm_yang/mappings/junos/parsers/config/openconfig-if-ip/ipv6.yaml
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/state
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/ethernet
[DEBUG   ] Skipping attribute: openconfig-if-ethernet:fxp0
[INFO    ] Finding parser for openconfig-if-ethernet:ethernet
[ERROR   ] Couldn't find parsing file: /usr/local/lib/python2.7/dist-packages/napalm_yang/mappings/junos/parsers/config/openconfig-if-ethernet/ethernet.yaml
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/name
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/name
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface
[DEBUG   ] Parsing element subinterface[0]
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/index
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/index
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/vlan
[DEBUG   ] Skipping attribute: openconfig-vlan:0
[INFO    ] Finding parser for openconfig-vlan:vlan
[DEBUG   ] Found on profile: junos, /usr/local/lib/python2.7/dist-packages/napalm_yang/mappings/junos/parsers/config/openconfig-vlan/vlan.yaml
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/vlan
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/vlan/state
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/vlan/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/vlan/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/vlan/config/vlan-id
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/vlan/config/vlan-id
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/state
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4
[DEBUG   ] Skipping attribute: openconfig-if-ip:0
[INFO    ] Finding parser for openconfig-if-ip:ipv4
[DEBUG   ] Found on profile: junos, /usr/local/lib/python2.7/dist-packages/napalm_yang/mappings/junos/parsers/config/openconfig-if-ip/ipv4.yaml
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/neighbors
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/neighbors
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/state
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/unnumbered
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/unnumbered
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/config/enabled
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/config/enabled
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/config/mtu
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/config/mtu
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address
[DEBUG   ] Parsing element address[10.0.0.15]
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/ip
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/ip
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/state
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/config/ip
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/config/ip
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/config/prefix-length
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/config/prefix-length
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/config/secondary
[DEBUG   ] Skipping attribute: napalm-if-ip:config
[INFO    ] Finding parser for napalm-if-ip:secondary
[ERROR   ] Couldn't find parsing file: /usr/local/lib/python2.7/dist-packages/napalm_yang/mappings/junos/parsers/config/napalm-if-ip/secondary.yaml
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/vrrp
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv4/addresses/address[ip='10.0.0.15']/vrrp
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/ipv6
[DEBUG   ] Skipping attribute: openconfig-if-ip:0
[INFO    ] Finding parser for openconfig-if-ip:ipv6
[ERROR   ] Couldn't find parsing file: /usr/local/lib/python2.7/dist-packages/napalm_yang/mappings/junos/parsers/config/openconfig-if-ip/ipv6.yaml
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/config/index
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/config/index
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/config/enabled
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/config/enabled
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/config/name
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/config/name
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/config/description
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/subinterfaces/subinterface[index='0']/config/description
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/hold-time
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/hold-time
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/config
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/config/enabled
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/config/enabled
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/config/description
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/config/description
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/config/type
[DEBUG   ] Parsing attribute: /interfaces/interface[name='fxp0']/config/type
[WARNING ] The minion function caused an exception
@mirceaulinic
Copy link
Member Author

When installing napalm-yang from pip: Successfully installed napalm-yang-0.0.7, although the version on the master branch is 0.0.6: https://github.com/napalm-automation/napalm-yang/blob/master/setup.py#L15 - and I'm not seeing what I'm missing.

@mirceaulinic
Copy link
Member Author

Anyway, the same happens also on the develop branch, the error being in a different place:

$ sudo salt vmx1 napalm_yang.parse "['models.openconfig_interfaces']" config=True
vmx1:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1468, in _thread_return
        return_data = executor.execute()
      File "/usr/lib/python2.7/dist-packages/salt/executors/direct_call.py", line 28, in execute
        return self.func(*self.args, **self.kwargs)
      File "/usr/lib/python2.7/dist-packages/salt/utils/napalm.py", line 393, in func_wrapper
        return func(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/salt/modules/napalm_yang_mod.py", line 356, in parse
        root.parse_config(**parser_kwargs)
      File "/state/home/mircea/src/napalm-yang/napalm_yang/base.py", line 225, in parse_config
        parser.parse()
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parser.py", line 85, in parse
        self._parse(self._yang_name, self.model, self.mapping[self._yang_name])
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parser.py", line 91, in _parse
        self._parse_container(attribute, model, mapping)
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parser.py", line 129, in _parse_container
        self._parse(k, v, mapping[v._yang_name])
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parser.py", line 93, in _parse
        self._parse_list(attribute, model, mapping)
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parser.py", line 171, in _parse_list
        self._parse(key, obj, element_mapping)
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parser.py", line 91, in _parse
        self._parse_container(attribute, model, mapping)
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parser.py", line 129, in _parse_container
        self._parse(k, v, mapping[v._yang_name])
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parser.py", line 91, in _parse
        self._parse_container(attribute, model, mapping)
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parser.py", line 129, in _parse_container
        self._parse(k, v, mapping[v._yang_name])
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parser.py", line 95, in _parse
        self._parse_leaf(attribute, model, mapping)
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parser.py", line 183, in _parse_leaf
        value = self.parser.parse_leaf(attribute, mapping["_process"], self.bookmarks)
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parsers/base.py", line 101, in parse_leaf
        result = self._parse_leaf_default(attribute, m, data)
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parsers/xml.py", line 29, in _parse_leaf_default
        return super()._parse_leaf_default(attribute, mapping, data)
      File "/state/home/mircea/src/napalm-yang/napalm_yang/parsers/jsonp.py", line 109, in _parse_leaf_default
        d = mapping['map'][d.lower()]
    KeyError: u'fxp'

@mirceaulinic mirceaulinic added this to the 0.0.8 milestone Aug 21, 2017
mirceaulinic added a commit that referenced this issue Aug 21, 2017
Resolves #89.

The fxp interfaces are used for manamenet, so they probably fall
into the same category ethernetCsmacd, as ge, xe, etc.
Juniper description:
"Management and internal Ethernet interfaces. For M Series routers,
MX Series routers, T Series routers, and TX Series routers, you can
use the show chassis hardware command to display hardware information
about the router, including its Routing Engine model."
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant