DX Operational Intelligence

Expand all | Collapse all

Populate CI location property and Conditional based on 3 Variables

Jump to Best Answer
  • 1.  Populate CI location property and Conditional based on 3 Variables

    Posted 04-13-2015 05:32 PM

    Hello, I was asked by a client if it was possible to populate the CI in SOI's "Location" property for each CI that it gets from Spectrum.

    They previously populated the Location (0x23000d) attribute on many Spectrum devices.

     

    So I added to the AdditionalAttributes.xml file the following:

        <Attribute id="0x23000d" name="Location"/>

        <Attribute id="0x1102e" name="sysLocation"/>


    And in the SpectrumPolicy.xml file I added

         <Field conditional="sysLocation" output="Location" format="{0}" input="sysLocation"/>

         <Field output="Description" format="{0}, POC: {1}, {2)" input="Description,ContactPerson,USER_AssetDescription"/>

     

    Then added to the publishcache the  [,Location,ContactPerson,USER_AssetDescription,NamedAliases,CIuserAttribute1]

     

    Yet this didn't work. The Location field on the CI's in SOI are not getting populated. I initially tried with the Location attribute, then I tried with the sysLocation property. Both didn't work.

     

    Anyone have any ideas?

    Also they wanted to populate the Description property on each CI in SOI from Spectrum based on a conditional of the 3 attributes listed above. [input="Description,ContactPerson,USER_AssetDescription"]

    Is it possible to do a conditional assignment based on 3 variables?

    TIA...



  • 2.  Re: Populate CI location property and Conditional based on 3 Variables

    Posted 04-16-2015 12:50 PM

    Anyone?



  • 3.  Re: Populate CI location property and Conditional based on 3 Variables

    Posted 05-18-2015 04:23 PM

    Can anyone from CA please respond to this? Still wondering if this is possible? TIA..



  • 4.  Re: Populate CI location property and Conditional based on 3 Variables

    Posted 05-19-2015 12:10 AM

    Hi Daniel,

     

    I have some questions for follow up:

    Do you see the original values of the Spectrum properties in the RAW files when using debug mode on the connector?

    Did you try to map the expected values of Location and sysLocation to the CIuserAttributes?  Just to see, if this is a problem of getting the values correct or if there is a problem with the "Location" field (some of the properties can behave a little strange).

     

    Rather than adding all the individual Attributes to the publishcache you can use '*' - this will take care of all.

     

    What exactly do you mean by "the condition with 3 variables":

    Shall all three variables be set and the resulting string has a fixed format

    or

    can any of the three be set and the string can have different formats?

     

    MichaelBoehm



  • 5.  Re: Populate CI location property and Conditional based on 3 Variables
    Best Answer

    Posted 05-20-2015 11:38 AM

    I am no expert and like you I have been experimenting so you may want to try this and see if it works. I see you have two things going on here so for me I need to break them up and try to accomplish one at a time.

    Before you start: (Assuming you are using the 195 or greater connector)
    1. Pick one device to work on preferably in a development Spectrum/SOI testing tier
    2. Make sure the Spectrum connectors are in debug mode that will produce the RAW and PUB files and what not on the connector matching
    3. Backup the files you may be working on (if the connector server is a windows clustered server is on the floating drive)
    a. <your path>\CA\SOI\resources\Configurations\SpectrumIM\AdditionalAttributes.xml
    b. <your_path>\CA\SOI\resources\Core\Catalogpolicy\spectrumim_policy.xml
    4. Open the <path>SOI\log\debugData folder
    5. Look for the CA_00005_Spectrum-<your_spectrum>_ITEM_RAW.txt file
    a. Look for the sysLocation or Location attribute for the device
    b. If its not there then you add it to the additional_attributes.xml file like you did under Models
    c. Restart the connector you should see a value that corresponds to what is in Spectrum now
    6. Now look for the device in one of the *.out files in the same folder.
    a. When the connector runs and it processes policy file each class section is written out
    b. This is important because then you will know the section in the policy file to edit.
    7. Say your device is in the ComputerSystem.out file for example.
    a. Now you know that you just search for the line that contains "ComputerSystem.out" in the <path>\SOI\resources\Core\Catalogpolicy\spectrumim_policy.xml file
    b. <Field type="file" name="ComputerSystem.out" properties="*" /> is in the section called "ComputerSystem USM type"
    8. In the section called "ComputerSystem USM type" within the <Format> section one line above the </Format> add this line:
    <Field conditional="sysLocation" output="Location" format="{0}" input="sysLocation" />
    9. Now a few lines down there is a <write> section edit the line to add the Location attribute
            <Field type="publishcache" properties="Location,Model,ClassName,Description,OtherMacAddresses,PrimaryDnsName,PrimaryIPV6Address,OtherIPAddresses,PrimaryMacAddress,PrimaryIPV4Address,SysName,AssetNumber,PhysSerialNumber" />
    10. Save the policy file and restart the connector(s)
    11. Now the tricky patch checking your work.
    12. You should still see the Spectrum attributes in the RAW file.
    13. You should now see in the ComputerSystem.out file the Location=<some value>
    14. Then look a the CA_00005_Spectrum-<your_spectrum>_CI_PUB.txt file for the device and the Location value
    15. The GUI should also have that same value for the device

    Notes:
    - If anything goes wrong and you don't see anything then what I found is that you need to force the value to change in Spectrum or delete and rediscover the device in Spectrum which will force it to build out the record.
    - If the sysLocation value can changes often then you may want to add a watchable flag at the end of your line in additionalattributes.xml
    <Attribute id="0x23000d" name="Location" watchable="yes"/>
    - Try setting the sysLocation to a CIuserAttribute adn see if that works. I tried to overwrite a value once and it would not seem to overwrite one of the values but it would go to an user attribute
    - If you are trying to concatenate values in the policy file into one line then you do it like this: where each item in the input is mapped to a {number}
    <Field output="Description" format="{0}-{1}-{2}" input="Description,ContactPerson,USER_AssetDescription" />
    For example: Description=Blah and ContactPerson=Bill Smith and User_AssetDescription=Stuff
    The new value for Description should be Description=Blah-Bill Smith-Stuff

    Hope this helps



  • 6.  Re: Populate CI location property and Conditional based on 3 Variables

    Posted 05-21-2015 08:29 AM

    Wow, thanks Dan. Great write up. Your level is Expert++ . 

     

    Anyway when I get a chance I'll give this another shot and will post results.



  • 7.  Re: Populate CI location property and Conditional based on 3 Variables

    Posted 10-27-2016 06:43 AM

    Hi Dan,

     

    I tried this and also did some further investigations, because it does NOT work for Location.

    the field Location you see on the Console for a CI cannot be set via the Connector policy, because it is not an attribute in the USM model, but an internal SOI attribute, for example used for the GoogleMaps integration.

    The setting in the Connector policy just ends up in "nowhere land" because there is no USM attribute to store the value in.

    If you assign the value to one of the CI User Attributes, the value is shown for the CI in the console.

     

    I agree that this is confusing, because you see a field Location in the Console for a CI, but you cannot set it via the Policy.  I will try to follow up on that internally to see if something can be done about that.

     

    MichaelBoehm



  • 8.  Re: Populate CI location property and Conditional based on 3 Variables

    Posted 03-26-2018 11:07 AM

    Would also like to know the outcome of Michael's response