I may come close to the full support finally

This commit is contained in:
root 2018-08-09 10:18:19 +00:00
parent 24e5d81bff
commit 13fbc9d572
6 changed files with 24 additions and 21 deletions

2
debian/control vendored
View File

@ -9,7 +9,7 @@ Vcs-Git: https://git.wit.com/netops/wit-network-config
Package: wit-network-config
Architecture: all
Depends: ${misc:Depends}, frr (>= 4.0-wit), sed, tcpdump, mtr-tiny, iproute2, ifupdown, ipmitool, iptables, lldpd, strongswan, telnet, netcat, fping, curl, wget, ifstat, rsyslog, ncurses-term, net-tools, bridge-utils, vlan, gnupg, sudo, isc-dhcp-client
Depends: ${misc:Depends}, sed, tcpdump, mtr-tiny, iproute2, ifupdown, ipmitool, iptables, lldpd, strongswan, telnet, netcat, fping, curl, wget, ifstat, rsyslog, ncurses-term, net-tools, bridge-utils, vlan, gnupg, sudo, isc-dhcp-client
Provides: ${diverted-files}
Conflicts: ${diverted-files}, dhcpcd5
Description: configure network for a standard wit compute and/or data node

View File

@ -2,6 +2,7 @@ files/vrf.conf etc/iproute2/rt_tables.d
files/vrf-dhcp-enter etc/dhcp/dhclient-enter-hooks.d
files/vrf-dhcp-exit etc/dhcp/dhclient-exit-hooks.d
files/dhcp-sethostname etc/dhcp/dhclient-exit-hooks.d
files/dhcp-loopback etc/dhcp/dhclient-exit-hooks.d
files/rc.local etc
files/10-frr.conf etc/sysctl.d
files/11-mgmt1.conf etc/sysctl.d

View File

@ -24,24 +24,16 @@ case "$1" in
### START gather all the info from the box and generate the variabels
source /etc/wit-net.conf
if [ -z $LOOPBACKv4 ]; then
echo "LOOPBACK not provided by DHCP"
exit 2
fi
[ -z $NODE_ID ] && export NODE_ID=$(ip -4 -br addr | grep 10.0. | awk '{ print $3 }' | awk 'BEGIN{FS="[./]"} { print $4 }')
export TIER_ID=$(echo $LOOPBACKv4 | cut -d . -f 3)
export NODE_ID=$(echo $LOOPBACKv4 | cut -d . -f 4)
export DOMAINNAME=${HOSTNAME#*.}
export MGMT_MAC=$(ip -br link show dev $(ip -4 -br addr | grep 10.0. | awk '{ print $1 }') | awk '{ print $3 }')
[ ${HOSTNAME:0:4} = vtep ] && export HOSTTYPE=hypervisor
[ ${HOSTNAME:0:1} = h ] && export HOSTTYPE=hypervisor
[ ${HOSTNAME:0:1} = d ] && export HOSTTYPE=datanode
[ $HOSTTYPE = hypervisor -a $DOMAINNAME = usw1.wit.com ] && export TIER_ID=2
[ $HOSTTYPE = datanode -a $DOMAINNAME = usw1.wit.com ] && export TIER_ID=4
[ $HOSTTYPE = hypervisor -a $DOMAINNAME = usw2.wit.com ] && export TIER_ID=18
[ $HOSTTYPE = datanode -a $DOMAINNAME = usw2.wit.com ] && export TIER_ID=20
[ $HOSTTYPE != hypervisor -a $HOSTTYPE != datanode ] && sed -ie "s/^TIER_ID.*/TIER_ID=$TIER_ID/; t; $ s/$/\nTIER_ID=$TIER_ID/" /etc/environment
if [ -z "$TIER_ID" ]; then
echo "Unable to autodetect TIER_ID, looks like we deal with a special node, please set in environment"
@ -53,9 +45,10 @@ case "$1" in
fi
export NODE_ASN="4200$(printf "%03d" $TIER_ID)$(printf "%03d" $NODE_ID)"
export LOOPBACKv4="10.1.$TIER_ID.$NODE_ID"
export LOOPBACKv6="2604:bbc0::$TIER_ID:$NODE_ID"
MGMT_MAC=$(ip -br link show dev $(ip -4 -br addr | grep 10.0. | awk '{ print $1 }') | awk '{ print $3 }')
## END variables

View File

@ -16,6 +16,15 @@ set -e
case "$1" in
install|upgrade)
source /etc/wit-net.conf
if [ -z $LOOPBACKv4 ]; then
echo "LOOPBACK NOT CONFIGURED, aborting..."
exit 2
fi
if [[ $LOOPBACKv4 = "10.1."* ]]; then
echo "only 10.1.x.y loopbacks supported at the moment"
exit 3
fi
systemctl stop systemd-networkd.socket
systemctl stop systemd-networkd.service
systemctl stop systemd-networkd-wait-online

View File

@ -1,4 +1,4 @@
/etc/systemd/timesyncd.conf.wit sed -e 's/#NTP=.*/NTP=ipv6.ntp.ubuntu.com/g'
/etc/frr/daemons.wit sed -e 's/bgpd=no/bgpd=yes/' -e 's/zebra=no/zebra=yes/'
/etc/bash.bashrc.wit sed -e 's/.*witaddon/source \/etc\/bashrc-witaddon/; t; $ s/$/\nsource \/etc\/bashrc-witaddon/'
/etc/dhcp/dhclient.conf.wit sed -e '/option.*tier-id/d;t;1s/^/option tier-id code 225 = unsigned integer 8;\n/'
/etc/dhcp/dhclient.conf.wit sed -e '/^option.*loopbackv4/d;' | sed -e '1s/^/option loopbackv4 code 225 = ip-address;\n/;'

View File

@ -1,6 +1,6 @@
#!/bin/bash
sed -ie '/^LOOPBACKv4.*/d' /etc/wit-net.conf
if [ ! -z $new_tier_id ]; then
sed -ie '/^TIER_ID=.*/d' /etc/environment
echo "TIER_ID=$new_tier_id" >>/etc/environment
if [ ! -z $new_loopbackv4 ]; then
echo "LOOPBACKv4=$new_loopbackv4" >>/etc/wit-net.conf
fi