Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions data/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Comment thread
rsdmike marked this conversation as resolved.
FOREIGN KEY (profile_name,tenant_id) REFERENCES profiles(profile_name,tenant_id),
Expand Down
18 changes: 9 additions & 9 deletions src/data/postgres/tables/proxyConfigs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions src/data/postgres/tables/proxyConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions src/models/RCS.Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -194,7 +194,7 @@ export interface TLSConfigFlow {
}

export interface mpsServer {
AccessInfo: any
address: any
InfoFormat: number
Port: number
AuthMethod: number
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/routes/admin/proxy/proxyValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
26 changes: 13 additions & 13 deletions src/test/collections/rps.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand All @@ -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",
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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",
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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",
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down