mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 19:32:31 +00:00 
			
		
		
		
	fix bug 3215 and 3216. Add confignetworks cases for vlan and bond
This commit is contained in:
		| @@ -186,6 +186,7 @@ check:rc==0 | ||||
| cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1496 | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 | ||||
| @@ -194,8 +195,8 @@ cmd:updatenode $$CN -P confignetwork | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~11.1.0.100 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep MTU /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep MTU /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep mtu /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~MTU=1496 |mtu 1496 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep MTU /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep MTU /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep MTU /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~MTU=1496 | ||||
| cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" | ||||
| cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| @@ -276,9 +277,9 @@ check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~11.1.0.100 | ||||
| check:output!~dhcp | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~12.1.0.100 | ||||
| check:output=~CONNECTED_MODE=yes | CONNECTED_MODE yes | ||||
| check:output=~CONNECTED_MODE=yes | ||||
| check:output!~dhcp | ||||
| cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 | ||||
| cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 | ||||
| @@ -394,7 +395,7 @@ cmd:chmod a+x /tmp/script1 | ||||
| check:rc==0 | ||||
| cmd:cp /tmp/script1 /install/postscripts | ||||
| check:rc==0 | ||||
| cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1496 | ||||
| cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mut=1496 | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 niccustomscripts.$$SECONDNIC=script1 | ||||
| check:rc==0 | ||||
| @@ -444,11 +445,11 @@ cmd:updatenode $$CN -P confignetwork | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~11.1.0.100 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~12.1.0.100 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 13.1.0.100 /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 13.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 13.1.0.100 /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~13.1.0.100 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 14.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 14.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/network/interfaces.d/$$THIRDNIC:1";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~14.1.0.100 | ||||
| cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 | ||||
| cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 | ||||
| @@ -470,3 +471,251 @@ check:rc==0 | ||||
| cmd:xdsh $$CN "rm -rf /tmp/backupnet/" | ||||
| check:rc==0 | ||||
| end | ||||
|  | ||||
| start:confignetwork_vlan_eth0 | ||||
| description: this case is to verify if confignetwork could config vlan for CN.When CN has Ethernet nic eth0, user wants to confgure 2 vlans, Configure vlan eth0.6 60.5.106.9 and eth0.7 70.5.106.9 based on ethernet nic eth0  | ||||
| cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi | ||||
| check:rc==0 | ||||
| cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi | ||||
| cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 | ||||
| check:rc==0 | ||||
| cmd:updatenode $$CN -P confignetwork | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~11.1.0.100 | ||||
| cmd:mkdef -t network -o 60_0_0_0-255_0_0_0 net=60.0.0.0 mask=255.0.0.0 mgtifname=$$SECONDNIC  | ||||
| check:rc==0 | ||||
| cmd:mkdef -t network -o 70_0_0_0-255_0_0_0 net=70.0.0.0 mask=255.0.0.0 mgtifname=$$SECONDNIC | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC.6="60_0 _0_0-255_0_0_0" nicnetworks.$$SECONDNIC.7="70_0 _0_0-255_0_0_0" nictypes.$$SECONDNIC.6=vlan nictypes.$$SECONDNIC.7=vlan nicips.$$SECONDNIC.6=60.5.106.9 nicips.$$SECONDNIC.7=70.5.106.9 nicdevices.$$SECONDNIC.6=$$SECONDNIC nicdevices.$$SECONDNIC.7=$$SECONDNIC | ||||
| check:rc==0 | ||||
| cmd:updatenode $$CN -P confignetwork | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 60.5.106.9 /etc/sysconfig/network/ifcfg-$$SECONDNIC.6"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 60.5.106.9 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC.6"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 60.5.106.9 /etc/network/interfaces.d/$$SECONDNIC.6";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~60.5.106.9 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 70.5.106.9 /etc/sysconfig/network/ifcfg-$$SECONDNIC.7"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 70.5.106.9 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC.7"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 70.5.106.9 /etc/network/interfaces.d/$$SECONDNIC.7";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~70.5.106.9 | ||||
| cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 | ||||
| cmd:xdsh $$CN "ip addr del 11.1.0.100/8 dev $$SECONDNIC" | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:rmdef -t network -o 60_0_0_0-255_0_0_0 | ||||
| cmd:rmdef -t network -o 70_0_0_0-255_0_0_0 | ||||
| cmd:xdsh $$CN "ip addr del 60.5.106.9/8 dev $$SECONDNIC.6" | ||||
| cmd:xdsh $$CN "ip addr del 70.5.106.9/8 dev $$SECONDNIC.7"  | ||||
| cmd:xdsh $$CN "ip link del dev $$SECONDNIC.6" | ||||
| cmd:xdsh $$CN "ip link del dev $$SECONDNIC.7" | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC.6 /etc/sysconfig/network/ifcfg-$$SECONDNIC.7"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC.6 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC.7"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC.6 /etc/network/interfaces.d/$$SECONDNIC.7";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" | ||||
| check:rc==0 | ||||
| end | ||||
|  | ||||
| start:confignetwork_vlan_false | ||||
| description:this case is to verify if confignetwork could process the false value when vlan nicdevice is not correctly set | ||||
| cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi | ||||
| check:rc==0 | ||||
| cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi | ||||
| cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1500 | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 | ||||
| check:rc==0 | ||||
| cmd:updatenode $$CN -P confignetwork | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~11.1.0.100 | ||||
| cmd:mkdef -t network -o 60_0_0_0-255_0_0_0 net=60.0.0.0 mask=255.0.0.0 mgtifname=$$SECONDNIC mtu=1500 | ||||
| check:rc==0 | ||||
| cmd:mkdef -t network -o 70_0_0_0-255_0_0_0 net=70.0.0.0 mask=255.0.0.0 mgtifname=$$SECONDNIC mtu=1500 | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC.6="60_0 _0_0-255_0_0_0" nicnetworks.$$SECONDNIC.7="70_0 _0_0-255_0_0_0" nictypes.$$SECONDNIC.6=vlan nictypes.$$SECONDNIC.7=vlan nicips.$$SECONDNIC.6=60.5.106.9 nicips.$$SECONDNIC.7=70.5.106.9  | ||||
| check:rc==0 | ||||
| cmd:updatenode $$CN -P confignetwork | ||||
| check:rc!=0 | ||||
| cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC.6="60_0 _0_0-255_0_0_0" nicnetworks.$$SECONDNIC.7="70_0 _0_0-255_0_0_0" nictypes.$$SECONDNIC.6=vlan nictypes.$$SECONDNIC.7=vlan nicips.$$SECONDNIC.6=60.5.106.9 nicips.$$SECONDNIC.7=70.5.106.9 nicdevices.$$SECONDNIC.6=$$SECONDNIC.6 nicdevices.$$SECONDNIC.7=$$SECONDNIC.7 | ||||
| cmd:updatenode $$CN -P confignetwork | ||||
| check:rc!=0 | ||||
| cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 | ||||
| cmd:rmdef -t network -o 60_0_0_0-255_0_0_0 | ||||
| cmd:rmdef -t network -o 70_0_0_0-255_0_0_0 | ||||
| cmd:xdsh $$CN "ip addr del 11.1.0.100/8 dev $$SECONDNIC" | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" | ||||
| check:rc==0 | ||||
| end | ||||
|  | ||||
| start:confignetwork_bond_eth2_eth3 | ||||
| description: this case is to verify if confignetwork could config bond for CN.CN has 2 Ethernet nics, eth2 and eth3, user configures bond bond0 using ethernet nic eth2 and eth3. | ||||
| cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi | ||||
| check:rc==0 | ||||
| cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi | ||||
| cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 | ||||
| check:rc==0 | ||||
| cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 | ||||
| check:rc==0 | ||||
| cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0  | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicnetworks.bond0=30_5_0_0-255_255_0_0 nictypes.$$SECONDNIC=ethernet nictypes.$$THIRDNIC=ethernet nictypes.bond0=bond nicips.bond0=30.5.106.9 nicdevices.bond0="$$SECONDNIC|$$THIRDNIC" | ||||
| check:rc==0 | ||||
| cmd:updatenode $$CN -P confignetwork | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 30.5.106.9 /etc/sysconfig/network/ifcfg-bond0"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 30.5.106.9 /etc/sysconfig/network-scripts/ifcfg-bond0"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 30.5.106.9 /etc/network/interfaces.d/bond0";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~30.5.106.9 | ||||
| check:rc==0 | ||||
| cmd:xdsh $$CN "ls /sys/class/net" | ||||
| check:output=~bond0 | ||||
| cmd:xdsh $$CN "cat /sys/class/net/bonding_masters" | ||||
| check:output=~bond0 | ||||
| cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 | ||||
| cmd:xdsh $$CN "ip addr del 11.1.0.100/8 dev $$SECONDNIC" | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 | ||||
| cmd:xdsh $$CN "ip addr del 12.1.0.100/8 dev $$THIRDNIC" | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:rmdef -t network -o 30_5_0_0-255_255_0_0   | ||||
| cmd:xdsh $$CN "ip addr del 30.5.106.9/16 dev bond0" | ||||
| cmd:xdsh $$CN "ip link del dev bond0" | ||||
| cmd:xdsh $$CN "echo -bond0 > /sys/class/net/bonding_masters" | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-bond0"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" | ||||
| check:rc==0 | ||||
| end | ||||
|  | ||||
| start:confignetwork_bond_false | ||||
| description: this case is to verify if confignetwork could process when bond is not correctly set. | ||||
| cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi | ||||
| check:rc==0 | ||||
| cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi | ||||
| cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 | ||||
| check:rc==0 | ||||
| cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 | ||||
| check:rc==0 | ||||
| cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0 | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicnetworks.bond0=30_5_0_0-255_255_0_0 nictypes.$$SECONDNIC=ethernet nictypes.$$THIRDNIC=ethernet nictypes.bond0=bond nicips.bond0=30.5.106.9 nicdevices.bond0= | ||||
| check:rc==0 | ||||
| cmd:updatenode $$CN -P confignetwork | ||||
| check:rc!=0 | ||||
| cmd:chdef $$CN nicnetworks.bond0=30_5_0_0-255_255_0_0 nictypes.$$SECONDNIC=ethernet nictypes.$$THIRDNIC=ethernet nictypes.bond0=bond nicips.bond0=30.5.106.9 nicdevices.$$SECONDNIC=bond0 | ||||
| check:rc==0 | ||||
| cmd:updatenode $$CN -P confignetwork | ||||
| check:rc!=0 | ||||
| cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 | ||||
| cmd:xdsh $$CN "ip addr del 11.1.0.100/8 dev $$SECONDNIC" | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 | ||||
| cmd:xdsh $$CN "ip addr del 12.1.0.100/8 dev $$THIRDNIC" | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:rmdef -t network -o 30_5_0_0-255_255_0_0 | ||||
| cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" | ||||
| check:rc==0 | ||||
| end | ||||
|  | ||||
| start:confignetwork_vlan_bond | ||||
| description: this case is to verify if confignetwork could config bond for CN.CN has 2 Ethernet nic eth2 and eth3, user wants to bond them to bond0, then make 2 vlan bond0.2 and bond0.3 for data network.  | ||||
| cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi | ||||
| check:rc==0 | ||||
| cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi | ||||
| cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1500 | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 | ||||
| check:rc==0 | ||||
| cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC mtu=1500 | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0 | ||||
| check:rc==0 | ||||
| cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0 mtu=1500 | ||||
| check:rc==0 | ||||
| cmd:mkdef -t network -o 40_5_0_0-255_255_0_0 net=40.5.0.0 mask=255.255.0.0 mtu=1500 | ||||
| check:rc==0 | ||||
| cmd:chdef $$CN nicdevices.bond0.2=bond0 nicdevices.bond0.3=bond0 nicips.bond0.2=30.5.106.8 nicips.bond0.3=40.5.106.8 nicnetworks.bond0.2=30_5_0_0-255_255_0_0 nicnetworks.bond0.3=40_5_0_0-255_255_0_0 nictypes.bond0.2=vlan nictypes.bond0.3=vlan nictypes.bond0=bond nictypes.$$SECONDNIC=ethernet nictypes.$$THIRDNIC=ethernet nicdevices.bond0="$$SECONDNIC|$$THIRDNIC" | ||||
| check:rc==0 | ||||
| cmd:updatenode $$CN -P confignetwork | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 30.5.106.8 /etc/sysconfig/network/ifcfg-bond0.2"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 30.5.106.8 /etc/sysconfig/network-scripts/ifcfg-bond0.2"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 30.5.106.8 /etc/network/interfaces.d/bond0.2";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~30.5.106.8 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 40.5.106.8 /etc/sysconfig/network/ifcfg-bond0.3"; elif grep "Red Hat" /etc/*release;then xdsh $$CN  "grep 40.5.106.8 /etc/sysconfig/network-scripts/ifcfg-bond0.3"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 40.5.106.8 /etc/network/interfaces.d/bond0.3";else echo "Sorry,this is not supported os"; fi | ||||
| check:output=~40.5.106.8 | ||||
| cmd:xdsh $$CN "ls /sys/class/net" | ||||
| check:output=~bond0 | ||||
| check:output=~bond0.2 | ||||
| check:output=~bond0.3 | ||||
| cmd:xdsh $$CN "cat /sys/class/net/bonding_masters" | ||||
| check:output=~bond0 | ||||
| cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 | ||||
| cmd:xdsh $$CN "ip addr del 11.1.0.100/8 dev $$SECONDNIC" | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 | ||||
| cmd:xdsh $$CN "ip addr del 12.1.0.100/8 dev $$THIRDNIC" | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:rmdef -t network -o 30_5_0_0-255_255_0_0 | ||||
| cmd:rmdef -t network -o 40_5_0_0-255_255_0_0 | ||||
| cmd:xdsh $$CN "ip addr del 30.5.106.9/16 dev bond0.2" | ||||
| cmd:xdsh $$CN "ip addr del 40.5.106.9/16 dev bond0.3" | ||||
| cmd:xdsh $$CN "ip link del dev bond0" | ||||
| cmd:xdsh $$CN "ip link del dev bond0.2" | ||||
| cmd:xdsh $$CN "ip link del dev bond0.3" | ||||
| cmd:xdsh $$CN "echo -bond0 > /sys/class/net/bonding_masters" | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi | ||||
| check:rc==0 | ||||
| cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi | ||||
| check:rc==0 | ||||
| cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" | ||||
| check:rc==0 | ||||
| end | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user