Skip to content

Commit

Permalink
fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
olasaadi99 committed Nov 4, 2024
1 parent 19b350c commit 52e2a35
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pkg/ibmvpc/implicit_routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ func isDestPublicInternet(dest *netset.IPBlock) bool {
return dest.IsSubset(publicRange)
}

func isDestServiceNetwork(dest *ipblock.IPBlock) bool {
func isDestServiceNetwork(dest *netset.IPBlock) bool {
_, serviceNetworkRange, _ := vpcmodel.GetNetworkAddressList().GetServiceNetworkIPblocksList()
return dest.ContainedIn(serviceNetworkRange)
return dest.IsSubset(serviceNetworkRange)
}

func fipHasSource(src vpcmodel.Node, fip *FloatingIP) bool {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ibmvpc/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ func (rc *IBMresourcesContainer) getPgwConfig(
return nil
}

func newSGW(sgwName string, cidr *ipblock.IPBlock) *ServiceNetworkGateway {
func newSGW(sgwName string, cidr *netset.IPBlock) *ServiceNetworkGateway {
return &ServiceNetworkGateway{
VPCResource: vpcmodel.VPCResource{
ResourceName: sgwName,
Expand Down
12 changes: 6 additions & 6 deletions pkg/ibmvpc/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ func (fip *FloatingIP) IsMultipleVPCs() bool {
// we add it for convenience - it is not a resource that appears in the input configuration file.
type ServiceNetworkGateway struct {
vpcmodel.VPCResource
cidr *ipblock.IPBlock
cidr *netset.IPBlock
}

func (sgw *ServiceNetworkGateway) Cidr() *ipblock.IPBlock {
func (sgw *ServiceNetworkGateway) Cidr() *netset.IPBlock {
return sgw.cidr
}
func (sgw *ServiceNetworkGateway) Sources() []vpcmodel.Node {
Expand All @@ -306,12 +306,12 @@ func (sgw *ServiceNetworkGateway) Destinations() []vpcmodel.Node {
func (sgw *ServiceNetworkGateway) SetExternalDestinations(destinations []vpcmodel.Node) {
}

func (sgw *ServiceNetworkGateway) AllowedConnectivity(src, dst vpcmodel.VPCResourceIntf) (*connection.Set, error) {
func (sgw *ServiceNetworkGateway) AllowedConnectivity(src, dst vpcmodel.VPCResourceIntf) (*netset.TransportSet, error) {
if areNodes, _, dst1 := isNodesPair(src, dst); areNodes {
if dst1.IsExternal() && !dst1.IsPublicInternet() {
return connection.All(), nil
return netset.AllTransports(), nil
}
return connection.None(), nil
return netset.NoTransports(), nil
}
return nil, errors.New("ServiceNetworkGateway.AllowedConnectivity unexpected src/dst types")
}
Expand Down Expand Up @@ -387,7 +387,7 @@ func (pgw *PublicGateway) AllowedConnectivity(src, dst vpcmodel.VPCResourceIntf)
srcSubnet := src.(*commonvpc.Subnet)
if dstNode, ok := dst.(vpcmodel.Node); ok {
if dstNode.IsExternal() && dstNode.IsPublicInternet() && hasSubnet(pgw.srcSubnets, srcSubnet) {
netset.AllTransports(), nil
return netset.AllTransports(), nil
}
return netset.NoTransports(), nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/vpcmodel/explainabilityInput.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ func (c *VPCConfig) getCidrExternalNodes(inputIPBlock *netset.IPBlock) (cidrNode
externalType := publicInternetNodeName
isPublicInternet := true
_, ip, _ := GetNetworkAddressList().GetServiceNetworkIPblocksList()
if block.ContainedIn(ip) {
if block.IsSubset(ip) {
externalType = serviceNetworkNodeName
isPublicInternet = false
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/vpcmodel/externalNetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ func GetDefaultPublicInternetAddressList() []string {
}
}

func (n *NetworkAddressLists) GetPublicInternetIPblocksList() (internetIPblocksList []*ipblock.IPBlock,
allInternetRagnes *ipblock.IPBlock, err error) {
func (n *NetworkAddressLists) GetPublicInternetIPblocksList() (internetIPblocksList []*netset.IPBlock,
allInternetRagnes *netset.IPBlock, err error) {
if len(n.publicInternetAddressList) == 0 {
return ipStringsToIPblocks(GetDefaultPublicInternetAddressList())
}
return ipStringsToIPblocks(n.publicInternetAddressList)
}

func (n *NetworkAddressLists) GetServiceNetworkIPblocksList() (serviceNetworkIPblocksList []*ipblock.IPBlock,
serviceNetworkRagnes *ipblock.IPBlock, err error) {
func (n *NetworkAddressLists) GetServiceNetworkIPblocksList() (serviceNetworkIPblocksList []*netset.IPBlock,
serviceNetworkRagnes *netset.IPBlock, err error) {
return ipStringsToIPblocks(n.serviceNetworkAddressList)
}

Expand Down Expand Up @@ -219,14 +219,14 @@ func GetExternalNetworkNodes(disjointRefExternalIPBlocks []*netset.IPBlock) ([]N
}
for _, ipb := range disjointRefExternalIPBlocksServiceNetwork {
var isPublicInternet bool
if ipb.ContainedIn(serviceNetworkRagnes) {
if ipb.IsSubset(serviceNetworkRagnes) {
isPublicInternet = false
} else {
continue
}
cidrs := ipb.ToCidrList()
for _, cidr := range cidrs {
nodeIPBlock, err := ipblock.FromCidr(cidr)
nodeIPBlock, err := netset.IPBlockFromCidr(cidr)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 52e2a35

Please sign in to comment.