Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(service): switch from http to https #56

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
74329d4
fix(cli): consolidate and repair backend error handling
scott-howe-1 Nov 21, 2024
ebeea1a
fix(cli): Remove unnecessary log message.
scott-howe-1 Nov 21, 2024
43fcc13
docs(cli): add function description
scott-howe-1 Nov 21, 2024
b440888
feat(service): switch to using https (remove http)
scott-howe-1 Nov 21, 2024
6231ad2
feat(cli): add https support
scott-howe-1 Nov 21, 2024
528489f
Merge branch 'main' into feat/service-switch-to-https
scott-howe-1 Nov 22, 2024
e7822f5
Merge commit '211a099d878427fd0fbcc1089130285cbc1a34a5' into feat/ser…
scott-howe-1 Dec 2, 2024
2788573
fix(service): fix device discovery error handling during service star…
scott-howe-1 Dec 4, 2024
f6d7c55
refactor(cli): command usage and example string generation refactor a…
scott-howe-1 Dec 4, 2024
cd1aceb
Merge branch 'main' into feat/service-switch-to-https
scott-howe-1 Dec 4, 2024
5c63d28
feat(webui): device discovery in cfm webui (#58)
Meng-20 Dec 6, 2024
5a6dc7e
fix(docker): update the docker running command to make D-bus availabl…
Meng-20 Dec 6, 2024
4faa226
fix(service): fix error handling bugs during add blade\host (#61)
scott-howe-1 Dec 6, 2024
e35f12f
Merge branch 'main' into feat/service-switch-to-https
scott-howe-1 Dec 6, 2024
701d222
Merge branch 'main' into feat/service-switch-to-https
scott-howe-1 Dec 10, 2024
1b634df
Merge branch 'main' into feat/service-switch-to-https
scott-howe-1 Dec 11, 2024
22a3312
Merge branch 'main' into feat/service-switch-to-https
scott-howe-1 Dec 17, 2024
f194f8d
Merge branch 'main' into feat/service-switch-to-https
scott-howe-1 Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions cli/pkg/serviceLib/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

package flags

// Constants
const (
PROTOCOL_HTTP = "http"
PROTOCOL_HTTPS = "https"
)

// CLI flag component descriptor
const (
SERVICE string = "service"
Expand Down Expand Up @@ -131,26 +137,26 @@ const (
SERVICE_NET_IP_DFLT string = "127.0.0.1"
SERVICE_NET_PORT_DFLT uint16 = 8080
SERVICE_INSECURE_DFLT bool = false
SERVICE_PROTOCOL_DFLT string = "http"
SERVICE_PROTOCOL_DFLT string = PROTOCOL_HTTPS

APPLIANCE_NET_IP_DFLT string = "127.0.0.1"
APPLIANCE_NET_PORT_DFLT uint16 = 443
APPLIANCE_INSECURE_DFLT bool = false
APPLIANCE_PROTOCOL_DFLT string = "https"
APPLIANCE_PROTOCOL_DFLT string = PROTOCOL_HTTPS
APPLIANCE_USERNAME_DFLT string = "dummyuser"
APPLIANCE_PASSWORD_DFLT string = "dummypswd"

BLADE_NET_IP_DFLT string = "127.0.0.1"
BLADE_NET_PORT_DFLT uint16 = 443
BLADE_INSECURE_DFLT bool = false
BLADE_PROTOCOL_DFLT string = "https"
BLADE_PROTOCOL_DFLT string = PROTOCOL_HTTPS
BLADE_USERNAME_DFLT string = "root"
BLADE_PASSWORD_DFLT string = "0penBmc"

HOST_NET_IP_DFLT string = "127.0.0.1"
HOST_NET_PORT_DFLT uint16 = 8082
HOST_INSECURE_DFLT bool = false
HOST_PROTOCOL_DFLT string = "http"
HOST_PROTOCOL_DFLT string = PROTOCOL_HTTP
HOST_USERNAME_DFLT string = "admin"
HOST_PASSWORD_DFLT string = "admin12345"

Expand Down
10 changes: 5 additions & 5 deletions cli/pkg/serviceLib/serviceRequests/appliances.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (r *ServiceRequestAddAppliance) Execute() (*service.Appliance, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "AppliancesCred", fmt.Sprintf("%+v", *r.ApplianceCred))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ApplianceTcp", fmt.Sprintf("%+v", *r.ApplianceTcp))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

insecure := r.ApplianceTcp.GetInsecure()
protocol := r.ApplianceTcp.GetProtocol()
Expand Down Expand Up @@ -79,7 +79,7 @@ func (r *ServiceRequestDeleteAppliance) Execute() (*service.Appliance, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ServiceTcp", fmt.Sprintf("%+v", *r.ServiceTcp))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ApplianceId", fmt.Sprintf("%+v", *r.ApplianceId))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

deletedAppliance, err := serviceWrap.DeleteApplianceById(serviceClient, r.ApplianceId.GetId())
if err != nil {
Expand All @@ -102,7 +102,7 @@ func NewServiceRequestListAppliances(cmd *cobra.Command) *ServiceRequestListAppl
func (r *ServiceRequestListAppliances) Execute() (*[]*service.Appliance, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ServiceTcp", fmt.Sprintf("%+v", *r.ServiceTcp))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.ip, r.ServiceTcp.port)
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

appliances, err := serviceWrap.GetAllAppliances(serviceClient)
if err != nil {
Expand Down Expand Up @@ -147,7 +147,7 @@ func (r *ServiceRequestRenameAppliance) Execute() (*service.Appliance, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ApplianceId", fmt.Sprintf("%+v", *r.ApplianceId))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "NewApplianceId", fmt.Sprintf("%+v", *r.NewApplianceId))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

appliance, err := serviceWrap.RenameApplianceById(serviceClient, r.ApplianceId.GetId(), r.NewApplianceId.GetId())
if err != nil {
Expand All @@ -173,7 +173,7 @@ func (r *ServiceRequestResyncAppliance) Execute() (*service.Appliance, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ServiceTcp", fmt.Sprintf("%+v", *r.ServiceTcp))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ApplianceId", fmt.Sprintf("%+v", *r.ApplianceId))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

appliance, err := serviceWrap.ResyncApplianceById(serviceClient, r.ApplianceId.GetId())
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions cli/pkg/serviceLib/serviceRequests/blades.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (r *ServiceRequestAddBlade) Execute() (*service.Blade, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "BladeCred", fmt.Sprintf("%+v", *r.BladeCred))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "BladeTcp", fmt.Sprintf("%+v", *r.BladeTcp))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

insecure := r.BladeTcp.GetInsecure()
protocol := r.BladeTcp.GetProtocol()
Expand Down Expand Up @@ -82,7 +82,7 @@ func (r *ServiceRequestDeleteBlade) Execute() (*service.Blade, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ApplianceId", fmt.Sprintf("%+v", *r.ApplianceId))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "BladeId", fmt.Sprintf("%+v", *r.BladeId))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

blade, err := serviceWrap.DeleteBladeById(serviceClient, r.ApplianceId.GetId(), r.BladeId.GetId())
if err != nil {
Expand Down Expand Up @@ -123,7 +123,7 @@ func (r *ServiceRequestListBlades) Execute() (*serviceWrap.ApplianceBladeSummary
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ServiceTcp", fmt.Sprintf("%+v", *r.ServiceTcp))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ApplianceId", fmt.Sprintf("%+v", *r.ApplianceId))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

if !r.AllAppliances() && !r.AllBlades() {
blade, err := serviceWrap.FindBladeById_SingleAppl(serviceClient, r.ApplianceId.GetId(), r.BladeId.GetId())
Expand Down Expand Up @@ -201,7 +201,7 @@ func (r *ServiceRequestRenameBlade) Execute() (*service.Blade, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "BladeId", fmt.Sprintf("%+v", *r.BladeId))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "NewBladeId", fmt.Sprintf("%+v", *r.NewBladeId))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

blade, err := serviceWrap.RenameBladeById(serviceClient, r.ApplianceId.GetId(), r.BladeId.GetId(), r.NewBladeId.GetId())
if err != nil {
Expand Down Expand Up @@ -230,7 +230,7 @@ func (r *ServiceRequestResyncBlade) Execute() (*service.Blade, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ApplianceId", fmt.Sprintf("%+v", *r.ApplianceId))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "BladeId", fmt.Sprintf("%+v", *r.BladeId))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

blade, err := serviceWrap.ResyncBladeById(serviceClient, r.ApplianceId.GetId(), r.BladeId.GetId())
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions cli/pkg/serviceLib/serviceRequests/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (r *ServiceRequestAddHost) Execute() (*service.Host, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "HostCred", fmt.Sprintf("%+v", *r.HostCred))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "HostTcp", fmt.Sprintf("%+v", *r.HostTcp))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

insecure := r.HostTcp.GetInsecure()
protocol := r.HostTcp.GetProtocol()
Expand Down Expand Up @@ -79,7 +79,7 @@ func (r *ServiceRequestDeleteHost) Execute() (*service.Host, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ServiceTcp", fmt.Sprintf("%+v", *r.ServiceTcp))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "HostId", fmt.Sprintf("%+v", *r.HostId))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

host, err = serviceWrap.DeleteHostById(serviceClient, r.HostId.GetId())
if err != nil {
Expand All @@ -102,7 +102,7 @@ func NewServiceRequestListHosts(cmd *cobra.Command) *ServiceRequestListHosts {
func (r *ServiceRequestListHosts) Execute() (*[]*service.Host, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ServiceTcp", fmt.Sprintf("%+v", *r.ServiceTcp))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.ip, r.ServiceTcp.port)
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

hosts, err := serviceWrap.GetAllHosts(serviceClient)
if err != nil {
Expand Down Expand Up @@ -147,7 +147,7 @@ func (r *ServiceRequestRenameHost) Execute() (*service.Host, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "HostId", fmt.Sprintf("%+v", *r.HostId))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "NewHostId", fmt.Sprintf("%+v", *r.NewHostId))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

host, err := serviceWrap.RenameHostById(serviceClient, r.HostId.GetId(), r.NewHostId.GetId())
if err != nil {
Expand All @@ -173,7 +173,7 @@ func (r *ServiceRequestResyncHost) Execute() (*service.Host, error) {
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "ServiceTcp", fmt.Sprintf("%+v", *r.ServiceTcp))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "HostId", fmt.Sprintf("%+v", *r.HostId))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort())
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

host, err := serviceWrap.ResyncHostById(serviceClient, r.HostId.GetId())
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cli/pkg/serviceLib/serviceRequests/memory-devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (r *ServiceRequestListHostMemoryDevices) Execute() (*serviceWrap.HostMemory
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "HostId", fmt.Sprintf("%+v", *r.HostId))
klog.V(4).InfoS(fmt.Sprintf("%T", *r), "MemoryDeviceId", fmt.Sprintf("%+v", *r.MemoryDeviceId))

serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.ip, r.ServiceTcp.port)
serviceClient := serviceWrap.GetServiceClient(r.ServiceTcp.GetIp(), r.ServiceTcp.GetPort(), r.ServiceTcp.GetInsecure(), r.ServiceTcp.GetProtocol())

if r.AllHosts() && r.AllMemoryDevices() {
summary, err = serviceWrap.GetMemoryDevices_AllHosts(serviceClient)
Expand Down
Loading
Loading