Skip to content

Commit

Permalink
fix(azure-iot-provisioning-service): add capabilities option to Enrol…
Browse files Browse the repository at this point in the history
…lmentGroup (#924)

Added capabilities option to EnrollmentGroup, added test

fix #922
  • Loading branch information
vishnureddy17 committed Feb 3, 2021
1 parent c7833fc commit f0a5e74
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
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) {
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

0 comments on commit f0a5e74

Please sign in to comment.