Skip to content

Convert netmask to CIDR notation for ip command!#26

Open
Anushree-Mathur wants to merge 1 commit into
lop-devops:KVMCIfrom
Anushree-Mathur:PCI_CICD_notation
Open

Convert netmask to CIDR notation for ip command!#26
Anushree-Mathur wants to merge 1 commit into
lop-devops:KVMCIfrom
Anushree-Mathur:PCI_CICD_notation

Conversation

@Anushree-Mathur

Copy link
Copy Markdown

The 'ip addr add' command requires CIDR notation (e.g., /24) but the test was using dotted decimal netmask format (e.g., 255.255.255.0), causing the command to hang and timeout.

Add netmask_to_cidr() helper function that converts dotted decimal netmask to CIDR notation by counting the number of 1 bits in the binary representation.

Example: 255.255.255.0 → 11111111.11111111.11111111.00000000 → /24

Signed-off-by: Anushree-Mathur anushree.mathur@linux.ibm.com

The 'ip addr add' command requires CIDR notation (e.g., /24) but the test
was using dotted decimal netmask format (e.g., 255.255.255.0), causing the
command to hang and timeout.

Add netmask_to_cidr() helper function that converts dotted decimal netmask
to CIDR notation by counting the number of 1 bits in the binary representation.

Example: 255.255.255.0 → 11111111.11111111.11111111.00000000 → /24

Signed-off-by: Anushree-Mathur <anushree.mathur@linux.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant