Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cffi/cdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ enum lyd_type {
LYD_TYPE_REPLY_YANG,
LYD_TYPE_RPC_NETCONF,
LYD_TYPE_NOTIF_NETCONF,
LYD_TYPE_REPLY_NETCONF
LYD_TYPE_REPLY_NETCONF,
LYD_TYPE_RPC_RESTCONF,
LYD_TYPE_NOTIF_RESTCONF,
LYD_TYPE_REPLY_RESTCONF
};

#define LYD_PRINT_KEEPEMPTYCONT ...
Expand Down
20 changes: 4 additions & 16 deletions libyang/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,10 @@ def dup_flags(


# -------------------------------------------------------------------------------------
def data_type(dtype):
if dtype == DataType.DATA_YANG:
return lib.LYD_TYPE_DATA_YANG
if dtype == DataType.RPC_YANG:
return lib.LYD_TYPE_RPC_YANG
if dtype == DataType.NOTIF_YANG:
return lib.LYD_TYPE_NOTIF_YANG
if dtype == DataType.REPLY_YANG:
return lib.LYD_TYPE_REPLY_YANG
if dtype == DataType.RPC_NETCONF:
return lib.LYD_TYPE_RPC_NETCONF
if dtype == DataType.NOTIF_NETCONF:
return lib.LYD_TYPE_NOTIF_NETCONF
if dtype == DataType.REPLY_NETCONF:
return lib.LYD_TYPE_REPLY_NETCONF
raise ValueError("Unknown data type")
def data_type(dtype: DataType) -> int:
if not isinstance(dtype, DataType):
dtype = DataType(dtype)
return dtype.value


# -------------------------------------------------------------------------------------
Expand Down
17 changes: 10 additions & 7 deletions libyang/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,16 @@ class IOType(enum.Enum):

# -------------------------------------------------------------------------------------
class DataType(enum.Enum):
DATA_YANG = enum.auto()
RPC_YANG = enum.auto()
NOTIF_YANG = enum.auto()
REPLY_YANG = enum.auto()
RPC_NETCONF = enum.auto()
NOTIF_NETCONF = enum.auto()
REPLY_NETCONF = enum.auto()
DATA_YANG = lib.LYD_TYPE_DATA_YANG
RPC_YANG = lib.LYD_TYPE_RPC_YANG
NOTIF_YANG = lib.LYD_TYPE_NOTIF_YANG
REPLY_YANG = lib.LYD_TYPE_REPLY_YANG
RPC_NETCONF = lib.LYD_TYPE_RPC_NETCONF
NOTIF_NETCONF = lib.LYD_TYPE_NOTIF_NETCONF
REPLY_NETCONF = lib.LYD_TYPE_REPLY_NETCONF
RPC_RESTCONF = lib.LYD_TYPE_RPC_RESTCONF
NOTIF_RESTCONF = lib.LYD_TYPE_NOTIF_RESTCONF
REPLY_RESTCONF = lib.LYD_TYPE_REPLY_RESTCONF


# -------------------------------------------------------------------------------------
Expand Down