diff --git a/data/init.sql b/data/init.sql index 59a764d89..58647c5ac 100644 --- a/data/init.sql +++ b/data/init.sql @@ -99,3 +99,23 @@ CREATE TABLE IF NOT EXISTS domains( CONSTRAINT domainsuffix UNIQUE (domain_suffix, tenant_id), PRIMARY KEY (name, domain_suffix, tenant_id) ); +CREATE TABLE IF NOT EXISTS proxyconfigs( + access_info varchar(256) NOT NULL, + info_format integer, + port integer, + network_dns_suffix varchar(192), + creation_date timestamp, + tenant_id varchar(36) NOT NULL, + PRIMARY KEY (access_info, tenant_id) +); +CREATE TABLE IF NOT EXISTS profiles_proxyconfigs( + access_info citext, + profile_name citext, + FOREIGN KEY (access_info,tenant_id) REFERENCES proxyconfigs(access_info,tenant_id), + FOREIGN KEY (profile_name,tenant_id) REFERENCES profiles(profile_name,tenant_id), + priority integer, + creation_date timestamp, + created_by varchar(40), + tenant_id varchar(36) NOT NULL, + PRIMARY KEY (access_info, profile_name, priority, tenant_id) +); \ No newline at end of file diff --git a/src/data/postgres/index.ts b/src/data/postgres/index.ts index ff782ab19..5ad0f98a9 100644 --- a/src/data/postgres/index.ts +++ b/src/data/postgres/index.ts @@ -14,6 +14,8 @@ import { WirelessProfilesTable } from './tables/wirelessProfiles.js' import { IEEE8021xProfilesTable } from './tables/ieee8021xProfiles.js' import { readFileSync } from 'fs' import { Environment } from '../../utils/Environment.js' +import { ProxyConfigsTable } from './tables/proxyConfigs.js' +import { ProfileProxyConfigsTable } from './tables/profileProxyConfigs.js' export default class Db implements IDB { pool: InstanceType @@ -23,6 +25,8 @@ export default class Db implements IDB { wirelessProfiles: WirelessProfilesTable profileWirelessConfigs: ProfilesWifiConfigsTable ieee8021xProfiles: IEEE8021xProfilesTable + proxyConfigs: ProxyConfigsTable + profileProxyConfigs: ProfileProxyConfigsTable log: Logger = new Logger('PostgresDb') @@ -79,6 +83,8 @@ export default class Db implements IDB { this.wirelessProfiles = new WirelessProfilesTable(this) this.profileWirelessConfigs = new ProfilesWifiConfigsTable(this) this.ieee8021xProfiles = new IEEE8021xProfilesTable(this) + this.proxyConfigs = new ProxyConfigsTable(this) + this.profileProxyConfigs = new ProfileProxyConfigsTable(this) } async query(text: string, params?: any): Promise> { diff --git a/src/data/postgres/tables/profileProxyConfigs.test.ts b/src/data/postgres/tables/profileProxyConfigs.test.ts new file mode 100644 index 000000000..c147c0f5f --- /dev/null +++ b/src/data/postgres/tables/profileProxyConfigs.test.ts @@ -0,0 +1,106 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2025 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import PostgresDb from '../index.js' +import { API_UNEXPECTED_EXCEPTION } from '../../../utils/constants.js' +import { type ProfileProxyConfigs } from '../../../models/RCS.Config.js' +import { ProfileProxyConfigsTable } from './profileProxyConfigs.js' +import { jest } from '@jest/globals' +import { type SpyInstance, spyOn } from 'jest-mock' + +describe('profileproxyconfig tests', () => { + let db: PostgresDb + let profilesProxyConfigsTable: ProfileProxyConfigsTable + let querySpy: SpyInstance + const proxyConfigs: ProfileProxyConfigs[] = [ + { configName: 'proxyConfig', priority: 1 } as any + ] + const configName = 'profileName' + const tenantId = 'tenantId' + + beforeEach(() => { + db = new PostgresDb('') + profilesProxyConfigsTable = new ProfileProxyConfigsTable(db) + querySpy = spyOn(profilesProxyConfigsTable.db, 'query') + }) + afterEach(() => { + jest.clearAllMocks() + }) + describe('Get', () => { + test('should Get', async () => { + querySpy.mockResolvedValueOnce({ rows: [{}], rowCount: 1 }) + const result = await profilesProxyConfigsTable.getProfileProxyConfigs(configName) + expect(result).toStrictEqual([{}]) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + SELECT + priority as "priority", + access_info as "configName" + FROM profiles_proxyconfigs + WHERE profile_name = $1 and tenant_id = $2 + ORDER BY priority`, + [configName, ''] + ) + }) + }) + describe('Delete', () => { + test('should Delete', async () => { + querySpy.mockResolvedValueOnce({ rows: [{}], rowCount: 1 }) + const result = await profilesProxyConfigsTable.deleteProfileProxyConfigs(configName) + expect(result).toBe(true) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + DELETE + FROM profiles_proxyconfigs + WHERE profile_name = $1 and tenant_id = $2`, + [configName, ''] + ) + }) + test('should Delete with tenandId', async () => { + querySpy.mockResolvedValueOnce({ rows: [{}], rowCount: 1 }) + const result = await profilesProxyConfigsTable.deleteProfileProxyConfigs(configName, tenantId) + expect(result).toBe(true) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + DELETE + FROM profiles_proxyconfigs + WHERE profile_name = $1 and tenant_id = $2`, + [configName, tenantId] + ) + }) + }) + describe('Insert', () => { + test('should Insert', async () => { + querySpy.mockResolvedValueOnce({ rows: [{}], rowCount: 1 }) + const result = await profilesProxyConfigsTable.createProfileProxyConfigs(proxyConfigs, configName) + expect(result).toBe(true) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith(` + INSERT INTO + profiles_proxyconfigs (access_info, profile_name, priority, tenant_id) + VALUES ('proxyConfig', 'profileName', '1', '')`) + }) + test('should NOT insert when no proxyconfigs', async () => { + await expect(profilesProxyConfigsTable.createProfileProxyConfigs([], configName)).rejects.toThrow( + 'Operation failed: profileName' + ) + }) + test('should NOT insert when constraint violation', async () => { + querySpy.mockRejectedValueOnce({ code: '23503', detail: 'error' }) + await expect(profilesProxyConfigsTable.createProfileProxyConfigs(proxyConfigs, configName)).rejects.toThrow( + 'error' + ) + }) + test('should NOT insert when unknown error', async () => { + querySpy.mockRejectedValueOnce('unknown') + await expect(profilesProxyConfigsTable.createProfileProxyConfigs(proxyConfigs, configName)).rejects.toThrow( + API_UNEXPECTED_EXCEPTION(configName) + ) + }) + }) +}) diff --git a/src/data/postgres/tables/profileProxyConfigs.ts b/src/data/postgres/tables/profileProxyConfigs.ts new file mode 100644 index 000000000..f629b2016 --- /dev/null +++ b/src/data/postgres/tables/profileProxyConfigs.ts @@ -0,0 +1,103 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2025 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import { type IProfileProxyConfigsTable } from '../../../interfaces/database/IProfileProxyConfigsDb.js' +import { type ProfileProxyConfigs } from '../../../models/RCS.Config.js' +import { API_UNEXPECTED_EXCEPTION } from '../../../utils/constants.js' +import { RPSError } from '../../../utils/RPSError.js' +import format from 'pg-format' +import type PostgresDb from '../index.js' +import { PostgresErr } from '../errors.js' + +export class ProfileProxyConfigsTable implements IProfileProxyConfigsTable { + db: PostgresDb + constructor(db: PostgresDb) { + this.db = db + } + + /** + * @description Get AMT Profile associated proxy configs + * @param {string} configName + * @returns {ProfileProxyConfigs[]} Return an array of proxy configs + */ + async getProfileProxyConfigs(configName: string, tenantId = ''): Promise { + const results = await this.db.query( + ` + SELECT + priority as "priority", + access_info as "configName" + FROM profiles_proxyconfigs + WHERE profile_name = $1 and tenant_id = $2 + ORDER BY priority`, + [configName, tenantId] + ) + return results.rows + } + + /** + * @description Insert proxy configs associated with AMT profile + * @param {ProfileProxyConfigs[]} proxyConfigs + * @param {string} configName + * @returns {ProfileProxyConfigs[]} Return an array of proxy configs + */ + async createProfileProxyConfigs( + proxyConfigs: ProfileProxyConfigs[], + configName: string, + tenantId = '' + ): Promise { + try { + if (proxyConfigs.length < 1) { + throw new RPSError('No proxyConfigs provided to insert') + } + // Preparing data for inserting multiple rows + const configs = proxyConfigs.map((config) => [ + config.configName, + configName, + config.priority, + tenantId + ]) + const proxyProfilesQueryResults = await this.db.query( + format( + ` + INSERT INTO + profiles_proxyconfigs (access_info, profile_name, priority, tenant_id) + VALUES %L`, + configs + ) + ) + + if ((proxyProfilesQueryResults?.rowCount ?? 0) > 0) { + return true + } + } catch (error) { + if (error.code === PostgresErr.C23_FOREIGN_KEY_VIOLATION) { + throw new RPSError(error.detail, 'Foreign key constraint violation') + } + throw new RPSError(API_UNEXPECTED_EXCEPTION(configName)) + } + return false + } + + /** + * @description Delete proxy configs of an AMT Profile from DB by profile name + * @param {string} configName + * @returns {boolean} Return true on successful deletion + */ + async deleteProfileProxyConfigs(configName: string, tenantId = ''): Promise { + const deleteProfileWifiResults = await this.db.query( + ` + DELETE + FROM profiles_proxyconfigs + WHERE profile_name = $1 and tenant_id = $2`, + [configName, tenantId] + ) + + if ((deleteProfileWifiResults?.rowCount ?? 0) > 0) { + return true + } + + return false + } +} diff --git a/src/data/postgres/tables/profiles.test.ts b/src/data/postgres/tables/profiles.test.ts index 292b5b699..5f70cf1ab 100644 --- a/src/data/postgres/tables/profiles.test.ts +++ b/src/data/postgres/tables/profiles.test.ts @@ -82,7 +82,13 @@ describe('profiles tests', () => { }) test('should get count of 0 on empty rows array', async () => { const expected = 0 - querySpy.mockResolvedValueOnce({ rows: [], command: '', fields: null, rowCount: expected, oid: 0 }) + querySpy.mockResolvedValueOnce({ + rows: [], + command: '', + fields: null, + rowCount: expected, + oid: 0 + }) const count: number = await profilesTable.getCount() expect(count).toBe(expected) }) @@ -124,9 +130,11 @@ describe('profiles tests', () => { ieee8021x_profile_name as "ieee8021xProfileName", COALESCE(json_agg(json_build_object('profileName',wc.wireless_profile_name, 'priority', wc.priority)) FILTER (WHERE wc.wireless_profile_name IS NOT NULL), '[]') AS "wifiConfigs", ip_sync_enabled as "ipSyncEnabled", - local_wifi_sync_enabled as "localWifiSyncEnabled" + local_wifi_sync_enabled as "localWifiSyncEnabled", + COALESCE(json_agg(json_build_object('configName',pc.access_info, 'priority', pc.priority)) FILTER (WHERE pc.access_info IS NOT NULL), '[]') AS "proxyConfigs" FROM profiles p LEFT JOIN profiles_wirelessconfigs wc ON wc.profile_name = p.profile_name AND wc.tenant_id = p.tenant_id + LEFT JOIN profiles_proxyconfigs pc ON pc.profile_name = p.profile_name AND pc.tenant_id = p.tenant_id WHERE p.tenant_id = $3 GROUP BY p.profile_name, @@ -182,9 +190,11 @@ describe('profiles tests', () => { ieee8021x_profile_name as "ieee8021xProfileName", COALESCE(json_agg(json_build_object('profileName',wc.wireless_profile_name, 'priority', wc.priority)) FILTER (WHERE wc.wireless_profile_name IS NOT NULL), '[]') AS "wifiConfigs", ip_sync_enabled as "ipSyncEnabled", - local_wifi_sync_enabled as "localWifiSyncEnabled" + local_wifi_sync_enabled as "localWifiSyncEnabled", + COALESCE(json_agg(json_build_object('configName',pc.access_info, 'priority', pc.priority)) FILTER (WHERE pc.access_info IS NOT NULL), '[]') AS "proxyConfigs" FROM profiles p LEFT JOIN profiles_wirelessconfigs wc ON wc.profile_name = p.profile_name AND wc.tenant_id = p.tenant_id + LEFT JOIN profiles_proxyconfigs pc ON pc.profile_name = p.profile_name AND pc.tenant_id = p.tenant_id WHERE p.profile_name = $1 and p.tenant_id = $2 GROUP BY p.profile_name, @@ -233,9 +243,12 @@ describe('profiles tests', () => { querySpy.mockResolvedValueOnce({ rows: [], rowCount: 1 }) const wirelessConfigSpy = spyOn(db.profileWirelessConfigs, 'deleteProfileWifiConfigs') wirelessConfigSpy.mockResolvedValue(true) + const profileProxyConfigsSpy = spyOn(db.profileProxyConfigs, 'deleteProfileProxyConfigs') + profileProxyConfigsSpy.mockResolvedValue(true) const result = await profilesTable.delete(profileName, tenantId) expect(result).toBeTruthy() expect(wirelessConfigSpy).toHaveBeenLastCalledWith(profileName, tenantId) + expect(profileProxyConfigsSpy).toHaveBeenLastCalledWith(profileName, tenantId) expect(querySpy).toBeCalledTimes(1) expect(querySpy).toBeCalledWith( ` @@ -249,6 +262,17 @@ describe('profiles tests', () => { querySpy.mockResolvedValueOnce({ rows: [], rowCount: 0 }) const wirelessConfigSpy = spyOn(db.profileWirelessConfigs, 'deleteProfileWifiConfigs') wirelessConfigSpy.mockResolvedValue(false) + const profileProxyConfigsSpy = spyOn(db.profileProxyConfigs, 'deleteProfileProxyConfigs') + profileProxyConfigsSpy.mockResolvedValue(true) + const result = await profilesTable.delete(profileName) + expect(result).toBe(false) + }) + test('should NOT delete when cannot delete proxy configs', async () => { + querySpy.mockResolvedValueOnce({ rows: [], rowCount: 0 }) + const wirelessConfigSpy = spyOn(db.profileWirelessConfigs, 'deleteProfileWifiConfigs') + wirelessConfigSpy.mockResolvedValue(true) + const profileProxyConfigsSpy = spyOn(db.profileProxyConfigs, 'deleteProfileProxyConfigs') + profileProxyConfigsSpy.mockResolvedValue(false) const result = await profilesTable.delete(profileName) expect(result).toBe(false) }) @@ -263,6 +287,7 @@ describe('profiles tests', () => { querySpy.mockResolvedValueOnce({ rows: [], rowCount: 1 }) const profileWirelessConfigsSpy = spyOn(db.profileWirelessConfigs, 'createProfileWifiConfigs') profileWirelessConfigsSpy.mockResolvedValue(true) + const getByNameSpy = spyOn(profilesTable, 'getByName') amtConfig.wifiConfigs = [{} as any] getByNameSpy.mockResolvedValue(amtConfig) @@ -274,6 +299,7 @@ describe('profiles tests', () => { amtConfig.profileName, amtConfig.tenantId ) + expect(getByNameSpy).toHaveBeenCalledWith(amtConfig.profileName, amtConfig.tenantId) expect(querySpy).toBeCalledTimes(1) expect(querySpy).toBeCalledWith( @@ -471,7 +497,10 @@ describe('profiles tests', () => { }) test('should NOT update when constraint violation', async () => { - querySpy.mockRejectedValueOnce({ code: '23503', message: 'profiles_cira_config_name_fkey' }) + querySpy.mockRejectedValueOnce({ + code: '23503', + message: 'profiles_cira_config_name_fkey' + }) await expect(profilesTable.update(amtConfig)).rejects.toThrow( PROFILE_INSERTION_CIRA_CONSTRAINT(amtConfig.ciraConfigName) ) @@ -486,5 +515,155 @@ describe('profiles tests', () => { getByNameSpy.mockResolvedValue(amtConfig) await expect(profilesTable.update(amtConfig)).rejects.toThrow(CONCURRENCY_MESSAGE) }) + test('should insert with proxy configs', async () => { + querySpy.mockResolvedValueOnce({ rows: [], rowCount: 1 }) + + const profileProxyConfigsSpy = spyOn(db.profileProxyConfigs, 'createProfileProxyConfigs') + profileProxyConfigsSpy.mockResolvedValue(true) + + const getByNameSpy = spyOn(profilesTable, 'getByName') + amtConfig.proxyConfigs = [{} as any] + getByNameSpy.mockResolvedValue(amtConfig) + const result = await profilesTable.insert(amtConfig) + + expect(result).toBe(amtConfig) + + expect(profileProxyConfigsSpy).toHaveBeenCalledWith( + amtConfig.proxyConfigs, + amtConfig.profileName, + amtConfig.tenantId + ) + + expect(getByNameSpy).toHaveBeenCalledWith(amtConfig.profileName, amtConfig.tenantId) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + INSERT INTO profiles( + profile_name, activation, + amt_password, generate_random_password, + cira_config_name, + mebx_password, generate_random_mebx_password, + tags, dhcp_enabled, tls_mode, + user_consent, ider_enabled, kvm_enabled, sol_enabled, + tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled) + values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)`, + [ + amtConfig.profileName, + amtConfig.activation, + amtConfig.amtPassword, + amtConfig.generateRandomPassword, + amtConfig.ciraConfigName, + amtConfig.mebxPassword, + amtConfig.generateRandomMEBxPassword, + amtConfig.tags, + amtConfig.dhcpEnabled, + amtConfig.tlsMode, + amtConfig.userConsent, + amtConfig.iderEnabled, + amtConfig.kvmEnabled, + amtConfig.solEnabled, + amtConfig.tenantId, + amtConfig.tlsSigningAuthority, + amtConfig.ieee8021xProfileName, + amtConfig.ipSyncEnabled, + amtConfig.localWifiSyncEnabled + ] + ) + }) + test('should insert without proxy configs', async () => { + querySpy.mockResolvedValueOnce({ rows: [], rowCount: 1 }) + const profileProxyConfigsSpy = spyOn(db.profileProxyConfigs, 'createProfileProxyConfigs') + profileProxyConfigsSpy.mockResolvedValue(true) + const getByNameSpy = spyOn(profilesTable, 'getByName') + getByNameSpy.mockResolvedValue(amtConfig) + const result = await profilesTable.insert(amtConfig) + + expect(result).toBe(amtConfig) + expect(profileProxyConfigsSpy).not.toHaveBeenCalledWith( + amtConfig.proxyConfigs, + amtConfig.profileName, + amtConfig.tenantId + ) + expect(getByNameSpy).toHaveBeenCalledWith(amtConfig.profileName, amtConfig.tenantId) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + INSERT INTO profiles( + profile_name, activation, + amt_password, generate_random_password, + cira_config_name, + mebx_password, generate_random_mebx_password, + tags, dhcp_enabled, tls_mode, + user_consent, ider_enabled, kvm_enabled, sol_enabled, + tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled) + values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)`, + [ + amtConfig.profileName, + amtConfig.activation, + amtConfig.amtPassword, + amtConfig.generateRandomPassword, + amtConfig.ciraConfigName, + amtConfig.mebxPassword, + amtConfig.generateRandomMEBxPassword, + amtConfig.tags, + amtConfig.dhcpEnabled, + amtConfig.tlsMode, + amtConfig.userConsent, + amtConfig.iderEnabled, + amtConfig.kvmEnabled, + amtConfig.solEnabled, + amtConfig.tenantId, + amtConfig.tlsSigningAuthority, + amtConfig.ieee8021xProfileName, + amtConfig.ipSyncEnabled, + amtConfig.localWifiSyncEnabled + ] + ) + }) + test('should update with proxy configs', async () => { + querySpy.mockResolvedValueOnce({ rows: [], rowCount: 1 }) + const profileProxyConfigsSpy = spyOn(db.profileProxyConfigs, 'createProfileProxyConfigs') + profileProxyConfigsSpy.mockResolvedValue(true) + const getByNameSpy = spyOn(profilesTable, 'getByName') + amtConfig.proxyConfigs = [{} as any] + getByNameSpy.mockResolvedValue(amtConfig) + + const result = await profilesTable.update(amtConfig) + expect(result).toBe(amtConfig) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + UPDATE profiles + SET activation=$2, amt_password=$3, generate_random_password=$4, cira_config_name=$5, + mebx_password=$6, generate_random_mebx_password=$7, + tags=$8, dhcp_enabled=$9, tls_mode=$10, user_consent=$13, + ider_enabled=$14, kvm_enabled=$15, sol_enabled=$16, + tls_signing_authority=$17, ieee8021x_profile_name=$18, + ip_sync_enabled=$19, local_wifi_sync_enabled=$20 + WHERE profile_name=$1 and tenant_id = $11 and xmin = $12`, + [ + amtConfig.profileName, + amtConfig.activation, + amtConfig.amtPassword, + amtConfig.generateRandomPassword, + amtConfig.ciraConfigName, + amtConfig.mebxPassword, + amtConfig.generateRandomMEBxPassword, + amtConfig.tags, + amtConfig.dhcpEnabled, + amtConfig.tlsMode, + amtConfig.tenantId, + amtConfig.version, + amtConfig.userConsent, + amtConfig.iderEnabled, + amtConfig.kvmEnabled, + amtConfig.solEnabled, + amtConfig.tlsSigningAuthority, + amtConfig.ieee8021xProfileName, + amtConfig.ipSyncEnabled, + amtConfig.localWifiSyncEnabled + ] + ) + }) }) }) diff --git a/src/data/postgres/tables/profiles.ts b/src/data/postgres/tables/profiles.ts index f1e36c225..8366a15f9 100644 --- a/src/data/postgres/tables/profiles.ts +++ b/src/data/postgres/tables/profiles.ts @@ -78,9 +78,11 @@ export class ProfilesTable implements IProfilesTable { ieee8021x_profile_name as "ieee8021xProfileName", COALESCE(json_agg(json_build_object('profileName',wc.wireless_profile_name, 'priority', wc.priority)) FILTER (WHERE wc.wireless_profile_name IS NOT NULL), '[]') AS "wifiConfigs", ip_sync_enabled as "ipSyncEnabled", - local_wifi_sync_enabled as "localWifiSyncEnabled" + local_wifi_sync_enabled as "localWifiSyncEnabled", + COALESCE(json_agg(json_build_object('configName',pc.access_info, 'priority', pc.priority)) FILTER (WHERE pc.access_info IS NOT NULL), '[]') AS "proxyConfigs" FROM profiles p LEFT JOIN profiles_wirelessconfigs wc ON wc.profile_name = p.profile_name AND wc.tenant_id = p.tenant_id + LEFT JOIN profiles_proxyconfigs pc ON pc.profile_name = p.profile_name AND pc.tenant_id = p.tenant_id WHERE p.tenant_id = $3 GROUP BY p.profile_name, @@ -140,9 +142,11 @@ export class ProfilesTable implements IProfilesTable { ieee8021x_profile_name as "ieee8021xProfileName", COALESCE(json_agg(json_build_object('profileName',wc.wireless_profile_name, 'priority', wc.priority)) FILTER (WHERE wc.wireless_profile_name IS NOT NULL), '[]') AS "wifiConfigs", ip_sync_enabled as "ipSyncEnabled", - local_wifi_sync_enabled as "localWifiSyncEnabled" + local_wifi_sync_enabled as "localWifiSyncEnabled", + COALESCE(json_agg(json_build_object('configName',pc.access_info, 'priority', pc.priority)) FILTER (WHERE pc.access_info IS NOT NULL), '[]') AS "proxyConfigs" FROM profiles p LEFT JOIN profiles_wirelessconfigs wc ON wc.profile_name = p.profile_name AND wc.tenant_id = p.tenant_id + LEFT JOIN profiles_proxyconfigs pc ON pc.profile_name = p.profile_name AND pc.tenant_id = p.tenant_id WHERE p.profile_name = $1 and p.tenant_id = $2 GROUP BY p.profile_name, @@ -193,6 +197,9 @@ export class ProfilesTable implements IProfilesTable { // delete any associations with wificonfigs await this.db.profileWirelessConfigs.deleteProfileWifiConfigs(profileName, tenantId) + // delete any associations with proxyconfigs + await this.db.profileProxyConfigs.deleteProfileProxyConfigs(profileName, tenantId) + const results = await this.db.query( ` DELETE @@ -263,6 +270,15 @@ export class ProfilesTable implements IProfilesTable { } } + const proxyConfigs = amtConfig?.proxyConfigs ?? [] + if (proxyConfigs.length > 0) { + await this.db.profileProxyConfigs.createProfileProxyConfigs( + proxyConfigs, + amtConfig.profileName, + amtConfig.tenantId + ) + } + return await this.getByName(amtConfig.profileName, amtConfig.tenantId) } catch (error) { this.log.error(`Failed to insert AMT profile: ${amtConfig.profileName}`, error) @@ -331,6 +347,15 @@ export class ProfilesTable implements IProfilesTable { amtConfig.tenantId ) } + const proxyConfigs = amtConfig?.proxyConfigs ?? [] + if (proxyConfigs.length > 0) { + await this.db.profileProxyConfigs.createProfileProxyConfigs( + proxyConfigs, + amtConfig.profileName, + amtConfig.tenantId + ) + } + latestItem = await this.getByName(amtConfig.profileName, amtConfig.tenantId) return latestItem } diff --git a/src/data/postgres/tables/proxyConfigs.test.ts b/src/data/postgres/tables/proxyConfigs.test.ts new file mode 100644 index 000000000..b3fbb0fe7 --- /dev/null +++ b/src/data/postgres/tables/proxyConfigs.test.ts @@ -0,0 +1,331 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2025 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import PostgresDb from '../index.js' +import { type ProxyConfig } from '../../../models/RCS.Config.js' +import { + API_UNEXPECTED_EXCEPTION, + CONCURRENCY_MESSAGE, + DEFAULT_SKIP, + DEFAULT_TOP, + NETWORK_CONFIG_DELETION_FAILED_CONSTRAINT, + NETWORK_CONFIG_ERROR, + NETWORK_CONFIG_INSERTION_FAILED_DUPLICATE +} from '../../../utils/constants.js' +import { ProxyConfigsTable } from './proxyConfigs.js' +import { RPSError } from '../../../utils/RPSError.js' +import { jest } from '@jest/globals' +import { type SpyInstance, spyOn } from 'jest-mock' + +describe('proxy configs tests', () => { + let db: PostgresDb + let proxyConfigsTable: ProxyConfigsTable + let querySpy: SpyInstance + let proxyConfig: ProxyConfig + const accessInfo = 'proxyName' + beforeEach(() => { + proxyConfig = { + accessInfo: 'proxy.com', + infoFormat: 201, // FQDN (201) + port: 1000, + networkDnsSuffix: 'suffix', + tenantId: '' + } + db = new PostgresDb('') + proxyConfigsTable = new ProxyConfigsTable(db) + querySpy = spyOn(proxyConfigsTable.db, 'query') + }) + afterEach(() => { + jest.clearAllMocks() + }) + describe('Get', () => { + test('should get expected count', async () => { + const expected = 10 + querySpy.mockResolvedValueOnce({ + rows: [{ total_count: expected }], + command: '', + fields: null, + rowCount: expected, + oid: 0 + }) + const count: number = await proxyConfigsTable.getCount() + expect(count).toBe(expected) + }) + test('should get count of 0 on no counts made', async () => { + const expected = 0 + querySpy.mockResolvedValueOnce({ + rows: [{ total_count: expected }], + command: '', + fields: null, + rowCount: expected, + oid: 0 + }) + const count: number = await proxyConfigsTable.getCount() + expect(count).toBe(0) + }) + test('should get count of 0 on empty rows array', async () => { + const expected = 0 + querySpy.mockResolvedValueOnce({ + rows: [], + command: '', + fields: null, + rowCount: expected, + oid: 0 + }) + const count: number = await proxyConfigsTable.getCount() + expect(count).toBe(expected) + }) + test('should get count of 0 on no rows returned', async () => { + querySpy.mockResolvedValueOnce({}) + const count: number = await proxyConfigsTable.getCount() + expect(count).toBe(0) + }) + test('should get count of 0 on null results', async () => { + querySpy.mockResolvedValueOnce(null) + const count: number = await proxyConfigsTable.getCount() + expect(count).toBe(0) + }) + + test('should Get', async () => { + querySpy.mockResolvedValueOnce({ rows: [{}], rowCount: 1 }) + const result = await proxyConfigsTable.get() + expect(result).toStrictEqual([{}]) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + SELECT + access_info as "accessInfo", + info_format as "infoFormat", + port as "port", + network_dns_suffix as "networkDnsSuffix", + tenant_id as "tenantId" + FROM proxyconfigs + WHERE tenant_id = $3 + ORDER BY access_info + LIMIT $1 OFFSET $2`, + [ + DEFAULT_TOP, + DEFAULT_SKIP, + '' + ] + ) + }) + test('should get by name', async () => { + const rows = [{}] + querySpy.mockResolvedValueOnce({ rows: [{}], rowCount: rows.length }) + const result = await proxyConfigsTable.getByName(accessInfo) + expect(result).toStrictEqual(rows[0]) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + SELECT + access_info as "accessInfo", + info_format as "infoFormat", + port as "port", + network_dns_suffix as "networkDnsSuffix", + tenant_id as "tenantId" + FROM proxyconfigs + WHERE access_info = $1 and tenant_id = $2`, + [accessInfo, ''] + ) + }) + test('should NOT get by name when no profiles exists', async () => { + querySpy.mockResolvedValueOnce({ rows: [], rowCount: 0 }) + const result = await proxyConfigsTable.getByName(accessInfo) + expect(result).toBeNull() + }) + test('should check profile exist', async () => { + querySpy.mockResolvedValueOnce({ rows: [], rowCount: 0 }) + const result = await proxyConfigsTable.checkProfileExits(accessInfo) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + SELECT 1 + FROM proxyconfigs + WHERE access_info = $1 and tenant_id = $2`, + [accessInfo, ''] + ) + expect(result).toBe(false) + }) + }) + describe('Delete', () => { + test('should delete', async () => { + let count = 0 + querySpy.mockImplementation(() => ({ rows: [], rowCount: count++ })) + const result = await proxyConfigsTable.delete(accessInfo) + expect(result).toBeTruthy() + expect(querySpy).toBeCalledTimes(2) + expect(querySpy).toHaveBeenNthCalledWith( + 1, + ` + SELECT 1 + FROM profiles_proxyconfigs + WHERE access_info = $1 and tenant_id = $2`, + [accessInfo, ''] + ) + expect(querySpy).toHaveBeenNthCalledWith( + 2, + ` + DELETE + FROM proxyconfigs + WHERE access_info = $1 and tenant_id = $2`, + [accessInfo, ''] + ) + }) + test('should NOT delete when relationship still exists to profile', async () => { + querySpy.mockResolvedValueOnce({ rows: [], rowCount: 1 }) + await expect(proxyConfigsTable.delete(accessInfo)).rejects.toThrow( + NETWORK_CONFIG_DELETION_FAILED_CONSTRAINT('Proxy', accessInfo) + ) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + SELECT 1 + FROM profiles_proxyconfigs + WHERE access_info = $1 and tenant_id = $2`, + [accessInfo, ''] + ) + }) + test('should NOT delete when constraint violation', async () => { + let count = 0 + querySpy.mockImplementation(() => { + if (count === 0) { + return { rows: [], rowCount: count++ } + } + const err = new Error('foreign key violation') + ;(err as any).code = '23503' + throw err + }) + await expect(proxyConfigsTable.delete(accessInfo)).rejects.toThrow( + NETWORK_CONFIG_DELETION_FAILED_CONSTRAINT('Proxy', accessInfo) + ) + }) + test('should NOT delete when unknown error', async () => { + let count = 0 + querySpy.mockImplementation(() => { + if (count === 0) { + return { rows: [], rowCount: count++ } + } + throw new Error('unknown') + }) + await expect(proxyConfigsTable.delete(accessInfo)).rejects.toThrow( + API_UNEXPECTED_EXCEPTION(`Delete proxy configuration : ${accessInfo}`) + ) + }) + }) + describe('Insert', () => { + test('should insert', async () => { + querySpy.mockResolvedValueOnce({ rows: [], rowCount: 1 }) + const getByNameSpy = spyOn(proxyConfigsTable, 'getByName') + getByNameSpy.mockResolvedValue(proxyConfig) + const result = await proxyConfigsTable.insert(proxyConfig) + + expect(result).toBe(proxyConfig) + expect(getByNameSpy).toHaveBeenCalledWith(proxyConfig.accessInfo, proxyConfig.tenantId) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + INSERT INTO proxyconfigs + (access_info, info_format, port, network_dns_suffix, creation_date, tenant_id) + values($1, $2, $3, $4, $5, $6)`, + [ + proxyConfig.accessInfo, + proxyConfig.infoFormat, + proxyConfig.port, + proxyConfig.networkDnsSuffix, + new Date().toISOString().replace(/T/, ' ').replace(/\..+/, ''), + proxyConfig.tenantId + ] + ) + }) + test('should return null if insert does not return any rows (should throw an error though)', async () => { + querySpy.mockResolvedValueOnce({ rows: [], rowCount: 0 }) + let result = await proxyConfigsTable.insert(proxyConfig) + expect(result).toBeNull() + + querySpy.mockResolvedValueOnce(null) + result = await proxyConfigsTable.insert(proxyConfig) + expect(result).toBeNull() + }) + test('should NOT insert when duplicate name', async () => { + querySpy.mockRejectedValueOnce({ code: '23505' }) + await expect(proxyConfigsTable.insert(proxyConfig)).rejects.toThrow( + NETWORK_CONFIG_INSERTION_FAILED_DUPLICATE('Proxy', proxyConfig.accessInfo) + ) + }) + test('should NOT insert when unexpected exception', async () => { + querySpy.mockRejectedValueOnce(new Error('unknown')) + await expect(proxyConfigsTable.insert(proxyConfig)).rejects.toThrow( + NETWORK_CONFIG_ERROR('Proxy', proxyConfig.accessInfo) + ) + }) + }) + describe('Update', () => { + test('should Update', async () => { + querySpy.mockResolvedValueOnce({ rows: [{}], rowCount: 1 }) + const getByNameSpy = spyOn(proxyConfigsTable, 'getByName') + getByNameSpy.mockResolvedValue(proxyConfig) + const result = await proxyConfigsTable.update(proxyConfig) + expect(result).toBe(proxyConfig) + expect(getByNameSpy).toHaveBeenCalledWith(proxyConfig.accessInfo, proxyConfig.tenantId) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + UPDATE proxyconfigs + SET info_format=$2, port=$3, network_dns_suffix=$4 + WHERE access_info=$1 and tenant_id = $5`, + [ + proxyConfig.accessInfo, + proxyConfig.infoFormat, + proxyConfig.port, + proxyConfig.networkDnsSuffix, + proxyConfig.tenantId + ] + ) + }) + test('should throw RPSError with no results from update query', async () => { + querySpy.mockResolvedValueOnce({ rows: [], rowCount: 0 }) + const getByNameSpy = spyOn(proxyConfigsTable, 'getByName') + getByNameSpy.mockResolvedValue(proxyConfig) + await expect(proxyConfigsTable.update(proxyConfig)).rejects.toBeInstanceOf(RPSError) + }) + test('should throw RPSError with return from update query', async () => { + querySpy.mockResolvedValueOnce(null) + const getByNameSpy = spyOn(proxyConfigsTable, 'getByName') + getByNameSpy.mockResolvedValue(proxyConfig) + await expect(proxyConfigsTable.update(proxyConfig)).rejects.toBeInstanceOf(RPSError) + }) + test('should NOT update when unexpected error', async () => { + querySpy.mockRejectedValueOnce('unknown') + const getByNameSpy = spyOn(proxyConfigsTable, 'getByName') + getByNameSpy.mockResolvedValue(proxyConfig) + await expect(proxyConfigsTable.update(proxyConfig)).rejects.toThrow( + NETWORK_CONFIG_ERROR('Proxy', proxyConfig.accessInfo) + ) + }) + + test('should NOT update when concurrency issue', async () => { + querySpy.mockResolvedValueOnce({ rows: [], rowCount: 0 }) + const getByNameSpy = spyOn(proxyConfigsTable, 'getByName') + getByNameSpy.mockResolvedValue(proxyConfig) + await expect(proxyConfigsTable.update(proxyConfig)).rejects.toThrow(CONCURRENCY_MESSAGE) + expect(getByNameSpy).toHaveBeenCalledWith(proxyConfig.accessInfo, proxyConfig.tenantId) + expect(querySpy).toBeCalledTimes(1) + expect(querySpy).toBeCalledWith( + ` + UPDATE proxyconfigs + SET info_format=$2, port=$3, network_dns_suffix=$4 + WHERE access_info=$1 and tenant_id = $5`, + [ + proxyConfig.accessInfo, + proxyConfig.infoFormat, + proxyConfig.port, + proxyConfig.networkDnsSuffix, + proxyConfig.tenantId + ] + ) + }) + }) +}) diff --git a/src/data/postgres/tables/proxyConfigs.ts b/src/data/postgres/tables/proxyConfigs.ts new file mode 100644 index 000000000..6cb863c1a --- /dev/null +++ b/src/data/postgres/tables/proxyConfigs.ts @@ -0,0 +1,234 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2025 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import { type ProxyConfig } from '../../../models/RCS.Config.js' +import { type IProxyConfigsTable } from '../../../interfaces/database/IProxyConfigsDB.js' +import { + API_UNEXPECTED_EXCEPTION, + CONCURRENCY_EXCEPTION, + CONCURRENCY_MESSAGE, + DEFAULT_SKIP, + DEFAULT_TOP, + NETWORK_CONFIG_DELETION_FAILED_CONSTRAINT, + NETWORK_CONFIG_ERROR, + NETWORK_CONFIG_INSERTION_FAILED_DUPLICATE +} from '../../../utils/constants.js' +import { RPSError } from '../../../utils/RPSError.js' +import Logger from '../../../Logger.js' +import type PostgresDb from '../index.js' +import { PostgresErr } from '../errors.js' + +export class ProxyConfigsTable implements IProxyConfigsTable { + db: PostgresDb + log: Logger + constructor(db: PostgresDb) { + this.db = db + this.log = new Logger('ProxyConfigsDb') + } + + /** + * @description Get count of all proxies from DB + * @returns {number} + */ + async getCount(tenantId = ''): Promise { + const result = await this.db.query<{ total_count: number }>( + ` + SELECT count(*) OVER() AS total_count + FROM proxyconfigs + WHERE tenant_id = $1`, + [tenantId] + ) + let count = 0 + if (result?.rows?.length > 0) { + count = Number(result.rows[0].total_count) + } + return count + } + + /** + * @description Get all proxies profiles from DB + * @param {number} top + * @param {number} skip + * @returns {ProxyConfig []} returns an array of ProxyConfig objects + */ + async get(top: number = DEFAULT_TOP, skip: number = DEFAULT_SKIP, tenantId = ''): Promise { + const results = await this.db.query( + ` + SELECT + access_info as "accessInfo", + info_format as "infoFormat", + port as "port", + network_dns_suffix as "networkDnsSuffix", + tenant_id as "tenantId" + FROM proxyconfigs + WHERE tenant_id = $3 + ORDER BY access_info + LIMIT $1 OFFSET $2`, + [ + top, + skip, + tenantId + ] + ) + return results.rows + } + + /** + * @description Get proxy profile from DB by name + * @param {string} accessInfo + * @returns {ProxyConfig} ProxyConfig object + */ + async getByName(accessInfo: string, tenantId = ''): Promise { + const results = await this.db.query( + ` + SELECT + access_info as "accessInfo", + info_format as "infoFormat", + port as "port", + network_dns_suffix as "networkDnsSuffix", + tenant_id as "tenantId" + FROM proxyconfigs + WHERE access_info = $1 and tenant_id = $2`, + [accessInfo, tenantId] + ) + + if ((results?.rowCount ?? 0) > 0) { + return results.rows[0] + } + + return null + } + + /** + * @description Check proxy profile exists in DB by name + * @param {string} accessInfo + * @returns {string[]} + */ + async checkProfileExits(accessInfo: string, tenantId = ''): Promise { + const results = await this.db.query( + ` + SELECT 1 + FROM proxyconfigs + WHERE access_info = $1 and tenant_id = $2`, + [accessInfo, tenantId] + ) + + if ((results?.rowCount ?? 0) > 0) { + return true + } + + return false + } + + /** + * @description Delete proxy profile from DB by name + * @param {string} accessInfo + * @returns {boolean} Return true on successful deletion + */ + async delete(accessInfo: string, tenantId = ''): Promise { + const profiles = await this.db.query( + ` + SELECT 1 + FROM profiles_proxyconfigs + WHERE access_info = $1 and tenant_id = $2`, + [accessInfo, tenantId] + ) + if ((profiles?.rowCount ?? 0) > 0) { + throw new RPSError(NETWORK_CONFIG_DELETION_FAILED_CONSTRAINT('Proxy', accessInfo), 'Foreign key violation') + } + try { + const results = await this.db.query( + ` + DELETE + FROM proxyconfigs + WHERE access_info = $1 and tenant_id = $2`, + [accessInfo, tenantId] + ) + if (results?.rowCount) { + return results.rowCount > 0 + } + } catch (error) { + this.log.error(`Failed to delete proxy configuration : ${accessInfo}`, error) + if (error.code === PostgresErr.C23_FOREIGN_KEY_VIOLATION) { + throw new RPSError(NETWORK_CONFIG_DELETION_FAILED_CONSTRAINT('Proxy', accessInfo)) + } + throw new RPSError(API_UNEXPECTED_EXCEPTION(`Delete proxy configuration : ${accessInfo}`)) + } + return false + } + + /** + * @description Insert proxy profile into DB + * @param {ProxyConfig} proxyConfig + * @returns {ProxyConfig} Returns ProxyConfig object + */ + async insert(proxyConfig: ProxyConfig): Promise { + try { + const date = new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '') + const results = await this.db.query( + ` + INSERT INTO proxyconfigs + (access_info, info_format, port, network_dns_suffix, creation_date, tenant_id) + values($1, $2, $3, $4, $5, $6)`, + [ + proxyConfig.accessInfo, + proxyConfig.infoFormat, + proxyConfig.port, + proxyConfig.networkDnsSuffix, + date, + proxyConfig.tenantId + ] + ) + + if ((results?.rowCount ?? 0) > 0) { + const config = await this.getByName(proxyConfig.accessInfo, proxyConfig.tenantId) + return config + } + } catch (error) { + if (error.code === PostgresErr.C23_UNIQUE_VIOLATION) { + throw new RPSError( + NETWORK_CONFIG_INSERTION_FAILED_DUPLICATE('Proxy', proxyConfig.accessInfo), + 'Unique key violation' + ) + } + throw new RPSError(NETWORK_CONFIG_ERROR('Proxy', proxyConfig.accessInfo)) + } + return null + } + + /** + * @description Update proxy profile into DB + * @param {ProxyConfig} proxyConfig + * @returns {boolean} Returns ProxyConfig object + */ + async update(proxyConfig: ProxyConfig): Promise { + let latestItem: ProxyConfig | null + + try { + const results = await this.db.query( + ` + UPDATE proxyconfigs + SET info_format=$2, port=$3, network_dns_suffix=$4 + WHERE access_info=$1 and tenant_id = $5`, + [ + proxyConfig.accessInfo, + proxyConfig.infoFormat, + proxyConfig.port, + proxyConfig.networkDnsSuffix, + proxyConfig.tenantId + ] + ) + + latestItem = await this.getByName(proxyConfig.accessInfo, proxyConfig.tenantId) + if ((results?.rowCount ?? 0) > 0) { + return latestItem + } + } catch (error) { + throw new RPSError(NETWORK_CONFIG_ERROR('Proxy', proxyConfig.accessInfo)) + } + // making assumption that if no records are updated, that it is due to concurrency. We've already checked for if it doesn't exist before calling update. + throw new RPSError(CONCURRENCY_MESSAGE, CONCURRENCY_EXCEPTION, latestItem) + } +} diff --git a/src/interfaces/database/IDb.ts b/src/interfaces/database/IDb.ts index ee44c1269..1e2b1b31d 100644 --- a/src/interfaces/database/IDb.ts +++ b/src/interfaces/database/IDb.ts @@ -9,6 +9,8 @@ import { type IIEEE8021xProfileTable } from './IIEEE8021xProfilesDB.js' import { type IProfilesTable } from './IProfilesDb.js' import { type IProfilesWifiConfigsTable } from './IProfileWifiConfigsDb.js' import { type IWirelessProfilesTable } from './IWirelessProfilesDB.js' +import { type IProfileProxyConfigsTable } from './IProfileProxyConfigsDb.js' +import { type IProxyConfigsTable } from './IProxyConfigsDB.js' export interface IDB { ciraConfigs: ICiraConfigTable @@ -17,5 +19,8 @@ export interface IDB { wirelessProfiles: IWirelessProfilesTable profileWirelessConfigs: IProfilesWifiConfigsTable ieee8021xProfiles: IIEEE8021xProfileTable + proxyConfigs: IProxyConfigsTable + profileProxyConfigs: IProfileProxyConfigsTable + query: (text: string, params?: any) => Promise } diff --git a/src/interfaces/database/IProfileProxyConfigsDb.ts b/src/interfaces/database/IProfileProxyConfigsDb.ts new file mode 100644 index 000000000..c0752cacd --- /dev/null +++ b/src/interfaces/database/IProfileProxyConfigsDb.ts @@ -0,0 +1,16 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import { type ProfileProxyConfigs } from '../../models/RCS.Config.js' + +export interface IProfileProxyConfigsTable { + getProfileProxyConfigs: (profileName: string) => Promise + deleteProfileProxyConfigs: (profileName: string, tenantId: string) => Promise + createProfileProxyConfigs: ( + proxyConfigs: ProfileProxyConfigs[], + profileName: string, + tenantId?: string + ) => Promise +} diff --git a/src/interfaces/database/IProxyConfigsDB.ts b/src/interfaces/database/IProxyConfigsDB.ts new file mode 100644 index 000000000..f35f1d706 --- /dev/null +++ b/src/interfaces/database/IProxyConfigsDB.ts @@ -0,0 +1,11 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import { type ProxyConfig } from '../../models/RCS.Config.js' +import { type ITable } from './ITable.js' + +export interface IProxyConfigsTable extends ITable { + checkProfileExits: (configName: string, tenantId?: string) => Promise +} diff --git a/src/models/RCS.Config.ts b/src/models/RCS.Config.ts index bf976ae6a..e21822263 100644 --- a/src/models/RCS.Config.ts +++ b/src/models/RCS.Config.ts @@ -301,3 +301,17 @@ export interface connectionParams { consoleNonce?: string digestChallenge?: DigestChallenge } + +export interface ProxyConfig { + accessInfo: string // A string holding the IP address or FQDN of the server + infoFormat: AMT.Types.MPServer.InfoFormat // An enumerated integer describing the format and interpretation of the AccessInfo property (IPv4 (3), IPv6 (4), FQDN (201)) + port: number + networkDnsSuffix: string // Domain name of the network to which this proxy belongs + tenantId: string +} + +export interface ProfileProxyConfigs { + priority: number + configName: string + tenantId: string +} diff --git a/src/models/index.ts b/src/models/index.ts index b5e7c08c4..20f062f30 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -9,7 +9,8 @@ import { type CIRAConfig, type ProfileWifiConfigs, type TlsMode, - type TlsSigningAuthority + type TlsSigningAuthority, + type ProfileProxyConfigs } from './RCS.Config.js' // guid: string, name: string, mpsuser: string, mpspass: string, amtuser: string, amtpassword: string, mebxpass: string) { @@ -155,6 +156,7 @@ export class AMTConfiguration { ipSyncEnabled?: boolean localWifiSyncEnabled?: boolean wifiConfigs?: ProfileWifiConfigs[] | null + proxyConfigs?: ProfileProxyConfigs[] | null tenantId: string tlsMode?: TlsMode tlsCerts?: TLSCerts diff --git a/src/routes/admin/index.ts b/src/routes/admin/index.ts index e15d2d628..5afa318db 100644 --- a/src/routes/admin/index.ts +++ b/src/routes/admin/index.ts @@ -11,6 +11,7 @@ import version from './version/index.js' import wirelessconfigs from './wireless/index.js' import health from './health/index.js' import ieee8021x from './ieee8021x/index.js' +import proxyconfigs from './proxy/index.js' const adminRouter: Router = Router() @@ -21,6 +22,7 @@ adminRouter.use('/wirelessconfigs', wirelessconfigs) adminRouter.use('/version', version) adminRouter.use('/health', health) adminRouter.use('/ieee8021xconfigs', ieee8021x) +adminRouter.use('/proxyconfigs', proxyconfigs) adminRouter.get('/', (req: Request, res: Response) => { res.status(200).json({ message: 'admin path. use admin/profiles' }) }) diff --git a/src/routes/admin/profiles/amtProfileValidator.ts b/src/routes/admin/profiles/amtProfileValidator.ts index 0850b7b04..8732cf9ed 100644 --- a/src/routes/admin/profiles/amtProfileValidator.ts +++ b/src/routes/admin/profiles/amtProfileValidator.ts @@ -138,6 +138,23 @@ export const amtProfileValidator = (): ValidationChain[] => [ throw new Error(`wifi configs ${wifiConfigs.toString()} does not exists in db`) } }), + check('proxyConfigs') + .optional({ nullable: true }) + .isArray() + .custom(async (value, { req }) => { + if (value.length > 15) { + throw new Error('A maximum of 15 proxy profiles can be stored at a time.') + } + for (const config of value) { + if (Number.isInteger(config.priority) && (config.priority < 1 || config.priority > 255)) { + throw new Error('proxy config priority should be an integer and between 1 and 255') + } + } + const proxyConfigs = await validateProxyConfigs(value, req as Request) + if (proxyConfigs.length > 0) { + throw new Error(`proxy configs ${proxyConfigs.toString()} does not exists in db`) + } + }), check('ieee8021xProfileName') .optional({ nullable: true }) .custom(async (value, { req }) => { @@ -181,6 +198,17 @@ const validatewifiConfigs = async (value: any, req: Request): Promise return wifiConfigNames } +const validateProxyConfigs = async (value: any, req: Request): Promise => { + const proxyConfigNames: string[] = [] + for (const config of value) { + const isProxyExist = await req.db.proxyConfigs.checkProfileExits(config.configName, req.tenantId) + if (!isProxyExist) { + proxyConfigNames.push(config.configName) + } + } + return proxyConfigNames +} + const validateIEEE8021xConfigs = async (value: any, req: Request): Promise => { const isProfileExist = await req.db.ieee8021xProfiles.checkProfileExits(value, req.tenantId) if (!isProfileExist) { @@ -323,6 +351,23 @@ export const profileUpdateValidator = (): any => [ throw new Error(`wifi configs ${wifiConfigs.toString()} does not exists in db`) } }), + check('proxyConfigs') + .optional({ nullable: true }) + .isArray() + .custom(async (value, { req }) => { + if (value.length > 15) { + throw new Error('A maximum of 15 proxy profiles can be stored at a time.') + } + for (const config of value) { + if (Number.isInteger(config.priority) && (config.priority < 1 || config.priority > 255)) { + throw new Error('proxy config priority should be an integer and between 1 and 255') + } + } + const proxyConfigs = await validateProxyConfigs(value, req as Request) + if (proxyConfigs.length > 0) { + throw new Error(`proxy configs ${proxyConfigs.toString()} does not exists in db`) + } + }), check('ieee8021xProfileName') .optional({ nullable: true }) .custom(async (value, { req }) => { diff --git a/src/routes/admin/proxy/all.test.ts b/src/routes/admin/proxy/all.test.ts new file mode 100644 index 000000000..02283ef08 --- /dev/null +++ b/src/routes/admin/proxy/all.test.ts @@ -0,0 +1,67 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import { createSpyObj } from '../../../test/helper/jest.js' +import { allProxyProfiles } from './all.js' +import { jest } from '@jest/globals' +import { spyOn } from 'jest-mock' + +describe('Proxy - All', () => { + let resSpy + let req + beforeEach(() => { + resSpy = createSpyObj('Response', [ + 'status', + 'json', + 'end', + 'send' + ]) + req = { + db: { + proxyConfigs: { + get: jest.fn<() => Promise>().mockImplementation(async () => await Promise.resolve([])), + getCount: jest.fn<() => Promise>().mockImplementation(async () => await Promise.resolve(123)) + } + }, + query: {} + } + resSpy.status.mockReturnThis() + resSpy.json.mockReturnThis() + resSpy.send.mockReturnThis() + }) + + it('should get all', async () => { + await allProxyProfiles(req, resSpy) + expect(req.db.proxyConfigs.get).toHaveBeenCalled() + expect(resSpy.status).toHaveBeenCalledWith(200) + }) + + it('should get all with proxy configs length > 0', async () => { + req.query.$count = true + spyOn(req.db.proxyConfigs, 'get').mockResolvedValue(['abc']) + await allProxyProfiles(req, resSpy) + expect(req.db.proxyConfigs.get).toHaveBeenCalled() + expect(resSpy.status).toHaveBeenCalledWith(200) + }) + + it('should get all with req.query.$count as true', async () => { + req.query.$count = true + await allProxyProfiles(req, resSpy) + expect(req.db.proxyConfigs.get).toHaveBeenCalled() + expect(req.db.proxyConfigs.getCount).toHaveBeenCalled() + expect(resSpy.status).toHaveBeenCalledWith(200) + }) + + it('should set status to 500 if error occurs', async () => { + req.db.proxyConfigs.getCount = jest.fn().mockImplementation(() => { + throw new TypeError('fake error') + }) + req.query.$count = true + await allProxyProfiles(req, resSpy) + expect(req.db.proxyConfigs.get).toHaveBeenCalled() + expect(req.db.proxyConfigs.getCount).toHaveBeenCalled() + expect(resSpy.status).toHaveBeenCalledWith(500) + }) +}) diff --git a/src/routes/admin/proxy/all.ts b/src/routes/admin/proxy/all.ts new file mode 100644 index 000000000..410a5d2c3 --- /dev/null +++ b/src/routes/admin/proxy/all.ts @@ -0,0 +1,35 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import Logger from '../../../Logger.js' +import { type ProxyConfig } from '../../../models/RCS.Config.js' +import { API_RESPONSE } from '../../../utils/constants.js' +import { type DataWithCount } from '../../../models/index.js' +import { MqttProvider } from '../../../utils/MqttProvider.js' +import { type Request, type Response } from 'express' +import handleError from '../../../utils/handleError.js' + +export async function allProxyProfiles(req: Request, res: Response): Promise { + const log = new Logger('allProfiles') + const top = Number(req.query.$top) + const skip = Number(req.query.$skip) + const includeCount = req.query.$count + try { + const proxyConfigs: ProxyConfig[] = await req.db.proxyConfigs.get(top, skip, req.tenantId) + if (includeCount == null || includeCount === 'false') { + res.status(200).json(API_RESPONSE(proxyConfigs)).end() + } else { + const count: number = await req.db.proxyConfigs.getCount(req.tenantId) + const dataWithCount: DataWithCount = { + data: proxyConfigs, + totalCount: count + } + res.status(200).json(API_RESPONSE(dataWithCount)).end() + } + MqttProvider.publishEvent('success', ['allProxyConfigs'], 'Sent proxy configs') + } catch (error) { + handleError(log, '', req, res, error) + } +} diff --git a/src/routes/admin/proxy/create.test.ts b/src/routes/admin/proxy/create.test.ts new file mode 100644 index 000000000..e59dd3393 --- /dev/null +++ b/src/routes/admin/proxy/create.test.ts @@ -0,0 +1,44 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2025 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import { createSpyObj } from '../../../test/helper/jest.js' +import { createProxyProfile } from './create.js' +import { jest } from '@jest/globals' +import { type SpyInstance, spyOn } from 'jest-mock' + +describe('Proxy - Create', () => { + let resSpy + let req + let insertSpy: SpyInstance + + beforeEach(() => { + resSpy = createSpyObj('Response', [ + 'status', + 'json', + 'end', + 'send' + ]) + req = { + db: { proxyConfigs: { insert: jest.fn() } }, + body: {}, + query: {} + } + insertSpy = spyOn(req.db.proxyConfigs, 'insert').mockResolvedValue({}) + resSpy.status.mockReturnThis() + resSpy.json.mockReturnThis() + resSpy.send.mockReturnThis() + }) + it('should create', async () => { + await createProxyProfile(req, resSpy) + expect(insertSpy).toHaveBeenCalledTimes(1) + expect(resSpy.status).toHaveBeenCalledWith(201) + }) + it('should handle error', async () => { + spyOn(req.db.proxyConfigs, 'insert').mockRejectedValue(null) + await createProxyProfile(req, resSpy) + expect(insertSpy).toHaveBeenCalledTimes(1) + expect(resSpy.status).toHaveBeenCalledWith(500) + }) +}) diff --git a/src/routes/admin/proxy/create.ts b/src/routes/admin/proxy/create.ts new file mode 100644 index 000000000..146db4846 --- /dev/null +++ b/src/routes/admin/proxy/create.ts @@ -0,0 +1,23 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import { type ProxyConfig } from '../../../models/RCS.Config.js' +import Logger from '../../../Logger.js' +import { MqttProvider } from '../../../utils/MqttProvider.js' +import { type Request, type Response } from 'express' +import handleError from '../../../utils/handleError.js' +export async function createProxyProfile(req: Request, res: Response): Promise { + const proxyConfig: ProxyConfig = req.body + proxyConfig.tenantId = req.tenantId || '' + const log = new Logger('createProxyProfile') + try { + const results: ProxyConfig | null = await req.db.proxyConfigs.insert(proxyConfig) + log.verbose(`Created proxy config: ${proxyConfig.accessInfo}`) + MqttProvider.publishEvent('success', ['createProxyConfigs'], `Created proxy config: ${proxyConfig.accessInfo}`) + res.status(201).json(results).end() + } catch (error) { + handleError(log, 'proxyConfig.accessInfo', req, res, error) + } +} diff --git a/src/routes/admin/proxy/index.ts b/src/routes/admin/proxy/index.ts new file mode 100644 index 000000000..1251fcd6c --- /dev/null +++ b/src/routes/admin/proxy/index.ts @@ -0,0 +1,17 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2025 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import { Router } from 'express' +import validateMiddleware from '../../../middleware/validate.js' +import { odataValidator } from '../odataValidator.js' +import { allProxyProfiles } from './all.js' +import { createProxyProfile } from './create.js' +import { proxyValidator } from './proxyValidator.js' + +const profileRouter: Router = Router() + +profileRouter.get('/', odataValidator(), validateMiddleware, allProxyProfiles) +profileRouter.post('/', proxyValidator(), validateMiddleware, createProxyProfile) +export default profileRouter diff --git a/src/routes/admin/proxy/proxyValidator.ts b/src/routes/admin/proxy/proxyValidator.ts new file mode 100644 index 000000000..9156a9c83 --- /dev/null +++ b/src/routes/admin/proxy/proxyValidator.ts @@ -0,0 +1,71 @@ +/********************************************************************* + * Copyright (c) Intel Corporation 2022 + * SPDX-License-Identifier: Apache-2.0 + **********************************************************************/ + +import { check } from 'express-validator' + +const ipv4 = + '^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$' +const ipv6 = + '^((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4}))*::((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4}))*|((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4})){7}$' +const fqdn = '^(?=.{1,254}$)((?=[a-z0-9-]{1,63}\\.)(xn--+)?[a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,63}$' + +export const proxyValidator = (): any => [ + check('accessInfo') + .not() + .isEmpty() + .withMessage('Server address is required') + .custom((value, { req }) => { + if (accessInfoFormatValidator(value, req)) { + return true + } + return false + }), + check('infoFormat') + .not() + .isEmpty() + .withMessage('Server address format is required') + .isIn([ + 3, + 4, + 201 + ]) + .withMessage('Server address format should be either 3(IPV4), 4(IPV6) or 201(FQDN)'), + check('port') + .not() + .isEmpty() + .withMessage('Port is required') + .isInt({ min: 0, max: 65535 }) + .withMessage('Port value should range between 0 and 65535'), + check('networkDnsSuffix') + .not() + .isEmpty() + .withMessage('Domain name of the network is required') + .matches('^(?=.{1,192}$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z]{2,})+$') + .withMessage('Domain name of the network should contain alphanumeric and hyphens in the middle') + .isLength({ max: 192 }) + .withMessage('Domain name of the network maximum length is 192') +] + +function accessInfoFormatValidator(value, req): boolean { + if (req.body.infoFormat == null) { + throw new Error('accessInfo is required') + } + if (value != null) { + if (req.body.infoFormat === 3) { + if (!value.match(ipv4)) { + throw new Error('infoFormat 3 requires IPV4 server address') + } + } else if (req.body.infoFormat === 4) { + if (!value.match(ipv6)) { + throw new Error('infoFormat 4 requires IPV6 server address') + } + } else if (req.body.infoFormat === 201) { + if (!value.match(fqdn)) { + throw new Error('infoFormat 201 requires FQDN server address') + } + } + } + return true +} diff --git a/src/test/collections/rps.postman_collection.json b/src/test/collections/rps.postman_collection.json index 9f0eecf6a..b6e449377 100644 --- a/src/test/collections/rps.postman_collection.json +++ b/src/test/collections/rps.postman_collection.json @@ -1,9 +1,9 @@ { "info": { - "_postman_id": "b2d7b182-11c6-409a-a84f-6cc3d3dd7f9a", + "_postman_id": "b08b48b6-9b34-4497-9929-f070c6cbe104", "name": "RPS API Tests", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "30575654" + "_exporter_id": "35155358" }, "item": [ { @@ -150,8 +150,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -257,8 +257,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -304,8 +304,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -354,8 +354,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -404,8 +404,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -457,8 +457,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -511,8 +511,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -561,8 +561,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1053,8 +1053,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1103,8 +1103,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1153,13 +1153,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "If-Match", - "type": "text", - "value": "123" + "value": "123", + "type": "text" } ], "body": { @@ -1202,8 +1202,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1253,8 +1253,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1304,8 +1304,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1397,8 +1397,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1447,8 +1447,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1492,8 +1492,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1581,8 +1581,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -1636,8 +1636,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "Cache-Control", @@ -1701,8 +1701,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -1748,8 +1748,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1802,8 +1802,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1852,8 +1852,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1902,8 +1902,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -1952,8 +1952,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2002,8 +2002,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2052,8 +2052,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2102,8 +2102,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2158,8 +2158,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2216,8 +2216,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2270,8 +2270,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2320,8 +2320,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2370,8 +2370,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2420,8 +2420,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2474,8 +2474,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2524,8 +2524,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2574,8 +2574,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2635,8 +2635,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2684,8 +2684,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2741,8 +2741,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -2788,8 +2788,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -2849,8 +2849,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -2918,8 +2918,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -2987,8 +2987,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -3058,8 +3058,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -3113,8 +3113,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3170,8 +3170,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3215,8 +3215,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3266,8 +3266,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3316,8 +3316,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3366,8 +3366,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3416,8 +3416,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3466,8 +3466,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3516,8 +3516,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3567,8 +3567,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3629,8 +3629,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3685,8 +3685,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3741,13 +3741,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "If-Match", - "type": "text", - "value": "123" + "value": "123", + "type": "text" } ], "body": { @@ -3808,8 +3808,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3870,8 +3870,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3915,8 +3915,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -3965,8 +3965,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -4014,8 +4014,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -4088,8 +4088,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -4134,8 +4134,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -4242,8 +4242,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -4297,8 +4297,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -4349,8 +4349,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -4400,8 +4400,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -4451,8 +4451,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -4712,8 +4712,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -5188,8 +5188,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -5245,13 +5245,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "Cache-Control", - "type": "text", - "value": "max-age" + "value": "max-age", + "type": "text" }, { "key": "If-None-Match", @@ -5317,8 +5317,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -5376,8 +5376,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -5434,8 +5434,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "url": { @@ -5489,8 +5489,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -5540,8 +5540,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -5591,8 +5591,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -5713,8 +5713,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -5765,8 +5765,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -5817,8 +5817,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -5885,8 +5885,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -5934,13 +5934,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "If-Match", - "type": "text", "value": "123", + "type": "text", "disabled": true }, { @@ -6005,8 +6005,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6065,8 +6065,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6124,8 +6124,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6175,8 +6175,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6230,8 +6230,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6286,8 +6286,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6342,8 +6342,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6396,8 +6396,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6450,8 +6450,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6504,8 +6504,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6557,8 +6557,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6610,13 +6610,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "If-Match", - "type": "text", - "value": "123" + "value": "123", + "type": "text" } ], "body": { @@ -6660,8 +6660,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6705,13 +6705,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -6756,8 +6756,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6801,8 +6801,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6851,8 +6851,8 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" } ], "body": { @@ -6919,13 +6919,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -6974,13 +6974,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -7038,13 +7038,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -7097,13 +7097,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -7154,13 +7154,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -7220,13 +7220,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -7282,13 +7282,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -7344,13 +7344,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "If-Match", - "type": "text", - "value": "123" + "value": "123", + "type": "text" } ], "body": { @@ -7402,13 +7402,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -7454,13 +7454,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -7506,13 +7506,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -7558,13 +7558,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -8904,13 +8904,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -8955,13 +8955,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -9006,13 +9006,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", "value": "APIKEYFORRPS123!", + "type": "text", "disabled": true } ], @@ -9145,39 +9145,50 @@ ] }, { - "name": "AMT Profiles w/ 8021x Profiles", + "name": "AMT Profiles w/ Proxy Profiles", "item": [ { - "name": "Create wired 8021x Profile", + "name": "Create Proxy (proxy-abc)", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", "pm.test(\"Status code is 201\", function () {\r", " pm.response.to.have.status(201);\r", "});\r", - "pm.test(\"Request should return profile just created\", function () {\r", - " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", - " pm.expect(jsonData.profileName).to.eql(profile);\r", - " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", - " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", - " pm.expect(jsonData.wiredInterface).to.eql(true);\r", + "pm.test(\"Creation should succeed\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.accessInfo).to.eql(\"www.proxy-abc.com\");\r", + " pm.expect(jsonData.infoFormat).to.eql(201);\r", + " pm.expect(jsonData.port).to.eql(900);\r", + " pm.expect(jsonData.networkDnsSuffix).to.eql(\"intel.com\");\r", + " pm.expect(jsonData.tenantId).to.eql(\"\");\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "method": "POST", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-RPS-API-Key", + "value": "APIKEYFORRPS123!", + "type": "text", + "disabled": true + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", + "raw": "{\r\n \"accessInfo\": \"www.proxy-abc.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -9185,7 +9196,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9194,43 +9205,53 @@ "api", "v1", "admin", - "ieee8021xconfigs", - "" + "proxyconfigs" ] } }, "response": [] }, { - "name": "Create 2nd wired 8021x Profile", + "name": "Create Proxy (proxy-abc.test)", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", "pm.test(\"Status code is 201\", function () {\r", " pm.response.to.have.status(201);\r", "});\r", - "pm.test(\"Request should return profile just created\", function () {\r", - " pm.expect(jsonData.profileName).to.eql(\"extraProf\");\r", - " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", - " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", - " pm.expect(jsonData.wiredInterface).to.eql(true);\r", + "pm.test(\"Request should return proxy just created\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.accessInfo).to.eql(\"www.proxy-abc.test.com\");\r", + " pm.expect(jsonData.infoFormat).to.eql(201);\r", + " pm.expect(jsonData.port).to.eql(800);\r", + " pm.expect(jsonData.networkDnsSuffix).to.eql(\"intel.com\");\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "method": "POST", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-RPS-API-Key", + "value": "APIKEYFORRPS123!", + "type": "text", + "disabled": true + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"extraProf\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", + "raw": "{\r\n \"accessInfo\": \"www.proxy-abc.test.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 800,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -9238,7 +9259,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9247,44 +9268,51 @@ "api", "v1", "admin", - "ieee8021xconfigs", - "" + "proxyconfigs" ] } }, "response": [] }, { - "name": "Create wireless 8021x Profile", + "name": "Create Profile with Proxy that doesn't exist", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", - "pm.test(\"Status code is 201\", function () {\r", - " pm.response.to.have.status(201);\r", + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", "});\r", - "pm.test(\"Request should return profile just created\", function () {\r", - " var profile = pm.environment.get(\"ieee8021xProfileWireless\")\r", - " pm.expect(jsonData.profileName).to.eql(profile);\r", - " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", - " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", - " pm.expect(jsonData.wiredInterface).to.eql(false);\r", + "pm.test(\"Creation should fail\", function () {\r", + " var result = pm.response.json();\r", + " pm.expect(result.errors[0].msg).to.eql(\"proxy configs proxy does not exists in db\"),\r", + " pm.expect(result.errors[0].path).to.eql(\"proxyConfigs\")\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "method": "POST", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-RPS-API-Key", + "value": "APIKEYFORRPS123!", + "type": "text", + "disabled": true + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWireless}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": false\r\n}", + "raw": "{\r\n \"profileName\": \"wifi-profile\",\r\n \"amtPassword\": \"Intel123!\",\r\n \"mebxPassword\": \"Intel123!\",\r\n \"activation\": \"ccmactivate\",\r\n \"tags\": [\"tag1\"],\r\n \"dhcpEnabled\": true,\r\n \"proxyConfigs\": [\r\n {\r\n \"priority\": 1,\r\n \"configName\": \"proxy\"\r\n }\r\n ]\r\n}", "options": { "raw": { "language": "json" @@ -9292,7 +9320,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/profiles/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9301,7 +9329,7 @@ "api", "v1", "admin", - "ieee8021xconfigs", + "profiles", "" ] } @@ -9309,89 +9337,53 @@ "response": [] }, { - "name": "Create Profile w/ wrong interface 8021x Profile", + "name": "Create AMT Profile", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", - "pm.test(\"Status code is 400\", function () {\r", - " pm.response.to.have.status(400);\r", + "pm.test(\"Status code is 201\", function () {\r", + " pm.response.to.have.status(201);\r", "});\r", - "\r", - "pm.test(\"Request should return 8021x profile is for wireless interfaces\", function () {\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Ieee8021x profile \" + pm.environment.get(\"ieee8021xProfileWireless\") + \" is for wireless interfaces\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", - " pm.expect(jsonData.errors[0].value).to.eql(pm.environment.get(\"ieee8021xProfileWireless\"));\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"profileName\": \"test8021x\",\r\n \"activation\": \"ccmactivate\",\r\n \"tags\": [\"tag1\"],\r\n \"dhcpEnabled\": false,\r\n \"generateRandomPassword\": true,\r\n \"generateRandomMEBxPassword\": true,\r\n \"ciraConfigName\": null,\r\n \"ieee8021xProfileName\": \"{{ieee8021xProfileWireless}}\",\r\n \"tlsMode\": null\r\n}\r\n", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/profiles/", - "protocol": "{{protocol}}", - "host": [ - "{{host}}" - ], - "path": [ - "api", - "v1", - "admin", - "profiles", - "" - ] - } - }, - "response": [] - }, - { - "name": "Create Profile w/ nonexistent 8021x Profile", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "var profName = pm.environment.get(\"badProf\")\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", - "pm.test(\"Status code is 400\", function () {\r", - " pm.response.to.have.status(400);\r", - "});\r", - "\r", - "pm.test(\"Request should return 8021x profile can not be specified\", function () {\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Ieee8021x profile \" + profName + \" does not exist in db\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", - " pm.expect(jsonData.errors[0].value).to.eql(profName);\r", + "pm.test(\"Creation should succeed\", function () {\r", + " var result = pm.response.json();\r", + " pm.expect(result.profileName).to.eql(\"wifi-profile1\"),\r", + " pm.expect(result.amtPassword).to.eql(),\r", + " pm.expect(result.mebxPassword).to.eql(),\r", + " pm.expect(result.activation).to.eql(\"ccmactivate\")\r", + " pm.expect(result.tags.length).to.equal(1)\r", + " pm.expect(result.dhcpEnabled).to.equal(true)\r", + " pm.expect(result.proxyConfigs.length).to.equal(2)\r", + " pm.expect(result.proxyConfigs[0].priority).to.equal(1)\r", + " pm.expect(result.proxyConfigs[0].configName).to.equal(\"www.proxy-abc.com\")\r", + " pm.expect(result.proxyConfigs[1].priority).to.equal(2)\r", + " pm.expect(result.proxyConfigs[1].configName).to.equal(\"www.proxy-abc.test.com\")\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "method": "POST", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "X-RPS-API-Key", + "value": "APIKEYFORRPS123!", + "type": "text", + "disabled": true + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"test8021x\",\r\n \"activation\": \"ccmactivate\",\r\n \"tags\": [\"tag1\"],\r\n \"dhcpEnabled\": false,\r\n \"generateRandomPassword\": true,\r\n \"generateRandomMEBxPassword\": true,\r\n \"ciraConfigName\": null,\r\n \"ieee8021xProfileName\": \"{{badProf}}\",\r\n \"tlsMode\": null\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"wifi-profile1\",\r\n \"amtPassword\": \"P@ssw0rd\",\r\n \"activation\": \"ccmactivate\",\r\n \"tags\": [\"acm\"],\r\n \"dhcpEnabled\": true,\r\n \"proxyConfigs\": [\r\n {\r\n \"priority\": 1,\r\n \"configName\": \"www.proxy-abc.com\"\r\n },\r\n {\r\n \"priority\": 2,\r\n \"configName\": \"www.proxy-abc.test.com\"\r\n }\r\n ]\r\n}", "options": { "raw": { "language": "json" @@ -9416,36 +9408,30 @@ "response": [] }, { - "name": "Create Profile - CCM with 8021x", + "name": "Create AMT Profile", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", "pm.test(\"Status code is 201\", function () {\r", " pm.response.to.have.status(201);\r", "});\r", - "\r", "pm.test(\"Creation should succeed\", function () {\r", " var result = pm.response.json();\r", - " pm.expect(result.profileName).to.eql(pm.environment.get(\"ieee8021xProfileWired\")),\r", - " pm.expect(result.ciraConfigName).to.eql(null)\r", + " pm.expect(result.profileName).to.eql(\"wifi-profile2\"),\r", " pm.expect(result.amtPassword).to.eql(),\r", " pm.expect(result.mebxPassword).to.eql(),\r", " pm.expect(result.activation).to.eql(\"ccmactivate\")\r", " pm.expect(result.tags.length).to.equal(1)\r", - " pm.expect(result.userConsent).to.eql(\"All\")\r", - " pm.expect(result.iderEnabled).to.eql(false)\r", - " pm.expect(result.kvmEnabled).to.eql(true)\r", - " pm.expect(result.solEnabled).to.eql(false)\r", - "});\r", - "\r", - "" + " pm.expect(result.dhcpEnabled).to.equal(true)\r", + " pm.expect(result.proxyConfigs.length).to.equal(1)\r", + " pm.expect(result.proxyConfigs[0].priority).to.equal(1)\r", + " pm.expect(result.proxyConfigs[0].configName).to.equal(\"www.proxy-abc.com\")\r", + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -9456,11 +9442,22 @@ "key": "Content-Type", "value": "application/json", "type": "text" + }, + { + "key": "X-RPS-API-Key", + "value": "APIKEYFORRPS123!", + "type": "text", + "disabled": true } ], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"test8021x\",\r\n \"activation\": \"ccmactivate\",\r\n \"tags\": [\"tag1\"],\r\n \"dhcpEnabled\": false,\r\n \"generateRandomPassword\": true,\r\n \"generateRandomMEBxPassword\": true,\r\n \"ciraConfigName\": null,\r\n \"ieee8021xProfileName\": \"{{ieee8021xProfileWired}}\",\r\n \"tlsMode\": null\r\n}" + "raw": "{\r\n \"profileName\": \"wifi-profile2\",\r\n \"amtPassword\": \"P@ssw0rd\",\r\n \"activation\": \"ccmactivate\",\r\n \"tags\": [\"acm\"],\r\n \"dhcpEnabled\": true,\r\n \"proxyConfigs\": [\r\n {\r\n \"priority\": 1,\r\n \"configName\": \"www.proxy-abc.com\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { "raw": "{{protocol}}://{{host}}/api/v1/admin/profiles/", @@ -9480,53 +9477,49 @@ "response": [] }, { - "name": "update Profile - CCM with 8021x", + "name": "GET ALL AMT Profile", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});\r", "\r", - "pm.test(\"Creation should succeed\", function () {\r", + "pm.test(\"Result should contain two profiles\", function () {\r", " var result = pm.response.json();\r", - " pm.expect(result.profileName).to.eql(pm.environment.get(\"ieee8021xProfileWired\")),\r", - " pm.expect(result.ciraConfigName).to.eql(null)\r", - " pm.expect(result.amtPassword).to.eql(),\r", - " pm.expect(result.mebxPassword).to.eql(),\r", - " pm.expect(result.activation).to.eql(\"ccmactivate\")\r", - " pm.expect(result.tags.length).to.equal(1)\r", - " pm.expect(result.userConsent).to.eql(\"All\")\r", - " pm.expect(result.iderEnabled).to.eql(false)\r", - " pm.expect(result.kvmEnabled).to.eql(true)\r", - " pm.expect(result.solEnabled).to.eql(false)\r", - " pm.expect(result.ieee8021xProfileName).to.eql(\"extraProf\")\r", + " pm.expect(result.length).to.equal(2)\r", "});\r", "\r", - "" + "pm.test(\"Profile one\", function () {\r", + " var result = pm.response.json();\r", + " pm.expect(result[0].profileName).to.eql(\"wifi-profile1\"),\r", + " pm.expect(result[0].amtPassword).to.eql(),\r", + " pm.expect(result[0].mebxPassword).to.eql(),\r", + " pm.expect(result[0].activation).to.eql(\"ccmactivate\")\r", + " pm.expect(result[0].tags.length).to.equal(1)\r", + " pm.expect(result[0].proxyConfigs.length).to.equal(2)\r", + "});\r", + "\r", + "pm.test(\"Profile two\", function () {\r", + " var result = pm.response.json();\r", + " pm.expect(result[1].profileName).to.eql(\"wifi-profile2\"),\r", + " pm.expect(result[1].activation).to.eql(\"ccmactivate\")\r", + " pm.expect(result[1].tags.length).to.equal(1)\r", + " pm.expect(result[1].proxyConfigs.length).to.equal(1)\r", + " pm.expect(result[1].proxyConfigs[0].priority).to.equal(1)\r", + " pm.expect(result[1].proxyConfigs[0].configName).to.equal(\"www.proxy-abc.com\")\r", + "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { - "method": "PATCH", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"profileName\": \"test8021x\",\r\n \"activation\": \"ccmactivate\",\r\n \"tags\": [\"tag1\"],\r\n \"dhcpEnabled\": false,\r\n \"generateRandomPassword\": true,\r\n \"generateRandomMEBxPassword\": true,\r\n \"ciraConfigName\": null,\r\n \"ieee8021xProfileName\": \"extraProf\",\r\n \"tlsMode\": null,\r\n \"version\": {{recordVersion}}\r\n}" - }, + "method": "GET", + "header": [], "url": { "raw": "{{protocol}}://{{host}}/api/v1/admin/profiles/", "protocol": "{{protocol}}", @@ -9543,16 +9536,31 @@ } }, "response": [] - }, + } + ] + }, + { + "name": "AMT Profiles w/ 8021x Profiles", + "item": [ { - "name": "Remove Profile", + "name": "Create wired 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 204\", function () {\r", - " pm.response.to.have.status(204);\r", + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 201\", function () {\r", + " pm.response.to.have.status(201);\r", + "});\r", + "pm.test(\"Request should return profile just created\", function () {\r", + " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", + " pm.expect(jsonData.profileName).to.eql(profile);\r", + " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", + " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", + " pm.expect(jsonData.wiredInterface).to.eql(true);\r", "});" ], "type": "text/javascript" @@ -9560,20 +9568,19 @@ } ], "request": { - "method": "DELETE", - "header": [ - { - "key": "Content-Type", - "type": "text", - "value": "application/json" - } - ], + "method": "POST", + "header": [], "body": { "mode": "raw", - "raw": "" + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", + "options": { + "raw": { + "language": "json" + } + } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/profiles/test8021x", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9582,22 +9589,31 @@ "api", "v1", "admin", - "profiles", - "test8021x" + "ieee8021xconfigs", + "" ] } }, "response": [] }, { - "name": "Delete wired 8021x Profile", + "name": "Create 2nd wired 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 204\", function () {\r", - " pm.response.to.have.status(204);\r", + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 201\", function () {\r", + " pm.response.to.have.status(201);\r", + "});\r", + "pm.test(\"Request should return profile just created\", function () {\r", + " pm.expect(jsonData.profileName).to.eql(\"extraProf\");\r", + " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", + " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", + " pm.expect(jsonData.wiredInterface).to.eql(true);\r", "});" ], "type": "text/javascript" @@ -9605,10 +9621,19 @@ } ], "request": { - "method": "DELETE", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"extraProf\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWired}}", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9618,21 +9643,31 @@ "v1", "admin", "ieee8021xconfigs", - "{{ieee8021xProfileWired}}" + "" ] } }, "response": [] }, { - "name": "Delete 2nd wired 8021x Profile", + "name": "Create wireless 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 204\", function () {\r", - " pm.response.to.have.status(204);\r", + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 201\", function () {\r", + " pm.response.to.have.status(201);\r", + "});\r", + "pm.test(\"Request should return profile just created\", function () {\r", + " var profile = pm.environment.get(\"ieee8021xProfileWireless\")\r", + " pm.expect(jsonData.profileName).to.eql(profile);\r", + " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", + " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", + " pm.expect(jsonData.wiredInterface).to.eql(false);\r", "});" ], "type": "text/javascript" @@ -9640,10 +9675,19 @@ } ], "request": { - "method": "DELETE", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWireless}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": false\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/extraProf", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9653,32 +9697,50 @@ "v1", "admin", "ieee8021xconfigs", - "extraProf" + "" ] } }, "response": [] }, { - "name": "Delete wireless 8021x Profile", + "name": "Create Profile w/ wrong interface 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 204\", function () {\r", - " pm.response.to.have.status(204);\r", - "});" + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "\r", + "pm.test(\"Request should return 8021x profile is for wireless interfaces\", function () {\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Ieee8021x profile \" + pm.environment.get(\"ieee8021xProfileWireless\") + \" is for wireless interfaces\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", + " pm.expect(jsonData.errors[0].value).to.eql(pm.environment.get(\"ieee8021xProfileWireless\"));\r", + "});" ], "type": "text/javascript" } } ], "request": { - "method": "DELETE", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"test8021x\",\r\n \"activation\": \"ccmactivate\",\r\n \"tags\": [\"tag1\"],\r\n \"dhcpEnabled\": false,\r\n \"generateRandomPassword\": true,\r\n \"generateRandomMEBxPassword\": true,\r\n \"ciraConfigName\": null,\r\n \"ieee8021xProfileName\": \"{{ieee8021xProfileWireless}}\",\r\n \"tlsMode\": null\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWireless}}", + "raw": "{{protocol}}://{{host}}/api/v1/admin/profiles/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9687,37 +9749,32 @@ "api", "v1", "admin", - "ieee8021xconfigs", - "{{ieee8021xProfileWireless}}" + "profiles", + "" ] } }, "response": [] - } - ] - }, - { - "name": "WIFI Profiles w/ 8021x Profiles", - "item": [ + }, { - "name": "Create wired 8021x Profile", + "name": "Create Profile w/ nonexistent 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ "var jsonData = pm.response.json();\r", + "var profName = pm.environment.get(\"badProf\")\r", "pm.globals.set(\"recordVersion\", jsonData.version);\r", "\r", - "pm.test(\"Status code is 201\", function () {\r", - " pm.response.to.have.status(201);\r", + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", "});\r", - "pm.test(\"Request should return profile just created\", function () {\r", - " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", - " pm.expect(jsonData.profileName).to.eql(profile);\r", - " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", - " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", - " pm.expect(jsonData.wiredInterface).to.eql(true);\r", + "\r", + "pm.test(\"Request should return 8021x profile can not be specified\", function () {\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Ieee8021x profile \" + profName + \" does not exist in db\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", + " pm.expect(jsonData.errors[0].value).to.eql(profName);\r", "});" ], "type": "text/javascript" @@ -9729,7 +9786,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", + "raw": "{\r\n \"profileName\": \"test8021x\",\r\n \"activation\": \"ccmactivate\",\r\n \"tags\": [\"tag1\"],\r\n \"dhcpEnabled\": false,\r\n \"generateRandomPassword\": true,\r\n \"generateRandomMEBxPassword\": true,\r\n \"ciraConfigName\": null,\r\n \"ieee8021xProfileName\": \"{{badProf}}\",\r\n \"tlsMode\": null\r\n}\r\n", "options": { "raw": { "language": "json" @@ -9737,7 +9794,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/profiles/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9746,7 +9803,7 @@ "api", "v1", "admin", - "ieee8021xconfigs", + "profiles", "" ] } @@ -9754,7 +9811,7 @@ "response": [] }, { - "name": "Create wireless 8021x Profile Copy", + "name": "Create Profile - CCM with 8021x", "event": [ { "listen": "test", @@ -9766,13 +9823,22 @@ "pm.test(\"Status code is 201\", function () {\r", " pm.response.to.have.status(201);\r", "});\r", - "pm.test(\"Request should return profile just created\", function () {\r", - " var profile = pm.environment.get(\"ieee8021xProfileWireless\")\r", - " pm.expect(jsonData.profileName).to.eql(profile);\r", - " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", - " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", - " pm.expect(jsonData.wiredInterface).to.eql(false);\r", - "});" + "\r", + "pm.test(\"Creation should succeed\", function () {\r", + " var result = pm.response.json();\r", + " pm.expect(result.profileName).to.eql(pm.environment.get(\"ieee8021xProfileWired\")),\r", + " pm.expect(result.ciraConfigName).to.eql(null)\r", + " pm.expect(result.amtPassword).to.eql(),\r", + " pm.expect(result.mebxPassword).to.eql(),\r", + " pm.expect(result.activation).to.eql(\"ccmactivate\")\r", + " pm.expect(result.tags.length).to.equal(1)\r", + " pm.expect(result.userConsent).to.eql(\"All\")\r", + " pm.expect(result.iderEnabled).to.eql(false)\r", + " pm.expect(result.kvmEnabled).to.eql(true)\r", + " pm.expect(result.solEnabled).to.eql(false)\r", + "});\r", + "\r", + "" ], "type": "text/javascript" } @@ -9780,18 +9846,19 @@ ], "request": { "method": "POST", - "header": [], + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWireless}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": false\r\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\r\n \"profileName\": \"test8021x\",\r\n \"activation\": \"ccmactivate\",\r\n \"tags\": [\"tag1\"],\r\n \"dhcpEnabled\": false,\r\n \"generateRandomPassword\": true,\r\n \"generateRandomMEBxPassword\": true,\r\n \"ciraConfigName\": null,\r\n \"ieee8021xProfileName\": \"{{ieee8021xProfileWired}}\",\r\n \"tlsMode\": null\r\n}" }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/profiles/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9800,7 +9867,7 @@ "api", "v1", "admin", - "ieee8021xconfigs", + "profiles", "" ] } @@ -9808,7 +9875,7 @@ "response": [] }, { - "name": "Create WIFI Profile w/ missing 8021x Profile", + "name": "update Profile - CCM with 8021x", "event": [ { "listen": "test", @@ -9817,32 +9884,46 @@ "var jsonData = pm.response.json();\r", "pm.globals.set(\"recordVersion\", jsonData.version);\r", "\r", - "pm.test(\"Status code is 400\", function () {\r", - " pm.response.to.have.status(400);\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", "});\r", - "pm.test(\"Request should return 8021x profile is required\", function () {\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"ieee8021xProfileName is required\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", - "});" + "\r", + "pm.test(\"Creation should succeed\", function () {\r", + " var result = pm.response.json();\r", + " pm.expect(result.profileName).to.eql(pm.environment.get(\"ieee8021xProfileWired\")),\r", + " pm.expect(result.ciraConfigName).to.eql(null)\r", + " pm.expect(result.amtPassword).to.eql(),\r", + " pm.expect(result.mebxPassword).to.eql(),\r", + " pm.expect(result.activation).to.eql(\"ccmactivate\")\r", + " pm.expect(result.tags.length).to.equal(1)\r", + " pm.expect(result.userConsent).to.eql(\"All\")\r", + " pm.expect(result.iderEnabled).to.eql(false)\r", + " pm.expect(result.kvmEnabled).to.eql(true)\r", + " pm.expect(result.solEnabled).to.eql(false)\r", + " pm.expect(result.ieee8021xProfileName).to.eql(\"extraProf\")\r", + "});\r", + "\r", + "" ], "type": "text/javascript" } } ], "request": { - "method": "POST", - "header": [], + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 5,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", - "options": { - "raw": { - "language": "json" - } - } + "raw": "{\r\n \"profileName\": \"test8021x\",\r\n \"activation\": \"ccmactivate\",\r\n \"tags\": [\"tag1\"],\r\n \"dhcpEnabled\": false,\r\n \"generateRandomPassword\": true,\r\n \"generateRandomMEBxPassword\": true,\r\n \"ciraConfigName\": null,\r\n \"ieee8021xProfileName\": \"extraProf\",\r\n \"tlsMode\": null,\r\n \"version\": {{recordVersion}}\r\n}" }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/profiles/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9851,7 +9932,7 @@ "api", "v1", "admin", - "wirelessconfigs", + "profiles", "" ] } @@ -9859,22 +9940,14 @@ "response": [] }, { - "name": "Create WIFI Profile w/ errant 8021x Profile", + "name": "Remove Profile", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", - "pm.test(\"Status code is 400\", function () {\r", - " pm.response.to.have.status(400);\r", - "});\r", - "pm.test(\"Request should return 8021x profile can not be specified\", function () {\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"ieee8021xProfileName can not be specified with the provided authenticationMethod\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", - " pm.expect(jsonData.errors[0].value).to.eql(\"errant\");\r", + "pm.test(\"Status code is 204\", function () {\r", + " pm.response.to.have.status(204);\r", "});" ], "type": "text/javascript" @@ -9882,19 +9955,20 @@ } ], "request": { - "method": "POST", - "header": [], + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"ieee8021xProfileName\": \"errant\"\r\n}\r\n", - "options": { - "raw": { - "language": "json" - } - } + "raw": "" }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/profiles/test8021x", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9903,31 +9977,22 @@ "api", "v1", "admin", - "wirelessconfigs", - "" + "profiles", + "test8021x" ] } }, "response": [] }, { - "name": "Create WIFI Profile w/ nonexistent 8021x Profile", + "name": "Delete wired 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "var profName = pm.environment.get(\"badProf\")\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", - "pm.test(\"Status code is 400\", function () {\r", - " pm.response.to.have.status(400);\r", - "});\r", - "pm.test(\"Request should return 8021x profile can not be specified\", function () {\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Ieee8021x profile \" + profName + \" does not exist in db\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", - " pm.expect(jsonData.errors[0].value).to.eql(profName);\r", + "pm.test(\"Status code is 204\", function () {\r", + " pm.response.to.have.status(204);\r", "});" ], "type": "text/javascript" @@ -9935,19 +10000,10 @@ } ], "request": { - "method": "POST", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 5,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"ieee8021xProfileName\": \"{{badProf}}\"\r\n}\r\n", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWired}}", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -9956,30 +10012,22 @@ "api", "v1", "admin", - "wirelessconfigs", - "" + "ieee8021xconfigs", + "{{ieee8021xProfileWired}}" ] } }, "response": [] }, { - "name": "Create WIFI Profile w/ wrong interface 8021x Profile", + "name": "Delete 2nd wired 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", - "pm.test(\"Status code is 400\", function () {\r", - " pm.response.to.have.status(400);\r", - "});\r", - "pm.test(\"Request should return 8021x profile is for wired interfaces\", function () {\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Ieee8021x profile \" + pm.environment.get(\"ieee8021xProfileWired\") + \" is for wired interfaces\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", - " pm.expect(jsonData.errors[0].value).to.eql(pm.environment.get(\"ieee8021xProfileWired\"));\r", + "pm.test(\"Status code is 204\", function () {\r", + " pm.response.to.have.status(204);\r", "});" ], "type": "text/javascript" @@ -9987,19 +10035,10 @@ } ], "request": { - "method": "POST", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 5,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"ieee8021xProfileName\": \"{{ieee8021xProfileWired}}\"\r\n}\r\n", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/extraProf", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -10008,34 +10047,72 @@ "api", "v1", "admin", - "wirelessconfigs", - "" + "ieee8021xconfigs", + "extraProf" ] } }, "response": [] }, { - "name": "Create WIFI Profile w/ 8021x", + "name": "Delete wireless 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "pm.test(\"Status code is 204\", function () {\r", + " pm.response.to.have.status(204);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWireless}}", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "ieee8021xconfigs", + "{{ieee8021xProfileWireless}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "WIFI Profiles w/ 8021x Profiles", + "item": [ + { + "name": "Create wired 8021x Profile", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", "\r", "pm.test(\"Status code is 201\", function () {\r", " pm.response.to.have.status(201);\r", "});\r", "pm.test(\"Request should return profile just created\", function () {\r", - " pm.expect(jsonData.profileName).to.eql(\"P1\");\r", - " pm.expect(jsonData.authenticationMethod).to.eql(5);\r", - " pm.expect(jsonData.encryptionMethod).to.eql(4);\r", - " pm.expect(jsonData.ssid).to.eql(\"test\");\r", - " pm.expect(jsonData.linkPolicy.length).to.eql(2);\r", - " pm.expect(jsonData.linkPolicy[0]).to.eql(14);\r", - " pm.expect(jsonData.linkPolicy[1]).to.eql(16);\r", + " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", + " pm.expect(jsonData.profileName).to.eql(profile);\r", + " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", + " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", + " pm.expect(jsonData.wiredInterface).to.eql(true);\r", "});" ], "type": "text/javascript" @@ -10047,7 +10124,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 5,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"ieee8021xProfileName\": \"{{ieee8021xProfileWireless}}\"\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", "options": { "raw": { "language": "json" @@ -10055,7 +10132,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -10064,7 +10141,7 @@ "api", "v1", "admin", - "wirelessconfigs", + "ieee8021xconfigs", "" ] } @@ -10072,7 +10149,61 @@ "response": [] }, { - "name": "Update WIFI Profile w/ wrong interface 8021x Profile", + "name": "Create wireless 8021x Profile Copy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 201\", function () {\r", + " pm.response.to.have.status(201);\r", + "});\r", + "pm.test(\"Request should return profile just created\", function () {\r", + " var profile = pm.environment.get(\"ieee8021xProfileWireless\")\r", + " pm.expect(jsonData.profileName).to.eql(profile);\r", + " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", + " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", + " pm.expect(jsonData.wiredInterface).to.eql(false);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWireless}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": false\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "ieee8021xconfigs", + "" + ] + } + }, + "response": [] + }, + { + "name": "Create WIFI Profile w/ missing 8021x Profile", "event": [ { "listen": "test", @@ -10084,10 +10215,9 @@ "pm.test(\"Status code is 400\", function () {\r", " pm.response.to.have.status(400);\r", "});\r", - "pm.test(\"Request should return 8021x profile can not be specified\", function () {\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Ieee8021x profile \" + pm.environment.get(\"ieee8021xProfileWired\") + \" is for wired interfaces\");\r", + "pm.test(\"Request should return 8021x profile is required\", function () {\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"ieee8021xProfileName is required\");\r", " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", - " pm.expect(jsonData.errors[0].value).to.eql(pm.environment.get(\"ieee8021xProfileWired\"));\r", "});" ], "type": "text/javascript" @@ -10095,11 +10225,11 @@ } ], "request": { - "method": "PATCH", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 5,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"ieee8021xProfileName\": \"{{ieee8021xProfileWired}}\",\r\n \"version\": {{recordVersion}}\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 5,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", "options": { "raw": { "language": "json" @@ -10124,14 +10254,22 @@ "response": [] }, { - "name": "Delete Profile", + "name": "Create WIFI Profile w/ errant 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 204\", function () {\r", - " pm.response.to.have.status(204);\r", + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "pm.test(\"Request should return 8021x profile can not be specified\", function () {\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"ieee8021xProfileName can not be specified with the provided authenticationMethod\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", + " pm.expect(jsonData.errors[0].value).to.eql(\"errant\");\r", "});" ], "type": "text/javascript" @@ -10139,10 +10277,19 @@ } ], "request": { - "method": "DELETE", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"ieee8021xProfileName\": \"errant\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/P1", + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -10152,21 +10299,30 @@ "v1", "admin", "wirelessconfigs", - "P1" + "" ] } }, "response": [] }, { - "name": "Delete wired 8021x Profile", + "name": "Create WIFI Profile w/ nonexistent 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 204\", function () {\r", - " pm.response.to.have.status(204);\r", + "var jsonData = pm.response.json();\r", + "var profName = pm.environment.get(\"badProf\")\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "pm.test(\"Request should return 8021x profile can not be specified\", function () {\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Ieee8021x profile \" + profName + \" does not exist in db\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", + " pm.expect(jsonData.errors[0].value).to.eql(profName);\r", "});" ], "type": "text/javascript" @@ -10174,10 +10330,19 @@ } ], "request": { - "method": "DELETE", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 5,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"ieee8021xProfileName\": \"{{badProf}}\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWired}}", + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -10186,22 +10351,30 @@ "api", "v1", "admin", - "ieee8021xconfigs", - "{{ieee8021xProfileWired}}" + "wirelessconfigs", + "" ] } }, "response": [] }, { - "name": "Delete wireless 8021x Profile", + "name": "Create WIFI Profile w/ wrong interface 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 204\", function () {\r", - " pm.response.to.have.status(204);\r", + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "pm.test(\"Request should return 8021x profile is for wired interfaces\", function () {\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Ieee8021x profile \" + pm.environment.get(\"ieee8021xProfileWired\") + \" is for wired interfaces\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", + " pm.expect(jsonData.errors[0].value).to.eql(pm.environment.get(\"ieee8021xProfileWired\"));\r", "});" ], "type": "text/javascript" @@ -10209,10 +10382,19 @@ } ], "request": { - "method": "DELETE", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 5,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"ieee8021xProfileName\": \"{{ieee8021xProfileWired}}\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWireless}}", + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -10221,51 +10403,264 @@ "api", "v1", "admin", - "ieee8021xconfigs", - "{{ieee8021xProfileWireless}}" + "wirelessconfigs", + "" ] } }, "response": [] - } - ] - } - ] - }, - { - "name": "Wireless", - "item": [ - { - "name": "All profiles", - "event": [ + }, { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Result length should be equal to zero\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(0);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", - "protocol": "{{protocol}}", - "host": [ - "{{host}}" - ], - "path": [ - "api", - "v1", + "name": "Create WIFI Profile w/ 8021x", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 201\", function () {\r", + " pm.response.to.have.status(201);\r", + "});\r", + "pm.test(\"Request should return profile just created\", function () {\r", + " pm.expect(jsonData.profileName).to.eql(\"P1\");\r", + " pm.expect(jsonData.authenticationMethod).to.eql(5);\r", + " pm.expect(jsonData.encryptionMethod).to.eql(4);\r", + " pm.expect(jsonData.ssid).to.eql(\"test\");\r", + " pm.expect(jsonData.linkPolicy.length).to.eql(2);\r", + " pm.expect(jsonData.linkPolicy[0]).to.eql(14);\r", + " pm.expect(jsonData.linkPolicy[1]).to.eql(16);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 5,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"ieee8021xProfileName\": \"{{ieee8021xProfileWireless}}\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update WIFI Profile w/ wrong interface 8021x Profile", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "pm.test(\"Request should return 8021x profile can not be specified\", function () {\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Ieee8021x profile \" + pm.environment.get(\"ieee8021xProfileWired\") + \" is for wired interfaces\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"ieee8021xProfileName\");\r", + " pm.expect(jsonData.errors[0].value).to.eql(pm.environment.get(\"ieee8021xProfileWired\"));\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 5,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"ieee8021xProfileName\": \"{{ieee8021xProfileWired}}\",\r\n \"version\": {{recordVersion}}\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "" + ] + } + }, + "response": [] + }, + { + "name": "Delete Profile", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 204\", function () {\r", + " pm.response.to.have.status(204);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/P1", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "P1" + ] + } + }, + "response": [] + }, + { + "name": "Delete wired 8021x Profile", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 204\", function () {\r", + " pm.response.to.have.status(204);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWired}}", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "ieee8021xconfigs", + "{{ieee8021xProfileWired}}" + ] + } + }, + "response": [] + }, + { + "name": "Delete wireless 8021x Profile", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 204\", function () {\r", + " pm.response.to.have.status(204);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWireless}}", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "ieee8021xconfigs", + "{{ieee8021xProfileWireless}}" + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "Wireless", + "item": [ + { + "name": "All profiles", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "pm.test(\"Result length should be equal to zero\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.length).to.eql(0);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", "admin", "wirelessconfigs", "" @@ -10275,19 +10670,677 @@ "response": [] }, { - "name": "A Specific Profile doesn't exists", + "name": "A Specific Profile doesn't exists", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {\r", + " pm.response.to.have.status(404);\r", + "});\r", + "pm.test(\"Result should contain an error and message\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.error).to.eql(\"Not Found\");\r", + " pm.expect(jsonData.message).to.eql(\"Wireless profile sampleProfile Not Found\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/sampleProfile", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "sampleProfile" + ] + } + }, + "response": [] + }, + { + "name": "Create Profile with invalid auth method", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "pm.test(\"Result should contain an error and message\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Authentication method must be one of 4:WPA PSK, 5:WPA IEEE 802.1x, 6:WPA2 PSK, 7:WPA2 IEEE 802.1x\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"authenticationMethod\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 10,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "" + ] + } + }, + "response": [] + }, + { + "name": "Create Profile with invalid encryption method", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "pm.test(\"Result should contain an error and message\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Encryption method must be one of 3:TKIP, 4:CCMP\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"encryptionMethod\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 6,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "" + ] + } + }, + "response": [] + }, + { + "name": "Create Profile with SSID length greater than 32", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "pm.test(\"Result should contain an error and message\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Maximum length is 32\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"ssid\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"wirelessProfile1234512345123456789\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "" + ] + } + }, + "response": [] + }, + { + "name": "Create Profile with psk pass phrase less than 8", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "pm.test(\"Result should contain an error and message\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"PSK Passphrase length should be greater than or equal to 8 and less than or equal to 63\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"pskPassphrase\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Inte123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "" + ] + } + }, + "response": [] + }, + { + "name": "Create Profile with psk pass phrase greater than 63", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "pm.test(\"Result should contain an error and message\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"PSK Passphrase length should be greater than or equal to 8 and less than or equal to 63\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"pskPassphrase\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "" + ] + } + }, + "response": [] + }, + { + "name": "Create Profile", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 201\", function () {\r", + " pm.response.to.have.status(201);\r", + "});\r", + "pm.test(\"Request should return profile just created\", function () {\r", + " pm.expect(jsonData.profileName).to.eql(\"P1\");\r", + " pm.expect(jsonData.authenticationMethod).to.eql(4);\r", + " pm.expect(jsonData.encryptionMethod).to.eql(4);\r", + " pm.expect(jsonData.ssid).to.eql(\"test\");\r", + " pm.expect(jsonData.linkPolicy.length).to.eql(2);\r", + " pm.expect(jsonData.linkPolicy[0]).to.eql(14);\r", + " pm.expect(jsonData.linkPolicy[1]).to.eql(16);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "" + ] + } + }, + "response": [] + }, + { + "name": "Create Duplicate Profile", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "pm.test(\"Request should return an error message\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.error).to.eql(\"Unique key violation\");\r", + " pm.expect(jsonData.message).to.eql(\"Wireless profile P1 already exists\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "" + ] + } + }, + "response": [] + }, + { + "name": "A Specific Profile that exists", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "pm.test(\"Result should wifi profile\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.profileName).to.eql(\"P1\");\r", + " pm.expect(jsonData.authenticationMethod).to.eql(4);\r", + " pm.expect(jsonData.encryptionMethod).to.eql(4);\r", + " pm.expect(jsonData.ssid).to.eql(\"test\");\r", + " pm.expect(jsonData.linkPolicy.length).to.eql(2);\r", + " pm.expect(jsonData.linkPolicy[0]).to.eql(14);\r", + " pm.expect(jsonData.linkPolicy[1]).to.eql(16);\r", + " pm.expect(jsonData.pskPassphrase).to.eql();\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/P1", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs", + "P1" + ] + } + }, + "response": [] + }, + { + "name": "All profiles", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "headerEtag = pm.response.headers.get(\"ETag\");\r", + "pm.globals.set(\"etag\", headerEtag);\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200); \r", + "});\r", + "pm.test(\"Result length should be equal to zero\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.length).to.eql(1);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs?$top=25&$skip=0", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs" + ], + "query": [ + { + "key": "$top", + "value": "25" + }, + { + "key": "$skip", + "value": "0" + } + ] + } + }, + "response": [] + }, + { + "name": "All profiles (Cached)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 304\", function () {\r", + " pm.response.to.have.status(304);\r", + "});\r", + "pm.test(\"Result length should be equal to zero\", function () {\r", + " var res = (_.isEmpty(responseBody));\r", + " pm.expect(res).to.be.true\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Cache-Control", + "value": "max-age", + "type": "text" + }, + { + "key": "If-None-Match", + "value": "{{etag}}", + "type": "text" + } + ], + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs?$top=25&$skip=0", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs" + ], + "query": [ + { + "key": "$top", + "value": "25" + }, + { + "key": "$skip", + "value": "0" + } + ] + } + }, + "response": [] + }, + { + "name": "All profiles with invalid query params", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "\r", + "pm.test(\"Request should fail with invalid query string\", function () {\r", + " var errors = pm.response.json().errors;\r", + " pm.expect(errors[0].path).to.equal('$top');\r", + " pm.expect(errors[0].msg).to.equal('The number of items to return should be a positive integer');\r", + "\r", + " pm.expect(errors[1].path).to.equal('$skip');\r", + " pm.expect(errors[1].msg).to.equal('The number of items to skip before starting to collect the result set should be a positive integer');\r", + " \r", + " pm.expect(errors[2].path).to.equal('$count');\r", + " pm.expect(errors[2].msg).to.equal('To return total number of records in result set should be boolean');\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs?$top=ten&$skip=zero&$count=notboolean", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs" + ], + "query": [ + { + "key": "$top", + "value": "ten" + }, + { + "key": "$skip", + "value": "zero" + }, + { + "key": "$count", + "value": "notboolean" + } + ] + } + }, + "response": [] + }, + { + "name": "All profiles with count set to true", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "pm.test(\"Result length should be equal to zero\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.data.length).to.eql(1);\r", + " pm.expect(jsonData.totalCount).to.eql(1);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs?$top=25&$skip=0&$count=true", + "protocol": "{{protocol}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v1", + "admin", + "wirelessconfigs" + ], + "query": [ + { + "key": "$top", + "value": "25" + }, + { + "key": "$skip", + "value": "0" + }, + { + "key": "$count", + "value": "true" + } + ] + } + }, + "response": [] + }, + { + "name": "All profiles with count set to false", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", "});\r", - "pm.test(\"Result should contain an error and message\", function () {\r", + "pm.test(\"Result length should be equal to zero\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.error).to.eql(\"Not Found\");\r", - " pm.expect(jsonData.message).to.eql(\"Wireless profile sampleProfile Not Found\");\r", + " pm.expect(jsonData.length).to.eql(1);\r", "});" ], "type": "text/javascript" @@ -10298,7 +11351,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/sampleProfile", + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs?$top=25&$skip=0&$count=false", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -10307,27 +11360,47 @@ "api", "v1", "admin", - "wirelessconfigs", - "sampleProfile" + "wirelessconfigs" + ], + "query": [ + { + "key": "$top", + "value": "25" + }, + { + "key": "$skip", + "value": "0" + }, + { + "key": "$count", + "value": "false" + } ] } }, "response": [] }, { - "name": "Create Profile with invalid auth method", + "name": "Update Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 400\", function () {\r", - " pm.response.to.have.status(400);\r", + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", "});\r", - "pm.test(\"Result should contain an error and message\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Authentication method must be one of 4:WPA PSK, 5:WPA IEEE 802.1x, 6:WPA2 PSK, 7:WPA2 IEEE 802.1x\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"authenticationMethod\");\r", + "pm.test(\"Request should return profile just created\", function () {\r", + " pm.expect(jsonData.profileName).to.eql(\"P1\");\r", + " pm.expect(jsonData.authenticationMethod).to.eql(4);\r", + " pm.expect(jsonData.encryptionMethod).to.eql(4);\r", + " pm.expect(jsonData.ssid).to.eql(\"test1\");\r", + " pm.expect(jsonData.linkPolicy.length).to.eql(2);\r", + " pm.expect(jsonData.linkPolicy[0]).to.eql(14);\r", + " pm.expect(jsonData.linkPolicy[1]).to.eql(16);\r", "});" ], "type": "text/javascript" @@ -10335,11 +11408,11 @@ } ], "request": { - "method": "POST", + "method": "PATCH", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 10,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test1\",\r\n \"pskPassphrase\": \"Intel@123!\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", "options": { "raw": { "language": "json" @@ -10364,19 +11437,20 @@ "response": [] }, { - "name": "Create Profile with invalid encryption method", + "name": "Update Profile missing version", "event": [ { "listen": "test", "script": { "exec": [ + "var jsonData = pm.response.json();\r", + "\r", "pm.test(\"Status code is 400\", function () {\r", " pm.response.to.have.status(400);\r", "});\r", - "pm.test(\"Result should contain an error and message\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Encryption method must be one of 3:TKIP, 4:CCMP\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"encryptionMethod\");\r", + "pm.test(\"Update request should fail missing version info\", function () {\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Version is required to patch/update a record.\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"version\");\r", "});" ], "type": "text/javascript" @@ -10384,11 +11458,11 @@ } ], "request": { - "method": "POST", + "method": "PATCH", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 6,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test1\",\r\n \"pskPassphrase\": \"Intel@123!\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", "options": { "raw": { "language": "json" @@ -10413,7 +11487,7 @@ "response": [] }, { - "name": "Create Profile with SSID length greater than 32", + "name": "Update Profile with invalid encryption method", "event": [ { "listen": "test", @@ -10424,8 +11498,8 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Maximum length is 32\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"ssid\");\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Encryption method must be one of 3:TKIP, 4:CCMP\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"encryptionMethod\");\r", "});" ], "type": "text/javascript" @@ -10433,11 +11507,11 @@ } ], "request": { - "method": "POST", + "method": "PATCH", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"wirelessProfile1234512345123456789\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 6,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", "options": { "raw": { "language": "json" @@ -10462,7 +11536,7 @@ "response": [] }, { - "name": "Create Profile with psk pass phrase less than 8", + "name": "Update Profile with invalid auth method", "event": [ { "listen": "test", @@ -10473,8 +11547,8 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"PSK Passphrase length should be greater than or equal to 8 and less than or equal to 63\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"pskPassphrase\");\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Authentication method must be one of 4:WPA PSK, 5:WPA IEEE 802.1x, 6:WPA2 PSK, 7:WPA2 IEEE 802.1x\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"authenticationMethod\");\r", "});" ], "type": "text/javascript" @@ -10482,11 +11556,11 @@ } ], "request": { - "method": "POST", + "method": "PATCH", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Inte123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 10,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", "options": { "raw": { "language": "json" @@ -10511,7 +11585,7 @@ "response": [] }, { - "name": "Create Profile with psk pass phrase greater than 63", + "name": "Update Profile with SSID length greater than 32", "event": [ { "listen": "test", @@ -10522,8 +11596,8 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"PSK Passphrase length should be greater than or equal to 8 and less than or equal to 63\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"pskPassphrase\");\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Maximum length is 32\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"ssid\");\r", "});" ], "type": "text/javascript" @@ -10531,11 +11605,11 @@ } ], "request": { - "method": "POST", + "method": "PATCH", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"wirelessProfile1234512345123456789\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", "options": { "raw": { "language": "json" @@ -10560,26 +11634,19 @@ "response": [] }, { - "name": "Create Profile", + "name": "Update Profile with psk pass phrase less than 8", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", - "pm.test(\"Status code is 201\", function () {\r", - " pm.response.to.have.status(201);\r", + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", "});\r", - "pm.test(\"Request should return profile just created\", function () {\r", - " pm.expect(jsonData.profileName).to.eql(\"P1\");\r", - " pm.expect(jsonData.authenticationMethod).to.eql(4);\r", - " pm.expect(jsonData.encryptionMethod).to.eql(4);\r", - " pm.expect(jsonData.ssid).to.eql(\"test\");\r", - " pm.expect(jsonData.linkPolicy.length).to.eql(2);\r", - " pm.expect(jsonData.linkPolicy[0]).to.eql(14);\r", - " pm.expect(jsonData.linkPolicy[1]).to.eql(16);\r", + "pm.test(\"Result should contain an error and message\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"PSK Passphrase length should be greater than or equal to 8 and less than or equal to 63\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"pskPassphrase\");\r", "});" ], "type": "text/javascript" @@ -10587,11 +11654,11 @@ } ], "request": { - "method": "POST", + "method": "PATCH", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Inte123\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", "options": { "raw": { "language": "json" @@ -10616,7 +11683,7 @@ "response": [] }, { - "name": "Create Duplicate Profile", + "name": "Update Profile with psk pass phrase greater than 63", "event": [ { "listen": "test", @@ -10625,10 +11692,10 @@ "pm.test(\"Status code is 400\", function () {\r", " pm.response.to.have.status(400);\r", "});\r", - "pm.test(\"Request should return an error message\", function () {\r", + "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.error).to.eql(\"Unique key violation\");\r", - " pm.expect(jsonData.message).to.eql(\"Wireless profile P1 already exists\");\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"PSK Passphrase length should be greater than or equal to 8 and less than or equal to 63\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"pskPassphrase\");\r", "});" ], "type": "text/javascript" @@ -10636,11 +11703,11 @@ } ], "request": { - "method": "POST", + "method": "PATCH", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", "options": { "raw": { "language": "json" @@ -10665,25 +11732,19 @@ "response": [] }, { - "name": "A Specific Profile that exists", + "name": "Update Profile that does not exits", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", + "pm.test(\"Status code is 404\", function () {\r", + " pm.response.to.have.status(404);\r", "});\r", - "pm.test(\"Result should wifi profile\", function () {\r", + "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.profileName).to.eql(\"P1\");\r", - " pm.expect(jsonData.authenticationMethod).to.eql(4);\r", - " pm.expect(jsonData.encryptionMethod).to.eql(4);\r", - " pm.expect(jsonData.ssid).to.eql(\"test\");\r", - " pm.expect(jsonData.linkPolicy.length).to.eql(2);\r", - " pm.expect(jsonData.linkPolicy[0]).to.eql(14);\r", - " pm.expect(jsonData.linkPolicy[1]).to.eql(16);\r", - " pm.expect(jsonData.pskPassphrase).to.eql();\r", + " pm.expect(jsonData.error).to.eql(\"Not Found\");\r", + " pm.expect(jsonData.message).to.eql(\"Wireless profile P12 Not Found\");\r", "});" ], "type": "text/javascript" @@ -10691,10 +11752,19 @@ } ], "request": { - "method": "GET", + "method": "PATCH", "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"P12\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/P1", + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -10704,28 +11774,21 @@ "v1", "admin", "wirelessconfigs", - "P1" + "" ] } }, "response": [] }, { - "name": "All profiles", + "name": "Delete Profile", "event": [ { "listen": "test", "script": { "exec": [ - "headerEtag = pm.response.headers.get(\"ETag\");\r", - "pm.globals.set(\"etag\", headerEtag);\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200); \r", - "});\r", - "pm.test(\"Result length should be equal to zero\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(1);\r", + "pm.test(\"Status code is 204\", function () {\r", + " pm.response.to.have.status(204);\r", "});" ], "type": "text/javascript" @@ -10733,69 +11796,10 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [], "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs?$top=25&$skip=0", - "protocol": "{{protocol}}", - "host": [ - "{{host}}" - ], - "path": [ - "api", - "v1", - "admin", - "wirelessconfigs" - ], - "query": [ - { - "key": "$top", - "value": "25" - }, - { - "key": "$skip", - "value": "0" - } - ] - } - }, - "response": [] - }, - { - "name": "All profiles (Cached)", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 304\", function () {\r", - " pm.response.to.have.status(304);\r", - "});\r", - "pm.test(\"Result length should be equal to zero\", function () {\r", - " var res = (_.isEmpty(responseBody));\r", - " pm.expect(res).to.be.true\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Cache-Control", - "value": "max-age", - "type": "text" - }, - { - "key": "If-None-Match", - "value": "{{etag}}", - "type": "text" - } - ], - "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs?$top=25&$skip=0", + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/P1", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -10804,43 +11808,27 @@ "api", "v1", "admin", - "wirelessconfigs" - ], - "query": [ - { - "key": "$top", - "value": "25" - }, - { - "key": "$skip", - "value": "0" - } + "wirelessconfigs", + "P1" ] } }, "response": [] }, { - "name": "All profiles with invalid query params", + "name": "Delete Profile that doesn't exists", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 400\", function () {\r", - " pm.response.to.have.status(400);\r", + "pm.test(\"Status code is 404\", function () {\r", + " pm.response.to.have.status(404);\r", "});\r", - "\r", - "pm.test(\"Request should fail with invalid query string\", function () {\r", - " var errors = pm.response.json().errors;\r", - " pm.expect(errors[0].path).to.equal('$top');\r", - " pm.expect(errors[0].msg).to.equal('The number of items to return should be a positive integer');\r", - "\r", - " pm.expect(errors[1].path).to.equal('$skip');\r", - " pm.expect(errors[1].msg).to.equal('The number of items to skip before starting to collect the result set should be a positive integer');\r", - " \r", - " pm.expect(errors[2].path).to.equal('$count');\r", - " pm.expect(errors[2].msg).to.equal('To return total number of records in result set should be boolean');\r", + "pm.test(\"Result should wifi profile\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.error).to.eql(\"Not Found\");\r", + " pm.expect(jsonData.message).to.eql(\"Wireless profile P11 Not Found\");\r", "});" ], "type": "text/javascript" @@ -10848,10 +11836,10 @@ } ], "request": { - "method": "GET", + "method": "DELETE", "header": [], "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs?$top=ten&$skip=zero&$count=notboolean", + "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/P11", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -10860,28 +11848,20 @@ "api", "v1", "admin", - "wirelessconfigs" - ], - "query": [ - { - "key": "$top", - "value": "ten" - }, - { - "key": "$skip", - "value": "zero" - }, - { - "key": "$count", - "value": "notboolean" - } + "wirelessconfigs", + "P11" ] } }, "response": [] - }, + } + ] + }, + { + "name": "IEEE8021xConfigs", + "item": [ { - "name": "All profiles with count set to true", + "name": "All 8021x Profiles", "event": [ { "listen": "test", @@ -10892,19 +11872,39 @@ "});\r", "pm.test(\"Result length should be equal to zero\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.data.length).to.eql(1);\r", - " pm.expect(jsonData.totalCount).to.eql(1);\r", + " pm.expect(jsonData.length).to.eql(0);\r", "});" ], "type": "text/javascript" } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var protocol = pm.environment.get(\"protocol\")\r", + "var host = pm.environment.get(\"host\");\r", + "var profile = pm.environment.get(\"ieee8021xProfileWired\");\r", + "const postRequest = {\r", + " url: protocol + '://' + host + '/api/v1/admin/ieee8021xconfigs/' + profile,\r", + " method: 'DELETE',\r", + "};\r", + "pm.sendRequest(postRequest, (error, response) => {\r", + " if (error) {\r", + " console.log(error);\r", + " };\r", + "});\r", + "" + ], + "type": "text/javascript" + } } ], "request": { "method": "GET", "header": [], "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs?$top=25&$skip=0&$count=true", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -10913,39 +11913,27 @@ "api", "v1", "admin", - "wirelessconfigs" - ], - "query": [ - { - "key": "$top", - "value": "25" - }, - { - "key": "$skip", - "value": "0" - }, - { - "key": "$count", - "value": "true" - } + "ieee8021xconfigs", + "" ] } }, "response": [] }, { - "name": "All profiles with count set to false", + "name": "Create 8021x Profile - Blank Profile Name", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", "});\r", - "pm.test(\"Result length should be equal to zero\", function () {\r", + "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(1);\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"802.1x profile name is required\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"profileName\");\r", "});" ], "type": "text/javascript" @@ -10953,10 +11941,19 @@ } ], "request": { - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs?$top=25&$skip=0&$count=false", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -10965,47 +11962,27 @@ "api", "v1", "admin", - "wirelessconfigs" - ], - "query": [ - { - "key": "$top", - "value": "25" - }, - { - "key": "$skip", - "value": "0" - }, - { - "key": "$count", - "value": "false" - } + "ieee8021xconfigs", + "" ] } }, "response": [] }, { - "name": "Update Profile", + "name": "Create 8021x Profile - Invalid Profile Name", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", "});\r", - "pm.test(\"Request should return profile just created\", function () {\r", - " pm.expect(jsonData.profileName).to.eql(\"P1\");\r", - " pm.expect(jsonData.authenticationMethod).to.eql(4);\r", - " pm.expect(jsonData.encryptionMethod).to.eql(4);\r", - " pm.expect(jsonData.ssid).to.eql(\"test1\");\r", - " pm.expect(jsonData.linkPolicy.length).to.eql(2);\r", - " pm.expect(jsonData.linkPolicy[0]).to.eql(14);\r", - " pm.expect(jsonData.linkPolicy[1]).to.eql(16);\r", + "pm.test(\"Result should contain an error and message\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"802.1x profile name should be alphanumeric\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"profileName\");\r", "});" ], "type": "text/javascript" @@ -11013,11 +11990,11 @@ } ], "request": { - "method": "PATCH", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test1\",\r\n \"pskPassphrase\": \"Intel@123!\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"test_#\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", "options": { "raw": { "language": "json" @@ -11025,7 +12002,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11034,7 +12011,7 @@ "api", "v1", "admin", - "wirelessconfigs", + "ieee8021xconfigs", "" ] } @@ -11042,20 +12019,19 @@ "response": [] }, { - "name": "Update Profile missing version", + "name": "Create 8021x Profile - Profile Name Too Long", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "\r", "pm.test(\"Status code is 400\", function () {\r", " pm.response.to.have.status(400);\r", "});\r", - "pm.test(\"Update request should fail missing version info\", function () {\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Version is required to patch/update a record.\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"version\");\r", + "pm.test(\"Result should contain an error and message\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"802.1x profile name maximum length is 32\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"profileName\");\r", "});" ], "type": "text/javascript" @@ -11063,11 +12039,11 @@ } ], "request": { - "method": "PATCH", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test1\",\r\n \"pskPassphrase\": \"Intel@123!\",\r\n \"linkPolicy\": [14,16]\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"test012345678901234567890123456789\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", "options": { "raw": { "language": "json" @@ -11075,7 +12051,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11084,7 +12060,7 @@ "api", "v1", "admin", - "wirelessconfigs", + "ieee8021xconfigs", "" ] } @@ -11092,7 +12068,7 @@ "response": [] }, { - "name": "Update Profile with invalid encryption method", + "name": "Create 8021x Profile - Invalid Wired Auth Protocol", "event": [ { "listen": "test", @@ -11103,8 +12079,9 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Encryption method must be one of 3:TKIP, 4:CCMP\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"encryptionMethod\");\r", + " pm.expect(jsonData.errors[0].value).to.eql(1);\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Authentication protocol must be one of 0:EAP-TLS, 3:PEAPv1/EAP-GTC, 5:EAP-FAST/GTC, 10:EAP-FAST/TLS, 2:PEAPv0/EAP-MSCHAPv2\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"authenticationProtocol\");\r", "});" ], "type": "text/javascript" @@ -11112,11 +12089,11 @@ } ], "request": { - "method": "PATCH", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 6,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 1,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", "options": { "raw": { "language": "json" @@ -11124,7 +12101,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11133,7 +12110,7 @@ "api", "v1", "admin", - "wirelessconfigs", + "ieee8021xconfigs", "" ] } @@ -11141,7 +12118,7 @@ "response": [] }, { - "name": "Update Profile with invalid auth method", + "name": "Create 8021x Profile - PXE Timeout Out of Range", "event": [ { "listen": "test", @@ -11152,8 +12129,9 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Authentication method must be one of 4:WPA PSK, 5:WPA IEEE 802.1x, 6:WPA2 PSK, 7:WPA2 IEEE 802.1x\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"authenticationMethod\");\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"PXE Timeout value should be 0 - 86400\");\r", + " pm.expect(jsonData.errors[0].value).to.eql(86401);\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"pxeTimeout\");\r", "});" ], "type": "text/javascript" @@ -11161,11 +12139,11 @@ } ], "request": { - "method": "PATCH", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 10,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 86401,\r\n \"wiredInterface\": true\r\n}", "options": { "raw": { "language": "json" @@ -11173,7 +12151,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11182,7 +12160,7 @@ "api", "v1", "admin", - "wirelessconfigs", + "ieee8021xconfigs", "" ] } @@ -11190,7 +12168,7 @@ "response": [] }, { - "name": "Update Profile with SSID length greater than 32", + "name": "Create 8021x Profile - Invalid PXE Timeout", "event": [ { "listen": "test", @@ -11201,8 +12179,8 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Maximum length is 32\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"ssid\");\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"PXE Timeout must be number\");\r", + " pm.expect(jsonData.errors[0].value).to.eql(\"120\");\r", "});" ], "type": "text/javascript" @@ -11210,11 +12188,11 @@ } ], "request": { - "method": "PATCH", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"wirelessProfile1234512345123456789\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": \"120\",\r\n \"wiredInterface\": true\r\n}", "options": { "raw": { "language": "json" @@ -11222,7 +12200,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11231,7 +12209,7 @@ "api", "v1", "admin", - "wirelessconfigs", + "ieee8021xconfigs", "" ] } @@ -11239,7 +12217,7 @@ "response": [] }, { - "name": "Update Profile with psk pass phrase less than 8", + "name": "Create 8021x Profile - No PXE Timeout", "event": [ { "listen": "test", @@ -11250,8 +12228,8 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"PSK Passphrase length should be greater than or equal to 8 and less than or equal to 63\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"pskPassphrase\");\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"PXE Timeout is required\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"pxeTimeout\");\r", "});" ], "type": "text/javascript" @@ -11259,11 +12237,11 @@ } ], "request": { - "method": "PATCH", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Inte123\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"wiredInterface\": true\r\n}", "options": { "raw": { "language": "json" @@ -11271,7 +12249,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11280,7 +12258,7 @@ "api", "v1", "admin", - "wirelessconfigs", + "ieee8021xconfigs", "" ] } @@ -11288,7 +12266,7 @@ "response": [] }, { - "name": "Update Profile with psk pass phrase greater than 63", + "name": "Create 8021x Profile - Invalid Wireless Auth Protocol", "event": [ { "listen": "test", @@ -11299,8 +12277,9 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"PSK Passphrase length should be greater than or equal to 8 and less than or equal to 63\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"pskPassphrase\");\r", + " pm.expect(jsonData.errors[0].value).to.eql(3);\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Authentication protocol must be one of 0:EAP-TLS, 2:PEAPv0/EAP-MSCHAPv2\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"authenticationProtocol\");\r", "});" ], "type": "text/javascript" @@ -11308,11 +12287,11 @@ } ], "request": { - "method": "PATCH", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P1\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!Intel@123!\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWireless}}\",\r\n \"authenticationProtocol\": 3,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": false\r\n}", "options": { "raw": { "language": "json" @@ -11320,7 +12299,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11329,7 +12308,7 @@ "api", "v1", "admin", - "wirelessconfigs", + "ieee8021xconfigs", "" ] } @@ -11337,19 +12316,24 @@ "response": [] }, { - "name": "Update Profile that does not exits", + "name": "Create 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 201\", function () {\r", + " pm.response.to.have.status(201);\r", "});\r", - "pm.test(\"Result should contain an error and message\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.error).to.eql(\"Not Found\");\r", - " pm.expect(jsonData.message).to.eql(\"Wireless profile P12 Not Found\");\r", + "pm.test(\"Request should return profile just created\", function () {\r", + " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", + " pm.expect(jsonData.profileName).to.eql(profile);\r", + " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", + " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", + " pm.expect(jsonData.wiredInterface).to.eql(true);\r", "});" ], "type": "text/javascript" @@ -11357,11 +12341,11 @@ } ], "request": { - "method": "PATCH", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"P12\",\r\n \"authenticationMethod\": 4,\r\n \"encryptionMethod\": 4,\r\n \"ssid\": \"test\",\r\n \"priority\": 1,\r\n \"pskPassphrase\": \"Intel@123\",\r\n \"linkPolicy\": [14,16],\r\n \"version\": {{recordVersion}}\r\n}\r\n", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", "options": { "raw": { "language": "json" @@ -11369,7 +12353,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11378,7 +12362,7 @@ "api", "v1", "admin", - "wirelessconfigs", + "ieee8021xconfigs", "" ] } @@ -11386,14 +12370,20 @@ "response": [] }, { - "name": "Delete Profile", + "name": "Create Duplicate 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 204\", function () {\r", - " pm.response.to.have.status(204);\r", + "pm.test(\"Status code is 400\", function () {\r", + " pm.response.to.have.status(400);\r", + "});\r", + "pm.test(\"Request should return an error message\", function () {\r", + " var jsonData = pm.response.json();\r", + " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", + " pm.expect(jsonData.error).to.eql(\"Unique key violation\");\r", + " pm.expect(jsonData.message).to.eql(\"802.1x config: \" + profile + \" already exists\");\r", "});" ], "type": "text/javascript" @@ -11401,10 +12391,19 @@ } ], "request": { - "method": "DELETE", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 10,\r\n \"pxeTimeout\": 0,\r\n \"wiredInterface\": true\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/P1", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11413,27 +12412,28 @@ "api", "v1", "admin", - "wirelessconfigs", - "P1" + "ieee8021xconfigs", + "" ] } }, "response": [] }, { - "name": "Delete Profile that doesn't exists", + "name": "Specific 8021xProfile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", "});\r", - "pm.test(\"Result should wifi profile\", function () {\r", + "pm.test(\"Result should contain 802.1x profile\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.error).to.eql(\"Not Found\");\r", - " pm.expect(jsonData.message).to.eql(\"Wireless profile P11 Not Found\");\r", + " pm.expect(jsonData.profileName).to.eql(pm.environment.get(\"ieee8021xProfileWired\"));\r", + " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", + " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", "});" ], "type": "text/javascript" @@ -11441,10 +12441,10 @@ } ], "request": { - "method": "DELETE", + "method": "GET", "header": [], "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/wirelessconfigs/P11", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWired}}", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11453,63 +12453,38 @@ "api", "v1", "admin", - "wirelessconfigs", - "P11" + "ieee8021xconfigs", + "{{ieee8021xProfileWired}}" ] } }, "response": [] - } - ] - }, - { - "name": "IEEE8021xConfigs", - "item": [ + }, { - "name": "All 8021x Profiles", + "name": "Specific 8021xProfile - Which doesn't exist", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", + "pm.test(\"Status code is 404\", function () {\r", + " pm.response.to.have.status(404);\r", "});\r", - "pm.test(\"Result length should be equal to zero\", function () {\r", + "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(0);\r", + " pm.expect(jsonData.error).to.eql(\"Not Found\");\r", + " pm.expect(jsonData.message).to.eql(\"802.1x profile testProfile Not Found\");\r", "});" ], "type": "text/javascript" } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var protocol = pm.environment.get(\"protocol\")\r", - "var host = pm.environment.get(\"host\");\r", - "var profile = pm.environment.get(\"ieee8021xProfileWired\");\r", - "const postRequest = {\r", - " url: protocol + '://' + host + '/api/v1/admin/ieee8021xconfigs/' + profile,\r", - " method: 'DELETE',\r", - "};\r", - "pm.sendRequest(postRequest, (error, response) => {\r", - " if (error) {\r", - " console.log(error);\r", - " };\r", - "});\r", - "" - ], - "type": "text/javascript" - } } ], "request": { "method": "GET", "header": [], "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/testProfile", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11519,26 +12494,28 @@ "v1", "admin", "ieee8021xconfigs", - "" + "testProfile" ] } }, "response": [] }, { - "name": "Create 8021x Profile - Blank Profile Name", + "name": "Update 8021x Profile - Missing Version", "event": [ { "listen": "test", "script": { "exec": [ + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", "pm.test(\"Status code is 400\", function () {\r", " pm.response.to.have.status(400);\r", "});\r", - "pm.test(\"Result should contain an error and message\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"802.1x profile name is required\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"profileName\");\r", + "pm.test(\"Update request should fail missing version info\", function () {\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Version is required to patch/update a record.\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"version\");\r", "});" ], "type": "text/javascript" @@ -11546,11 +12523,11 @@ } ], "request": { - "method": "POST", + "method": "PATCH", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 5,\r\n \"pxeTimeout\": 0,\r\n \"wiredInterface\": true\r\n}", "options": { "raw": { "language": "json" @@ -11575,19 +12552,24 @@ "response": [] }, { - "name": "Create 8021x Profile - Invalid Profile Name", + "name": "Update 8021x Profile - Invalid Version", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 400\", function () {\r", - " pm.response.to.have.status(400);\r", + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 409\", function () {\r", + " pm.response.to.have.status(409);\r", "});\r", - "pm.test(\"Result should contain an error and message\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"802.1x profile name should be alphanumeric\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"profileName\");\r", + "pm.test(\"Request should fail and return profile in db\", function () {\r", + " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", + " pm.expect(jsonData.profileName).to.eql(profile);\r", + " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", + " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", + " pm.expect(jsonData.wiredInterface).to.eql(true);\r", "});" ], "type": "text/javascript" @@ -11595,11 +12577,11 @@ } ], "request": { - "method": "POST", + "method": "PATCH", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"test_#\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 5,\r\n \"pxeTimeout\": 0,\r\n \"wiredInterface\": true,\r\n \"version\": 100\r\n}", "options": { "raw": { "language": "json" @@ -11624,19 +12606,24 @@ "response": [] }, { - "name": "Create 8021x Profile - Profile Name Too Long", + "name": "Update 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 400\", function () {\r", - " pm.response.to.have.status(400);\r", + "var jsonData = pm.response.json();\r", + "pm.globals.set(\"recordVersion\", jsonData.version);\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", "});\r", - "pm.test(\"Result should contain an error and message\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"802.1x profile name maximum length is 32\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"profileName\");\r", + "pm.test(\"Request should return profile just created\", function () {\r", + " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", + " pm.expect(jsonData.profileName).to.eql(profile);\r", + " pm.expect(jsonData.authenticationProtocol).to.eql(5);\r", + " pm.expect(jsonData.pxeTimeout).to.eql(0);\r", + " pm.expect(jsonData.wiredInterface).to.eql(true);\r", "});" ], "type": "text/javascript" @@ -11644,11 +12631,11 @@ } ], "request": { - "method": "POST", + "method": "PATCH", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"test012345678901234567890123456789\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", + "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 5,\r\n \"pxeTimeout\": 0,\r\n \"wiredInterface\": true,\r\n \"version\": {{recordVersion}}\r\n}", "options": { "raw": { "language": "json" @@ -11673,20 +12660,14 @@ "response": [] }, { - "name": "Create 8021x Profile - Invalid Wired Auth Protocol", + "name": "Delete 8021x Profile", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 400\", function () {\r", - " pm.response.to.have.status(400);\r", - "});\r", - "pm.test(\"Result should contain an error and message\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].value).to.eql(1);\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Authentication protocol must be one of 0:EAP-TLS, 3:PEAPv1/EAP-GTC, 5:EAP-FAST/GTC, 10:EAP-FAST/TLS, 2:PEAPv0/EAP-MSCHAPv2\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"authenticationProtocol\");\r", + "pm.test(\"Status code is 204\", function () {\r", + " pm.response.to.have.status(204);\r", "});" ], "type": "text/javascript" @@ -11694,19 +12675,10 @@ } ], "request": { - "method": "POST", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 1,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWired}}", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11716,14 +12688,19 @@ "v1", "admin", "ieee8021xconfigs", - "" + "{{ieee8021xProfileWired}}" ] } }, "response": [] - }, + } + ] + }, + { + "name": "Proxy", + "item": [ { - "name": "Create 8021x Profile - PXE Timeout Out of Range", + "name": "Create Proxy with empty access info", "event": [ { "listen": "test", @@ -11734,12 +12711,12 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"PXE Timeout value should be 0 - 86400\");\r", - " pm.expect(jsonData.errors[0].value).to.eql(86401);\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"pxeTimeout\");\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Server address is required\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"accessInfo\");\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -11748,7 +12725,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 86401,\r\n \"wiredInterface\": true\r\n}", + "raw": "{\r\n \"accessInfo\": \"\",\r\n \"infoFormat\": 3,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -11756,7 +12733,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11765,7 +12742,7 @@ "api", "v1", "admin", - "ieee8021xconfigs", + "proxyconfigs", "" ] } @@ -11773,7 +12750,7 @@ "response": [] }, { - "name": "Create 8021x Profile - Invalid PXE Timeout", + "name": "Create Proxy with invalid info format", "event": [ { "listen": "test", @@ -11784,11 +12761,12 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"PXE Timeout must be number\");\r", - " pm.expect(jsonData.errors[0].value).to.eql(\"120\");\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Server address format should be either 3(IPV4), 4(IPV6) or 201(FQDN)\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"infoFormat\");\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -11797,7 +12775,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": \"120\",\r\n \"wiredInterface\": true\r\n}", + "raw": "{\r\n \"accessInfo\": \"192.168.9.58\",\r\n \"infoFormat\": 5,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -11805,7 +12783,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11814,7 +12792,7 @@ "api", "v1", "admin", - "ieee8021xconfigs", + "proxyconfigs", "" ] } @@ -11822,7 +12800,7 @@ "response": [] }, { - "name": "Create 8021x Profile - No PXE Timeout", + "name": "Create Proxy with port greater than 65535", "event": [ { "listen": "test", @@ -11833,11 +12811,12 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"PXE Timeout is required\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"pxeTimeout\");\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Port value should range between 0 and 65535\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"port\");\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -11846,7 +12825,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"wiredInterface\": true\r\n}", + "raw": "{\r\n \"accessInfo\": \"192.168.9.58\",\r\n \"infoFormat\": 3,\r\n \"port\": 65536,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -11854,7 +12833,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11863,7 +12842,7 @@ "api", "v1", "admin", - "ieee8021xconfigs", + "proxyconfigs", "" ] } @@ -11871,7 +12850,7 @@ "response": [] }, { - "name": "Create 8021x Profile - Invalid Wireless Auth Protocol", + "name": "Create Proxy with invalid network DNS suffix", "event": [ { "listen": "test", @@ -11882,12 +12861,12 @@ "});\r", "pm.test(\"Result should contain an error and message\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.errors[0].value).to.eql(3);\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Authentication protocol must be one of 0:EAP-TLS, 2:PEAPv0/EAP-MSCHAPv2\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"authenticationProtocol\");\r", + " pm.expect(jsonData.errors[0].msg).to.eql(\"Domain name of the network should contain alphanumeric and hyphens in the middle\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"networkDnsSuffix\");\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -11896,7 +12875,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWireless}}\",\r\n \"authenticationProtocol\": 3,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": false\r\n}", + "raw": "{\r\n \"accessInfo\": \"192.168.9.58\",\r\n \"infoFormat\": 3,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"-intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -11904,7 +12883,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11913,7 +12892,7 @@ "api", "v1", "admin", - "ieee8021xconfigs", + "proxyconfigs", "" ] } @@ -11921,27 +12900,25 @@ "response": [] }, { - "name": "Create 8021x Profile", + "name": "Create Proxy", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", "pm.test(\"Status code is 201\", function () {\r", " pm.response.to.have.status(201);\r", "});\r", - "pm.test(\"Request should return profile just created\", function () {\r", - " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", - " pm.expect(jsonData.profileName).to.eql(profile);\r", - " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", - " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", - " pm.expect(jsonData.wiredInterface).to.eql(true);\r", + "pm.test(\"Request should return proxy just created\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.accessInfo).to.eql(\"www.vprodemo.com\");\r", + " pm.expect(jsonData.infoFormat).to.eql(201);\r", + " pm.expect(jsonData.port).to.eql(900);\r", + " pm.expect(jsonData.networkDnsSuffix).to.eql(\"intel.com\");\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -11950,7 +12927,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 0,\r\n \"pxeTimeout\": 120,\r\n \"wiredInterface\": true\r\n}", + "raw": "{\r\n \"accessInfo\": \"www.vprodemo.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -11958,7 +12935,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -11967,7 +12944,7 @@ "api", "v1", "admin", - "ieee8021xconfigs", + "proxyconfigs", "" ] } @@ -11975,7 +12952,7 @@ "response": [] }, { - "name": "Create Duplicate 8021x Profile", + "name": "Create Duplicate Proxy", "event": [ { "listen": "test", @@ -11986,21 +12963,24 @@ "});\r", "pm.test(\"Request should return an error message\", function () {\r", " var jsonData = pm.response.json();\r", - " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", " pm.expect(jsonData.error).to.eql(\"Unique key violation\");\r", - " pm.expect(jsonData.message).to.eql(\"802.1x config: \" + profile + \" already exists\");\r", + " pm.expect(jsonData.message).to.eql(\"Proxy profile www.vprodemo.com already exists\");\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { + "auth": { + "type": "noauth" + }, "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 10,\r\n \"pxeTimeout\": 0,\r\n \"wiredInterface\": true\r\n}", + "raw": "{\r\n \"accessInfo\": \"www.vprodemo.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -12008,7 +12988,7 @@ } }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs/", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -12017,7 +12997,7 @@ "api", "v1", "admin", - "ieee8021xconfigs", + "proxyconfigs", "" ] } @@ -12025,23 +13005,25 @@ "response": [] }, { - "name": "Specific 8021xProfile", + "name": "All proxies", "event": [ { "listen": "test", "script": { "exec": [ + "headerEtag = pm.response.headers.get(\"ETag\");\r", + "pm.globals.set(\"etag\", headerEtag);\r", + "\r", "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", + " pm.response.to.have.status(200); \r", "});\r", - "pm.test(\"Result should contain 802.1x profile\", function () {\r", + "pm.test(\"Result length should be equal to three\", function () {\r", " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.profileName).to.eql(pm.environment.get(\"ieee8021xProfileWired\"));\r", - " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", - " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", + " pm.expect(jsonData.length).to.eql(3);\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -12049,7 +13031,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWired}}", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs?$top=25&$skip=0", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -12058,38 +13040,58 @@ "api", "v1", "admin", - "ieee8021xconfigs", - "{{ieee8021xProfileWired}}" + "proxyconfigs" + ], + "query": [ + { + "key": "$top", + "value": "25" + }, + { + "key": "$skip", + "value": "0" + } ] } }, "response": [] }, { - "name": "Specific 8021xProfile - Which doesn't exist", + "name": "All profiles (Cached)", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", + "pm.test(\"Status code is 304\", function () {\r", + " pm.response.to.have.status(304);\r", "});\r", - "pm.test(\"Result should contain an error and message\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.error).to.eql(\"Not Found\");\r", - " pm.expect(jsonData.message).to.eql(\"802.1x profile testProfile Not Found\");\r", + "pm.test(\"Result length should be equal to zero\", function () {\r", + " var res = (_.isEmpty(responseBody));\r", + " pm.expect(res).to.be.true\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { "method": "GET", - "header": [], + "header": [ + { + "key": "Cache-Control", + "value": "max-age", + "type": "text" + }, + { + "key": "If-None-Match", + "value": "{{etag}}", + "type": "text" + } + ], "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/testProfile", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs?$top=25&$skip=0", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -12098,49 +13100,55 @@ "api", "v1", "admin", - "ieee8021xconfigs", - "testProfile" + "proxyconfigs" + ], + "query": [ + { + "key": "$top", + "value": "25" + }, + { + "key": "$skip", + "value": "0" + } ] } }, "response": [] }, { - "name": "Update 8021x Profile - Missing Version", + "name": "All profiles with invalid query params", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", "pm.test(\"Status code is 400\", function () {\r", " pm.response.to.have.status(400);\r", "});\r", - "pm.test(\"Update request should fail missing version info\", function () {\r", - " pm.expect(jsonData.errors[0].msg).to.eql(\"Version is required to patch/update a record.\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"version\");\r", + "\r", + "pm.test(\"Request should fail with invalid query string\", function () {\r", + " var errors = pm.response.json().errors;\r", + " pm.expect(errors[0].path).to.equal('$top');\r", + " pm.expect(errors[0].msg).to.equal('The number of items to return should be a positive integer');\r", + "\r", + " pm.expect(errors[1].path).to.equal('$skip');\r", + " pm.expect(errors[1].msg).to.equal('The number of items to skip before starting to collect the result set should be a positive integer');\r", + " \r", + " pm.expect(errors[2].path).to.equal('$count');\r", + " pm.expect(errors[2].msg).to.equal('To return total number of records in result set should be boolean');\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { - "method": "PATCH", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 5,\r\n \"pxeTimeout\": 0,\r\n \"wiredInterface\": true\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs?$top=ten&$skip=zero&$count=notboolean", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -12149,52 +13157,52 @@ "api", "v1", "admin", - "ieee8021xconfigs", - "" + "proxyconfigs" + ], + "query": [ + { + "key": "$top", + "value": "ten" + }, + { + "key": "$skip", + "value": "zero" + }, + { + "key": "$count", + "value": "notboolean" + } ] } }, "response": [] }, { - "name": "Update 8021x Profile - Invalid Version", + "name": "All profiles with count set to true", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", - "pm.test(\"Status code is 409\", function () {\r", - " pm.response.to.have.status(409);\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", "});\r", - "pm.test(\"Request should fail and return profile in db\", function () {\r", - " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", - " pm.expect(jsonData.profileName).to.eql(profile);\r", - " pm.expect(jsonData.authenticationProtocol).to.eql(0);\r", - " pm.expect(jsonData.pxeTimeout).to.eql(120);\r", - " pm.expect(jsonData.wiredInterface).to.eql(true);\r", + "pm.test(\"Result length should be equal to three\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.data.length).to.eql(3);\r", + " pm.expect(jsonData.totalCount).to.eql(3);\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { - "method": "PATCH", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 5,\r\n \"pxeTimeout\": 0,\r\n \"wiredInterface\": true,\r\n \"version\": 100\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs?$top=25&$skip=0&$count=true", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -12203,52 +13211,51 @@ "api", "v1", "admin", - "ieee8021xconfigs", - "" + "proxyconfigs" + ], + "query": [ + { + "key": "$top", + "value": "25" + }, + { + "key": "$skip", + "value": "0" + }, + { + "key": "$count", + "value": "true" + } ] } }, "response": [] }, { - "name": "Update 8021x Profile", + "name": "All profiles with count set to false", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = pm.response.json();\r", - "pm.globals.set(\"recordVersion\", jsonData.version);\r", - "\r", "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});\r", - "pm.test(\"Request should return profile just created\", function () {\r", - " var profile = pm.environment.get(\"ieee8021xProfileWired\")\r", - " pm.expect(jsonData.profileName).to.eql(profile);\r", - " pm.expect(jsonData.authenticationProtocol).to.eql(5);\r", - " pm.expect(jsonData.pxeTimeout).to.eql(0);\r", - " pm.expect(jsonData.wiredInterface).to.eql(true);\r", + "pm.test(\"Result length should be equal to three\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.length).to.eql(3);\r", "});" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { - "method": "PATCH", + "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"profileName\": \"{{ieee8021xProfileWired}}\",\r\n \"authenticationProtocol\": 5,\r\n \"pxeTimeout\": 0,\r\n \"wiredInterface\": true,\r\n \"version\": {{recordVersion}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/", + "raw": "{{protocol}}://{{host}}/api/v1/admin/proxyconfigs?$top=25&$skip=0&$count=false", "protocol": "{{protocol}}", "host": [ "{{host}}" @@ -12257,43 +13264,21 @@ "api", "v1", "admin", - "ieee8021xconfigs", - "" - ] - } - }, - "response": [] - }, - { - "name": "Delete 8021x Profile", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 204\", function () {\r", - " pm.response.to.have.status(204);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{protocol}}://{{host}}/api/v1/admin/ieee8021xconfigs/{{ieee8021xProfileWired}}", - "protocol": "{{protocol}}", - "host": [ - "{{host}}" + "proxyconfigs" ], - "path": [ - "api", - "v1", - "admin", - "ieee8021xconfigs", - "{{ieee8021xProfileWired}}" + "query": [ + { + "key": "$top", + "value": "25" + }, + { + "key": "$skip", + "value": "0" + }, + { + "key": "$count", + "value": "false" + } ] } }, @@ -12325,13 +13310,13 @@ "header": [ { "key": "Content-Type", - "type": "text", - "value": "application/json" + "value": "application/json", + "type": "text" }, { "key": "X-RPS-API-Key", - "type": "text", - "value": "APIKEYFORRPS123!" + "value": "APIKEYFORRPS123!", + "type": "text" } ], "url": { diff --git a/src/utils/constants.ts b/src/utils/constants.ts index ad7249bb0..327856aef 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -53,8 +53,10 @@ export const API_UNEXPECTED_EXCEPTION = (message: string): string => `Operation export const CONCURRENCY_EXCEPTION = 'Concurrency' export const CONCURRENCY_MESSAGE = 'No records were updated' export const NOT_FOUND_EXCEPTION = 'Not Found' -export const NOT_FOUND_MESSAGE = (type: 'Domain' | 'Wireless' | '802.1x' | 'CIRA' | 'AMT', name: string): string => - `${type} profile ${name} Not Found` +export const NOT_FOUND_MESSAGE = ( + type: 'Domain' | 'Wireless' | '802.1x' | 'CIRA' | 'AMT' | 'Proxy', + name: string +): string => `${type} profile ${name} Not Found` // JSON response export const API_RESPONSE = (data?: any, error?: string | null, message?: string): apiResponse => { const response: apiResponse = {}