-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IPv6 key item support to request parser (#1449)
**What I did** Add support for parsing IPv6 key items in request parser when the key separator is `:` (e.g. in AppDB). Note: if a key contains an IPv6 address/prefix, it must be the last item in the key to be properly parsed. **Why I did it** Some components that use the request parser are being updated to support IPv6 key items (notably VnetOrch). These components also communicate with AppDB, which uses `:` as the delimiter for key items. Since IPv6 addresses are also separated with `:`, the original parsing logic will fragment an IPv6 address into multiple key items. **How I verified it** Added unit tests to verify correct parsing behavior for the following key formats: * `<string>:<valid ipv6 address or prefix>` * `<string>:<invalid ipv6 address or prefix>` (an exception should be thrown when the parser attempts to construct an `IpAddress` or `IpPrefix` object from the invalid key) * `<empty string>:<valid ipv6 address or prefix>` * `<valid ipv6 address or prefix>` **Details if related** The following 3 conditions must be met before request parser will attempt to parse an IPv6 address: * The key separator being used is `:` (IPv6 addresses can already be parsed with other key separators) * The number of parsed key items is greater than the number of expected key items (this indicates that the `:` within an IPv6 address may have been interpreted as a key separator). * The last key item type is either an IP address or an IP prefix (in any current key formats that contain an IP address, the IP address is always the last member of the key) Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
- Loading branch information
1 parent
76e2251
commit be51ebc
Showing
2 changed files
with
331 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters