This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Cloning an Atlas Map for use in almost identical locations

This use case covers taking an atlas map, with a small number of devices, and then cloning it, and updating the node & interface ID's of the comparable devices at multiple locations. For example, consider the use case where you have 100 small remote offices, all of which have 1 router, 1 switch, and 2 APs.

In this case, first you would simply export out the template map from the atlas (in a .orionmap extension), then the below function could be called 4 times, each time replacing the source info with the info for the matching device in the new location. In this particular example I have just hardcoded the details I want to find and replace, but it it's relatively trivial to add in these details via the SDK, importing from a CSV, etc. (In the code below, I've left in the original strings, to help understand the formatting)

<#

    

    #comment: "NetObjects=Orion.Nodes: 3,Orion.Nodes: 6,Orion.NPM.Interfaces: 3|2,Orion.NPM.Interfaces: 6|54"

    # text: "syd-2851"

    #SWTargetNodeID: "Orion.NPM.Interfaces: 6|54"

    #SWNetObjectNID: "Orion.Nodes: 3"

    #SWNetObjectNID: "Orion.Nodes: 3"

#>

function Update-OrionMaps

{

    [CmdletBinding()]

    [Alias()]

    [OutputType([int])]

    Param

    (

        # Param1 help description

        [Parameter(Mandatory=$true,

                   ValueFromPipelineByPropertyName=$true,

                   Position=0)]

        $MapPath,

        # Param2 help description

        [Parameter(Mandatory=$true,

                   ValueFromPipelineByPropertyName=$true)]

        [int]

        $OriginalNodeID,

       

        [Parameter(Mandatory=$true,

            ValueFromPipelineByPropertyName=$true)]

        [int]

        $OriginalInterfaceID,

       

        [Parameter(Mandatory=$true,

            ValueFromPipelineByPropertyName=$true)]

        [string]

        $OriginalCaption,

       

        [Parameter(Mandatory=$true,

            ValueFromPipelineByPropertyName=$true)]

        [int]

        $NewNodeID,

       

        [Parameter(Mandatory=$true,

            ValueFromPipelineByPropertyName=$true)]

        [int]

        $NewInterfaceID,

       

        [Parameter(Mandatory=$true,

            ValueFromPipelineByPropertyName=$true)]

        [string]

        $NewCaption

    )

    Begin

    {

      $NodeString = "Orion.Nodes: "

      $Interfacestring = "Orion.NPM.Interfaces: "

      $SourceContent = Get-Content $MapPath

    }

    Process

    {

      #$newContent =($SourceContent).Replace("Orion.Nodes: 3","Orion.Nodes: 1")

      $newContent =($SourceContent).Replace($NodeString+$OriginalNodeID,$NodeString+$NewNodeID)

      #$newContent =($NewContent).Replace("Orion.NPM.Interfaces: 3|2","Orion.NPM.Interfaces: 1|52")

      $newContent =($NewContent).Replace($Interfacestring+$OriginalNodeID+"|"+$OriginalInterfaceID, $Interfacestring+$NewNodeID+"|"+$NewInterfaceID)

      $newContent =($NewContent).Replace($OriginalCaption,$NewCaption)

    }

    End

    {

      Set-Content -Value $newContent -Path $MapPath -Force

    }

}

$SourceFile = 'C:\Temp\Template_Map.OrionMap'

$CloneFile = 'C:\temp\Clone.OrionMap'

Copy-Item -Path $SourceFile -Destination $CloneFile -Force

Update-OrionMaps -MapPath $CloneFile -OriginalNodeID 6 -OriginalInterfaceID 54 -OriginalCaption "bas-2960" -NewNodeID 1 -NewInterfaceID 52 -NewCaption "syd-2851"

Then, once all the files have been imported, the ImportMapBatch.exe located in "C:\Program Files (x86)\SolarWinds\Orion\Network Atlas\" can be used to do a bulk import once all the files have been created.

MapImportBatch.jpg