diff --git a/data/init.sql b/data/init.sql index 01794e08c..0e6f09224 100644 --- a/data/init.sql +++ b/data/init.sql @@ -101,18 +101,17 @@ CREATE TABLE IF NOT EXISTS domains( ); CREATE TABLE IF NOT EXISTS proxyconfigs( proxy_config_name citext, - access_info citext NOT NULL, + address citext NOT NULL, info_format integer NOT NULL, port integer NOT NULL, network_dns_suffix varchar(192), creation_date timestamp, tenant_id varchar(36), - CONSTRAINT access_info_port UNIQUE (access_info, port, tenant_id), + CONSTRAINT proxy_config_name_tenant_id UNIQUE (proxy_config_name, tenant_id), PRIMARY KEY (proxy_config_name, tenant_id) ); CREATE TABLE IF NOT EXISTS profiles_proxyconfigs( proxy_config_name citext, - access_info citext, profile_name citext, FOREIGN KEY (proxy_config_name,tenant_id) REFERENCES proxyconfigs(proxy_config_name,tenant_id), FOREIGN KEY (profile_name,tenant_id) REFERENCES profiles(profile_name,tenant_id), diff --git a/src/data/postgres/tables/proxyConfigs.test.ts b/src/data/postgres/tables/proxyConfigs.test.ts index f56659037..a53925bfa 100644 --- a/src/data/postgres/tables/proxyConfigs.test.ts +++ b/src/data/postgres/tables/proxyConfigs.test.ts @@ -28,7 +28,7 @@ describe('proxy configs tests', () => { beforeEach(() => { proxyConfig = { proxyName: 'proxy profile', - accessInfo: 'proxy.com', + address: 'proxy.com', infoFormat: 201, // FQDN (201) port: 1000, networkDnsSuffix: 'suffix', @@ -98,7 +98,7 @@ describe('proxy configs tests', () => { ` SELECT proxy_config_name as "proxyName", - access_info as "accessInfo", + address as "address", info_format as "infoFormat", port as "port", network_dns_suffix as "networkDnsSuffix", @@ -124,7 +124,7 @@ describe('proxy configs tests', () => { ` SELECT proxy_config_name as "proxyName", - access_info as "accessInfo", + address as "address", info_format as "infoFormat", port as "port", network_dns_suffix as "networkDnsSuffix", @@ -231,11 +231,11 @@ describe('proxy configs tests', () => { expect(querySpy).toBeCalledWith( ` INSERT INTO proxyconfigs - (proxy_config_name, access_info, info_format, port, network_dns_suffix, creation_date, tenant_id) + (proxy_config_name, address, info_format, port, network_dns_suffix, creation_date, tenant_id) values($1, $2, $3, $4, $5, $6, $7)`, [ proxyConfig.proxyName, - proxyConfig.accessInfo, + proxyConfig.address, proxyConfig.infoFormat, proxyConfig.port, proxyConfig.networkDnsSuffix, @@ -278,11 +278,11 @@ describe('proxy configs tests', () => { expect(querySpy).toBeCalledWith( ` UPDATE proxyconfigs - SET access_info=$2, info_format=$3, port=$4, network_dns_suffix=$5 + SET address=$2, info_format=$3, port=$4, network_dns_suffix=$5 WHERE proxy_config_name=$1 and tenant_id = $6`, [ proxyConfig.proxyName, - proxyConfig.accessInfo, + proxyConfig.address, proxyConfig.infoFormat, proxyConfig.port, proxyConfig.networkDnsSuffix, @@ -321,11 +321,11 @@ describe('proxy configs tests', () => { expect(querySpy).toBeCalledWith( ` UPDATE proxyconfigs - SET access_info=$2, info_format=$3, port=$4, network_dns_suffix=$5 + SET address=$2, info_format=$3, port=$4, network_dns_suffix=$5 WHERE proxy_config_name=$1 and tenant_id = $6`, [ proxyConfig.proxyName, - proxyConfig.accessInfo, + proxyConfig.address, proxyConfig.infoFormat, proxyConfig.port, proxyConfig.networkDnsSuffix, diff --git a/src/data/postgres/tables/proxyConfigs.ts b/src/data/postgres/tables/proxyConfigs.ts index fc14c144f..2bc417512 100644 --- a/src/data/postgres/tables/proxyConfigs.ts +++ b/src/data/postgres/tables/proxyConfigs.ts @@ -58,7 +58,7 @@ export class ProxyConfigsTable implements IProxyConfigsTable { ` SELECT proxy_config_name as "proxyName", - access_info as "accessInfo", + address as "address", info_format as "infoFormat", port as "port", network_dns_suffix as "networkDnsSuffix", @@ -86,7 +86,7 @@ export class ProxyConfigsTable implements IProxyConfigsTable { ` SELECT proxy_config_name as "proxyName", - access_info as "accessInfo", + address as "address", info_format as "infoFormat", port as "port", network_dns_suffix as "networkDnsSuffix", @@ -172,11 +172,11 @@ export class ProxyConfigsTable implements IProxyConfigsTable { const results = await this.db.query( ` INSERT INTO proxyconfigs - (proxy_config_name, access_info, info_format, port, network_dns_suffix, creation_date, tenant_id) + (proxy_config_name, address, info_format, port, network_dns_suffix, creation_date, tenant_id) values($1, $2, $3, $4, $5, $6, $7)`, [ proxyConfig.proxyName, - proxyConfig.accessInfo, + proxyConfig.address, proxyConfig.infoFormat, proxyConfig.port, proxyConfig.networkDnsSuffix, @@ -213,11 +213,11 @@ export class ProxyConfigsTable implements IProxyConfigsTable { const results = await this.db.query( ` UPDATE proxyconfigs - SET access_info=$2, info_format=$3, port=$4, network_dns_suffix=$5 + SET address=$2, info_format=$3, port=$4, network_dns_suffix=$5 WHERE proxy_config_name=$1 and tenant_id = $6`, [ proxyConfig.proxyName, - proxyConfig.accessInfo, + proxyConfig.address, proxyConfig.infoFormat, proxyConfig.port, proxyConfig.networkDnsSuffix, diff --git a/src/models/RCS.Config.ts b/src/models/RCS.Config.ts index cedb810b6..9c687a206 100644 --- a/src/models/RCS.Config.ts +++ b/src/models/RCS.Config.ts @@ -48,11 +48,11 @@ export interface Ieee8021xConfig { /* - AddMpServer Method: -AccessInfo: IP or FQDN of MPS server(MaxLen 256) +address: IP or FQDN of MPS server(MaxLen 256) Port (number) Username (16 alphanumeric characters) Password (16 characters) -CN (common name used when AccessInfo is IP address) +CN (common name used when address is IP address) Additional information that we need to provide when configuring MPS: @@ -194,7 +194,7 @@ export interface TLSConfigFlow { } export interface mpsServer { - AccessInfo: any + address: any InfoFormat: number Port: number AuthMethod: number @@ -304,8 +304,8 @@ export interface connectionParams { export interface ProxyConfig { proxyName: string - 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)) + address: 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 address property (IPv4 (3), IPv6 (4), FQDN (201)) port: number networkDnsSuffix: string // Domain name of the network to which this proxy belongs tenantId: string diff --git a/src/routes/admin/proxy/proxyValidator.ts b/src/routes/admin/proxy/proxyValidator.ts index d0228cebc..51f21877a 100644 --- a/src/routes/admin/proxy/proxyValidator.ts +++ b/src/routes/admin/proxy/proxyValidator.ts @@ -29,19 +29,19 @@ export const proxyValidator = (): any => [ ]) .withMessage('Server address format should be either 3(IPV4), 4(IPV6) or 201(FQDN)'), - // accessInfo presence - check('accessInfo').not().isEmpty().withMessage('Server address is required'), + // address presence + check('address').not().isEmpty().withMessage('Server address is required'), - // accessInfo format based on infoFormat - check('accessInfo') + // address format based on infoFormat + check('address') .if((_, { req }) => req.body.infoFormat === 3) .isIP(4) .withMessage('infoFormat 3 requires IPV4 server address'), - check('accessInfo') + check('address') .if((_, { req }) => req.body.infoFormat === 4) .isIP(6) .withMessage('infoFormat 4 requires IPV6 server address'), - check('accessInfo') + check('address') .if((_, { req }) => req.body.infoFormat === 201) .isFQDN({ require_tld: true, allow_underscores: false, allow_numeric_tld: false }) .withMessage('infoFormat 201 requires FQDN server address'), diff --git a/src/test/collections/rps.postman_collection.json b/src/test/collections/rps.postman_collection.json index c3da3c1ae..6422def3b 100644 --- a/src/test/collections/rps.postman_collection.json +++ b/src/test/collections/rps.postman_collection.json @@ -7256,7 +7256,7 @@ "pm.test(\"Creation should succeed\", function () {\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData.proxyName).to.eql(\"proxyabc\");\r", - " pm.expect(jsonData.accessInfo).to.eql(\"www.proxy-abc.com\");\r", + " pm.expect(jsonData.address).to.eql(\"www.proxy-abc.com\");\r", " pm.expect(jsonData.infoFormat).to.eql(201);\r", " pm.expect(jsonData.port).to.eql(902);\r", " pm.expect(jsonData.networkDnsSuffix).to.eql(\"intel.com\");\r", @@ -7285,7 +7285,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"proxyName\": \"proxyabc\",\r\n \"accessInfo\": \"www.proxy-abc.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 902,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", + "raw": "{\r\n \"proxyName\": \"proxyabc\",\r\n \"address\": \"www.proxy-abc.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 902,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -7309,7 +7309,7 @@ "pm.test(\"Request should return proxy just created\", function () {\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData.proxyName).to.eql(\"proxyabctest\");\r", - " pm.expect(jsonData.accessInfo).to.eql(\"www.proxy-abc.test.com\");\r", + " pm.expect(jsonData.address).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", @@ -7337,7 +7337,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"proxyName\": \"proxyabctest\",\r\n \"accessInfo\": \"www.proxy-abc.test.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 800,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", + "raw": "{\r\n \"proxyName\": \"proxyabctest\",\r\n \"address\": \"www.proxy-abc.test.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 800,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -9990,7 +9990,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"proxyName\": \"\",\r\n \"accessInfo\": \"proxy.dummy.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", + "raw": "{\r\n \"proxyName\": \"\",\r\n \"address\": \"proxy.dummy.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -10014,7 +10014,7 @@ "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(\"Server address is required\");\r", - " pm.expect(jsonData.errors[0].path).to.eql(\"accessInfo\");\r", + " pm.expect(jsonData.errors[0].path).to.eql(\"address\");\r", "});" ], "type": "text/javascript", @@ -10033,7 +10033,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"accessInfo\": \"\",\r\n \"infoFormat\": 3,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", + "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"address\": \"\",\r\n \"infoFormat\": 3,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -10076,7 +10076,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"accessInfo\": \"192.168.9.58\",\r\n \"infoFormat\": 5,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", + "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"address\": \"192.168.9.58\",\r\n \"infoFormat\": 5,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -10119,7 +10119,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"accessInfo\": \"192.168.9.58\",\r\n \"infoFormat\": 3,\r\n \"port\": 65536,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", + "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"address\": \"192.168.9.58\",\r\n \"infoFormat\": 3,\r\n \"port\": 65536,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -10162,7 +10162,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"accessInfo\": \"192.168.9.58\",\r\n \"infoFormat\": 3,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"-intel.com\"\r\n}", + "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"address\": \"192.168.9.58\",\r\n \"infoFormat\": 3,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"-intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -10185,7 +10185,7 @@ "});\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.address).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", @@ -10207,7 +10207,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"accessInfo\": \"www.vprodemo.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", + "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"address\": \"www.vprodemo.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json" @@ -10250,7 +10250,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"accessInfo\": \"www.vprodemo.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", + "raw": "{\r\n \"proxyName\": \"proxy1\",\r\n \"address\": \"www.vprodemo.com\",\r\n \"infoFormat\": 201,\r\n \"port\": 900,\r\n \"networkDnsSuffix\": \"intel.com\"\r\n}", "options": { "raw": { "language": "json"