diff --git a/pkg/wsman/amt/auditlog/message.go b/pkg/wsman/amt/auditlog/message.go index f6c8fbd7..d345a6a4 100644 --- a/pkg/wsman/amt/auditlog/message.go +++ b/pkg/wsman/amt/auditlog/message.go @@ -45,15 +45,15 @@ func (service Service) ReadRecords(startIndex int) (response Response, err error err = service.Base.Execute(response.Message) if err != nil { - return + return response, err } err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } response.Body.DecodedRecordsResponse = convertToAuditLogResult(response.Body.ReadRecordsResponse.EventRecords) - return + return response, err } diff --git a/pkg/wsman/amt/authorization/service.go b/pkg/wsman/amt/authorization/service.go index 044b083e..0ab0a99b 100644 --- a/pkg/wsman/amt/authorization/service.go +++ b/pkg/wsman/amt/authorization/service.go @@ -51,16 +51,16 @@ func (as Service) EnumerateUserACLEntries(startIndex int) (response Response, er err = as.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Gets the state of a user ACL entry (enabled/disabled). @@ -76,16 +76,16 @@ func (as Service) GetACLEnabledState(handle int) (response Response, err error) err = as.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Returns the username attribute of the Admin ACL. @@ -101,16 +101,16 @@ func (as Service) GetAdminACLEntry() (response Response, err error) { err = as.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Reads the Admin ACL Entry status from Intel® AMT. The return state changes as a function of the admin password. @@ -126,16 +126,16 @@ func (as Service) GetAdminACLEntryStatus() (response Response, err error) { err = as.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Reads the remote Admin ACL Entry status from Intel® AMT. The return state changes as a function of the remote admin password. @@ -151,16 +151,16 @@ func (as Service) GetAdminNetACLEntryStatus() (response Response, err error) { err = as.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Reads a user entry from the Intel® AMT device. Note: confidential information, such as password (hash) is omitted or zeroed in the response. @@ -176,16 +176,16 @@ func (as Service) GetUserACLEntryEx(handle int) (response Response, err error) { err = as.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Removes an entry from the User Access Control List (ACL), given a handle. @@ -201,16 +201,16 @@ func (as Service) RemoveUserACLEntry(handle int) (response Response, err error) err = as.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Enables or disables a user ACL entry. Disabling ACL entries is useful when accounts that cannot be removed (system accounts - starting with $$) are required to be disabled. @@ -226,16 +226,16 @@ func (as Service) SetACLEnabledState(handle int, enabled bool) (response Respons err = as.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Updates an Admin entry in the Intel® AMT device. @@ -251,14 +251,14 @@ func (as Service) SetAdminAclEntryEx(username, digestPassword string) (response err = as.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/boot/settingdata.go b/pkg/wsman/amt/boot/settingdata.go index 37ad4867..8e5f996a 100644 --- a/pkg/wsman/amt/boot/settingdata.go +++ b/pkg/wsman/amt/boot/settingdata.go @@ -31,16 +31,16 @@ func (settingData SettingData) Get() (response Response, err error) { // send the message to AMT err = settingData.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Enumerate returns an enumeration context which is used in a subsequent Pull call. @@ -54,16 +54,16 @@ func (settingData SettingData) Enumerate() (response Response, err error) { // send the message to AMT err = settingData.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Pull returns the instances of this class. An enumeration context provided by the Enumerate call is used as input. @@ -77,16 +77,16 @@ func (settingData SettingData) Pull(enumerationContext string) (response Respons // send the message to AMT err = settingData.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } func (settingData SettingData) Put(bootSettingData BootSettingDataRequest) (response Response, err error) { diff --git a/pkg/wsman/amt/environmentdetection/settingdata.go b/pkg/wsman/amt/environmentdetection/settingdata.go index 6a5a7ebe..8f1ddc55 100644 --- a/pkg/wsman/amt/environmentdetection/settingdata.go +++ b/pkg/wsman/amt/environmentdetection/settingdata.go @@ -31,15 +31,15 @@ func (sd SettingData) Get() (response Response, err error) { // send the message to AMT err = sd.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Enumerate returns an enumeration context which is used in a subsequent Pull call. @@ -52,15 +52,15 @@ func (sd SettingData) Enumerate() (response Response, err error) { // send the message to AMT err = sd.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Pull returns the instances of this class. An enumeration context provided by the Enumerate call is used as input. @@ -73,15 +73,15 @@ func (sd SettingData) Pull(enumerationContext string) (response Response, err er // send the message to AMT err = sd.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Put will change properties of the selected instance. @@ -99,13 +99,13 @@ func (sd SettingData) Put(environmentDetectionSettingData EnvironmentDetectionSe // send the message to AMT err = sd.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/ethernetport/settings.go b/pkg/wsman/amt/ethernetport/settings.go index c4387b2c..91205401 100644 --- a/pkg/wsman/amt/ethernetport/settings.go +++ b/pkg/wsman/amt/ethernetport/settings.go @@ -37,15 +37,15 @@ func (s Settings) Get(instanceID string) (response Response, err error) { // send the message to AMT err = s.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Enumerate returns an enumeration context which is used in a subsequent Pull call. @@ -58,15 +58,15 @@ func (s Settings) Enumerate() (response Response, err error) { // send the message to AMT err = s.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // // Pull returns the instances of this class. An enumeration context provided by the Enumerate call is used as input. @@ -79,15 +79,15 @@ func (s Settings) Pull(enumerationContext string) (response Response, err error) // send the message to AMT err = s.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Put will change properties of the selected instance. @@ -105,14 +105,14 @@ func (s Settings) Put(instanceID string, ethernetPortSettings SettingsRequest) ( // send the message to AMT err = s.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/kerberos/settingdata.go b/pkg/wsman/amt/kerberos/settingdata.go index fafde8b7..c2df56ed 100644 --- a/pkg/wsman/amt/kerberos/settingdata.go +++ b/pkg/wsman/amt/kerberos/settingdata.go @@ -40,15 +40,15 @@ func (settingData SettingData) GetCredentialCacheState() (response Response, err // send the message to AMT err = settingData.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // SetCredentialCacheState enables/disables the credential caching functionality @@ -69,13 +69,13 @@ func (settingData SettingData) SetCredentialCacheState(enabled bool) (response R // send the message to AMT err = settingData.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/managementpresence/remotesap.go b/pkg/wsman/amt/managementpresence/remotesap.go index 1b682b88..bf5b4bf8 100644 --- a/pkg/wsman/amt/managementpresence/remotesap.go +++ b/pkg/wsman/amt/managementpresence/remotesap.go @@ -36,13 +36,13 @@ func (remoteSAP RemoteSAP) Delete(handle string) (response Response, err error) // send the message to AMT err = remoteSAP.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/messagelog/log.go b/pkg/wsman/amt/messagelog/log.go index 89f1650a..c911b617 100644 --- a/pkg/wsman/amt/messagelog/log.go +++ b/pkg/wsman/amt/messagelog/log.go @@ -104,13 +104,13 @@ func (messageLog Service) PositionToFirstRecord() (response Response, err error) // send the message to AMT err = messageLog.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/publickey/certificate.go b/pkg/wsman/amt/publickey/certificate.go index 5b0da1eb..9b2a84c1 100644 --- a/pkg/wsman/amt/publickey/certificate.go +++ b/pkg/wsman/amt/publickey/certificate.go @@ -41,15 +41,15 @@ func (certificate Certificate) Get(instanceID string) (response Response, err er // send the message to AMT err = certificate.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Enumerate returns an enumeration context which is used in a subsequent Pull call. @@ -62,15 +62,15 @@ func (certificate Certificate) Enumerate() (response Response, err error) { // send the message to AMT err = certificate.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Pull returns the instances of this class. An enumeration context provided by the Enumerate call is used as input. @@ -131,15 +131,15 @@ func (certificate Certificate) Put(instanceID, cert string) (response Response, // send the message to AMT err = certificate.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Delete removes a the specified instance. @@ -153,13 +153,13 @@ func (certificate Certificate) Delete(instanceID string) (response Response, err // send the message to AMT err = certificate.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/publicprivate/keypair.go b/pkg/wsman/amt/publicprivate/keypair.go index b1ccac70..c8adb897 100644 --- a/pkg/wsman/amt/publicprivate/keypair.go +++ b/pkg/wsman/amt/publicprivate/keypair.go @@ -36,15 +36,15 @@ func (keyPair KeyPair) Get(instanceID string) (response Response, err error) { // send the message to AMT err = keyPair.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Enumerate returns an enumeration context which is used in a subsequent Pull call. @@ -57,15 +57,15 @@ func (keyPair KeyPair) Enumerate() (response Response, err error) { // send the message to AMT err = keyPair.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Pull returns the instances of this class. An enumeration context provided by the Enumerate call is used as input. @@ -119,13 +119,13 @@ func (keyPair KeyPair) Delete(handle string) (response Response, err error) { // send the message to AMT err = keyPair.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/redirection/service.go b/pkg/wsman/amt/redirection/service.go index 3427114d..f208ac73 100644 --- a/pkg/wsman/amt/redirection/service.go +++ b/pkg/wsman/amt/redirection/service.go @@ -42,17 +42,17 @@ func (service Service) RequestStateChange(requestedState RequestedState) (respon // send the message to AMT err = service.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } if response.Body.RequestStateChange_OUTPUT.ReturnValue != 0 { err = errors.New("RequestStateChange failed with return code " + response.Body.RequestStateChange_OUTPUT.ReturnValue.String()) } - return + return response, err } diff --git a/pkg/wsman/amt/remoteaccess/policyappliestomps.go b/pkg/wsman/amt/remoteaccess/policyappliestomps.go index 49f85d97..7dffc85e 100644 --- a/pkg/wsman/amt/remoteaccess/policyappliestomps.go +++ b/pkg/wsman/amt/remoteaccess/policyappliestomps.go @@ -43,16 +43,16 @@ func (policyAppliesToMPS PolicyAppliesToMPS) Get() (response Response, err error // send the message to AMT err = policyAppliesToMPS.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Enumerate returns an enumeration context which is used in a subsequent Pull call. @@ -65,16 +65,16 @@ func (policyAppliesToMPS PolicyAppliesToMPS) Enumerate() (response Response, err // send the message to AMT err = policyAppliesToMPS.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Pull returns the instances of this class. An enumeration context provided by the Enumerate call is used as input. @@ -87,16 +87,16 @@ func (policyAppliesToMPS PolicyAppliesToMPS) Pull(enumerationContext string) (re // send the message to AMT err = policyAppliesToMPS.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Put will change properties of the selected instance. @@ -120,16 +120,16 @@ func (policyAppliesToMPS PolicyAppliesToMPS) Put(remoteAccessPolicyAppliesToMPS // send the message to AMT err = policyAppliesToMPS.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Delete removes a the specified instance. @@ -143,14 +143,14 @@ func (policyAppliesToMPS PolicyAppliesToMPS) Delete(handle string) (response Res // send the message to AMT err = policyAppliesToMPS.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/remoteaccess/policyrule.go b/pkg/wsman/amt/remoteaccess/policyrule.go index 1e9bbf30..c1c083a2 100644 --- a/pkg/wsman/amt/remoteaccess/policyrule.go +++ b/pkg/wsman/amt/remoteaccess/policyrule.go @@ -35,13 +35,13 @@ func (policyRule PolicyRule) Delete(handle string) (response Response, err error // send the message to AMT err = policyRule.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/remoteaccess/service.go b/pkg/wsman/amt/remoteaccess/service.go index 2becd611..6503e8df 100644 --- a/pkg/wsman/amt/remoteaccess/service.go +++ b/pkg/wsman/amt/remoteaccess/service.go @@ -46,16 +46,16 @@ func (service Service) AddMPS(mpServer AddMpServerRequest) (response Response, e // send the message to AMT. err = service.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct. err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // AddRemoteAccessPolicyRule adds a Remote Access policy to the Intel® AMT subsystem. diff --git a/pkg/wsman/amt/timesynchronization/service.go b/pkg/wsman/amt/timesynchronization/service.go index b1769ee4..a07b617e 100644 --- a/pkg/wsman/amt/timesynchronization/service.go +++ b/pkg/wsman/amt/timesynchronization/service.go @@ -53,15 +53,15 @@ func (service Service) SetHighAccuracyTimeSynch(ta0, tm1, tm2 int64) (response R // send the message to AMT err = service.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // GetLowAccuracyTimeSynch is used for reading the Intel® AMT device's internal clock. @@ -76,13 +76,13 @@ func (service Service) GetLowAccuracyTimeSynch() (response Response, err error) // send the message to AMT err = service.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/tls/credentialcontext.go b/pkg/wsman/amt/tls/credentialcontext.go index ec34abda..cd34c6bf 100644 --- a/pkg/wsman/amt/tls/credentialcontext.go +++ b/pkg/wsman/amt/tls/credentialcontext.go @@ -43,15 +43,15 @@ func (credentialContext CredentialContext) Get() (response Response, err error) // send the message to AMT err = credentialContext.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Enumerate returns an enumeration context which is used in a subsequent Pull call. @@ -64,15 +64,15 @@ func (credentialContext CredentialContext) Enumerate() (response Response, err e // send the message to AMT err = credentialContext.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Pull returns the instances of this class. An enumeration context provided by the Enumerate call is used as input. @@ -85,15 +85,15 @@ func (credentialContext CredentialContext) Pull(enumerationContext string) (resp // send the message to AMT err = credentialContext.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Delete removes a the specified instance. @@ -107,15 +107,15 @@ func (credentialContext CredentialContext) Delete(handle string) (response Respo // send the message to AMT err = credentialContext.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Creates a new instance of this class. @@ -130,15 +130,16 @@ func (credentialContext CredentialContext) Create(certHandle string) (response R // send the message to AMT err = credentialContext.base.Execute(response.Message) if err != nil { - return + return response, err } + // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Put will update the certificate when TLS is enabled. diff --git a/pkg/wsman/amt/tls/credentialcontext_test.go b/pkg/wsman/amt/tls/credentialcontext_test.go index 52fc6dc9..bf4fb277 100644 --- a/pkg/wsman/amt/tls/credentialcontext_test.go +++ b/pkg/wsman/amt/tls/credentialcontext_test.go @@ -65,7 +65,7 @@ var createCredentialContextResponse = CredentialContextCreateResponse{ Local: "Selector", }, Name: "InstanceID", - Text: "", + Text: "testCertificate", }, }, }, @@ -102,7 +102,7 @@ var createCredentialContextResponse = CredentialContextCreateResponse{ Local: "Selector", }, Name: "ElementName", - Text: "", + Text: "TLSProtocolEndpoint Instances Collection", }, }, }, @@ -143,7 +143,7 @@ var putCredentialContextResponse = CredentialContextResponse{ Local: "Selector", }, Name: "InstanceID", - Text: "", + Text: "Intel(r) AMT Certificate: Handle: 4", }, }, }, @@ -173,7 +173,7 @@ var putCredentialContextResponse = CredentialContextResponse{ Local: "Selector", }, Name: "ElementName", - Text: "", + Text: "TLSProtocolEndpoint Instances Collection", }, }, }, @@ -188,7 +188,7 @@ func TestJson(t *testing.T) { CredentialContextCreateResponse: createCredentialContextResponse, }, } - expectedResult := "{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"SettingDataGetAndPutResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ElementName\":\"\",\"InstanceID\":\"\",\"MutualAuthentication\":false,\"Enabled\":false,\"TrustedCN\":null,\"AcceptNonSecureConnections\":false,\"NonSecureConnectionsSupported\":null},\"CredentialContextGetResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ElementInContext\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Address\":\"\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ResourceURI\":\"\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Selectors\":null}}},\"ElementProvidingContext\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Address\":\"\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ResourceURI\":\"\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Selectors\":null}}}},\"CredentialContextCreateResponse\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/09/transfer\",\"Local\":\"ResourceCreated\"},\"Address\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing\",\"Local\":\"ReferenceParameters\"},\"ResourceURI\":\"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSCredentialContext\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"SelectorSet\"},\"Selectors\":[{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"Selector\"},\"Name\":\"ElementInContext\",\"Text\":\"\",\"EndpointReference\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing\",\"Local\":\"EndpointReference\"},\"Address\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing\",\"Local\":\"ReferenceParameters\"},\"ResourceURI\":\"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"SelectorSet\"},\"Selectors\":[{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"Selector\"},\"Name\":\"InstanceID\",\"Text\":\"\",\"EndpointReference\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Address\":\"\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ResourceURI\":\"\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Selectors\":null}}}}]}}}},{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"Selector\"},\"Name\":\"ElementProvidingContext\",\"Text\":\"\",\"EndpointReference\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing\",\"Local\":\"EndpointReference\"},\"Address\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing\",\"Local\":\"ReferenceParameters\"},\"ResourceURI\":\"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSProtocolEndpointCollection\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"SelectorSet\"},\"Selectors\":[{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"Selector\"},\"Name\":\"ElementName\",\"Text\":\"\",\"EndpointReference\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Address\":\"\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ResourceURI\":\"\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Selectors\":null}}}}]}}}}]}}},\"ProtocolEndpointCollectionGetResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ElementName\":\"\"},\"EnumerateResponse\":{\"EnumerationContext\":\"\"},\"PullResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"SettingDataItems\":null,\"ProtocolEndpointCollectionItems\":null,\"CredentialContextItems\":null}}" + expectedResult := "{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"SettingDataGetAndPutResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ElementName\":\"\",\"InstanceID\":\"\",\"MutualAuthentication\":false,\"Enabled\":false,\"TrustedCN\":null,\"AcceptNonSecureConnections\":false,\"NonSecureConnectionsSupported\":null},\"CredentialContextGetResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ElementInContext\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Address\":\"\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ResourceURI\":\"\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Selectors\":null}}},\"ElementProvidingContext\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Address\":\"\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ResourceURI\":\"\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Selectors\":null}}}},\"CredentialContextCreateResponse\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/09/transfer\",\"Local\":\"ResourceCreated\"},\"Address\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing\",\"Local\":\"ReferenceParameters\"},\"ResourceURI\":\"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSCredentialContext\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"SelectorSet\"},\"Selectors\":[{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"Selector\"},\"Name\":\"ElementInContext\",\"Text\":\"\",\"EndpointReference\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing\",\"Local\":\"EndpointReference\"},\"Address\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing\",\"Local\":\"ReferenceParameters\"},\"ResourceURI\":\"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"SelectorSet\"},\"Selectors\":[{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"Selector\"},\"Name\":\"InstanceID\",\"Text\":\"testCertificate\",\"EndpointReference\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Address\":\"\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ResourceURI\":\"\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Selectors\":null}}}}]}}}},{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"Selector\"},\"Name\":\"ElementProvidingContext\",\"Text\":\"\",\"EndpointReference\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing\",\"Local\":\"EndpointReference\"},\"Address\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"http://schemas.xmlsoap.org/ws/2004/08/addressing\",\"Local\":\"ReferenceParameters\"},\"ResourceURI\":\"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSProtocolEndpointCollection\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"SelectorSet\"},\"Selectors\":[{\"XMLName\":{\"Space\":\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\",\"Local\":\"Selector\"},\"Name\":\"ElementName\",\"Text\":\"TLSProtocolEndpoint Instances Collection\",\"EndpointReference\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Address\":\"\",\"ReferenceParameters\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ResourceURI\":\"\",\"SelectorSet\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"Selectors\":null}}}}]}}}}]}}},\"ProtocolEndpointCollectionGetResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ElementName\":\"\"},\"EnumerateResponse\":{\"EnumerationContext\":\"\"},\"PullResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"SettingDataItems\":null,\"ProtocolEndpointCollectionItems\":null,\"CredentialContextItems\":null}}" result := response.JSON() assert.Equal(t, expectedResult, result) } @@ -200,7 +200,7 @@ func TestYaml(t *testing.T) { CredentialContextCreateResponse: createCredentialContextResponse, }, } - expectedResult := "xmlname:\n space: \"\"\n local: \"\"\nsettingdatagetandputresponse:\n xmlname:\n space: \"\"\n local: \"\"\n elementname: \"\"\n instanceid: \"\"\n mutualauthentication: false\n enabled: false\n trustedcn: []\n acceptnonsecureconnections: false\n nonsecureconnectionssupported: null\ncredentialcontextgetresponse:\n xmlname:\n space: \"\"\n local: \"\"\n elementincontext:\n xmlname:\n space: \"\"\n local: \"\"\n address: \"\"\n referenceparameters:\n xmlname:\n space: \"\"\n local: \"\"\n resourceuri: \"\"\n selectorset:\n xmlname:\n space: \"\"\n local: \"\"\n selectors: []\n elementprovidingcontext:\n xmlname:\n space: \"\"\n local: \"\"\n address: \"\"\n referenceparameters:\n xmlname:\n space: \"\"\n local: \"\"\n resourceuri: \"\"\n selectorset:\n xmlname:\n space: \"\"\n local: \"\"\n selectors: []\ncredentialcontextcreateresponse:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/09/transfer\n local: ResourceCreated\n address: http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\n referenceparameters:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/08/addressing\n local: ReferenceParameters\n resourceuri: http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSCredentialContext\n selectorset:\n xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: SelectorSet\n selectors:\n - xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: Selector\n name: ElementInContext\n text: \"\"\n endpointreference:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/08/addressing\n local: EndpointReference\n address: http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\n referenceparameters:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/08/addressing\n local: ReferenceParameters\n resourceuri: http://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate\n selectorset:\n xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: SelectorSet\n selectors:\n - xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: Selector\n name: InstanceID\n text: \"\"\n endpointreference:\n xmlname:\n space: \"\"\n local: \"\"\n address: \"\"\n referenceparameters:\n xmlname:\n space: \"\"\n local: \"\"\n resourceuri: \"\"\n selectorset:\n xmlname:\n space: \"\"\n local: \"\"\n selectors: []\n - xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: Selector\n name: ElementProvidingContext\n text: \"\"\n endpointreference:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/08/addressing\n local: EndpointReference\n address: http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\n referenceparameters:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/08/addressing\n local: ReferenceParameters\n resourceuri: http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSProtocolEndpointCollection\n selectorset:\n xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: SelectorSet\n selectors:\n - xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: Selector\n name: ElementName\n text: \"\"\n endpointreference:\n xmlname:\n space: \"\"\n local: \"\"\n address: \"\"\n referenceparameters:\n xmlname:\n space: \"\"\n local: \"\"\n resourceuri: \"\"\n selectorset:\n xmlname:\n space: \"\"\n local: \"\"\n selectors: []\nprotocolendpointcollectiongetresponse:\n xmlname:\n space: \"\"\n local: \"\"\n elementname: \"\"\nenumerateresponse:\n enumerationcontext: \"\"\npullresponse:\n xmlname:\n space: \"\"\n local: \"\"\n settingdataitems: []\n protocolendpointcollectionitems: []\n credentialcontextitems: []\n" + expectedResult := "xmlname:\n space: \"\"\n local: \"\"\nsettingdatagetandputresponse:\n xmlname:\n space: \"\"\n local: \"\"\n elementname: \"\"\n instanceid: \"\"\n mutualauthentication: false\n enabled: false\n trustedcn: []\n acceptnonsecureconnections: false\n nonsecureconnectionssupported: null\ncredentialcontextgetresponse:\n xmlname:\n space: \"\"\n local: \"\"\n elementincontext:\n xmlname:\n space: \"\"\n local: \"\"\n address: \"\"\n referenceparameters:\n xmlname:\n space: \"\"\n local: \"\"\n resourceuri: \"\"\n selectorset:\n xmlname:\n space: \"\"\n local: \"\"\n selectors: []\n elementprovidingcontext:\n xmlname:\n space: \"\"\n local: \"\"\n address: \"\"\n referenceparameters:\n xmlname:\n space: \"\"\n local: \"\"\n resourceuri: \"\"\n selectorset:\n xmlname:\n space: \"\"\n local: \"\"\n selectors: []\ncredentialcontextcreateresponse:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/09/transfer\n local: ResourceCreated\n address: http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\n referenceparameters:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/08/addressing\n local: ReferenceParameters\n resourceuri: http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSCredentialContext\n selectorset:\n xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: SelectorSet\n selectors:\n - xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: Selector\n name: ElementInContext\n text: \"\"\n endpointreference:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/08/addressing\n local: EndpointReference\n address: http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\n referenceparameters:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/08/addressing\n local: ReferenceParameters\n resourceuri: http://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate\n selectorset:\n xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: SelectorSet\n selectors:\n - xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: Selector\n name: InstanceID\n text: testCertificate\n endpointreference:\n xmlname:\n space: \"\"\n local: \"\"\n address: \"\"\n referenceparameters:\n xmlname:\n space: \"\"\n local: \"\"\n resourceuri: \"\"\n selectorset:\n xmlname:\n space: \"\"\n local: \"\"\n selectors: []\n - xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: Selector\n name: ElementProvidingContext\n text: \"\"\n endpointreference:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/08/addressing\n local: EndpointReference\n address: http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\n referenceparameters:\n xmlname:\n space: http://schemas.xmlsoap.org/ws/2004/08/addressing\n local: ReferenceParameters\n resourceuri: http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSProtocolEndpointCollection\n selectorset:\n xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: SelectorSet\n selectors:\n - xmlname:\n space: http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\n local: Selector\n name: ElementName\n text: TLSProtocolEndpoint Instances Collection\n endpointreference:\n xmlname:\n space: \"\"\n local: \"\"\n address: \"\"\n referenceparameters:\n xmlname:\n space: \"\"\n local: \"\"\n resourceuri: \"\"\n selectorset:\n xmlname:\n space: \"\"\n local: \"\"\n selectors: []\nprotocolendpointcollectiongetresponse:\n xmlname:\n space: \"\"\n local: \"\"\n elementname: \"\"\nenumerateresponse:\n enumerationcontext: \"\"\npullresponse:\n xmlname:\n space: \"\"\n local: \"\"\n settingdataitems: []\n protocolendpointcollectionitems: []\n credentialcontextitems: []\n" result := response.YAML() assert.Equal(t, expectedResult, result) } @@ -258,23 +258,65 @@ func TestPositiveAMT_TLSCredentialContext(t *testing.T) { }, // PULLS - // { - // "should create a valid AMT_TLSCredentialContext Pull wsman message", - // AMT_TLSCredentialContext, - // wsmantesting.PULL, - // wsmantesting.PULL_BODY, - // "", - // func() (Response, error) { - // client.CurrentMessage = wsmantesting.CurrentMessagePull - // return elementUnderTest.Pull(wsmantesting.EnumerationContext) - // }, - // Body{ - // PullResponse: PullResponse{ - // XMLName: xml.Name{Space: message.XMLPullResponseSpace, Local: "PullResponse"}, + { + "should create a valid AMT_TLSCredentialContext Pull wsman message", + AMTTLSCredentialContext, + wsmantesting.Pull, + wsmantesting.PullBody, + "", + func() (Response, error) { + client.CurrentMessage = wsmantesting.CurrentMessagePull - // }, - // }, - // }, + return elementUnderTest.Pull(wsmantesting.EnumerationContext) + }, + Body{ + XMLName: xml.Name{Space: message.XMLBodySpace, Local: "Body"}, + PullResponse: PullResponse{ + XMLName: xml.Name{Space: message.XMLPullResponseSpace, Local: "PullResponse"}, + CredentialContextItems: []CredentialContextResponse{ + { + XMLName: xml.Name{Space: "http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSCredentialContext", Local: "AMT_TLSCredentialContext"}, + ElementInContext: ElementInContextResponse{ + XMLName: xml.Name{Space: "http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSCredentialContext", Local: "ElementInContext"}, + Address: "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous", + ReferenceParameters: ReferenceParametersResponse{ + XMLName: xml.Name{Space: "http://schemas.xmlsoap.org/ws/2004/08/addressing", Local: "ReferenceParameters"}, + ResourceURI: "http://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate", + SelectorSet: SelectorSetResponse{ + XMLName: xml.Name{Space: "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd", Local: "SelectorSet"}, + Selectors: []SelectorResponse{ + { + XMLName: xml.Name{Space: "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd", Local: "Selector"}, + Name: "InstanceID", + Text: "Intel(r) AMT Certificate: Handle: 3", + }, + }, + }, + }, + }, + ElementProvidingContext: ElementProvidingContextResponse{ + XMLName: xml.Name{Space: "http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSCredentialContext", Local: "ElementProvidingContext"}, + Address: "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous", + ReferenceParameters: ReferenceParametersResponse{ + XMLName: xml.Name{Space: "http://schemas.xmlsoap.org/ws/2004/08/addressing", Local: "ReferenceParameters"}, + ResourceURI: "http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSProtocolEndpointCollection", + SelectorSet: SelectorSetResponse{ + XMLName: xml.Name{Space: "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd", Local: "SelectorSet"}, + Selectors: []SelectorResponse{ + { + XMLName: xml.Name{Space: "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd", Local: "Selector"}, + Name: "ElementName", + Text: "TLSProtocolEndpoint Instances Collection", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, // DELETE // { // "should create a valid AMT_TLSCredentialContext Delete wsman message", @@ -289,24 +331,25 @@ func TestPositiveAMT_TLSCredentialContext(t *testing.T) { // Body{}, // }, // Create - // { - // "should create a valid AMT_TLSCredentialContext Create wsman message", - // AMTTLSCredentialContext, - // wsmantesting.Create, - // fmt.Sprintf(`/wsman%sAMT_PublicKeyCertificate%s/wsman%sAMT_TLSProtocolEndpointCollectionTLSProtocolEndpointInstances Collection`, "http://intel.com/wbem/wscim/1/amt-schema/1/", "http://intel.com/wbem/wscim/1/amt-schema/1/", "testCertificate", "http://intel.com/wbem/wscim/1/amt-schema/1/"), - // "", - // func() (Response, error) { - // client.CurrentMessage = wsmantesting.CurrentMessageCreate - // return elementUnderTest.Create("testCertificate") - // }, - // Body{ - // XMLName: xml.Name{ - // Space: "http://www.w3.org/2003/05/soap-envelope", - // Local: "Body", - // }, - // CredentialContextCreateResponse: createCredentialContextResponse, - // }, - // }, + { + "should create a valid AMT_TLSCredentialContext Create wsman message", + AMTTLSCredentialContext, + wsmantesting.Create, + "/wsmanhttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificatetestCertificate/wsmanhttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSProtocolEndpointCollectionTLSProtocolEndpointInstances Collection", + "", + func() (Response, error) { + client.CurrentMessage = wsmantesting.CurrentMessageCreate + + return elementUnderTest.Create("testCertificate") + }, + Body{ + XMLName: xml.Name{ + Space: "http://www.w3.org/2003/05/soap-envelope", + Local: "Body", + }, + CredentialContextCreateResponse: createCredentialContextResponse, + }, + }, // Put { "should create a valid AMT_TLSCredentialContext Put wsman message", diff --git a/pkg/wsman/amt/tls/settingdata.go b/pkg/wsman/amt/tls/settingdata.go index f97a913f..1aafc307 100644 --- a/pkg/wsman/amt/tls/settingdata.go +++ b/pkg/wsman/amt/tls/settingdata.go @@ -34,15 +34,15 @@ func (settingData SettingData) Get(instanceID string) (response Response, err er // send the message to AMT err = settingData.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Enumerate returns an enumeration context which is used in a subsequent Pull call. @@ -55,15 +55,15 @@ func (settingData SettingData) Enumerate() (response Response, err error) { // send the message to AMT err = settingData.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Pull returns the instances of this class. An enumeration context provided by the Enumerate call is used as input. @@ -76,15 +76,15 @@ func (settingData SettingData) Pull(enumerationContext string) (response Respons // send the message to AMT err = settingData.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Put changes properties of the selected instance. @@ -111,13 +111,13 @@ func (settingData SettingData) Put(instanceID string, tlsSettingData SettingData // send the message to AMT err = settingData.base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/amt/tls/types.go b/pkg/wsman/amt/tls/types.go index c600234e..633f29e9 100644 --- a/pkg/wsman/amt/tls/types.go +++ b/pkg/wsman/amt/tls/types.go @@ -7,6 +7,7 @@ package tls import ( "encoding/xml" + "strings" "github.com/device-management-toolkit/go-wsman-messages/v2/internal/message" "github.com/device-management-toolkit/go-wsman-messages/v2/pkg/wsman/client" @@ -53,7 +54,7 @@ type ( SelectorResponse struct { XMLName xml.Name `xml:"Selector,omitempty"` Name string `xml:"Name,attr,omitempty"` - Text string `xml:"Text,omitempty"` + Text string `xml:",chardata"` EndpointReference EndpointReferenceResponse `xml:"EndpointReference,omitempty"` } SelectorSetResponse struct { @@ -102,6 +103,21 @@ type ( } ) +// UnmarshalXML trims insignificant whitespace in SelectorResponse.Text while decoding. +func (s *SelectorResponse) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type Alias SelectorResponse + + var aux Alias + if err := d.DecodeElement(&aux, &start); err != nil { + return err + } + + aux.Text = strings.TrimSpace(aux.Text) + *s = SelectorResponse(aux) + + return nil +} + type ( SettingDataRequest struct { XMLName xml.Name `xml:"h:AMT_TLSSettingData"` diff --git a/pkg/wsman/amt/userinitiatedconnection/service.go b/pkg/wsman/amt/userinitiatedconnection/service.go index 8a2f092c..e41d09d4 100644 --- a/pkg/wsman/amt/userinitiatedconnection/service.go +++ b/pkg/wsman/amt/userinitiatedconnection/service.go @@ -52,13 +52,13 @@ func (service Service) RequestStateChange(requestedState RequestedState) (respon // send the message to AMT err = service.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/cim/credential/context.go b/pkg/wsman/cim/credential/context.go index bfce5a60..b4d3e5b8 100644 --- a/pkg/wsman/cim/credential/context.go +++ b/pkg/wsman/cim/credential/context.go @@ -43,15 +43,15 @@ func (context Context) Enumerate() (response Response, err error) { err = context.base.Execute(response.Message) if err != nil { - return + return response, err } err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Pull instances of this class, following an Enumerate operation. diff --git a/pkg/wsman/cim/kvm/redirectionsap.go b/pkg/wsman/cim/kvm/redirectionsap.go index dec25830..3e63250e 100644 --- a/pkg/wsman/cim/kvm/redirectionsap.go +++ b/pkg/wsman/cim/kvm/redirectionsap.go @@ -36,13 +36,13 @@ func (redirectionSAP RedirectionSAP) RequestStateChange(requestedState KVMRedire err = redirectionSAP.Base.Execute(response.Message) if err != nil { - return + return response, err } err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/cim/physical/package.go b/pkg/wsman/cim/physical/package.go index e5c5e9cd..d12544f6 100644 --- a/pkg/wsman/cim/physical/package.go +++ b/pkg/wsman/cim/physical/package.go @@ -33,15 +33,15 @@ func (physicalPackage Package) Enumerate() (response Response, err error) { err = physicalPackage.base.Execute(response.Message) if err != nil { - return + return response, err } err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } // Pull returns the instances of this class. An enumeration context provided by the Enumerate call is used as input. diff --git a/pkg/wsman/cim/power/managementservice.go b/pkg/wsman/cim/power/managementservice.go index b72421f9..41050286 100644 --- a/pkg/wsman/cim/power/managementservice.go +++ b/pkg/wsman/cim/power/managementservice.go @@ -42,14 +42,14 @@ func (managementService ManagementService) RequestPowerStateChange(powerState Po // send the message to AMT err = managementService.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/cim/wifi/endpointsettings.go b/pkg/wsman/cim/wifi/endpointsettings.go index 276cb2c3..0633fd06 100644 --- a/pkg/wsman/cim/wifi/endpointsettings.go +++ b/pkg/wsman/cim/wifi/endpointsettings.go @@ -43,13 +43,13 @@ func (endpointSettings EndpointSettings) Delete(handle string) (response Respons err = endpointSettings.Base.Execute(response.Message) if err != nil { - return + return response, err } err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/ips/alarmclock/occurrence.go b/pkg/wsman/ips/alarmclock/occurrence.go index ec622e17..560d28df 100644 --- a/pkg/wsman/ips/alarmclock/occurrence.go +++ b/pkg/wsman/ips/alarmclock/occurrence.go @@ -36,13 +36,13 @@ func (occurrence Occurrence) Delete(handle string) (response Response, err error err = occurrence.Base.Execute(response.Message) if err != nil { - return + return response, err } err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/ips/http/service_test.go b/pkg/wsman/ips/http/service_test.go index 2f9d2ae0..d41a4592 100644 --- a/pkg/wsman/ips/http/service_test.go +++ b/pkg/wsman/ips/http/service_test.go @@ -78,7 +78,7 @@ func TestPositiveIPS_HTTPProxyService(t *testing.T) { XMLName: xml.Name{Space: fmt.Sprintf("%s%s", message.IPSSchema, IPSHTTPProxyService), Local: "ProxyAccessPoint"}, Address: "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous", ReferenceParameters: models.ReferenceParameters_OUTPUT{ - ResourceURI: "\n http://intel.com/wbem/wscim/1/ips-schema/1/IPS_HTTPProxyAccessPoint", + ResourceURI: "http://intel.com/wbem/wscim/1/ips-schema/1/IPS_HTTPProxyAccessPoint", SelectorSet: models.SelectorSet_OUTPUT{ XMLName: xml.Name{Space: "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd", Local: "SelectorSet"}, Selector: []message.Selector_OUTPUT{ diff --git a/pkg/wsman/ips/power/managementservice.go b/pkg/wsman/ips/power/managementservice.go index 5c6b3f00..64489b86 100644 --- a/pkg/wsman/ips/power/managementservice.go +++ b/pkg/wsman/ips/power/managementservice.go @@ -43,14 +43,14 @@ func (managementService ManagementService) RequestOSPowerSavingStateChange(osPow // send the message to AMT err = managementService.Base.Execute(response.Message) if err != nil { - return + return response, err } // put the xml response into the go struct err = xml.Unmarshal([]byte(response.XMLOutput), &response) if err != nil { - return + return response, err } - return + return response, err } diff --git a/pkg/wsman/wsmantesting/responses/amt/tls/credentialcontext/create.xml b/pkg/wsman/wsmantesting/responses/amt/tls/credentialcontext/create.xml index 15ef77e9..d7070445 100644 --- a/pkg/wsman/wsmantesting/responses/amt/tls/credentialcontext/create.xml +++ b/pkg/wsman/wsmantesting/responses/amt/tls/credentialcontext/create.xml @@ -1,6 +1,5 @@ - http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous - - http://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate + http://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate - Intel(r) AMT Certificate: Handle: 3 + Intel(r) AMT Certificate: Handle: 3 http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous - - http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSProtocolEndpointCollection + http://intel.com/wbem/wscim/1/amt-schema/1/AMT_TLSProtocolEndpointCollection - TLSProtocolEndpoint Instances Collection + TLSProtocolEndpoint Instances Collection diff --git a/pkg/wsman/wsmantesting/responses/ips/http/addproxyaccesspoint.xml b/pkg/wsman/wsmantesting/responses/ips/http/addproxyaccesspoint.xml index f0754cfe..1f388835 100644 --- a/pkg/wsman/wsmantesting/responses/ips/http/addproxyaccesspoint.xml +++ b/pkg/wsman/wsmantesting/responses/ips/http/addproxyaccesspoint.xml @@ -20,8 +20,7 @@ http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous - - http://intel.com/wbem/wscim/1/ips-schema/1/IPS_HTTPProxyAccessPoint + http://intel.com/wbem/wscim/1/ips-schema/1/IPS_HTTPProxyAccessPoint IPS_HTTPProxyAccessPoint Intel(r) ME:HTTP Proxy Access Point 3