cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3491
Views
0
Helpful
5
Replies

Ucs Central Powertool 2.0.1 compare/sync within same Ucs Central does not work

jmunk
Level 4
Level 4

Ucs Central compare/sync within same Ucs Central does not work, I get "object already exists" error and no changes made

The compare/sync function is essential for managing large Ucs Central solutions

Using:

- Ucscentral 1.4(1b)

- UcsPowerTool Suite 2.0.1, Ucs Central Powertool

#User Guide says

#===============================================

$refObj = Get-UcsCentralServiceProfile -Name TestSP -UcsCentral Ucsc-Bidwell-Dev-131a

$diffObj= Get-UcsCentralServiceProfile -Name TestSP -UcsCentral UcsCentral-Dev-Auburn

$compareObj = Compare-UcsCentralManagedObject -ReferenceObject $refObj -DifferenceObject $diffObj

Sync-UcsCentralManagedObject -Difference $compareObj -UcsCentral UcsCentral-Dev-Auburn -Force

#My test: Working on these MOs within same Ucs Central

#===============================================

get-ucscentralorg -level root | add-ucscentralorg -name "SubOrg1" -descr "SubOrg1 Description" -ModifyPresent

get-ucscentralorg -level root | add-ucscentralorg -name "SubOrg2" -descr "SubOrg2 Description" -ModifyPresent

get-ucscentralorg -name "SubOrg1" | add-ucscentralorg -name "SubOrg1_1" -descr "SubOrg1_1 Description" -ModifyPresent

get-ucscentralorg -name "SubOrg2" | add-ucscentralorg -name "SubOrg2_1" -descr "SubOrg2_1 Description" -ModifyPresent

get-ucscentralorg | ? {$_.Name -like "*SubOrg*"} | select Name,Descr,Dn | format-table -AutoSize

Name  Descr             Dn                          
----  -----             --                          
SubOrg1   SubOrg1 Description   org-root/org-SubOrg1        

SubOrg1_1 SubOrg1_1 Description org-root/org-SubOrg1/org-SubOrg1_1

SubOrg2   SubOrg2 Description   org-root/org-SubOrg2        

SubOrg2_1 SubOrg2_1 Description org-root/org-SubOrg2/org-SubOrg2_1

#Synchronzing from SubOrg1 to SubOrg2, expecting Descr to be updated, but above mentioned error and no changes

#=================================================================

$refObj = Get-ucscentralorg -name "SubOrg1"

$diffObj= Get-ucscentralorg -name "SubOrg2"

$compareObj = Compare-UcsCentralManagedObject -ReferenceObject $refObj -DifferenceObject $diffObj

$refObj | select Dn

Dn                                                                                                                                                      
--                                                                                                                                                      

org-root/org-SubOrg1

$diffObj | select Dn

Dn                                                                                                                                                      
--                                                                                                                                                      

org-root/org-SubOrg2

$compareObj | select Dn

Dn                                                                                                                                                      
--                                                                                                                                                      
org-root/org-SubOrg1                                                                                                                                    

org-root/org-SubOrg2

Sync-UcsCentralManagedObject -Difference $compareObj -Force

Sync-UcsCentralManagedObject : JmuUcsCentral2:can't create; object already exists.

At line:1 char:1

+ Sync-UcsCentralManagedObject -Difference $compareObj -Force

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ResourceExists: (unidentified-fail:String) [Sync-UcsCentralManagedObject], Exception

    + FullyQualifiedErrorId : 103,Cisco.UcsCentral.Cmdlets.SyncUcsCentralManagedObject

get-ucscentralorg | ? {$_.Name -like "*SubOrg*"} | select Name,Descr,Dn | format-table -AutoSize

Name  Descr             Dn                          
----  -----             --                          
SubOrg1   SubOrg1 Description   org-root/org-SubOrg1        

SubOrg1_1 SubOrg1_1 Description org-root/org-SubOrg1/org-SubOrg1_1

SubOrg2   SubOrg2 Description   org-root/org-SubOrg2        

