Newer
Older
"crypto/tls"
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"net/http"
)
//MCPClient handles requests to a Ciena MCP RESTCONF endpoint
type MCPClient struct {
transport *httptransport.Runtime
client *apiclient.ServiceTopologyTAPI
func (c MCPClient) GetConfig() string {
//TODO: Fill with life
return "..."
}
//NewMCPClient creates a client
func NewMCPClient(endpoint, username, password string, database *database.Database) MCPClient {
transport.Transport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
transport.Debug = true
// create the API client, with the transport
basicAuth := httptransport.BasicAuth(username, password)
// authenticate client
transport.DefaultAuthentication = basicAuth
buf := make([]byte, 0)
transport.Consumers[runtime.JSONMime] = util.YANGConsumer{Data: &buf}
return MCPClient{
transport: transport,
client: client,
c.buf = nil
_, err := c.client.TapiConnectivityCore.GetTapiCoreContextConnection(nil)
c.buf = nil
_, err := c.client.TapiTopologyCore.GetTapiCoreContextTopologyMcpBaseTopologyNode(nil)
c.buf = nil
_, err := c.client.TapiTopologyCore.GetTapiCoreContextTopologyMcpBaseTopologyNodeEdgePoint(nil)