14 Replies Latest reply on Feb 17, 2017 7:12 AM by Andrew Waters

    Network Device Sync Issue

    Sagar Talreja

      Hello All,

       

      While synchronizing network device into CMDB, ADDM doesn't push the FQDN of those devices into Name field.

      But for Hosts, it sends the FQDN.

      If I want to push FQDN for Network devices as well, what changes I need to do in the default sync mapping TKU?

       

      ADDM Version:- 11.1.0.2

      TKU:- That came with Upgrade package

      NW.JPG

        • 1. Re: Network Device Sync Issue
          Andrew Waters

          That really depends upon where you are intending to find the value. There is no equivalent to local_fqdn.

          • 2. Re: Network Device Sync Issue
            Sagar Talreja

            Is there any way/field to find out FQDN and assign to name field?

            I was thinking to traverse #DeviceWithAddress:DeviceAddress:IPv4Address:IPAddress.fqdns as 'FQDNs'

            and fetch the fqdn.

            • 3. Re: Network Device Sync Issue
              Andrew Waters

              Which is the "right one"?

              • 4. Re: Network Device Sync Issue
                Sagar Talreja

                You mean to say, traversing will not work?

                Explaining in detail will be helpful Andrew.

                • 5. Re: Network Device Sync Issue
                  Andrew Waters

                  No - I don't mean to say that. I mean to say there are multiple IPAddress nodes - which one are you looking to pick what name out of the fully qualified domains?

                  • 6. Re: Network Device Sync Issue
                    Sagar Talreja

                    Hi Andrew,

                     

                    I wrote the tpl, but not sure whether it will work-

                     

                    tpl 1.12 module CMDB.NetworkDevice_ComputerSystem_FQDN;

                     

                    """

                    This TPL will sync FQDN in Name field of Computer system form for Network devices

                     

                    """

                    metadata

                        origin := "TKU";

                        tree_path := "BMC Discovery Operation", "CMDB Sync", "Network Device", "NetworkDevice -> ComputerSystem_FQDN";

                    end metadata;

                     

                    from CMDB.NetworkDevice_ComputerSystem import NetworkDevice_ComputerSystem 1.0

                     

                    syncmapping NetworkDevice_ComputerSystem_FQDN 1.0

                        """

                     

                        This is a customization. It does the following:

                     

                        Replace the name of the Network Device with FQDN

                       

                        """

                       

                        overview

                            tags CMDB, Extension;

                        end overview;

                     

                       

                        mapping from NetworkDevice_ComputerSystem.device as device

                        traverse DeviceWithAddress:DeviceAddress:IPv4Address:IPAddress as FQDN

                        end traverse;

                        end mapping;

                       

                      

                        body

                           

                            // log.info("Map network device %device.name%");

                     

                            computersystem=NetworkDevice_ComputerSystem.device_cs;

                           

                            if not FQDN.fqdns then

                                Name:=device.name;

                            else

                                Name:=FQDN.fqdns;

                            end if;

                           

                        end body;

                     

                    end syncmapping;

                    • 7. Re: Network Device Sync Issue
                      Andrew Waters

                      No this will not work.

                       

                      * You need to iterate over any traverse in the mapping section using a for loop.

                      * fqdns is a list of strings so you would need to pick one.

                      * Name is just a variable, you need to reference the NetworkDevice.

                       

                      Apart from that there is nothing meaning you will get consistent results. Devices can have multiple IPAddress nodes with multiple names.

                      2 of 2 people found this helpful
                      • 8. Re: Network Device Sync Issue
                        Sagar Talreja

                        Hi Andrew,

                         

                        Based on your feedback, did some changes to TPL-

                         

                        tpl 1.12 module CMDB.NetworkDevice_ComputerSystem_FQDN;

                         

                        ///This TPL will sync FQDN in Name field of Computer system form for Network devices

                         

                         

                        metadata

                            origin := "TKU";

                            tree_path := "BMC Discovery Operation", "CMDB Sync", "Network Device", "NetworkDevice -> ComputerSystem_FQDN";

                        end metadata;

                         

                        from CMDB.NetworkDevice_ComputerSystem import NetworkDevice_ComputerSystem 2.0;

                         

                        syncmapping NetworkDevice_ComputerSystem_FQDN 1.0

                            """

                         

                            This is a customization. It does the following:

                         

                            Replace the name of the Network Device with FQDN

                           

                            """

                            overview

                                tags CMDB, Extension;

                            end overview;

                           

                            mapping from NetworkDevice_ComputerSystem.device as device

                            traverse DeviceWithAddress:DeviceAddress:IPv4Address:IPAddress as FQDN

                            end traverse;

                            end mapping;

                              

                            body

                               

                                // log.info("Map network device %device.name%");

                         

                                computersystem:=NetworkDevice_ComputerSystem.device_cs;

                               

                                for each FQDN do

                                  if not FQDN.fqdns then

                                    computersystem.Name:=device.name;

                                  else

                                    computersystem.Name:=FQDN.fqdns;

                                  end if;

                                end for;

                            end body;

                         

                        end syncmapping;

                         

                         

                        What else need to be done to make this running effectively.

                        • 9. Re: Network Device Sync Issue
                          Andrew Waters

                          As I said fqdns is a list of strings so you cannot just assign it to computersystem.Name - it has the wrong type. You would need to pick a value out of the list, e.g. FQDN.fqdns[0];

                           

                          There is no specific order on names appearing in the fqdns list.

                          • 10. Re: Network Device Sync Issue
                            Sagar Talreja

                            Thanks Andrew for feedback.

                             

                            Based on the analysis and client's words, N/W device will have only one FQDN.

                            What if I put a loop on FQDN list and find out the first position in list for FQDN and assign it to computersystem.Name?

                            • 11. Re: Network Device Sync Issue
                              Sagar Talreja

                              I modified the assignment as fqdn[0].

                               

                              for each FQDN do

                                      if not FQDN.fqdns[0] then

                                           computersystem.Name:=device.name;

                                           log.debug("Map network device %device.name%  %FQDN% ,%FQDN.fqdns%");

                                       else

                                          computersystem.Name:=FQDN.fqdns[0];

                                          log.debug("Map network device %device.name%  %FQDN% ,%FQDN.fqdns%");

                                       end if;

                              end for;

                               

                              FQDN is now synced properly. However, there is error message while sync for devices who dont have any FQDN-

                               

                              nw2.JPG

                               

                              Same error seen in logs. Any way to avoid this error message as it seems to be a OOB error.

                              • 12. Re: Network Device Sync Issue
                                Andrew Waters

                                Your change broke things - if FQDN.dqdns does not exist they your test will fail causing the error you see.

                                 

                                Either you can filter the FQDN in the traverse by adding where fqdns defined

                                mapping from NetworkDevice_ComputerSystem.device as device

                                  traverse DeviceWithAddress:DeviceAddress:IPv4Address:IPAddress where fqdns defined as FQDN

                                  end traverse;

                                end mapping;

                                and use

                                for each FQDN do

                                  computersystem.Name := FQDN.fqdns[0];

                                  break;

                                end for;

                                or just update the loop.

                                for each FQDN do

                                  if FQDN.fqdns then

                                    computersystem.Name := FQDN.fqdns[0];

                                    break;

                                  end if;

                                end for;

                                • 13. Re: Network Device Sync Issue
                                  Sagar Talreja

                                  Many Thanks Andrew.It worked

                                   

                                  Just wanted to know what difference this "where fqdns defined" statement made to the tpl that ADDM stopped throwing the error.?

                                  • 14. Re: Network Device Sync Issue
                                    Andrew Waters

                                    It filters out the IPAddress nodes where the is no fdqns value present so all the FQDN nodes in the for loop will have fqdns present. Discovery will not put an empty list in fqdns so the existence of the attrbute means fqdns[0] will always be a valid value.

                                    1 of 1 people found this helpful