Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
support sci state for express route link
  • Loading branch information
kairu-ms committed Jul 12, 2021
commit d09a3c3bbb8a33369ff6d8b30882c9678fd8015a
3 changes: 2 additions & 1 deletion src/azure-cli/azure/cli/command_modules/network/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -2943,7 +2943,8 @@
--name link1 \\
--macsec-ckn-secret-identifier MacSecCKNSecretID \\
--macsec-cak-secret-identifier MacSecCAKSecretID \\
--macsec-cipher gcm-aes-128
--macsec-cipher GcmAes128 \\
--macsec-sci-state
- name: Enable administrative state of an ExpressRoute Link.
text: |-
az network express-route port link update \\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ def load_arguments(self, _):
c.argument('macsec_ckn_secret_identifier',
help='The connectivity key name (CKN) that stored in the KeyVault.')
c.argument('macsec_cipher', arg_type=express_route_link_macsec_cipher_type, help='Cipher Method')
c.argument('macsec_sci_state', arg_type=get_three_state_flag(positive_label='Enabled', negative_label='Disabled', return_label=True), help='Sci mode', min_api='2020-06-01')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this type the same as admin_state above? It seems very similar and is it possible that we can share a common arg_type?


with self.argument_context('network express-route port location', min_api='2018-08-01') as c:
c.argument('location_name', options_list=['--location', '-l'])
Expand Down
8 changes: 5 additions & 3 deletions src/azure-cli/azure/cli/command_modules/network/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2999,7 +2999,7 @@ def show_express_route_port_identity(cmd, resource_group_name, express_route_por

def update_express_route_port_link(cmd, instance, express_route_port_name, link_name,
macsec_cak_secret_identifier=None, macsec_ckn_secret_identifier=None,
macsec_cipher=None, admin_state=None):
macsec_sci_state=None, macsec_cipher=None, admin_state=None):
"""
:param cmd:
:param instance: an instance of ExpressRoutePort
Expand All @@ -3020,16 +3020,18 @@ def update_express_route_port_link(cmd, instance, express_route_port_name, link_
except Exception:
raise CLIError('ExpressRoute Link "{}" not found'.format(link_name))

if any([macsec_cak_secret_identifier, macsec_ckn_secret_identifier, macsec_cipher]):
if any([macsec_cak_secret_identifier, macsec_ckn_secret_identifier, macsec_cipher, macsec_sci_state]):
instance.links[link_index].mac_sec_config.cak_secret_identifier = macsec_cak_secret_identifier
instance.links[link_index].mac_sec_config.ckn_secret_identifier = macsec_ckn_secret_identifier

# TODO https://github.com/Azure/azure-rest-api-specs/issues/7569
# need to remove this conversion when the issue is fixed.
if macsec_cipher is not None:
macsec_ciphers_tmp = {'gcm-aes-128': 'GcmAes128', 'gcm-aes-256': 'GcmAes256'}
macsec_cipher = macsec_ciphers_tmp[macsec_cipher]
if macsec_cipher in macsec_ciphers_tmp:
macsec_cipher = macsec_ciphers_tmp[macsec_cipher]
instance.links[link_index].mac_sec_config.cipher = macsec_cipher
instance.links[link_index].mac_sec_config.sci_state = macsec_sci_state

if admin_state is not None:
instance.links[link_index].admin_state = admin_state
Expand Down