forked from vrnetlab/vrnetlab
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DHCP and static MAC support for management interface (#310)
* common/vrnetlab.py: added DHCP support for management interface If CLAB_MGMT_DHCP environment variable is set, we assume that a DHCP client inside of the VM will take care about setting the management IP and gateway. From the implementation point of view the IPv4 and IPv6 addresses and gateways are simply set to 'dhcp', and the platform specific `launch.py` script needs to check it to decide if the interface needs to be configured manually or to to enable dhcp (if not enabled by default). The initial implementation has been tested with Broadcom Enterprise SONiC 4.4.0 using the "dell_sonic" kind (which actually is a rebranded Broadcom SONiC). The primary focus is the ability to test the Zero Touch Provisioning feature of SONiC but could also be used for testing PXE boot scenarios of other systems using containerlab. Note: This feature is only working when CLAB_MGMT_PASSTHROUGH is true. The feature needs to be defined explicitely within the node configuration like this: -------------------------------- env: CLAB_MGMT_PASSTHROUGH: "true" CLAB_MGMT_DHCP: "true" -------------------------------- * dell_sonic: changed to check if dhcp is enabled for the management interface Manually set IPv4/IPv6 addresses and gateways only if dhcp is not enabled. * common/vrnetlab.py: added get_mgmt_mac method to VM class get_mgmt_mac() checks for the environment variable 'CLAB_MGMT_MAC' which can be used to provide a static MAC address for the management interface. If there is no static MAC address set the former behavior is preserved by calling gen_mac(0) generating a MAC address. * vrnetlab: Refactor mgmt MAC generation, handle exceptions for CSR1000v/ROS/SROS * compresss env var based var assignment --------- Co-authored-by: vista <vista@birb.network> Co-authored-by: Roman Dodin <dodin.roman@gmail.com>
- Loading branch information
1 parent
46f5e20
commit ad44c11
Showing
5 changed files
with
67 additions
and
36 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
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
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