Skip to content

Commit 0bb2d2c

Browse files
jaer-tsuntamilmani1989
authored andcommitted
Renaming and modifying NetworkContainerOrchestratorInfo (Azure#112)
* Rename NetworkContainerOrchestratorInfo -> OrchestratorInfo and modify its structure and content. * Split api into api and dnccontract.
1 parent 9f6ebad commit 0bb2d2c

File tree

2 files changed

+132
-117
lines changed

2 files changed

+132
-117
lines changed

cns/api.go

Lines changed: 11 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@ package cns
55

66
// Container Network Service remote API Contract
77
const (
8-
SetEnvironmentPath = "/network/environment"
9-
CreateNetworkPath = "/network/create"
10-
DeleteNetworkPath = "/network/delete"
11-
ReserveIPAddressPath = "/network/ip/reserve"
12-
ReleaseIPAddressPath = "/network/ip/release"
13-
GetHostLocalIPPath = "/network/ip/hostlocal"
14-
GetIPAddressUtilizationPath = "/network/ip/utilization"
15-
GetUnhealthyIPAddressesPath = "/network/ipaddresses/unhealthy"
16-
GetHealthReportPath = "/network/health"
17-
V1Prefix = "/v0.1"
18-
V2Prefix = "/v0.2"
19-
CreateOrUpdateNetworkContainer = "/network/createorupdatenetworkcontainer"
20-
DeleteNetworkContainer = "/network/deletenetworkcontainer"
21-
GetNetworkContainerStatus = "/network/getnetworkcontainerstatus"
22-
GetInterfaceForContainer = "/network/getinterfaceforcontainer"
8+
SetEnvironmentPath = "/network/environment"
9+
CreateNetworkPath = "/network/create"
10+
DeleteNetworkPath = "/network/delete"
11+
ReserveIPAddressPath = "/network/ip/reserve"
12+
ReleaseIPAddressPath = "/network/ip/release"
13+
GetHostLocalIPPath = "/network/ip/hostlocal"
14+
GetIPAddressUtilizationPath = "/network/ip/utilization"
15+
GetUnhealthyIPAddressesPath = "/network/ipaddresses/unhealthy"
16+
GetHealthReportPath = "/network/health"
17+
V1Prefix = "/v0.1"
18+
V2Prefix = "/v0.2"
2319
)
2420

2521
// SetEnvironmentRequest describes the Request to set the environment in CNS.
@@ -110,105 +106,3 @@ type OptionMap map[string]interface{}
110106
type errorResponse struct {
111107
Err string
112108
}
113-
114-
// CreateNetworkContainerRequest specifies request to create a network container or network isolation boundary.
115-
type CreateNetworkContainerRequest struct {
116-
Version string
117-
NetworkContainerType string
118-
NetworkContainerid string // Mandatory input.
119-
PrimaryInterfaceIdentifier string // Primary CA.
120-
AuthorizationToken string
121-
NetworkContainerOrchestratorInfo NetworkContainerOrchestratorInfo
122-
IPConfiguration IPConfiguration
123-
MultiTenancyInfo MultiTenancyInfo
124-
VnetAddressSpace []IPSubnet // To setup SNAT (should include service endpoint vips).
125-
Routes []Route
126-
}
127-
128-
// NetworkContainerOrchestratorInfo contains orchestrator type, pod name and pod namespace.
129-
type NetworkContainerOrchestratorInfo struct {
130-
OrchestratorType string
131-
PodName string
132-
PodNamespace string
133-
}
134-
135-
// MultiTenancyInfo contains encap type and id.
136-
type MultiTenancyInfo struct {
137-
EncapType string
138-
ID int // This can be vlanid, vxlanid, gre-key etc. (depends on EnacapType).
139-
}
140-
141-
// IPConfiguration contains details about ip config to provision in the VM.
142-
type IPConfiguration struct {
143-
IPSubnet IPSubnet
144-
DNSServers []string
145-
GatewayIPAddress string
146-
}
147-
148-
// IPSubnet contains ip subnet.
149-
type IPSubnet struct {
150-
IPAddress string
151-
PrefixLength uint8
152-
}
153-
154-
// Route describes an entry in routing table.
155-
type Route struct {
156-
IPAddress string
157-
GatewayIPAddress string
158-
InterfaceToUse string
159-
}
160-
161-
// CreateNetworkContainerResponse specifies response of creating a network container.
162-
type CreateNetworkContainerResponse struct {
163-
Response Response
164-
}
165-
166-
// GetNetworkContainerStatusRequest specifies the details about the request to retrieve status of a specifc network container.
167-
type GetNetworkContainerStatusRequest struct {
168-
NetworkContainerid string
169-
}
170-
171-
// GetNetworkContainerStatusResponse specifies response of retriving a network container status.
172-
type GetNetworkContainerStatusResponse struct {
173-
NetworkContainerid string
174-
Version string
175-
AzureHostVersion string
176-
Response Response
177-
}
178-
179-
// GetNetworkContainerRequest specifies the details about the request to retrieve a specifc network container.
180-
type GetNetworkContainerRequest struct {
181-
}
182-
183-
// GetNetworkContainerResponse describes the response to retrieve a specifc network container.
184-
type GetNetworkContainerResponse struct {
185-
Response Response
186-
}
187-
188-
// DeleteNetworkContainerRequest specifies the details about the request to delete a specifc network container.
189-
type DeleteNetworkContainerRequest struct {
190-
NetworkContainerid string
191-
}
192-
193-
// DeleteNetworkContainerResponse describes the response to delete a specifc network container.
194-
type DeleteNetworkContainerResponse struct {
195-
Response Response
196-
}
197-
198-
// GetInterfaceForContainerRequest specifies the container ID for which interface needs to be identified.
199-
type GetInterfaceForContainerRequest struct {
200-
NetworkContainerID string
201-
}
202-
203-
// GetInterfaceForContainerResponse specifies the interface for a given container ID.
204-
type GetInterfaceForContainerResponse struct {
205-
NetworkInterface NetworkInterface
206-
VnetAddressSpace []IPSubnet
207-
Response Response
208-
}
209-
210-
// NetworkInterface specifies the information that can be used to unquely identify an interface.
211-
type NetworkInterface struct {
212-
Name string
213-
IPAddress string
214-
}

cns/dnccontract.go

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
package cns
2+
3+
// Container Network Service DNC Contract
4+
const (
5+
CreateOrUpdateNetworkContainer = "/network/createorupdatenetworkcontainer"
6+
DeleteNetworkContainer = "/network/deletenetworkcontainer"
7+
GetNetworkContainerStatus = "/network/getnetworkcontainerstatus"
8+
GetInterfaceForContainer = "/network/getinterfaceforcontainer"
9+
)
10+
11+
// Orchestrator Types
12+
const (
13+
AzureContainerInstance = "AzureContainerInstance"
14+
)
15+
16+
// CreateNetworkContainerRequest specifies request to create a network container or network isolation boundary.
17+
type CreateNetworkContainerRequest struct {
18+
Version string
19+
NetworkContainerType string
20+
NetworkContainerid string // Mandatory input.
21+
PrimaryInterfaceIdentifier string // Primary CA.
22+
AuthorizationToken string
23+
OrchestratorInfo OrchestratorInfo
24+
IPConfiguration IPConfiguration
25+
MultiTenancyInfo MultiTenancyInfo
26+
VnetAddressSpace []IPSubnet // To setup SNAT (should include service endpoint vips).
27+
Routes []Route
28+
}
29+
30+
// OrchestratorInfo contains orchestrator type which is used to cast OrchestratorContext.
31+
type OrchestratorInfo struct {
32+
OrchestratorType string
33+
OrchestratorContext interface{}
34+
}
35+
36+
// AzureContainerInstanceInfo is an OrchestratorContext that holds PodName and PodNamespace.
37+
type AzureContainerInstanceInfo struct {
38+
PodName string
39+
PodNamespace string
40+
}
41+
42+
// MultiTenancyInfo contains encap type and id.
43+
type MultiTenancyInfo struct {
44+
EncapType string
45+
ID int // This can be vlanid, vxlanid, gre-key etc. (depends on EnacapType).
46+
}
47+
48+
// IPConfiguration contains details about ip config to provision in the VM.
49+
type IPConfiguration struct {
50+
IPSubnet IPSubnet
51+
DNSServers []string
52+
GatewayIPAddress string
53+
}
54+
55+
// IPSubnet contains ip subnet.
56+
type IPSubnet struct {
57+
IPAddress string
58+
PrefixLength uint8
59+
}
60+
61+
// Route describes an entry in routing table.
62+
type Route struct {
63+
IPAddress string
64+
GatewayIPAddress string
65+
InterfaceToUse string
66+
}
67+
68+
// CreateNetworkContainerResponse specifies response of creating a network container.
69+
type CreateNetworkContainerResponse struct {
70+
Response Response
71+
}
72+
73+
// GetNetworkContainerStatusRequest specifies the details about the request to retrieve status of a specifc network container.
74+
type GetNetworkContainerStatusRequest struct {
75+
NetworkContainerid string
76+
}
77+
78+
// GetNetworkContainerStatusResponse specifies response of retriving a network container status.
79+
type GetNetworkContainerStatusResponse struct {
80+
NetworkContainerid string
81+
Version string
82+
AzureHostVersion string
83+
Response Response
84+
}
85+
86+
// GetNetworkContainerRequest specifies the details about the request to retrieve a specifc network container.
87+
type GetNetworkContainerRequest struct {
88+
}
89+
90+
// GetNetworkContainerResponse describes the response to retrieve a specifc network container.
91+
type GetNetworkContainerResponse struct {
92+
Response Response
93+
}
94+
95+
// DeleteNetworkContainerRequest specifies the details about the request to delete a specifc network container.
96+
type DeleteNetworkContainerRequest struct {
97+
NetworkContainerid string
98+
}
99+
100+
// DeleteNetworkContainerResponse describes the response to delete a specifc network container.
101+
type DeleteNetworkContainerResponse struct {
102+
Response Response
103+
}
104+
105+
// GetInterfaceForContainerRequest specifies the container ID for which interface needs to be identified.
106+
type GetInterfaceForContainerRequest struct {
107+
NetworkContainerID string
108+
}
109+
110+
// GetInterfaceForContainerResponse specifies the interface for a given container ID.
111+
type GetInterfaceForContainerResponse struct {
112+
NetworkInterface NetworkInterface
113+
VnetAddressSpace []IPSubnet
114+
Response Response
115+
}
116+
117+
// NetworkInterface specifies the information that can be used to unquely identify an interface.
118+
type NetworkInterface struct {
119+
Name string
120+
IPAddress string
121+
}

0 commit comments

Comments
 (0)