#!/bin/bash

function ip2int {
    local a b c d
    { IFS=. read a b c d; } <<< $1
    echo $(((((((a << 8) | b) << 8) | c) << 8) | d))
}

function int2ip {
    local ui32=$1; shift
    local ip n
    for n in 1 2 3 4; do
        ip=$((ui32 & 0xff))${ip:+.}$ip
        ui32=$((ui32 >> 8))
    done
    echo $ip
}

function netmask {
    local mask=$((0xffffffff << (32 - $1))); shift
    int2ip $mask
}

function broadcast {
    local addr=$(ip2int $1); shift
    local mask=$((0xffffffff << (32 -$1))); shift
    int2ip $((addr | ~mask))
}

function network {
    local addr=$(ip2int $1); shift
    local mask=$((0xffffffff << (32 -$1))); shift
    int2ip $((addr & mask))
}

function first {
    local addr=$(ip2int $1)
    addr=`expr $addr + 1`
    int2ip $addr
}

function guess_type {
    local CNT=$(echo "$1" | sed -e 's/[:.]/ /g' | wc -w)
    if [ $CNT -ne 1 ]; then
        # drop all sub and vlan interfaces
        echo "DNC"
        return
    fi
    local DRIVER=$(ethtool -i $1 2>/dev/null | grep driver | awk '{print $2}')
    local RESULT="DNC"
    case $DRIVER in
            mlx4_en)
            RESULT="MLX4_EN"
            ;;
        i40e)
            RESULT="I40G"
            ;;
        ixgbe)
            RESULT="10G"
            ;;
        *)
            IS_PHY=$(ls -l /sys/class/net/$1 | grep -v virtual | wc -l)
            if [ $IS_PHY -eq 1 ]; then
            RESULT="ETH"
            fi
            ;;
        *) ;;
    esac
    echo $RESULT
}

function get_mac {
  echo $(ifconfig $1 | grep HWaddr | awk '{print $5}')
}

function generate_persistent_names {
    local OUT=$NAMES_FILE
#"70-persistent-net.rules"
    rm -rf $OUT

    IDX=0
    # this will not support more than 10 fabric nics... should be ok. (Famous last words)
    for i in $(cat $1 | sort); do
        echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"$i\", ATTR{dev_id}==\"0x$IDX\", ATTR{type}==\"1\", KERNEL==\"*\", NAME=\"eth$IDX\"" >> $OUT
        IDX=$(expr $IDX + 1)
    done

    for i in $(cat $2 | sort); do
        echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"$i\", NAME=\"eth$IDX\"" >> $OUT
        IDX=$(expr $IDX + 1)
    done
}

# FABRIC_LIST ETH_LIST FAB_IFACE EXT_IFACE MGT_IFACE
function generate_interfaces {
    OUT=$IFACES_FILE
    rm -rf $OUT
    echo "# This file describes the network interfaces available on your system" >> $OUT
    echo "# and how to activate them. For more information, see interfaces(5)." >> $OUT
    echo "" >> $OUT
    echo "# The loopback network interface" >> $OUT
    echo "auto lo" >> $OUT
    echo "iface lo inet loopback" >> $OUT
    echo "" >> $OUT

    IDX=0
    local CNT40=$(cat $1 | wc -w)
    for i in $(cat $1); do
        echo "auto eth$IDX" >> $OUT
        echo "iface eth$IDX inet manual" >> $OUT
        echo "    bond-master $3" >> $OUT
        [ -z $FIRST ] && echo "    bond-primary eth$IDX" >> $OUT
        FIRST="done"
        echo "" >> $OUT
        IDX=$(expr $IDX + 1)
    done

    if [ $CNT40 -ne 0 ]; then
      echo "auto $3" >> $OUT
      echo "iface $3 inet static" >> $OUT
      echo "  address $FAB_IP" >> $OUT
      echo "  network $FAB_NETWORK" >> $OUT
      echo "  netmask $FAB_NETMASK" >> $OUT
      # Make bond-mode configurable
      echo "  bond-mode active-backup" >> $OUT
      echo "  bond-miimon 100" >> $OUT
      echo "  bond-slaves none" >> $OUT
      echo "" >> $OUT
    fi

    BRIDGE_PORTS=
    for i in $(cat $2); do
        if [ "eth$IDX" == "$4" ]; then
                echo "auto eth$IDX" >> $OUT
            if [ "$EXT_IP" == "dhcp" ]; then
                echo "iface eth$IDX inet dhcp" >> $OUT
            elif [ "$EXT_IP" == "manual" ]; then
            echo "iface eth$IDX inet manual" >> $OUT
            else
                echo "iface eth$IDX inet static" >> $OUT
                echo "    address $EXT_IP" >> $OUT
                echo "    network $EXT_NETWORK" >> $OUT
                echo "    netmask $EXT_NETMASK" >> $OUT
                echo "    broadcast $EXT_BROADCAST" >> $OUT
                echo "    gateway $EXT_GW" >> $OUT
            echo "    dns-nameservers 8.8.8.8 8.8.4.4" >> $OUT
            echo "    dns-search cord.lab" >> $OUT
            fi
        elif [ "eth$IDX" == "$5" ]; then
            echo "auto eth$IDX" >> $OUT
            if [ "$MGT_IP" == "dhcp" ]; then
                echo "iface eth$IDX inet dhcp" >> $OUT
            elif [ "$MGT_IP" == "manual" ]; then
            echo "iface eth$IDX inet manual" >> $OUT
            else
                echo "iface eth$IDX inet static" >> $OUT
                echo "    address $MGT_IP" >> $OUT
                echo "    network $MGT_NETWORK" >> $OUT
                echo "    netmask $MGT_NETMASK" >> $OUT
                echo "    broadcast $MGT_BROADCAST" >> $OUT
                echo "    gateway $MGT_GW" >> $OUT
            fi
        else
            echo "auto eth$IDX" >> $OUT
            echo "iface eth$IDX inet manual" >> $OUT
            BRIDGE_PORTS="$BRIDGE_PORTS eth$IDX"
        fi
        echo "" >> $OUT
        IDX=$(expr $IDX + 1)
    done

    local BRNAME=$5
    local F=$(echo $5 | grep "^eth[0-9]*$" | wc -l)
    if [ $F -ne 0 ]; then
        BRNAME="br-mgmt"
    fi
    local BPCNT=$(echo $BRIDGE_PORTS | wc -w)
    if [ $BPCNT -ne 0 ]; then
        echo "auto $BRNAME" >> $OUT
        echo "iface $BRNAME inet dhcp" >> $OUT
        echo "    bridge_ports $BRIDGE_PORTS" >> $OUT
    fi
}

