Just to add some more detail to Christopher's post:

It's a simple job to move devices from any container to any other container. 
You just need to know the model handles for source and destination containers 
and the device(s) you want to move. The location of a device is specified by a 
"Collects" relation, which has a handle of 0x10002.

You can use either the VNMSH CLI or web services interface (REST API). For 
performance reasons I'd strongly recommend the REST API. I run the commands 
below on a Red Hat Linux host so I can take advantage of the cURL command 
(we're running Spectrum on Windows servers).

You can't specify devices and containers by name but you can run various 
commands to get the model handles you need. For example to get a list of 
devices in the LostFound container (model handle = 0xn00002, where n is 
dependent on the landscape handle) on the landscape with handle 0x400000:

curl 
'http://<username>:<password>@<oneclickhost_ip>/spectrum/restful/associations/relation/0x10002/model/0x400002?side=left'

Output data is in XML format by default but if you prefer JSON just include the 
JSON directive in the cURL command:

curl -H "Accept: application/json" 
'http://<username>:<password>@<oneclickhost_ip>/spectrum/restful/associations/relation/0x10002/model/0x400002?side=left'

Now you will have a list of models in the source container specified as 
associations. The leftmh (left model handle) will be the handle of the source 
container where the device is located and the rightmh (right model handle) is 
the handle of the device itself. To move a device to a different container you 
must:

1. Destroy the Collects relation between the device and its existing container
2. Create a new Collects relation between the device and the new container you 
want to move it to

For example:

# Destroy the existing Collects relation:
curl -X DELETE 'http:// 
<username>:<password>@<oneclickhost_ip>/spectrum/restful/associations/relation/0x10002/leftmodel/<existing_container_model_handle>/rightmodel/<device_model_handle>'

# Create new Collects relation:
curl -X POST 
'http://<username>:<password>@<oneclickhost_ip>/spectrum/restful/associations/relation/0x10002/leftmodel/<new_container_model_handle>/rightmodel/<device_model_handle>'

To see whether a command was successful check the value of the "error" 
attribute of the "delete-association-response" and 
"create-association-response" elements in the returned XML. It should be 
"Success", however in my experience it's not a 100% reliable indication of 
whether or not the operation was actually successful. For example if you run 
the 2nd command above to move the device without destroying the existing 
association first Spectrum will return "Success" but it hasn't actually done 
anything.

Keep in mind that you can only create an association between models on the same 
spectroserver. If a device needs to be moved to a container on a different 
spectroserver you can't use this method. You must delete and rediscover it.

I'd disagree that the process is ugly or flaky. IMHO it works very well but it 
helps if you're comfortable with one of the major scripting languages, 
especially if you're doing this regularly, but that's true when using the REST 
API for any vendor's product. My preference is Perl and JSON so I like that CA 
included support for JSON output (not all vendors' products do) but you can use 
Python or Ruby instead of Perl and XML output instead of JSON if you prefer. 
There are numerous Perl modules to help you parse both XML and JSON.

Hope that helps.

Craig Porter, Enterprise Systems Management - Availability & Performance 
Monitoring
Marsh & McLennan Companies
Global Technology Infrastructure (MGTI) | Centralized Operations
Sackville House 1.6, 143-149 Fenchurch Street, London EC3M 6BN, Great Britain
+44 (0)20 7178 4827 | Mobile +44 (0)7585 803 093 | craig.por...@mmc.com
www.mmc.com

-----Original Message-----
From: Cashell, Christopher P. [mailto:cpcash...@west.com]
Sent: 31 March 2016 00:30
To: spectrum
Cc: spectrum
Subject: RE: [spectrum] New Devices container.

It can be done with scripts through the Spectrum Command Line Interface[0].  
Pull a list of devices tied to the New Devices container, break the 
relationship, and place them somewhere else.  We've got a custom setup doing 
that based on work done by CA Professional services.  If you haven't worked 
with the command line, however, it's an ugly, flaky, clunky pain in the ass.  
Wrapping it in something like the Perl module Spectrum::CLI makes it 
*significantly* more usable, but it's still far from optimal.  If you're going 
to use the CLI and you know anything at all about Perl, use the Spectrum::CLI 
module.  You'll hate the CLI less that way.

If I were doing a new development, and I had someone with any Web Services 
experience[2], I'd probably look at the Web Services API.  You should be able 
to do the same thing as described above, there.  Personally, I find it annoying 
that it only supports XML for input (both XML and JSON are supported for 
output), but that's Spectrum for you.

  [0] 
https://docops.ca.com/ca-spectrum/10-1/en/managing-client-applications/command-line-interface
  [1] http://search.cpan.org/~plonka/Spectrum-CLI-1.016/CLI.pm
  [2] 
https://docops.ca.com/ca-spectrum/10-1/en/programming/web-services-api-reference

--
Christopher P. Cashell

EIT Platform EngineeringE-Mail: cpcash...@west.com
Infrastructure Monitoring, Management, and Automation DivisionEIT ~ Converging 
People and Technologies
West Corporation


-----Original Message-----
From: Jon Magnus Dullerud [mailto:dulle...@gmail.com]
Sent: Tuesday, March 29, 2016 3:46 AM
To: spectrum
Subject: [spectrum] New Devices container.

Hi All.

Do anyone know how to move a devices from the New Devices container to a 
container in Universe  based on it´s name or something in the name.

All the best
Jon Magnus Dullerud
Norwegian Defence.



---
To unsubscribe from spectrum, send email to lists...@unc.edu with the body: 
unsubscribe spectrum cpcash...@west.com

---
To unsubscribe from spectrum, send email to lists...@unc.edu with the body: 
unsubscribe spectrum craig.por...@marsh.com

________________________________


Marsh Ltd. Registered in England and Wales Number: 1507274
Registered office 1 Tower Place West, Tower Place, London, EC3R 5BU.

Marsh Ltd is authorised and regulated by the Financial Conduct Authority.

This message and any attachments are confidential.
If you have received this message in error please delete it from your system.
If you require any assistance please notify the sender. Thank you.

---
To unsubscribe from spectrum, send email to lists...@unc.edu with the body: 
unsubscribe spectrum arch...@mail-archive.com

Reply via email to