From 214ea903fca5d1a483798f4ffdb5a3b54f980eeb Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Jul 2018 18:28:18 +0000 Subject: [PATCH] getting close.... only frr.conf is not behaving --- debian/postinst.ex | 2 +- debian/preinst.ex | 5 +++-- debian/wit-hypervisor.displace | 1 + debian/wit-hypervisor.hide | 4 ---- debian/wit-hypervisor.install | 2 +- debian/wit-hypervisor.transform | 3 ++- files/{frr.conf.tmpl => frr.conf.wit} | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) create mode 100644 debian/wit-hypervisor.displace delete mode 100644 debian/wit-hypervisor.hide rename files/{frr.conf.tmpl => frr.conf.wit} (98%) diff --git a/debian/postinst.ex b/debian/postinst.ex index 6cb4c5a..d2aed70 100644 --- a/debian/postinst.ex +++ b/debian/postinst.ex @@ -25,7 +25,7 @@ case "$1" in echo "iface lo:0 inet static\n address 10.1.$TIER_ID.$NODE_ID/32" >> /etc/network/interfaces.d/lo echo "iface lo:0 inet6 static\n address 2604:bbc0::$TIER_ID:$NODE_ID/128" >> /etc/network/interfaces.d/lo - sed -e "s/VTEPINDEX/$MYID/" -e "s/TIERID/$TIERID/" -e "s/TIERASN/$(printf "%03d" $TIERID)/" -e "s/VTEPASN/$(printf "%03d" $MYID)/" /usr/share/wit-hypervisor/frr.conf.tmpl >/etc/frr/frr.conf + #sed -i -e "s/VTEPINDEX/$MYID/" -e "s/TIERID/$TIERID/" -e "s/TIERASN/$(printf "%03d" $TIERID)/" -e "s/VTEPASN/$(printf "%03d" $MYID)/" /etc/frr/frr.conf echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$MGMT_MAC'", ATTR{type}=="1", NAME="mgmt1"' >/etc/udev/rules.d/70-persistent-net.rules diff --git a/debian/preinst.ex b/debian/preinst.ex index e96b7bb..356785e 100644 --- a/debian/preinst.ex +++ b/debian/preinst.ex @@ -23,8 +23,8 @@ case "$1" in MGMT_MAC=$(ip -br link show dev $(ip -4 -br addr | grep 10.0. | awk '{ print $1 }') | awk '{ print $3 }') - [ "$MGMT_ID" -ge 0 -a "$MGMT_ID" -lt 16 ] && export DOMAINNAME=.usw1.wit.com - [ "$MGMT_ID" -ge 16 -a "$MGMT_ID" -lt 32 ] && export DOMAINNAME=.usw2.wit.com + [ "$MGMT_ID" -ge 0 -a "$MGMT_ID" -lt 16 ] && export DOMAINNAME=usw1.wit.com + [ "$MGMT_ID" -ge 16 -a "$MGMT_ID" -lt 32 ] && export DOMAINNAME=usw2.wit.com [ ${HOSTNAME:0:1} = h ] && export HOSTTYPE=hypervisor @@ -46,6 +46,7 @@ case "$1" in exit 2 fi + export NODE_ASN="$(printf "%03d" $TIER_ID)$(printf "%03d" $NODE_ID)" ;; diff --git a/debian/wit-hypervisor.displace b/debian/wit-hypervisor.displace new file mode 100644 index 0000000..2058bc8 --- /dev/null +++ b/debian/wit-hypervisor.displace @@ -0,0 +1 @@ +/etc/frr/frr.conf.wit diff --git a/debian/wit-hypervisor.hide b/debian/wit-hypervisor.hide deleted file mode 100644 index cc3e875..0000000 --- a/debian/wit-hypervisor.hide +++ /dev/null @@ -1,4 +0,0 @@ -/etc/systemd/network/* -/etc/frr/daemons -/etc/bash.bashrc -/etc/systemd/timesyncd.conf.wit diff --git a/debian/wit-hypervisor.install b/debian/wit-hypervisor.install index dc8ba2a..75df8d7 100644 --- a/debian/wit-hypervisor.install +++ b/debian/wit-hypervisor.install @@ -11,4 +11,4 @@ files/qemu-ifup-public etc/libvirt/hooks files/qemu-ifup etc/libvirt/hooks files/firewall etc/init.d files/interfaces etc/network -files/frr.conf.tmpl usr/share/wit-hypervisor +files/frr.conf.wit /etc/frr diff --git a/debian/wit-hypervisor.transform b/debian/wit-hypervisor.transform index 8494474..1e6dad2 100644 --- a/debian/wit-hypervisor.transform +++ b/debian/wit-hypervisor.transform @@ -1,3 +1,4 @@ -/etc/frr/daemons.wit sed -e 's/bgpd=no/bgpd=yes/' -e 's/zebra=no/zebra=yes/' /etc/systemd/timesyncd.conf.wit sed -e 's/#NTP=.*/NTP=ipv6.ntp.ubuntu.com/g' /etc/bash.bashrc.wit sed -e '/.*bashrc-witaddon.*/d' -e '$ s/$/\nsource \/etc\/bashrc-witaddon/' +/etc/frr/daemons.wit sed -e 's/bgpd=no/bgpd=yes/' -e 's/zebra=no/zebra=yes/' +/etc/frr/frr.conf.wit sed -e "s/VTEPINDEX/$NODE_ID/" -e "s/TIERID/$TIER_ID/" -e "s/NODEASN/$NODE_ASN/" diff --git a/files/frr.conf.tmpl b/files/frr.conf.wit similarity index 98% rename from files/frr.conf.tmpl rename to files/frr.conf.wit index 12cdd2a..2868c08 100644 --- a/files/frr.conf.tmpl +++ b/files/frr.conf.wit @@ -13,7 +13,7 @@ interface feth2 ipv6 nd ra-interval 10 no ipv6 nd suppress-ra ! -router bgp 4200TIERASNVTEPASN +router bgp 4200NODEASN bgp router-id 10.1.TIERID.VTEPINDEX no bgp default ipv4-unicast coalesce-time 1000