Documentation
¶
Overview ¶
Package models provides the models for Cisco Modeling Labs here: annotation related types
Package models provides the models for Cisco Modeling Labs here: external connector related types
Package models provides the models for Cisco Modeling Labs here: general types
Package models provides the models for Cisco Modeling Labs here: group related types
Package models provides the models for Cisco Modeling Labs here: image definition related types
Package models provides the models for Cisco Modeling Labs here: interface related types
Package models provides the models for Cisco Modeling Labs here: lab related types
Package models provides the models for Cisco Modeling Labs here: link related types
Package models provides the models for Cisco Modeling Labs here: link conditioning related types
Package models provides the models for Cisco Modeling Labs here: link topology related types
Package models provides the models for Cisco Modeling Labs here: node related types
Package models provides the models for Cisco Modeling Labs here: node definition related types
Package models provides the models for Cisco Modeling Labs here: permission related types
Package models provides the models for Cisco Modeling Labs here: user related types
Index ¶
- Constants
- type Annotation
- type AnnotationCreate
- type AnnotationTile
- type AnnotationType
- type AnnotationUpdate
- type Association
- type AssociationList
- type AssociationUsersGroups
- type BootProgress
- type BorderStyle
- type ConditionResponse
- type DeviceNature
- type EllipseAnnotation
- type EllipseAnnotationPartial
- type EllipseAnnotationResponse
- type EndpointStats
- type ErrorResponse
- type ExtConn
- type GeneratorConfig
- type Group
- type GroupList
- type IfaceState
- type IfaceType
- type ImageDefinition
- type Interface
- type InterfaceList
- type Lab
- type LabCreateRequest
- type LabGroup
- type LabImport
- type LabList
- type LabRequest
- type LabResponse
- type LabState
- type LabTile
- type LabTilesResponse
- type LabUpdateRequest
- type LineAnnotation
- type LineAnnotationPartial
- type LineAnnotationResponse
- type LineStyle
- type Link
- type LinkConditionConfiguration
- type LinkConditionStricted
- type LinkList
- type LinkTile
- type LinkTopology
- type LinuxNativeSimulation
- type Node
- type NodeConfig
- type NodeDefIcons
- type NodeDefinition
- type NodeDefinitionBoot
- type NodeDefinitionConfiguration
- type NodeDefinitionGeneral
- type NodeDefinitionInherited
- type NodeDefinitionMap
- type NodeDefinitionPyats
- type NodeDefinitionUI
- type NodeMap
- type NodeOperational
- type NodeParameters
- type NodeStaging
- type NodeState
- type NodeTile
- type OldPermission
- type Operational
- type OptInState
- type Permission
- type Permissions
- type ProvisioningConfig
- type PyAtsCredentials
- type RectangleAnnotation
- type RectangleAnnotationPartial
- type RectangleAnnotationResponse
- type SerialConsole
- type SerialDevice
- type SimplifiedNodeDefinitionResponse
- type SmartAnnotation
- type SmartAnnotationUpdate
- type Stats
- type Stub
- type SystemInformation
- type TextAnnotation
- type TextAnnotationPartial
- type TextAnnotationResponse
- type Topology
- type UUID
- type UpdatePassword
- type UsageEstimations
- type User
- type UserBase
- type UserCreateRequest
- type UserList
- type UserUpdateRequest
- type VMProperties
Constants ¶
const ( // IfaceStateDefined indicates the interface is defined on core. IfaceStateDefined IfaceState = "DEFINED_ON_CORE" // IfaceStateStopped indicates the interface is stopped. IfaceStateStopped IfaceState = "STOPPED" // IfaceStateStarted indicates the interface is started. IfaceStateStarted IfaceState = "STARTED" // IfaceTypePhysical indicates a physical interface. IfaceTypePhysical IfaceType = "physical" // IfaceTypeLoopback indicates a loopback interface. IfaceTypeLoopback IfaceType = "loopback" )
const ( // LinkStateDefined indicates the link is defined on core. LinkStateDefined = "DEFINED_ON_CORE" // LinkStateStopped indicates the link is stopped. LinkStateStopped = "STOPPED" // LinkStateStarted indicates the link is started. LinkStateStarted = "STARTED" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation struct {
Type AnnotationType
Text *TextAnnotationResponse
Rectangle *RectangleAnnotationResponse
Ellipse *EllipseAnnotationResponse
Line *LineAnnotationResponse
}
Annotation is a discriminated union wrapper. Exactly one of Text/Rectangle/Ellipse/Line is set after unmarshaling.
func (Annotation) MarshalJSON ¶
func (a Annotation) MarshalJSON() ([]byte, error)
MarshalJSON implements custom JSON marshaling for Annotation.
func (*Annotation) UnmarshalJSON ¶
func (a *Annotation) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom JSON unmarshaling for Annotation.
type AnnotationCreate ¶
type AnnotationCreate struct {
Type AnnotationType
Text *TextAnnotation
Rectangle *RectangleAnnotation
Ellipse *EllipseAnnotation
Line *LineAnnotation
}
AnnotationCreate is the request payload for creating an annotation. Exactly one of Text/Rectangle/Ellipse/Line should be set.
func (AnnotationCreate) MarshalJSON ¶
func (a AnnotationCreate) MarshalJSON() ([]byte, error)
MarshalJSON implements custom JSON marshaling for AnnotationCreate.
type AnnotationTile ¶
type AnnotationTile struct {
ID UUID `json:"id"`
BorderColor string `json:"border_color,omitempty"`
BorderRadius float64 `json:"border_radius,omitempty"`
BorderStyle string `json:"border_style,omitempty"`
Color string `json:"color,omitempty"`
Rotation float64 `json:"rotation,omitempty"`
TextBold bool `json:"text_bold,omitempty"`
TextContent string `json:"text_content,omitempty"`
TextFont string `json:"text_font,omitempty"`
TextItalic bool `json:"text_italic,omitempty"`
TextSize float64 `json:"text_size,omitempty"`
TextUnit string `json:"text_unit,omitempty"`
Thickness float64 `json:"thickness,omitempty"`
Type string `json:"type"`
X1 float64 `json:"x1,omitempty"`
Y1 float64 `json:"y1,omitempty"`
X2 float64 `json:"x2,omitempty"`
Y2 float64 `json:"y2,omitempty"`
ZIndex float64 `json:"z_index,omitempty"`
}
AnnotationTile represents an annotation in the topology
type AnnotationType ¶
type AnnotationType string
AnnotationType is the discriminator for classic annotations.
const ( // AnnotationTypeText represents a text annotation. AnnotationTypeText AnnotationType = "text" // AnnotationTypeRectangle represents a rectangle annotation. AnnotationTypeRectangle AnnotationType = "rectangle" // AnnotationTypeEllipse represents an ellipse annotation. AnnotationTypeEllipse AnnotationType = "ellipse" // AnnotationTypeLine represents a line annotation. AnnotationTypeLine AnnotationType = "line" )
type AnnotationUpdate ¶
type AnnotationUpdate struct {
Type AnnotationType
Text *TextAnnotationPartial
Rectangle *RectangleAnnotationPartial
Ellipse *EllipseAnnotationPartial
Line *LineAnnotationPartial
}
AnnotationUpdate is the request payload for patching an annotation. OpenAPI requires `type` and accepts partial fields.
func (AnnotationUpdate) MarshalJSON ¶
func (a AnnotationUpdate) MarshalJSON() ([]byte, error)
MarshalJSON implements custom JSON marshaling for AnnotationUpdate.
type Association ¶
type Association struct {
ID UUID `json:"id"`
Permissions Permissions `json:"permissions"`
}
Association represents an association between a user/group and permissions.
type AssociationList ¶
type AssociationList []Association
AssociationList is a slice of Association.
type AssociationUsersGroups ¶
type AssociationUsersGroups struct {
Groups AssociationList `json:"groups,omitempty"`
Users AssociationList `json:"users,omitempty"`
}
AssociationUsersGroups contains associations for users and groups.
type BootProgress ¶
type BootProgress string
BootProgress represents the boot progress state of a node.
const ( // BootProgressNotRunning indicates the node is not running. BootProgressNotRunning BootProgress = "Not running" // BootProgressBooting indicates the node is booting. BootProgressBooting BootProgress = "Booting" // BootProgressBooted indicates the node is booted. BootProgressBooted BootProgress = "Booted" )
type BorderStyle ¶
type BorderStyle string
BorderStyle matches OpenAPI `BorderStyle`. Values observed in schema: "", "2,2", "4,2".
type ConditionResponse ¶
type ConditionResponse struct {
LinkConditionConfiguration // Configuration fields including Enabled
Operational *LinkConditionStricted `json:"operational,omitempty"` // Operational data (read-only)
}
ConditionResponse represents the response from link conditioning operations
type DeviceNature ¶
type DeviceNature string
DeviceNature represents the nature/type of a device.
const ( // DeviceNatureRouter represents a router device. DeviceNatureRouter DeviceNature = "router" // DeviceNatureSwitch represents a switch device. DeviceNatureSwitch DeviceNature = "switch" // DeviceNatureServer represents a server device. DeviceNatureServer DeviceNature = "server" // DeviceNatureHost represents a host device. DeviceNatureHost DeviceNature = "host" // DeviceNatureCloud represents a cloud device. DeviceNatureCloud DeviceNature = "cloud" // DeviceNatureFirewall represents a firewall device. DeviceNatureFirewall DeviceNature = "firewall" // DeviceNatureExternalConnector represents an external connector. DeviceNatureExternalConnector DeviceNature = "external_connector" )
type EllipseAnnotation ¶
type EllipseAnnotation struct {
X2 float64 `json:"x2"`
Y2 float64 `json:"y2"`
Rotation float64 `json:"rotation"`
Type AnnotationType `json:"type"`
BorderColor string `json:"border_color"`
BorderStyle BorderStyle `json:"border_style"`
Color string `json:"color"`
Thickness float64 `json:"thickness"`
X1 float64 `json:"x1"`
Y1 float64 `json:"y1"`
ZIndex float64 `json:"z_index"`
}
EllipseAnnotation represents an ellipse annotation.
type EllipseAnnotationPartial ¶
type EllipseAnnotationPartial struct {
X2 *float64 `json:"x2,omitempty"`
Y2 *float64 `json:"y2,omitempty"`
Rotation *float64 `json:"rotation,omitempty"`
Type AnnotationType `json:"type"`
BorderColor *string `json:"border_color,omitempty"`
BorderStyle *BorderStyle `json:"border_style,omitempty"`
Color *string `json:"color,omitempty"`
Thickness *float64 `json:"thickness,omitempty"`
X1 *float64 `json:"x1,omitempty"`
Y1 *float64 `json:"y1,omitempty"`
ZIndex *float64 `json:"z_index,omitempty"`
}
EllipseAnnotationPartial represents a partial ellipse annotation for updates.
type EllipseAnnotationResponse ¶
type EllipseAnnotationResponse struct {
ID UUID `json:"id"`
EllipseAnnotation
}
EllipseAnnotationResponse represents an ellipse annotation with ID.
type EndpointStats ¶
type EndpointStats struct {
CallCount int
MinTime time.Duration
MaxTime time.Duration
AvgTime time.Duration
TotalTime time.Duration
StatusCounts map[int]int // Status code counts for this endpoint group
}
EndpointStats contains all metrics for a grouped endpoint
type ErrorResponse ¶
type ErrorResponse struct {
Code int `json:"code"`
Description json.RawMessage `json:"description"`
}
ErrorResponse represents an error response from the CML API.
type ExtConn ¶
type ExtConn struct {
ID UUID `json:"id"`
DeviceName string `json:"device_name"`
Label string `json:"label"`
Protected bool `json:"protected"`
Snooped bool `json:"snooped"`
Tags []string `json:"tags"`
Operational opdata `json:"operational"`
}
ExtConn defines the data structure for a CML external connector
type GeneratorConfig ¶
type GeneratorConfig struct {
Driver string `json:"driver"`
}
GeneratorConfig represents generator configuration.
type Group ¶
type Group struct {
ID UUID `json:"id,omitempty"`
Description string `json:"description,omitempty"`
Members []UUID `json:"members"`
Name string `json:"name"`
Associations []Association `json:"associations,omitempty"`
Created string `json:"created,omitempty"`
Modified string `json:"modified,omitempty"`
DirectoryDN string `json:"directory_dn,omitempty"`
DirectoryExists *bool `json:"directory_exists,omitempty"`
}
Group represents a user group in CML with associated permissions and members.
type IfaceState ¶
type IfaceState string
IfaceState represents the state of an interface. IfaceType is the type of an interface.
type ImageDefinition ¶
type ImageDefinition struct {
ID UUID `json:"id"`
SchemaVersion string `json:"schema_version,omitempty"`
NodeDefID string `json:"node_definition_id"`
Description string `json:"description,omitempty"`
Label string `json:"label"`
DiskImage *string `json:"disk_image,omitempty"`
DiskImage2 *string `json:"disk_image_2,omitempty"`
DiskImage3 *string `json:"disk_image_3,omitempty"`
DiskImage4 *string `json:"disk_image_4,omitempty"`
ReadOnly bool `json:"read_only"`
Configuration *string `json:"configuration,omitempty"`
DockerTag *string `json:"docker_tag,omitempty"`
EFIBoot bool `json:"efi_boot,omitempty"`
PyATS *PyAtsCredentials `json:"pyats,omitempty"`
SHA256 *string `json:"sha256,omitempty"`
RAM *int `json:"ram,omitempty"`
CPUs *int `json:"cpus,omitempty"`
CPUlimit *int `json:"cpu_limit,omitempty"`
DataVolume *int `json:"data_volume,omitempty"`
BootDiskSize *int `json:"boot_disk_size,omitempty"`
}
ImageDefinition represents an image definition known to the controller.
func (ImageDefinition) DiskImage1 ¶
func (id ImageDefinition) DiskImage1() string
DiskImage1 is a legacy accessor for the primary disk image. Prefer using DiskImage going forward.
type Interface ¶
type Interface struct {
ID UUID `json:"id"`
LabID UUID `json:"lab_id,omitempty"`
Node UUID `json:"node"`
Label string `json:"label"`
Slot *int `json:"slot,omitempty"`
Type IfaceType `json:"type,omitempty"`
State IfaceState `json:"state,omitempty"`
IsConnected bool `json:"is_connected"`
Operational *Operational `json:"operational,omitempty"`
MACAddress *string `json:"mac_address,omitempty"`
// extra fields not in OpenAPI spec
IP4 []string `json:"ip4,omitempty"`
IP6 []string `json:"ip6,omitempty"`
}
Interface represents a CML interface.
func (Interface) IsPhysical ¶
IsPhysical returns true if the interface is physical.
type Lab ¶
type Lab struct {
ID UUID `json:"id"`
State LabState `json:"state,omitempty"`
Created string `json:"created,omitempty"`
Modified string `json:"modified,omitempty"`
Title string `json:"lab_title,omitempty"`
Description string `json:"lab_description,omitempty"`
Notes string `json:"lab_notes,omitempty"`
OwnerID UUID `json:"owner,omitempty"`
OwnerUsername string `json:"owner_username,omitempty"`
OwnerFullname string `json:"owner_fullname,omitempty"`
NodeCount int `json:"node_count,omitempty"`
LinkCount int `json:"link_count,omitempty"`
EffectivePermissions Permissions `json:"effective_permissions,omitempty"`
Groups []LabGroup `json:"groups,omitempty"`
NodeStaging *NodeStaging `json:"node_staging,omitempty"`
// non-schema helpers
Owner *User `json:"-"` // Full user object (not serialized)
Nodes NodeMap `json:"nodes,omitempty"`
Links LinkList `json:"links,omitempty"`
}
Lab represents a CML lab with its nodes, links, and metadata.
func (*Lab) CanBeWiped ¶
CanBeWiped returns `true` when all nodes in the lab are wiped.
func (*Lab) NodeByLabel ¶
NodeByLabel returns the node of a lab identified by its `label“ or an error if not found.
type LabCreateRequest ¶
type LabCreateRequest struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Notes string `json:"notes,omitempty"`
Owner UUID `json:"owner,omitempty"`
Groups []LabGroup `json:"groups,omitzero"`
Associations AssociationUsersGroups `json:"associations,omitzero"`
NodeStaging *NodeStaging `json:"node_staging,omitempty"`
}
LabCreateRequest represents the data required to create a new lab. Only certain fields from the full Lab model are accepted during creation. This ensures API safety by preventing misuse of unsupported fields.
type LabGroup ¶
type LabGroup struct {
ID UUID `json:"id"`
Permission OldPermission `json:"permission"`
Name string `json:"name,omitempty"`
}
LabGroup represents a group with permissions for a lab
type LabImport ¶
LabImport represents the result of importing a lab, including any warnings.
func (*LabImport) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. The OpenAPI schema allows `warnings` to be null.
type LabRequest ¶
type LabRequest = LabCreateRequest
LabRequest exists for OpenAPI parity: in CML OpenAPI 2.10 the same schema is used for create and update.
type LabResponse ¶
type LabResponse struct {
ID UUID `json:"id"`
Created string `json:"created,omitempty"`
Modified string `json:"modified,omitempty"`
Title string `json:"lab_title"`
Description string `json:"lab_description,omitempty"`
Notes string `json:"lab_notes,omitempty"`
OwnerID UUID `json:"owner"`
OwnerUsername string `json:"owner_username"`
OwnerFullname string `json:"owner_fullname"`
State LabState `json:"state"`
NodeCount int `json:"node_count"`
LinkCount int `json:"link_count"`
Groups []LabGroup `json:"groups,omitempty"`
EffectivePermissions Permissions `json:"effective_permissions"`
NodeStaging *NodeStaging `json:"node_staging,omitempty"`
}
LabResponse represents the response from /labs/{lab_id} endpoint
type LabTile ¶
type LabTile struct {
ID UUID `json:"id"`
State LabState `json:"state"`
Created string `json:"created"`
Modified string `json:"modified"`
Title string `json:"lab_title"`
Description string `json:"lab_description"`
Notes string `json:"lab_notes"`
OwnerID UUID `json:"owner"`
OwnerUsername string `json:"owner_username"`
OwnerFullname string `json:"owner_fullname"`
NodeCount int `json:"node_count"`
LinkCount int `json:"link_count"`
Groups []LabGroup `json:"groups"`
Topology Topology `json:"topology"`
EffectivePermissions Permissions `json:"effective_permissions"`
}
LabTile represents a lab tile with topology data
type LabTilesResponse ¶
LabTilesResponse represents the response from /populate_lab_tiles endpoint
type LabUpdateRequest ¶
type LabUpdateRequest LabCreateRequest
LabUpdateRequest is identical to LabCreateRequest and, in fact, LabCreateRequest is also used in the OpenAPI spec. Using a new type makes it clearer.
type LineAnnotation ¶
type LineAnnotation struct {
X2 float64 `json:"x2"`
Y2 float64 `json:"y2"`
Type AnnotationType `json:"type"`
BorderColor string `json:"border_color"`
BorderStyle BorderStyle `json:"border_style"`
Color string `json:"color"`
Thickness float64 `json:"thickness"`
X1 float64 `json:"x1"`
Y1 float64 `json:"y1"`
ZIndex float64 `json:"z_index"`
// line_start/line_end are required by the schema but may be null.
LineStart *LineStyle `json:"line_start"`
LineEnd *LineStyle `json:"line_end"`
}
LineAnnotation represents a line annotation.
type LineAnnotationPartial ¶
type LineAnnotationPartial struct {
X2 *float64 `json:"x2,omitempty"`
Y2 *float64 `json:"y2,omitempty"`
Type AnnotationType `json:"type"`
BorderColor *string `json:"border_color,omitempty"`
BorderStyle *BorderStyle `json:"border_style,omitempty"`
Color *string `json:"color,omitempty"`
Thickness *float64 `json:"thickness,omitempty"`
X1 *float64 `json:"x1,omitempty"`
Y1 *float64 `json:"y1,omitempty"`
ZIndex *float64 `json:"z_index,omitempty"`
// line_start/line_end are required by the schema but may be null.
// For updates, we always include these keys so callers can send explicit null.
LineStart *LineStyle `json:"line_start"`
LineEnd *LineStyle `json:"line_end"`
}
LineAnnotationPartial represents a partial line annotation for updates.
type LineAnnotationResponse ¶
type LineAnnotationResponse struct {
ID UUID `json:"id"`
LineAnnotation
}
LineAnnotationResponse represents a line annotation with ID.
type LineStyle ¶
type LineStyle string
LineStyle matches OpenAPI `LineStyle`. Values observed in schema: "arrow", "square", "circle".
func (LineStyle) MarshalJSON ¶ added in v0.2.2
MarshalJSON validates LineStyle values during marshaling.
The server treats line markers as an enum and rejects empty strings. Enforcing this client-side prevents accidentally emitting invalid payloads.
type Link ¶
type Link struct {
ID UUID `json:"id"`
LabID UUID `json:"lab_id"`
State string `json:"state"`
Label string `json:"label"`
PCAPkey UUID `json:"link_capture_key"`
SrcID UUID `json:"interface_a"`
DstID UUID `json:"interface_b"`
SrcNode UUID `json:"node_a"`
DstNode UUID `json:"node_b"`
SrcSlot int `json:"slot_a"`
DstSlot int `json:"slot_b"`
}
Link defines the data structure for a CML link between nodes.
type LinkConditionConfiguration ¶
type LinkConditionConfiguration struct {
Bandwidth int `json:"bandwidth,omitempty"` // Bandwidth in kbps (0-10000000)
Latency int `json:"latency,omitempty"` // Delay in ms (0-10000)
DelayCorr float64 `json:"delay_corr,omitempty"` // Delay correlation in percent (0-100)
Limit int `json:"limit,omitempty"` // Limit in ms (0-10000)
Loss float64 `json:"loss,omitempty"` // Loss in percent (0-100)
LossCorr float64 `json:"loss_corr,omitempty"` // Loss correlation in percent (0-100)
Gap int `json:"gap,omitempty"` // Gap between packets in ms (0-10000)
Duplicate float64 `json:"duplicate,omitempty"` // Duplicate probability in percent (0-100)
DuplicateCorr float64 `json:"duplicate_corr,omitempty"` // Duplicate correlation in percent (0-100)
Jitter int `json:"jitter,omitempty"` // Jitter in ms (0-10000)
ReorderProb float64 `json:"reorder_prob,omitempty"` // Reorder probability in percent (0-100)
ReorderCorr float64 `json:"reorder_corr,omitempty"` // Reorder correlation in percent (0-100)
CorruptProb float64 `json:"corrupt_prob,omitempty"` // Corruption probability in percent (0-100)
CorruptCorr float64 `json:"corrupt_corr,omitempty"` // Corruption correlation in percent (0-100)
Enabled bool `json:"enabled,omitempty"` // Whether conditioning is enabled
}
LinkConditionConfiguration defines the configurable parameters for link conditioning
type LinkConditionStricted ¶
type LinkConditionStricted struct {
Bandwidth int `json:"bandwidth,omitempty"` // Bandwidth in kbps
Latency int `json:"latency,omitempty"` // Delay in ms
DelayCorr float64 `json:"delay_corr,omitempty"` // Delay correlation in percent
Limit int `json:"limit,omitempty"` // Limit in ms
Loss float64 `json:"loss,omitempty"` // Loss in percent
LossCorr float64 `json:"loss_corr,omitempty"` // Loss correlation in percent
Gap int `json:"gap,omitempty"` // Gap between packets in ms
Duplicate float64 `json:"duplicate,omitempty"` // Duplicate probability in percent
DuplicateCorr float64 `json:"duplicate_corr,omitempty"` // Duplicate correlation in percent
Jitter int `json:"jitter,omitempty"` // Jitter in ms
ReorderProb float64 `json:"reorder_prob,omitempty"` // Reorder probability in percent
ReorderCorr float64 `json:"reorder_corr,omitempty"` // Reorder correlation in percent
CorruptProb float64 `json:"corrupt_prob,omitempty"` // Corruption probability in percent
CorruptCorr float64 `json:"corrupt_corr,omitempty"` // Corruption correlation in percent
}
LinkConditionStricted defines operational link conditioning data (read-only, no Enabled field)
type LinkTile ¶
type LinkTile struct {
ID UUID `json:"id"`
NodeA UUID `json:"node_a"`
NodeB UUID `json:"node_b"`
State string `json:"state"`
}
LinkTile represents a link between nodes
type LinkTopology ¶
type LinkTopology struct {
ID string `json:"id"`
I1 string `json:"i1"`
I2 string `json:"i2"`
N1 string `json:"n1"`
N2 string `json:"n2"`
Label string `json:"label,omitempty"`
Conditioning *LinkConditionConfiguration `json:"conditioning,omitempty"`
}
LinkTopology defines the data structure for a CML link in topology context. This is used for topology import/export operations, not for API operations.
type LinuxNativeSimulation ¶
type LinuxNativeSimulation struct {
LibvirtDomainDriver string `json:"libvirt_domain_driver"`
Driver string `json:"driver"`
DiskDriver string `json:"disk_driver"`
EFIBoot bool `json:"efi_boot"`
EFICode string `json:"efi_code"`
EFIVars string `json:"efi_vars"`
MachineType string `json:"machine_type"`
RAM int `json:"ram"`
CPUs int `json:"cpus"`
CPULimit int `json:"cpu_limit"`
CPUModel string `json:"cpu_model"`
NICDriver string `json:"nic_driver"`
DataVolume int `json:"data_volume"`
BootDiskSize int `json:"boot_disk_size"`
Video map[string]any `json:"video"`
EnableRNG bool `json:"enable_rng"`
EnableTPM bool `json:"enable_tpm"`
}
LinuxNativeSimulation represents Linux native simulation settings.
type Node ¶
type Node struct {
ID UUID `json:"id"`
LabID UUID `json:"lab_id"`
Label string `json:"label"`
X int `json:"x"`
Y int `json:"y"`
NodeDefinition string `json:"node_definition"`
CPUs int `json:"cpus"`
Priority *int `json:"priority,omitempty"`
PyATS *PyAtsCredentials `json:"pyats,omitempty"`
// Optional fields with proper null handling
ImageDefinition *string `json:"image_definition,omitempty"`
RAM *int `json:"ram,omitempty"`
CPUlimit *int `json:"cpu_limit,omitempty"`
DataVolume *int `json:"data_volume,omitempty"`
BootDiskSize *int `json:"boot_disk_size,omitempty"`
HideLinks *bool `json:"hide_links,omitempty"`
Tags []string `json:"tags,omitempty"`
State NodeState `json:"state,omitempty"`
BootProgress BootProgress `json:"boot_progress,omitempty"`
Operational *NodeOperational `json:"operational,omitempty"`
PinnedComputeID *UUID `json:"pinned_compute_id,omitempty"`
// Configuration can be string, array of NodeConfig, or single NodeConfig
Configuration any `json:"configuration,omitempty"`
Configurations []NodeConfig `json:"-"`
// Interfaces and SerialDevices are not in the main schema but used internally
Interfaces InterfaceList `json:"interfaces,omitempty"`
SerialDevices []SerialDevice `json:"serial_devices,omitempty"`
// Parameters field from schema
Parameters any `json:"parameters,omitempty"`
}
Node represents a CML node with its configuration and state.
func (*Node) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Node, handling named configurations.
func (*Node) SameConfig ¶
SameConfig compares the configuration of two nodes for equality.
func (*Node) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Node, handling flexible configuration field types.
type NodeConfig ¶
NodeConfig represents a named configuration for a node.
type NodeDefIcons ¶
type NodeDefIcons string
NodeDefIcons represents the icon type for a node definition.
const ( // NodeDefIconsRouter represents a router icon. NodeDefIconsRouter NodeDefIcons = "router" // NodeDefIconsSwitch represents a switch icon. NodeDefIconsSwitch NodeDefIcons = "switch" // NodeDefIconsServer represents a server icon. NodeDefIconsServer NodeDefIcons = "server" // NodeDefIconsHost represents a host icon. NodeDefIconsHost NodeDefIcons = "host" // NodeDefIconsCloud represents a cloud icon. NodeDefIconsCloud NodeDefIcons = "cloud" // NodeDefIconsFirewall represents a firewall icon. NodeDefIconsFirewall NodeDefIcons = "firewall" // NodeDefIconsAccessPoint represents an access point icon. NodeDefIconsAccessPoint NodeDefIcons = "access_point" // NodeDefIconsWl represents a wireless icon. NodeDefIconsWl NodeDefIcons = "wl" )
type NodeDefinition ¶
type NodeDefinition struct {
ID UUID `json:"id"`
Configuration NodeDefinitionConfiguration `json:"configuration"`
Device deviceData `json:"device"`
Inherited NodeDefinitionInherited `json:"inherited"`
SchemaVersion string `json:"schema_version"`
Sim simData `json:"sim"`
Boot NodeDefinitionBoot `json:"boot"`
PyATS NodeDefinitionPyats `json:"pyats"`
General NodeDefinitionGeneral `json:"general"`
UI NodeDefinitionUI `json:"ui"`
ImageDefinitions []string `json:"image_definitions,omitempty"`
}
NodeDefinition represents a node definition available on the CML controller. The node def data structure now matches the OpenAPI schema.
func (NodeDefinition) HasSerial ¶
func (nd NodeDefinition) HasSerial() bool
HasSerial returns true if the node definition has serial ports.
func (NodeDefinition) HasVNC ¶
func (nd NodeDefinition) HasVNC() bool
HasVNC returns true if the node definition supports VNC.
func (NodeDefinition) SerialPorts ¶
func (nd NodeDefinition) SerialPorts() int
SerialPorts returns the number of serial ports.
type NodeDefinitionBoot ¶
type NodeDefinitionBoot struct {
Timeout int `json:"timeout"`
Completed []string `json:"completed"`
UsesRegex bool `json:"uses_regex"`
}
NodeDefinitionBoot represents boot configuration for a node definition.
type NodeDefinitionConfiguration ¶
type NodeDefinitionConfiguration struct {
Generator GeneratorConfig `json:"generator"`
Provisioning ProvisioningConfig `json:"provisioning"`
}
NodeDefinitionConfiguration represents the configuration for a node definition.
type NodeDefinitionGeneral ¶
type NodeDefinitionGeneral struct {
Nature DeviceNature `json:"nature"`
Description string `json:"description"`
ReadOnly bool `json:"read_only"`
}
NodeDefinitionGeneral represents general configuration for a node definition.
type NodeDefinitionInherited ¶
type NodeDefinitionInherited struct {
Image VMProperties `json:"image"`
Node VMProperties `json:"node"`
}
NodeDefinitionInherited represents inherited properties for a node definition.
type NodeDefinitionMap ¶
type NodeDefinitionMap map[UUID]NodeDefinition
NodeDefinitionMap is a map of node UUIDs to node definitions.
type NodeDefinitionPyats ¶
type NodeDefinitionPyats struct {
OS string `json:"os"`
Series string `json:"series"`
Model string `json:"model"`
UseInTestbed bool `json:"use_in_testbed"`
Username *string `json:"username"`
Password *string `json:"password"`
ConfigExtractCommand *string `json:"config_extract_command"`
}
NodeDefinitionPyats represents pyATS configuration for a node definition.
type NodeDefinitionUI ¶
type NodeDefinitionUI struct {
LabelPrefix string `json:"label_prefix"`
Icon NodeDefIcons `json:"icon"`
Label string `json:"label"`
Visible bool `json:"visible"`
Group string `json:"group"`
Description string `json:"description"`
HasConfiguration bool `json:"has_configuration"`
ShowRAM bool `json:"show_ram"`
ShowCPUs bool `json:"show_cpus"`
ShowCPULimit bool `json:"show_cpu_limit"`
ShowDataVolume bool `json:"show_data_volume"`
ShowBootDiskSize bool `json:"show_boot_disk_size"`
HasConfigExtraction bool `json:"has_config_extraction"`
}
NodeDefinitionUI represents UI configuration for a node definition.
type NodeMap ¶
NodeMap is a map of node UUIDs to Node pointers.
func (NodeMap) MarshalJSON ¶
MarshalJSON implements json.Marshaler for NodeMap, sorting nodes by UUID for stable output.
type NodeOperational ¶
type NodeOperational struct {
BootDiskSize *int `json:"boot_disk_size"`
CPUlimit *int `json:"cpu_limit"`
CPUs *int `json:"cpus"`
DataVolume *int `json:"data_volume"`
RAM *int `json:"ram"`
ComputeID *UUID `json:"compute_id"`
ImageDefinition *string `json:"image_definition"`
VNCkey *UUID `json:"vnc_key"`
ResourcePool *string `json:"resource_pool,omitempty"`
IOLAppID *int `json:"iol_app_id,omitempty"`
SerialConsoles []SerialConsole `json:"serial_consoles,omitempty"`
}
NodeOperational contains operational data for a node.
type NodeParameters ¶
NodeParameters represents node-specific parameters.
type NodeStaging ¶
type NodeStaging struct {
Enabled bool `json:"enabled"`
StartRemaining bool `json:"start_remaining"`
AbortOnFailure bool `json:"abort_on_failure"`
}
NodeStaging represents lab node staging configuration. This matches the OpenAPI `NodeStaging` schema.
type NodeState ¶
type NodeState string
NodeState represents the operational state of a CML node.
const ( // NodeStateDefined indicates the node is defined on core. NodeStateDefined NodeState = "DEFINED_ON_CORE" // NodeStateStopped indicates the node is stopped. NodeStateStopped NodeState = "STOPPED" // NodeStateStarted indicates the node is started. NodeStateStarted NodeState = "STARTED" // NodeStateQueued indicates the node is queued for execution. NodeStateQueued NodeState = "QUEUED" // NodeStateBooted indicates the node is booted. NodeStateBooted NodeState = "BOOTED" // NodeStateDisconnected indicates the node is disconnected. NodeStateDisconnected NodeState = "DISCONNECTED" )
type NodeTile ¶
type NodeTile struct {
ID UUID `json:"id"`
Label string `json:"label"`
X float64 `json:"x"`
Y float64 `json:"y"`
NodeDefinition string `json:"node_definition"`
ImageDefinition *string `json:"image_definition"`
State string `json:"state"`
CPUs *int `json:"cpus"`
CPULimit *int `json:"cpu_limit"`
RAM *int `json:"ram"`
DataVolume *int `json:"data_volume"`
BootDiskSize *int `json:"boot_disk_size"`
Tags []any `json:"tags"` // Keep as any for now
}
NodeTile represents a node in the topology
type OldPermission ¶
type OldPermission string
OldPermission represents the old permission system for lab groups
const ( // OldPermissionReadOnly allows read-only access OldPermissionReadOnly OldPermission = "read_only" // OldPermissionReadWrite allows read-write access OldPermissionReadWrite OldPermission = "read_write" )
type Operational ¶
type Operational struct {
DeviceName *string `json:"device_name,omitempty"`
MACaddress *string `json:"mac_address,omitempty"`
SrcUDPport *int `json:"src_udp_port,omitempty"`
DstUDPport *int `json:"dst_udp_port,omitempty"`
}
Operational contains operational data for an interface.
type OptInState ¶
type OptInState string
OptInState represents the user's opt-in state.
const ( // OptInAccepted indicates the user has accepted opt-in. OptInAccepted OptInState = "accepted" // OptInDeclined indicates the user has declined opt-in. OptInDeclined OptInState = "declined" // OptInUnset indicates the opt-in state is not set. OptInUnset OptInState = "unset" )
type Permission ¶
type Permission string
Permission represents a permission level for CML resources.
const ( // PermissionAdmin grants administrative access. PermissionAdmin Permission = "lab_admin" // PermissionEdit allows editing resources. PermissionEdit Permission = "lab_edit" // PermissionExec allows executing operations. PermissionExec Permission = "lab_exec" // PermissionView allows viewing resources. PermissionView Permission = "lab_view" )
type ProvisioningConfig ¶
type ProvisioningConfig struct {
Files []map[string]any `json:"files"`
MediaType string `json:"media_type"`
VolumeName string `json:"volume_name"`
}
ProvisioningConfig represents provisioning configuration.
type PyAtsCredentials ¶
type PyAtsCredentials struct {
Username *string `json:"username"`
Password *string `json:"password"`
EnablePassword *string `json:"enable_password"`
}
PyAtsCredentials represents node-level PyATS credentials. This matches the OpenAPI 2.10 schema `PyAtsCredentials`.
type RectangleAnnotation ¶
type RectangleAnnotation struct {
X2 float64 `json:"x2"`
Y2 float64 `json:"y2"`
Rotation float64 `json:"rotation"`
Type AnnotationType `json:"type"`
BorderColor string `json:"border_color"`
BorderStyle BorderStyle `json:"border_style"`
Color string `json:"color"`
Thickness float64 `json:"thickness"`
X1 float64 `json:"x1"`
Y1 float64 `json:"y1"`
ZIndex float64 `json:"z_index"`
BorderRadius float64 `json:"border_radius"`
}
RectangleAnnotation represents a rectangle annotation.
type RectangleAnnotationPartial ¶
type RectangleAnnotationPartial struct {
X2 *float64 `json:"x2,omitempty"`
Y2 *float64 `json:"y2,omitempty"`
Rotation *float64 `json:"rotation,omitempty"`
Type AnnotationType `json:"type"`
BorderColor *string `json:"border_color,omitempty"`
BorderStyle *BorderStyle `json:"border_style,omitempty"`
Color *string `json:"color,omitempty"`
Thickness *float64 `json:"thickness,omitempty"`
X1 *float64 `json:"x1,omitempty"`
Y1 *float64 `json:"y1,omitempty"`
ZIndex *float64 `json:"z_index,omitempty"`
BorderRadius *float64 `json:"border_radius,omitempty"`
}
RectangleAnnotationPartial represents a partial rectangle annotation for updates.
type RectangleAnnotationResponse ¶
type RectangleAnnotationResponse struct {
ID UUID `json:"id"`
RectangleAnnotation
}
RectangleAnnotationResponse represents a rectangle annotation with ID.
type SerialConsole ¶
type SerialConsole struct {
ConsoleKey UUID `json:"console_key"`
DeviceNumber int `json:"device_number"`
Label string `json:"label,omitempty"`
}
SerialConsole represents a serial console for a node.
type SerialDevice ¶
type SerialDevice struct {
ConsoleKey UUID `json:"console_key"`
DeviceNumber int `json:"device_number"`
}
SerialDevice represents a serial device for a node.
type SimplifiedNodeDefinitionResponse ¶
type SimplifiedNodeDefinitionResponse struct {
ID string `json:"id"`
General any `json:"general"` // Keep as any for now
Device any `json:"device"` // Keep as any for now
UI any `json:"ui"` // Keep as any for now
Sim any `json:"sim"` // Keep as any for now
ImageDefinitions []string `json:"image_definitions"`
}
SimplifiedNodeDefinitionResponse represents a simplified node definition
type SmartAnnotation ¶
type SmartAnnotation struct {
ID UUID `json:"id"`
BorderColor *string `json:"border_color,omitempty"`
BorderStyle *BorderStyle `json:"border_style,omitempty"`
FillColor *string `json:"fill_color,omitempty"`
GroupDistance *int `json:"group_distance,omitempty"`
IsOn *bool `json:"is_on,omitempty"`
Label *string `json:"label,omitempty"`
Padding *int `json:"padding,omitempty"`
Tag *string `json:"tag,omitempty"`
TagOffsetX *int `json:"tag_offset_x,omitempty"`
TagOffsetY *int `json:"tag_offset_y,omitempty"`
TagSize *int `json:"tag_size,omitempty"`
Thickness *int `json:"thickness,omitempty"`
ZIndex *int `json:"z_index,omitempty"`
}
SmartAnnotation represents a smart annotation.
type SmartAnnotationUpdate ¶
type SmartAnnotationUpdate struct {
BorderColor *string `json:"border_color,omitempty"`
BorderStyle *BorderStyle `json:"border_style,omitempty"`
FillColor *string `json:"fill_color,omitempty"`
GroupDistance *int `json:"group_distance,omitempty"`
IsOn *bool `json:"is_on,omitempty"`
Label *string `json:"label,omitempty"`
Padding *int `json:"padding,omitempty"`
Tag *string `json:"tag,omitempty"`
TagOffsetX *int `json:"tag_offset_x,omitempty"`
TagOffsetY *int `json:"tag_offset_y,omitempty"`
TagSize *int `json:"tag_size,omitempty"`
Thickness *int `json:"thickness,omitempty"`
ZIndex *int `json:"z_index,omitempty"`
}
SmartAnnotationUpdate represents a smart annotation update payload.
type Stats ¶
type Stats struct {
// Primary data structure - everything computed from this
EndpointGroups map[string]*EndpointStats // Key: "METHOD /path/{id}/subpath/{id}"
}
Stats holds basic API call statistics
func (*Stats) CallsByEndpoint ¶
CallsByEndpoint returns call counts grouped by normalized endpoint
func (*Stats) CallsByMethod ¶
CallsByMethod returns call counts grouped by HTTP method
func (*Stats) RecordCall ¶
RecordCall records a single API call with endpoint grouping
func (*Stats) StatusCounts ¶
StatusCounts returns total status code counts across all endpoints
func (*Stats) TotalCalls ¶
TotalCalls returns the total number of API calls
type SystemInformation ¶
type SystemInformation struct {
Version string `json:"version"`
Ready bool `json:"ready"`
AllowSSHPubkeyAuth bool `json:"allow_ssh_pubkey_auth"`
OUI *string `json:"oui"`
Timeout int `json:"timeout,omitempty"`
Features map[string]bool `json:"features,omitempty"`
}
SystemInformation represents system information from CML
type TextAnnotation ¶
type TextAnnotation struct {
Rotation float64 `json:"rotation"`
Type AnnotationType `json:"type"`
BorderColor string `json:"border_color"`
BorderStyle BorderStyle `json:"border_style"`
Color string `json:"color"`
Thickness float64 `json:"thickness"`
X1 float64 `json:"x1"`
Y1 float64 `json:"y1"`
ZIndex float64 `json:"z_index"`
TextBold bool `json:"text_bold"`
TextContent string `json:"text_content"`
TextFont string `json:"text_font"`
TextItalic bool `json:"text_italic"`
TextSize float64 `json:"text_size"`
TextUnit string `json:"text_unit"`
}
TextAnnotation represents a text annotation.
type TextAnnotationPartial ¶
type TextAnnotationPartial struct {
Rotation *float64 `json:"rotation,omitempty"`
Type AnnotationType `json:"type"`
BorderColor *string `json:"border_color,omitempty"`
BorderStyle *BorderStyle `json:"border_style,omitempty"`
Color *string `json:"color,omitempty"`
Thickness *float64 `json:"thickness,omitempty"`
X1 *float64 `json:"x1,omitempty"`
Y1 *float64 `json:"y1,omitempty"`
ZIndex *float64 `json:"z_index,omitempty"`
TextBold *bool `json:"text_bold,omitempty"`
TextContent *string `json:"text_content,omitempty"`
TextFont *string `json:"text_font,omitempty"`
TextItalic *bool `json:"text_italic,omitempty"`
TextSize *float64 `json:"text_size,omitempty"`
TextUnit *string `json:"text_unit,omitempty"`
}
TextAnnotationPartial represents a partial text annotation for updates.
type TextAnnotationResponse ¶
type TextAnnotationResponse struct {
ID UUID `json:"id"`
TextAnnotation
}
TextAnnotationResponse represents a text annotation with ID.
type Topology ¶
type Topology struct {
Nodes []NodeTile `json:"nodes"`
Links []LinkTile `json:"links"`
Annotations []AnnotationTile `json:"annotations"`
SmartAnnotations []any `json:"smart_annotations"` // Keep as any for now
}
Topology represents the lab topology with nodes and links
type UpdatePassword ¶
UpdatePassword represents a password update request.
type UsageEstimations ¶
UsageEstimations represents resource usage estimates.
type User ¶
type User struct {
UserBase
ID UUID `json:"id,omitempty"`
Created string `json:"created,omitempty"`
Modified string `json:"modified,omitempty"`
DirectoryDN string `json:"directory_dn,omitempty"`
Labs []UUID `json:"labs,omitempty"`
Password string `json:"password,omitempty"` // For backward compatibility
}
User represents a CML user with additional metadata.
func (*User) UnmarshalJSON ¶
UnmarshalJSON provides backwards-compatible handling for opt_in.
CML versions have been observed returning opt_in as: - boolean (legacy): true/false - string (newer): "accepted" (and possibly other states)
type UserBase ¶
type UserBase struct {
Username string `json:"username"`
Fullname string `json:"fullname"`
Description string `json:"description"`
Email string `json:"email"`
IsAdmin bool `json:"admin"`
Groups []UUID `json:"groups,omitempty"`
Associations AssociationList `json:"associations,omitempty"` // with 2.9.0
ResourcePool *UUID `json:"resource_pool,omitempty"` // with 2.5.0
OptIn *OptInState `json:"opt_in,omitempty"` // with 2.5.0
TourVersion string `json:"tour_version"`
PubkeyInfo string `json:"pubkey_info,omitempty"`
}
UserBase contains common user fields.
type UserCreateRequest ¶
UserCreateRequest represents the data required to create a new user.
func NewUserCreateRequest ¶
func NewUserCreateRequest(username, password string) UserCreateRequest
NewUserCreateRequest creates a new UserCreateRequest with the given username and password.
type UserUpdateRequest ¶
type UserUpdateRequest struct {
UserBase
Password *UpdatePassword `json:"password,omitempty"`
}
UserUpdateRequest represents the data for updating a user.