Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions cns/NetworkContainerContract.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ type PodIpInfo struct {
PodIPConfig IPSubnet
NetworkContainerPrimaryIPConfig IPConfiguration
HostPrimaryIPInfo HostIPInfo
HostSecondaryIPInfo HostIPInfo
// NICType defines whether NIC is InfraNIC or DelegatedVMNIC or BackendNIC
NICType NICType
InterfaceName string
Expand All @@ -475,15 +474,12 @@ type PodIpInfo struct {
SkipDefaultRoutes bool
// Routes to configure on interface
Routes []Route
// AddInterfacesDataToPodInfo is set to true for SF SwiftV2 scenario
AddInterfacesDataToPodInfo bool
}

type HostIPInfo struct {
Gateway string
PrimaryIP string
SecondaryIP string
Subnet string
Gateway string
PrimaryIP string
Subnet string
}

type IPConfigRequest struct {
Expand Down
33 changes: 0 additions & 33 deletions cns/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"encoding/json"
"fmt"
"net"
"time"

"github.com/Azure/azure-container-networking/cns/common"
Expand Down Expand Up @@ -365,35 +364,3 @@ type EndpointRequest struct {
HnsEndpointID string `json:"hnsEndpointID"`
HostVethName string `json:"hostVethName"`
}

// GetEndpointResponse describes response from the The GetEndpoint API.
type GetEndpointResponse struct {
Response Response `json:"response"`
EndpointInfo EndpointInfo `json:"endpointInfo"`
}

type EndpointInfo struct {
PodName string
PodNamespace string
IfnameToIPMap map[string]*IPInfo // key : interface name, value : IPInfo
HnsEndpointID string
HostVethName string
}
type IPInfo struct {
IPv4 []net.IPNet
IPv6 []net.IPNet
}

type GetHTTPServiceDataResponse struct {
HTTPRestServiceData HTTPRestServiceData `json:"HTTPRestServiceData"`
Response Response `json:"response"`
}

// HTTPRestServiceData represents in-memory CNS data in the debug API paths.
// PodInterfaceId is key and value is slice of Pod IP uuids in PodIPIDByPodInterfaceKey
// secondaryipid(uuid) is key for PodIPConfigState
type HTTPRestServiceData struct {
PodIPIDByPodInterfaceKey map[string][]string `json:"podIPIDByPodInterfaceKey"`
PodIPConfigState map[string]IPConfigurationStatus `json:"podIpConfigState"`
IPAMPoolMonitor IpamPoolMonitorStateSnapshot `json:"ipamPoolMonitor"`
}
9 changes: 5 additions & 4 deletions cns/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/Azure/azure-container-networking/cns"
"github.com/Azure/azure-container-networking/cns/restserver"
"github.com/Azure/azure-container-networking/cns/types"
"github.com/pkg/errors"
)
Expand Down Expand Up @@ -562,7 +563,7 @@ func (c *Client) GetPodOrchestratorContext(ctx context.Context) (map[string][]st
}

// GetHTTPServiceData gets all public in-memory struct details for debugging purpose
func (c *Client) GetHTTPServiceData(ctx context.Context) (*cns.GetHTTPServiceDataResponse, error) {
func (c *Client) GetHTTPServiceData(ctx context.Context) (*restserver.GetHTTPServiceDataResponse, error) {
u := c.routes[cns.PathDebugRestData]
req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
if err != nil {
Expand All @@ -582,7 +583,7 @@ func (c *Client) GetHTTPServiceData(ctx context.Context) (*cns.GetHTTPServiceDat
if res.StatusCode != http.StatusOK {
return nil, errors.Errorf("http response %d", res.StatusCode)
}
var resp cns.GetHTTPServiceDataResponse
var resp restserver.GetHTTPServiceDataResponse
err = json.NewDecoder(bytes.NewReader(b)).Decode(&resp)
if err != nil {
return nil, errors.Wrap(err, "failed to decode GetHTTPServiceDataResponse")
Expand Down Expand Up @@ -1023,7 +1024,7 @@ func (c *Client) GetHomeAz(ctx context.Context) (*cns.GetHomeAzResponse, error)
}

// GetEndpoint calls the EndpointHandlerAPI in CNS to retrieve the state of a given EndpointID
func (c *Client) GetEndpoint(ctx context.Context, endpointID string) (*cns.GetEndpointResponse, error) {
func (c *Client) GetEndpoint(ctx context.Context, endpointID string) (*restserver.GetEndpointResponse, error) {
// build the request
u := c.routes[cns.EndpointAPI]
uString := u.String() + endpointID
Expand All @@ -1043,7 +1044,7 @@ func (c *Client) GetEndpoint(ctx context.Context, endpointID string) (*cns.GetEn
return nil, errors.Errorf("http response %d", res.StatusCode)
}

var response cns.GetEndpointResponse
var response restserver.GetEndpointResponse
err = json.NewDecoder(res.Body).Decode(&response)
if err != nil {
return nil, errors.Wrap(err, "failed to decode GetEndpointResponse")
Expand Down
Loading