Skip to content

Commit

Permalink
Merge pull request #194 from Cray-HPE/ngsm-test
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsalmela authored May 29, 2024
2 parents 3452be4 + 9681fde commit c39e056
Show file tree
Hide file tree
Showing 1,004 changed files with 591,626 additions and 6 deletions.
2 changes: 2 additions & 0 deletions cmd/session/session_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ func initSessionWithProviderCmd(cmd *cobra.Command, args []string) (err error) {
switch root.D.Provider {
case taxonomy.CSM:
root.D.DatastorePath = filepath.Join(config.ConfigDir, taxonomy.DsFileCSM)
case taxonomy.Ngsm:
root.D.DatastorePath = filepath.Join(config.ConfigDir, taxonomy.DsFile)
default:
err = fmt.Errorf("not a valid provider: %s", root.D.Provider)
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/taxonomy/taxonomy.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
const (
App = "cani"
CSM = "csm"
Ngsm = "ngsm"
DsFile = App + "db.json"
DsFileCSM = App + "db.json"
LogFile = App + "db.log"
Expand All @@ -49,7 +50,7 @@ const (
var (
DsPath = filepath.Join(CfgDir, DsFile)
CfgPath = filepath.Join(CfgDir, CfgFile)
SupportedProviders = []string{CSM}
SupportedProviders = []string{CSM, Ngsm}
)

func Init() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func MergeProviderFlags(providerCmd *cobra.Command, caniCmd *cobra.Command) (err
// at present, the user must run commands + provider name, like:
//
// cani add cabinet csm
// cani list blade hpengi
// cani list blade ngsm
//
// this requires hiding the provider sub command and dynamically executing it, as opposed to making the user type it in
func RegisterProviderCommand(p provider.InventoryProvider, caniCmd *cobra.Command) (err error) {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/antihax/optional v1.0.0
github.com/fatih/color v1.13.0
github.com/fatih/structs v1.1.0
github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a
github.com/google/uuid v1.3.0
github.com/hashicorp/go-retryablehttp v0.7.2
github.com/manifoldco/promptui v0.9.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM=
github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a h1:RYfmiM0zluBJOiPDJseKLEN4BapJ42uSi9SZBQ2YyiA=
github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI=
github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
Expand Down
6 changes: 6 additions & 0 deletions internal/domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/Cray-HPE/cani/internal/inventory"
"github.com/Cray-HPE/cani/internal/provider"
"github.com/Cray-HPE/cani/internal/provider/csm"
"github.com/Cray-HPE/cani/internal/provider/ngsm"
"github.com/Cray-HPE/cani/pkg/hardwaretypes"
"github.com/google/uuid"
"github.com/rs/zerolog/log"
Expand Down Expand Up @@ -90,6 +91,8 @@ func (d *Domain) SetupDomain(cmd *cobra.Command, args []string, configDomains ma
switch d.Provider {
case taxonomy.CSM:
d.datastore, err = inventory.NewDatastoreJSONCSM(d.DatastorePath, d.LogFilePath, inventory.Provider(d.Provider))
case taxonomy.Ngsm:
d.datastore, err = inventory.NewDatastoreJSON(d.DatastorePath, d.LogFilePath, inventory.Provider(d.Provider))
default:
return fmt.Errorf("invalid provider: %s", d.Provider)
}
Expand All @@ -116,6 +119,8 @@ func (d *Domain) SetupDomain(cmd *cobra.Command, args []string, configDomains ma
switch d.Provider {
case taxonomy.CSM:
d.externalInventoryProvider, err = csm.New(cmd, args, d.hardwareTypeLibrary, d.Options)
case taxonomy.Ngsm:
d.externalInventoryProvider, err = ngsm.New(cmd, args, d.hardwareTypeLibrary, d.Options)
default:
return fmt.Errorf("unknown external inventory provider provided (%s)", d.Provider)
}
Expand Down Expand Up @@ -166,6 +171,7 @@ type UpdatedHardwareResult struct {
func GetProviders() []provider.InventoryProvider {
supportedProviders := []provider.InventoryProvider{
&csm.CSM{},
&ngsm.Ngsm{},
}
return supportedProviders
}
Expand Down
3 changes: 3 additions & 0 deletions internal/domain/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"fmt"

"github.com/Cray-HPE/cani/internal/provider/csm"
"github.com/Cray-HPE/cani/internal/provider/ngsm"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
Expand All @@ -43,6 +44,8 @@ func NewProviderCmd(caniCmd *cobra.Command, p string) (providerCmd *cobra.Comman
switch p {
case "csm":
providerCmd, err = csm.NewProviderCmd(caniCmd)
case "ngsm":
providerCmd, err = ngsm.NewProviderCmd(caniCmd)
default:
err = fmt.Errorf("no command matched for provider %s", p)
}
Expand Down
77 changes: 77 additions & 0 deletions internal/netbox/device-types/HPE/Apollo-35.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#
# MIT License
#
# (C) Copyright 2024 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.
#
---
manufacturer: HPE
model: HPE Apollo 35 System
slug: hpe-apollo-35-system
u_height: 2
is_full_depth: true
console-ports:
- name: Serial
type: de-9
- name: VGA
type: other
module-bays:
- name: PSU1
position: PSU1
- name: PSU2
position: PSU2
- name: FlexLOM
position: FlexLOM
- name: PCIe1
position: PCIe1
label: primary riser
- name: PCIe2
position: PCIe2
label: primary riser
- name: PCIe3
position: PCIe3
label: primary riser
- name: PCIe4
position: PCIe4
label: secondary riser
- name: PCIe5
position: PCIe5
label: secondary riser
- name: PCIe6
position: PCIe6
label: secondary riser
- name: PCIe7
position: PCIe7
label: tertiary riser
- name: PCIe8
position: PCIe8
label: tertiary riser
interfaces:
- name: Gig-E 1
type: 1000base-t
- name: Gig-E 2
type: 1000base-t
- name: Gig-E 3
type: 1000base-t
- name: Gig-E 4
type: 1000base-t
- name: iLO
type: 1000base-t
mgmt_only: true
152 changes: 152 additions & 0 deletions internal/netbox/device-types/HPE/Aruba-6300M-48G.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#
# MIT License
#
# (C) Copyright 2024 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.
#
---
manufacturer: HPE
model: HPE Aruba Networking CX 6300M 48G Power-to-Port Airflow 2 Fans 1 Power Supply Unit Bundle
slug: hpe-aruba-6300m-48g
part_number: R9F63A
u_height: 1
is_full_depth: false
console-ports:
- name: usb-c
type: usb-c
- name: usb-ble
type: usb-a
power-ports:
- name: ps1
type: iec-60320-c14
maximum_draw: 250
allocated_draw: 75
- name: ps2
type: iec-60320-c14
maximum_draw: 250
allocated_draw: 75
interfaces:
- name: 1/1/1
type: 1000base-t
- name: 1/1/2
type: 1000base-t
- name: 1/1/3
type: 1000base-t
- name: 1/1/4
type: 1000base-t
- name: 1/1/5
type: 1000base-t
- name: 1/1/6
type: 1000base-t
- name: 1/1/7
type: 1000base-t
- name: 1/1/8
type: 1000base-t
- name: 1/1/9
type: 1000base-t
- name: 1/1/10
type: 1000base-t
- name: 1/1/11
type: 1000base-t
- name: 1/1/12
type: 1000base-t
- name: 1/1/13
type: 1000base-t
- name: 1/1/14
type: 1000base-t
- name: 1/1/15
type: 1000base-t
- name: 1/1/16
type: 1000base-t
- name: 1/1/17
type: 1000base-t
- name: 1/1/18
type: 1000base-t
- name: 1/1/19
type: 1000base-t
- name: 1/1/20
type: 1000base-t
- name: 1/1/21
type: 1000base-t
- name: 1/1/22
type: 1000base-t
- name: 1/1/23
type: 1000base-t
- name: 1/1/24
type: 1000base-t
- name: 1/1/25
type: 1000base-t
- name: 1/1/26
type: 1000base-t
- name: 1/1/27
type: 1000base-t
- name: 1/1/28
type: 1000base-t
- name: 1/1/29
type: 1000base-t
- name: 1/1/30
type: 1000base-t
- name: 1/1/31
type: 1000base-t
- name: 1/1/32
type: 1000base-t
- name: 1/1/33
type: 1000base-t
- name: 1/1/34
type: 1000base-t
- name: 1/1/35
type: 1000base-t
- name: 1/1/36
type: 1000base-t
- name: 1/1/37
type: 1000base-t
- name: 1/1/38
type: 1000base-t
- name: 1/1/39
type: 1000base-t
- name: 1/1/40
type: 1000base-t
- name: 1/1/41
type: 1000base-t
- name: 1/1/42
type: 1000base-t
- name: 1/1/43
type: 1000base-t
- name: 1/1/44
type: 1000base-t
- name: 1/1/45
type: 1000base-t
- name: 1/1/46
type: 1000base-t
- name: 1/1/47
type: 1000base-t
- name: 1/1/48
type: 1000base-t
- name: 1/1/49
type: 25gbase-x-sfp28
- name: 1/1/50
type: 25gbase-x-sfp28
- name: 1/1/51
type: 25gbase-x-sfp28
- name: 1/1/52
type: 25gbase-x-sfp28
- name: mgmt
type: 1000base-t
mgmt_only: true
Loading

0 comments on commit c39e056

Please sign in to comment.