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 <wak@google.com>
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 @@
                                  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 @@
     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 @@
     /** @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 @@
         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 @@
     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 @@
           type: uint32
           description: >
               VLAN Identifier.
+      returns:
+        - name: Path
+          type: path
+          description: >
+            The path for the created VLAN object.