cvpapi

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2020 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Action                          string   `json:"action"`
	ConfigletBuilderList            []string `json:"configletBuilderList"`
	ConfigletBuilderNamesList       []string `json:"configletBuilderNamesList"`
	ConfigletList                   []string `json:"configletList"`
	ConfigletNamesList              []string `json:"configletNamesList"`
	FromID                          string   `json:"fromId"`
	FromName                        string   `json:"fromName"`
	IgnoreConfigletBuilderList      []string `json:"ignoreConfigletBuilderList"`
	IgnoreConfigletBuilderNamesList []string `json:"ignoreConfigletBuilderNamesList"`
	IgnoreConfigletList             []string `json:"ignoreConfigletList"`
	IgnoreConfigletNamesList        []string `json:"ignoreConfigletNamesList"`
	IgnoreNodeID                    string   `json:"ignoreNodeId"`
	IgnoreNodeName                  string   `json:"ignoreNodeName"`
	Info                            string   `json:"info"`
	InfoPreview                     string   `json:"infoPreview"`
	NodeID                          string   `json:"nodeId"`
	NodeIPAddress                   string   `json:"nodeIpAddress"`
	NodeName                        string   `json:"nodeName"`
	NodeTargetIPAddress             string   `json:"nodeTargetIpAddress"`
	NodeType                        string   `json:"nodeType"`
	ToID                            string   `json:"toId"`
	ToIDType                        string   `json:"toIdType"`
	ToName                          string   `json:"toName"`

	CCID                 string   `json:"ccId,omitempty"`
	ID                   int      `json:"id,omitempty"`
	Note                 string   `json:"note,omitempty"`
	ChildTasks           []string `json:"childTasks,omitempty"`
	ParentTask           string   `json:"parentTask,omitempty"`
	FactoryID            int      `json:"factoryId,omitempty"`
	BestImageContainerID string   `json:"bestImageContainerId,omitempty"`
	SessionID            string   `json:"sessionId,omitempty"`
	ContainerKey         string   `json:"containerKey,omitempty"`
	TaskID               int      `json:"taskId,omitempty"`
	OldNodeName          string   `json:"oldNodeName,omitempty"`
	NodeList             []string `json:"nodeList,omitempty"`
	IgnoreNodeList       []string `json:"ignoreNodeList,omitempty"`
	NodeNamesList        []string `json:"nodeNamesList,omitempty"`
	IgnoreNodeNamesList  []string `json:"ignoreNodeNamesList,omitempty"`
	UserID               string   `json:"userId,omitempty"`
	Key                  string   `json:"key,omitempty"`
	ImageBundleID        string   `json:"imageBundleId,omitempty"`
	Mode                 string   `json:"mode,omitempty"`
	Timestamp            float64  `json:"timestamp,omitempty"`
	PageType             string   `json:"pageType,omitempty"`
	ViaContainer         bool     `json:"viaContainer,omitempty"`
}

Action request structure for saveTopology

type ActionRequest

type ActionRequest struct {
	Data []Action `json:"data,omitempty"`
}

ActionRequest request structure for saveTopology

type AddNotesToChangeControlResp added in v1.0.0

type AddNotesToChangeControlResp struct {
	Data string `json:"data"`

	ErrorResponse
}

AddNotesToChangeControlResp is the response returned for addNotesToChangeControl API call

type AddOrUpdateChangeControlResp added in v1.0.0

type AddOrUpdateChangeControlResp struct {
	Data string `json:"data"`
	CcID string `json:"ccId"`

	ErrorResponse
}

AddOrUpdateChangeControlResp is the response returned for addOrUpdateChangeControl API call

type ChangeControl added in v1.0.0

type ChangeControl struct {
	CreatedBy             string `json:"createdBy"`
	FactoryID             int    `json:"factoryId"`
	TaskEndTime           int64  `json:"taskEndTime"`
	DeviceCount           int    `json:"deviceCount"`
	StopOnError           bool   `json:"stopOnError"`
	ID                    int    `json:"id"`
	ScheduledTimestamp    int64  `json:"scheduledTimestamp"`
	CountryID             string `json:"countryId"`
	CcID                  string `json:"ccId"`
	PreSnapshotEndTime    int64  `json:"preSnapshotEndTime"`
	TaskCount             int    `json:"taskCount"`
	TaskStartTime         int64  `json:"taskStartTime"`
	ScheduledBy           string `json:"scheduledBy"`
	ScheduledByPassword   string `json:"scheduledByPassword"`
	Type                  string `json:"type"`
	Status                string `json:"status"`
	PreSnapshotStartTime  int64  `json:"preSnapshotStartTime"`
	PostSnapshotEndTime   int64  `json:"postSnapshotEndTime"`
	CreatedTimestamp      int64  `json:"createdTimestamp"`
	Key                   string `json:"key"`
	CcName                string `json:"ccName"`
	ExecutedTimestamp     int64  `json:"executedTimestamp"`
	ExecutedBy            string `json:"executedBy"`
	ClassID               int    `json:"classId"`
	ContainerName         string `json:"containerName"`
	StopOnErrorStatus     string `json:"stopOnErrorStatus"`
	Notes                 string `json:"notes"`
	DateTime              string `json:"dateTime"`
	PostSnapshotStartTime int64  `json:"postSnapshotStartTime"`
	ContainerKey          string `json:"containerKey"`
	TimeZone              string `json:"timeZone"`

	ErrorResponse
}

ChangeControl represents a CVP Change Control object

type ChangeControlList added in v1.0.0

type ChangeControlList struct {
	Total int             `json:"total"`
	Data  []ChangeControl `json:"data"`

	ErrorResponse
}

ChangeControlList represents a return data for getting a list of all change controls

type ChangeControlTask added in v1.0.0

