gen_path_callouts: Write callouts to JSON file

Save all of the Callout objects to a JSON file.  This is where the FRU
callout has its duplicates removed and is sorted based on priority.

This also adds a new Util module function getLocationCode to find the
location code of a target.

The JSON file is organized into sections for each callout type,
with keys based on the type.  I2c uses a bus and address, FSI uses a
link, and SPI uses a bus number. If FSI is combined with I2C or SPI,
then the link plus the I2C/SPI keys is used.  Multi-hop FSI links are
indicated by a dash in between the links, eg "0-1".  A contrived example
of an entry in the FSI section, on link 5, is:

"FSI":
{
   "5":
   {
      "Callouts":[
        {
           "Priority":"H"
           "LocationCode": "P1-C50",
           "MRU":"/sys-0/node-0/motherboard/proc_socket-0/module-0/power9-0",
           "Name":"/sys-0/node-0/motherboard/cpu0"
        },
        {
           "Priority":"M",
           "LocationCode": "P1-C42",
           "MRU":"/sys-0/node-0/motherboard/ebmc-card/BMC-0",
           "Name":"/sys-0/node-0/motherboard/ebmc-card"
        },
        {
           "Priority":"L",
           "LocationCode": "P1",
           "Name":"/sys-0/node-0/motherboard"
        }
     ],
     "Dest":"/sys-0/node-0/motherboard-0/proc_socket-0/module-0/power9-0",
     "Source":"/sys-0/node-0/motherboard-0/ebmc-card-connector-0/card-0/bmc-0"
   }
}

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Iee3493834d5045c553a52c80bbb62f7aa71140e0
2 files changed