From 187c8d13e66b976c5550cbb558a2ad4ee7fb35bb Mon Sep 17 00:00:00 2001 From: Zaid Date: Wed, 25 Oct 2023 16:17:11 -0700 Subject: [PATCH] feat(amt): adds execute support for setup --- pkg/amt/setupandconfiguration/service.go | 2 +- pkg/amt/setupandconfiguration/service_test.go | 104 ++++++++++++------ .../amt/setupandconfiguration/enumerate.xml | 22 ++++ .../amt/setupandconfiguration/get.xml | 2 +- 4 files changed, 93 insertions(+), 37 deletions(-) create mode 100644 pkg/wsmantesting/responses/amt/setupandconfiguration/enumerate.xml diff --git a/pkg/amt/setupandconfiguration/service.go b/pkg/amt/setupandconfiguration/service.go index bf86eb2d..14536f8a 100644 --- a/pkg/amt/setupandconfiguration/service.go +++ b/pkg/amt/setupandconfiguration/service.go @@ -28,7 +28,7 @@ type ( } Body struct { XMLName xml.Name `xml:"Body"` - Setup Setup `xml:"AMT_AuthorizationService"` + Setup Setup `xml:"AMT_SetupAndConfigurationService"` EnumerateResponse common.EnumerateResponse } diff --git a/pkg/amt/setupandconfiguration/service_test.go b/pkg/amt/setupandconfiguration/service_test.go index 68a36d32..03d6a619 100644 --- a/pkg/amt/setupandconfiguration/service_test.go +++ b/pkg/amt/setupandconfiguration/service_test.go @@ -7,25 +7,59 @@ package setupandconfiguration import ( "encoding/xml" + "fmt" + "io" + "os" + "strings" "testing" "github.com/stretchr/testify/assert" "github.com/open-amt-cloud-toolkit/go-wsman-messages/internal/message" "github.com/open-amt-cloud-toolkit/go-wsman-messages/pkg/wsmantesting" - "github.com/open-amt-cloud-toolkit/go-wsman-messages/pkg/wsman" - //"github.com/open-amt-cloud-toolkit/go-wsman-messages/pkg/common" + //"github.com/open-amt-cloud-toolkit/go-wsman-messages/pkg/wsman" + "github.com/open-amt-cloud-toolkit/go-wsman-messages/pkg/common" ) +type MockClient struct { +} + +const ( + EnvelopeResponse = `http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous0` + GetBody = `AMT_RedirectionServiceIntel(r) AMT Redirection ServiceIntel(r) AMT Redirection ServiceCIM_ComputerSystemManagedSystem`, elementUnderTest.CommitChanges}, @@ -93,7 +127,7 @@ func TestAMT_SetupAndConfigurationService(t *testing.T) { expectedXMLInput := wsmantesting.ExpectedResponse(messageID, resourceUriBase, test.method, test.action, "", test.body) messageID++ response, err := test.responseFunc() - println(response.XMLOutput) + //println(response.XMLOutput) assert.NoError(t, err) assert.Equal(t, expectedXMLInput, response.XMLInput) assert.Equal(t, test.expectedResponse, response.Body) diff --git a/pkg/wsmantesting/responses/amt/setupandconfiguration/enumerate.xml b/pkg/wsmantesting/responses/amt/setupandconfiguration/enumerate.xml new file mode 100644 index 00000000..03c9fef2 --- /dev/null +++ b/pkg/wsmantesting/responses/amt/setupandconfiguration/enumerate.xml @@ -0,0 +1,22 @@ + + + + http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous + 0 + http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse + uuid:00000000-8086-8086-8086-000000000322 + http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SetupAndConfigurationService + + + + D3000000-0000-0000-0000-000000000000 + + + \ No newline at end of file diff --git a/pkg/wsmantesting/responses/amt/setupandconfiguration/get.xml b/pkg/wsmantesting/responses/amt/setupandconfiguration/get.xml index d54b88a4..ae6c23bf 100644 --- a/pkg/wsmantesting/responses/amt/setupandconfiguration/get.xml +++ b/pkg/wsmantesting/responses/amt/setupandconfiguration/get.xml @@ -1,4 +1,4 @@ - +