SubOrg2_1 SubOrg2_1 Description org-root/org-SubOrg2/org-SubOrg2_1

#Synchronzing from SubOrg1 -hierarchy to SubOrg2 hierarchy, expecting child SubOrg1_1 to be copied to SubOrg2 "Parent", and Descr's to be updated

#but above mentioned error and no changes

#===============================================

$refObj = Get-ucscentralorg -name "SubOrg1" -hierarchy

$diffObj= Get-ucscentralorg -name "SubOrg2" -Hierarchy

$compareObj = Compare-UcsCentralManagedObject -ReferenceObject $refObj -DifferenceObject $diffObj

$refObj | select Dn

Dn                                                                                                                                                      
--                                                                                                                                                      
org-root/org-SubOrg1                                                                                                                                    
org-root/org-SubOrg1/lacp-default                                                                                                                       
org-root/org-SubOrg1/org-SubOrg1_1                                                                                                                      
org-root/org-SubOrg1/org-SubOrg1_1/lacp-default                                                                                                         
org-root/org-SubOrg1/org-SubOrg1_1/src-mask                                                                                                             

org-root/org-SubOrg1/src-mask

$diffObj | select Dn

Dn                                                                                                                                                      
--                                                                                                                                                      
org-root/org-SubOrg2                                                                                                                                    
org-root/org-SubOrg2/lacp-default                                                                                                                       
org-root/org-SubOrg2/org-SubOrg2_1                                                                                                                      
org-root/org-SubOrg2/org-SubOrg2_1/lacp-default                                                                                                         
org-root/org-SubOrg2/org-SubOrg2_1/src-mask                                                                                                             

org-root/org-SubOrg2/src-mask

$compareObj | select Dn

Dn                                                                                                                                                      
--                                                                                                                                                      
org-root/org-SubOrg1                                                                                                                                    
org-root/org-SubOrg1/lacp-default                                                                                                                       
org-root/org-SubOrg1/org-SubOrg1_1                                                                                                                      
org-root/org-SubOrg1/org-SubOrg1_1/lacp-default                                                                                                         
org-root/org-SubOrg2                                                                                                                                    
org-root/org-SubOrg2/lacp-default                                                                                                                       
org-root/org-SubOrg2/org-SubOrg2_1                                                                                                                      

org-root/org-SubOrg2/org-SubOrg2_1/lacp-default

Sync-UcsCentralManagedObject -Difference $compareObj -Force

Sync-UcsCentralManagedObject : JmuUcsCentral2:can't create; object already exists.

At line:1 char:1

+ Sync-UcsCentralManagedObject -Difference $compareObj -Force

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ResourceExists: (unidentified-fail:String) [Sync-UcsCentralManagedObject], Exception

    + FullyQualifiedErrorId : 103,Cisco.UcsCentral.Cmdlets.SyncUcsCentralManagedObject

get-ucscentralorg | ? {$_.Name -like "*SubOrg*"} | select Name,Descr,Dn | format-table -AutoSize

Name  Descr             Dn                          
----  -----             --                          
SubOrg1   SubOrg1 Description   org-root/org-SubOrg1        

SubOrg1_1 SubOrg1_1 Description org-root/org-SubOrg1/org-SubOrg1_1

SubOrg2   SubOrg2 Description   org-root/org-SubOrg2        

SubOrg2_1 SubOrg2_1 Description org-root/org-SubOrg2/org-SubOrg2_1

1 Accepted Solution

Accepted Solutions

vravish
Cisco Employee
Cisco Employee

Hi,

you can try the XlateMap parameter if you want to compare and sync mos in hierarchy. XlateMap is hashtable which has Dn's of difference mos as key and Dn's of reference mos as value.

PowerTool C:\> $refObj = Get-ucscentralorg -name "SubOrg1" -Hierarchy

PowerTool C:\> $diffObj= Get-ucscentralorg -name "SubOrg2" -Hierarchy

Now if you compare the $diffObj and $refObj, you will have $compareObj with all the child mos of "SubOrg1" and "SubOrg2". Again all the mo entries in the $compareObj will either be marked as to be created or deleted.  So you have to translate the dns of $diffObj so that Compare-UcsCentralMO cmdlet can compare the two objects using XlateMap parameter.

