mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 09:36:41 +00:00
Merge pull request #2457 from cxhong/edgecoresw
Configure snmp and interface for onie switch
This commit is contained in:
commit
d2ab444dfb
48
xCAT/postscripts/configinterface
Executable file
48
xCAT/postscripts/configinterface
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
#the postscript to configure interface in ONIE compatible switches
|
||||
|
||||
if ! cat /etc/os-release |grep -i '^NAME=[ "]*Cumulus Linux[ "]*$' >/dev/null 2>&1 ; then
|
||||
echo "This script is only supported on Cumulus OS in ONIE switch"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
xcat_intf="/etc/network/interfaces.d/xCAT.intf"
|
||||
|
||||
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
|
||||
|
||||
# license needs to set before start switchd
|
||||
if [ ! -e /etc/cumulus/.license* ]; then
|
||||
echo "ERROR: cumulus license file is not exist";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
systemctl enable switchd
|
||||
systemctl restart switchd
|
||||
ifreload -a
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
#the postscript to enable snmpd in ONIE compatible switches
|
||||
|
||||
if ! cat /etc/os-release |grep -i '^NAME=[ "]*Cumulus Linux[ "]*$' >/dev/null 2>&1 ; then
|
||||
@ -20,6 +21,15 @@ sed -i "/rocommunity\s*public\s*default/s/^#//" $snmp_conf
|
||||
sed -i "/rocommunity\s*public\s*default\s*-V\s*systemonly/s/^#//" $snmp_conf
|
||||
sed -i "/#\s*createUser\s*authPrivUser\s*SHA/{n;s/^.*$/createUser $snmp_user SHA $snmp_passwd/}" $snmp_conf
|
||||
sed -i "/#rwuser\s*authPrivUser\s*priv/{n;s/^.*$/rwuser $snmp_user/}" $snmp_conf
|
||||
sed -i "/view\s*systemonly\s*included\s*.1.3.6.1.2.1.17/s/^#//" $snmp_conf
|
||||
sed -i "/pass_persist\s*.1.3.6.1.2.1.17\s*\/usr\/share\/snmp\/bridge_pp.py/s/^#//" $snmp_conf
|
||||
|
||||
#create snmpd restart conf file
|
||||
mkdir -p /etc/systemd/system/snmpd.service.d
|
||||
restart_conf="/etc/systemd/system/snmpd.service.d/restart.conf"
|
||||
echo "[Service]" > $restart_conf
|
||||
echo "Restart=always" >> $restart_conf
|
||||
echo "RestartSec=60" >> $restart_conf
|
||||
|
||||
systemctl enable snmpd
|
||||
systemctl restart snmpd
|
||||
|
Loading…
x
Reference in New Issue
Block a user