## Switchy ##
Switch client that can use unipede, switch api or ssh direct to gather switch port info and config, client and structures
Parsers will be added as needed to support any data source, currently it can support ctk and dcx autohost port naming conventions.

## Goals ##
Create a client that can be used in any number of libraries to allow easier reusability of functions.

## Switch Port Structure ##
```
         "switch_ports": [
            {
               "cab": 20,
               "core_device": 550883,
               "core_account": 1920573,
               "dc": "ORD1",
               "errors": null,
               "fe_port": 10116,
               "fe_aggregated_to": null,
               "mac_address_entries": null
               "migration": false,
               "port": 16,
               "port_name": "GigabitEthernet1/0/16",
               "port_config": null,
               "port_status": null,
               "port_type": "Public",
               "switch_name": "D2-20-1",
               "switch_num": 1,
            },
            {
               "cab": 20,
               "core_device": 550883,
               "core_account": 1920573,
               "dc": "ORD1",
               "errors": null,
               "fe_port": 10141,
               "fe_aggregated_to": null,
               "mac_address_entries": null
               "migration": false,
               "port": 41,
               "port_name": "GigabitEthernet1/0/41",
               "port_config": null,
               "port_status": null,
               "port_type": "AggExNet",
               "switch_name": "D2-20-2E",
               "switch_num": 2,
            }
         ],
```

## goctk support ##
Currently this structure has only been added to computer query light, more support will be added in the future.
Here is example of how to gather data from a ctk query

```
package main

import (
	"os"

	"github.rackspace.com/NSI/nsiutils/goctk"
	"github.rackspace.com/NSI/nsiutils/unipede"
	"github.rackspace.com/NSI/nsiutils/util"
)

func main() {
	devices := []int{527925, 527929, 628068, 628079}
   
    // initialize new unipede client
	u, err := unipede.New("user", "pass", "or token only") 
	util.ErrHandler(err)

    // new ctk client
	ctk := goctk.MustAuthToken("core session")

	// run a query light for devices
	res, err := ctk.ComputerQuery(devices)
	util.ErrHandler(err)

	// pull port name data for ports
	err = res.PortNames(u)
	util.ErrHandler(err)

    // print out the structure
	util.JsonPrint(res)
}
```

```
{
   "count": 1,
   "class": "Computer.Computer",
   "limit": 250,
   "result": [
      {
         "number": 550883,
         ...
         "ports.display_name": [
            "D2-20-1[16] (Public)",
            "D2-20-2E[41] (AggExNet)"
         ],
         "switch_ports": [
            {
               "cab": 20,
               "core_device": 550883,
               "core_account": 1920573,
               "dc": "ORD1",
               "errors": null,
               "fe_port": 10116,
               "fe_aggregated_to": null,
               "migration": false,
               "mac_address_entries": null
               "port": 16,
               "port_name": "GigabitEthernet1/0/16",
               "port_config": null,
               "port_status": null,
               "port_type": "Public",
               "switch_name": "D2-20-1",
               "switch_num": 1,
            },
            {
               "cab": 20,
               "core_device": 550883,
               "core_account": 1920573,
               "dc": "ORD1",
               "errors": null,
               "fe_port": 10141,
               "fe_aggregated_to": null,
               "migration": false,
               "mac_address_entries": null
               "port": 41,
               "port_name": "GigabitEthernet1/0/41",
               "port_config": null,
               "port_type": "AggExNet",
               "port_status": null,
               "switch_name": "D2-20-2E",
               "switch_num": 2,
            }
         ],
         ...
```