type ChangeControlTask struct {
	ContainerName              string `json:"containerName"`
	CurrentTaskName            string `json:"currentTaskName"`
	Description                string `json:"description"`
	CreatedOnInLongFormat      int64  `json:"createdOnInLongFormat"`
	WorkOrderID                string `json:"workOrderId"`
	NetElementHostName         string `json:"netElementHostName"`
	Note                       string `json:"note"`
	NetElementID               string `json:"netElementId"`
	CreatedBy                  string `json:"createdBy"`
	TemplateID                 string `json:"templateId"`
	ExecutedOnInLongFormat     int64  `json:"executedOnInLongFormat"`
	ExecutedBy                 string `json:"executedBy"`
	WorkOrderUserDefinedStatus string `json:"workOrderUserDefinedStatus"`
	IPAddress                  string `json:"ipAddress"`
	Model                      string `json:"model"`
	WorkOrderState             string `json:"workOrderState"`
	CcID                       string `json:"ccId"`

	ErrorResponse
}

ChangeControlTask represents a task

type ChangeControlTaskInfo added in v1.0.0

type ChangeControlTaskInfo struct {
	TaskID              string `json:"taskId"`
	TaskOrder           int    `json:"taskOrder"`
	SnapshotTemplateKey string `json:"snapshotTemplateKey"`
	ClonedCcID          string `json:"clonedCcId"`
}

ChangeControlTaskInfo represents task info to be used for applying a task to an existing or new change control.

type ChangeControlTaskList added in v1.0.0

type ChangeControlTaskList struct {
	Total int                 `json:"total"`
	Data  []ChangeControlTask `json:"data"`

	ErrorResponse
}

ChangeControlTaskList represents a return data for getting a list of tasks available for change control

type ClientInterface

type ClientInterface interface {
	Get(string, *url.Values) ([]byte, error)
	Post(string, *url.Values, interface{}) ([]byte, error)
}

The ClientInterface is implemented by a client to allow interaction with CVP REST

type ComplianceResp

type ComplianceResp struct {
	Architecture         string    `json:"architecture"`
	BootupTimeStamp      float64   `json:"bootupTimeStamp"`
	ComplianceCode       string    `json:"complianceCode"`
	ComplianceIndication string    `json:"complianceIndication"`
	DeviceStatus         string    `json:"deviceStatus"`
	DeviceStatusInfo     string    `json:"deviceStatusInfo"`
	Fqdn                 string    `json:"fqdn"`
	HardwareRevision     string    `json:"hardwareRevision"`
	InternalBuildID      string    `json:"internalBuildId"`
	InternalVersion      string    `json:"internalVersion"`
	IPAddress            string    `json:"ipAddress"`
	IsDANZEnabled        string    `json:"isDANZEnabled"`
	IsMLAGEnabled        string    `json:"isMLAGEnabled"`
	Key                  string    `json:"key"`
	LastSyncUp           int64     `json:"lastSyncUp"`
	MemFree              int       `json:"memFree"`
	MemTotal             int       `json:"memTotal"`
	ModelName            string    `json:"modelName"`
	SerialNumber         string    `json:"serialNumber"`
	SystemMacAddress     string    `json:"systemMacAddress"`
	TaskIDList           []CvpTask `json:"taskIdList"`
	Type                 string    `json:"type"`
	UnAuthorized         bool      `json:"unAuthorized"`
	Version              string    `json:"version"`
	ZtpMode              string    `json:"ztpMode"`

	ErrorResponse
}

ComplianceResp represents a response from a Compliance check

type Configlet

type Configlet struct {
	IsDefault            string `json:"isDefault"`
	DateTimeInLongFormat int64  `json:"dateTimeInLongFormat"`
	ContainerCount       int    `json:"containerCount"`
	NetElementCount      int    `json:"netElementCount"`
	IsAutoBuilder        string `json:"isAutoBuilder"`
	Reconciled           bool   `json:"reconciled"`
	FactoryID            int    `json:"factoryId"`
	Config               string `json:"config"`
	User                 string `json:"user"`
	Note                 string `json:"note"`
	Name                 string `json:"name"`
	Key                  string `json:"key"`
	ID                   int    `json:"id"`
	Type                 string `json:"type"`

	ErrorResponse
}

Configlet represents a Configlet

func (Configlet) String

func (c Configlet) String() string

type ConfigletHistoryEntry

type ConfigletHistoryEntry struct {
	ConfigletID                 string `json:"configletId"`
	OldUserID                   string `json:"oldUserId"`
	NewUserID                   string `json:"newUserId"`
	OldConfig                   string `json:"oldConfig"`
	NewConfig                   string `json:"newConfig"`
	OldDate                     string `json:"oldDate"`
	NewDate                     string `json:"newDate"`
	OldDateTimeInLongFormat     int64  `json:"oldDateTimeInLongFormat"`
	UpdatedDateTimeInLongFormat int64  `json:"updatedDateTimeInLongFormat"`
	FactoryID                   int    `json:"factoryId"`
	Key                         string `json:"key"`
	ID                          int    `json:"id"`
}

ConfigletHistoryEntry represents a configlet history entry

type ConfigletHistoryList

type ConfigletHistoryList struct {
	Total       int                     `json:"total"`
	HistoryList []ConfigletHistoryEntry `json:"configletHistory"`

	ErrorResponse
}

ConfigletHistoryList represents a list of ConfigletHistoryEntry's

type ConfigletInfo

type ConfigletInfo struct {
	Total           int                         `json:"total"`
	ConfigletMapper map[string]ConfigletMapping `json:"configletMapper"`
	ConfigletList   []Configlet                 `json:"configletList"`

	ErrorResponse
}

ConfigletInfo represents the configlets for a netelemet

type ConfigletList

type ConfigletList struct {
	Total int         `json:"total"`
	Data  []Configlet `json:"data"`

	ErrorResponse
}

ConfigletList represents a list of configlets

type ConfigletMapping added in v0.2.0

type ConfigletMapping struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

ConfigletMapping represents basic info related to a Configlet

type ConfigletOpReturn

type ConfigletOpReturn struct {
	Data Configlet `json:"data"`

	ErrorResponse
}

ConfigletOpReturn represents the

type ConfigletVerifyResp added in v1.0.0

type ConfigletVerifyResp struct {
	ID      string `json:"id,omitempty"`
	JSONRPC string `json:"jsonrpc,omitempty"`
	Result  []struct {
		Output   string   `json:"output"`
		Messages []string `json:"messages,omitempty"`
	} `json:"result"`
	Warnings     []VerifyWarning `json:"warnings"`
	WarningCount int             `json:"warningCount"`
	Errors       []VerifyError   `json:"errors,omitempty"`
	ErrorCount   int             `json:"errorCount,omitempty"`
}

