Skip to content

Commit

Permalink
feat(amt): adds execute support for ethernet
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidusmani26 committed Oct 30, 2023
1 parent 551e7d5 commit 65220d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 32 deletions.
32 changes: 8 additions & 24 deletions pkg/amt/ethernetport/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
},
}
Expand Down Expand Up @@ -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)
// }
9 changes: 1 addition & 8 deletions pkg/amt/ethernetport/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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) {
Expand All @@ -78,7 +73,6 @@ func TestAMT_EthernetPortSettings(t *testing.T) {
"",
func() (Response, error) {
currentMessage = "Get"
//return elementUnderTest.Get(selector)
return elementUnderTest.Get()
},
Body{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 65220d4

Please sign in to comment.