$xlateDn = @{}

$xlateDn['org-root/org-SubOrg2'] = 'org-root/org-SubOrg1'

$xlateDn['org-root/org-SubOrg2/org-SubOrg2_1'] = 'org-root/org-SubOrg1/org-SubOrg1_1'

In above, I am trying to translate two mos in the comparison result. I keep the Dns of $diffObj as keys and Dns of$refObj as value and I will use this $xlateDn in the Compare-UcscentralMo cmdlet.

PowerTool C:\> $compareObj = Compare-UcsCentralManagedObject -ReferenceObject $refObj -DifferenceObject $diffObj -XlateMap $xlateDn

PowerTool C:\> $compareObj

Dn                                         InputObject                 SideIndicator        DiffProperty
--                                         -----------                 -------------        ------------
org-root/org-SubOrg1                       Cisco.UcsCentral.OrgOrg          =>              {Descr}
org-root/org-SubOrg1/org-SubOrg1_1         Cisco.UcsCentral.OrgOrg          =>              {Descr, Rn}

PowerTool C:\> Sync-UcsCentralManagedObject -Difference $compareObj -Force

Descr        : SubOrg2 Description
Level        : 1
Name         : SubOrg1
UcsCentral   : UCSCentral166
Dn           : org-root/org-SubOrg1
Rn           : org-SubOrg1
Status       : modified
XtraProperty : {}

Descr        : SubOrg2_1 Description
Level        : 2
Name         : SubOrg1_1
UcsCentral   : UCSCentral166
Dn           : org-root/org-SubOrg1/org-SubOrg1_1
Rn           : org-SubOrg1_1
Status       : modified

XtraProperty : {}

Please let us know if you need any more information.

Thanks,

Vinay Ravish

View solution in original post

5 Replies 5

vravish
Cisco Employee
Cisco Employee

Comapre/Sync cmdlets are typically used to compare across different UcsCentral.

If you want to use the Comapre/Sync functionality in same UcsCentral, then you have to use -XlateOrg or  -XlateMap parameters of Compare-UcsCentralManagedObject cmdlet.

PowerTool C:\> $refObj


Descr        : SubOrg1 Description
Level        : 1
Name        : SubOrg1
UcsCentral  : UCSCentral166
Dn          : org-root/org-SubOrg1
Rn          : org-SubOrg1
Status      :
XtraProperty : {}

PowerTool C:\> $diffObj


Descr        : SubOrg2 Description
Level        : 1
Name        : SubOrg2
UcsCentral  : UCSCentral166
Dn          : org-root/org-SubOrg2
Rn          : org-SubOrg2
Status      :
XtraProperty : {}

PowerTool C:\>$compareObj = Compare-UcsCentralManagedObject -ReferenceObject $refObj -DifferenceObject $diffObj -XlateOrg "org-root/org-SubOrg1"

PowerTool C:\>

PowerTool C:\>

PowerTool C:\> $compareObj

Dn                                            InputObject                                SideIndicator                  DiffProperty
--                                                -----------                                    -------------                      ------------
org-root/org-SubOrg1            Cisco.UcsCentral.OrgOrg            =>                                  {Descr}

PowerTool C:\>

PowerTool C:\>

PowerTool C:\> Sync-UcsCentralManagedObject -Difference $compareObj -Force


Descr        : SubOrg2 Description
Level        : 1
Name        : SubOrg1
UcsCentral  : UCSCentral166
Dn          : org-root/org-SubOrg1
Rn          : org-SubOrg1
Status      : modified
XtraProperty : {}

After Sync, description of reference object is updated with description of difference object.

Please let us know in case of more query.

jmunk
Level 4
Level 4

Vinay

This is very quick reply and it works for the MO to MO compary/sync!

And I can see, that when I compare two MOs including their children (created with -hierarchy) as I do in the below example, then only the "parent" MOs get compared and synced.

