From 65220d44ebc1a9fe9a6b1340d8cc1e7cbad63897 Mon Sep 17 00:00:00 2001 From: Zaid Date: Mon, 30 Oct 2023 15:09:06 -0700 Subject: [PATCH] feat(amt): adds execute support for ethernet --- pkg/amt/ethernetport/settings.go | 32 +++++++-------------------- pkg/amt/ethernetport/settings_test.go | 9 +------- 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/pkg/amt/ethernetport/settings.go b/pkg/amt/ethernetport/settings.go index 7a0d4d4c..db07ebc9 100644 --- a/pkg/amt/ethernetport/settings.go +++ b/pkg/amt/ethernetport/settings.go @@ -47,20 +47,6 @@ type ( SubnetMask string } ) - -/* - type Selector struct { - XMLName xml.Name `xml:"w:Selector,omitempty"` - Name string `xml:"Name,attr"` - Value string `xml:",chardata"` - } - - type Selector_OUTPUT struct { - XMLName xml.Name `xml:"Selector,omitempty"` - Name string `xml:"Name,attr"` - Value string `xml:",chardata"` - } -*/ type EthernetPortSettings struct { models.SettingData VLANTag int @@ -172,11 +158,9 @@ func NewEthernetPortSettings(wsmanMessageCreator *message.WSManMessageCreator) S } // Get retrieves the representation of the instance -// func (s Settings) Get(selector *Selector) (response Response, err error) { func (s Settings) Get() (response Response, err error) { response = Response{ Message: &wsman.Message{ - //XMLInput: s.base.Get((*message.Selector)(selector)), XMLInput: s.base.Get(nil), }, } @@ -218,12 +202,12 @@ func (s Settings) Enumerate() (response Response, err error) { return } -// Pulls instances of this class, following an Enumerate operation -func (EthernetPortSettings Settings) Pull(enumerationContext string) string { - return EthernetPortSettings.base.Pull(enumerationContext) -} +// // Pulls instances of this class, following an Enumerate operation +// func (EthernetPortSettings Settings) Pull(enumerationContext string) string { +// return EthernetPortSettings.base.Pull(enumerationContext) +// } -// Put will change properties of the selected instance -func (EthernetPortSettings Settings) Put(ethernetPortSettings EthernetPortSettings) string { - return EthernetPortSettings.base.Put(ethernetPortSettings, false, nil) -} +// // Put will change properties of the selected instance +// func (EthernetPortSettings Settings) Put(ethernetPortSettings EthernetPortSettings) string { +// return EthernetPortSettings.base.Put(ethernetPortSettings, false, nil) +// } diff --git a/pkg/amt/ethernetport/settings_test.go b/pkg/amt/ethernetport/settings_test.go index 8f2b9085..79770104 100644 --- a/pkg/amt/ethernetport/settings_test.go +++ b/pkg/amt/ethernetport/settings_test.go @@ -16,7 +16,6 @@ import ( "github.com/open-amt-cloud-toolkit/go-wsman-messages/internal/message" "github.com/open-amt-cloud-toolkit/go-wsman-messages/pkg/common" "github.com/stretchr/testify/assert" - //"github.com/open-amt-cloud-toolkit/go-wsman-messages/pkg/wsman" "github.com/open-amt-cloud-toolkit/go-wsman-messages/pkg/wsmantesting" ) @@ -52,13 +51,9 @@ func (c *MockClient) Post(msg string) ([]byte, error) { } func TestAMT_EthernetPortSettings(t *testing.T) { messageID := 0 - //selector := &Selector{Name: "InstanceID", Value: "Intel(r) AMT Ethernet Port Settings 0"} resourceUriBase := "http://intel.com/wbem/wscim/1/amt-schema/1/" wsmanMessageCreator := message.NewWSManMessageCreator(resourceUriBase) - client := MockClient{} // wsman.NewClient("http://localhost:16992/wsman", "admin", "P@ssw0rd", true) - //elementUnderTest := NewServiceWithClient(wsmanMessageCreator, &client) - // enumerationId := "" - //client := wsman.NewClient("http://localhost:1699/wsman", "admin", "Intel123!", true) + client := MockClient{} elementUnderTest := NewEthernetPortSettingsWithClient(wsmanMessageCreator, &client) t.Run("amt_* Tests", func(t *testing.T) { @@ -78,7 +73,6 @@ func TestAMT_EthernetPortSettings(t *testing.T) { "", func() (Response, error) { currentMessage = "Get" - //return elementUnderTest.Get(selector) return elementUnderTest.Get() }, Body{ @@ -129,7 +123,6 @@ func TestAMT_EthernetPortSettings(t *testing.T) { expectedXMLInput := wsmantesting.ExpectedResponse(messageID, resourceUriBase, test.method, test.action, "", test.body) messageID++ response, err := test.responseFunc() - //println(response.XMLOutput) assert.NoError(t, err) assert.Equal(t, expectedXMLInput, response.XMLInput) assert.Equal(t, test.expectedResponse, response.Body)