mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-29 17:58:36 +08:00
fix: deploy ipv6 scripts fixes (#22900)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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",
|
||||
"",
|
||||
|
||||
Reference in New Issue
Block a user