Add info about status to describe

Change-Id: I18b0ad156363f08b526be9d7765dad5383612a88
diff --git a/src/interpreter.cpp b/src/interpreter.cpp
index d01cb1d..8f419c3 100644
--- a/src/interpreter.cpp
+++ b/src/interpreter.cpp
@@ -142,7 +142,12 @@
 void Interpreter::operator()(const describe_& describe) const
 {
     auto path = absolutePathFromCommand(describe);
-    std::cout << path << ": " << buildTypeInfo(path) << std::endl;
+    auto status = m_datastore.schema()->status(path);
+    auto statusStr = status == yang::Status::Deprecated ? " (deprecated)" :
+        status == yang::Status::Obsolete ? " (obsolete)" :
+        "";
+
+    std::cout << path << ": " << buildTypeInfo(path) << statusStr << std::endl;
     if (auto description = m_datastore.schema()->description(path)) {
         std::cout << std::endl << *description << std::endl;
     }
diff --git a/src/schema.hpp b/src/schema.hpp
index 49fc5db..7ce24fb 100644
--- a/src/schema.hpp
+++ b/src/schema.hpp
@@ -24,6 +24,12 @@
     List,
     Leaf
 };
+
+enum class Status {
+    Current,
+    Deprecated,
+    Obsolete
+};
 }
 
 enum class Recursion {
@@ -62,6 +68,7 @@
     virtual std::optional<std::string> leafTypeName(const std::string& path) const = 0;
     virtual std::string leafrefPath(const std::string& leafrefPath) const = 0;
     virtual std::optional<std::string> description(const std::string& location) const = 0;
+    virtual yang::Status status(const std::string& location) const = 0;
 
     virtual std::set<std::string> childNodes(const schemaPath_& path, const Recursion recursion) const = 0;
     virtual std::set<std::string> moduleNodes(const module_& module, const Recursion recursion) const = 0;
diff --git a/src/static_schema.cpp b/src/static_schema.cpp
index dfb12e8..c86b232 100644
--- a/src/static_schema.cpp
+++ b/src/static_schema.cpp
@@ -197,6 +197,11 @@
     throw std::runtime_error{"StaticSchema::description not implemented"};
 }
 
+yang::Status StaticSchema::status([[maybe_unused]] const std::string& location) const
+{
+    throw std::runtime_error{"Internal error: StaticSchema::status(std::string) not implemented. The tests should not have called this overload."};
+}
+
 yang::NodeTypes StaticSchema::nodeType([[maybe_unused]] const std::string& path) const
 {
     throw std::runtime_error{"Internal error: StaticSchema::nodeType(std::string) not implemented. The tests should not have called this overload."};
diff --git a/src/static_schema.hpp b/src/static_schema.hpp
index 0d2bdff..947cc43 100644
--- a/src/static_schema.hpp
+++ b/src/static_schema.hpp
@@ -60,6 +60,7 @@
     std::set<std::string> childNodes(const schemaPath_& path, const Recursion) const override;
     std::set<std::string> moduleNodes(const module_& module, const Recursion recursion) const override;
     std::optional<std::string> description(const std::string& path) const override;
+    yang::Status status(const std::string& location) const override;
 
     /** A helper for making tests a little bit easier. It returns all
      * identities which are based on the argument passed and which can then be
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 6290429..b134440 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -456,6 +456,18 @@
     return node->dsc() ? std::optional{node->dsc()} : std::nullopt;
 }
 
+yang::Status YangSchema::status(const std::string& location) const
+{
+    auto node = getSchemaNode(location.c_str());
+    if (node->flags() & LYS_STATUS_DEPRC) {
+        return yang::Status::Deprecated;
+    } else if (node->flags() & LYS_STATUS_OBSLT) {
+        return yang::Status::Obsolete;
+    } else {
+        return yang::Status::Current;
+    }
+}
+
 bool YangSchema::isConfig(const std::string& path) const
 {
     return getSchemaNode(path.c_str())->flags() & LYS_CONFIG_W;
diff --git a/src/yang_schema.hpp b/src/yang_schema.hpp
index c62ed20..fb0405b 100644
--- a/src/yang_schema.hpp
+++ b/src/yang_schema.hpp
@@ -46,6 +46,7 @@
     std::set<std::string> childNodes(const schemaPath_& path, const Recursion recursion) const override;
     std::set<std::string> moduleNodes(const module_& module, const Recursion recursion) const override;
     std::optional<std::string> description(const std::string& path) const override;
+    yang::Status status(const std::string& location) const override;
 
     void registerModuleCallback(const std::function<std::string(const char*, const char*, const char*, const char*)>& clb);