From f4b4ff813029e2571447e9c21f51701f88595c3c Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Tue, 9 Apr 2019 19:06:52 -0700 Subject: vlan: Modify create method to return an ObjectPath This will be nice to have for ipmid so that it can easily figure out the path of the new vlan object when it creates one. Change-Id: I6b93c5e64499c0cb9e36e8354eda6089bfd6d6c9 Signed-off-by: William A. Kennington III --- ethernet_interface.cpp | 4 +++- ethernet_interface.hpp | 2 +- network_manager.cpp | 4 ++-- network_manager.hpp | 2 +- xyz/openbmc_project/Network/VLAN/Create.interface.yaml | 5 +++++ 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp index 999613d..154efcb 100644 --- a/ethernet_interface.cpp +++ b/ethernet_interface.cpp @@ -424,7 +424,7 @@ void EthernetInterface::loadVLAN(VlanId id) std::move(vlanIntf)); } -void EthernetInterface::createVLAN(VlanId id) +ObjectPath EthernetInterface::createVLAN(VlanId id) { std::string vlanInterfaceName = interfaceName() + "." + std::to_string(id); std::string path = objPath; @@ -439,6 +439,8 @@ void EthernetInterface::createVLAN(VlanId id) this->vlanInterfaces.emplace(vlanInterfaceName, std::move(vlanIntf)); // write the new vlan device entry to the configuration(network) file. manager.writeToConfigurationFile(); + + return path; } ServerList EthernetInterface::getNTPServersFromConf() diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp index 7d7447d..c65726a 100644 --- a/ethernet_interface.hpp +++ b/ethernet_interface.hpp @@ -137,7 +137,7 @@ class EthernetInterface : public Ifaces /** @brief create Vlan interface. * @param[in] id- VLAN identifier. */ - void createVLAN(VlanId id); + ObjectPath createVLAN(VlanId id); /** @brief load the vlan info from the system * and creates the ip address dbus objects. diff --git a/network_manager.cpp b/network_manager.cpp index 4483631..fa5da0f 100644 --- a/network_manager.cpp +++ b/network_manager.cpp @@ -176,9 +176,9 @@ void Manager::createChildObjects() bus, objPath.string(), *this); } -void Manager::vLAN(IntfName interfaceName, uint32_t id) +ObjectPath Manager::vLAN(IntfName interfaceName, uint32_t id) { - interfaces[interfaceName]->createVLAN(id); + return interfaces[interfaceName]->createVLAN(id); } void Manager::reset() diff --git a/network_manager.hpp b/network_manager.hpp index e2dfea9..edb341f 100644 --- a/network_manager.hpp +++ b/network_manager.hpp @@ -56,7 +56,7 @@ class Manager : public details::VLANCreateIface Manager(sdbusplus::bus::bus& bus, const char* objPath, const std::string& dir); - void vLAN(IntfName interfaceName, uint32_t id) override; + ObjectPath vLAN(IntfName interfaceName, uint32_t id) override; /** @brief write the network conf file with the in-memory objects. */ diff --git a/xyz/openbmc_project/Network/VLAN/Create.interface.yaml b/xyz/openbmc_project/Network/VLAN/Create.interface.yaml index be23a55..8e63f2f 100644 --- a/xyz/openbmc_project/Network/VLAN/Create.interface.yaml +++ b/xyz/openbmc_project/Network/VLAN/Create.interface.yaml @@ -12,3 +12,8 @@ methods: type: uint32 description: > VLAN Identifier. + returns: + - name: Path + type: path + description: > + The path for the created VLAN object. -- cgit v1.2.1