diff --git a/src/polycubed/src/extiface.cpp b/src/polycubed/src/extiface.cpp index 14d0006a7..f0b74e39f 100644 --- a/src/polycubed/src/extiface.cpp +++ b/src/polycubed/src/extiface.cpp @@ -251,5 +251,9 @@ bool ExtIface::is_used() const { return cubes_.size() > 0 || peer_ != nullptr; } +std::string ExtIface::get_iface_name() const { + return iface_; +} + } // namespace polycubed } // namespace polycube diff --git a/src/polycubed/src/extiface.h b/src/polycubed/src/extiface.h index b7898e3f5..fa948737d 100644 --- a/src/polycubed/src/extiface.h +++ b/src/polycubed/src/extiface.h @@ -48,6 +48,8 @@ class ExtIface : public PeerIface { void set_next_index(uint16_t index); bool is_used() const; + std::string get_iface_name() const; + protected: static std::set used_ifaces; int load_ingress(); diff --git a/src/polycubed/src/transparent_cube.cpp b/src/polycubed/src/transparent_cube.cpp index a25d4f328..fb2adb67b 100644 --- a/src/polycubed/src/transparent_cube.cpp +++ b/src/polycubed/src/transparent_cube.cpp @@ -151,8 +151,11 @@ nlohmann::json TransparentCube::to_json() const { std::string parent; if (parent_) { - auto port_parent = dynamic_cast(parent_); - parent = port_parent->get_path(); + if (auto port_parent = dynamic_cast(parent_)) { + parent = port_parent->get_path(); + } else if (auto iface_parent = dynamic_cast(parent_)) { + parent = iface_parent->get_iface_name(); + } } j["parent"] = parent;