diff --git a/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst b/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst index 0f3ce1184..512c4b1f4 100644 --- a/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst +++ b/docs/source/advanced/networks/onie_switches/os_cumulus/manage.rst @@ -1,10 +1,10 @@ Switch Management ================= -VLAN Configuration ------------------- +Switch Port and VLAN Configuration +---------------------------------- -xCAT ships a simple configuration script that will set all the ports on the switch to be part of VLAN 1. See the Cumulus Networks documentation for more information regarding advanced networking configuration. :: +xCAT expects the configuration for the front-panel ports to be located at ``/etc/network/interfaces.d/xCAT.intf`` on the switch. The ``configinterface`` postscript can download an interface configuration file from the management node. Place the configuration file in the directory ``/install/custom/sw_os/cumulus/interface/`` on the management node. It will first look for a file named the same as the switch's hostname, followed by the name of each group, followed by the word 'default'. If the postscript cannot find a configuration file on the management node, it will set all the ports on the switch to be part of VLAN 1. See the Cumulus Networks documentation for more information regarding advanced networking configuration. :: updatenode -P configinterface diff --git a/xCAT/postscripts/configinterface b/xCAT/postscripts/configinterface index 53d9c720a..9c248b2e4 100755 --- a/xCAT/postscripts/configinterface +++ b/xCAT/postscripts/configinterface @@ -9,45 +9,66 @@ fi xcat_intf="/etc/network/interfaces.d/xCAT.intf" -if [ -f $xcat_intf ] && grep -w '#This is sample interface file provided by xCAT' $xcat_intf ; then - echo "The switch data ports and default brige have been configured. Do nothing..." - exit 0 +if [ -z "$MASTER" ]; then + echo "xCAT Master unset! Cannot download interface description" + exit 2 fi -echo "#This is sample interface file provided by xCAT" > $xcat_intf -echo "# bridge-vlan-aware: set to yes to indicate that the bridge is VLAN-aware. " >> $xcat_intf -echo "# bridge-access: declares the access port. " >> $xcat_intf -echo "# bridge-pvid: specifies native VLANs if the ID is other than 1. " >> $xcat_intf -echo "# bridge-vids: declares the VLANs associated with this bridge. " >> $xcat_intf -echo " " >> $xcat_intf +TMPINT=/tmp/xCAT.intf +rm $TMPINT 2>/dev/null +UPDATED=0 -#create default bridge -echo "auto br0" >> $xcat_intf -echo "iface br0" >> $xcat_intf -echo " bridge-vlan-aware yes" >> $xcat_intf -echo " bridge-ports glob swp1-52" >> $xcat_intf -echo " bridge-stp on" >> $xcat_intf -echo " bridge-vids 1 " >> $xcat_intf -echo " bridge-pvid 1" >> $xcat_intf -echo " " >> $xcat_intf - -#create each interface - -for i in `seq 1 52`; -do - echo "auto swp$i">> $xcat_intf - echo "iface swp$i" >> $xcat_intf - echo " mstpctl-portadminedge yes" >> $xcat_intf - echo " " >> $xcat_intf +for name in $NODE ${GROUP//,/ } default; do + curl -s -o $TMPINT -f http://${MASTER}/install/custom/sw_os/cumulus/interface/$name + if [ -f $TMPINT ]; then + if ! diff $TMPINT $xcat_intf > /dev/null; then + mv $TMPINT $xcat_intf + UPDATED=1 + fi + break + fi done +if [ ! -f $xcat_intf ]; then + UPDATED=1 + + echo "#This is sample interface file provided by xCAT" > $xcat_intf + echo "# bridge-vlan-aware: set to yes to indicate that the bridge is VLAN-aware. " >> $xcat_intf + echo "# bridge-access: declares the access port. " >> $xcat_intf + echo "# bridge-pvid: specifies native VLANs if the ID is other than 1. " >> $xcat_intf + echo "# bridge-vids: declares the VLANs associated with this bridge. " >> $xcat_intf + echo " " >> $xcat_intf + + #create default bridge + echo "auto br0" >> $xcat_intf + echo "iface br0" >> $xcat_intf + echo " bridge-vlan-aware yes" >> $xcat_intf + echo " bridge-ports glob swp1-52" >> $xcat_intf + echo " bridge-stp on" >> $xcat_intf + echo " bridge-vids 1 " >> $xcat_intf + echo " bridge-pvid 1" >> $xcat_intf + echo " " >> $xcat_intf + + #create each interface + + for i in `seq 1 52`; + do + echo "auto swp$i">> $xcat_intf + echo "iface swp$i" >> $xcat_intf + echo " mstpctl-portadminedge yes" >> $xcat_intf + echo " " >> $xcat_intf + done +fi + # license needs to set before start switchd if [ ! -e /etc/cumulus/.license* ]; then - echo "ERROR: cumulus license file is not exist"; + echo "ERROR: cumulus license file does not exist"; exit 1; fi -systemctl enable switchd -systemctl restart switchd -ifreload -a +if [ $UPDATED -eq 1 ]; then + systemctl enable switchd + systemctl start switchd + ifreload -a +fi diff --git a/xCAT/postscripts/cumulusztp b/xCAT/postscripts/cumulusztp index 563016689..bc4b40d9a 100755 --- a/xCAT/postscripts/cumulusztp +++ b/xCAT/postscripts/cumulusztp @@ -104,21 +104,11 @@ done mkdir -p /root/.ssh mv _ssh/authorized_keys /root/.ssh/authorized_keys -#enable and config snmpd -./enablesnmp -rc=$? -if [ "$rc" != "0" ];then - logger -s -t "xcat.cumulusztp" -p local4.err "enablesnmp: failed to enable SNMP" - echo "enablesnmp: failed to enable SNMP" -else - logger -s -t "xcat.cumulusztp" -p local4.info "SNMP enabled!" -fi - #install license, if needed -cl-license > /dev/null 2>&1 +/usr/cumulus/bin/cl-license > /dev/null 2>&1 rc=$? if [ "$rc" != "0" ];then - if cl-license -i http://$server_ip/install/custom/sw_os/cumulus/licensefile.txt; then + if /usr/cumulus/bin/cl-license -i http://$server_ip/install/custom/sw_os/cumulus/licensefile.txt; then logger -s -t "xcat.cumulusztp" -p local4.info "installed Cumulus license" systemctl enable switchd systemctl start switchd @@ -128,15 +118,6 @@ if [ "$rc" != "0" ];then fi fi -#config base interface -./configinterface -rc=$? -if [ "$rc" != "0" ];then - echo "configinterface: failed to config switch data ports" -else - logger -s -t "xcat.cumulusztp" -p local4.info "data ports enabled!" -fi - #obtain myposctscript from MN ./getmypostscript.cumulus $server_ip:3001 rc=$? @@ -147,14 +128,18 @@ if [ "$rc" != "0" ]; then exit 1 fi +#enable snmp +echo './enablesnmp' >> ./mypostscript +#config base interface +echo './configinterface' >> ./mypostscript #config static ip address for mgt interface echo './confignics -s' >> ./mypostscript chmod 700 ./mypostscript ./mypostscript rc=$? if [ "$rc" != "0" ]; then - logger -s -t "xcat.cumulusztp" -p local4.info "failed to set static ip address for mgt interface" - echo "failed to set static ip address for mgt interface" + logger -s -t "xcat.cumulusztp" -p local4.info "failed to complete setup" + echo "failed to complete setup" ztp -R exit 1 fi