fix: deploy ipv6 scripts fixes (#22900)

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
Jian Qiu
2025-07-15 18:59:42 +08:00
committed by GitHub
co-authored by Qiu Jian
parent 42e58b4996
commit 3e5e6e175c
5 changed files with 99 additions and 61 deletions
+9 -5
View File
@@ -199,15 +199,19 @@ func (n *Network) YAMLString() string {
return toYAMLString(n)
}
func NewDHCP4EthernetConfig() *EthernetConfig {
return &EthernetConfig{
DHCP4: true,
}
func NewDHCPEthernetConfig() *EthernetConfig {
return &EthernetConfig{}
}
func (c *EthernetConfig) EnableDHCP6() {
func (c *EthernetConfig) EnableDHCP4() *EthernetConfig {
c.DHCP4 = true
return c
}
func (c *EthernetConfig) EnableDHCP6() *EthernetConfig {
c.DHCP6 = true
c.AcceptRa = true
return c
}
func NewStaticEthernetConfig(
+2 -2
View File
@@ -21,7 +21,7 @@ import (
)
func TestNewEthernetConfig(t *testing.T) {
c := NewDHCP4EthernetConfig()
c := NewDHCPEthernetConfig().EnableDHCP4()
assert := assert.New(t)
assert.YAMLEq("dhcp4: true", c.YAMLString())
@@ -72,7 +72,7 @@ parameters:
func TestNewNetwork(t *testing.T) {
n := NewNetwork()
n.AddEthernet("eth0", NewDHCP4EthernetConfig())
n.AddEthernet("eth0", NewDHCPEthernetConfig().EnableDHCP4())
n.AddEthernet("eth1", NewStaticEthernetConfig(
"10.10.10.2/24",
"",