FAB_IFACE=$1
FAB_ADDR=$2
FAB_IP=$(echo $FAB_ADDR | cut -d/ -f1)
FAB_MASKBITS=$(echo $FAB_ADDR | cut -d/ -f2)
FAB_NETWORK=$(network $FAB_IP $FAB_MASKBITS)
FAB_NETMASK=$(netmask $FAB_MASKBITS)

EXT_IFACE=$3
EXT_ADDR=$4
if [ "$EXT_ADDR" != "dhcp" ]; then
    EXT_IP=$(echo $EXT_ADDR | cut -d/ -f1)
    EXT_MASKBITS=$(echo $EXT_ADDR | cut -d/ -f2)
    EXT_NETWORK=$(network $EXT_IP $EXT_MASKBITS)
    EXT_NETMASK=$(netmask $EXT_MASKBITS)
    EXT_BROADCAST=$(broadcast $EXT_IP $EXT_MASKBITS)
    EXT_GW=$(first $EXT_ADDR)
fi
MGT_IFACE=$5
MGT_ADDR=$6
if [ "$MGT_ADDR" != "dhcp" ]; then
    MGT_IP=$(echo $MGT_ADDR | cut -d/ -f1)
    MGT_MASKBITS=$(echo $MGT_ADDR | cut -d/ -f2)
    MGT_NETWORK=$(network $MGT_IP $MGT_MASKBITS)
    MGT_NETMASK=$(netmask $MGT_MASKBITS)
    MGT_BROADCAST=$(broadcast $MGT_IP $MGT_MASKBITS)
    MGT_GW=$(first $MGT_ADDR)
fi

LIST_ETH=$(mktemp -u)
LIST_FABRIC=$(mktemp -u)
IFACES_FILE=$(mktemp -u)
NAMES_FILE=$(mktemp -u)

IFACES=$(ifconfig -a | grep "^[a-z]" | awk '{print $1}')

for i in $IFACES; do
    TYPE=$(guess_type $i)
    case $TYPE in
        ETH)
            echo "$(get_mac $i)" >> $LIST_ETH
            ;;
        I40G|MLX4_EN|10G)
            echo "$(get_mac $i)" >> $LIST_FABRIC
            ;;
        *) ;;
    esac
done

CHANGED="false"

generate_interfaces $LIST_FABRIC $LIST_ETH "$FAB_IFACE" "$EXT_IFACE" "$MGT_IFACE"

diff /etc/network/interfaces $IFACES_FILE 2>&1 > /dev/null
if [ $? -ne 0 ]; then
  CHANGED="true"
  cp /etc/network/interfaces /etc/network/interfaces.1
  cp $IFACES_FILE /etc/network/interfaces
fi

generate_persistent_names $LIST_FABRIC $LIST_ETH "$FAB_IFACE" "$EXT_IFACE"

if [ -r /etc/udev/rules.d/70-persistent-net.rules ]; then
  diff /etc/udev/rules.d/70-persistent-net.rules $NAMES_FILE 2>&1 > /dev/null
  if [ $? -ne 0 ]; then
    CHANGED="true"
    cp /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.1
    cp $NAMES_FILE /etc/udev/rules.d/70-persistent-net.rules
  fi
else
  CHANGED="true"
  cp $NAMES_FILE /etc/udev/rules.d/70-persistent-net.rules
fi

rm -rf $IFACES_FILE
rm -rf $NAMES_FILE
rm -rf $LIST_ETH
rm -rf $LIST_FABRIC

echo -n $CHANGED
