start:makedns_h
description:help
label:mn_only,dns
cmd:makedns -h
check:rc==0
cmd:makedns --help
check:rc==0
check:output=~Usage
end

start:makedns_d_node
description:makedns -d noderange
label:mn_only,dns,wait_fix
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:chdef -t node -o dnstestnode groups=all  ip=100.100.100.1
check:rc==0
cmd:hostname
cmd:cat /etc/hosts
cmd:ip a
cmd:lsdef -l
cmd:tabdump networks
cmd:makedns -n
check:rc==0
cmd:makedns dnstestnode
check:rc==0
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output!~(server can't find dnstestnode)
cmd:makedns -d dnstestnode
check:rc==0
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output~=(server can't find dnstestnode)
cmd:rmdef -t node dnstestnode
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
end

start:makedns_node
description:makedns noderange
label:mn_only,dns,wait_fix
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:chdef -t node -o dnstestnode groups=all  ip=100.100.100.1
check:rc==0
cmd:lsdef -l  dnstestnode
cmd:cat /etc/hosts
cmd:makedns -n
check:rc==0
cmd:cat /etc/hosts
cmd:ps aux|grep name
cmd:makedns dnstestnode
check:rc==0
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output!~(server can't find dnstestnode)
cmd:makedns -d dnstestnode
check:rc==0
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output~=(server can't find dnstestnode)
cmd:rmdef -t node dnstestnode
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
end

start:makedns_ubuntu_n
description:makedns -n
os:ubuntu
label:mn_only,dns,wait_fix
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:cp /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:echo "100.100.100.1  dnstestnode" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:cat /etc/bind/named.conf
check:rc==0
check:output~=zone "100.100.100.IN-ADDR.ARPA."
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output!~(server can't find dnstestnode)
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.testbak   /etc/hosts
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:cat /etc/bind/named.conf
check:rc==0
check:output!~zone "100.100.100.IN-ADDR.ARPA."
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output~=(server can't find dnstestnode)
end

start:makedns_n
description:makedns -n
os:rhels,sles
label:mn_only,dns
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:cp /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:echo "100.100.100.1  dnstestnode" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:cat /etc/named.conf
check:rc==0
check:output~=zone "100.100.100.IN-ADDR.ARPA."
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output!~(server can't find dnstestnode)
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.testbak   /etc/hosts
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:cat /etc/named.conf
check:rc==0
check:output!~zone "100.100.100.IN-ADDR.ARPA."
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output~=(server can't find dnstestnode)
end

start:makedns
description:makedns
label:mn_only,dns,wait_fix
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:makedns -n
check:rc==0
cmd:if [ -f "/etc/named.conf" ]; then a="/etc/named.conf"; elif [ -f "/etc/bind/named.conf" ]; then a="/etc/bind/named.conf";fi; cat $a
check:rc==0
check:output~=zone "100.100.100.IN-ADDR.ARPA."
cmd:rm -f /tmp/makedns_named_conf.org /tmp/makedns_named_conf.new
check:rc==0
cmd:if [ -f "/etc/named.conf" ]; then a="/etc/named.conf"; elif [ -f "/etc/bind/named.conf" ]; then a="/etc/bind/named.conf";fi; cat $a >/tmp/makedns_named_conf.org
check:rc==0
cmd:cp /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:echo "100.100.100.1  dnstestnode" >> /etc/hosts
check:rc==0
cmd:makedns
check:rc==0
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output!~(server can't find dnstestnode)
cmd:if [ -f "/etc/named.conf" ]; then a="/etc/named.conf"; elif [ -f "/etc/bind/named.conf" ]; then a="/etc/bind/named.conf";fi; cat $a > /tmp/makedns_named_conf.new
check:rc==0
cmd:diff /tmp/makedns_named_conf.org   /tmp/makedns_named_conf.new
check:rc==0
check:output~=
cmd:rm -f /tmp/makedns_named_conf.org /tmp/makedns_named_conf.new
check:rc==0
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.testbak   /etc/hosts
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:if [ -f "/etc/named.conf" ]; then a="/etc/named.conf"; elif [ -f "/etc/bind/named.conf" ]; then a="/etc/bind/named.conf";fi; cat $a
check:rc==0
check:output!~zone "100.100.100.IN-ADDR.ARPA."
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output~=(server can't find dnstestnode)
end

#------------------------------------
start:makedns_environment_check_forworder_mode
description:check basic environment of makedns in hierarchical arch and sn acts forworder
os:rhels
label:cn_os_ready,dns
cmd:chtab key=nameservers site.value="<xcatmaster>"
check:rc==0
cmd:chdef service setupnameserver=1 setupdhcp=1
check:rc==0
cmd:tabdump servicenode
check:rc==0
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:cp /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:echo "100.100.100.1  dnstestnode" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:output~=running
cmd:more /etc/resolv.conf |grep nameserver
cmd:xdsh $$SN "more /etc/resolv.conf |grep nameserver"
cmd:xdsh $$CN "more /etc/resolv.conf |grep nameserver"
cmd:more /etc/dhcp/dhcpd.conf |grep domain-name-servers
cmd:xdsh $$SN "more /etc/dhcp/dhcpd.conf|grep domain-name-servers"
cmd:tabdump site|grep nameservers
cmd:tabdump networks
cmd:lsdef $$SN -i setupnameserver |grep setupnameserver
check:rc==0
check:output~=1
cmd:lsdef $$SN -i setupdhcp |grep setupdhcp
check:rc==0
check:output~=1
cmd:service named status
check:rc==0
check:output~=running
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output!~(server can't find dnstestnode)
cmd:xdsh $$SN "service named status"
check:rc==0
check:output~=running
cmd:xdsh $$SN "more /etc/named.conf"
check:rc==0
check:output~=forward only
cmd:nslookup $$SN $$MN
check:output~=Server:             $$MN
check:output!~(server can't find $$SN)
cmd:nslookup dnstestnode $$SN
check:output~=Server:             $$SN
check:output!~(server can't find dnstestnode)
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.testbak   /etc/hosts
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:output~=running
end

start:makedns_environment_check_forworder_mode
description:check basic environment of makedns in hierarchical arch and sn acts forworder
os:sles
label:cn_os_ready,dns
cmd:chtab key=nameservers site.value="<xcatmaster>"
check:rc==0
cmd:chdef service setupnameserver=1 setupdhcp=1
check:rc==0
cmd:tabdump servicenode
check:rc==0
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:cp /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:echo "100.100.100.1  dnstestnode" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
cnd:output~=running
cmd:more /etc/resolv.conf |grep nameserver
cmd:xdsh $$SN "more /etc/resolv.conf |grep nameserver"
cmd:xdsh $$CN "more /etc/resolv.conf |grep nameserver"
cmd:more /etc/dhcpd.conf|grep domain-name-servers
cmd:xdsh $$SN "more /etc/dhcpd.conf|grep domain-name-servers"
cmd:tabdump site|grep nameservers
cmd:tabdump networks
cmd:lsdef $$SN -i setupnameserver|grep setupnameserver
check:rc==0
check:output~=1
cmd:lsdef $$SN -i setupdhcp|grep setupdhcp
check:rc==0
check:output~=1
cmd:service named status
check:rc==0
check:output~=running
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output!~(server can't find dnstestnode)
cmd:xdsh $$SN "service named status"
check:rc==0
check:output~=running
cmd:xdsh $$SN "more /etc/named.conf"
check:rc==0
check:output~=forward only
cmd:nslookup $$SN $$MN
check:output~=Server:             $$MN
check:output!~(server can't find $$SN)
cmd:nslookup dnstestnode $$SN
check:output~=Server:             $$SN
check:output!~(server can't find dnstestnode)
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.testbak   /etc/hosts
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:output~=running
end


start:makedns_environment_check_master_slave_mode
description:check basic environment of makedns in hierarchical arch and sn acts slave
os:rhels
label:cn_os_ready,dns
cmd:chtab key=nameservers site.value="<xcatmaster>,$$MNIP"
check:rc==0
cmd:chdef  service setupnameserver=2 setupdhcp=1
check:rc==0
cmd:tabdump servicenode
check:rc==0
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:cp /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:echo "100.100.100.1  dnstestnode" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:output~=running
cmd:more /etc/resolv.conf|grep nameserver
check:rc==0
cmd:xdsh $$SN "more /etc/resolv.conf|grep nameserver"
check:rc==0
cmd:xdsh $$CN "more /etc/resolv.conf|grep nameserver"
cmd:more /etc/dhcp/dhcpd.conf |grep domain-name-servers
check:rc==0
cmd:xdsh $$SN "more /etc/dhcp/dhcpd.conf|grep domain-name-servers"
check:rc==0
cmd:tabdump site|grep nameservers
check:rc==0
cmd:tabdump networks
check:rc==0
cmd:lsdef $$SN -i setupnameserver|grep setupnameserver
check:rc==0
check:output~=2
cmd:lsdef $$SN -i setupdhcp|grep setupdhcp
check:rc==0
check:output~=1
cmd:service named status
check:output~=running
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output!~(server can't find dnstestnode)
cmd:xdsh $$SN "service named status"
check:output~=running
cmd:xdsh $$SN "more /etc/named.conf"
check:rc==0
check:output~=type slave
cmd:nslookup $$SN $$MN
check:output~=Server:             $$MN
check:output!~(server can't find $$SN)
cmd:nslookup dnstestnode $$SN
check:output~=Server:             $$SN
check:output!~(server can't find dnstestnode)
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.testbak   /etc/hosts
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:output~=running
end

start:makedns_environment_check_master_slave_mode
description:check basic environment of makedns in hierarchical arch and sn acts slave
os:sles
label:cn_os_ready,dns
cmd:chtab key=nameservers site.value="<xcatmaster>,$$MNIP"
check:rc==0
cmd:chdef  service setupnameserver=2 setupdhcp=1
check:rc==0
cmd:tabdump servicenode
check:rc==0
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:cp /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:echo "100.100.100.1  dnstestnode" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:output~=running
cmd:more /etc/resolv.conf|grep nameserver
check:rc==0
cmd:xdsh $$SN "more /etc/resolv.conf|grep nameserver"
check:rc==0
cmd:xdsh $$CN "more /etc/resolv.conf|grep nameserver"
cmd:more /etc/dhcpd.conf|grep domain-name-servers
check:rc==0
cmd:xdsh $$SN "more /etc/dhcpd.conf|grep domain-name-servers"
check:rc==0
cmd:tabdump site|grep nameservers
check:rc==0
cmd:tabdump networks
check:rc==0
cmd:lsdef $$SN -i setupnameserver|grep setupnameserver
check:rc==0
check:output~=2
cmd:lsdef $$SN -i setupdhcp|grep setupdhcp
check:rc==0
check:output~=1
cmd:service named status
check:output~=running
cmd:nslookup dnstestnode $$MN
check:output~=Server:             $$MN
check:output!~(server can't find dnstestnode)
cmd:xdsh $$SN "service named status"
check:output~=running
cmd:xdsh $$SN "more /etc/named.conf"
check:rc==0
check:output~=type slave
cmd:nslookup $$SN $$MN
check:output~=Server:             $$MN
check:output!~(server can't find $$SN)
cmd:nslookup dnstestnode $$SN
check:output~=Server:             $$SN
check:output!~(server can't find dnstestnode)
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.testbak   /etc/hosts
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:output~=running
end

#---------------------------------------------------------------------

start:makedns_when_nameserver_on_mn_down
description:when nameserver on mn down, nameserver on sn should provide service
os:rhels
label:cn_os_ready,dns
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:cp /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:echo "100.100.100.1  dnstestnode" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:service named status
check:rc==0
check:output~=running
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:rc==0
check:output~=running
cmd:nslookup dnstestnode $$MN
check:rc==0
check:output~=Server:         $$MN
check:output!~(server can't find dnstestnode)
cmd:nslookup dnstestnode $$SN
check:rc==0
check:output~=Server:         $$SN
check:output!~(server can't find dnstestnode)
cmd:service named stop
check:rc==0
cmd:service named status
check:output~=stopped
cmd:nslookup dnstestnode $$MN
check:rc!=0
check:output~=Server:         $$MN
check:output~=(server can't find dnstestnode)
cmd:nslookup dnstestnode $$SN
check:rc==0
check:output~=Server:         $$SN
check:output!~(server can't find dnstestnode)
cmd:service named start
check:rc==0
cmd:service named status
check:rc==0
check:output~=running
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.testbak   /etc/hosts
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:output~=running
end

start:makedns_when_nameserver_on_mn_down
description:when nameserver on mn down, nameserver on sn should provide service
os:sles
label:cn_os_ready,dns
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:cp /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:echo "100.100.100.1  dnstestnode" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:service named status
check:rc==0
check:output~=running
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:rc==0
check:output~=running
cmd:nslookup dnstestnode $$MN
check:output~=Server:         $$MN
check:output!~(server can't find dnstestnode)
cmd:nslookup dnstestnode $$SN
check:output~=Server:         $$SN
check:output!~(server can't find dnstestnode)
cmd:service named stop
check:rc==0
cmd:service named status
check:output~=unused
cmd:nslookup dnstestnode $$MN
check:output~=Server:         $$MN
check:output~=(server can't find dnstestnode)
cmd:nslookup dnstestnode $$SN
check:output~=Server:         $$SN
check:output!~(server can't find dnstestnode)
cmd:service named start
check:rc==0
cmd:service named status
check:rc==0
check:output~=running
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.testbak   /etc/hosts
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:output~=running
end


start:makedns_when_nameserver_on_sn_down
description:when nameserver on sn down, nameserver on mn should provide service
os:rhels
label:cn_os_ready,dns
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:cp /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:echo "100.100.100.1  dnstestnode" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:service named status
check:rc==0
check:output~=running
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:rc==0
check:output~=running
cmd:nslookup dnstestnode $$MN
check:rc==0
check:output~=Server:         $$MN
check:output!~(server can't find dnstestnode)
cmd:nslookup dnstestnode $$SN
check:rc==0
check:output~=Server:         $$SN
check:output!~(server can't find dnstestnode)
cmd:xdsh $$SN "service named stop"
check:rc==0
cmd:xdsh $$SN "service named status"
check:rc!=0
check:output~=stopped
cmd:nslookup dnstestnode $$MN
check:rc==0
check:output~=Server:         $$MN
check:output!~(server can't find dnstestnode)
cmd:nslookup dnstestnode $$SN
check:rc!=0
check:output~=Server:         $$SN
check:output~=(server can't find dnstestnode)
cmd:xdsh $$SN "service named start"
check:rc==0
cmd:xdsh $$SN "service named status"
check:rc==0
check:output~=running
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.testbak   /etc/hosts
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:rc==0
check:output~=running
end

start:makedns_when_nameserver_on_sn_down
description:when nameserver on sn down, nameserver on mn should provide service
os:sles
label:cn_os_ready,dns
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:cp /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:echo "100.100.100.1  dnstestnode" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:service named status
check:rc==0
check:output~=running
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:rc==0
check:output~=running
cmd:nslookup dnstestnode $$MN
check:output~=Server:         $$MN
check:output!~(server can't find dnstestnode)
cmd:nslookup dnstestnode $$SN
check:output~=Server:         $$SN
check:output!~(server can't find dnstestnode)
cmd:xdsh $$SN "service named stop"
check:rc==0
cmd:xdsh $$SN "service named status"
check:output~=unused
cmd:nslookup dnstestnode $$MN
check:output~=Server:         $$MN
check:output!~(server can't find dnstestnode)
cmd:nslookup dnstestnode $$SN
check:output~=Server:         $$SN
check:output~=(server can't find dnstestnode)
cmd:xdsh $$SN "service named start"
check:rc==0
cmd:xdsh $$SN "service named status"
check:rc==0
check:output~=running
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.testbak   /etc/hosts
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "service xcatd status"
check:rc==0
check:output~=running
end

#999999999999999999999999999
start:makedns_nameserver_on_sn_sync_db
description:when nameserver's db on mn was changed, nameserver's db on sn should be synchronized
os:Linux
label:cn_os_ready,dns
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:chdef -t node -o dnstestnode groups=all  ip=100.100.100.2
check:rc==0
cmd:makedns dnstestnode
check:rc==0
cmd:nslookup dnstestnode $$MN
check:rc==0
check:output~=Server:         $$MN
check:output!~(server can't find dnstestnode)
cmd:sleep 2
cmd:nslookup dnstestnode $$SN
check:rc==0
check:output~=Server:         $$SN
check:output!~(server can't find dnstestnode)
cmd:makedns -d dnstestnode
check:rc==0
cmd:nslookup dnstestnode $$MN
check:output~=Server:         $$MN
check:output~=(server can't find dnstestnode)
cmd:sleep 2
cmd:nslookup dnstestnode $$SN
check:output~=Server:         $$SN
check:output~=(server can't find dnstestnode)
cmd:rmdef -t node dnstestnode
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
end


start:makedns_nameserver_on_sn_sync_conf
description:when nameserver's conf file on mn was changed, nameserver's conf file on sn should be synchronized when xcatd restart
label:cn_os_ready,dns,
cmd:makedns -n
check:rc==0
cmd:cat /etc/named.conf
check:rc==0
check:output!~zone "100.100.100.IN-ADDR.ARPA."
cmd:xdsh $$SN "cat /etc/named.conf"
check:rc==0
check:output!~zone "100.100.100.IN-ADDR.ARPA."
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:makedns -n
check:rc==0
cmd:cat /etc/named.conf
check:rc==0
check:output~=zone "100.100.100.IN-ADDR.ARPA."
cmd:xdsh $$SN "cat /etc/named.conf"
check:rc==0
check:output!~zone "100.100.100.IN-ADDR.ARPA."
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "cat /etc/named.conf"
check:rc==0
check:output~=zone "100.100.100.IN-ADDR.ARPA."
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:cat /etc/named.conf
check:rc==0
check:output!~zone "100.100.100.IN-ADDR.ARPA."
cmd:xdsh $$SN "cat /etc/named.conf"
check:rc==0
check:output~=zone "100.100.100.IN-ADDR.ARPA."
cmd:xdsh $$SN "service xcatd restart"
check:rc==0
cmd:xdsh $$SN "cat /etc/named.conf"
check:rc==0
check:output!~=zone "100.100.100.IN-ADDR.ARPA."
end


start:makedns_nameserver_on_sn_sync_db_when_sn_down
description:when nameserver's db on mn was changed and name server on SN down at the same time, when name server on SN restart, it should sync the latest name server db on MN
os:rhels
label:cn_os_ready,dns
cmd:makedns -n
check:rc==0
cmd:service named status
check:rc==0
check:output~=running
cmd:xdsh $$SN "service named status"
check:rc==0
check:output~=running
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:chdef -t node -o dnstestnode groups=all  ip=100.100.100.2
check:rc==0
cmd:xdsh $$SN "service named stop"
check:rc==0
cmd:makedns dnstestnode
check:rc==0
cmd:nslookup dnstestnode $$MN
check:rc==0
check:output~=Server:         $$MN
check:output!~(server can't find dnstestnode)
cmd:xdsh $$SN "service named start"
check:rc==0
cmd:xdsh $$SN "service named status"
check:rc==0
check:output~=running
cmd:sleep 2
cmd:nslookup dnstestnode $$SN
check:rc==0
check:output~=Server:         $$SN
check:output!~(server can't find $$CN)
cmd:xdsh $$SN "service named stop"
check:rc==0
cmd:makedns -d dnstestnode
check:rc==0
cmd:nslookup dnstestnode $$MN
check:rc!=0
check:output~=Server:         $$MN
check:output~=(server can't find $$CN)
cmd:xdsh $$SN "service named start"
check:rc==0
cmd:xdsh $$SN "service named status"
check:rc==0
check:output~=running
cmd:sleep 2
cmd:nslookup dnstestnode $$SN
check:rc!=0
cmd:rmdef -t node dnstestnode
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
end

start:makedns_n_noderange
description:to verify makedns -n noderange works as design. add case for bug #2572. Test case bug number is #2826.
label:mn_only,dns,wait_fix
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:chdef -t node -o dnstestnode[1-10] groups=dnsnode  ip="|dnstestnode(\d+)|100.100.100.(\$1+0)|"
check:rc==0
cmd:cp -f /etc/hosts  /etc/hosts.testbak
check:rc==0
cmd:for i in {1..10}; do echo "100.100.100.$i  dnstestnode$i" >> /etc/hosts; done
check:rc==0
cmd:hostname
cmd:cat /etc/hosts
cmd:ip a
cmd:lsdef -l
cmd:tabdump networks
cmd:makedns -n dnstestnode[1-10]
check:rc==0
cmd:nslookup dnstestnode5 $$MN
check:output~=Server:             $$MN
check:output!~(server can't find dnstestnode)
cmd:makedns -d dnstestnode[1-10]
check:rc==0
cmd:nslookup dnstestnode5 $$MN
check:output~=Server:             $$MN
check:output~=(server can't find dnstestnode)
cmd:makedns -n dnsnode
check:rc==0
cmd:nslookup dnstestnode5 $$MN
check:output~=Server:             $$MN
check:output!~(server can't find dnstestnode)
cmd:makedns -d dnsnode
check:rc==0
cmd:nslookup dnstestnode5 $$MN
check:output~=Server:             $$MN
check:output~=(server can't find dnstestnode)
cmd:rmdef -t node dnstestnode[1-10]
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:cp -f /etc/hosts.testbak /etc/hosts
end
