mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 09:36:41 +00:00
228 lines
8.9 KiB
Plaintext
228 lines
8.9 KiB
Plaintext
start:makedhcp_n
|
|
description:Create a new dhcp configuration file with a network statement for each network the dhcp daemon should listen on
|
|
os:Linux
|
|
label:mn_only,dhcp
|
|
cmd:if [ -f "/etc/dhcp/dhcpd.conf" ];then mv -f /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak ; elif [ -f "/etc/dhcpd.conf" ]; then mv -f /etc/dhcpd.conf /etc/dhcpd.conf.bak; fi
|
|
cmd:makedhcp -n
|
|
check:rc==0
|
|
cmd:ls /etc/dhcp/dhcpd.conf || ls /etc/dhcpd.conf
|
|
check:rc==0
|
|
cmd:sleep 20
|
|
cmd:ps -e | grep dhcpd
|
|
check:rc==0
|
|
check:output=~dhcpd
|
|
cmd:if cat /etc/*release |grep Ubuntu >/dev/null;then service isc-dhcp-server status;else service dhcpd status;fi
|
|
check:output=~running
|
|
cmd:if [ -f "/etc/dhcp/dhcpd.conf" ]; then mv -f /etc/dhcp/dhcpd.conf.bak /etc/dhcp/dhcpd.conf; elif [ -f "/etc/dhcpd.conf" ]; then mv -f /etc/dhcpd.conf.bak /etc/dhcpd.conf; fi
|
|
end
|
|
|
|
start:makedhcp_h
|
|
description:help
|
|
label:mn_only,dhcp
|
|
cmd:makedhcp -h
|
|
check:rc==0
|
|
check:output=~Usage
|
|
end
|
|
|
|
start:makedhcp_help
|
|
description:help
|
|
label:mn_only,dhcp
|
|
cmd:makedhcp -h
|
|
check:rc==0
|
|
check:output=~Usage
|
|
end
|
|
|
|
start:makedhcp_n_linux
|
|
description:Create a new dhcp configuration file with a network statement for each network the dhcp daemon should listen on
|
|
os:Linux
|
|
cmd:if [ -f "/etc/dhcp/dhcpd.conf" ];then mv -f /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak ; elif [ -f "/etc/dhcpd.conf" ]; then mv -f /etc/dhcpd.conf /etc/dhcpd.conf.bak; fi
|
|
cmd:makedhcp -n
|
|
check:rc==0
|
|
cmd:ls /etc/dhcp/dhcpd.conf || ls /etc/dhcpd.conf
|
|
check:rc==0
|
|
cmd:ps -e | grep dhcpd
|
|
check:rc==0
|
|
check:output=~dhcpd
|
|
cmd:if [ -f "/etc/dhcp/dhcpd.conf" ];then mv -f /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak ; elif [ -f "/etc/dhcpd.conf" ]; then mv -f /etc/dhcpd.conf /etc/dhcpd.conf.bak; fi
|
|
end
|
|
|
|
start:makedhcp_a_linux
|
|
description:Define all nodes to the DHCP server. (Will only add nodes that can be reached, network-wise, by this DHCP server.) The dhcp daemon does not have to be restarted after this.
|
|
os:Linux
|
|
label:mn_only,dhcp
|
|
cmd:mkdef -t node -o testnode1 groups=compute mac=11:22:33:55:66:88 arch=ppc64
|
|
cmd:chdef -t node -o testnode1 netboot=yaboot tftpserver=192.16.10.0 nfsserver=192.16.10.0 monserver=192.16.10.0 xcatmaster=192.16.10.0 installnic="mac" primarynic="mac"
|
|
cmd:lsdef -l testnode1 -z | tee /tmp/CN.stanza
|
|
cmd:chdef -t node -o testnode1 mac=11:22:33:44:55:66
|
|
cmd:if [ -f "/etc/dhcp/dhcpd.conf" ];then mv -f /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak ; elif [ -f "/etc/dhcpd.conf" ]; then mv -f /etc/dhcpd.conf /etc/dhcpd.conf.bak; fi
|
|
cmd:makedhcp -n
|
|
cmd:makedhcp -a
|
|
check:rc==0
|
|
cmd:if [ -f /var/lib/dhcpd/dhcpd.leases ]; then cat /var/lib/dhcpd/dhcpd.leases; elif [ -f /var/lib/dhcp/db/dhcpd.leases ]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [ -f "/var/lib/dhcp/dhcpd.leases" ]; then cat /var/lib/dhcp/dhcpd.leases; fi
|
|
check:output=~testnode1
|
|
check:output=~11:22:33:44:55:66
|
|
cmd:cat /tmp/CN.stanza | chdef -z
|
|
cmd:rmdef testnode1
|
|
cmd:if [ -f "/etc/dhcp/dhcpd.conf" ];then mv -f /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak ; elif [ -f "/etc/dhcpd.conf" ]; then mv -f /etc/dhcpd.conf /etc/dhcpd.conf.bak; fi
|
|
end
|
|
|
|
start:makedhcp_a_linux_check_invalid_mac
|
|
description:Define all nodes to the DHCP server. If mac format is invalid, makedhcp -a print error and return 1
|
|
os:Linux
|
|
label:mn_only,dhcp
|
|
cmd:lsdef -l $$CN -z > /tmp/$$CN.stanza
|
|
cmd:chdef -t node -o $$CN mac=11:22:33
|
|
cmd:makedhcp $$CN
|
|
check:rc!=0
|
|
check:output!~ ^11:22:33$
|
|
cmd:chdef -t node -o $$CN mac=
|
|
cmd:cat /tmp/$$CN.stanza | chdef -z
|
|
end
|
|
|
|
start:makedhcp_a_d_linux
|
|
os:Linux
|
|
label:mn_only,dhcp
|
|
cmd:lsdef -t node -l -z > /tmp/all.nodes
|
|
cmd:mkdef -t node -o testnode1 groups=compute mac=11:22:33:55:66:88 arch=ppc64
|
|
cmd:mkdef -t node -o testnode2 groups=compute mac=11:22:33:55:66:99 arch=ppc64
|
|
cmd:if [ -f "/etc/dhcp/dhcpd.conf" ];then mv -f /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak ; elif [ -f "/etc/dhcpd.conf" ]; then mv -f /etc/dhcpd.conf /etc/dhcpd.conf.bak; fi
|
|
cmd:makedhcp -n
|
|
cmd:makedhcp -a
|
|
check:rc==0
|
|
cmd:if [ -f /var/lib/dhcpd/dhcpd.leases ]; then cat /var/lib/dhcpd/dhcpd.leases > /tmp/1; elif [ -f /var/lib/dhcp/db/dhcpd.leases ]; then cat /var/lib/dhcp/db/dhcpd.leases > /tmp/1;elif [ -f /var/lib/dhcp/dhcpd.leases ]; then cat /var/lib/dhcp/dhcpd.leases > /tmp/1; fi
|
|
cmd:makedhcp -a -d
|
|
check:rc==0
|
|
cmd:if [ -f /var/lib/dhcpd/dhcpd.leases ]; then cat /var/lib/dhcpd/dhcpd.leases > /tmp/2; elif [ -f /var/lib/dhcp/db/dhcpd.leases ]; then cat /var/lib/dhcp/db/dhcpd.leases > /tmp/2;elif [ -f /var/lib/dhcp/dhcpd.leases ]; then cat /var/lib/dhcp/dhcpd.leases > /tmp/2; fi
|
|
cmd:diff /tmp/1 /tmp/2
|
|
check:output=~testnode1
|
|
check:output=~deleted
|
|
check:output=~testnode2
|
|
cmd:cat /tmp/all.nodes | chdef -z
|
|
cmd:rmdef testnode1
|
|
cmd:rmdef testnode2
|
|
cmd:rm -f /tmp/1 /tmp/2
|
|
end
|
|
|
|
start:makedhcp_d_linux
|
|
description:Delete all node entries, added by xCAT, in the noderange from the DHCP server configuration.
|
|
os:Linux
|
|
label:mn_only,dhcp
|
|
cmd:mkdef -t node -o testnode1 groups=compute mac=11:22:33:55:66:88 arch=ppc64
|
|
cmd:chdef -t node -o testnode1 netboot=yaboot tftpserver=192.16.10.0 nfsserver=192.16.10.0 monserver=192.16.10.0 xcatmaster=192.16.10.0 installnic="mac" primarynic="mac"
|
|
cmd:if [ -f "/etc/dhcp/dhcpd.conf" ];then mv -f /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak ; elif [ -f "/etc/dhcpd.conf" ]; then mv -f /etc/dhcpd.conf /etc/dhcpd.conf.bak; fi
|
|
cmd:lsdef -l testnode1 -z > /tmp/CN.stanza
|
|
cmd:chdef -t node -o testnode1 mac=11:22:33:44:55:66
|
|
cmd:makedhcp -n
|
|
cmd:makedhcp testnode1
|
|
cmd:if [ -f /var/lib/dhcpd/dhcpd.leases ]; then cat /var/lib/dhcpd/dhcpd.leases > /tmp/1; elif [ -f /var/lib/dhcp/db/dhcpd.leases ]; then cat /var/lib/dhcp/db/dhcpd.leases > /tmp/1;elif [ -f /var/lib/dhcp/dhcpd.leases ]; then cat /var/lib/dhcp/dhcpd.leases > /tmp/1; fi
|
|
cmd:makedhcp -d testnode1
|
|
check:rc==0
|
|
cmd:if [ -f /var/lib/dhcpd/dhcpd.leases ]; then cat /var/lib/dhcpd/dhcpd.leases > /tmp/2; elif [ -f /var/lib/dhcp/db/dhcpd.leases ]; then cat /var/lib/dhcp/db/dhcpd.leases > /tmp/2;elif [ -f /var/lib/dhcp/dhcpd.leases ]; then cat /var/lib/dhcp/dhcpd.leases > /tmp/2; fi
|
|
cmd:diff /tmp/1 /tmp/2
|
|
check:output=~testnode1
|
|
check:output=~deleted
|
|
cmd:cat /tmp/CN.stanza | chdef -z
|
|
cmd:rmdef testnode1
|
|
cmd:if [ -f "/etc/dhcp/dhcpd.conf" ]; then mv -f /etc/dhcp/dhcpd.conf.bak /etc/dhcp/dhcpd.conf; elif [ -f "/etc/dhcpd.conf" ]; then mv -f /etc/dhcpd.conf.bak /etc/dhcpd.conf; fi
|
|
cmd:rm -f /tmp/1 /tmp/2
|
|
end
|
|
|
|
start:makedhcp_a
|
|
os:Linux
|
|
label:cn_os_ready,dhcp
|
|
cmd:lsdef -l $$CN -z > /tmp/$$CN.stanza
|
|
cmd:chdef -t node -o $$CN mac=11:22:33:44:55:66
|
|
cmd:makedhcp -a
|
|
check:rc==0
|
|
cmd:makedhcp -q $$CN
|
|
check:rc==0
|
|
check:output=~$$CN
|
|
check:output=~11:22:33:44:55:66
|
|
cmd:chdef -t node -o $$CN mac=
|
|
cmd:cat /tmp/$$CN.stanza | chdef -z
|
|
end
|
|
|
|
start:makedhcp_a_ubuntu
|
|
os:ubuntu
|
|
label:cn_os_ready,dhcp
|
|
cmd:lsdef -l $$CN -z > /tmp/$$CN.stanza
|
|
cmd:chdef -t node -o $$CN mac=11:22:33:44:55:66
|
|
cmd:makedhcp -a
|
|
check:rc==0
|
|
cmd:if [ -f /var/lib/dhcp/dhcpd.leases ]; then cat /var/lib/dhcp/dhcpd.leases; fi
|
|
check:output=~$$CN
|
|
check:output=~11:22:33:44:55:66
|
|
cmd:chdef -t node -o $$CN mac=
|
|
cmd:cat /tmp/$$CN.stanza | chdef -z
|
|
end
|
|
|
|
start:makedhcp_a_d
|
|
os:Linux
|
|
label:cn_os_ready,dhcp
|
|
cmd:makedhcp -a -d
|
|
check:rc==0
|
|
cmd:service dhcpd restart
|
|
cmd:makedhcp -q $$CN
|
|
check:rc==0
|
|
check:output!~$$CN
|
|
cmd:makedhcp -a
|
|
end
|
|
|
|
start:makedhcp_a_d_ubuntu
|
|
os:ubuntu
|
|
label:cn_os_ready,dhcp
|
|
cmd:makedhcp -a -d
|
|
check:rc==0
|
|
cmd:service isc-dhcp-server restart
|
|
cmd:if [ -f /var/lib/dhcp/dhcpd.leases ]; then cat /var/lib/dhcp/dhcpd.leases | grep $$CN; fi
|
|
check:output!~$$CN
|
|
cmd:makedhcp -a
|
|
end
|
|
|
|
start:makedhcp_d
|
|
os:Linux
|
|
label:cn_os_ready,dhcp
|
|
cmd:makedhcp -d $$CN
|
|
check:rc==0
|
|
cmd:service dhcpd restart
|
|
cmd:makedhcp -q $$CN
|
|
check:output!~$$CN
|
|
cmd:makedhcp -a
|
|
end
|
|
|
|
start:makedhcp_remote_network
|
|
descriptiion:This case is to test when there is mgtifname='!remote!<nicname>', makedhcp could work correctly and create entrys in dhcp lease file.
|
|
os:linux
|
|
label:mn_only,dhcp
|
|
cmd:mkdef -t network -o testnetwork net=100.100.100.0 mask=255.255.255.0 mgtifname='!remote!eth0' gateway=100.100.100.1
|
|
check:rc==0
|
|
cmd:lsdef -t network
|
|
check:rc==0
|
|
check:output=~testnetwork
|
|
cmd:mkdef -t node -o testnode ip=100.100.100.2 groups=all mac=42:3d:0a:05:27:0b
|
|
check:rc==0
|
|
cmd:cat /etc/hosts
|
|
cmd:echo -e "\n100.100.100.2 testnode" >> /etc/hosts
|
|
check:rc==0
|
|
cmd:cat /etc/hosts
|
|
cmd:makedhcp -n
|
|
check:rc==0
|
|
cmd:makedhcp -d testnode
|
|
cmd:if [ -f /var/lib/dhcpd/dhcpd.leases ]; then a="/var/lib/dhcpd/dhcpd.leases"; elif [ -f /var/lib/dhcp/db/dhcpd.leases ]; then a="/var/lib/dhcp/db/dhcpd.leases"; elif [ -f "/var/lib/dhcp/dhcpd.leases" ]; then a="/var/lib/dhcp/dhcpd.leases";fi; ls -l $a; cat $a
|
|
cmd:makedhcp testnode
|
|
check:rc==0
|
|
cmd:if [ -f /var/lib/dhcpd/dhcpd.leases ]; then a="/var/lib/dhcpd/dhcpd.leases"; elif [ -f /var/lib/dhcp/db/dhcpd.leases ]; then a="/var/lib/dhcp/db/dhcpd.leases"; elif [ -f "/var/lib/dhcp/dhcpd.leases" ]; then a="/var/lib/dhcp/dhcpd.leases";fi; ls -l $a; cat $a
|
|
cmd:makedhcp -q testnode
|
|
check:rc==0
|
|
check:output=~testnode: ip-address = 100.100.100.2
|
|
cmd:makedhcp -d testnode
|
|
check:rc==0
|
|
cmd:makedhcp -n
|
|
check:rc==0
|
|
cmd:noderm testnode
|
|
check:rc==0
|
|
cmd:chtab -d netname=testnetwork networks
|
|
check:rc==0
|
|
cmd:cp -f /etc/hosts.bak /etc/hosts
|
|
end
|