diff --git a/pkg/wsman/amt/ieee8021x/credentialcontext_test.go b/pkg/wsman/amt/ieee8021x/credentialcontext_test.go index 13dc5018..de5ce4db 100644 --- a/pkg/wsman/amt/ieee8021x/credentialcontext_test.go +++ b/pkg/wsman/amt/ieee8021x/credentialcontext_test.go @@ -22,7 +22,7 @@ func TestJson(t *testing.T) { CredentialContextGetResponse: CredentialContextResponse{}, }, } - expectedResult := "{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ProfileGetAndPutResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ElementName\":\"\",\"InstanceID\":\"\",\"Enabled\":false,\"ActiveInS0\":false,\"AuthenticationProtocol\":0,\"RoamingIdentity\":\"\",\"ServerCertificateName\":\"\",\"ServerCertificateNameComparison\":0,\"Username\":\"\",\"Password\":\"\",\"Domain\":\"\",\"ProtectedAccessCredential\":null,\"PACPassword\":\"\",\"ClientCertificate\":\"\",\"ServerCertificateIssue\":\"\",\"PxeTimeout\":0},\"CredentialContextGetResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"}},\"EnumerateResponse\":{\"EnumerationContext\":\"\"},\"PullResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ProfileItems\":null,\"CredentialContextItems\":null}}" + expectedResult := "{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ProfileGetAndPutResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ElementName\":\"\",\"InstanceID\":\"\",\"Enabled\":false,\"ActiveInS0\":false,\"AuthenticationProtocol\":0,\"RoamingIdentity\":\"\",\"ServerCertificateName\":\"\",\"ServerCertificateNameComparison\":0,\"Username\":\"\",\"Password\":\"\",\"Domain\":\"\",\"ProtectedAccessCredential\":null,\"PACPassword\":\"\",\"ClientCertificate\":\"\",\"ServerCertificateIssue\":\"\",\"PxeTimeout\":0},\"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}}}},\"EnumerateResponse\":{\"EnumerationContext\":\"\"},\"PullResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ProfileItems\":null,\"CredentialContextItems\":null}}" result := response.JSON() assert.Equal(t, expectedResult, result) } @@ -33,7 +33,7 @@ func TestYaml(t *testing.T) { CredentialContextGetResponse: CredentialContextResponse{}, }, } - expectedResult := "xmlname:\n space: \"\"\n local: \"\"\nprofilegetandputresponse:\n xmlname:\n space: \"\"\n local: \"\"\n elementname: \"\"\n instanceid: \"\"\n enabled: false\n activeins0: false\n authenticationprotocol: 0\n roamingidentity: \"\"\n servercertificatename: \"\"\n servercertificatenamecomparison: 0\n username: \"\"\n password: \"\"\n domain: \"\"\n protectedaccesscredential: []\n pacpassword: \"\"\n clientcertificate: \"\"\n servercertificateissue: \"\"\n pxetimeout: 0\ncredentialcontextgetresponse:\n xmlname:\n space: \"\"\n local: \"\"\nenumerateresponse:\n enumerationcontext: \"\"\npullresponse:\n xmlname:\n space: \"\"\n local: \"\"\n profileitems: []\n credentialcontextitems: []\n" + expectedResult := "xmlname:\n space: \"\"\n local: \"\"\nprofilegetandputresponse:\n xmlname:\n space: \"\"\n local: \"\"\n elementname: \"\"\n instanceid: \"\"\n enabled: false\n activeins0: false\n authenticationprotocol: 0\n roamingidentity: \"\"\n servercertificatename: \"\"\n servercertificatenamecomparison: 0\n username: \"\"\n password: \"\"\n domain: \"\"\n protectedaccesscredential: []\n pacpassword: \"\"\n clientcertificate: \"\"\n servercertificateissue: \"\"\n pxetimeout: 0\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: []\nenumerateresponse:\n enumerationcontext: \"\"\npullresponse:\n xmlname:\n space: \"\"\n local: \"\"\n profileitems: []\n credentialcontextitems: []\n" result := response.YAML() assert.Equal(t, expectedResult, result) } diff --git a/pkg/wsman/amt/ieee8021x/types.go b/pkg/wsman/amt/ieee8021x/types.go index 9b4f2587..6259177e 100644 --- a/pkg/wsman/amt/ieee8021x/types.go +++ b/pkg/wsman/amt/ieee8021x/types.go @@ -56,9 +56,34 @@ type ( ServerCertificateIssue string `xml:"ServerCertificateIssue,omitempty"` // The trusted root CA that should be used while verifying the server certificate. The root certificate should be specified in the Put request while configuring the profile. This will delete the existing instance of AMT_8021xCredentialContext that represents the trusted root certificate, and create a new instance if a trusted root certificate EPR is provided. This property will never be returned in Get response. This field is optional. If not defined, AMT looks for a matching root certidicate in its repository. PxeTimeout int `xml:"PxeTimeout,omitempty"` // Timeout in seconds, in which the IntelĀ® AMT will hold an authenticated 802.1X session. During the defined period, IntelĀ® AMT manages the 802.1X negotiation while a PXE boot takes place. After the timeout, control of the negotiation passes to the host. The maximum value is 86400 seconds (one day). A value of 0 disables the feature. If you do not set a profile, the value of PxeTimeout is 0. If you set a profile without specifying a value for PxeTimeout, the firmware sets it to 120. } - + SelectorResponse struct { + XMLName xml.Name `xml:"Selector,omitempty"` + Name string `xml:"Name,attr"` + Text string `xml:",chardata"` + } + SelectorSetResponse struct { + XMLName xml.Name `xml:"SelectorSet,omitempty"` + Selectors []SelectorResponse `xml:"Selector,omitempty"` + } + ReferenceParametersResponse struct { + XMLName xml.Name `xml:"ReferenceParameters,omitempty"` + ResourceURI string `xml:"ResourceURI,omitempty"` + SelectorSet SelectorSetResponse `xml:"SelectorSet,omitempty"` + } + ElementInContextResponse struct { + XMLName xml.Name `xml:"ElementInContext"` + Address string `xml:"Address,omitempty"` + ReferenceParameters ReferenceParametersResponse `xml:"ReferenceParameters,omitempty"` + } + ElementProvidingContextResponse struct { + XMLName xml.Name `xml:"ElementProvidingContext"` + Address string `xml:"Address,omitempty"` + ReferenceParameters ReferenceParametersResponse `xml:"ReferenceParameters,omitempty"` + } CredentialContextResponse struct { - XMLName xml.Name `xml:"AMT_8021XCredentialContext"` + XMLName xml.Name `xml:"AMT_8021xCredentialContext"` + ElementInContext ElementInContextResponse `xml:"ElementInContext"` + ElementProvidingContext ElementProvidingContextResponse `xml:"ElementProvidingContext"` } ) diff --git a/pkg/wsman/ips/ieee8021x/credentialcontext_test.go b/pkg/wsman/ips/ieee8021x/credentialcontext_test.go index bbcbcc70..f3c5bd64 100644 --- a/pkg/wsman/ips/ieee8021x/credentialcontext_test.go +++ b/pkg/wsman/ips/ieee8021x/credentialcontext_test.go @@ -22,7 +22,7 @@ func TestJson(t *testing.T) { PullResponse: PullResponse{}, }, } - expectedResult := "{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"PullResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"IEEE8021xSettingsItems\":null},\"EnumerateResponse\":{\"EnumerationContext\":\"\"},\"IEEE8021xSettingsResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ElementName\":\"\",\"InstanceID\":\"\",\"Enabled\":0,\"AvailableInS0\":false,\"PxeTimeout\":0},\"SetCertificatesResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ReturnValue\":0}}" + expectedResult := "{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"PullResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"IEEE8021xSettingsItems\":null,\"CredentialContextItems\":null},\"EnumerateResponse\":{\"EnumerationContext\":\"\"},\"IEEE8021xSettingsResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ElementName\":\"\",\"InstanceID\":\"\",\"Enabled\":0,\"AvailableInS0\":false,\"PxeTimeout\":0},\"SetCertificatesResponse\":{\"XMLName\":{\"Space\":\"\",\"Local\":\"\"},\"ReturnValue\":0}}" result := response.JSON() assert.Equal(t, expectedResult, result) } @@ -33,7 +33,7 @@ func TestYaml(t *testing.T) { PullResponse: PullResponse{}, }, } - expectedResult := "xmlname:\n space: \"\"\n local: \"\"\npullresponse:\n xmlname:\n space: \"\"\n local: \"\"\n ieee8021xsettingsitems: []\nenumerateresponse:\n enumerationcontext: \"\"\nieee8021xsettingsresponse:\n xmlname:\n space: \"\"\n local: \"\"\n elementname: \"\"\n instanceid: \"\"\n enabled: 0\n availableins0: false\n pxetimeout: 0\nsetcertificatesresponse:\n xmlname:\n space: \"\"\n local: \"\"\n returnvalue: 0\n" + expectedResult := "xmlname:\n space: \"\"\n local: \"\"\npullresponse:\n xmlname:\n space: \"\"\n local: \"\"\n ieee8021xsettingsitems: []\n credentialcontextitems: []\nenumerateresponse:\n enumerationcontext: \"\"\nieee8021xsettingsresponse:\n xmlname:\n space: \"\"\n local: \"\"\n elementname: \"\"\n instanceid: \"\"\n enabled: 0\n availableins0: false\n pxetimeout: 0\nsetcertificatesresponse:\n xmlname:\n space: \"\"\n local: \"\"\n returnvalue: 0\n" result := response.YAML() assert.Equal(t, expectedResult, result) } diff --git a/pkg/wsman/ips/ieee8021x/types.go b/pkg/wsman/ips/ieee8021x/types.go index f35bc0f2..5fa7f2a4 100644 --- a/pkg/wsman/ips/ieee8021x/types.go +++ b/pkg/wsman/ips/ieee8021x/types.go @@ -53,6 +53,36 @@ type ( PullResponse struct { XMLName xml.Name `xml:"PullResponse"` IEEE8021xSettingsItems []IEEE8021xSettingsResponse `xml:"Items>IPS_IEEE8021xSettings"` + CredentialContextItems []CredentialContextResponse `xml:"Items>IPS_8021xCredentialContext"` + } + CredentialContextResponse struct { + XMLName xml.Name `xml:"IPS_8021xCredentialContext"` + ElementInContext ElementInContextResponse `xml:"ElementInContext"` + ElementProvidingContext ElementProvidingContextResponse `xml:"ElementProvidingContext"` + } + SelectorResponse struct { + XMLName xml.Name `xml:"Selector,omitempty"` + Name string `xml:"Name,attr"` + Text string `xml:",chardata"` + } + SelectorSetResponse struct { + XMLName xml.Name `xml:"SelectorSet,omitempty"` + Selectors []SelectorResponse `xml:"Selector,omitempty"` + } + ReferenceParametersResponse struct { + XMLName xml.Name `xml:"ReferenceParameters,omitempty"` + ResourceURI string `xml:"ResourceURI,omitempty"` + SelectorSet SelectorSetResponse `xml:"SelectorSet,omitempty"` + } + ElementInContextResponse struct { + XMLName xml.Name `xml:"ElementInContext"` + Address string `xml:"Address,omitempty"` + ReferenceParameters ReferenceParametersResponse `xml:"ReferenceParameters,omitempty"` + } + ElementProvidingContextResponse struct { + XMLName xml.Name `xml:"ElementProvidingContext"` + Address string `xml:"Address,omitempty"` + ReferenceParameters ReferenceParametersResponse `xml:"ReferenceParameters,omitempty"` } SetCertificates_OUTPUT struct { XMLName xml.Name `xml:"SetCertificates_OUTPUT"`