dreport: add network details to the BMC dump

Captured below information and add it to the BMC dump

1) Adding route info the network.log file
2) Adding contents of eth0 and eth1 to the network.log file
3) Add network interface statistics to the network.log file
4) Add active TCP connection details to the network.log file

Append network.log to the BMC dump

Tested:
[route]
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         x.x.xx.x        0.0.0.0         UG    0      0        0 eth1
default         x.x.xx.x        0.0.0.0         UG    0      0        0 eth0
x.x.xx.0        *               255.255.255.0   U     0      0        0 eth0

[eth0]
[Match]
Name=eth0
[Link]
MACAddress=xx:xx:xx:xx:xx:xx
[Network]
LinkLocalAddressing=no
IPv6AcceptRA=false
DHCP=ipv6
[Address]
Address=x.x.xx.xxx/xx
[Route]
Gateway=x.x.xx.x
[DHCP]
ClientIdentifier=mac
UseDNS=true
UseNTP=true
UseHostname=true
SendHostname=true

[eth1]
[Match]
Name=eth1
[Link]
MACAddress=xx:xx:xx:xx:xx:xx
[Network]
LinkLocalAddressing=no
IPv6AcceptRA=false
DHCP=true
[Route]
Gateway=x.x.xx.x
[DHCP]
ClientIdentifier=mac
UseDNS=true
UseNTP=true
UseHostname=true
SendHostname=true

Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Change-Id: I8325b18400140f8f6e1463a5abbc1b9c526fad99
diff --git a/tools/dreport.d/plugins.d/network b/tools/dreport.d/plugins.d/network
new file mode 100644
index 0000000..3e9a0a3
--- /dev/null
+++ b/tools/dreport.d/plugins.d/network
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+#
+# config: 1234 30
+# @brief: Collect network information
+#
+
+#. $DREPORT_INCLUDE/functions
+
+file_name="network.log"
+
+#netstat
+add_cmd_output "echo $'[netstat]'" "$file_name" "netstat"
+add_cmd_output "netstat -nr" "$file_name" "netstat"
+
+#eth0
+eth0_file="/etc/systemd/network/00-bmc-eth0.network"
+if [ -f $eth0_file ]; then
+    add_cmd_output "echo $'\n[eth0]'" "$file_name" "eth0"
+    add_cmd_output "cat $eth0_file" "$file_name" "eth0"
+fi
+
+#eth1
+eth1_file="/etc/systemd/network/00-bmc-eth1.network"
+if [ -f $eth1_file ]; then
+    add_cmd_output "echo $'\n[eth1]'" "$file_name" "eth1"
+    add_cmd_output "cat $eth1_file" "$file_name" "eth1"
+fi
+
+
+#network interface statistics
+procnetdev_file="/proc/net/dev"
+if [ -f $procnetdev_file ]; then
+    add_cmd_output "echo $'\n[proc_net_dev]'" "$file_name" "proc_net_dev"
+    add_cmd_output "cat $procnetdev_file" "$file_name" "proc_net_dev"
+fi
+
+#active tcp connections
+activetcp="/proc/net/tcp"
+if [ -f $activetcp ]; then
+    add_cmd_output "echo $'\n[activetcp]'" "$file_name" "activetcp"
+    add_cmd_output "cat $activetcp" "$file_name" "activetcp"
+fi
+
+#Load average
+loadavg="cat /proc/loadavg"
+if [ -f $activetcp ]; then
+    add_cmd_output "echo $'\n[Load average]'" "$file_name" "loadaverage"
+    add_cmd_output "cat $loadavg" "$file_name" "loadaverage"
+fi