How to add many hosts using jython interface to sps host database

Hi,

we want to create a huge number of virtual hosts into sps repository with jython interface.

for exemple our variables are:

hostname = sps1.internet.com

ip = 192.168.1.1

masterserver = masterserver

hardware = v550

and the script command looks like:

app.execRaw ( 'hdb.h.add' , { 'name' : hostname , 'desc' : hardware , 'tID' : 'NM:com.vodafone.osmgt#vodRAvhostHT' , 'pID' : NM:masterserver , 'attr' : 'cliServer=cliServer;RA_HOSTNAME=hostname;RA_PROVISIONING_IP_ADDR=ip;RA_DESCRIP TION=Dynamic Infrastructure container;RA_OWNER=n1sps;RA_OWNER_DIR=/var/crash/home/n1sps;RA_OWNER_CREATE_SSH _CONN=true;RA_UID=2241;RA_GROUP=n1sps;RA_GID=2241;RA_INSTALLER_USER=root;RA_SUID =y;RA_INSTALLBASE=/opt/SUNWn1sps;RA_CTYPE=ssh;RA_CTYPE_PARAM=cprefix=/opt/SUNWn1 sps/N1_Service_Provisioning_System/agent;RA_LEAVEFILES=n;RA_INSTALL_JRE=/opt/SUN Wn1sps/N1_Service_Provisioning_System/common/jre;RA_PORT=1131;RA_CIPHER_TYPE=1;R A_INSTALLER_WORKDIR=/tmp;RA_PARENT_HOST=masterserver;RA_PARENT_OWNER=n1sps;RA_PA RENT_OWNER_DIR=/opt/SUNWn1sps/home/n1sps;RA_PARENT_TYPE=MS;RA_PACKAGE_PATH=/var/ tmp/spsra;RA_PACKAGE_NAME=cr_ra_solaris_sparc_5.2.sh;RA_REMOTE_PACKAGE_TMP_DIR=/ tmp;RA_REMOTE_PRIV_CMD=/usr/local/bin/sudo;RA_REMOTE_PRIV_USER=admin;RA_REMOTE_P RIV_USER_HOME=/home/admin;RA_SRC_SSH_DIR=/opt/home/.ssh;RA_DST_SSH_DIR=/home/.ss h;RA_SSH_AUTH_KEY_FILE=authorized_keys' } )

unfortunetly we are getting an error when we try to run the n1 sps hdb.h.add command.

Are we using this command in the right manner ?

Thanks in advance.

--

Christian

[1631 byte] By [ChRa] at [2008-2-22]
# 1

Hi Christian

You could have pasted the error you're seeing.

Anyway, I don't see a login info

a sample hdb.h.add for adding a virtual host TEST_VHOST to masterserver:

session = clui_app.execRaw("udb.login", {"u" : "admin" , "p" : "admin"})

clui_app.execRaw("hdb.h.add", {"s" : session , "name" : "TEST_VHOST", "tID" : "NM:system#crhost", "pID": "NM:masterserver"})

clui_app.execRaw("udb.logout", {"s" : session})

hth

Lubos

Tarzaneka at 2007-7-8 > top of java,Administration Tools,N1 Service Provisioning System...
# 2

Dear Tarzanek,

I am Alexis Susset a coleague of Christian.

Thank you very much for your reply, we are now able to add hosts directly from a Jython script.

Unfortunetly, we are now encourting a problem with the hdb.h.add command.

It dies if our hostname (name) is already present in the database.

We currently need to import a very high number of node and I would like to know how to simply get two outputs (1. added nodes, 2. non-added nodes ).

Please let me know if you would like me to post the scripts I have.

PS: I tried to use a hbd.h.lo command but it dies as well when I search for a host that doesn't exist.

Many thanks and best regards,

--

Alexis

alexis_susseta at 2007-7-8 > top of java,Administration Tools,N1 Service Provisioning System...