Skip to content

Commit

Permalink
Merge pull request projectcalico#8083 from tomastigera/tomas-ipv6-fv-…
Browse files Browse the repository at this point in the history
…infra

fv infra for runnign full ipv6 tests
  • Loading branch information
tomastigera authored Oct 6, 2023
2 parents 5fa2b23 + c2f3390 commit 31b649d
Show file tree
Hide file tree
Showing 13 changed files with 251 additions and 77 deletions.
13 changes: 11 additions & 2 deletions felix/fv/connectivity/conncheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,12 @@ func (c *Checker) ActualConnectivity(isARetry bool) ([]*Result, []string) {

if res != nil {
if c.CheckSNAT {
srcIP := strings.Split(res.LastResponse.SourceAddr, ":")[0]
var srcIP string
if res.LastResponse.SourceAddr != "" && res.LastResponse.SourceAddr[0] == '[' {
srcIP = strings.Split(res.LastResponse.SourceAddr[1:], "]")[0]
} else {
srcIP = strings.Split(res.LastResponse.SourceAddr, ":")[0]
}
pretty[i] += " (from " + srcIP + ")"
}
if res.ClientMTU.Start != 0 {
Expand Down Expand Up @@ -439,7 +444,11 @@ type Response struct {
}

func (r *Response) SourceIP() string {
return strings.Split(r.SourceAddr, ":")[0]
if r.SourceAddr[0] != '[' {
return strings.Split(r.SourceAddr, ":")[0]
}

return strings.Split(r.SourceAddr[1:], "]")[0]
}

type ConnectionTarget interface {
Expand Down
3 changes: 3 additions & 0 deletions felix/fv/containers/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,9 @@ func (c *Container) SourceName() string {

func (c *Container) SourceIPs() []string {
ips := []string{c.IP}
if c.IPv6 != "" {
ips = append(ips, c.IPv6)
}
ips = append(ips, c.ExtraSourceIPs...)
return ips
}
Expand Down
2 changes: 1 addition & 1 deletion felix/fv/infrastructure/datastore_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/projectcalico/calico/libcalico-go/lib/apiconfig"
)

type InfraFactory func() DatastoreInfra
type InfraFactory func(...CreateOption) DatastoreInfra

// DatastoreDescribe is a replacement for ginkgo.Describe which invokes Describe
// multiple times for one or more different datastore drivers - passing in the
Expand Down
7 changes: 5 additions & 2 deletions felix/fv/infrastructure/felix.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ type Felix struct {
startupDelayed bool
restartDelayed bool
Workloads []workload

TopologyOptions TopologyOptions
}

type workload interface {
Expand Down Expand Up @@ -223,8 +225,9 @@ func RunFelix(infra DatastoreInfra, id int, options TopologyOptions) *Felix {
"-P", "FORWARD", "DROP")

return &Felix{
Container: c,
startupDelayed: options.DelayFelixStart,
Container: c,
startupDelayed: options.DelayFelixStart,
TopologyOptions: options,
}
}

Expand Down
2 changes: 1 addition & 1 deletion felix/fv/infrastructure/infra_etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type EtcdDatastoreInfra struct {
BadEndpoint string
}

func createEtcdDatastoreInfra() DatastoreInfra {
func createEtcdDatastoreInfra(opts ...CreateOption) DatastoreInfra {
infra, err := GetEtcdDatastoreInfra()
Expect(err).NotTo(HaveOccurred())
return infra
Expand Down
Loading

0 comments on commit 31b649d

Please sign in to comment.