[Fixbug 18418] [Yang] MACSEC_PROFILE table does not match yang definition (#18419)

### Why I did it
Fix the issue [18418](https://github.com/sonic-net/sonic-buildimage/issues/18418), The YANG model to MACsec fallback cak/ckn is wrong. We should allow the fallback option is empty.

### How I did it
Add a condition to check whether the fallback is providered

#### How to verify it
Check Azp
This commit is contained in:
Ze Gan 2024-03-22 07:39:02 +08:00 committed by GitHub
parent 0688aa38ae
commit 4ee6b6e8b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -30,6 +30,18 @@
"replay_window": 64, "replay_window": 64,
"send_sci": "true", "send_sci": "true",
"rekey_period": 3600 "rekey_period": 3600
},
{
"name": "test_nofallback",
"priority": 64,
"cipher_suite": "GCM-AES-XPN-256",
"primary_cak": "5207554155500e5d5157786d6c2a3d2031425a5e577e7e727f6b6c03312432262706080a00005b554f4e007975707670725b0a54540c0252445e5d7a29252b046a",
"primary_ckn": "6162636465666768696A6B6C6D6E6F706162636465666768696A6B6C6D6E6F70",
"policy": "security",
"enable_replay_protect": "true",
"replay_window": 64,
"send_sci": "true",
"rekey_period": 3600
} }
] ]
} }

View File

@ -70,9 +70,9 @@ module sonic-macsec {
} }
} }
must "string-length(fallback_cak) = string-length(primary_cak)"; must "string-length(fallback_cak) = 0 or string-length(fallback_cak) = string-length(primary_cak)";
must "primary_ckn != fallback_ckn"; must "string-length(fallback_ckn) = 0 or primary_ckn != fallback_ckn";
leaf policy { leaf policy {
type string { type string {