ConfigletVerifyResp represents

type Container

type Container struct {
	ChildContainerID bool   `json:"childContainerId"`
	FactoryID        int    `json:"factoryId"`
	ID               int    `json:"id"`
	Key              string `json:"key"`
	Name             string `json:"name"`
	ParentID         string `json:"parentId"`
	Type             string `json:"type"`
	UserID           string `json:"userId"`
}

Container is

type ContainerData

type ContainerData struct {
	Undefined            bool   `json:"undefined"`
	UserID               string `json:"userId"`
	DateTimeInLongFormat int64  `json:"dateTimeInLongFormat"`
	FactoryID            int    `json:"factoryId"`
	Root                 bool   `json:"root"`
	Mode                 string `json:"mode"`
	Name                 string `json:"name"`
	Key                  string `json:"key"`
	ID                   int    `json:"id"`
}

ContainerData represents a container within CVP

type ContainerList

type ContainerList struct {
	Total         int         `json:"total"`
	ContainerList []Container `json:"data"`

	ErrorResponse
}

ContainerList is a list of NetElements and Containers

type CvpInfo

type CvpInfo struct {
	AppVersion string `json:"appVersion"`
	Version    string `json:"version"`
}

CvpInfo represents Cvp specific information

func (CvpInfo) String

func (i CvpInfo) String() string

type CvpInventoryConfiguration added in v1.0.0

type CvpInventoryConfiguration struct {
	Output   string   `json:"output"`
	Warnings []string `json:"warnings"`

	ErrorResponse
}

CvpInventoryConfiguration is the config and warnings for a device

type CvpInventoryList

type CvpInventoryList struct {
	Total          int               `json:"total"`
	ContainerList  map[string]string `json:"containerList"`
	NetElementList []NetElement      `json:"netElementList"`

	ErrorResponse
}

CvpInventoryList is a list of NetElements and Containers

type CvpLabelList added in v0.2.0

type CvpLabelList struct {
	Total     int     `json:"total"`
	LabelList []Label `json:"labels"`

	ErrorResponse
}

CvpLabelList is a list of Labels

type CvpLogList

type CvpLogList struct {
	Total int       `json:"total"`
	Data  []LogData `json:"data"`

	ErrorResponse
}

CvpLogList represents the log list for a specific task

type CvpRestAPI

type CvpRestAPI struct {
	// contains filtered or unexported fields
}

CvpRestAPI provides the REST functionallity

func NewCvpRestAPI

func NewCvpRestAPI(client ClientInterface) *CvpRestAPI

NewCvpRestAPI creates a new Rest API

func (CvpRestAPI) AddConfiglet

func (c CvpRestAPI) AddConfiglet(name string, config string) (*Configlet, error)

AddConfiglet creates/adds a configlet

func (CvpRestAPI) AddConfigletNote added in v1.0.0

func (c CvpRestAPI) AddConfigletNote(key string, note string) error

AddConfigletNote creates/adds a configlet note

func (CvpRestAPI) AddContainer

func (c CvpRestAPI) AddContainer(containerName, parentName,
	parentKey string) error

AddContainer adds the container to the specified parent.

func (CvpRestAPI) AddLabel added in v0.2.0

func (c CvpRestAPI) AddLabel(name string, note string, labeltype string) (*Label, error)

AddLabel adds a label

func (CvpRestAPI) AddNoteToTask

func (c CvpRestAPI) AddNoteToTask(taskID int, note string) error

AddNoteToTask adds a note to the task represented by taskID

func (CvpRestAPI) AddNotesToChangeControl added in v1.0.0

func (c CvpRestAPI) AddNotesToChangeControl(ccID int, notes string) error

AddNotesToChangeControl adds a note to the Change Control represented by ccID

func (CvpRestAPI) AddToInventory added in v0.3.0

func (c CvpRestAPI) AddToInventory(deviceIPAddress, parentContainerName,
	parentContainerID string) error

AddToInventory Add device to the Cvp inventory. Warning -- Method doesn't check the existance of the parent container

func (CvpRestAPI) ApplyConfigletToDevice

func (c CvpRestAPI) ApplyConfigletToDevice(appName string, dev *NetElement,
	newConfiglet *Configlet, commit bool) (*TaskInfo, error)

ApplyConfigletToDevice apply the configlets to the device.

func (CvpRestAPI) ApplyConfigletsToDevice

func (c CvpRestAPI) ApplyConfigletsToDevice(appName string, dev *NetElement, commit bool,
	newConfiglets ...Configlet) (*TaskInfo, error)

ApplyConfigletsToDevice apply the configlets to the device.

func (CvpRestAPI) ApplyImageToContainer

func (c CvpRestAPI) ApplyImageToContainer(imageInfo *ImageBundleInfo, container *Container,
	commit bool) (*TaskInfo, error)

ApplyImageToContainer Applies image bundle to container

func (CvpRestAPI) ApplyImageToDevice

func (c CvpRestAPI) ApplyImageToDevice(imageInfo *ImageBundleInfo, netElement *NetElement,
	commit bool) (*TaskInfo, error)

ApplyImageToDevice Applies image bundle to device

func (CvpRestAPI) CancelTask

func (c CvpRestAPI) CancelTask(taskID int) error

CancelTask cancels the task given the taskID

func (CvpRestAPI) CheckCompliance

func (c CvpRestAPI) CheckCompliance(nodeKey string, nodeType string) (*ComplianceResp, error)

CheckCompliance Check that a device is in compliance, that is the configlets applied to the device match the devices running configuration.

Supported only for NetElements

func (CvpRestAPI) CreateChangeControl added in v1.0.0

func (c CvpRestAPI) CreateChangeControl(ccName, timeZone, countryID, dateTime, snapshotTemplateKey,
	changeControlType, stopOnError string, tasks []ChangeControlTaskInfo) (string, error)

CreateChangeControl adds a note to the Change Control represented by ccID

func (CvpRestAPI) DeleteConfiglet

func (c CvpRestAPI) DeleteConfiglet(name string, key string) error

DeleteConfiglet deletes a configlet.

func (CvpRestAPI) DeleteContainer

