Skip to content

Commit 0a5a848

Browse files
fix: updated the macsec fields as per latest api spec
1 parent cc280f2 commit 0a5a848

File tree

2 files changed

+128
-54
lines changed

2 files changed

+128
-54
lines changed

direct-link/v1.ts

Lines changed: 106 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ class DirectLinkV1 extends BaseService {
293293
* any macsec_config fields, no other fields may be specified in the patch request. Contact IBM support for access to
294294
* MACsec.
295295
*
296-
* Keys used for MACsec configuration must have names with an even number of characters from [0-9a-fA-F].
296+
* A MACsec config cannot be added to a gateway created without MACsec.
297297
* @param {boolean} [params.metered] - Metered billing option. When `true` gateway usage is billed per gigabyte.
298298
* When `false` there is no per gigabyte usage charge, instead a flat rate is charged for the gateway.
299299
* @param {string} [params.name] - The unique user-defined name for this gateway.
@@ -589,7 +589,8 @@ class DirectLinkV1 extends BaseService {
589589
/**
590590
* Gateway statistics.
591591
*
592-
* Retrieve gateway statistics. Specify statistic to retrieve using required `type` query parameter.
592+
* Retrieve gateway statistics. Specify statistic to retrieve using required `type` query parameter. Currently data
593+
* retrieval is only supported for MACsec configurations.
593594
*
594595
* @param {Object} params - The parameters to send to the service.
595596
* @param {string} params.id - Direct Link Dedicated gateway identifier.
@@ -1241,7 +1242,7 @@ namespace DirectLinkV1 {
12411242
/** MACsec configuration information. When patching any macsec_config fields, no other fields may be specified
12421243
* in the patch request. Contact IBM support for access to MACsec.
12431244
*
1244-
* Keys used for MACsec configuration must have names with an even number of characters from [0-9a-fA-F].
1245+
* A MACsec config cannot be added to a gateway created without MACsec.
12451246
*/
12461247
macsecConfig?: GatewayMacsecConfigPatchTemplate;
12471248
/** Metered billing option. When `true` gateway usage is billed per gigabyte. When `false` there is no per
@@ -1600,84 +1601,150 @@ namespace DirectLinkV1 {
16001601
gateways: Gateway[];
16011602
}
16021603

1603-
/** MACsec connectivity association key. */
1604-
export interface GatewayMacsecCak {
1605-
/** connectivity association key. */
1606-
crn: string;
1607-
}
1608-
16091604
/** MACsec configuration information. For Dedicated Gateways with MACsec configured, return configuration information. Contact IBM support for access to MACsec. */
16101605
export interface GatewayMacsecConfig {
1611-
/** Indicate whether MACsec protection should be active (true) or inactive (false) for this MACsec enabled
1612-
* gateway.
1606+
/** Indicate whether MACsec should currently be active (true) or inactive (false) for a MACsec enabled gateway.
1607+
* To be MACsec enabled a `macsec_config` must be specified at gateway create time.
16131608
*/
16141609
active: boolean;
1615-
/** Active connectivity association key. Normally will be the same as the primary_cak. During CAK changes this
1616-
* field can be used to indicate which key is currently active.
1610+
/** Active connectivity association key.
1611+
*
1612+
* During normal operation `active_cak` will match the desired `primary_cak`. During CAK changes this field can be
1613+
* used to indicate which key is currently active on the gateway.
16171614
*/
1618-
active_cak?: GatewayMacsecCak;
1615+
active_cak?: GatewayMacsecConfigActiveCak;
16191616
/** SAK cipher suite. */
16201617
cipher_suite?: string;
16211618
/** confidentiality offset. */
1622-
confidentiality_offset: number;
1619+
confidentiality_offset?: number;
16231620
/** cryptographic algorithm. */
16241621
cryptographic_algorithm?: string;
16251622
/** fallback connectivity association key. */
1626-
fallback_cak?: GatewayMacsecCak;
1623+
fallback_cak?: GatewayMacsecConfigFallbackCak;
16271624
/** key server priority. */
16281625
key_server_priority?: number;
16291626
/** desired primary connectivity association key. */
1630-
primary_cak: GatewayMacsecCak;
1627+
primary_cak: GatewayMacsecConfigPrimaryCak;
16311628
/** Secure Association Key (SAK) expiry time in seconds. */
16321629
sak_expiry_time?: number;
1633-
/** The current status of MACsec on the device for this gateway. Status 'unknown' is returned during gateway
1634-
* creation and deletion.
1630+
/** Packets without MACsec headers are not dropped when security_policy is `should_secure`. */
1631+
security_policy?: string;
1632+
/** Current status of MACsec on the device for this gateway. Status 'unknown' is returned during gateway
1633+
* creation and deletion. Status `key_error` indicates Direct Link was unable to retrieve key materials for one of
1634+
* the specified. This usually due to inadequate service to service authorization. Verify the key exists and
1635+
* verify a service to service policy exists authorization the Direct Link service to access its key material.
1636+
* Correct any problems and respecify the desired key. If the problem persists contact IBM support.
16351637
*/
16361638
status: string;
16371639
/** replay protection window size. */
16381640
window_size?: number;
16391641
}
16401642

1641-
/** MACsec configuration information. When patching any macsec_config fields, no other fields may be specified in the patch request. Contact IBM support for access to MACsec. Keys used for MACsec configuration must have names with an even number of characters from [0-9a-fA-F]. */
1643+
/** Active connectivity association key. During normal operation `active_cak` will match the desired `primary_cak`. During CAK changes this field can be used to indicate which key is currently active on the gateway. */
1644+
export interface GatewayMacsecConfigActiveCak {
1645+
/** connectivity association key crn. */
1646+
crn: string;
1647+
/** connectivity association key status. */
1648+
status: string;
1649+
}
1650+
1651+
/** fallback connectivity association key. */
1652+
export interface GatewayMacsecConfigFallbackCak {
1653+
/** connectivity association key crn. */
1654+
crn: string;
1655+
/** connectivity association key status. */
1656+
status: string;
1657+
}
1658+
1659+
/** MACsec configuration information. When patching any macsec_config fields, no other fields may be specified in the patch request. Contact IBM support for access to MACsec. A MACsec config cannot be added to a gateway created without MACsec. */
16421660
export interface GatewayMacsecConfigPatchTemplate {
16431661
/** Indicate whether MACsec protection should be active (true) or inactive (false) for this MACsec enabled
16441662
* gateway.
16451663
*/
16461664
active?: boolean;
1647-
/** Fallback connectivity association key. Keys used for MACsec configuration must have names with an even
1648-
* number of characters from [0-9a-fA-F].
1665+
/** Fallback connectivity association key.
1666+
*
1667+
* The `fallback_cak` crn cannot match the `primary_cak` crn.
1668+
*
1669+
* MACsec keys must be type=standard with key name lengths between 2 to 64 inclusive and contain only characters
1670+
* [a-fA-F0-9].
1671+
* The key material must be exactly 64 characters in length and contain only [a-fA-F0-9].
1672+
*
1673+
* To clear the optional `fallback_cak` field patch its crn to `""`.
1674+
*
1675+
* A gateway's `fallback_cak` crn cannot match its `primary_cak` crn.
16491676
*/
1650-
fallback_cak?: GatewayMacsecCak;
1651-
/** Desired primary connectivity association key. Keys for a MACsec configuration must have names with an even
1652-
* number of characters from [0-9a-fA-F].
1677+
fallback_cak?: GatewayMacsecConfigPatchTemplateFallbackCak;
1678+
/** Desired primary connectivity association key.
1679+
*
1680+
* MACsec keys must be type=standard with key name lengths between 2 to 64 inclusive and contain only characters
1681+
* [a-fA-F0-9].
1682+
* The key material must be exactly 64 characters in length and contain only [a-fA-F0-9].
1683+
*
1684+
* A gateway's `primary_cak` crn cannot match its `fallback_cak` crn.
16531685
*/
1654-
primary_cak?: GatewayMacsecCak;
1655-
/** Secure Association Key (SAK) expiry time in seconds. */
1656-
sak_expiry_time?: number;
1686+
primary_cak?: GatewayMacsecConfigPatchTemplatePrimaryCak;
16571687
/** replay protection window size. */
16581688
window_size?: number;
16591689
}
16601690

1661-
/** MACsec configuration information. Contact IBM support for access to MACsec. Keys used for MACsec configuration must have names with an even number of characters from [0-9a-fA-F]. */
1691+
/** Fallback connectivity association key. The `fallback_cak` crn cannot match the `primary_cak` crn. MACsec keys must be type=standard with key name lengths between 2 to 64 inclusive and contain only characters [a-fA-F0-9]. The key material must be exactly 64 characters in length and contain only [a-fA-F0-9]. To clear the optional `fallback_cak` field patch its crn to `""`. A gateway's `fallback_cak` crn cannot match its `primary_cak` crn. */
1692+
export interface GatewayMacsecConfigPatchTemplateFallbackCak {
1693+
/** connectivity association key crn. */
1694+
crn: string;
1695+
}
1696+
1697+
/** Desired primary connectivity association key. MACsec keys must be type=standard with key name lengths between 2 to 64 inclusive and contain only characters [a-fA-F0-9]. The key material must be exactly 64 characters in length and contain only [a-fA-F0-9]. A gateway's `primary_cak` crn cannot match its `fallback_cak` crn. */
1698+
export interface GatewayMacsecConfigPatchTemplatePrimaryCak {
1699+
/** connectivity association key crn. */
1700+
crn: string;
1701+
}
1702+
1703+
/** desired primary connectivity association key. */
1704+
export interface GatewayMacsecConfigPrimaryCak {
1705+
/** connectivity association key crn. */
1706+
crn: string;
1707+
/** connectivity association key status. */
1708+
status: string;
1709+
}
1710+
1711+
/** MACsec configuration information. Contact IBM support for access to MACsec. */
16621712
export interface GatewayMacsecConfigTemplate {
16631713
/** Indicate whether MACsec protection should be active (true) or inactive (false) for this MACsec enabled
16641714
* gateway.
16651715
*/
16661716
active: boolean;
1667-
/** Fallback connectivity association key. Keys used for MACsec configuration must have names with an even
1668-
* number of characters from [0-9a-fA-F].
1717+
/** Fallback connectivity association key.
1718+
*
1719+
* The `fallback_cak` crn cannot match the `primary_cak` crn.
1720+
* MACsec keys must be type=standard with key name lengths between 2 to 64 inclusive and contain only characters
1721+
* [a-fA-F0-9].
1722+
* The key material must be exactly 64 characters in length and contain only [a-fA-F0-9].
16691723
*/
1670-
fallback_cak?: GatewayMacsecCak;
1671-
/** Desired primary connectivity association key. Keys used for MACsec configuration must have names with an
1672-
* even number of characters from [0-9a-fA-F].
1724+
fallback_cak?: GatewayMacsecConfigTemplateFallbackCak;
1725+
/** Desired primary connectivity association key.
1726+
*
1727+
* MACsec keys must be type=standard with key name lengths between 2 to 64 inclusive and contain only characters
1728+
* [a-fA-F0-9].
1729+
* The key material must be exactly 64 characters in length and contain only [a-fA-F0-9].
16731730
*/
1674-
primary_cak: GatewayMacsecCak;
1675-
/** Secure Association Key (SAK) expiry time in seconds. */
1676-
sak_expiry_time?: number;
1731+
primary_cak: GatewayMacsecConfigTemplatePrimaryCak;
16771732
/** replay protection window size. */
16781733
window_size?: number;
16791734
}
16801735

1736+
/** Fallback connectivity association key. The `fallback_cak` crn cannot match the `primary_cak` crn. MACsec keys must be type=standard with key name lengths between 2 to 64 inclusive and contain only characters [a-fA-F0-9]. The key material must be exactly 64 characters in length and contain only [a-fA-F0-9]. */
1737+
export interface GatewayMacsecConfigTemplateFallbackCak {
1738+
/** connectivity association key crn. */
1739+
crn: string;
1740+
}
1741+
1742+
/** Desired primary connectivity association key. MACsec keys must be type=standard with key name lengths between 2 to 64 inclusive and contain only characters [a-fA-F0-9]. The key material must be exactly 64 characters in length and contain only [a-fA-F0-9]. */
1743+
export interface GatewayMacsecConfigTemplatePrimaryCak {
1744+
/** connectivity association key crn. */
1745+
crn: string;
1746+
}
1747+
16811748
/** gateway port for type=connect gateways. */
16821749
export interface GatewayPort {
16831750
/** Port Identifier. */
@@ -1690,7 +1757,7 @@ namespace DirectLinkV1 {
16901757
id: string;
16911758
}
16921759

1693-
/** MACsec statistics. */
1760+
/** Gateway statistics. Currently data retrieval is only supported for MACsec configurations. */
16941761
export interface GatewayStatistic {
16951762
/** Date and time data was collected. */
16961763
created_at: string;
@@ -1930,10 +1997,7 @@ namespace DirectLinkV1 {
19301997
customer_name: string;
19311998
/** Gateway location. */
19321999
location_name: string;
1933-
/** MACsec configuration information. Contact IBM support for access to MACsec.
1934-
*
1935-
* Keys used for MACsec configuration must have names with an even number of characters from [0-9a-fA-F].
1936-
*/
2000+
/** MACsec configuration information. Contact IBM support for access to MACsec. */
19372001
macsec_config?: GatewayMacsecConfigTemplate;
19382002
}
19392003

test/unit/direct-link.v1.test.js

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,18 +174,23 @@ describe('DirectLinkV1', () => {
174174
describe('positive tests', () => {
175175
// Request models needed by this operation.
176176

177-
// GatewayMacsecCak
178-
const gatewayMacsecCakModel = {
177+
// GatewayMacsecConfigTemplateFallbackCak
178+
const gatewayMacsecConfigTemplateFallbackCakModel = {
179179
crn:
180-
'crn:v1:bluemix:public:hs-crypto:us-south:a/57a7d05f36894e3cb9b46a43556d903e:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222',
180+
'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222',
181+
};
182+
183+
// GatewayMacsecConfigTemplatePrimaryCak
184+
const gatewayMacsecConfigTemplatePrimaryCakModel = {
185+
crn:
186+
'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222',
181187
};
182188

183189
// GatewayMacsecConfigTemplate
184190
const gatewayMacsecConfigTemplateModel = {
185191
active: true,
186-
fallback_cak: gatewayMacsecCakModel,
187-
primary_cak: gatewayMacsecCakModel,
188-
sak_expiry_time: 3600,
192+
fallback_cak: gatewayMacsecConfigTemplateFallbackCakModel,
193+
primary_cak: gatewayMacsecConfigTemplatePrimaryCakModel,
189194
window_size: 148809600,
190195
};
191196

@@ -422,18 +427,23 @@ describe('DirectLinkV1', () => {
422427
describe('positive tests', () => {
423428
// Request models needed by this operation.
424429

425-
// GatewayMacsecCak
426-
const gatewayMacsecCakModel = {
430+
// GatewayMacsecConfigPatchTemplateFallbackCak
431+
const gatewayMacsecConfigPatchTemplateFallbackCakModel = {
432+
crn:
433+
'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222',
434+
};
435+
436+
// GatewayMacsecConfigPatchTemplatePrimaryCak
437+
const gatewayMacsecConfigPatchTemplatePrimaryCakModel = {
427438
crn:
428-
'crn:v1:bluemix:public:hs-crypto:us-south:a/57a7d05f36894e3cb9b46a43556d903e:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222',
439+
'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222',
429440
};
430441

431442
// GatewayMacsecConfigPatchTemplate
432443
const gatewayMacsecConfigPatchTemplateModel = {
433444
active: true,
434-
fallback_cak: gatewayMacsecCakModel,
435-
primary_cak: gatewayMacsecCakModel,
436-
sak_expiry_time: 3600,
445+
fallback_cak: gatewayMacsecConfigPatchTemplateFallbackCakModel,
446+
primary_cak: gatewayMacsecConfigPatchTemplatePrimaryCakModel,
437447
window_size: 512,
438448
};
439449

0 commit comments

Comments
 (0)