Is there a way to make the compary/sync work for the complete subtrees of two MOs (say "parentMO1" and "parentMO2"), such that both of the below will take place:

- Child MOs under the two "parents" with same "subtree" Dn's, e.g. Dn="parentMO1/ChildMO1" and Dn = "parentMO2/ChildMO1" get compared/sync'ed

- If a child object exists only under the difference "parent" object (say child "parentMO2/ChildMO7"), but not under the reference "parent" (in casu "parentMO1"), then this child will be copied as a child under the reference "parent" (here as "parentMO1/ChildMO7") (I can see that the -deleteNotPresent works ok for the "other way" by deleting children under the reference Parent, which do not exist under the difference Parent)

One way to handle a "subtree" compary/sync could be to "manually" code a "loop" down through both ParentMO subtrees, In this case I would then have to find a way to handle the situation, where a child exists under the difference Parent but not under the reference Parent. My immediate impression is, that there is no way to do compare/sync from a difference MO to a non existing reference MO.

The below test shows that my compare/sync of two subtrees created by -hierarchy only works on the two "Parent" MOs (except for the -deleteNotPresent, which does work (not shown below))

$refObj = Get-ucscentralorg -name "SubOrg1" -hierarchy

$diffObj= Get-ucscentralorg -name "SubOrg2" -Hierarchy

$compareObj = Compare-UcsCentralManagedObject -ReferenceObject $refObj -DifferenceObject $diffObj -XlateOrg "org-root/org-SubOrg1"

$refObj | select Dn

$diffObj | select Dn

$compareObj | select Dn

Sync-UcsCentralManagedObject -Difference $compareObj -Force

get-ucscentralorg | ? {$_.Name -like "*SubOrg*"} | select Name,Descr,Dn | format-table -AutoSize

Name  Descr             Dn                          
----  -----             --                          
SubOrg1   SubOrg2_1 Description org-root/org-SubOrg1         <= Update

SubOrg1_1 SubOrg1_1 Description org-root/org-SubOrg1/org-SubOrg1_1 <= No Update

SubOrg2   SubOrg2 Description   org-root/org-SubOrg2        

SubOrg2_1 SubOrg2_1 Description org-root/org-SubOrg2/org-SubOrg2_1

vravish
Cisco Employee
Cisco Employee

Hi,

you can try the XlateMap parameter if you want to compare and sync mos in hierarchy. XlateMap is hashtable which has Dn's of difference mos as key and Dn's of reference mos as value.

PowerTool C:\> $refObj = Get-ucscentralorg -name "SubOrg1" -Hierarchy

PowerTool C:\> $diffObj= Get-ucscentralorg -name "SubOrg2" -Hierarchy

Now if you compare the $diffObj and $refObj, you will have $compareObj with all the child mos of "SubOrg1" and "SubOrg2". Again all the mo entries in the $compareObj will either be marked as to be created or deleted.  So you have to translate the dns of $diffObj so that Compare-UcsCentralMO cmdlet can compare the two objects using XlateMap parameter.

$xlateDn = @{}

$xlateDn['org-root/org-SubOrg2'] = 'org-root/org-SubOrg1'

$xlateDn['org-root/org-SubOrg2/org-SubOrg2_1'] = 'org-root/org-SubOrg1/org-SubOrg1_1'

In above, I am trying to translate two mos in the comparison result. I keep the Dns of $diffObj as keys and Dns of$refObj as value and I will use this $xlateDn in the Compare-UcscentralMo cmdlet.

PowerTool C:\> $compareObj = Compare-UcsCentralManagedObject -ReferenceObject $refObj -DifferenceObject $diffObj -XlateMap $xlateDn

PowerTool C:\> $compareObj

Dn                                         InputObject                 SideIndicator        DiffProperty
--                                         -----------                 -------------        ------------
org-root/org-SubOrg1                       Cisco.UcsCentral.OrgOrg          =>              {Descr}
org-root/org-SubOrg1/org-SubOrg1_1         Cisco.UcsCentral.OrgOrg          =>              {Descr, Rn}

PowerTool C:\> Sync-UcsCentralManagedObject -Difference $compareObj -Force