func (c CvpRestAPI) DeleteContainer(containerName, containerKey,
	parentName, parentKey string) error

DeleteContainer deletes the container from the specified parent.

func (CvpRestAPI) DeleteDevice added in v0.3.0

func (c CvpRestAPI) DeleteDevice(deviceMac string) error

DeleteDevice Remove device from the Cvp inventory

func (CvpRestAPI) DeleteDevices added in v0.3.0

func (c CvpRestAPI) DeleteDevices(deviceMacs []string) error

DeleteDevices Remove devices from the Cvp inventory

func (CvpRestAPI) DeleteLabelByKey added in v0.2.0

func (c CvpRestAPI) DeleteLabelByKey(key string) error

DeleteLabelByKey deletes a Label using key.

func (CvpRestAPI) DeleteLabelByName added in v0.2.0

func (c CvpRestAPI) DeleteLabelByName(name string) error

DeleteLabelByName deletes a Label using its name

func (CvpRestAPI) DeleteLabelsByKey added in v0.2.0

func (c CvpRestAPI) DeleteLabelsByKey(keys []string) error

DeleteLabelsByKey deletes a group of Labels using list of their respective Keys.

func (CvpRestAPI) DeployDevice

func (c CvpRestAPI) DeployDevice(netElement *NetElement, container *Container,
	configlets ...Configlet) (*TaskInfo, error)

DeployDevice Move a device from the undefined container to a target container. Optionally, apply device-specific configlets to the device.

func (CvpRestAPI) DeployDeviceWithImage

func (c CvpRestAPI) DeployDeviceWithImage(netElement *NetElement, container *Container,
	image string, configlets ...Configlet) (*TaskInfo, error)

DeployDeviceWithImage Move a device from the undefined container to a target container and apply image. Optionally, apply device-specific configlets to the device.

func (CvpRestAPI) ExecuteTask

func (c CvpRestAPI) ExecuteTask(taskID int) error

ExecuteTask executes a task given the taskID.

func (CvpRestAPI) GetAllConfigletHistory

func (c CvpRestAPI) GetAllConfigletHistory(key string) (*ConfigletHistoryList, error)

GetAllConfigletHistory returns all the history for a given configlet

func (CvpRestAPI) GetAllContainers

func (c CvpRestAPI) GetAllContainers() (*ContainerList, error)

GetAllContainers returns all current inventory Containers

func (CvpRestAPI) GetAllDevices

func (c CvpRestAPI) GetAllDevices() ([]NetElement, error)

GetAllDevices returns CvpInventoryList of all current inventory

func (CvpRestAPI) GetAllImageBundles

func (c CvpRestAPI) GetAllImageBundles() ([]ImageBundleInfo, error)

GetAllImageBundles gets all ImageBundles

func (CvpRestAPI) GetAllTasks

func (c CvpRestAPI) GetAllTasks() ([]CvpTask, error)

GetAllTasks returns a list of all the tasks.

func (CvpRestAPI) GetAllTempActions added in v0.2.0

func (c CvpRestAPI) GetAllTempActions(start, end int) ([]Action, error)

GetAllTempActions gets the list of current actions outstanding

func (CvpRestAPI) GetChangeControlAvailableTasks added in v1.0.0

func (c CvpRestAPI) GetChangeControlAvailableTasks(
	querystr string, start int, end int) ([]ChangeControlTask, error)

GetChangeControlAvailableTasks returns a list of ChangeControlTask's.

Failed search returns empty

{
  "total": 0,
  "data": []
}

func (CvpRestAPI) GetChangeControls added in v1.0.0

func (c CvpRestAPI) GetChangeControls(
	querystr string, start int, end int) ([]ChangeControl, error)

GetChangeControls returns a list of ChangeControls.

Failed search returns empty

{
  "total": 0,
  "data": []
}

func (CvpRestAPI) GetConfigletByName

func (c CvpRestAPI) GetConfigletByName(name string) (*Configlet, error)

GetConfigletByName returns the configlet with the specified name

func (CvpRestAPI) GetConfigletHistory

func (c CvpRestAPI) GetConfigletHistory(key string, start int,
	end int) (*ConfigletHistoryList, error)

GetConfigletHistory returns the history for a configlet provided the key, and a range.

func (CvpRestAPI) GetConfigletsByDeviceID

func (c CvpRestAPI) GetConfigletsByDeviceID(mac string) ([]Configlet, error)

GetConfigletsByDeviceID returns the list of configlets applied to a device.

func (CvpRestAPI) GetContainer

func (c CvpRestAPI) GetContainer(querystr string, start int, end int) (*ContainerList, error)

GetContainer returns The endpoint searchContainers.do will not return the Undefined_Container in the list

func (CvpRestAPI) GetContainerByName

func (c CvpRestAPI) GetContainerByName(name string) (*Container, error)

GetContainerByName returns a Container

func (CvpRestAPI) GetCvpInfo

func (c CvpRestAPI) GetCvpInfo() (*CvpInfo, error)

GetCvpInfo returns the CvpInfo from the Client connection.

func (CvpRestAPI) GetDeviceByID added in v0.2.0

func (c CvpRestAPI) GetDeviceByID(mac string) (*NetElement, error)

GetDeviceByID returns NetElement info related to a device mac.

func (CvpRestAPI) GetDeviceByName

func (c CvpRestAPI) GetDeviceByName(fqdn string) (*NetElement, error)

GetDeviceByName returns a CvpInventoryList based on device name provided

func (CvpRestAPI) GetDeviceConfigletInfo added in v0.2.0

func (c CvpRestAPI) GetDeviceConfigletInfo(mac string) (*ConfigletInfo, error)

GetDeviceConfigletInfo returns all configlet info related to a device.

func (CvpRestAPI) GetDeviceContainer added in v0.2.0

func (c CvpRestAPI) GetDeviceContainer(mac string) (*Container, error)

GetDeviceContainer returns a Container this device is allocated to

func (CvpRestAPI) GetDevicesInContainer

func (c CvpRestAPI) GetDevicesInContainer(name string) ([]NetElement, error)

GetDevicesInContainer returns a CvpInventoryList based on container name provided

func (CvpRestAPI) GetImageBundleByName

func (c CvpRestAPI) GetImageBundleByName(name string) (*ImageBundleInfo, error)

