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

Instance-identifier defined in ietf-netconf but not mapped in pyangbind #355

Open
sanchayanghosh opened this issue Aug 2, 2024 · 2 comments · May be fixed by #360
Open

Instance-identifier defined in ietf-netconf but not mapped in pyangbind #355

sanchayanghosh opened this issue Aug 2, 2024 · 2 comments · May be fixed by #360

Comments

@sanchayanghosh
Copy link

sanchayanghosh commented Aug 2, 2024

What is the issue?

instance-identifier not being mapped. #123 was opened to address this issue, but got closed due to inactivity. So opening this issue because I don't know how to reopen that issue.

Elaborate on the issue?

I have created a test yang with instance-identifier defined as per RFC 6020

aeroplane.yang

module aeroplane {
    yang-version 1.1;
    namespace "urn:aeroplanetypes:test";
    prefix "test";
    revision 2024-08-02;
    container aeroplane {
        description "Its an aeroplane";
        leaf identityaero {
            type instance-identifier;
        }
    }

}

I use this script to compile this yang to a py module using pyangbind
run_pyang.sh

#!/bin/bash
export PYBINDPLUGIN=`/usr/bin/env python -c \
'import pyangbind; import os; print ("{}/plugin".format(os.path.dirname(pyangbind.__file__)))'`
echo $PYBINDPLUGIN


pyang --plugindir $PYBINDPLUGIN -f pybind -o $2 $1


I run above script and get this error

./run_pyang.sh build/aeroplane.py yang_values/aeroplane.yang 2>&1 | pbcopy
/mnt/5a257e09-2112-4140-b6d0-529977714705/yang/.venv/lib/python3.12/site-packages/pyangbind/plugin
FATAL: unmapped type (instance-identifier)
dict_keys(['boolean', 'binary', 'uint8', 'bits', 'uint16', 'uint32', 'uint64', 'string', 'decimal64', 'empty', 'int8', 'int16', 'int32', 'int64'])
'instance-identifier'
False

In #123 @robshakir had asked for a patch with what the value instance-identifier should be mapped to. Whoever is the maintainer now, I can submit a patch taking a look at the netconf-rfc for the right mapping.

What version of pyang and pyangbind do you use?

Name: pyang
Version: 2.6.1
Summary: A YANG (RFC 6020/7950) validator and converter
Home-page: https://github.com/mbj4668/pyang
Author: Martin Bjorklund
Author-email: [email protected]
License: BSD
Location: /mnt/5a257e09-2112-4140-b6d0-529977714705/yang/.venv/lib/python3.12/site-packages
Requires: lxml
Required-by: pyangbind

pyangbind version:

Name: pyangbind
Version: 0.8.5
Summary: PyangBind is a plugin for pyang which converts YANG data models into a Python class hierarchy, such that Python can be used to manipulate data that conforms with a YANG model.
Home-page: https://github.com/robshakir/pyangbind
Author: Rob Shakir
Author-email: [email protected]
License: Apache License, Version 2.0
Location: /mnt/5a257e09-2112-4140-b6d0-529977714705/yang/.venv/lib/python3.12/site-packages
Requires: enum34, lxml, pyang, regex, six
Required-by: 

PC version:

██████████████████  ████████
██████████████████  ████████
██████████████████  ████████
██████████████████  ████████
████████            ████████
████████  ████████  ████████
████████  ████████  ████████
████████  ████████  ████████
████████  ████████  ████████
████████  ████████  ████████
████████  ████████  ████████
████████  ████████  ████████
████████  ████████  ████████
████████  ████████  ████████�[1G�[13A�[32Cbob@bob-systemproductname
�[32C-------------------------
�[32COS: Manjaro Linux x86_64
�[32CKernel: Linux 5.15.160-1-MANJARO
�[32CUptime: 1 hour, 51 mins
�[32CPackages: 1987 (pacman)[stable], 159 (nix-user), 49 (nix-default), 11 (snap)
�[32CShell: bash 5.2.26
�[32CDisplay (VNC-0): 1024x768 @ 60 Hz
�[32CWM: i3 (X11)
�[32CTheme: Cutefish-light [GTK3]
�[32CIcons: Crule [GTK3]
�[32CFont: Noto Sans (9pt) [GTK3]
�[32CCursor: Vanilla-DMZ-AA
�[32CTerminal: GNOME Terminal 3.52.2
�[32CTerminal Font: Source Code Pro (10pt)
�[32CCPU: AMD Ryzen 9 5900X (24) @ 3.70 GHz
�[32CGPU: llvmpipe (LLVM 17.0.6, 256 bits)
�[32CMemory: 4.15 GiB / 31.26 GiB (13%)
�[32CSwap: Disabled
�[32CDisk (/): 243.80 GiB / 287.31 GiB (85%) - ext4
�[32CDisk (/mnt/5a257e09-2112-4140-b6d0-529977714705): 86.44 GiB / 915.82 GiB (9%) - ext4
�[32CDisk (/mnt/sda3): 10.11 GiB / 161.23 GiB (6%) - ext4
�[32CDisk (/mnt/sda5): 224.13 GiB / 300.26 GiB (75%) - fuseblk
�[32CLocal IP (wlp6s0): 192.168.0.113/24
�[32CLocale: en_IN
�[32C
�[32C�[40m   �[41m   �[42m   �[43m   �[44m   �[45m   �[46m   �[47m   �[m
�[32C�[100m   �[101m   �[102m   �[103m   �[104m   �[105m   �[106m   �[107m   �[m

@sanchayanghosh
Copy link
Author

I will be creating a PR for this. Thanks for all those who review it.

@sanchayanghosh
Copy link
Author

Very sorry for the delay. I ended up having a lot of work in a few projects. I have written a draft PR. I wanted to ask if I also need to write custom logic to check that the value passed is a valid xpath? Instance identifier sets and gets the xpath itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant