csm

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

* * MIT License * * (C) Copyright 2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *

Index

Constants

View Source
const (
	ProviderMetadataVlanId  = "HMNVlan"
	ProviderMetadataRole    = "Role"
	ProviderMetadataSubRole = "SubRole"
	ProviderMetadataAlias   = "Alias"
	ProviderMetadataNID     = "NID"
)

Variables

This section is empty.

Functions

func BuildExpectedHardwareState

func BuildExpectedHardwareState(hardwareTypeLibrary hardwaretypes.Library, datastore inventory.Datastore, slsNetworks map[string]sls_client.Network) (sls_client.SlsState, map[string]inventory.Hardware, error)

func BuildSLSHardware

func BuildSLSHardware(cHardware inventory.Hardware, locationPath inventory.LocationPath, class sls_client.HardwareClass, slsNetworks map[string]sls_client.Network) (sls_client.Hardware, error)

func BuildSLSMgmtSwitchConnector

func BuildSLSMgmtSwitchConnector(hardware sls_client.Hardware, cHardware inventory.Hardware) (sls_client.Hardware, error)

func BuildXname

func BuildXname(cHardware inventory.Hardware, locationPath inventory.LocationPath) (xnames.Xname, error)

func BuildXnameT

func BuildXnameT[T xnames.Xname](cHardware inventory.Hardware, locationPath inventory.LocationPath) (*T, error)

func DetermineEndingVlanFromSlug

func DetermineEndingVlanFromSlug(deviceTypeSlug string, hardwareTypeLibrary hardwaretypes.Library) (int, error)

func DetermineHardwareClass

func DetermineHardwareClass(hardware inventory.Hardware, data inventory.Inventory, hardwareTypeLibrary hardwaretypes.Library) (sls_client.HardwareClass, error)

func DetermineHardwareClassFromSlug

func DetermineHardwareClassFromSlug(deviceTypeSlug string, hardwareTypeLibrary hardwaretypes.Library) (sls_client.HardwareClass, error)

func DetermineStartingOrdinalFromSlug

func DetermineStartingOrdinalFromSlug(deviceTypeSlug string, hardwareTypeLibrary hardwaretypes.Library) (int, error)

func DetermineStartingVlanFromSlug

func DetermineStartingVlanFromSlug(deviceTypeSlug string, hardwareTypeLibrary hardwaretypes.Library) (int, error)

func EncodeProviderMetadata

func EncodeProviderMetadata(metadata Metadata) (result map[string]interface{}, err error)

func FromXname

func FromXname(xnameRaw xnames.Xname) (inventory.LocationPath, error)

func GetHMSType

func GetHMSType(cHardware inventory.Hardware, locationPath inventory.LocationPath) (xnametypes.HMSType, error)

func GetXnameTypeConverters

func GetXnameTypeConverters() map[xnametypes.HMSType]XnameConverter

func NewAddCabinetCommand added in v0.4.0

func NewAddCabinetCommand() (cmd *cobra.Command, err error)

func NewAddNodeCommand added in v0.4.0

func NewAddNodeCommand() (cmd *cobra.Command, err error)

func NewExportCommand added in v0.4.0

func NewExportCommand() (cmd *cobra.Command, err error)

func NewImportCommand added in v0.4.0

func NewImportCommand() (cmd *cobra.Command, err error)

func NewSessionInitCommand added in v0.4.0

func NewSessionInitCommand() (cmd *cobra.Command, err error)

func NewUpdateNodeCommand added in v0.4.0

func NewUpdateNodeCommand() (cmd *cobra.Command, err error)

func UpdateAddCabinetCommand added in v0.4.0

func UpdateAddCabinetCommand(caniCmd *cobra.Command) error

UpdateAddCabinetCommand is run during init and allows the provider to set additional options for CANI flags such as marking certain options mutually exclusive with the auto flag

func UpdateUpdateNodeCommand added in v0.4.0

func UpdateUpdateNodeCommand(caniCmd *cobra.Command) error

UpdateUpdateNodeCommand

Types

type CSM

type CSM struct {
	TBV     *validate.ToBeValidated
	Options *CsmOpts
	// contains filtered or unexported fields
}

func New

func New(cmd *cobra.Command, args []string, hwlib *hardwaretypes.Library, opts interface{}) (csm *CSM, err error)

Need to load from existing if not init

func (*CSM) BuildHardwareMetadata

func (csm *CSM) BuildHardwareMetadata(cHardware *inventory.Hardware, cmd *cobra.Command, args []string, recommendations provider.HardwareRecommendations) error

func (*CSM) Export added in v0.4.0

func (csm *CSM) Export(cmd *cobra.Command, args []string, datastore inventory.Datastore) error

func (*CSM) GetFieldMetadata added in v0.2.0

func (csm *CSM) GetFieldMetadata() ([]provider.FieldMetadata, error)

func (*CSM) GetFields

func (csm *CSM) GetFields(hw *inventory.Hardware, fieldNames []string) (values []string, err error)

func (*CSM) GetProviderOptions added in v0.4.0

func (csm *CSM) GetProviderOptions() (interface{}, error)

func (*CSM) Import

func (csm *CSM) Import(cmd *cobra.Command, args []string, datastore inventory.Datastore) error

func (*CSM) ImportInit added in v0.4.0

func (csm *CSM) ImportInit(cmd *cobra.Command, args []string, datastore inventory.Datastore) error

func (*CSM) ListCabinetMetadataColumns added in v0.4.0

func (csm *CSM) ListCabinetMetadataColumns() (columns []string)

ListCabinetMetadataColumns returns a slice of strings, which are columns names of CSM-specific metadata to be shown when listing cabinets

func (*CSM) ListCabinetMetadataRow added in v0.4.0

func (csm *CSM) ListCabinetMetadataRow(hw inventory.Hardware) (values []string, err error)

ListCabinetMetadataRow returns a slice of strings, which are values from the hardware that correlate to the columns they will be shown in

func (*CSM) NewHardwareMetadata added in v0.4.0

func (csm *CSM) NewHardwareMetadata(hw *inventory.Hardware, cmd *cobra.Command, args []string) (err error)

func (*CSM) PrintHardware added in v0.4.0

func (csm *CSM) PrintHardware(hw *inventory.Hardware)

func (*CSM) RecommendHardware added in v0.2.0

func (csm *CSM) RecommendHardware(inv inventory.Inventory, cmd *cobra.Command, args []string, auto bool) (recommended provider.HardwareRecommendations, err error)

func (*CSM) Reconcile

func (csm *CSM) Reconcile(cmd *cobra.Command, args []string, datastore inventory.Datastore, dryrun bool, ignoreExternalValidation bool) (err error)

Reconcile CANI's inventory state with the external inventory state and apply required changes TODO perhaps Reconcile should return a ReconcileResult struct, that can contain what the provider wants to do This would enable these two things

  • Provide a way to pass downwards the result, and allow for a custom string/Presentation function to format the results in a human readable way
  • Allow for a process like the following: 1. Figure out what has changed 2. Validate the changes 3. Display what changed 4. Make changes

func (*CSM) SetFields

func (csm *CSM) SetFields(hw *inventory.Hardware, values map[string]string) (result provider.SetFieldsResult, err error)

func (*CSM) SetProviderOptions added in v0.4.0

func (csm *CSM) SetProviderOptions(cmd *cobra.Command, args []string) error

func (*CSM) SetProviderOptionsInterface added in v0.4.0

func (csm *CSM) SetProviderOptionsInterface(opts interface{}) error

func (*CSM) ValidateExternal

func (csm *CSM) ValidateExternal(cmd *cobra.Command, args []string) error

Validate the external services of the inventory provider are correct

func (*CSM) ValidateInternal

func (csm *CSM) ValidateInternal(cmd *cobra.Command, args []string, datastore inventory.Datastore, enableRequiredDataChecks bool) (map[uuid.UUID]provider.HardwareValidationResult, error)

Validate the representation of the inventory data into the destination inventory system is consistent. The default set of checks will verify all currently provided data is valid. If enableRequiredDataChecks is set to true, additional checks focusing on missing data will be ran.

type CabinetMetadata

type CabinetMetadata struct {
	HMNVlan *int `json:"HMNVlan" mapstructure:"HMNVlan"`
}

type CsmOpts added in v0.4.0

type CsmOpts struct {
	UseSimulation      bool
	InsecureSkipVerify bool
	APIGatewayToken    string
	BaseUrlSLS         string
	BaseUrlHSM         string
	SecretName         string
	K8sPodsCidr        string
	K8sServicesCidr    string
	KubeConfig         string
	ClientID           string `json:"-" yaml:"-"` // omit credentials from cani.yml
	ClientSecret       string `json:"-" yaml:"-"` // omit credentials from cani.yml
	ProviderHost       string
	TokenUsername      string `json:"-" yaml:"-"` // omit credentials from cani.yml
	TokenPassword      string `json:"-" yaml:"-"` // omit credentials from cani.yml
	CaCertPath         string
	ValidRoles         []string
	ValidSubRoles      []string
}

type HardwareChanges

type HardwareChanges struct {
	Removed   []sls_client.Hardware
	Added     []sls_client.Hardware
	Changed   []sls.HardwarePair
	Identical []sls_client.Hardware
}

type IPReservationChange

type IPReservationChange struct {
	NetworkName   string
	SubnetName    string
	IPReservation sls_client.NetworkIpReservation

	// This is the hardware object that triggered the change
	// If empty, then this was not changed by hardware
	ChangedByXname string
}

type Metadata

type Metadata struct {
	Cabinet *CabinetMetadata `json:"Cabinet,omitempty" mapstructure:"Cabinet,omitempty"`
	Node    *NodeMetadata    `json:"Node,omitempty" mapstructure:"Node,omitempty"`
}

func DecodeProviderMetadata

func DecodeProviderMetadata(cHardware inventory.Hardware) (result Metadata, err error)

DecodeProviderMetadata return a Metadata structure from the given hardwares CSM Provider properties. If the hardware doesn't have any metadata set an empty Metadata struct will be returned.

type NetworkChanges

type NetworkChanges struct {
	ModifiedNetworks map[string]sls_client.Network

	// The following fields are for book keeping to trigger other events
	SubnetsAdded        []SubnetChange
	IPReservationsAdded []IPReservationChange
}

type NodeMetadata

type NodeMetadata struct {
	Role                 *string                `json:"Role" mapstructure:"Role"`
	SubRole              *string                `json:"SubRole" mapstructure:"SubRole"`
	Nid                  *int                   `json:"Nid" mapstructure:"Nid"`
	Alias                []string               `json:"Alias" mapstructure:"Alias"`
	AdditionalProperties map[string]interface{} `json:"AdditionalProperties" mapstructure:"AdditionalProperties"`
}

func (*NodeMetadata) Pretty

func (nm *NodeMetadata) Pretty() (prettyNm NodeMetadataStrings)

type NodeMetadataStrings

type NodeMetadataStrings struct {
	Role                 string
	SubRole              string
	Nid                  string
	Alias                []string
	AdditionalProperties map[string]interface{}
}

type SubnetChange

type SubnetChange struct {
	NetworkName string
	Subnet      sls_client.NetworkIpv4Subnet
}

type XnameConverter

type XnameConverter struct {
	XnameOrdinalMapping []XnameOrdinal
	PropertyMatcher     func(cHardware inventory.Hardware) (bool, error) // IF nil, match all
}

func (*XnameConverter) GetHardwareTypePath

func (xc *XnameConverter) GetHardwareTypePath() hardwaretypes.HardwareTypePath

func (*XnameConverter) GetOrdinalIndexMapping

func (xc *XnameConverter) GetOrdinalIndexMapping() (result []int)

func (*XnameConverter) Match

func (xc *XnameConverter) Match(cHardware inventory.Hardware, locationPath inventory.LocationPath) (bool, error)

type XnameOrdinal

type XnameOrdinal struct {
	HardwareType              hardwaretypes.HardwareType
	HardwarePathLocationIndex int
}

XnameOrdinal is the mapping between the ordinal withing an xname to a hardware type in a location path

Directories

Path Synopsis
* * MIT License * * (C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software.
* * MIT License * * (C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software.
* * MIT License * * (C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software.
* * MIT License * * (C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software.

Jump to

Keyboard shortcuts

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