GetImageBundleByName gets ImageBundle by specified name

func (CvpRestAPI) GetImageBundles

func (c CvpRestAPI) GetImageBundles(querystr string, start, end int) ([]ImageBundleInfo, error)

GetImageBundles returns a list of ImageBundles based on a specific query string and range

func (CvpRestAPI) GetImageByName added in v0.3.0

func (c CvpRestAPI) GetImageByName(name string) (*ImageInfo, error)

GetImageByName returns an ImageInfo object based on name provided

func (CvpRestAPI) GetImages

func (c CvpRestAPI) GetImages(querystr string, start int, end int) ([]ImageInfo, error)

GetImages returns a list of Images based on a specific query string and range

func (CvpRestAPI) GetInventory

func (c CvpRestAPI) GetInventory(querystr string, start int, end int) (*CvpInventoryList, error)

GetInventory returns a CvpInventoryList based on a provided query and range.

Failed search returns empty

{
  "total": 0,
  "containerList": {},
  "netElementList": []
}

func (CvpRestAPI) GetInventoryConfiguration added in v1.0.0

func (c CvpRestAPI) GetInventoryConfiguration(
	macAddress string) (*CvpInventoryConfiguration, error)

GetInventoryConfiguration returns a CvpInventoryConfiguration based on a provided MAC Address.

Failed search returns empty

{
  "output": "",
  "warnings": [],
}

func (CvpRestAPI) GetLabel added in v0.2.0

func (c CvpRestAPI) GetLabel(name string) (*Label, error)

GetLabel returns the label for name provided.

func (CvpRestAPI) GetLabelInfo added in v0.2.0

func (c CvpRestAPI) GetLabelInfo(labelID string) (*Label, error)

GetLabelInfo returns the label info for the specified labelID

func (CvpRestAPI) GetLabels added in v0.2.0

func (c CvpRestAPI) GetLabels(module, labelType, searchStr string,
	start int, end int) ([]Label, error)

GetLabels returns the labels for

func (CvpRestAPI) GetLogs

func (c CvpRestAPI) GetLogs(taskID int, start int, end int) ([]LogData, error)

GetLogs returns the log entries for the task with the specified taskID and within the provide start/end range.

func (CvpRestAPI) GetLogsByID

func (c CvpRestAPI) GetLogsByID(taskID int) ([]LogData, error)

GetLogsByID returns the log entries for the task with the specified taskID.

func (CvpRestAPI) GetNonConnectedDeviceCount added in v0.3.0

func (c CvpRestAPI) GetNonConnectedDeviceCount() (int, error)

GetNonConnectedDeviceCount returns number of devices not connected

func (CvpRestAPI) GetParentContainerForDevice

func (c CvpRestAPI) GetParentContainerForDevice(deviceMAC string) (*Container, error)

GetParentContainerForDevice returns the Container for specified deviceMAC

func (CvpRestAPI) GetTaskByID

func (c CvpRestAPI) GetTaskByID(taskID int) (*CvpTask, error)

GetTaskByID returns the current Task for the specified taskID.

func (CvpRestAPI) GetTaskByStatus

func (c CvpRestAPI) GetTaskByStatus(status string) ([]CvpTask, error)

GetTaskByStatus returns a list of all tasks with the given status.

func (CvpRestAPI) GetTasks

func (c CvpRestAPI) GetTasks(queryStr string, start int, end int) ([]CvpTask, error)

GetTasks returns the current CVP Tasks that match the provided string and within the provided start/end range.

func (CvpRestAPI) GetTempAction added in v0.2.0

func (c CvpRestAPI) GetTempAction() (*Action, error)

GetTempAction returns the first outstanding action

func (CvpRestAPI) GetTempConfigByNetElementID

func (c CvpRestAPI) GetTempConfigByNetElementID(netElementID string) (*TempConfig, error)

GetTempConfigByNetElementID gets the current temporary config for the supplied netElement

func (CvpRestAPI) GetUndefinedDevices

func (c CvpRestAPI) GetUndefinedDevices() ([]NetElement, error)

GetUndefinedDevices returns a NetElement list of devices within the Undefined container

func (*CvpRestAPI) Login

func (c *CvpRestAPI) Login(username, password string) (*LoginResp, error)

Login perform loging and save off cookies

func (*CvpRestAPI) Logout

func (c *CvpRestAPI) Logout() error

Logout perform logout

func (CvpRestAPI) MoveDeviceToContainer

func (c CvpRestAPI) MoveDeviceToContainer(device *NetElement, container *Container,
	commit bool) (*TaskInfo, error)

MoveDeviceToContainer moves a specified netelement to a container.

func (CvpRestAPI) RemoveConfigletFromDevice

func (c CvpRestAPI) RemoveConfigletFromDevice(appName string, dev *NetElement,
	remConfiglet *Configlet, commit bool) (*TaskInfo, error)

RemoveConfigletFromDevice Remove the configlets from the device.

func (CvpRestAPI) RemoveConfigletsFromDevice

func (c CvpRestAPI) RemoveConfigletsFromDevice(appName string, dev *NetElement, commit bool,
	remConfiglets ...Configlet) (*TaskInfo, error)

RemoveConfigletsFromDevice Remove the configlets from the device.

func (CvpRestAPI) RemoveImageFromContainer

func (c CvpRestAPI) RemoveImageFromContainer(imageInfo *ImageBundleInfo,
	container *Container) (*TaskInfo, error)

RemoveImageFromContainer removes image bundle from container

func (CvpRestAPI) ResetDevice added in v0.2.0

func (c CvpRestAPI) ResetDevice(appName string, dev *NetElement,
	container *Container, commit bool) (*TaskInfo, error)

ResetDevice Resets/Reboots the device to factory setting.

func (CvpRestAPI) SaveInventory added in v0.3.0

func (c CvpRestAPI) SaveInventory() (*SaveInventoryData, error)

SaveInventory saves the current CVP inventory

func (CvpRestAPI) SaveTopology

func (c CvpRestAPI) SaveTopology() (*TaskInfo, error)

SaveTopology Schedule tasks for many operations like configlet and image bundle mapping/removal to/from device or container, addition/deletion of containers, deletion of device. Return a list of taskIds created in response to saving the topology.

