Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

255 remove stateful #48

Merged
merged 9 commits into from
Jun 18, 2024
20 changes: 12 additions & 8 deletions pkg/connection/connectionset.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func entireDimension(dim Dimension) *interval.CanonicalSet {

type Set struct {
connectionProperties *hypercube.CanonicalSet
IsStateful StatefulState
}

func None() *Set {
Expand Down Expand Up @@ -104,7 +103,6 @@ func (c *Set) Equal(other *Set) bool {
func (c *Set) Copy() *Set {
return &Set{
connectionProperties: c.connectionProperties.Copy(),
IsStateful: c.IsStateful,
}
}

Expand All @@ -128,12 +126,6 @@ func (c *Set) Union(other *Set) *Set {
}
}

// Subtract
// ToDo: Subtract seems to ignore IsStateful (see https://github.com/np-guard/vpc-network-config-analyzer/issues/199):
// 1. is the delta connection stateful
// 2. connectionProperties is identical but c stateful while other is not
// the 2nd item can be computed here, with enhancement to relevant structure
// the 1st can not since we do not know where exactly the statefulness came from
func (c *Set) Subtract(other *Set) *Set {
if c.IsEmpty() {
return None()
Expand Down Expand Up @@ -410,3 +402,15 @@ func ToJSON(c *Set) Details {

return Details(res)
}

// SwitchSrcDstPorts returns a new Set object, built from the input Set object.
// The src and dst ports on relevant cubes are being switched.
func (c *Set) SwitchSrcDstPorts() *Set {
if c.IsAll() {
return c.Copy()
}
newConn := c.connectionProperties.SwapDimensions(slices.Index(dimensionsList, srcPort), slices.Index(dimensionsList, dstPort))
return &Set{
connectionProperties: newConn,
}
}
81 changes: 0 additions & 81 deletions pkg/connection/statefulness.go

This file was deleted.

151 changes: 0 additions & 151 deletions pkg/connection/statefulness_test.go

This file was deleted.