Added VLAN Object to EthernetInterface schema

VLAN object added to EthernetInterface schema which is visible when Ethernet Interface is a VLAN interface.

Does not break anything on Wolfpass or x86. BMCWeb working

Change-Id: I965c484e6e120568db4e6542d2b48f8a7fb54fd0
Signed-off-by: Kowalski, Kamil <kamil.kowalski@intel.com>
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 68e6ebb..eaee13e 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -56,6 +56,7 @@
   const std::string *hostname;
   const std::string *default_gateway;
   const std::string *mac_address;
+  const unsigned int *vlan_id;
 };
 
 /**
@@ -125,6 +126,14 @@
           extractProperty<std::string>(*mac_properties, "MACAddress");
     }
 
+    const PropertiesMapType *vlan_properties = extractInterfaceProperties(
+        "/xyz/openbmc_project/network/" + ethiface_id,
+        "xyz.openbmc_project.Network.VLAN", dbus_data);
+
+    if (vlan_properties != nullptr) {
+      eth_data.vlan_id = extractProperty<unsigned int>(*vlan_properties, "Id");
+    }
+
     // Extract data that contains link information (auto negotiation and speed)
     const PropertiesMapType *eth_properties = extractInterfaceProperties(
         "/xyz/openbmc_project/network/" + ethiface_id,
@@ -237,7 +246,7 @@
         ](const boost::system::error_code error_code,
           const GetManagedObjectsType &resp) {
 
-          EthernetInterfaceData eth_data;
+          EthernetInterfaceData eth_data{};
           std::vector<IPv4AddressData> ipv4_data;
           ipv4_data.reserve(MAX_IPV4_ADDRESSES_PER_INTERFACE);
 
@@ -459,6 +468,11 @@
             if (eth_data.hostname != nullptr)
               json_response["HostName"] = *eth_data.hostname;
 
+            if (eth_data.vlan_id != nullptr) {
+              json_response["VLAN"]["VLANEnable"] = true;
+              json_response["VLAN"]["VLANId"] = *eth_data.vlan_id;
+            }
+
             // ... at last, check if there are IPv4 data and prepare appropriate
             // collection
             if (ipv4_data.size() > 0) {