Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(azure-iot-provisioning-service): add capabilities option to EnrollmentGroup #924

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions provisioning/e2e/_service_create_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,26 @@ var symmetricKeyEnrollmentGroup = {
allocationPolicy: 'static'
};

var iotEdgeEnrollmentGroup = {
enrollmentGroupId: 'e2e-node-deleteme-psc-' + uuid.v4(),
attestation: {
type: 'symmetricKey',
symmetricKey: {
primaryKey: Buffer.from(uuid.v4()).toString('base64'),
secondaryKey: Buffer.from(uuid.v4()).toString('base64')
}
},
provisioningStatus: "enabled",
capabilities: {
iotEdge: true
},
reprovisionPolicy: {
updateHubAssignment: false,
migrateDeviceData: true
},
allocationPolicy: 'static'
};

describe('Provisioning Service Client: CRUD operations', function () {
this.timeout(60000);
before(function(done) {
Expand Down Expand Up @@ -142,6 +162,16 @@ describe('Provisioning Service Client: CRUD operations', function () {
createFunction: serviceClient.createOrUpdateEnrollmentGroup.bind(serviceClient),
updateFunction: serviceClient.createOrUpdateEnrollmentGroup.bind(serviceClient),
enrollmentObject: symmetricKeyEnrollmentGroup
},
{
getFunction: serviceClient.getEnrollmentGroup.bind(serviceClient),
deleteFunction: serviceClient.deleteEnrollmentGroup.bind(serviceClient),
getAttestationMechanismFunction: serviceClient.getEnrollmentGroupAttestationMechanism.bind(serviceClient),
testDescription: 'EnrollmentGroup object with symmetric keys and capabilities.iotEdge property with value true',
idPropertyName: 'enrollmentGroupId',
createFunction: serviceClient.createOrUpdateEnrollmentGroup.bind(serviceClient),
updateFunction: serviceClient.createOrUpdateEnrollmentGroup.bind(serviceClient),
enrollmentObject: iotEdgeEnrollmentGroup
}
];
testSpecification.forEach(function(testConfiguration) {
Expand Down Expand Up @@ -171,6 +201,9 @@ describe('Provisioning Service Client: CRUD operations', function () {
debug(err);
}
assert.isNull(err,'Should be no error from the create');
if (testConfiguration.enrollmentObject.capabilities && testConfiguration.enrollmentObject.capabilities.iotEdge) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&& testConfiguration.enrollmentObject.capabilities.iotEdge [](start = 61, length = 59)

Should probably delete everything past the &&

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I changed my mind. Leave it exactly the way it is.


In reply to: 569003962 [](ancestors = 569003962)

assert.isTrue(returnedEnrollment.capabilities.iotEdge, 'capabilities.iotEdge property in returned enrollment should be true');
}
enrollmentToDelete = returnedEnrollment;
callback();
});
Expand Down
5 changes: 5 additions & 0 deletions provisioning/service/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,11 @@ export interface EnrollmentGroup {
*/
lastUpdatedDateTimeUtc?: string;

/**
* The capabilities of the device that will be provisioned using this enrollment record.
*/
capabilities?: DeviceCapabilities;

/**
* The behavior when a device is re-provisioned to an IoT hub.
*/
Expand Down