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
4 changes: 4 additions & 0 deletions src/polycubed/src/extiface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/polycubed/src/extiface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> used_ifaces;
int load_ingress();
Expand Down
7 changes: 5 additions & 2 deletions src/polycubed/src/transparent_cube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,11 @@ nlohmann::json TransparentCube::to_json() const {

std::string parent;
if (parent_) {
auto port_parent = dynamic_cast<Port *>(parent_);
parent = port_parent->get_path();
if (auto port_parent = dynamic_cast<Port *>(parent_)) {
parent = port_parent->get_path();
} else if (auto iface_parent = dynamic_cast<ExtIface *>(parent_)) {
parent = iface_parent->get_iface_name();
}
}

j["parent"] = parent;
Expand Down