Descr        : SubOrg2 Description
Level        : 1
Name         : SubOrg1
UcsCentral   : UCSCentral166
Dn           : org-root/org-SubOrg1
Rn           : org-SubOrg1
Status       : modified
XtraProperty : {}

Descr        : SubOrg2_1 Description
Level        : 2
Name         : SubOrg1_1
UcsCentral   : UCSCentral166
Dn           : org-root/org-SubOrg1/org-SubOrg1_1
Rn           : org-SubOrg1_1
Status       : modified

XtraProperty : {}

Please let us know if you need any more information.

Thanks,

Vinay Ravish

Vinay

Great, I will test and give You feed back

/Jesper

Vinay!

Compare/Sync between two MO subtrees within same Ucs Central works just fine, and I can do with only mapping the "root" Dn's of the two subtress, and then all child MOs with identical Dn's (taking the mapping of the "root" Dn's into account) get synchronized, which is just what I want for this use case. See example below for details

Questions to You:

1. Can You confirm that the above use of Sync between two subtrees within same Ucs Central where I only map the "root" Dn's of the two subtrees, is officially supported by Cisco, and that I am not in "this works but You are on Your own, if issues occur" territory?

2. The compare object generated by the compare operations only contains information ($compareObj.DiffProperty)

about which properties within a given MO, that are different in the two subtrees,

but not the values of these properties in respectively the "reference" and "difference" objects.

Is there any (automatic) way to get the value of these differing properties in both the "reference" and "difference" objects? Here I am thinking of the compare/sync process providing this information directly.

3. I would like to copy a given MO subtree to another place in the "total" subtree within the same Ucs Central system, where this subtree does not exist beforehand. So this is a genuine copy function, not a compare/sync function. Is there a feature to perform this or is Cisco planning to make such feature later (and when). (I understand this will involve some "below the surface" copying functionality since we are working with Powershell objects and "real" objects within the Ucs Central DME itself).

========================

Details of my compare/sync test

========================

#Creating MOs to work on

get-ucscentralorg -level root | add-ucscentralorg -name "SubOrg1" -descr "SubOrg1 Description" -ModifyPresent

get-ucscentralorg -level root | add-ucscentralorg -name "MiddleOrg" |

add-ucscentralorg -name "SubOrg2" -descr "SubOrg2 Description" -ModifyPresent

get-ucscentralorg -name "SubOrg1" |

    add-ucscentralorg -name "SubOrgL1" -descr "SubOrg1 L1 Description" -ModifyPresent |

    add-ucscentralorg -name "SubOrgL2" -descr "SubOrg1 L2 Description" -ModifyPresent |

    add-ucscentralorg -name "SubOrgL3" -descr "SubOrg1 L3 Description" -ModifyPresent

get-ucscentralorg -name "MiddleOrg" -limitscope | get-ucscentralorg -name "SubOrg2" |

    add-ucscentralorg -name "SubOrgL1" -descr "SubOrg2 L1 Description" -ModifyPresent |

    add-ucscentralorg -name "SubOrgL2" -descr "SubOrg2 L2 Description" -ModifyPresent

get-ucscentralorg | ? {$_.Name -like "*SubOrg*" -or $_.Name -like "*MiddleOrg*"} | select Name,Descr,Dn | format-table -AutoSize

Name      Descr                  Dn                                                         

----      -----                  --                                                         

MiddleOrg                        org-root/org-MiddleOrg                                     

SubOrg2   SubOrg2 Description    org-root/org-MiddleOrg/org-SubOrg2                         

SubOrgL1  SubOrg2 L1 Description org-root/org-MiddleOrg/org-SubOrg2/org-SubOrgL1            

SubOrgL2  SubOrg2 L2 Description org-root/org-MiddleOrg/org-SubOrg2/org-SubOrgL1/org-SubOrgL2

SubOrg1   SubOrg1 Description    org-root/org-SubOrg1                                       

SubOrgL1  SubOrg1 L1 Description org-root/org-SubOrg1/org-SubOrgL1                          

SubOrgL2  SubOrg1 L2 Description org-root/org-SubOrg1/org-SubOrgL1/org-SubOrgL2             

SubOrgL3  SubOrg1 L3 Description org-root/org-SubOrg1/org-SubOrgL1/org-SubOrgL2/org-SubOrgL3

#Synchronzing from SubOrg2 -hierarchy to SubOrg3 hierarchy with XlateDn for only the "root" MO of

#the compared subtrees, in casu mapping org-root/org-MiddleOrg/org-SubOrg2 to org-root/org-SubOrg1

#===============================================

$xlateDn = @{} 

$xlateDn['org-root/org-MiddleOrg/org-SubOrg2'] = 'org-root/org-SubOrg1' 

$refObj = Get-ucscentralorg -name "SubOrg1" -hierarchy

$refObj | select Dn,Descr | Format-Table -AutoSize

$diffObj= get-ucscentralorg -name "MiddleOrg" -limitscope | get-ucscentralorg -name "SubOrg2" -Hierarchy

$diffObj | select Dn,Descr | Format-Table -AutoSize

$compareObj = Compare-UcsCentralManagedObject -ReferenceObject $refObj -DifferenceObject $diffObj -XlateMap $xlateDn

Dn                                      InputObject                             SideIndicator                           DiffProperty                         

--                                      -----------                             -------------                           ------------                         

org-root/org-SubOrg1                    Cisco.UcsCentral.OrgOrg                 =>                                      {Descr}                              

org-root/org-SubOrg1/org-SubOrgL1       Cisco.UcsCentral.OrgOrg                 =>                                      {Descr}                              

org-root/org-SubOrg1/org-SubOrgL1/or... Cisco.UcsCentral.OrgOrg                 =>                                      {Descr}                              

org-root/org-SubOrg1/org-SubOrgL1/or... Cisco.UcsCentral.OrgOrg                 <=                                                                           

org-root/org-SubOrg1/org-SubOrgL1/or... Cisco.UcsCentral.FabricLacpPolicy       <=                                                                           

org-root/org-SubOrg1/org-SubOrgL1/or... Cisco.UcsCentral.FabricVlanPermit       <=                                                                           

org-root/org-SubOrg1/org-SubOrgL1/or... Cisco.UcsCentral.FabricVlanPermit       <=                                                                           

org-root/org-SubOrg1/org-SubOrgL1/or... Cisco.UcsCentral.FabricVlanPermit       <=

Sync-UcsCentralManagedObject -Difference $compareObj -Force

#Result: synchronization happens all the way down (in casu for Descr attr) in the ref and diff MO Subtrees but only for MOs where identical Dns

#(taking #the Dn Xlate into account) exist in the two subtrees. I.e. here for org-root/org-SubOrg1/org-SubOrgL1/org-SubOrgL2/org-SubOrgL3 which

#only exists in the ref subtree, no sync takes place

get-ucscentralorg | ? {$_.Name -like "*SubOrg*"} | select Name,Descr,Dn | format-table -AutoSize

Name     Descr                  Dn                                                         

----     -----                  --                                                         

SubOrg2  SubOrg2 Description    org-root/org-MiddleOrg/org-SubOrg2                         

SubOrgL1 SubOrg2 L1 Description org-root/org-MiddleOrg/org-SubOrg2/org-SubOrgL1            

SubOrgL2 SubOrg2 L2 Description org-root/org-MiddleOrg/org-SubOrg2/org-SubOrgL1/org-SubOrgL2

SubOrg1  SubOrg2 Description    org-root/org-SubOrg1                                       

SubOrgL1 SubOrg2 L1 Description org-root/org-SubOrg1/org-SubOrgL1                          

SubOrgL2 SubOrg2 L2 Description org-root/org-SubOrg1/org-SubOrgL1/org-SubOrgL2             

SubOrgL3 SubOrg1 L3 Description org-root/org-SubOrg1/org-SubOrgL1/org-SubOrgL2/org-SubOrgL3  <== NOT sync'ed

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Cisco UCS X-Series Energy Efficiency Offer