func (CvpRestAPI) SearchConfiglets

func (c CvpRestAPI) SearchConfiglets(searchStr string) (*ConfigletList, error)

SearchConfiglets search function for configlets.

func (CvpRestAPI) SearchConfigletsWithRange

func (c CvpRestAPI) SearchConfigletsWithRange(searchStr string, start int,
	end int) (*ConfigletList, error)

SearchConfigletsWithRange search function for configlets.

func (CvpRestAPI) SearchTopology

func (c CvpRestAPI) SearchTopology(query string) (*SearchTopologyResp, error)

SearchTopology searches the topology for items matching the query parameter.

func (CvpRestAPI) SearchTopologyWithRange

func (c CvpRestAPI) SearchTopologyWithRange(querystr string, start int,
	end int) (*SearchTopologyResp, error)

SearchTopologyWithRange searches the topology for items matching the query parameter and returning those within the specified range.

If query yields no hits, then result is (SearchTopologyResp{})

func (CvpRestAPI) UpdateConfiglet

func (c CvpRestAPI) UpdateConfiglet(config string, name string, key string) error

UpdateConfiglet updates a configlet.

func (CvpRestAPI) UpdateLabel added in v0.2.0

func (c CvpRestAPI) UpdateLabel(name, key, note, labelType string) error

UpdateLabel updates a configlet.

func (CvpRestAPI) UpdateLabelNote added in v0.2.0

func (c CvpRestAPI) UpdateLabelNote(key, note string) error

UpdateLabelNote updates a label note.

func (CvpRestAPI) VerifyConfig added in v1.0.0

func (c CvpRestAPI) VerifyConfig(netElement string, config string) error

VerifyConfig verifies a configlet config config

type CvpTask

type CvpTask struct {
	TemplateID                 string          `json:"templateId"`
	CurrentTaskType            string          `json:"currentTaskType"`
	TaskStatus                 string          `json:"taskStatus"`
	CurrentTaskName            string          `json:"currentTaskName"`
	ExecutedBy                 string          `json:"executedBy"`
	WorkOrderUserDefinedStatus string          `json:"workOrderUserDefinedStatus"`
	WorkOrderID                string          `json:"workOrderId"`
	WorkOrderState             string          `json:"workOrderState"`
	CreatedBy                  string          `json:"createdBy"`
	ExecutedOnInLongFormat     int64           `json:"executedOnInLongFormat"`
	WorkOrderDetails           WorkOrderDetail `json:"workOrderDetails"`
	CreatedOnInLongFormat      int64           `json:"createdOnInLongFormat"`
	Data                       WorkData        `json:"data"`
	Description                string          `json:"description"`
	Note                       string          `json:"note"`
	Name                       string          `json:"name"`
	ID                         int             `json:"id"`

	ErrorResponse
}

CvpTask represents a task

type CvpTaskList

type CvpTaskList struct {
	Total int       `json:"total"`
	Data  []CvpTask `json:"data"`

	ErrorResponse
}

CvpTaskList represents a task list returned from a request

type DeviceStatus

type DeviceStatus struct {
	Critical     int `json:"critical"`
	Warning      int `json:"warning"`
	Normal       int `json:"normal"`
	ImageUpgrade int `json:"imageUpgrade"`
	Task         int `json:"task"`
	UnAuthorized int `json:"unAuthorized"`
}

DeviceStatus represents status for a device

type ErrorResponse

type ErrorResponse struct {
	ErrorCode    string `json:"errorCode"`
	ErrorMessage string `json:"errorMessage"`
}

ErrorResponse is the response sent during error conditions within CVP

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() error

Error returns error

func (*ErrorResponse) String added in v0.2.0

func (e *ErrorResponse) String() string

type ImageBundleInfo

type ImageBundleInfo struct {
	AppliedContainersCount   int         `json:"appliedContainersCount"`
	AppliedDevicesCount      int         `json:"appliedDevicesCount"`
	FactoryID                int         `json:"factoryId"`
	ID                       int         `json:"id"`
	IsCertifiedImageBundle   string      `json:"isCertifiedImageBundle"`
	ImageIds                 []string    `json:"imageIds"`
	Images                   []ImageInfo `json:"images,omitempty"`
	Key                      string      `json:"key"`
	Name                     string      `json:"name"`
	Note                     string      `json:"note"`
	UploadedBy               string      `json:"uploadedBy,omitempty"`
	UploadedDateinLongFormat int64       `json:"uploadedDateinLongFormat"`
	User                     string      `json:"user"`

	ErrorResponse
}

ImageBundleInfo represents ImageBundle object within CVP

type ImageBundleResp

type ImageBundleResp struct {
	Total                 int                   `json:"total"`
	Data                  []ImageBundleInfo     `json:"data"`
	ImageBundleMapper     map[string]*ImageInfo `json:"imageBundleMapper"`
	AssignedImageBundleID string                `json:"assignedImageBundleId"`

	ErrorResponse
}

ImageBundleResp response data/payload for ImageBundle query

type ImageInfo

type ImageInfo struct {
	AppliedContainersCount   int    `json:"appliedContainersCount"`
	AppliedDevicesCount      int    `json:"appliedDevicesCount"`
	FactoryID                int    `json:"factoryId"`
	ID                       int    `json:"id"`
	ImageID                  string `json:"imageId"`
	ImageFile                string `json:"imageFile"`
	ImageFileName            string `json:"imageFileName"`
	ImageSize                string `json:"imageSize"`
	IsHotFix                 string `json:"isHotFix"`
	IsRebootRequired         string `json:"isRebootRequired"`
	Key                      string `json:"key"`
	MD5                      string `json:"md5"`
	SHA512                   string `json:"sha512"`
	Name                     string `json:"name"`
	SwiMaxHwepoch            string `json:"swiMaxHwepoch"`
	SwiVarient               string `json:"swiVarient"`
	UploadedDateinLongFormat int64  `json:"uploadedDateinLongFormat"`
	User                     string `json:"user"`
	Version                  string `json:"version"`
}

ImageInfo represents information related to an Image within CVP

type ImageResp

type ImageResp struct {
	Total int         `json:"total"`
	Data  []ImageInfo `json:"data"`

	ErrorResponse
}

