To run the batch and delete multiple devices, run the following:
<BASEDIR>/smarts/bin/sm_adapter -s <IP domain name> -b <broker_port> --file=node_delete.txt <path>/node_delete.asl
File: node_delete.asl
topo_manager = object(getInstances("ICF_TopologyManager")[0]);
START {
node:rep(word) eol
}
do {
Node_obj = object();
Node_obj = topo_manager->findComputerSystem(node);
if (Node_obj->isNull()) {
print("Cannot find node :: ".node);
} else {
print("Deleting NODE :: ".Node_obj);
Node_obj->remove();
}
}
EOF
do {
print("Done with deleting the nodes");
}
Recommendations for back up to preserve the devices in your IP domain.
AM-PM domain repository save:
<BASEDIR>/IP/smarts/bin/sm_tpmgr -s <DomainName> --save
Save your IP domain rps with the above command. Once this command is complete, make a backup copy of your IP domain just in case you need it. Do a cp command to copy the rps and provide a new name. The location for the saved repository file is: <BASEDIR>/IP/smarts/local/repos/icf
Should you need to recover the IP domain, stop the IP domain, use the backup copy to overwrite the current file and restart the IP domain.
As another backup measure you can also create a seed file for the IP domain prior to running the script. The use the seed file to rediscover the devices that you removed to restore the topology to the IP domain. Review the following KB articles:
Creating a seedfile from existing topology
The command below will generate a seedfile consisting of SNMP Agent IP Addresses of devices present in the topology.
$cd <BASEDIR>/IP/smarts/bin
$./sm_tpmgr s <DM_Name> --dump-agents > <PATH>/seedfile
Smarts IP: How to discover the devices through seedfile from command line. (303967)
Discover devices using a seed file via command line and GUI
Store the seedfile in <BASEDIR>/IP/smarts/local/conf/ or <BASEDIR>/IP/smarts/conf
<BASEDIR>/IP/smarts/bin/sm_tpmgr -s <IP domain> --seed=<seedfile filename>
This will allow you to rediscover the devices back in the IP domain in case you deleted some that should not have been deleted.