Stack Network Switch - Stack serial numbers are referenced to the master switch on the Network Switch PatternDescriptionThe Stacked Switches Section of the network switch pattern does not have a section to set the reference in the cmdb_serial_number record to the stacked switch CI - this results in the serial number record of the stacked switch serial number to be referenced to the master switch instead - when you look in the related lists between the two, it does appear that the master switch has all of the serial numbers.This can create an issue when the roles between master and slave are swapped as the identifier for serial number table seems to fail and create new records. There are also cases of IRE errors, like: Found multiple non-dependency relations [parent:'PARENT_CI_SYSID'/child:'CHILD_CI_SYSID'/type:'RELATIONSHIP_TYPE_SYSID'] between payload itemhttps://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0992755 Example: "error": "MULTI_MATCH","message": "Found multiple non-dependency relations [parent:'8af7a8936f3535802b5ee90d2c3ee436'/child:'8af7a8936f3535802b5ee90d2c3ee436'/type:'c8c685710b22130005d90d2835673aa8'] between payload items The error above means that the IRE is trying to insert a record of serial_number of Slave to the cmdb_serial_number which already exist in the cmdb_serial_number and belongs to Master switch. The workaround is solving this issue as well.Steps to Reproduce 1. Run Network Switch discovery against Stacked Switch.2. Check the discovered CIs.Notice that the master has reference to ALL Serial Numbers (SN), and the slave have no reference to a SN. This is incorrect, as each resource have one reference to its SN.WorkaroundSince San Diego, an updated pattern is present and creates the correct reference: the master switch has a reference to his serial number in the cmdb_serial_number table, and the slave switches have a reference to their cmdb_serial_number table. For older versions than San Diego, the attached update set sys_remote_update_set_1ed1981a1b3a8110fa738485604bcbe3.xml is available including the "Stacked Switches" library from San Diego needed to import, run, and perform Pattern Sync To Mid. Also a background script is available to check the cmdb_ci_ip_switch and cmdb_serial_number records, and validate if the serial_number matches and prints the results. Background script output example for IP 1.2.3.4: *** Script: Print problematic records for IP Address 1.2.3.4*** Script: There is no match between the Network Switch CI sys_id jkldfs0934lkjjef902334lkdfsf0934 and the cmdb_serial_number cmdb_ci jkldfs0934lkjjef902334lkdfsf0934*** Script: cmdb_ci_ip_switch.sys_id = jkldfs0934lkjjef902334lkdfsf0934, cmdb_ci_ip_switch.serial_number = FCW12345678, cmdb_ci_ip_switch.name = switch01-FCW12345678*** Script: cmdb_serial_number.cmdb_ci = jkldfs0934lkjjef902334lkdfsf0934, cmdb_serial_number.serial = FCW22111333 *** Script: PLAN: Deleting cmdb_serial_number.cmdb_ci = jkldfs0934lkjjef902334lkdfsf0934, cmdb_serial_number.serial = FCW22111333 *** Script: Print all records for IP Address 1.2.3.4 without an issue:*** Script: switch sys_id=jkldfs0934lkjjef902334lkdfsf0934, switch serial_number = FCW12345678, device.name = switch01-FCW12345678*** Script: serialCmdb.cmdb_ci =jkldfs0934lkjjef902334lkdfsf0934, serialCmdb.serial = FCW12345678*** Script: Print all records for IP Address 1.2.3.4 without an issue:*** Script: switch sys_id=hgdsk45khf345978dsfh398857723sd3, switch serial_number = FCW22111333, device.name = switch01*** Script: serialCmdb.cmdb_ci =hgdsk45khf345978dsfh398857723sd3, serialCmdb.serial = FCW22111333 We can see from the above output that one record has a mismatch between the Network Switch switch01-FCW12345678 serial number (FCW12345678) and the record in the cmdb_serial_number (FCW22111333). In this case the cmdb_serial_number record should be deleted.We can see also that there is a match for two other Network Switches: Network Switch switch01-FCW12345678 has a serial number (FCW12345678), and the record in the cmdb_serial_number (FCW12345678), and for Network Switch switch01 has a serial number (FCW22111333) and the record in the cmdb_serial_number (FCW22111333). How to run the background script:The background scripts have two mode options for running.Set mode:var mode = "read_only"; //This mode for only printing the wrong records. var mode = "delete"; //This mode prints the wrong records and deletes them as well.The deletions commands are left commented on purpose. If the actual deletion should happen, needs to remove the comments on lines 77 and 78. Set the ip_list variable:The background scripts have 3 ip_list options for running:var ip_list = ''; //Keep it empty for scanning all the Stack Network Switches in the CMDB.var ip_list = ['10.2.3.4','10.28.3.5','10.8.8.6','10.2.5.4']; //Write the IP Addresses in comma separated to check specific IPs. It can contains one IP as well (ip_list = ['1.2.3.4'];). var ip_list = 'print_problematic_ips'; //This option will print a list of all the Network Switch IPs that have unmatch serial number. Example for setting for read_only: 1. Copy and paste this script to "Script - Background" in the instance. 2. Set the script for read_only mode: var mode="read_only"; 3. Add relevant IP address to the ip_list in the script so we can work with 1 IP at a time (for example '10.28.3.5'):var ip_list = ['10.28.3.5'];4. Changed scope to global. 5. Run the script and analyze the results. Example for setting for deletion:1. Copy and paste this script to "Script - Background" in the instance. 2. Set the script for delete mode: var mode="delete"; 3. Uncomment lines 77 and 78 : // serialCmdb.setWorkflow(false);// serialCmdb.deleteRecord(); 4. Add relevant IP address to the ip_list in the script so we can work with 1 IP at a time (for example '10.28.3.5'):var ip_list = ['10.28.3.5'];5. Changed scope to global.6. Run the script, and analyze the results. Verify that the script successfully deleted the problematics master/stack switch cmdb_serial_number records.7. Run quick discovery on 10.28.3.5 and verify that the CIs are being created successfully/correctly and that there are no more errors in payload processing of the Network Switch pattern. Related Problem: PRB1536015