ImageResp response from Image request

type Label added in v0.2.0

type Label struct {
	Key                  string `json:"key"`
	Name                 string `json:"name"`
	Note                 string `json:"note"`
	Type                 string `json:"type"`
	User                 string `json:"user"`
	DateTimeInLongFormat int64  `json:"dateTimeInLongFormat"`
	NetElementCount      int    `json:"netElementCount"`
	FactoryID            int    `json:"factoryId"`
	ID                   int    `json:"id"`

	ErrorResponse
}

Label represents a label

type LogData

type LogData struct {
	ClassID              int    `json:"classId"`
	DateTimeInLongFormat int64  `json:"dateTimeInLongFormat"`
	LogDetails           string `json:"logDetails"`
	WorkOrderID          string `json:"workOrderId"`
	FactoryID            int    `json:"factoryId"`
	ObjectName           string `json:"objectName"`
	UserName             string `json:"userName"`
	Key                  string `json:"key"`
	ID                   int    `json:"id"`
}

LogData log data associated with a task

type LoginResp

type LoginResp struct {
	Roles              []Role        `json:"roles"`
	AuthorizationType  string        `json:"authorizationType"`
	PermissionList     []Permissions `json:"permissionList"`
	SessionID          string        `json:"sessionId"`
	AuthenticationType string        `json:"authenticationType"`
	User               User          `json:"user"`
	Username           string        `json:"username"`

	ErrorResponse
}

LoginResp contains the response from a login request

type Module

type Module struct {
	Mode      string `json:"mode"`
	FactoryID int    `json:"factoryId"`
	Name      string `json:"name"`
	ID        int    `json:"id"`
}

Module ..

type NetElement

type NetElement struct {
	IPAddress            string       `json:"ipAddress"`
	ModelName            string       `json:"modelName"`
	InternalVersion      string       `json:"internalVersion"`
	SystemMacAddress     string       `json:"systemMacAddress"`
	MemTotal             int          `json:"memTotal"`
	BootupTimeStamp      float64      `json:"bootupTimeStamp"`
	MemFree              int          `json:"memFree"`
	Architecture         string       `json:"architecture"`
	InternalBuildID      string       `json:"internalBuildId"`
	HardwareRevision     string       `json:"hardwareRevision"`
	Fqdn                 string       `json:"fqdn"`
	TaskIDList           []CvpTask    `json:"taskIdList"`
	ZtpMode              string       `json:"ztpMode"`
	Version              string       `json:"version"`
	SerialNumber         string       `json:"serialNumber"`
	Key                  string       `json:"key"`
	Type                 string       `json:"type"`
	TempActionList       []TempAction `json:"tempAction"`
	IsDANZEnabled        string       `json:"isDANZEnabled"`
	IsMLAGEnabled        string       `json:"isMLAGEnabled"`
	ComplianceIndication string       `json:"complianceIndication"`
	ComplianceCode       string       `json:"complianceCode"`
	LastSyncUp           int64        `json:"lastSyncUp"`
	UnAuthorized         bool         `json:"unAuthorized"`
	DeviceInfo           string       `json:"deviceInfo"`
	DeviceStatus         string       `json:"deviceStatus"`
	ParentContainerID    string       `json:"parentContainerId"`
	ContainerName        string       `json:"containerName"`

	ErrorResponse
}

NetElement represents a CVP network element returned as part of inventory query

type NetElementContainer

type NetElementContainer struct {
	ContainerKey  string `json:"containerKey"`
	ContainerName string `json:"containerName"`
	NetElementKey string `json:"netElementKey"`
}

NetElementContainer maps a specific netelemet to a container

type Permissions

type Permissions struct {
	Mode      string `json:"mode"`
	FactoryID int    `json:"factoryId"`
	Name      string `json:"name"`
	ID        int    `json:"id"`
}

Permissions represents CVP permission

type Role

type Role struct {
	ClassID        int      `json:"classId"`
	ModuleList     []Module `json:"moduleList"`
	CreatedBy      string   `json:"createdBy"`
	FactoryID      int      `json:"factoryId"`
	Name           string   `json:"name"`
	ModuleListSize int      `json:"moduleListSize"`
	Description    string   `json:"description"`
	ID             int      `json:"id"`
	CreatedOn      int64    `json:"createdOn"`
	Key            string   `json:"key"`
}

Role represents CVP role

type SaveInventoryData added in v0.3.0

type SaveInventoryData struct {
	Total                            string `json:"total"`
	UpgradeRequired                  string `json:"Upgrade required"`
	InvalidContainer                 string `json:"Invalid-Container"`
	Connected                        string `json:"Connected"`
	RegistrationInProcessByOtherUser string `json:"Registration in process by other user"`
	Duplicate                        string `json:"Duplicate"`
	Retry                            string `json:"Retry"`
	UnauthorizedAccess               string `json:"Unauthorized access"`
	Message                          string `json:"message"`
	Connecting                       string `json:"Connecting"`
}

SaveInventoryData relates to saveInventory status

type SaveInventoryResp added in v0.3.0

type SaveInventoryResp struct {
	Data SaveInventoryData `json:"data"`
	ErrorResponse
}

SaveInventoryResp is the response returned for saveInventory API call

type SearchTopologyResp

type SearchTopologyResp struct {
	NetElementContainerList []NetElementContainer `json:"netElementContainerList"`
	Total                   int                   `json:"total"`
	KeywordList             []string              `json:"keywordList"`
	ContainerList           []ContainerData       `json:"containerList"`
	NetElementList          []NetElement          `json:"netElementList"`

	ErrorResponse
}

SearchTopologyResp represents the response from SearchTopology request

type TaskInfo

type TaskInfo struct {
	TaskIDs []string `json:"taskIds"`
	Status  string   `json:"status"`
}

TaskInfo represents task info

type TaskResp

type TaskResp struct {
	Data TaskInfo `json:"data"`
}

TaskResp represents a task response

type TempAction

