Hello,
I have been working on some scripts to automate some repetitive tasks in relation to merging two distinct Orion NPM platforms, but have hit some issues in getting this script working.
The purpose of the script is to compare all interfaces in two NPM installations and then remove all interfaces from installation B (Destination) that do not exist in installation A (Source). If the script determines that an interface is found to be in both installations it is left unchanged. The result should be that all interfaces on both installations are consistent (Unless there are additional interfaces on the source).
I have this script working perfectly in our development environment, but when executing the script on a backed up production environment I get odd results.
This is what’s happening, which is different from my exhaustive local testing.
The lookup is using the IP address of the Node and the InterfaceIndex as unique identifiers
1. Interfaces exist on both Orion instances with complete match i.e. all 5 Interfaces exist with the same InterfaceIndex
a. Result – No changes are made – this is correct and expected behaviour
2. Interface/s exist on Destination (B) but not on Source (A) AND Interfaces that exist on both
a. ALL interfaces are being deleted and not just the mismatches
i. This is unexpected behaviour
b. The logging output of the script shows the correct assessment and is tagging each Interface correctly i.e. Interfaces with Result of 1 are identified as not existing on both and 0 is where they exist on both and should therefore be left alone
c. Orion logging is showing that ONLY those interfaces that are being matched are being deleted. NO Orion logging is being performed for the Interfaces that a not matched and are deleted
i. This is odd behaviour as if an interface is being deleted via the API, it should be logged regardless
Orion versions v10.3
API v1.5
Powershell script
I would appreciate any help on this.
Regards,
Ben