Load the VLAN interfaces from the system

At start up Network Manager creates all the interfaces
by reading it from the system.This commit creates the
vlan interface after reading it from the system.

Change-Id: I38e6f3b776f834e33d17e4e88f700b4f52af4048
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/network_manager.cpp b/network_manager.cpp
index cac4d93..6ae3bfb 100644
--- a/network_manager.cpp
+++ b/network_manager.cpp
@@ -64,18 +64,38 @@
     for (const auto& intfInfo : interfaceInfoList)
     {
         fs::path objPath = objectPath;
+        auto index = intfInfo.first.find(".");
+
+        // interface can be of vlan type or normal ethernet interface.
+        // vlan interface looks like "interface.vlanid",so here by looking
+        // at the interface name we decide that we need
+        // to create the vlaninterface or normal physical interface.
+        if (index != std::string::npos)
+        {
+            //it is vlan interface
+            auto interface = intfInfo.first.substr(0, index);
+            auto vlanid = intfInfo.first.substr(index + 1);
+            uint32_t vlanInt = std::stoul(vlanid);
+
+            interfaces[interface]->loadVLAN(vlanInt);
+            return;
+        }
+        // normal ethernet inetrface
         objPath /= intfInfo.first;
 
         auto dhcp = getDHCPValue(intfInfo.first);
 
+        auto intf =  std::make_shared<phosphor::network::EthernetInterface>(
+                         bus,
+                         objPath.string(),
+                         dhcp,
+                         *this);
+
+
+        intf->createIPAddressObjects();
+
         this->interfaces.emplace(std::make_pair(
-                                     intfInfo.first,
-                                     std::make_unique<
-                                     phosphor::network::EthernetInterface>
-                                     (bus,
-                                      objPath.string(),
-                                      dhcp,
-                                      *this)));
+                                     intfInfo.first, std::move(intf)));
 
     }