type TempAction struct {
	CcID                            string   `json:"ccId"`
	SessionID                       string   `json:"sessionId"`
	ContainerKey                    string   `json:"containerKey"`
	TaskID                          int      `json:"taskId"`
	Info                            string   `json:"info"`
	InfoPreview                     string   `json:"infoPreview"`
	Note                            string   `json:"note"`
	Action                          string   `json:"action"`
	NodeType                        string   `json:"nodeType"`
	NodeID                          string   `json:"nodeId"`
	ToID                            string   `json:"toId"`
	FromID                          string   `json:"fromId"`
	NodeName                        string   `json:"nodeName"`
	ToName                          string   `json:"toName"`
	FromName                        string   `json:"fromName"`
	ChildTasks                      []string `json:"childTasks"`
	ParentTask                      string   `json:"parentTask"`
	OldNodeName                     string   `json:"oldNodeName"`
	ToIDType                        string   `json:"toIdType"`
	ConfigletList                   []string `json:"configletList"`
	IgnoreConfigletList             []string `json:"ignoreConfigletList"`
	ConfigletNamesList              []string `json:"configletNamesList"`
	IgnoreConfigletNamesList        []string `json:"ignoreConfigletNamesList"`
	NodeList                        []string `json:"nodeList"`
	IgnoreNodeList                  []string `json:"ignoreNodeList"`
	NodeNamesList                   []string `json:"nodeNamesList"`
	IgnoreNodeNamesList             []string `json:"ignoreNodeNamesList"`
	NodeIPAddress                   string   `json:"nodeIpAddress"`
	NodeTargetIPAddress             string   `json:"nodeTargetIpAddress"`
	Key                             string   `json:"key"`
	IgnoreNodeID                    string   `json:"ignoreNodeId"`
	IgnoreNodeName                  string   `json:"ignoreNodeName"`
	ImageBundleID                   string   `json:"imageBundleId"`
	Mode                            string   `json:"mode"`
	Timestamp                       int64    `json:"timestamp"`
	ConfigletBuilderList            []string `json:"configletBuilderList"`
	ConfigletBuilderNamesList       []string `json:"configletBuilderNamesList"`
	IgnoreConfigletBuilderList      []string `json:"ignoreConfigletBuilderList"`
	IgnoreConfigletBuilderNamesList []string `json:"ignoreConfigletBuilderNamesList"`
	PageType                        string   `json:"pageType"`
	ViaContainer                    bool     `json:"viaContainer"`
	BestImageContainerID            string   `json:"bestImageContainerId"`
	User                            string   `json:"user"`
	FactoryID                       int      `json:"factoryId"`
	ID                              int      `json:"id"`
}

TempAction is

type TempConfig

type TempConfig struct {
	ExistingConfiglets        []string    `json:"existingConfiglets"`
	IgnoredConfiglets         []string    `json:"ignoredConfiglets"`
	AssignedConfiglets        []string    `json:"assignedConfiglets"`
	ProposedConfiglets        []Configlet `json:"proposedConfiglets"`
	DeviceConfigletBuilders   []string    `json:"deviceConfigletBuilders"`
	AssignedConfigletBuilders []string    `json:"assignedConfigletBuilders"`
	IgnoredConfigletBuilders  []string    `json:"ignoredConfigletBuilders"`
	DeviceConfiglets          []string    `json:"deviceConfiglets"`
	ExistingConfigletBuilders []string    `json:"existingConfigletBuilders"`

	ErrorResponse
}

TempConfig ...

type Topology

type Topology struct {
	Key                      string        `json:"key"`
	Name                     string        `json:"name"`
	Type                     string        `json:"type"`
	ChildContainerCount      int           `json:"childContainerCount"`
	ChildNetElementCount     int           `json:"childNetElementCount"`
	ParentContainerID        interface{}   `json:"parentContainerId"`
	Mode                     string        `json:"mode"`
	DevStatus                DeviceStatus  `json:"deviceStatus"`
	ChildTaskCount           int           `json:"childTaskCount"`
	ChildContainerList       []Topology    `json:"childContainerList"`
	ChildNetElementList      []NetElement  `json:"childNetElementList"`
	HierarchyNetElementCount int           `json:"hierarchyNetElementCount"`
	TempAction               []interface{} `json:"tempAction"`
	TempEvent                []interface{} `json:"tempEvent"`
}

Topology ..

type TopologyResp

type TopologyResp struct {
	Topology Topology `json:"topology"`
	Type     string   `json:"type"`

	ErrorResponse
}

TopologyResp ..

type User

type User struct {
	FirstName     string      `json:"firstName"`
	LastName      string      `json:"lastName"`
	Password      interface{} `json:"password"`
	UserStatus    string      `json:"userStatus"`
	CurrentStatus string      `json:"currentStatus"`
	FactoryID     int         `json:"factoryId"`
	ContactNumber interface{} `json:"contactNumber"`
	LastAccessed  int64       `json:"lastAccessed"`
	UserType      string      `json:"userType"`
	ID            int         `json:"id"`
	UserID        string      `json:"userId"`
	Email         string      `json:"email"`
}

User represents CVP User

type VerifyError added in v1.0.0

type VerifyError struct {
	LineNo string `json:"lineNo"`
	Error  string `json:"error"`
}

VerifyError represents an error related to verification of a config

type VerifyWarning added in v1.0.0

type VerifyWarning struct {
	LineNo  string `json:"lineNo"`
	Warning string `json:"warning"`
}

VerifyWarning represents a warning related to verification of a config

type WorkData

type WorkData struct {
	WorkFlowAction           string   `json:"WORKFLOW_ACTION"`
	CurrentparentContainerID string   `json:"currentparentContainerId"`
	View                     string   `json:"VIEW"`
	NewparentContainerID     string   `json:"newparentContainerId"`
	NetElementID             string   `json:"NETELEMENT_ID"`
	IsConfigPushNeeded       string   `json:"IS_CONFIG_PUSH_NEEDED"`
	IgnoreConfigletList      []string `json:"ignoreConfigletList"`
}

WorkData associated with a task

type WorkOrderDetail

type WorkOrderDetail struct {
	NetElementID       string `json:"netElementId"`
	NetElementHostName string `json:"netElementHostName"`
	IPAddress          string `json:"ipAddress"`
	FactoryID          int    `json:"factoryId"`
	SerialNumber       string `json:"serialNumber"`
	ID                 int    `json:"id"`
}

WorkOrderDetail associated with a task

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL