diff --git a/Protobuild.toml b/Protobuild.toml index 47d7650fb7..8bb920851a 100644 --- a/Protobuild.toml +++ b/Protobuild.toml @@ -35,20 +35,10 @@ plugins = ["grpc", "fieldpath"] prefixes = ["github.com/Microsoft/hcsshim/internal/shimdiag"] plugins = ["ttrpc"] -# Lock down runhcs config - -[[descriptors]] -prefix = "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options" -target = "cmd/containerd-shim-runhcs-v1/options/next.pb.txt" -ignore_files = [ - "google/protobuf/descriptor.proto", - "gogoproto/gogo.proto" -] +[[overrides]] +prefixes = ["github.com/Microsoft/hcsshim/internal/computeagent"] +plugins = ["ttrpc"] -[[descriptors]] -prefix = "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/stats" -target = "cmd/containerd-shim-runhcs-v1/stats/next.pb.txt" -ignore_files = [ - "google/protobuf/descriptor.proto", - "gogoproto/gogo.proto" -] \ No newline at end of file +[[overrides]] +prefixes = ["github.com/Microsoft/hcsshim/internal/ncproxyttrpc"] +plugins = ["ttrpc"] \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 8d7065b156..e7a7b872d0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,7 +19,8 @@ build_script: - go build ./cmd/tar2ext4 - go build ./cmd/wclayer - go build ./cmd/device-util - - go build ./internal/tools/grantvmgroupaccess + - go build ./cmd/ncproxy + - go build ./internal/tools/grantvmgroupaccess - go build ./internal/tools/uvmboot - go build ./internal/tools/zapdir - go test -gcflags=all=-d=checkptr -v ./... -tags admin @@ -40,6 +41,7 @@ artifacts: - path: 'grantvmgroupaccess.exe' - path: 'uvmboot.exe' - path: 'zapdir.exe' + - path: 'ncproxy.exe' - path: './test/containerd-shim-runhcs-v1.test.exe' - path: './test/cri-containerd.test.exe' - path: './test/functional.test.exe' diff --git a/cmd/containerd-shim-runhcs-v1/options/next.pb.txt b/cmd/containerd-shim-runhcs-v1/options/next.pb.txt index bbeee50f43..e69de29bb2 100755 --- a/cmd/containerd-shim-runhcs-v1/options/next.pb.txt +++ b/cmd/containerd-shim-runhcs-v1/options/next.pb.txt @@ -1,221 +0,0 @@ -file { - name: "google/protobuf/timestamp.proto" - package: "google.protobuf" - message_type { - name: "Timestamp" - field { - name: "seconds" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_INT64 - json_name: "seconds" - } - field { - name: "nanos" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_INT32 - json_name: "nanos" - } - } - options { - java_package: "com.google.protobuf" - java_outer_classname: "TimestampProto" - java_multiple_files: true - go_package: "github.com/golang/protobuf/ptypes/timestamp" - cc_enable_arenas: true - objc_class_prefix: "GPB" - csharp_namespace: "Google.Protobuf.WellKnownTypes" - } - syntax: "proto3" -} -file { - name: "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options/runhcs.proto" - package: "containerd.runhcs.v1" - dependency: "gogoproto/gogo.proto" - dependency: "google/protobuf/timestamp.proto" - message_type { - name: "Options" - field { - name: "debug" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_BOOL - json_name: "debug" - } - field { - name: "debug_type" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_ENUM - type_name: ".containerd.runhcs.v1.Options.DebugType" - json_name: "debugType" - } - field { - name: "registry_root" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "registryRoot" - } - field { - name: "sandbox_image" - number: 4 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "sandboxImage" - } - field { - name: "sandbox_platform" - number: 5 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "sandboxPlatform" - } - field { - name: "sandbox_isolation" - number: 6 - label: LABEL_OPTIONAL - type: TYPE_ENUM - type_name: ".containerd.runhcs.v1.Options.SandboxIsolation" - json_name: "sandboxIsolation" - } - field { - name: "boot_files_root_path" - number: 7 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "bootFilesRootPath" - } - field { - name: "vm_processor_count" - number: 8 - label: LABEL_OPTIONAL - type: TYPE_INT32 - json_name: "vmProcessorCount" - } - field { - name: "vm_memory_size_in_mb" - number: 9 - label: LABEL_OPTIONAL - type: TYPE_INT32 - json_name: "vmMemorySizeInMb" - } - field { - name: "GPUVHDPath" - number: 10 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "GPUVHDPath" - } - field { - name: "scale_cpu_limits_to_sandbox" - number: 11 - label: LABEL_OPTIONAL - type: TYPE_BOOL - json_name: "scaleCpuLimitsToSandbox" - } - enum_type { - name: "DebugType" - value { - name: "NPIPE" - number: 0 - } - value { - name: "FILE" - number: 1 - } - value { - name: "ETW" - number: 2 - } - } - enum_type { - name: "SandboxIsolation" - value { - name: "PROCESS" - number: 0 - } - value { - name: "HYPERVISOR" - number: 1 - } - } - } - message_type { - name: "ProcessDetails" - field { - name: "image_name" - number: 1 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "imageName" - } - field { - name: "created_at" - number: 2 - label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".google.protobuf.Timestamp" - options { - 65001: 0 - 65010: 1 - } - json_name: "createdAt" - } - field { - name: "kernel_time_100_ns" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "kernelTime100Ns" - } - field { - name: "memory_commit_bytes" - number: 4 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "memoryCommitBytes" - } - field { - name: "memory_working_set_private_bytes" - number: 5 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "memoryWorkingSetPrivateBytes" - } - field { - name: "memory_working_set_shared_bytes" - number: 6 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "memoryWorkingSetSharedBytes" - } - field { - name: "process_id" - number: 7 - label: LABEL_OPTIONAL - type: TYPE_UINT32 - json_name: "processId" - } - field { - name: "user_time_100_ns" - number: 8 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "userTime100Ns" - } - field { - name: "exec_id" - number: 9 - label: LABEL_OPTIONAL - type: TYPE_STRING - json_name: "execId" - } - } - options { - go_package: "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options;options" - } - weak_dependency: 0 - syntax: "proto3" -} diff --git a/cmd/containerd-shim-runhcs-v1/options/runhcs.pb.go b/cmd/containerd-shim-runhcs-v1/options/runhcs.pb.go index 76ef109634..1be269e296 100644 --- a/cmd/containerd-shim-runhcs-v1/options/runhcs.pb.go +++ b/cmd/containerd-shim-runhcs-v1/options/runhcs.pb.go @@ -123,16 +123,19 @@ type Options struct { ScaleCpuLimitsToSandbox bool `protobuf:"varint,11,opt,name=scale_cpu_limits_to_sandbox,json=scaleCpuLimitsToSandbox,proto3" json:"scale_cpu_limits_to_sandbox,omitempty"` // default_container_scratch_size_in_gb is the default scratch size (sandbox.vhdx) // to be used for containers. Every container will get a sandbox of `size_in_gb` assigned - // instead of the familiar 20GB as usual. + // instead of the default of 20GB. DefaultContainerScratchSizeInGb int32 `protobuf:"varint,12,opt,name=default_container_scratch_size_in_gb,json=defaultContainerScratchSizeInGb,proto3" json:"default_container_scratch_size_in_gb,omitempty"` - // default_container_scratch_size_in_gb is the default scratch size (sandbox.vhdx) + // default_vm_scratch_size_in_gb is the default scratch size (sandbox.vhdx) // to be used for the UVM. This only applies to WCOW as LCOW doesn't mount a scratch // specifically for the UVM. DefaultVmScratchSizeInGb int32 `protobuf:"varint,13,opt,name=default_vm_scratch_size_in_gb,json=defaultVmScratchSizeInGb,proto3" json:"default_vm_scratch_size_in_gb,omitempty"` // share_scratch specifies if we'd like to reuse scratch space between multiple containers. // This currently only affects LCOW. The sandbox containers scratch space is re-used for all // subsequent containers launched in the pod. - ShareScratch bool `protobuf:"varint,14,opt,name=share_scratch,json=shareScratch,proto3" json:"share_scratch,omitempty"` + ShareScratch bool `protobuf:"varint,14,opt,name=share_scratch,json=shareScratch,proto3" json:"share_scratch,omitempty"` + //NCProxyAddr is the address of the network configuration proxy service. If omitted + // the network is setup locally. + NCProxyAddr string `protobuf:"bytes,15,opt,name=NCProxyAddr,proto3" json:"NCProxyAddr,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -231,62 +234,63 @@ func init() { } var fileDescriptor_b643df6839c75082 = []byte{ - // 883 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0xdb, 0x6e, 0xdb, 0x36, - 0x18, 0xc7, 0xad, 0x26, 0x71, 0xa2, 0x2f, 0x71, 0xea, 0x70, 0x06, 0x26, 0xa4, 0xab, 0x6d, 0xa4, - 0x03, 0x9a, 0x62, 0x8d, 0x94, 0x74, 0x97, 0x1b, 0x30, 0xcc, 0x87, 0xb4, 0x1e, 0x9a, 0xc4, 0x90, - 0xb3, 0x74, 0x87, 0x0b, 0x42, 0x07, 0x5a, 0x26, 0x6a, 0x8a, 0x82, 0x48, 0x7b, 0x71, 0xaf, 0xf6, - 0x08, 0x7b, 0x9b, 0xbd, 0x42, 0x2e, 0x77, 0x39, 0x60, 0x40, 0xb6, 0xfa, 0x49, 0x06, 0x52, 0x94, - 0xbb, 0x05, 0xc1, 0x6e, 0x76, 0x65, 0xea, 0xff, 0xfd, 0xf8, 0xe7, 0xc7, 0xc3, 0xdf, 0x70, 0x91, - 0x50, 0x39, 0x99, 0x85, 0x6e, 0xc4, 0x99, 0x77, 0x46, 0xa3, 0x9c, 0x0b, 0x3e, 0x96, 0xde, 0x24, - 0x12, 0x62, 0x42, 0x99, 0x17, 0xb1, 0xd8, 0x8b, 0x78, 0x2a, 0x03, 0x9a, 0x92, 0x3c, 0x3e, 0x52, - 0xda, 0x51, 0x3e, 0x4b, 0x27, 0x91, 0x38, 0x9a, 0x9f, 0x78, 0x3c, 0x93, 0x94, 0xa7, 0xc2, 0x2b, - 0x14, 0x37, 0xcb, 0xb9, 0xe4, 0xa8, 0xf1, 0x81, 0x77, 0x4d, 0x61, 0x7e, 0xb2, 0xdf, 0x48, 0x78, - 0xc2, 0x35, 0xe0, 0xa9, 0x51, 0xc1, 0xee, 0xb7, 0x12, 0xce, 0x93, 0x29, 0xf1, 0xf4, 0x57, 0x38, - 0x1b, 0x7b, 0x92, 0x32, 0x22, 0x64, 0xc0, 0xb2, 0x02, 0x38, 0xf8, 0xb5, 0x0a, 0x9b, 0x17, 0xc5, - 0x2a, 0xa8, 0x01, 0x1b, 0x31, 0x09, 0x67, 0x89, 0x63, 0xb5, 0xad, 0xc3, 0x2d, 0xbf, 0xf8, 0x40, - 0xa7, 0x00, 0x7a, 0x80, 0xe5, 0x22, 0x23, 0xce, 0x83, 0xb6, 0x75, 0xb8, 0xfb, 0xe2, 0xa9, 0x7b, - 0x5f, 0x0f, 0xae, 0x31, 0x72, 0x7b, 0x8a, 0xbf, 0x5c, 0x64, 0xc4, 0xb7, 0xe3, 0x72, 0x88, 0x9e, - 0x40, 0x2d, 0x27, 0x09, 0x15, 0x32, 0x5f, 0xe0, 0x9c, 0x73, 0xe9, 0xac, 0xb5, 0xad, 0x43, 0xdb, - 0xdf, 0x29, 0x45, 0x9f, 0x73, 0xa9, 0x20, 0x11, 0xa4, 0x71, 0xc8, 0xaf, 0x31, 0x65, 0x41, 0x42, - 0x9c, 0xf5, 0x02, 0x32, 0xe2, 0x40, 0x69, 0xe8, 0x19, 0xd4, 0x4b, 0x28, 0x9b, 0x06, 0x72, 0xcc, - 0x73, 0xe6, 0x6c, 0x68, 0xee, 0xa1, 0xd1, 0x87, 0x46, 0x46, 0x3f, 0xc2, 0xde, 0xca, 0x4f, 0xf0, - 0x69, 0xa0, 0xfa, 0x73, 0xaa, 0x7a, 0x0f, 0xee, 0x7f, 0xef, 0x61, 0x64, 0x56, 0x2c, 0x67, 0xf9, - 0xe5, 0x9a, 0x2b, 0x05, 0x79, 0xd0, 0x08, 0x39, 0x97, 0x78, 0x4c, 0xa7, 0x44, 0xe8, 0x3d, 0xe1, - 0x2c, 0x90, 0x13, 0x67, 0x53, 0xf7, 0xb2, 0xa7, 0x6a, 0xa7, 0xaa, 0xa4, 0x76, 0x36, 0x0c, 0xe4, - 0x04, 0x3d, 0x07, 0x34, 0x67, 0x38, 0xcb, 0x79, 0x44, 0x84, 0xe0, 0x39, 0x8e, 0xf8, 0x2c, 0x95, - 0xce, 0x56, 0xdb, 0x3a, 0xdc, 0xf0, 0xeb, 0x73, 0x36, 0x2c, 0x0b, 0x5d, 0xa5, 0x23, 0x17, 0x1a, - 0x73, 0x86, 0x19, 0x61, 0x3c, 0x5f, 0x60, 0x41, 0xdf, 0x11, 0x4c, 0x53, 0xcc, 0x42, 0xc7, 0x2e, - 0xf9, 0x33, 0x5d, 0x1a, 0xd1, 0x77, 0x64, 0x90, 0x9e, 0x85, 0xa8, 0x09, 0xf0, 0x72, 0xf8, 0xed, - 0xd5, 0xab, 0x9e, 0x5a, 0xcb, 0x01, 0xdd, 0xc4, 0x3f, 0x14, 0xf4, 0x25, 0x3c, 0x12, 0x51, 0x30, - 0x25, 0x38, 0xca, 0x66, 0x78, 0x4a, 0x19, 0x95, 0x02, 0x4b, 0x8e, 0xcd, 0xb6, 0x9c, 0x6d, 0x7d, - 0xe9, 0x1f, 0x6b, 0xa4, 0x9b, 0xcd, 0x5e, 0x6b, 0xe0, 0x92, 0x9b, 0x73, 0x40, 0x67, 0xf0, 0x69, - 0x4c, 0xc6, 0xc1, 0x6c, 0x2a, 0xf1, 0xea, 0xdc, 0xb0, 0x88, 0xf2, 0x40, 0x46, 0x93, 0x55, 0x77, - 0x49, 0xe8, 0xec, 0xe8, 0xee, 0x5a, 0x86, 0xed, 0x96, 0xe8, 0xa8, 0x20, 0x8b, 0x66, 0x5f, 0x86, - 0xe8, 0x2b, 0x78, 0x5c, 0xda, 0xcd, 0xd9, 0x7d, 0x3e, 0x35, 0xed, 0xe3, 0x18, 0xe8, 0x8a, 0xdd, - 0x35, 0x50, 0x2f, 0x65, 0x12, 0xe4, 0xa4, 0x9c, 0xeb, 0xec, 0xea, 0xfe, 0x77, 0xb4, 0x68, 0xe0, - 0x83, 0x67, 0x60, 0xaf, 0xde, 0x22, 0xb2, 0x61, 0xe3, 0x7c, 0x38, 0x18, 0xf6, 0xeb, 0x15, 0xb4, - 0x05, 0xeb, 0xa7, 0x83, 0xd7, 0xfd, 0xba, 0x85, 0x36, 0x61, 0xad, 0x7f, 0xf9, 0xa6, 0xfe, 0xe0, - 0xc0, 0x83, 0xfa, 0xdd, 0x2b, 0x47, 0xdb, 0xb0, 0x39, 0xf4, 0x2f, 0xba, 0xfd, 0xd1, 0xa8, 0x5e, - 0x41, 0xbb, 0x00, 0xaf, 0xbe, 0x1f, 0xf6, 0xfd, 0xab, 0xc1, 0xe8, 0xc2, 0xaf, 0x5b, 0x07, 0x7f, - 0xac, 0xc1, 0xae, 0xb9, 0xb1, 0x1e, 0x91, 0x01, 0x9d, 0x0a, 0xf4, 0x18, 0x40, 0xbf, 0x5a, 0x9c, - 0x06, 0x8c, 0xe8, 0x14, 0xd9, 0xbe, 0xad, 0x95, 0xf3, 0x80, 0x11, 0xd4, 0x05, 0x88, 0x72, 0x12, - 0x48, 0x12, 0xe3, 0x40, 0xea, 0x24, 0x6d, 0xbf, 0xd8, 0x77, 0x8b, 0x84, 0xba, 0x65, 0x42, 0xdd, - 0xcb, 0x32, 0xa1, 0x9d, 0xad, 0x9b, 0xdb, 0x56, 0xe5, 0x97, 0x3f, 0x5b, 0x96, 0x6f, 0x9b, 0x79, - 0x5f, 0x4b, 0xf4, 0x19, 0xa0, 0xb7, 0x24, 0x4f, 0xc9, 0x14, 0xab, 0x28, 0xe3, 0x93, 0xe3, 0x63, - 0x9c, 0x0a, 0x9d, 0xa5, 0x75, 0xff, 0x61, 0x51, 0x51, 0x0e, 0x27, 0xc7, 0xc7, 0xe7, 0x02, 0xb9, - 0xf0, 0x91, 0x79, 0x3f, 0x11, 0x67, 0x8c, 0x4a, 0x1c, 0x2e, 0x24, 0x11, 0x3a, 0x54, 0xeb, 0xfe, - 0x5e, 0x51, 0xea, 0xea, 0x4a, 0x47, 0x15, 0xd0, 0x29, 0xb4, 0x0d, 0xff, 0x13, 0xcf, 0xdf, 0xd2, - 0x34, 0xc1, 0x82, 0x48, 0x9c, 0xe5, 0x74, 0x1e, 0x48, 0x62, 0x26, 0x6f, 0xe8, 0xc9, 0x9f, 0x14, - 0xdc, 0x9b, 0x02, 0x1b, 0x11, 0x39, 0x2c, 0xa0, 0xc2, 0xa7, 0x07, 0xad, 0x7b, 0x7c, 0xf4, 0xd5, - 0xc4, 0xc6, 0xa6, 0xaa, 0x6d, 0x1e, 0xdd, 0xb5, 0x19, 0x69, 0xa6, 0x70, 0x79, 0x0e, 0x60, 0xb2, - 0x82, 0x69, 0xac, 0x53, 0x55, 0xeb, 0xd4, 0x96, 0xb7, 0x2d, 0xdb, 0x1c, 0xfb, 0xa0, 0xe7, 0xdb, - 0x06, 0x18, 0xc4, 0xe8, 0x29, 0xd4, 0x67, 0x82, 0xe4, 0xff, 0x3a, 0x96, 0x2d, 0xbd, 0x48, 0x4d, - 0xe9, 0x1f, 0x0e, 0xe5, 0x09, 0x6c, 0x92, 0x6b, 0x12, 0x29, 0x4f, 0x15, 0x25, 0xbb, 0x03, 0xcb, - 0xdb, 0x56, 0xb5, 0x7f, 0x4d, 0xa2, 0x41, 0xcf, 0xaf, 0xaa, 0xd2, 0x20, 0xee, 0xc4, 0x37, 0xef, - 0x9b, 0x95, 0xdf, 0xdf, 0x37, 0x2b, 0x3f, 0x2f, 0x9b, 0xd6, 0xcd, 0xb2, 0x69, 0xfd, 0xb6, 0x6c, - 0x5a, 0x7f, 0x2d, 0x9b, 0xd6, 0x0f, 0xdf, 0xfc, 0xff, 0xff, 0xf3, 0x2f, 0xcc, 0xef, 0x77, 0x95, - 0xb0, 0xaa, 0xef, 0xfd, 0xf3, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xbb, 0xb6, 0x6d, 0x09, 0x26, + // 899 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0x5b, 0x6f, 0xdb, 0x36, + 0x18, 0x86, 0xad, 0x26, 0x71, 0xac, 0x2f, 0x71, 0xe2, 0x70, 0x06, 0x26, 0xa4, 0xab, 0x6d, 0xa4, + 0x03, 0x9a, 0x62, 0x8d, 0x94, 0x74, 0x97, 0x1b, 0x30, 0xd4, 0x87, 0xb4, 0x1e, 0x9a, 0x44, 0x90, + 0xb3, 0x74, 0x87, 0x0b, 0x42, 0x07, 0x5a, 0x16, 0x6a, 0x8a, 0x02, 0x49, 0x7b, 0x71, 0xaf, 0xf6, + 0x13, 0xf6, 0xb3, 0x72, 0xb9, 0xcb, 0x0d, 0x03, 0xb2, 0xd5, 0xbf, 0x64, 0x10, 0x45, 0xb9, 0x5d, + 0x10, 0xec, 0x66, 0x57, 0xa6, 0xde, 0xef, 0xe1, 0xcb, 0x8f, 0x87, 0xd7, 0x70, 0x11, 0x27, 0x72, + 0x32, 0x0b, 0xec, 0x90, 0x51, 0xe7, 0x2c, 0x09, 0x39, 0x13, 0x6c, 0x2c, 0x9d, 0x49, 0x28, 0xc4, + 0x24, 0xa1, 0x4e, 0x48, 0x23, 0x27, 0x64, 0xa9, 0xf4, 0x93, 0x94, 0xf0, 0xe8, 0x28, 0xd7, 0x8e, + 0xf8, 0x2c, 0x9d, 0x84, 0xe2, 0x68, 0x7e, 0xe2, 0xb0, 0x4c, 0x26, 0x2c, 0x15, 0x4e, 0xa1, 0xd8, + 0x19, 0x67, 0x92, 0xa1, 0xe6, 0x07, 0xde, 0xd6, 0x85, 0xf9, 0xc9, 0x7e, 0x33, 0x66, 0x31, 0x53, + 0x80, 0x93, 0x8f, 0x0a, 0x76, 0xbf, 0x1d, 0x33, 0x16, 0x4f, 0x89, 0xa3, 0xbe, 0x82, 0xd9, 0xd8, + 0x91, 0x09, 0x25, 0x42, 0xfa, 0x34, 0x2b, 0x80, 0x83, 0x3f, 0xaa, 0xb0, 0x79, 0x51, 0xac, 0x82, + 0x9a, 0xb0, 0x11, 0x91, 0x60, 0x16, 0x5b, 0x46, 0xc7, 0x38, 0xac, 0x79, 0xc5, 0x07, 0x3a, 0x05, + 0x50, 0x03, 0x2c, 0x17, 0x19, 0xb1, 0x1e, 0x74, 0x8c, 0xc3, 0x9d, 0xe7, 0x4f, 0xec, 0xfb, 0x7a, + 0xb0, 0xb5, 0x91, 0xdd, 0xcf, 0xf9, 0xcb, 0x45, 0x46, 0x3c, 0x33, 0x2a, 0x87, 0xe8, 0x31, 0xd4, + 0x39, 0x89, 0x13, 0x21, 0xf9, 0x02, 0x73, 0xc6, 0xa4, 0xb5, 0xd6, 0x31, 0x0e, 0x4d, 0x6f, 0xbb, + 0x14, 0x3d, 0xc6, 0x64, 0x0e, 0x09, 0x3f, 0x8d, 0x02, 0x76, 0x8d, 0x13, 0xea, 0xc7, 0xc4, 0x5a, + 0x2f, 0x20, 0x2d, 0x0e, 0x73, 0x0d, 0x3d, 0x85, 0x46, 0x09, 0x65, 0x53, 0x5f, 0x8e, 0x19, 0xa7, + 0xd6, 0x86, 0xe2, 0x76, 0xb5, 0xee, 0x6a, 0x19, 0xfd, 0x04, 0x7b, 0x2b, 0x3f, 0xc1, 0xa6, 0x7e, + 0xde, 0x9f, 0x55, 0x55, 0x7b, 0xb0, 0xff, 0x7b, 0x0f, 0x23, 0xbd, 0x62, 0x39, 0xcb, 0x2b, 0xd7, + 0x5c, 0x29, 0xc8, 0x81, 0x66, 0xc0, 0x98, 0xc4, 0xe3, 0x64, 0x4a, 0x84, 0xda, 0x13, 0xce, 0x7c, + 0x39, 0xb1, 0x36, 0x55, 0x2f, 0x7b, 0x79, 0xed, 0x34, 0x2f, 0xe5, 0x3b, 0x73, 0x7d, 0x39, 0x41, + 0xcf, 0x00, 0xcd, 0x29, 0xce, 0x38, 0x0b, 0x89, 0x10, 0x8c, 0xe3, 0x90, 0xcd, 0x52, 0x69, 0xd5, + 0x3a, 0xc6, 0xe1, 0x86, 0xd7, 0x98, 0x53, 0xb7, 0x2c, 0xf4, 0x72, 0x1d, 0xd9, 0xd0, 0x9c, 0x53, + 0x4c, 0x09, 0x65, 0x7c, 0x81, 0x45, 0xf2, 0x8e, 0xe0, 0x24, 0xc5, 0x34, 0xb0, 0xcc, 0x92, 0x3f, + 0x53, 0xa5, 0x51, 0xf2, 0x8e, 0x0c, 0xd3, 0xb3, 0x00, 0xb5, 0x00, 0x5e, 0xba, 0xdf, 0x5d, 0xbd, + 0xea, 0xe7, 0x6b, 0x59, 0xa0, 0x9a, 0xf8, 0x48, 0x41, 0x5f, 0xc3, 0x43, 0x11, 0xfa, 0x53, 0x82, + 0xc3, 0x6c, 0x86, 0xa7, 0x09, 0x4d, 0xa4, 0xc0, 0x92, 0x61, 0xbd, 0x2d, 0x6b, 0x4b, 0x5d, 0xfa, + 0xa7, 0x0a, 0xe9, 0x65, 0xb3, 0xd7, 0x0a, 0xb8, 0x64, 0xfa, 0x1c, 0xd0, 0x19, 0x7c, 0x1e, 0x91, + 0xb1, 0x3f, 0x9b, 0x4a, 0xbc, 0x3a, 0x37, 0x2c, 0x42, 0xee, 0xcb, 0x70, 0xb2, 0xea, 0x2e, 0x0e, + 0xac, 0x6d, 0xd5, 0x5d, 0x5b, 0xb3, 0xbd, 0x12, 0x1d, 0x15, 0x64, 0xd1, 0xec, 0xcb, 0x00, 0x7d, + 0x03, 0x8f, 0x4a, 0xbb, 0x39, 0xbd, 0xcf, 0xa7, 0xae, 0x7c, 0x2c, 0x0d, 0x5d, 0xd1, 0xbb, 0x06, + 0xf9, 0x4b, 0x99, 0xf8, 0x9c, 0x94, 0x73, 0xad, 0x1d, 0xd5, 0xff, 0xb6, 0x12, 0x35, 0x8c, 0x3a, + 0xb0, 0x75, 0xde, 0x73, 0x39, 0xbb, 0x5e, 0xbc, 0x88, 0x22, 0x6e, 0xed, 0xaa, 0x33, 0xf9, 0x58, + 0x3a, 0x78, 0x0a, 0xe6, 0xea, 0xb5, 0x22, 0x13, 0x36, 0xce, 0xdd, 0xa1, 0x3b, 0x68, 0x54, 0x50, + 0x0d, 0xd6, 0x4f, 0x87, 0xaf, 0x07, 0x0d, 0x03, 0x6d, 0xc2, 0xda, 0xe0, 0xf2, 0x4d, 0xe3, 0xc1, + 0x81, 0x03, 0x8d, 0xbb, 0x8f, 0x02, 0x6d, 0xc1, 0xa6, 0xeb, 0x5d, 0xf4, 0x06, 0xa3, 0x51, 0xa3, + 0x82, 0x76, 0x00, 0x5e, 0xfd, 0xe0, 0x0e, 0xbc, 0xab, 0xe1, 0xe8, 0xc2, 0x6b, 0x18, 0x07, 0x7f, + 0xae, 0xc1, 0x8e, 0xbe, 0xd3, 0x3e, 0x91, 0x7e, 0x32, 0x15, 0xe8, 0x11, 0x80, 0x7a, 0xd7, 0x38, + 0xf5, 0x29, 0x51, 0x39, 0x33, 0x3d, 0x53, 0x29, 0xe7, 0x3e, 0x25, 0xa8, 0x07, 0x10, 0x72, 0xe2, + 0x4b, 0x12, 0x61, 0x5f, 0xaa, 0xac, 0x6d, 0x3d, 0xdf, 0xb7, 0x8b, 0x0c, 0xdb, 0x65, 0x86, 0xed, + 0xcb, 0x32, 0xc3, 0xdd, 0xda, 0xcd, 0x6d, 0xbb, 0xf2, 0xeb, 0x5f, 0x6d, 0xc3, 0x33, 0xf5, 0xbc, + 0x17, 0x12, 0x7d, 0x01, 0xe8, 0x2d, 0xe1, 0x29, 0x99, 0xe2, 0x3c, 0xec, 0xf8, 0xe4, 0xf8, 0x18, + 0xa7, 0x42, 0xa5, 0x6d, 0xdd, 0xdb, 0x2d, 0x2a, 0xb9, 0xc3, 0xc9, 0xf1, 0xf1, 0xb9, 0x40, 0x36, + 0x7c, 0xa2, 0x5f, 0x58, 0xc8, 0x28, 0x4d, 0x24, 0x0e, 0x16, 0x92, 0x08, 0x15, 0xbb, 0x75, 0x6f, + 0xaf, 0x28, 0xf5, 0x54, 0xa5, 0x9b, 0x17, 0xd0, 0x29, 0x74, 0x34, 0xff, 0x33, 0xe3, 0x6f, 0x93, + 0x34, 0xc6, 0x82, 0x48, 0x9c, 0xf1, 0x64, 0xee, 0x4b, 0xa2, 0x27, 0x6f, 0xa8, 0xc9, 0x9f, 0x15, + 0xdc, 0x9b, 0x02, 0x1b, 0x11, 0xe9, 0x16, 0x50, 0xe1, 0xd3, 0x87, 0xf6, 0x3d, 0x3e, 0xea, 0xf2, + 0x22, 0x6d, 0x53, 0x55, 0x36, 0x0f, 0xef, 0xda, 0x8c, 0x14, 0x53, 0xb8, 0x3c, 0x03, 0xd0, 0x69, + 0xc2, 0x49, 0xa4, 0x72, 0x57, 0xef, 0xd6, 0x97, 0xb7, 0x6d, 0x53, 0x1f, 0xfb, 0xb0, 0xef, 0x99, + 0x1a, 0x18, 0x46, 0xe8, 0x09, 0x34, 0x66, 0x82, 0xf0, 0x7f, 0x1d, 0x4b, 0x4d, 0x2d, 0x52, 0xcf, + 0xf5, 0x0f, 0x87, 0xf2, 0x18, 0x36, 0xc9, 0x35, 0x09, 0x73, 0xcf, 0x3c, 0x6c, 0x66, 0x17, 0x96, + 0xb7, 0xed, 0xea, 0xe0, 0x9a, 0x84, 0xc3, 0xbe, 0x57, 0xcd, 0x4b, 0xc3, 0xa8, 0x1b, 0xdd, 0xbc, + 0x6f, 0x55, 0x7e, 0x7f, 0xdf, 0xaa, 0xfc, 0xb2, 0x6c, 0x19, 0x37, 0xcb, 0x96, 0xf1, 0xdb, 0xb2, + 0x65, 0xfc, 0xbd, 0x6c, 0x19, 0x3f, 0x7e, 0xfb, 0xff, 0xff, 0xf1, 0xbf, 0xd2, 0xbf, 0xdf, 0x57, + 0x82, 0xaa, 0xba, 0xf7, 0x2f, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x0d, 0x33, 0xad, 0x48, 0x06, 0x00, 0x00, } @@ -395,6 +399,12 @@ func (m *Options) MarshalTo(dAtA []byte) (int, error) { } i++ } + if len(m.NCProxyAddr) > 0 { + dAtA[i] = 0x7a + i++ + i = encodeVarintRunhcs(dAtA, i, uint64(len(m.NCProxyAddr))) + i += copy(dAtA[i:], m.NCProxyAddr) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -534,6 +544,10 @@ func (m *Options) Size() (n int) { if m.ShareScratch { n += 2 } + l = len(m.NCProxyAddr) + if l > 0 { + n += 1 + l + sovRunhcs(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -612,6 +626,7 @@ func (this *Options) String() string { `DefaultContainerScratchSizeInGb:` + fmt.Sprintf("%v", this.DefaultContainerScratchSizeInGb) + `,`, `DefaultVmScratchSizeInGb:` + fmt.Sprintf("%v", this.DefaultVmScratchSizeInGb) + `,`, `ShareScratch:` + fmt.Sprintf("%v", this.ShareScratch) + `,`, + `NCProxyAddr:` + fmt.Sprintf("%v", this.NCProxyAddr) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -1007,6 +1022,38 @@ func (m *Options) Unmarshal(dAtA []byte) error { } } m.ShareScratch = bool(v != 0) + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NCProxyAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRunhcs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRunhcs + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRunhcs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NCProxyAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRunhcs(dAtA[iNdEx:]) diff --git a/cmd/containerd-shim-runhcs-v1/options/runhcs.proto b/cmd/containerd-shim-runhcs-v1/options/runhcs.proto index 72b2100eec..85840b33ce 100644 --- a/cmd/containerd-shim-runhcs-v1/options/runhcs.proto +++ b/cmd/containerd-shim-runhcs-v1/options/runhcs.proto @@ -83,6 +83,9 @@ message Options { // This currently only affects LCOW. The sandbox containers scratch space is re-used for all // subsequent containers launched in the pod. bool share_scratch = 14; + //NCProxyAddr is the address of the network configuration proxy service. If omitted + // the network is setup locally. + string NCProxyAddr = 15; } // ProcessDetails contains additional information about a process. This is the additional diff --git a/cmd/containerd-shim-runhcs-v1/pod.go b/cmd/containerd-shim-runhcs-v1/pod.go index 6e341b83fb..9606769463 100644 --- a/cmd/containerd-shim-runhcs-v1/pod.go +++ b/cmd/containerd-shim-runhcs-v1/pod.go @@ -7,7 +7,6 @@ import ( "path/filepath" "sync" - "github.com/Microsoft/hcsshim/internal/hcsoci" "github.com/Microsoft/hcsshim/internal/log" "github.com/Microsoft/hcsshim/internal/oci" "github.com/Microsoft/hcsshim/internal/uvm" @@ -141,25 +140,40 @@ func createPod(ctx context.Context, events publisher, req *task.CreateTaskReques id: req.ID, host: parent, } - // TOOD: JTERRY75 - There is a bug in the compartment activation for Windows + + if parent != nil { + cid := req.ID + if id, ok := s.Annotations[oci.AnnotationNcproxyContainerID]; ok { + cid = id + } + caAddr := fmt.Sprintf(uvm.ComputeAgentAddrFmt, cid) + if err := parent.CreateAndAssignNetworkSetup(ctx, caAddr, cid); err != nil { + return nil, err + } + } + + // TODO: JTERRY75 - There is a bug in the compartment activation for Windows // Process isolated that requires us to create the real pause container to // hold the network compartment open. This is not required for Windows // Hypervisor isolated. When we have a build that supports this for Windows // Process isolated make sure to move back to this model. + + // For WCOW we fake out the init task since we dont need it. We only + // need to provision the guest network namespace if this is hypervisor + // isolated. Process isolated WCOW gets the namespace endpoints + // automatically. + nsid := "" if isWCOW && parent != nil { - // For WCOW we fake out the init task since we dont need it. We only - // need to provision the guest network namespace if this is hypervisor - // isolated. Process isolated WCOW gets the namespace endpoints - // automatically. - if parent != nil { - if s.Windows != nil && s.Windows.Network != nil && s.Windows.Network.NetworkNamespace != "" { - err = hcsoci.SetupNetworkNamespace(ctx, parent, s.Windows.Network.NetworkNamespace) - if err != nil { - return nil, err - } + if s.Windows != nil && s.Windows.Network != nil { + nsid = s.Windows.Network.NetworkNamespace + } + + if nsid != "" { + if err := parent.ConfigureNetworking(ctx, nsid); err != nil { + return nil, errors.Wrapf(err, "failed to setup networking for pod %q", req.ID) } } - p.sandboxTask = newWcowPodSandboxTask(ctx, events, req.ID, req.Bundle, parent) + p.sandboxTask = newWcowPodSandboxTask(ctx, events, req.ID, req.Bundle, parent, nsid) // Publish the created event. We only do this for a fake WCOW task. A // HCS Task will event itself based on actual process lifetime. events.publishEvent( @@ -193,7 +207,6 @@ func createPod(ctx context.Context, events publisher, req *task.CreateTaskReques } p.sandboxTask = lt } - return &p, nil } @@ -217,7 +230,7 @@ type pod struct { // It MUST be treated as read only in the lifetime of the pod. host *uvm.UtilityVM - // wcl is the worload create mutex. All calls to CreateTask must hold this + // wcl is the workload create mutex. All calls to CreateTask must hold this // lock while the ID reservation takes place. Once the ID is held it is safe // to release the lock to allow concurrent creates. wcl sync.Mutex diff --git a/cmd/containerd-shim-runhcs-v1/serve.go b/cmd/containerd-shim-runhcs-v1/serve.go index 929cf5705c..224904fc62 100644 --- a/cmd/containerd-shim-runhcs-v1/serve.go +++ b/cmd/containerd-shim-runhcs-v1/serve.go @@ -189,8 +189,7 @@ var serveCommand = cli.Command{ // TODO: JTERRY75 We should use a real context with cancellation shared by // the service for shim shutdown gracefully. ctx := context.Background() - if err := s.Serve(ctx, sl); err != nil && - !strings.Contains(err.Error(), "use of closed network connection") { + if err := trapClosedConnErr(s.Serve(ctx, sl)); err != nil { logrus.WithError(err).Fatal("containerd-shim: ttrpc server failure") serrs <- err return @@ -224,6 +223,13 @@ var serveCommand = cli.Command{ }, } +func trapClosedConnErr(err error) error { + if err == nil || strings.Contains(err.Error(), "use of closed network connection") { + return nil + } + return err +} + // readOptions reads in bytes from the reader and converts it to a shim options // struct. If no data is available from the reader, returns (nil, nil). func readOptions(r io.Reader) (*runhcsopts.Options, error) { diff --git a/cmd/containerd-shim-runhcs-v1/task_hcs.go b/cmd/containerd-shim-runhcs-v1/task_hcs.go index 676224d47d..ddd493eac3 100644 --- a/cmd/containerd-shim-runhcs-v1/task_hcs.go +++ b/cmd/containerd-shim-runhcs-v1/task_hcs.go @@ -147,11 +147,12 @@ func newHcsTask( } opts := hcsoci.CreateOptions{ - ID: req.ID, - Owner: owner, - Spec: s, - HostingSystem: parent, - NetworkNamespace: netNS, + ID: req.ID, + Owner: owner, + Spec: s, + HostingSystem: parent, + NetworkNamespace: netNS, + ScaleCPULimitsToSandbox: shimOpts.ScaleCpuLimitsToSandbox, } if shimOpts != nil { diff --git a/cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go b/cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go index 122c2bba6e..0fd700fae6 100644 --- a/cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go +++ b/cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go @@ -29,7 +29,7 @@ import ( // It is assumed that this is the only fake WCOW task and that this task owns // `parent`. When the fake WCOW `init` process exits via `Signal` `parent` will // be forcibly closed by this task. -func newWcowPodSandboxTask(ctx context.Context, events publisher, id, bundle string, parent *uvm.UtilityVM) shimTask { +func newWcowPodSandboxTask(ctx context.Context, events publisher, id, bundle string, parent *uvm.UtilityVM, nsid string) shimTask { log.G(ctx).WithField("tid", id).Debug("newWcowPodSandboxTask") wpst := &wcowPodSandboxTask{ @@ -38,6 +38,7 @@ func newWcowPodSandboxTask(ctx context.Context, events publisher, id, bundle str init: newWcowPodSandboxExec(ctx, events, id, bundle), host: parent, closed: make(chan struct{}), + nsid: nsid, } if parent != nil { // We have (and own) a parent UVM. Listen for its exit and forcibly @@ -80,6 +81,12 @@ type wcowPodSandboxTask struct { // `host==nil` this is an Argon task so no UVM cleanup is required. host *uvm.UtilityVM + // nsid is the pods network namespace ID. Normally the network for the pod would be cleaned + // up when the pod sandbox container is being torn down, but as there isn't one + // we need to do this manually. Store the network namespace ID so we can remove this on + // close. + nsid string + closed chan struct{} closeOnce sync.Once } @@ -168,6 +175,10 @@ func (wpst *wcowPodSandboxTask) close(ctx context.Context) { log.G(ctx).Debug("wcowPodSandboxTask::closeOnce") if wpst.host != nil { + if err := wpst.host.TearDownNetworking(ctx, wpst.nsid); err != nil { + log.G(ctx).WithError(err).Error("failed to cleanup networking for utility VM") + } + if err := wpst.host.Close(); err != nil { log.G(ctx).WithError(err).Error("failed host vm shutdown") } diff --git a/cmd/ncproxy/config.go b/cmd/ncproxy/config.go new file mode 100644 index 0000000000..b31d526a45 --- /dev/null +++ b/cmd/ncproxy/config.go @@ -0,0 +1,61 @@ +package main + +import ( + "encoding/json" + "io/ioutil" + "os" + "path/filepath" + + "github.com/pkg/errors" +) + +type config struct { + TTRPCAddr string `json:"ttrpc,omitempty"` + GRPCAddr string `json:"grpc,omitempty"` + NodeNetSvcAddr string `json:"node_net_svc_addr,omitempty"` + // Timeout in seconds to wait to connect to a NodeNetworkService. + // 0 represents no timeout and ncproxy will continuously try and connect in the + // background. + Timeout uint32 `json:"timeout,omitempty"` +} + +// Returns config. If path is "" will check the default location of the config +// which is /path/of/executable/ncproxy.json +func loadConfig(path string) (*config, error) { + // Check if config path was passed in. + if path != "" { + return readConfig(path) + } + // Otherwise check if config is in default location (same dir as executable) + if path, exists := configPresent(); exists { + return readConfig(path) + } + return nil, errors.New("no config specified and no default config found") +} + +// Reads config from path and returns config struct if path is valid and marshaling +// succeeds +func readConfig(path string) (*config, error) { + data, err := ioutil.ReadFile(path) + if err != nil { + return nil, errors.Wrap(err, "failed to read config file") + } + conf := &config{} + if err := json.Unmarshal(data, conf); err != nil { + return nil, errors.New("failed to unmarshal config data") + } + return conf, nil +} + +// Checks to see if there is an ncproxy.json in the directory of the executable. +func configPresent() (string, bool) { + path, err := os.Executable() + if err != nil { + return "", false + } + path = filepath.Join(filepath.Dir(path), "ncproxy.json") + if _, err := os.Stat(path); os.IsNotExist(err) { + return "", false + } + return path, true +} diff --git a/cmd/ncproxy/main.go b/cmd/ncproxy/main.go new file mode 100644 index 0000000000..4d2b5326c1 --- /dev/null +++ b/cmd/ncproxy/main.go @@ -0,0 +1,111 @@ +package main + +import ( + "context" + "flag" + "os" + "os/signal" + "syscall" + "time" + + "github.com/Microsoft/hcsshim/cmd/ncproxy/nodenetsvc" + "github.com/Microsoft/hcsshim/internal/computeagent" + "github.com/Microsoft/hcsshim/internal/log" + "github.com/sirupsen/logrus" + "google.golang.org/grpc" +) + +type nodeNetSvcConn struct { + client nodenetsvc.NodeNetworkServiceClient + addr string + grpcConn *grpc.ClientConn +} + +var ( + configPath = flag.String("config", "", "Path to JSON configuration file.") + // Global mapping of network namespace ID to shim compute agent ttrpc service. + containerIDToShim = make(map[string]computeagent.ComputeAgentService) + // Global object representing the connection to the node network service that + // ncproxy will be talking to. + nodeNetSvcClient *nodeNetSvcConn +) + +func main() { + flag.Parse() + ctx := context.Background() + conf, err := loadConfig(*configPath) + if err != nil { + log.G(ctx).WithError(err).Fatal("failed getting configuration file") + } + + if conf.GRPCAddr == "" { + log.G(ctx).Fatal("missing GRPC endpoint in config") + } + + if conf.TTRPCAddr == "" { + log.G(ctx).Fatal("missing TTRPC endpoint in config") + } + + // If there's a node network service in the config, assign this to our global client. + if conf.NodeNetSvcAddr != "" { + log.G(ctx).Debugf("connecting to NodeNetworkService at address %s", conf.NodeNetSvcAddr) + + opts := []grpc.DialOption{grpc.WithInsecure()} + if conf.Timeout > 0 { + opts = append(opts, grpc.WithBlock(), grpc.WithTimeout(time.Duration(conf.Timeout)*time.Second)) + } + client, err := grpc.Dial(conf.NodeNetSvcAddr, opts...) + if err != nil { + log.G(ctx).Fatalf("failed to connect to NodeNetworkService at address %s", conf.NodeNetSvcAddr) + } + + log.G(ctx).Debugf("successfully connected to NodeNetworkService at address %s", conf.NodeNetSvcAddr) + + netSvcClient := nodenetsvc.NewNodeNetworkServiceClient(client) + nodeNetSvcClient = &nodeNetSvcConn{ + addr: conf.NodeNetSvcAddr, + client: netSvcClient, + grpcConn: client, + } + } + + log.G(ctx).WithFields(logrus.Fields{ + "TTRPCAddr": conf.TTRPCAddr, + "NodeNetSvcAddr": conf.NodeNetSvcAddr, + "GRPCAddr": conf.GRPCAddr, + "Timeout": conf.Timeout, + }).Info("starting ncproxy") + + sigChan := make(chan os.Signal, 1) + serveErr := make(chan error, 1) + signal.Notify(sigChan, syscall.SIGINT) + defer signal.Stop(sigChan) + + // Create new server and then register NetworkConfigProxyServices. + server, err := newServer(ctx, conf) + if err != nil { + log.G(ctx).WithError(err).Fatal("failed to make new ncproxy server") + } + + ttrpcListener, grpcListener, err := server.setup(ctx) + if err != nil { + log.G(ctx).WithError(err).Fatal("failed to setup ncproxy server") + } + + server.serve(ctx, ttrpcListener, grpcListener, serveErr) + + // Wait for server error or user cancellation. + select { + case <-sigChan: + log.G(ctx).Info("received interrupt. Closing") + case err := <-serveErr: + if err != nil { + log.G(ctx).WithError(err).Fatal("service failure") + } + } + + // Cancel inflight requests and shutdown services + if err := server.gracefulShutdown(ctx); err != nil { + log.G(ctx).WithError(err).Fatal("ncproxy failed to shutdown gracefully") + } +} diff --git a/cmd/ncproxy/ncproxy.go b/cmd/ncproxy/ncproxy.go new file mode 100644 index 0000000000..302c5f5721 --- /dev/null +++ b/cmd/ncproxy/ncproxy.go @@ -0,0 +1,459 @@ +package main + +import ( + "context" + "encoding/json" + "strconv" + "sync" + + "github.com/Microsoft/go-winio" + "github.com/Microsoft/hcsshim/cmd/ncproxy/ncproxygrpc" + "github.com/Microsoft/hcsshim/cmd/ncproxy/nodenetsvc" + "github.com/Microsoft/hcsshim/hcn" + "github.com/Microsoft/hcsshim/internal/computeagent" + "github.com/Microsoft/hcsshim/internal/log" + "github.com/Microsoft/hcsshim/internal/ncproxyttrpc" + "github.com/Microsoft/hcsshim/internal/uvm" + "github.com/containerd/ttrpc" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// GRPC service exposed for use by a Node Network Service. Holds a mutex for +// updating global client. +type grpcService struct { + m sync.Mutex +} + +var _ ncproxygrpc.NetworkConfigProxyServer = &grpcService{} + +func (s *grpcService) AddNIC(ctx context.Context, req *ncproxygrpc.AddNICRequest) (*ncproxygrpc.AddNICResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "containerID": req.ContainerID, + "endpointName": req.EndpointName, + "nicID": req.NicID, + }).Info("AddNIC request") + + if req.ContainerID == "" || req.EndpointName == "" || req.NicID == "" { + return nil, status.Errorf(codes.InvalidArgument, "received empty field in request: %+v", req) + } + if client, ok := containerIDToShim[req.ContainerID]; ok { + caReq := &computeagent.AddNICInternalRequest{ + ContainerID: req.ContainerID, + NicID: req.NicID, + EndpointName: req.EndpointName, + } + if _, err := client.AddNIC(ctx, caReq); err != nil { + return nil, err + } + return &ncproxygrpc.AddNICResponse{}, nil + } + return nil, status.Errorf(codes.FailedPrecondition, "No shim registered for namespace `%s`", req.ContainerID) +} + +func (s *grpcService) DeleteNIC(ctx context.Context, req *ncproxygrpc.DeleteNICRequest) (*ncproxygrpc.DeleteNICResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "containerID": req.ContainerID, + "nicID": req.NicID, + "endpointName": req.EndpointName, + }).Info("DeleteNIC request") + + if req.ContainerID == "" || req.EndpointName == "" || req.NicID == "" { + return nil, status.Errorf(codes.InvalidArgument, "received empty field in request: %+v", req) + } + if client, ok := containerIDToShim[req.ContainerID]; ok { + caReq := &computeagent.DeleteNICInternalRequest{ + ContainerID: req.ContainerID, + NicID: req.NicID, + EndpointName: req.EndpointName, + } + if _, err := client.DeleteNIC(ctx, caReq); err != nil { + if err == uvm.ErrNICNotFound || err == uvm.ErrNetNSNotFound { + return nil, status.Errorf(codes.NotFound, "failed to remove endpoint %q from namespace %q", req.EndpointName, req.NicID) + } + return nil, err + } + return &ncproxygrpc.DeleteNICResponse{}, nil + } + return nil, status.Errorf(codes.FailedPrecondition, "No shim registered for namespace `%s`", req.ContainerID) +} + +// +// HNS Methods +// +func (s *grpcService) CreateNetwork(ctx context.Context, req *ncproxygrpc.CreateNetworkRequest) (*ncproxygrpc.CreateNetworkResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "networkName": req.Name, + "type": req.Mode.String(), + "ipamType": req.IpamType, + }).Info("CreateNetwork request") + + if req.Name == "" || req.Mode.String() == "" || req.IpamType.String() == "" || req.SwitchName == "" { + return nil, status.Errorf(codes.InvalidArgument, "received empty field in request: %+v", req) + } + + // Check if the network already exists, and if so return error. + _, err := hcn.GetNetworkByName(req.Name) + if err == nil { + return nil, status.Errorf(codes.FailedPrecondition, "network with name %q already exists", req.Name) + } + + // Get the layer ID from the external switch. HNS will create a transparent network for + // any external switch that is created not through HNS so this is what we're + // searching for here. If the network exists, the vSwitch with this name exists. + extSwitch, err := hcn.GetNetworkByName(req.SwitchName) + if err != nil { + if _, ok := err.(hcn.NetworkNotFoundError); ok { + return nil, status.Errorf(codes.NotFound, "no network/switch with name `%s` found", req.SwitchName) + } + return nil, errors.Wrapf(err, "failed to get network/switch with name %q", req.SwitchName) + } + + // Get layer ID and use this as the basis for what to layer the new network over. + if extSwitch.Health.Extra.LayeredOn == "" { + return nil, status.Errorf(codes.NotFound, "no layer ID found for network %q found", extSwitch.Id) + } + + layerPolicy := hcn.LayerConstraintNetworkPolicySetting{LayerId: extSwitch.Health.Extra.LayeredOn} + data, err := json.Marshal(layerPolicy) + if err != nil { + return nil, errors.Wrap(err, "failed to marshal layer policy") + } + + netPolicy := hcn.NetworkPolicy{ + Type: hcn.LayerConstraint, + Settings: data, + } + + subnets := make([]hcn.Subnet, len(req.SubnetIpadressPrefix)) + for i, addrPrefix := range req.SubnetIpadressPrefix { + subnet := hcn.Subnet{ + IpAddressPrefix: addrPrefix, + Routes: []hcn.Route{ + { + NextHop: req.DefaultGateway, + DestinationPrefix: "0.0.0.0/0", + }, + }, + } + subnets[i] = subnet + } + + ipam := hcn.Ipam{ + Type: req.IpamType.String(), + Subnets: subnets, + } + + network := &hcn.HostComputeNetwork{ + Name: req.Name, + Type: hcn.NetworkType(req.Mode.String()), + Ipams: []hcn.Ipam{ipam}, + Policies: []hcn.NetworkPolicy{netPolicy}, + SchemaVersion: hcn.SchemaVersion{ + Major: 2, + Minor: 2, + }, + } + + network, err = network.Create() + if err != nil { + return nil, errors.Wrapf(err, "failed to create HNS network %q", req.Name) + } + + return &ncproxygrpc.CreateNetworkResponse{ + ID: network.Id, + }, nil +} + +func (s *grpcService) CreateEndpoint(ctx context.Context, req *ncproxygrpc.CreateEndpointRequest) (*ncproxygrpc.CreateEndpointResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "endpointName": req.Name, + "ipAddr": req.Ipaddress, + "macAddr": req.Macaddress, + "networkName": req.NetworkName, + }).Info("CreateEndpoint request") + + if req.Name == "" || req.Ipaddress == "" || req.Macaddress == "" || req.NetworkName == "" { + return nil, status.Errorf(codes.InvalidArgument, "received empty field in request: %+v", req) + } + + network, err := hcn.GetNetworkByName(req.NetworkName) + if err != nil { + if _, ok := err.(hcn.NetworkNotFoundError); ok { + return nil, status.Errorf(codes.NotFound, "no network with name `%s` found", req.NetworkName) + } + return nil, errors.Wrapf(err, "failed to get network with name %q", req.NetworkName) + } + + prefixLen, err := strconv.ParseUint(req.IpaddressPrefixlength, 10, 8) + if err != nil { + return nil, errors.Wrap(err, "failed to convert ip address prefix length to uint") + } + + // Construct ip config. + ipConfig := hcn.IpConfig{ + IpAddress: req.Ipaddress, + PrefixLength: uint8(prefixLen), + } + + // Construct the portname policy we'll be setting on the endpoint. + var portPolicy hcn.PortnameEndpointPolicySetting + if req.PortnamePolicySetting != nil { + portPolicy = hcn.PortnameEndpointPolicySetting{ + Name: req.PortnamePolicySetting.PortName, + } + } + portPolicyJSON, err := json.Marshal(portPolicy) + if err != nil { + return nil, errors.Wrap(err, "failed to marshal portname") + } + + // Construct endpoint policy + epPolicy := hcn.EndpointPolicy{ + Type: hcn.EndpointPolicyType(req.PolicyType.String()), + Settings: portPolicyJSON, + } + + endpoint := &hcn.HostComputeEndpoint{ + Name: req.Name, + HostComputeNetwork: network.Id, + MacAddress: req.Macaddress, + IpConfigurations: []hcn.IpConfig{ipConfig}, + Policies: []hcn.EndpointPolicy{epPolicy}, + SchemaVersion: hcn.SchemaVersion{ + Major: 2, + Minor: 0, + }, + } + + endpoint, err = endpoint.Create() + if err != nil { + return nil, errors.Wrap(err, "failed to create HNS endpoint") + } + + return &ncproxygrpc.CreateEndpointResponse{ + ID: endpoint.Id, + }, nil +} + +func (s *grpcService) AddEndpoint(ctx context.Context, req *ncproxygrpc.AddEndpointRequest) (*ncproxygrpc.AddEndpointResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "endpointName": req.Name, + "namespaceID": req.NamespaceID, + }).Info("AddEndpoint request") + + if req.Name == "" { + return nil, status.Errorf(codes.InvalidArgument, "received empty field in request: %+v", req) + } + + ep, err := hcn.GetEndpointByName(req.Name) + if err != nil { + if _, ok := err.(hcn.EndpointNotFoundError); ok { + return nil, status.Errorf(codes.NotFound, "no endpoint with name `%s` found", req.Name) + } + return nil, errors.Wrapf(err, "failed to get endpoint with name %q", req.Name) + } + + if err := hcn.AddNamespaceEndpoint(req.NamespaceID, ep.Id); err != nil { + return nil, errors.Wrapf(err, "failed to add endpoint with name %q to namespace", req.Name) + } + return &ncproxygrpc.AddEndpointResponse{}, nil +} + +func (s *grpcService) DeleteEndpoint(ctx context.Context, req *ncproxygrpc.DeleteEndpointRequest) (*ncproxygrpc.DeleteEndpointResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "endpointName": req.Name, + }).Info("DeleteEndpoint request") + + if req.Name == "" { + return nil, status.Errorf(codes.InvalidArgument, "received empty field in request: %+v", req) + } + + ep, err := hcn.GetEndpointByName(req.Name) + if err != nil { + if _, ok := err.(hcn.EndpointNotFoundError); ok { + return nil, status.Errorf(codes.NotFound, "no endpoint with name `%s` found", req.Name) + } + return nil, errors.Wrapf(err, "failed to get endpoint with name %q", req.Name) + } + + if err = ep.Delete(); err != nil { + return nil, errors.Wrapf(err, "failed to delete endpoint with name %q", req.Name) + } + return &ncproxygrpc.DeleteEndpointResponse{}, nil +} + +func (s *grpcService) DeleteNetwork(ctx context.Context, req *ncproxygrpc.DeleteNetworkRequest) (*ncproxygrpc.DeleteNetworkResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "networkName": req.Name, + }).Info("DeleteNetwork request") + + if req.Name == "" { + return nil, status.Errorf(codes.InvalidArgument, "received empty field in request: %+v", req) + } + + network, err := hcn.GetNetworkByName(req.Name) + if err != nil { + if _, ok := err.(hcn.NetworkNotFoundError); ok { + return nil, status.Errorf(codes.NotFound, "no network with name `%s` found", req.Name) + } + return nil, errors.Wrapf(err, "failed to get network with name %q", req.Name) + } + + if err = network.Delete(); err != nil { + return nil, errors.Wrapf(err, "failed to delete network with name %q", req.Name) + } + return &ncproxygrpc.DeleteNetworkResponse{}, nil +} + +func (s *grpcService) GetEndpoint(ctx context.Context, req *ncproxygrpc.GetEndpointRequest) (*ncproxygrpc.GetEndpointResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "endpointName": req.Name, + }).Info("GetEndpoint request") + + if req.Name == "" { + return nil, status.Errorf(codes.InvalidArgument, "received empty field in request: %+v", req) + } + + ep, err := hcn.GetEndpointByName(req.Name) + if err != nil { + if _, ok := err.(hcn.EndpointNotFoundError); ok { + return nil, status.Errorf(codes.NotFound, "no endpoint with name `%s` found", req.Name) + } + return nil, errors.Wrapf(err, "failed to get endpoint with name %q", req.Name) + } + + return &ncproxygrpc.GetEndpointResponse{ + ID: ep.Id, + Name: ep.Name, + Network: ep.HostComputeNetwork, + Namespace: ep.HostComputeNamespace, + }, nil +} + +func (s *grpcService) GetEndpoints(ctx context.Context, req *ncproxygrpc.GetEndpointsRequest) (*ncproxygrpc.GetEndpointsResponse, error) { + log.G(ctx).Info("GetEndpoints request") + + rawEndpoints, err := hcn.ListEndpoints() + if err != nil { + return nil, errors.Wrap(err, "failed to get HNS endpoints") + } + + endpoints := make([]*ncproxygrpc.GetEndpointResponse, len(rawEndpoints)) + for i, endpoint := range rawEndpoints { + resp := &ncproxygrpc.GetEndpointResponse{ + ID: endpoint.Id, + Name: endpoint.Name, + Network: endpoint.HostComputeNetwork, + Namespace: endpoint.HostComputeNamespace, + } + endpoints[i] = resp + } + return &ncproxygrpc.GetEndpointsResponse{ + Endpoints: endpoints, + }, nil +} + +func (s *grpcService) GetNetwork(ctx context.Context, req *ncproxygrpc.GetNetworkRequest) (*ncproxygrpc.GetNetworkResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "networkName": req.Name, + }).Info("GetNetwork request") + + if req.Name == "" { + return nil, status.Errorf(codes.InvalidArgument, "received empty field in request: %+v", req) + } + + network, err := hcn.GetNetworkByName(req.Name) + if err != nil { + if _, ok := err.(hcn.NetworkNotFoundError); ok { + return nil, status.Errorf(codes.NotFound, "no network with name `%s` found", req.Name) + } + return nil, errors.Wrapf(err, "failed to get network with name %q", req.Name) + } + + return &ncproxygrpc.GetNetworkResponse{ + ID: network.Id, + Name: network.Name, + }, nil +} + +func (s *grpcService) GetNetworks(ctx context.Context, req *ncproxygrpc.GetNetworksRequest) (*ncproxygrpc.GetNetworksResponse, error) { + log.G(ctx).Info("GetNetworks request") + + rawNetworks, err := hcn.ListNetworks() + if err != nil { + return nil, errors.Wrap(err, "failed to get HNS networks") + } + + networks := make([]*ncproxygrpc.GetNetworkResponse, len(rawNetworks)) + for i, network := range rawNetworks { + resp := &ncproxygrpc.GetNetworkResponse{ + ID: network.Id, + Name: network.Name, + } + networks[i] = resp + } + + return &ncproxygrpc.GetNetworksResponse{ + Networks: networks, + }, nil +} + +// TTRPC service exposed for use by the shim. Holds a mutex for updating map of +// client connections. +type ttrpcService struct { + m sync.Mutex +} + +func (s *ttrpcService) RegisterComputeAgent(ctx context.Context, req *ncproxyttrpc.RegisterComputeAgentRequest) (*ncproxyttrpc.RegisterComputeAgentResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "containerID": req.ContainerID, + "agentAddress": req.AgentAddress, + }).Info("RegisterComputeAgent request") + + conn, err := winio.DialPipe(req.AgentAddress, nil) + if err != nil { + return nil, errors.Wrap(err, "failed to connect to compute agent service") + } + client := ttrpc.NewClient(conn, ttrpc.WithOnClose(func() { conn.Close() })) + // Add to global client map if connection succeeds. Don't check if there's already a map entry + // just overwrite as the client may have changed the address of the config agent. + s.m.Lock() + defer s.m.Unlock() + containerIDToShim[req.ContainerID] = computeagent.NewComputeAgentClient(client) + return &ncproxyttrpc.RegisterComputeAgentResponse{}, nil +} + +func (s *ttrpcService) ConfigureNetworking(ctx context.Context, req *ncproxyttrpc.ConfigureNetworkingInternalRequest) (*ncproxyttrpc.ConfigureNetworkingInternalResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "containerID": req.ContainerID, + "RequestType": req.RequestType, + }).Info("ConfigureNetworking request") + + if req.ContainerID == "" { + return nil, status.Error(codes.InvalidArgument, "ContainerID is empty") + } + + if nodeNetSvcClient == nil { + return nil, status.Error(codes.FailedPrecondition, "No NodeNetworkService client registered") + } + + switch req.RequestType { + case ncproxyttrpc.RequestTypeInternal_Setup: + case ncproxyttrpc.RequestTypeInternal_Teardown: + default: + return nil, status.Errorf(codes.InvalidArgument, "Request type %d is not known", req.RequestType) + } + + netsvcReq := &nodenetsvc.ConfigureNetworkingRequest{ + ContainerID: req.ContainerID, + RequestType: nodenetsvc.RequestType(req.RequestType), + } + + if _, err := nodeNetSvcClient.client.ConfigureNetworking(ctx, netsvcReq); err != nil { + return nil, err + } + return &ncproxyttrpc.ConfigureNetworkingInternalResponse{}, nil +} diff --git a/cmd/ncproxy/ncproxygrpc/doc.go b/cmd/ncproxy/ncproxygrpc/doc.go new file mode 100644 index 0000000000..7dce37899c --- /dev/null +++ b/cmd/ncproxy/ncproxygrpc/doc.go @@ -0,0 +1 @@ +package ncproxygrpc diff --git a/cmd/ncproxy/ncproxygrpc/networkconfigproxy.pb.go b/cmd/ncproxy/ncproxygrpc/networkconfigproxy.pb.go new file mode 100644 index 0000000000..fb337b715c --- /dev/null +++ b/cmd/ncproxy/ncproxygrpc/networkconfigproxy.pb.go @@ -0,0 +1,5426 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: github.com/Microsoft/hcsshim/cmd/ncproxy/ncproxygrpc/networkconfigproxy.proto + +package ncproxygrpc + +import ( + context "context" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + io "io" + math "math" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type CreateNetworkRequest_NetworkMode int32 + +const ( + CreateNetworkRequest_Transparent CreateNetworkRequest_NetworkMode = 0 +) + +var CreateNetworkRequest_NetworkMode_name = map[int32]string{ + 0: "Transparent", +} + +var CreateNetworkRequest_NetworkMode_value = map[string]int32{ + "Transparent": 0, +} + +func (x CreateNetworkRequest_NetworkMode) String() string { + return proto.EnumName(CreateNetworkRequest_NetworkMode_name, int32(x)) +} + +func (CreateNetworkRequest_NetworkMode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{4, 0} +} + +type CreateNetworkRequest_IpamType int32 + +const ( + CreateNetworkRequest_Static CreateNetworkRequest_IpamType = 0 + CreateNetworkRequest_DHCP CreateNetworkRequest_IpamType = 1 +) + +var CreateNetworkRequest_IpamType_name = map[int32]string{ + 0: "Static", + 1: "DHCP", +} + +var CreateNetworkRequest_IpamType_value = map[string]int32{ + "Static": 0, + "DHCP": 1, +} + +func (x CreateNetworkRequest_IpamType) String() string { + return proto.EnumName(CreateNetworkRequest_IpamType_name, int32(x)) +} + +func (CreateNetworkRequest_IpamType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{4, 1} +} + +type CreateEndpointRequest_EndpointPolicyType int32 + +const ( + CreateEndpointRequest_PortName CreateEndpointRequest_EndpointPolicyType = 0 +) + +var CreateEndpointRequest_EndpointPolicyType_name = map[int32]string{ + 0: "PortName", +} + +var CreateEndpointRequest_EndpointPolicyType_value = map[string]int32{ + "PortName": 0, +} + +func (x CreateEndpointRequest_EndpointPolicyType) String() string { + return proto.EnumName(CreateEndpointRequest_EndpointPolicyType_name, int32(x)) +} + +func (CreateEndpointRequest_EndpointPolicyType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{6, 0} +} + +type AddNICRequest struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + NicID string `protobuf:"bytes,2,opt,name=nic_id,json=nicId,proto3" json:"nic_id,omitempty"` + EndpointName string `protobuf:"bytes,3,opt,name=endpoint_name,json=endpointName,proto3" json:"endpoint_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AddNICRequest) Reset() { *m = AddNICRequest{} } +func (*AddNICRequest) ProtoMessage() {} +func (*AddNICRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{0} +} +func (m *AddNICRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AddNICRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AddNICRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AddNICRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddNICRequest.Merge(m, src) +} +func (m *AddNICRequest) XXX_Size() int { + return m.Size() +} +func (m *AddNICRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AddNICRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AddNICRequest proto.InternalMessageInfo + +type AddNICResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AddNICResponse) Reset() { *m = AddNICResponse{} } +func (*AddNICResponse) ProtoMessage() {} +func (*AddNICResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{1} +} +func (m *AddNICResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AddNICResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AddNICResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AddNICResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddNICResponse.Merge(m, src) +} +func (m *AddNICResponse) XXX_Size() int { + return m.Size() +} +func (m *AddNICResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AddNICResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AddNICResponse proto.InternalMessageInfo + +type DeleteNICRequest struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + NicID string `protobuf:"bytes,2,opt,name=nic_id,json=nicId,proto3" json:"nic_id,omitempty"` + EndpointName string `protobuf:"bytes,3,opt,name=endpoint_name,json=endpointName,proto3" json:"endpoint_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteNICRequest) Reset() { *m = DeleteNICRequest{} } +func (*DeleteNICRequest) ProtoMessage() {} +func (*DeleteNICRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{2} +} +func (m *DeleteNICRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteNICRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteNICRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteNICRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteNICRequest.Merge(m, src) +} +func (m *DeleteNICRequest) XXX_Size() int { + return m.Size() +} +func (m *DeleteNICRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteNICRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteNICRequest proto.InternalMessageInfo + +type DeleteNICResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteNICResponse) Reset() { *m = DeleteNICResponse{} } +func (*DeleteNICResponse) ProtoMessage() {} +func (*DeleteNICResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{3} +} +func (m *DeleteNICResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteNICResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteNICResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteNICResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteNICResponse.Merge(m, src) +} +func (m *DeleteNICResponse) XXX_Size() int { + return m.Size() +} +func (m *DeleteNICResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteNICResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteNICResponse proto.InternalMessageInfo + +type CreateNetworkRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Mode CreateNetworkRequest_NetworkMode `protobuf:"varint,2,opt,name=mode,proto3,enum=ncproxygrpc.CreateNetworkRequest_NetworkMode" json:"mode,omitempty"` + SwitchName string `protobuf:"bytes,3,opt,name=switch_name,json=switchName,proto3" json:"switch_name,omitempty"` + IpamType CreateNetworkRequest_IpamType `protobuf:"varint,4,opt,name=ipam_type,json=ipamType,proto3,enum=ncproxygrpc.CreateNetworkRequest_IpamType" json:"ipam_type,omitempty"` + SubnetIpadressPrefix []string `protobuf:"bytes,5,rep,name=subnet_ipadress_prefix,json=subnetIpadressPrefix,proto3" json:"subnet_ipadress_prefix,omitempty"` + DefaultGateway string `protobuf:"bytes,6,opt,name=default_gateway,json=defaultGateway,proto3" json:"default_gateway,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateNetworkRequest) Reset() { *m = CreateNetworkRequest{} } +func (*CreateNetworkRequest) ProtoMessage() {} +func (*CreateNetworkRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{4} +} +func (m *CreateNetworkRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateNetworkRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateNetworkRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CreateNetworkRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateNetworkRequest.Merge(m, src) +} +func (m *CreateNetworkRequest) XXX_Size() int { + return m.Size() +} +func (m *CreateNetworkRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateNetworkRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateNetworkRequest proto.InternalMessageInfo + +type CreateNetworkResponse struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateNetworkResponse) Reset() { *m = CreateNetworkResponse{} } +func (*CreateNetworkResponse) ProtoMessage() {} +func (*CreateNetworkResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{5} +} +func (m *CreateNetworkResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateNetworkResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateNetworkResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CreateNetworkResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateNetworkResponse.Merge(m, src) +} +func (m *CreateNetworkResponse) XXX_Size() int { + return m.Size() +} +func (m *CreateNetworkResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CreateNetworkResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateNetworkResponse proto.InternalMessageInfo + +type CreateEndpointRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Macaddress string `protobuf:"bytes,2,opt,name=macaddress,proto3" json:"macaddress,omitempty"` + Ipaddress string `protobuf:"bytes,3,opt,name=ipaddress,proto3" json:"ipaddress,omitempty"` + IpaddressPrefixlength string `protobuf:"bytes,4,opt,name=ipaddress_prefixlength,json=ipaddressPrefixlength,proto3" json:"ipaddress_prefixlength,omitempty"` + PolicyType CreateEndpointRequest_EndpointPolicyType `protobuf:"varint,5,opt,name=policy_type,json=policyType,proto3,enum=ncproxygrpc.CreateEndpointRequest_EndpointPolicyType" json:"policy_type,omitempty"` + PortnamePolicySetting *CreateEndpointRequest_PortNameEndpointPolicySetting `protobuf:"bytes,6,opt,name=portname_policy_setting,json=portnamePolicySetting,proto3" json:"portname_policy_setting,omitempty"` + NetworkName string `protobuf:"bytes,7,opt,name=network_name,json=networkName,proto3" json:"network_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateEndpointRequest) Reset() { *m = CreateEndpointRequest{} } +func (*CreateEndpointRequest) ProtoMessage() {} +func (*CreateEndpointRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{6} +} +func (m *CreateEndpointRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateEndpointRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateEndpointRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CreateEndpointRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateEndpointRequest.Merge(m, src) +} +func (m *CreateEndpointRequest) XXX_Size() int { + return m.Size() +} +func (m *CreateEndpointRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateEndpointRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateEndpointRequest proto.InternalMessageInfo + +type CreateEndpointRequest_PortNameEndpointPolicySetting struct { + PortName string `protobuf:"bytes,1,opt,name=port_name,json=portName,proto3" json:"port_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateEndpointRequest_PortNameEndpointPolicySetting) Reset() { + *m = CreateEndpointRequest_PortNameEndpointPolicySetting{} +} +func (*CreateEndpointRequest_PortNameEndpointPolicySetting) ProtoMessage() {} +func (*CreateEndpointRequest_PortNameEndpointPolicySetting) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{6, 0} +} +func (m *CreateEndpointRequest_PortNameEndpointPolicySetting) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateEndpointRequest_PortNameEndpointPolicySetting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateEndpointRequest_PortNameEndpointPolicySetting.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CreateEndpointRequest_PortNameEndpointPolicySetting) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateEndpointRequest_PortNameEndpointPolicySetting.Merge(m, src) +} +func (m *CreateEndpointRequest_PortNameEndpointPolicySetting) XXX_Size() int { + return m.Size() +} +func (m *CreateEndpointRequest_PortNameEndpointPolicySetting) XXX_DiscardUnknown() { + xxx_messageInfo_CreateEndpointRequest_PortNameEndpointPolicySetting.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateEndpointRequest_PortNameEndpointPolicySetting proto.InternalMessageInfo + +type CreateEndpointResponse struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateEndpointResponse) Reset() { *m = CreateEndpointResponse{} } +func (*CreateEndpointResponse) ProtoMessage() {} +func (*CreateEndpointResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{7} +} +func (m *CreateEndpointResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateEndpointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateEndpointResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CreateEndpointResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateEndpointResponse.Merge(m, src) +} +func (m *CreateEndpointResponse) XXX_Size() int { + return m.Size() +} +func (m *CreateEndpointResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CreateEndpointResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateEndpointResponse proto.InternalMessageInfo + +type AddEndpointRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + NamespaceID string `protobuf:"bytes,2,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AddEndpointRequest) Reset() { *m = AddEndpointRequest{} } +func (*AddEndpointRequest) ProtoMessage() {} +func (*AddEndpointRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{8} +} +func (m *AddEndpointRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AddEndpointRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AddEndpointRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AddEndpointRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddEndpointRequest.Merge(m, src) +} +func (m *AddEndpointRequest) XXX_Size() int { + return m.Size() +} +func (m *AddEndpointRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AddEndpointRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AddEndpointRequest proto.InternalMessageInfo + +type AddEndpointResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AddEndpointResponse) Reset() { *m = AddEndpointResponse{} } +func (*AddEndpointResponse) ProtoMessage() {} +func (*AddEndpointResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{9} +} +func (m *AddEndpointResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AddEndpointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AddEndpointResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AddEndpointResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddEndpointResponse.Merge(m, src) +} +func (m *AddEndpointResponse) XXX_Size() int { + return m.Size() +} +func (m *AddEndpointResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AddEndpointResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AddEndpointResponse proto.InternalMessageInfo + +type DeleteEndpointRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteEndpointRequest) Reset() { *m = DeleteEndpointRequest{} } +func (*DeleteEndpointRequest) ProtoMessage() {} +func (*DeleteEndpointRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{10} +} +func (m *DeleteEndpointRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteEndpointRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteEndpointRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteEndpointRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteEndpointRequest.Merge(m, src) +} +func (m *DeleteEndpointRequest) XXX_Size() int { + return m.Size() +} +func (m *DeleteEndpointRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteEndpointRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteEndpointRequest proto.InternalMessageInfo + +type DeleteEndpointResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteEndpointResponse) Reset() { *m = DeleteEndpointResponse{} } +func (*DeleteEndpointResponse) ProtoMessage() {} +func (*DeleteEndpointResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{11} +} +func (m *DeleteEndpointResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteEndpointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteEndpointResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteEndpointResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteEndpointResponse.Merge(m, src) +} +func (m *DeleteEndpointResponse) XXX_Size() int { + return m.Size() +} +func (m *DeleteEndpointResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteEndpointResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteEndpointResponse proto.InternalMessageInfo + +type DeleteNetworkRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteNetworkRequest) Reset() { *m = DeleteNetworkRequest{} } +func (*DeleteNetworkRequest) ProtoMessage() {} +func (*DeleteNetworkRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{12} +} +func (m *DeleteNetworkRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteNetworkRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteNetworkRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteNetworkRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteNetworkRequest.Merge(m, src) +} +func (m *DeleteNetworkRequest) XXX_Size() int { + return m.Size() +} +func (m *DeleteNetworkRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteNetworkRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteNetworkRequest proto.InternalMessageInfo + +type DeleteNetworkResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteNetworkResponse) Reset() { *m = DeleteNetworkResponse{} } +func (*DeleteNetworkResponse) ProtoMessage() {} +func (*DeleteNetworkResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{13} +} +func (m *DeleteNetworkResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteNetworkResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteNetworkResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteNetworkResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteNetworkResponse.Merge(m, src) +} +func (m *DeleteNetworkResponse) XXX_Size() int { + return m.Size() +} +func (m *DeleteNetworkResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteNetworkResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteNetworkResponse proto.InternalMessageInfo + +type GetEndpointRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetEndpointRequest) Reset() { *m = GetEndpointRequest{} } +func (*GetEndpointRequest) ProtoMessage() {} +func (*GetEndpointRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{14} +} +func (m *GetEndpointRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetEndpointRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetEndpointRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetEndpointRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetEndpointRequest.Merge(m, src) +} +func (m *GetEndpointRequest) XXX_Size() int { + return m.Size() +} +func (m *GetEndpointRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetEndpointRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetEndpointRequest proto.InternalMessageInfo + +type GetEndpointResponse struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Network string `protobuf:"bytes,3,opt,name=network,proto3" json:"network,omitempty"` + Namespace string `protobuf:"bytes,4,opt,name=namespace,proto3" json:"namespace,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetEndpointResponse) Reset() { *m = GetEndpointResponse{} } +func (*GetEndpointResponse) ProtoMessage() {} +func (*GetEndpointResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{15} +} +func (m *GetEndpointResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetEndpointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetEndpointResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetEndpointResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetEndpointResponse.Merge(m, src) +} +func (m *GetEndpointResponse) XXX_Size() int { + return m.Size() +} +func (m *GetEndpointResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetEndpointResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetEndpointResponse proto.InternalMessageInfo + +type GetNetworkRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetNetworkRequest) Reset() { *m = GetNetworkRequest{} } +func (*GetNetworkRequest) ProtoMessage() {} +func (*GetNetworkRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{16} +} +func (m *GetNetworkRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetNetworkRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetNetworkRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetNetworkRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetNetworkRequest.Merge(m, src) +} +func (m *GetNetworkRequest) XXX_Size() int { + return m.Size() +} +func (m *GetNetworkRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetNetworkRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetNetworkRequest proto.InternalMessageInfo + +type GetNetworkResponse struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetNetworkResponse) Reset() { *m = GetNetworkResponse{} } +func (*GetNetworkResponse) ProtoMessage() {} +func (*GetNetworkResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{17} +} +func (m *GetNetworkResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetNetworkResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetNetworkResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetNetworkResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetNetworkResponse.Merge(m, src) +} +func (m *GetNetworkResponse) XXX_Size() int { + return m.Size() +} +func (m *GetNetworkResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetNetworkResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetNetworkResponse proto.InternalMessageInfo + +type GetEndpointsRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetEndpointsRequest) Reset() { *m = GetEndpointsRequest{} } +func (*GetEndpointsRequest) ProtoMessage() {} +func (*GetEndpointsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{18} +} +func (m *GetEndpointsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetEndpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetEndpointsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetEndpointsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetEndpointsRequest.Merge(m, src) +} +func (m *GetEndpointsRequest) XXX_Size() int { + return m.Size() +} +func (m *GetEndpointsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetEndpointsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetEndpointsRequest proto.InternalMessageInfo + +type GetEndpointsResponse struct { + Endpoints []*GetEndpointResponse `protobuf:"bytes,1,rep,name=endpoints,proto3" json:"endpoints,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetEndpointsResponse) Reset() { *m = GetEndpointsResponse{} } +func (*GetEndpointsResponse) ProtoMessage() {} +func (*GetEndpointsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{19} +} +func (m *GetEndpointsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetEndpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetEndpointsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetEndpointsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetEndpointsResponse.Merge(m, src) +} +func (m *GetEndpointsResponse) XXX_Size() int { + return m.Size() +} +func (m *GetEndpointsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetEndpointsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetEndpointsResponse proto.InternalMessageInfo + +type GetNetworksRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetNetworksRequest) Reset() { *m = GetNetworksRequest{} } +func (*GetNetworksRequest) ProtoMessage() {} +func (*GetNetworksRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{20} +} +func (m *GetNetworksRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetNetworksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetNetworksRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetNetworksRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetNetworksRequest.Merge(m, src) +} +func (m *GetNetworksRequest) XXX_Size() int { + return m.Size() +} +func (m *GetNetworksRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetNetworksRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetNetworksRequest proto.InternalMessageInfo + +type GetNetworksResponse struct { + Networks []*GetNetworkResponse `protobuf:"bytes,1,rep,name=networks,proto3" json:"networks,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetNetworksResponse) Reset() { *m = GetNetworksResponse{} } +func (*GetNetworksResponse) ProtoMessage() {} +func (*GetNetworksResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4dbe7e533383a60, []int{21} +} +func (m *GetNetworksResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetNetworksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetNetworksResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetNetworksResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetNetworksResponse.Merge(m, src) +} +func (m *GetNetworksResponse) XXX_Size() int { + return m.Size() +} +func (m *GetNetworksResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetNetworksResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetNetworksResponse proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("ncproxygrpc.CreateNetworkRequest_NetworkMode", CreateNetworkRequest_NetworkMode_name, CreateNetworkRequest_NetworkMode_value) + proto.RegisterEnum("ncproxygrpc.CreateNetworkRequest_IpamType", CreateNetworkRequest_IpamType_name, CreateNetworkRequest_IpamType_value) + proto.RegisterEnum("ncproxygrpc.CreateEndpointRequest_EndpointPolicyType", CreateEndpointRequest_EndpointPolicyType_name, CreateEndpointRequest_EndpointPolicyType_value) + proto.RegisterType((*AddNICRequest)(nil), "ncproxygrpc.AddNICRequest") + proto.RegisterType((*AddNICResponse)(nil), "ncproxygrpc.AddNICResponse") + proto.RegisterType((*DeleteNICRequest)(nil), "ncproxygrpc.DeleteNICRequest") + proto.RegisterType((*DeleteNICResponse)(nil), "ncproxygrpc.DeleteNICResponse") + proto.RegisterType((*CreateNetworkRequest)(nil), "ncproxygrpc.CreateNetworkRequest") + proto.RegisterType((*CreateNetworkResponse)(nil), "ncproxygrpc.CreateNetworkResponse") + proto.RegisterType((*CreateEndpointRequest)(nil), "ncproxygrpc.CreateEndpointRequest") + proto.RegisterType((*CreateEndpointRequest_PortNameEndpointPolicySetting)(nil), "ncproxygrpc.CreateEndpointRequest.PortNameEndpointPolicySetting") + proto.RegisterType((*CreateEndpointResponse)(nil), "ncproxygrpc.CreateEndpointResponse") + proto.RegisterType((*AddEndpointRequest)(nil), "ncproxygrpc.AddEndpointRequest") + proto.RegisterType((*AddEndpointResponse)(nil), "ncproxygrpc.AddEndpointResponse") + proto.RegisterType((*DeleteEndpointRequest)(nil), "ncproxygrpc.DeleteEndpointRequest") + proto.RegisterType((*DeleteEndpointResponse)(nil), "ncproxygrpc.DeleteEndpointResponse") + proto.RegisterType((*DeleteNetworkRequest)(nil), "ncproxygrpc.DeleteNetworkRequest") + proto.RegisterType((*DeleteNetworkResponse)(nil), "ncproxygrpc.DeleteNetworkResponse") + proto.RegisterType((*GetEndpointRequest)(nil), "ncproxygrpc.GetEndpointRequest") + proto.RegisterType((*GetEndpointResponse)(nil), "ncproxygrpc.GetEndpointResponse") + proto.RegisterType((*GetNetworkRequest)(nil), "ncproxygrpc.GetNetworkRequest") + proto.RegisterType((*GetNetworkResponse)(nil), "ncproxygrpc.GetNetworkResponse") + proto.RegisterType((*GetEndpointsRequest)(nil), "ncproxygrpc.GetEndpointsRequest") + proto.RegisterType((*GetEndpointsResponse)(nil), "ncproxygrpc.GetEndpointsResponse") + proto.RegisterType((*GetNetworksRequest)(nil), "ncproxygrpc.GetNetworksRequest") + proto.RegisterType((*GetNetworksResponse)(nil), "ncproxygrpc.GetNetworksResponse") +} + +func init() { + proto.RegisterFile("github.com/Microsoft/hcsshim/cmd/ncproxy/ncproxygrpc/networkconfigproxy.proto", fileDescriptor_b4dbe7e533383a60) +} + +var fileDescriptor_b4dbe7e533383a60 = []byte{ + // 1041 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0x8f, 0xd3, 0x36, 0x4d, 0x9e, 0xd3, 0x36, 0xfb, 0x9a, 0x64, 0xa3, 0x2c, 0xeb, 0xa4, 0xb3, + 0x87, 0xad, 0x16, 0x91, 0xa0, 0xc0, 0x9e, 0x40, 0x68, 0xbb, 0x09, 0x2a, 0x91, 0x68, 0x88, 0xbc, + 0xcb, 0x0a, 0x09, 0xa4, 0xc8, 0xb5, 0xa7, 0x89, 0x45, 0x63, 0x1b, 0x7b, 0xaa, 0x36, 0x37, 0xce, + 0x48, 0x7c, 0x20, 0xbe, 0xc1, 0x1e, 0x39, 0x72, 0xaa, 0x68, 0xbe, 0x04, 0x1c, 0x91, 0xc7, 0x63, + 0xc7, 0x36, 0xf9, 0x77, 0xdc, 0x93, 0xed, 0xf7, 0xde, 0xfc, 0xde, 0xef, 0xfd, 0x1d, 0xc3, 0xc5, + 0xd8, 0x64, 0x93, 0x9b, 0xcb, 0x96, 0x6e, 0x4f, 0xdb, 0x17, 0xa6, 0xee, 0xda, 0x9e, 0x7d, 0xc5, + 0xda, 0x13, 0xdd, 0xf3, 0x26, 0xe6, 0xb4, 0xad, 0x4f, 0x8d, 0xb6, 0xa5, 0x3b, 0xae, 0x7d, 0x37, + 0x0b, 0x9f, 0x63, 0xd7, 0xd1, 0xdb, 0x16, 0x65, 0xb7, 0xb6, 0xfb, 0xb3, 0x6e, 0x5b, 0x57, 0xe6, + 0x98, 0x8b, 0x5b, 0x8e, 0x6b, 0x33, 0x1b, 0xe5, 0x98, 0x15, 0xf9, 0x4d, 0x82, 0x83, 0x33, 0xc3, + 0x18, 0xf4, 0xbb, 0x2a, 0xfd, 0xe5, 0x86, 0x7a, 0x0c, 0x3b, 0x50, 0xd4, 0x6d, 0x8b, 0x69, 0xa6, + 0x45, 0xdd, 0x91, 0x69, 0xd4, 0xa4, 0xa6, 0x74, 0x5a, 0x78, 0x7d, 0x34, 0xbf, 0x6f, 0xc8, 0xdd, + 0x50, 0xde, 0xef, 0xa9, 0x72, 0x64, 0xd4, 0x37, 0xb0, 0x09, 0x39, 0xcb, 0xd4, 0x7d, 0xeb, 0x2c, + 0xb7, 0x2e, 0xcc, 0xef, 0x1b, 0x7b, 0x03, 0x53, 0xef, 0xf7, 0xd4, 0x3d, 0xcb, 0xd4, 0xfb, 0x06, + 0x3e, 0x83, 0x03, 0x6a, 0x19, 0x8e, 0x6d, 0x5a, 0x6c, 0x64, 0x69, 0x53, 0x5a, 0xdb, 0xf1, 0x0d, + 0xd5, 0x62, 0x28, 0x1c, 0x68, 0x53, 0x4a, 0x4a, 0x70, 0x18, 0x72, 0xf1, 0x1c, 0xdb, 0xf2, 0x28, + 0xf9, 0x5d, 0x82, 0x52, 0x8f, 0x5e, 0x53, 0x46, 0x3f, 0x0c, 0x86, 0xc7, 0xf0, 0x28, 0x46, 0x47, + 0x90, 0xfc, 0x37, 0x0b, 0xe5, 0xae, 0x4b, 0x35, 0x46, 0x07, 0x41, 0xce, 0x43, 0xa2, 0x08, 0xbb, + 0x1c, 0x89, 0x13, 0x54, 0xf9, 0x3b, 0x9e, 0xc1, 0xee, 0xd4, 0x36, 0x28, 0xa7, 0x71, 0xd8, 0xf9, + 0xa4, 0x15, 0x2b, 0x46, 0x6b, 0x19, 0x48, 0x4b, 0x7c, 0x5e, 0xd8, 0x06, 0x55, 0xf9, 0x51, 0x6c, + 0x80, 0xec, 0xdd, 0x9a, 0x4c, 0x9f, 0xc4, 0x79, 0x42, 0x20, 0xf2, 0x59, 0xe2, 0x39, 0x14, 0x4c, + 0x47, 0x9b, 0x8e, 0xd8, 0xcc, 0xa1, 0xb5, 0x5d, 0xee, 0xe8, 0xc5, 0x66, 0x47, 0x7d, 0x47, 0x9b, + 0xbe, 0x9d, 0x39, 0x54, 0xcd, 0x9b, 0xe2, 0x0d, 0x3f, 0x87, 0xaa, 0x77, 0x73, 0x69, 0x51, 0x36, + 0x32, 0x1d, 0xcd, 0x70, 0xa9, 0xe7, 0x8d, 0x1c, 0x97, 0x5e, 0x99, 0x77, 0xb5, 0xbd, 0xe6, 0xce, + 0x69, 0x41, 0x2d, 0x07, 0xda, 0xbe, 0x50, 0x0e, 0xb9, 0x0e, 0x9f, 0xc3, 0x91, 0x41, 0xaf, 0xb4, + 0x9b, 0x6b, 0x36, 0x1a, 0x6b, 0x8c, 0xde, 0x6a, 0xb3, 0x5a, 0x8e, 0x73, 0x3c, 0x14, 0xe2, 0xf3, + 0x40, 0x4a, 0x14, 0x90, 0x63, 0xd1, 0xe1, 0x11, 0xc8, 0x6f, 0x5d, 0xcd, 0xf2, 0x1c, 0xcd, 0xa5, + 0x16, 0x2b, 0x65, 0x48, 0x13, 0xf2, 0x21, 0x29, 0x04, 0xc8, 0xbd, 0x61, 0x1a, 0x33, 0xf5, 0x52, + 0x06, 0xf3, 0xb0, 0xdb, 0xfb, 0xa6, 0x3b, 0x2c, 0x49, 0xa4, 0x0d, 0x95, 0x54, 0x2c, 0x41, 0x4d, + 0xb0, 0x0a, 0xd9, 0xa8, 0x33, 0x72, 0xf3, 0xfb, 0x46, 0xb6, 0xdf, 0x53, 0xb3, 0xa6, 0x41, 0xfe, + 0xd9, 0x09, 0x4f, 0x7c, 0x2d, 0xea, 0xba, 0xae, 0x58, 0x0a, 0xc0, 0x54, 0xd3, 0x35, 0x83, 0x47, + 0x17, 0x74, 0x8e, 0x1a, 0x93, 0xe0, 0x47, 0x3c, 0xd1, 0x42, 0x1d, 0xd4, 0x61, 0x21, 0xc0, 0x97, + 0x50, 0x8d, 0x3e, 0x44, 0xde, 0xae, 0xa9, 0x35, 0x66, 0x13, 0x5e, 0x93, 0x82, 0x5a, 0x89, 0xb4, + 0xc3, 0x98, 0x12, 0xdf, 0x81, 0xec, 0xd8, 0xd7, 0xa6, 0x3e, 0x0b, 0xea, 0xb7, 0xc7, 0xeb, 0xf7, + 0x72, 0x49, 0xfd, 0x52, 0x11, 0xb4, 0xc2, 0xef, 0x21, 0x3f, 0xcd, 0x4b, 0x09, 0x4e, 0xf4, 0x8e, + 0x77, 0xf0, 0xd8, 0xb1, 0x5d, 0xe6, 0x07, 0x36, 0x12, 0x0e, 0x3c, 0xca, 0x98, 0x69, 0x8d, 0x79, + 0x79, 0xe4, 0xce, 0xab, 0x2d, 0x7c, 0x0c, 0x6d, 0x97, 0x4f, 0x42, 0xd2, 0xd7, 0x9b, 0x00, 0x47, + 0xad, 0x84, 0x0e, 0x12, 0x62, 0x3c, 0x81, 0xa2, 0xd8, 0x46, 0x41, 0xc7, 0xee, 0xf3, 0xf0, 0x65, + 0x21, 0xf3, 0xe1, 0xea, 0x5f, 0xc2, 0xd3, 0xb5, 0xd0, 0xf8, 0x04, 0x0a, 0x3e, 0xf8, 0x28, 0x56, + 0xa3, 0xbc, 0x23, 0x4e, 0x10, 0x02, 0xf8, 0xff, 0xe0, 0xb1, 0x08, 0xf9, 0x10, 0xb3, 0x94, 0x21, + 0x9f, 0x42, 0x35, 0x1d, 0xd2, 0x86, 0x5e, 0xf9, 0x09, 0xf0, 0xcc, 0x30, 0xb6, 0xe9, 0x93, 0x0e, + 0x14, 0xfd, 0xa7, 0xe7, 0x68, 0x3a, 0x5d, 0xec, 0x18, 0xbe, 0x91, 0x06, 0xa1, 0xdc, 0xdf, 0x48, + 0x91, 0x51, 0xdf, 0x20, 0x15, 0x38, 0x4e, 0xa0, 0x8b, 0x65, 0xf2, 0x31, 0x54, 0x82, 0x0d, 0xb3, + 0x85, 0x5f, 0x52, 0x83, 0x6a, 0xda, 0x58, 0xc0, 0xbc, 0x80, 0xb2, 0x58, 0x54, 0x1b, 0x57, 0x12, + 0x79, 0x1c, 0xba, 0x4c, 0x0d, 0x11, 0x39, 0x05, 0x3c, 0xa7, 0x6c, 0x1b, 0x22, 0x33, 0x38, 0x4e, + 0x58, 0xae, 0xcf, 0x6c, 0x04, 0x91, 0x8d, 0xe5, 0xb0, 0x06, 0xfb, 0xa2, 0x21, 0xc4, 0x24, 0x85, + 0x9f, 0xfe, 0x94, 0x45, 0x89, 0x13, 0xa3, 0xb3, 0x10, 0x90, 0xe7, 0xf0, 0xe8, 0x9c, 0xb2, 0x2d, + 0xc2, 0x7c, 0xc5, 0xa3, 0xd9, 0x72, 0x51, 0x2c, 0xa3, 0xe8, 0x97, 0x2c, 0x16, 0xa5, 0x27, 0x9c, + 0x91, 0x77, 0x50, 0x4e, 0x8a, 0x05, 0xf4, 0x57, 0x50, 0x08, 0x2f, 0x0f, 0xaf, 0x26, 0x35, 0x77, + 0x4e, 0xe5, 0x4e, 0x33, 0x31, 0x62, 0x4b, 0x52, 0xa6, 0x2e, 0x8e, 0x90, 0x72, 0x9c, 0x70, 0xe4, + 0x4d, 0xe5, 0x24, 0x16, 0x52, 0xe1, 0xec, 0x0b, 0xc8, 0x8b, 0x7c, 0x85, 0xbe, 0x1a, 0x69, 0x5f, + 0xa9, 0xd0, 0xd5, 0xe8, 0x40, 0xe7, 0x8f, 0x7d, 0x40, 0xa1, 0xed, 0xf2, 0xff, 0x85, 0xa1, 0x7f, + 0x0e, 0xbb, 0x90, 0x0b, 0xee, 0x63, 0xac, 0x27, 0xb0, 0x12, 0x3f, 0x0c, 0xf5, 0x27, 0x4b, 0x75, + 0xa2, 0x85, 0x32, 0xf8, 0x2d, 0x14, 0xa2, 0x2b, 0x13, 0x9f, 0x26, 0x6c, 0xd3, 0x37, 0x7b, 0x5d, + 0x59, 0xa5, 0x8e, 0xd0, 0x7e, 0x80, 0x83, 0xc4, 0xc2, 0xc7, 0x93, 0x8d, 0x17, 0x5b, 0x9d, 0xac, + 0x33, 0x89, 0x90, 0x7f, 0x84, 0xc3, 0xe4, 0x7e, 0x40, 0xb2, 0x79, 0x1f, 0xd6, 0x9f, 0xad, 0xb5, + 0x89, 0xc0, 0x55, 0x90, 0x63, 0xc3, 0x8e, 0x8d, 0x74, 0xca, 0xd2, 0xb0, 0xcd, 0xd5, 0x06, 0x71, + 0xc2, 0xc9, 0xe1, 0x4f, 0x11, 0x5e, 0xba, 0x46, 0x52, 0x84, 0x57, 0x6c, 0x0f, 0x9e, 0xe7, 0xc4, + 0x4e, 0x48, 0xe5, 0x79, 0xd9, 0x6e, 0xa9, 0x93, 0x75, 0x26, 0xf1, 0x54, 0xc4, 0xfa, 0x1e, 0x1b, + 0xab, 0x27, 0x62, 0x59, 0x2a, 0x96, 0x8c, 0x0c, 0xc9, 0xe0, 0x77, 0x00, 0x8b, 0xfe, 0x46, 0x65, + 0x65, 0xe3, 0x07, 0x88, 0x9b, 0x06, 0x83, 0x64, 0xf0, 0x7b, 0x28, 0xc6, 0x47, 0x1a, 0x57, 0x92, + 0x08, 0xc7, 0xb2, 0x7e, 0xb2, 0xc6, 0x22, 0x15, 0x7b, 0x38, 0xbb, 0xb8, 0x8a, 0x88, 0xb7, 0x32, + 0xf6, 0xf4, 0xd8, 0x93, 0xcc, 0xeb, 0xda, 0xfb, 0x07, 0x25, 0xf3, 0xd7, 0x83, 0x92, 0xf9, 0x75, + 0xae, 0x48, 0xef, 0xe7, 0x8a, 0xf4, 0xe7, 0x5c, 0x91, 0xfe, 0x9e, 0x2b, 0xd2, 0x65, 0x8e, 0xff, + 0xef, 0x7f, 0xf6, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xba, 0xe3, 0xef, 0x3b, 0x40, 0x0c, 0x00, + 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// NetworkConfigProxyClient is the client API for NetworkConfigProxy service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NetworkConfigProxyClient interface { + AddNIC(ctx context.Context, in *AddNICRequest, opts ...grpc.CallOption) (*AddNICResponse, error) + DeleteNIC(ctx context.Context, in *DeleteNICRequest, opts ...grpc.CallOption) (*DeleteNICResponse, error) + CreateNetwork(ctx context.Context, in *CreateNetworkRequest, opts ...grpc.CallOption) (*CreateNetworkResponse, error) + CreateEndpoint(ctx context.Context, in *CreateEndpointRequest, opts ...grpc.CallOption) (*CreateEndpointResponse, error) + AddEndpoint(ctx context.Context, in *AddEndpointRequest, opts ...grpc.CallOption) (*AddEndpointResponse, error) + DeleteEndpoint(ctx context.Context, in *DeleteEndpointRequest, opts ...grpc.CallOption) (*DeleteEndpointResponse, error) + DeleteNetwork(ctx context.Context, in *DeleteNetworkRequest, opts ...grpc.CallOption) (*DeleteNetworkResponse, error) + GetEndpoint(ctx context.Context, in *GetEndpointRequest, opts ...grpc.CallOption) (*GetEndpointResponse, error) + GetNetwork(ctx context.Context, in *GetNetworkRequest, opts ...grpc.CallOption) (*GetNetworkResponse, error) + GetEndpoints(ctx context.Context, in *GetEndpointsRequest, opts ...grpc.CallOption) (*GetEndpointsResponse, error) + GetNetworks(ctx context.Context, in *GetNetworksRequest, opts ...grpc.CallOption) (*GetNetworksResponse, error) +} + +type networkConfigProxyClient struct { + cc *grpc.ClientConn +} + +func NewNetworkConfigProxyClient(cc *grpc.ClientConn) NetworkConfigProxyClient { + return &networkConfigProxyClient{cc} +} + +func (c *networkConfigProxyClient) AddNIC(ctx context.Context, in *AddNICRequest, opts ...grpc.CallOption) (*AddNICResponse, error) { + out := new(AddNICResponse) + err := c.cc.Invoke(ctx, "/ncproxygrpc.NetworkConfigProxy/AddNIC", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *networkConfigProxyClient) DeleteNIC(ctx context.Context, in *DeleteNICRequest, opts ...grpc.CallOption) (*DeleteNICResponse, error) { + out := new(DeleteNICResponse) + err := c.cc.Invoke(ctx, "/ncproxygrpc.NetworkConfigProxy/DeleteNIC", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *networkConfigProxyClient) CreateNetwork(ctx context.Context, in *CreateNetworkRequest, opts ...grpc.CallOption) (*CreateNetworkResponse, error) { + out := new(CreateNetworkResponse) + err := c.cc.Invoke(ctx, "/ncproxygrpc.NetworkConfigProxy/CreateNetwork", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *networkConfigProxyClient) CreateEndpoint(ctx context.Context, in *CreateEndpointRequest, opts ...grpc.CallOption) (*CreateEndpointResponse, error) { + out := new(CreateEndpointResponse) + err := c.cc.Invoke(ctx, "/ncproxygrpc.NetworkConfigProxy/CreateEndpoint", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *networkConfigProxyClient) AddEndpoint(ctx context.Context, in *AddEndpointRequest, opts ...grpc.CallOption) (*AddEndpointResponse, error) { + out := new(AddEndpointResponse) + err := c.cc.Invoke(ctx, "/ncproxygrpc.NetworkConfigProxy/AddEndpoint", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *networkConfigProxyClient) DeleteEndpoint(ctx context.Context, in *DeleteEndpointRequest, opts ...grpc.CallOption) (*DeleteEndpointResponse, error) { + out := new(DeleteEndpointResponse) + err := c.cc.Invoke(ctx, "/ncproxygrpc.NetworkConfigProxy/DeleteEndpoint", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *networkConfigProxyClient) DeleteNetwork(ctx context.Context, in *DeleteNetworkRequest, opts ...grpc.CallOption) (*DeleteNetworkResponse, error) { + out := new(DeleteNetworkResponse) + err := c.cc.Invoke(ctx, "/ncproxygrpc.NetworkConfigProxy/DeleteNetwork", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *networkConfigProxyClient) GetEndpoint(ctx context.Context, in *GetEndpointRequest, opts ...grpc.CallOption) (*GetEndpointResponse, error) { + out := new(GetEndpointResponse) + err := c.cc.Invoke(ctx, "/ncproxygrpc.NetworkConfigProxy/GetEndpoint", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *networkConfigProxyClient) GetNetwork(ctx context.Context, in *GetNetworkRequest, opts ...grpc.CallOption) (*GetNetworkResponse, error) { + out := new(GetNetworkResponse) + err := c.cc.Invoke(ctx, "/ncproxygrpc.NetworkConfigProxy/GetNetwork", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *networkConfigProxyClient) GetEndpoints(ctx context.Context, in *GetEndpointsRequest, opts ...grpc.CallOption) (*GetEndpointsResponse, error) { + out := new(GetEndpointsResponse) + err := c.cc.Invoke(ctx, "/ncproxygrpc.NetworkConfigProxy/GetEndpoints", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *networkConfigProxyClient) GetNetworks(ctx context.Context, in *GetNetworksRequest, opts ...grpc.CallOption) (*GetNetworksResponse, error) { + out := new(GetNetworksResponse) + err := c.cc.Invoke(ctx, "/ncproxygrpc.NetworkConfigProxy/GetNetworks", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NetworkConfigProxyServer is the server API for NetworkConfigProxy service. +type NetworkConfigProxyServer interface { + AddNIC(context.Context, *AddNICRequest) (*AddNICResponse, error) + DeleteNIC(context.Context, *DeleteNICRequest) (*DeleteNICResponse, error) + CreateNetwork(context.Context, *CreateNetworkRequest) (*CreateNetworkResponse, error) + CreateEndpoint(context.Context, *CreateEndpointRequest) (*CreateEndpointResponse, error) + AddEndpoint(context.Context, *AddEndpointRequest) (*AddEndpointResponse, error) + DeleteEndpoint(context.Context, *DeleteEndpointRequest) (*DeleteEndpointResponse, error) + DeleteNetwork(context.Context, *DeleteNetworkRequest) (*DeleteNetworkResponse, error) + GetEndpoint(context.Context, *GetEndpointRequest) (*GetEndpointResponse, error) + GetNetwork(context.Context, *GetNetworkRequest) (*GetNetworkResponse, error) + GetEndpoints(context.Context, *GetEndpointsRequest) (*GetEndpointsResponse, error) + GetNetworks(context.Context, *GetNetworksRequest) (*GetNetworksResponse, error) +} + +func RegisterNetworkConfigProxyServer(s *grpc.Server, srv NetworkConfigProxyServer) { + s.RegisterService(&_NetworkConfigProxy_serviceDesc, srv) +} + +func _NetworkConfigProxy_AddNIC_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddNICRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkConfigProxyServer).AddNIC(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ncproxygrpc.NetworkConfigProxy/AddNIC", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkConfigProxyServer).AddNIC(ctx, req.(*AddNICRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetworkConfigProxy_DeleteNIC_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteNICRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkConfigProxyServer).DeleteNIC(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ncproxygrpc.NetworkConfigProxy/DeleteNIC", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkConfigProxyServer).DeleteNIC(ctx, req.(*DeleteNICRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetworkConfigProxy_CreateNetwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateNetworkRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkConfigProxyServer).CreateNetwork(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ncproxygrpc.NetworkConfigProxy/CreateNetwork", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkConfigProxyServer).CreateNetwork(ctx, req.(*CreateNetworkRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetworkConfigProxy_CreateEndpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateEndpointRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkConfigProxyServer).CreateEndpoint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ncproxygrpc.NetworkConfigProxy/CreateEndpoint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkConfigProxyServer).CreateEndpoint(ctx, req.(*CreateEndpointRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetworkConfigProxy_AddEndpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddEndpointRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkConfigProxyServer).AddEndpoint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ncproxygrpc.NetworkConfigProxy/AddEndpoint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkConfigProxyServer).AddEndpoint(ctx, req.(*AddEndpointRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetworkConfigProxy_DeleteEndpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteEndpointRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkConfigProxyServer).DeleteEndpoint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ncproxygrpc.NetworkConfigProxy/DeleteEndpoint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkConfigProxyServer).DeleteEndpoint(ctx, req.(*DeleteEndpointRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetworkConfigProxy_DeleteNetwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteNetworkRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkConfigProxyServer).DeleteNetwork(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ncproxygrpc.NetworkConfigProxy/DeleteNetwork", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkConfigProxyServer).DeleteNetwork(ctx, req.(*DeleteNetworkRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetworkConfigProxy_GetEndpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetEndpointRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkConfigProxyServer).GetEndpoint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ncproxygrpc.NetworkConfigProxy/GetEndpoint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkConfigProxyServer).GetEndpoint(ctx, req.(*GetEndpointRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetworkConfigProxy_GetNetwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNetworkRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkConfigProxyServer).GetNetwork(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ncproxygrpc.NetworkConfigProxy/GetNetwork", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkConfigProxyServer).GetNetwork(ctx, req.(*GetNetworkRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetworkConfigProxy_GetEndpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetEndpointsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkConfigProxyServer).GetEndpoints(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ncproxygrpc.NetworkConfigProxy/GetEndpoints", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkConfigProxyServer).GetEndpoints(ctx, req.(*GetEndpointsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetworkConfigProxy_GetNetworks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNetworksRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkConfigProxyServer).GetNetworks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ncproxygrpc.NetworkConfigProxy/GetNetworks", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkConfigProxyServer).GetNetworks(ctx, req.(*GetNetworksRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _NetworkConfigProxy_serviceDesc = grpc.ServiceDesc{ + ServiceName: "ncproxygrpc.NetworkConfigProxy", + HandlerType: (*NetworkConfigProxyServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddNIC", + Handler: _NetworkConfigProxy_AddNIC_Handler, + }, + { + MethodName: "DeleteNIC", + Handler: _NetworkConfigProxy_DeleteNIC_Handler, + }, + { + MethodName: "CreateNetwork", + Handler: _NetworkConfigProxy_CreateNetwork_Handler, + }, + { + MethodName: "CreateEndpoint", + Handler: _NetworkConfigProxy_CreateEndpoint_Handler, + }, + { + MethodName: "AddEndpoint", + Handler: _NetworkConfigProxy_AddEndpoint_Handler, + }, + { + MethodName: "DeleteEndpoint", + Handler: _NetworkConfigProxy_DeleteEndpoint_Handler, + }, + { + MethodName: "DeleteNetwork", + Handler: _NetworkConfigProxy_DeleteNetwork_Handler, + }, + { + MethodName: "GetEndpoint", + Handler: _NetworkConfigProxy_GetEndpoint_Handler, + }, + { + MethodName: "GetNetwork", + Handler: _NetworkConfigProxy_GetNetwork_Handler, + }, + { + MethodName: "GetEndpoints", + Handler: _NetworkConfigProxy_GetEndpoints_Handler, + }, + { + MethodName: "GetNetworks", + Handler: _NetworkConfigProxy_GetNetworks_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/Microsoft/hcsshim/cmd/ncproxy/ncproxygrpc/networkconfigproxy.proto", +} + +func (m *AddNICRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AddNICRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if len(m.NicID) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.NicID))) + i += copy(dAtA[i:], m.NicID) + } + if len(m.EndpointName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.EndpointName))) + i += copy(dAtA[i:], m.EndpointName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AddNICResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AddNICResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteNICRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteNICRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if len(m.NicID) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.NicID))) + i += copy(dAtA[i:], m.NicID) + } + if len(m.EndpointName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.EndpointName))) + i += copy(dAtA[i:], m.EndpointName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteNICResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteNICResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CreateNetworkRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateNetworkRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Mode != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(m.Mode)) + } + if len(m.SwitchName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.SwitchName))) + i += copy(dAtA[i:], m.SwitchName) + } + if m.IpamType != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(m.IpamType)) + } + if len(m.SubnetIpadressPrefix) > 0 { + for _, s := range m.SubnetIpadressPrefix { + dAtA[i] = 0x2a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.DefaultGateway) > 0 { + dAtA[i] = 0x32 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.DefaultGateway))) + i += copy(dAtA[i:], m.DefaultGateway) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CreateNetworkResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateNetworkResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CreateEndpointRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateEndpointRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Macaddress) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Macaddress))) + i += copy(dAtA[i:], m.Macaddress) + } + if len(m.Ipaddress) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Ipaddress))) + i += copy(dAtA[i:], m.Ipaddress) + } + if len(m.IpaddressPrefixlength) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.IpaddressPrefixlength))) + i += copy(dAtA[i:], m.IpaddressPrefixlength) + } + if m.PolicyType != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(m.PolicyType)) + } + if m.PortnamePolicySetting != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(m.PortnamePolicySetting.Size())) + n1, err := m.PortnamePolicySetting.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if len(m.NetworkName) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.NetworkName))) + i += copy(dAtA[i:], m.NetworkName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CreateEndpointRequest_PortNameEndpointPolicySetting) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateEndpointRequest_PortNameEndpointPolicySetting) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.PortName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.PortName))) + i += copy(dAtA[i:], m.PortName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CreateEndpointResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateEndpointResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AddEndpointRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AddEndpointRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.NamespaceID) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.NamespaceID))) + i += copy(dAtA[i:], m.NamespaceID) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AddEndpointResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AddEndpointResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteEndpointRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteEndpointRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteEndpointResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteEndpointResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteNetworkRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteNetworkRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteNetworkResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteNetworkResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GetEndpointRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetEndpointRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GetEndpointResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetEndpointResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if len(m.Name) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Network) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Network))) + i += copy(dAtA[i:], m.Network) + } + if len(m.Namespace) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Namespace))) + i += copy(dAtA[i:], m.Namespace) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GetNetworkRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetNetworkRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GetNetworkResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetNetworkResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if len(m.Name) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GetEndpointsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetEndpointsRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GetEndpointsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetEndpointsResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Endpoints) > 0 { + for _, msg := range m.Endpoints { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GetNetworksRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetNetworksRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GetNetworksResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetNetworksResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Networks) > 0 { + for _, msg := range m.Networks { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintNetworkconfigproxy(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *AddNICRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.NicID) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.EndpointName) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AddNICResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteNICRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.NicID) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.EndpointName) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteNICResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CreateNetworkRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.Mode != 0 { + n += 1 + sovNetworkconfigproxy(uint64(m.Mode)) + } + l = len(m.SwitchName) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.IpamType != 0 { + n += 1 + sovNetworkconfigproxy(uint64(m.IpamType)) + } + if len(m.SubnetIpadressPrefix) > 0 { + for _, s := range m.SubnetIpadressPrefix { + l = len(s) + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + } + l = len(m.DefaultGateway) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CreateNetworkResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CreateEndpointRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.Macaddress) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.Ipaddress) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.IpaddressPrefixlength) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.PolicyType != 0 { + n += 1 + sovNetworkconfigproxy(uint64(m.PolicyType)) + } + if m.PortnamePolicySetting != nil { + l = m.PortnamePolicySetting.Size() + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.NetworkName) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CreateEndpointRequest_PortNameEndpointPolicySetting) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PortName) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CreateEndpointResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AddEndpointRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.NamespaceID) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AddEndpointResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteEndpointRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteEndpointResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteNetworkRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteNetworkResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetEndpointRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetEndpointResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.Network) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.Namespace) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetNetworkRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetNetworkResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetEndpointsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetEndpointsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Endpoints) > 0 { + for _, e := range m.Endpoints { + l = e.Size() + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetNetworksRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetNetworksResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Networks) > 0 { + for _, e := range m.Networks { + l = e.Size() + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovNetworkconfigproxy(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozNetworkconfigproxy(x uint64) (n int) { + return sovNetworkconfigproxy(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *AddNICRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AddNICRequest{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `NicID:` + fmt.Sprintf("%v", this.NicID) + `,`, + `EndpointName:` + fmt.Sprintf("%v", this.EndpointName) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *AddNICResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AddNICResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *DeleteNICRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeleteNICRequest{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `NicID:` + fmt.Sprintf("%v", this.NicID) + `,`, + `EndpointName:` + fmt.Sprintf("%v", this.EndpointName) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *DeleteNICResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeleteNICResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *CreateNetworkRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CreateNetworkRequest{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Mode:` + fmt.Sprintf("%v", this.Mode) + `,`, + `SwitchName:` + fmt.Sprintf("%v", this.SwitchName) + `,`, + `IpamType:` + fmt.Sprintf("%v", this.IpamType) + `,`, + `SubnetIpadressPrefix:` + fmt.Sprintf("%v", this.SubnetIpadressPrefix) + `,`, + `DefaultGateway:` + fmt.Sprintf("%v", this.DefaultGateway) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *CreateNetworkResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CreateNetworkResponse{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *CreateEndpointRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CreateEndpointRequest{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Macaddress:` + fmt.Sprintf("%v", this.Macaddress) + `,`, + `Ipaddress:` + fmt.Sprintf("%v", this.Ipaddress) + `,`, + `IpaddressPrefixlength:` + fmt.Sprintf("%v", this.IpaddressPrefixlength) + `,`, + `PolicyType:` + fmt.Sprintf("%v", this.PolicyType) + `,`, + `PortnamePolicySetting:` + strings.Replace(fmt.Sprintf("%v", this.PortnamePolicySetting), "CreateEndpointRequest_PortNameEndpointPolicySetting", "CreateEndpointRequest_PortNameEndpointPolicySetting", 1) + `,`, + `NetworkName:` + fmt.Sprintf("%v", this.NetworkName) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *CreateEndpointRequest_PortNameEndpointPolicySetting) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CreateEndpointRequest_PortNameEndpointPolicySetting{`, + `PortName:` + fmt.Sprintf("%v", this.PortName) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *CreateEndpointResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CreateEndpointResponse{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *AddEndpointRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AddEndpointRequest{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `NamespaceID:` + fmt.Sprintf("%v", this.NamespaceID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *AddEndpointResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AddEndpointResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *DeleteEndpointRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeleteEndpointRequest{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *DeleteEndpointResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeleteEndpointResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *DeleteNetworkRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeleteNetworkRequest{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *DeleteNetworkResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeleteNetworkResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *GetEndpointRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetEndpointRequest{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *GetEndpointResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetEndpointResponse{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Network:` + fmt.Sprintf("%v", this.Network) + `,`, + `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *GetNetworkRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetNetworkRequest{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *GetNetworkResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetNetworkResponse{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *GetEndpointsRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetEndpointsRequest{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *GetEndpointsResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetEndpointsResponse{`, + `Endpoints:` + strings.Replace(fmt.Sprintf("%v", this.Endpoints), "GetEndpointResponse", "GetEndpointResponse", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *GetNetworksRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetNetworksRequest{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *GetNetworksResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetNetworksResponse{`, + `Networks:` + strings.Replace(fmt.Sprintf("%v", this.Networks), "GetNetworkResponse", "GetNetworkResponse", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringNetworkconfigproxy(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *AddNICRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AddNICRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddNICRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NicID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NicID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndpointName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndpointName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AddNICResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AddNICResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddNICResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteNICRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteNICRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteNICRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NicID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NicID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndpointName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndpointName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteNICResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteNICResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteNICResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateNetworkRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateNetworkRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateNetworkRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) + } + m.Mode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Mode |= CreateNetworkRequest_NetworkMode(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwitchName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SwitchName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IpamType", wireType) + } + m.IpamType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IpamType |= CreateNetworkRequest_IpamType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubnetIpadressPrefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubnetIpadressPrefix = append(m.SubnetIpadressPrefix, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultGateway", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DefaultGateway = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateNetworkResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateNetworkResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateNetworkResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateEndpointRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateEndpointRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateEndpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Macaddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Macaddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ipaddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ipaddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IpaddressPrefixlength", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IpaddressPrefixlength = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PolicyType", wireType) + } + m.PolicyType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PolicyType |= CreateEndpointRequest_EndpointPolicyType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortnamePolicySetting", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PortnamePolicySetting == nil { + m.PortnamePolicySetting = &CreateEndpointRequest_PortNameEndpointPolicySetting{} + } + if err := m.PortnamePolicySetting.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NetworkName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateEndpointRequest_PortNameEndpointPolicySetting) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PortNameEndpointPolicySetting: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PortNameEndpointPolicySetting: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateEndpointResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateEndpointResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateEndpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AddEndpointRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AddEndpointRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddEndpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NamespaceID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NamespaceID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AddEndpointResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AddEndpointResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddEndpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteEndpointRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteEndpointRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteEndpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteEndpointResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteEndpointResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteEndpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteNetworkRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteNetworkRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteNetworkRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteNetworkResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteNetworkResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteNetworkResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetEndpointRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetEndpointRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetEndpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetEndpointResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetEndpointResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetEndpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Network", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Network = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Namespace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetNetworkRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetNetworkRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetNetworkRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetNetworkResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetNetworkResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetNetworkResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetEndpointsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetEndpointsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetEndpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetEndpointsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetEndpointsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetEndpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Endpoints = append(m.Endpoints, &GetEndpointResponse{}) + if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetNetworksRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetNetworksRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetNetworksRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetNetworksResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetNetworksResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetNetworksResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Networks", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Networks = append(m.Networks, &GetNetworkResponse{}) + if err := m.Networks[len(m.Networks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNetworkconfigproxy(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthNetworkconfigproxy + } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthNetworkconfigproxy + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipNetworkconfigproxy(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthNetworkconfigproxy + } + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthNetworkconfigproxy = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNetworkconfigproxy = fmt.Errorf("proto: integer overflow") +) diff --git a/cmd/ncproxy/ncproxygrpc/networkconfigproxy.proto b/cmd/ncproxy/ncproxygrpc/networkconfigproxy.proto new file mode 100644 index 0000000000..4a7d8ed495 --- /dev/null +++ b/cmd/ncproxy/ncproxygrpc/networkconfigproxy.proto @@ -0,0 +1,131 @@ +syntax = "proto3"; + +package ncproxygrpc; + +service NetworkConfigProxy { + rpc AddNIC(AddNICRequest) returns (AddNICResponse) {} + rpc DeleteNIC(DeleteNICRequest) returns (DeleteNICResponse) {} + rpc CreateNetwork(CreateNetworkRequest) returns (CreateNetworkResponse) {} + rpc CreateEndpoint(CreateEndpointRequest) returns (CreateEndpointResponse) {} + rpc AddEndpoint(AddEndpointRequest) returns (AddEndpointResponse) {} + rpc DeleteEndpoint(DeleteEndpointRequest) returns (DeleteEndpointResponse) {} + rpc DeleteNetwork(DeleteNetworkRequest) returns (DeleteNetworkResponse) {} + rpc GetEndpoint(GetEndpointRequest) returns (GetEndpointResponse) {} + rpc GetNetwork(GetNetworkRequest) returns (GetNetworkResponse) {} + rpc GetEndpoints(GetEndpointsRequest) returns (GetEndpointsResponse) {} + rpc GetNetworks(GetNetworksRequest) returns (GetNetworksResponse) {} +} + +message AddNICRequest { + string container_id = 1; + string nic_id = 2; + string endpoint_name = 3; +} + +message AddNICResponse {} + +message DeleteNICRequest { + string container_id = 1; + string nic_id = 2; + string endpoint_name = 3; +} + +message DeleteNICResponse {} + +message CreateNetworkRequest { + enum NetworkMode + { + Transparent = 0; + } + + enum IpamType + { + Static = 0; + DHCP = 1; + } + + string name = 1; + NetworkMode mode = 2; + string switch_name = 3; + IpamType ipam_type = 4; + repeated string subnet_ipadress_prefix = 5; + string default_gateway = 6; +} + +message CreateNetworkResponse{ + string id = 1; +} + +message CreateEndpointRequest { + enum EndpointPolicyType + { + PortName = 0; + } + + message PortNameEndpointPolicySetting { + string port_name = 1; + } + + string name = 1; + string macaddress = 2; + string ipaddress = 3; + string ipaddress_prefixlength = 4; + EndpointPolicyType policy_type = 5; + PortNameEndpointPolicySetting portname_policy_setting = 6; + string network_name = 7; +} + +message CreateEndpointResponse{ + string id = 1; +} + +message AddEndpointRequest { + string name = 1; + string namespace_id = 2; +} + +message AddEndpointResponse{} + +message DeleteEndpointRequest { + string name = 1; +} + +message DeleteEndpointResponse{} + +message DeleteNetworkRequest{ + string name = 1; +} + +message DeleteNetworkResponse{} + +message GetEndpointRequest{ + string name = 1; +} + +message GetEndpointResponse{ + string id = 1; + string name = 2; + string network = 3; // GUID + string namespace = 4; // GUID +} + +message GetNetworkRequest{ + string name = 1; +} + +message GetNetworkResponse{ + string id = 1; + string name = 2; +} + +message GetEndpointsRequest{} + +message GetEndpointsResponse{ + repeated GetEndpointResponse endpoints = 1; +} + +message GetNetworksRequest{} + +message GetNetworksResponse{ + repeated GetNetworkResponse networks = 1; +} \ No newline at end of file diff --git a/cmd/ncproxy/nodenetsvc/doc.go b/cmd/ncproxy/nodenetsvc/doc.go new file mode 100644 index 0000000000..51dd36e65c --- /dev/null +++ b/cmd/ncproxy/nodenetsvc/doc.go @@ -0,0 +1 @@ +package nodenetsvc diff --git a/cmd/ncproxy/nodenetsvc/nodenetsvc.pb.go b/cmd/ncproxy/nodenetsvc/nodenetsvc.pb.go new file mode 100644 index 0000000000..61a2a8beed --- /dev/null +++ b/cmd/ncproxy/nodenetsvc/nodenetsvc.pb.go @@ -0,0 +1,1592 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: github.com/Microsoft/hcsshim/cmd/ncproxy/nodenetsvc/nodenetsvc.proto + +package nodenetsvc + +import ( + context "context" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + io "io" + math "math" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type RequestType int32 + +const ( + RequestType_Setup RequestType = 0 + RequestType_Teardown RequestType = 1 +) + +var RequestType_name = map[int32]string{ + 0: "Setup", + 1: "Teardown", +} + +var RequestType_value = map[string]int32{ + "Setup": 0, + "Teardown": 1, +} + +func (x RequestType) String() string { + return proto.EnumName(RequestType_name, int32(x)) +} + +func (RequestType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_3a65404bd96160d4, []int{0} +} + +type ConfigureNetworkingRequest struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + RequestType RequestType `protobuf:"varint,2,opt,name=request_type,json=requestType,proto3,enum=azure.nodenetworkservice.RequestType" json:"request_type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConfigureNetworkingRequest) Reset() { *m = ConfigureNetworkingRequest{} } +func (*ConfigureNetworkingRequest) ProtoMessage() {} +func (*ConfigureNetworkingRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3a65404bd96160d4, []int{0} +} +func (m *ConfigureNetworkingRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConfigureNetworkingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConfigureNetworkingRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConfigureNetworkingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfigureNetworkingRequest.Merge(m, src) +} +func (m *ConfigureNetworkingRequest) XXX_Size() int { + return m.Size() +} +func (m *ConfigureNetworkingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ConfigureNetworkingRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ConfigureNetworkingRequest proto.InternalMessageInfo + +type ConfigureNetworkingResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConfigureNetworkingResponse) Reset() { *m = ConfigureNetworkingResponse{} } +func (*ConfigureNetworkingResponse) ProtoMessage() {} +func (*ConfigureNetworkingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3a65404bd96160d4, []int{1} +} +func (m *ConfigureNetworkingResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConfigureNetworkingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConfigureNetworkingResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConfigureNetworkingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfigureNetworkingResponse.Merge(m, src) +} +func (m *ConfigureNetworkingResponse) XXX_Size() int { + return m.Size() +} +func (m *ConfigureNetworkingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ConfigureNetworkingResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ConfigureNetworkingResponse proto.InternalMessageInfo + +type PingNodeNetworkServiceRequest struct { + PingRequestMessage string `protobuf:"bytes,1,opt,name=pingRequestMessage,proto3" json:"pingRequestMessage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PingNodeNetworkServiceRequest) Reset() { *m = PingNodeNetworkServiceRequest{} } +func (*PingNodeNetworkServiceRequest) ProtoMessage() {} +func (*PingNodeNetworkServiceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3a65404bd96160d4, []int{2} +} +func (m *PingNodeNetworkServiceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PingNodeNetworkServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PingNodeNetworkServiceRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PingNodeNetworkServiceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PingNodeNetworkServiceRequest.Merge(m, src) +} +func (m *PingNodeNetworkServiceRequest) XXX_Size() int { + return m.Size() +} +func (m *PingNodeNetworkServiceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PingNodeNetworkServiceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PingNodeNetworkServiceRequest proto.InternalMessageInfo + +type PingNodeNetworkServiceResponse struct { + PingResponseMessage string `protobuf:"bytes,1,opt,name=pingResponseMessage,proto3" json:"pingResponseMessage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PingNodeNetworkServiceResponse) Reset() { *m = PingNodeNetworkServiceResponse{} } +func (*PingNodeNetworkServiceResponse) ProtoMessage() {} +func (*PingNodeNetworkServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3a65404bd96160d4, []int{3} +} +func (m *PingNodeNetworkServiceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PingNodeNetworkServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PingNodeNetworkServiceResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PingNodeNetworkServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PingNodeNetworkServiceResponse.Merge(m, src) +} +func (m *PingNodeNetworkServiceResponse) XXX_Size() int { + return m.Size() +} +func (m *PingNodeNetworkServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PingNodeNetworkServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PingNodeNetworkServiceResponse proto.InternalMessageInfo + +type ConfigureContainerNetworkingRequest struct { + RequestType RequestType `protobuf:"varint,1,opt,name=request_type,json=requestType,proto3,enum=azure.nodenetworkservice.RequestType" json:"request_type,omitempty"` + ContainerID string `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + NetworkNamespace string `protobuf:"bytes,3,opt,name=network_namespace,json=networkNamespace,proto3" json:"network_namespace,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConfigureContainerNetworkingRequest) Reset() { *m = ConfigureContainerNetworkingRequest{} } +func (*ConfigureContainerNetworkingRequest) ProtoMessage() {} +func (*ConfigureContainerNetworkingRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3a65404bd96160d4, []int{4} +} +func (m *ConfigureContainerNetworkingRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConfigureContainerNetworkingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConfigureContainerNetworkingRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConfigureContainerNetworkingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfigureContainerNetworkingRequest.Merge(m, src) +} +func (m *ConfigureContainerNetworkingRequest) XXX_Size() int { + return m.Size() +} +func (m *ConfigureContainerNetworkingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ConfigureContainerNetworkingRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ConfigureContainerNetworkingRequest proto.InternalMessageInfo + +type ConfigureContainerNetworkingResponse struct { + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResponseJson string `protobuf:"bytes,2,opt,name=response_json,json=responseJson,proto3" json:"response_json,omitempty"` + ErrorJson string `protobuf:"bytes,3,opt,name=error_json,json=errorJson,proto3" json:"error_json,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConfigureContainerNetworkingResponse) Reset() { *m = ConfigureContainerNetworkingResponse{} } +func (*ConfigureContainerNetworkingResponse) ProtoMessage() {} +func (*ConfigureContainerNetworkingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3a65404bd96160d4, []int{5} +} +func (m *ConfigureContainerNetworkingResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConfigureContainerNetworkingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConfigureContainerNetworkingResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConfigureContainerNetworkingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfigureContainerNetworkingResponse.Merge(m, src) +} +func (m *ConfigureContainerNetworkingResponse) XXX_Size() int { + return m.Size() +} +func (m *ConfigureContainerNetworkingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ConfigureContainerNetworkingResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ConfigureContainerNetworkingResponse proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("azure.nodenetworkservice.RequestType", RequestType_name, RequestType_value) + proto.RegisterType((*ConfigureNetworkingRequest)(nil), "azure.nodenetworkservice.ConfigureNetworkingRequest") + proto.RegisterType((*ConfigureNetworkingResponse)(nil), "azure.nodenetworkservice.ConfigureNetworkingResponse") + proto.RegisterType((*PingNodeNetworkServiceRequest)(nil), "azure.nodenetworkservice.PingNodeNetworkServiceRequest") + proto.RegisterType((*PingNodeNetworkServiceResponse)(nil), "azure.nodenetworkservice.PingNodeNetworkServiceResponse") + proto.RegisterType((*ConfigureContainerNetworkingRequest)(nil), "azure.nodenetworkservice.ConfigureContainerNetworkingRequest") + proto.RegisterType((*ConfigureContainerNetworkingResponse)(nil), "azure.nodenetworkservice.ConfigureContainerNetworkingResponse") +} + +func init() { + proto.RegisterFile("github.com/Microsoft/hcsshim/cmd/ncproxy/nodenetsvc/nodenetsvc.proto", fileDescriptor_3a65404bd96160d4) +} + +var fileDescriptor_3a65404bd96160d4 = []byte{ + // 513 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x41, 0x6f, 0xd3, 0x30, + 0x14, 0xae, 0x37, 0x01, 0xeb, 0x6b, 0x81, 0xe2, 0x49, 0x28, 0x2a, 0x34, 0x4c, 0xd9, 0x40, 0x13, + 0x48, 0x09, 0x2a, 0x20, 0xb8, 0xc0, 0x61, 0xdb, 0x81, 0x21, 0xad, 0xa0, 0x6c, 0x27, 0x2e, 0x55, + 0xe6, 0xbc, 0xa5, 0x01, 0xd5, 0x0e, 0x76, 0xb2, 0x51, 0x4e, 0x08, 0x71, 0xe3, 0x1f, 0x20, 0xf1, + 0x7b, 0xd8, 0x71, 0x47, 0x4e, 0x88, 0xe5, 0x97, 0x20, 0xea, 0xa4, 0x2d, 0x6b, 0x52, 0x6d, 0xbd, + 0x25, 0xef, 0xf3, 0xfb, 0xfc, 0x7d, 0x9f, 0xfd, 0x0c, 0x5b, 0x41, 0x18, 0xf7, 0x92, 0x7d, 0x9b, + 0x89, 0xbe, 0xb3, 0x13, 0x32, 0x29, 0x94, 0x38, 0x88, 0x9d, 0x1e, 0x53, 0xaa, 0x17, 0xf6, 0x1d, + 0xd6, 0xf7, 0x1d, 0xce, 0x22, 0x29, 0x3e, 0x0e, 0x1c, 0x2e, 0x7c, 0xe4, 0x18, 0xab, 0x43, 0x36, + 0xf1, 0x69, 0x47, 0x52, 0xc4, 0x82, 0x1a, 0xde, 0xa7, 0x44, 0xa2, 0x9d, 0xd5, 0x8f, 0x84, 0x7c, + 0xaf, 0x50, 0x1e, 0x86, 0x0c, 0xad, 0xef, 0x04, 0x9a, 0x9b, 0x82, 0x1f, 0x84, 0x41, 0x22, 0xb1, + 0xa3, 0xb1, 0x90, 0x07, 0x2e, 0x7e, 0x48, 0x50, 0xc5, 0xb4, 0x0d, 0x75, 0x26, 0x78, 0xec, 0x85, + 0x1c, 0x65, 0x37, 0xf4, 0x0d, 0xb2, 0x42, 0xd6, 0xab, 0x1b, 0xd7, 0xd3, 0xdf, 0x77, 0x6a, 0x9b, + 0x79, 0x7d, 0x7b, 0xcb, 0xad, 0x8d, 0x16, 0x6d, 0xfb, 0xf4, 0x25, 0xd4, 0xa5, 0x6e, 0xef, 0xc6, + 0x83, 0x08, 0x8d, 0x85, 0x15, 0xb2, 0x7e, 0xad, 0x7d, 0xd7, 0x2e, 0xd3, 0x60, 0x67, 0x9b, 0xed, + 0x0d, 0x22, 0x74, 0x6b, 0x72, 0xfc, 0x63, 0xb5, 0xe0, 0x56, 0xa1, 0x36, 0x15, 0x09, 0xae, 0xd0, + 0x7a, 0x0d, 0xad, 0x37, 0x21, 0x0f, 0x3a, 0xc2, 0xcf, 0xd1, 0x5d, 0xcd, 0x98, 0xab, 0xb7, 0x81, + 0x46, 0x63, 0x33, 0x3b, 0xa8, 0x94, 0x17, 0xa0, 0xf6, 0xe0, 0x16, 0x20, 0x96, 0x0b, 0x66, 0x19, + 0xa1, 0xde, 0x92, 0x3e, 0x84, 0xe5, 0x68, 0x42, 0xc2, 0xff, 0x94, 0x45, 0x90, 0x75, 0x42, 0x60, + 0x75, 0x64, 0x62, 0x94, 0xd9, 0x74, 0xd2, 0x67, 0x53, 0x23, 0xf3, 0xa6, 0x36, 0x75, 0x66, 0x0b, + 0xe7, 0x38, 0xb3, 0x07, 0x70, 0x23, 0xa3, 0xef, 0x72, 0xaf, 0x8f, 0x2a, 0xf2, 0x18, 0x1a, 0x8b, + 0x43, 0x57, 0x8d, 0x0c, 0xe8, 0xe4, 0x75, 0xeb, 0x2b, 0x81, 0xb5, 0xd9, 0x96, 0xb2, 0xb4, 0x0c, + 0xb8, 0xa2, 0x12, 0xc6, 0x50, 0xa9, 0xa1, 0x9d, 0x25, 0x37, 0xff, 0xa5, 0xab, 0x70, 0x55, 0x66, + 0xab, 0xba, 0xef, 0x94, 0xe0, 0x5a, 0xa4, 0x5b, 0xcf, 0x8b, 0xaf, 0x94, 0xe0, 0xb4, 0x05, 0x80, + 0x52, 0x0a, 0xa9, 0x57, 0x68, 0x35, 0xd5, 0x61, 0xe5, 0x1f, 0x7c, 0xff, 0x1e, 0xd4, 0x26, 0x32, + 0xa0, 0x55, 0xb8, 0xb4, 0x8b, 0x71, 0x12, 0x35, 0x2a, 0xb4, 0x0e, 0x4b, 0x7b, 0xe8, 0x49, 0x5f, + 0x1c, 0xf1, 0x06, 0x69, 0xff, 0x5c, 0x04, 0x3a, 0x7d, 0xa4, 0xf4, 0x0b, 0x81, 0xe5, 0x82, 0xdb, + 0x45, 0x1f, 0x97, 0x47, 0x5e, 0x3e, 0x28, 0xcd, 0x27, 0x17, 0xec, 0xca, 0x12, 0xfa, 0x41, 0xe0, + 0xf6, 0xac, 0x28, 0xe9, 0xf3, 0x73, 0xf0, 0x96, 0xdf, 0xaa, 0xe6, 0x8b, 0x79, 0xdb, 0x33, 0x7d, + 0xdf, 0x08, 0xdc, 0x2c, 0x1e, 0x09, 0xfa, 0xb4, 0x9c, 0x7a, 0xe6, 0x54, 0x36, 0x9f, 0x5d, 0xbc, + 0x51, 0xab, 0xd9, 0x58, 0x3b, 0x3e, 0x35, 0x2b, 0xbf, 0x4e, 0xcd, 0xca, 0xe7, 0xd4, 0x24, 0xc7, + 0xa9, 0x49, 0x4e, 0x52, 0x93, 0xfc, 0x49, 0x4d, 0xf2, 0x16, 0xc6, 0x4f, 0xde, 0xfe, 0xe5, 0xe1, + 0x9b, 0xf7, 0xe8, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x25, 0xe7, 0xf5, 0xc4, 0x3b, 0x05, 0x00, + 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// NodeNetworkServiceClient is the client API for NodeNetworkService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NodeNetworkServiceClient interface { + ConfigureNetworking(ctx context.Context, in *ConfigureNetworkingRequest, opts ...grpc.CallOption) (*ConfigureNetworkingResponse, error) + ConfigureContainerNetworking(ctx context.Context, in *ConfigureContainerNetworkingRequest, opts ...grpc.CallOption) (*ConfigureContainerNetworkingResponse, error) + PingNodeNetworkService(ctx context.Context, in *PingNodeNetworkServiceRequest, opts ...grpc.CallOption) (*PingNodeNetworkServiceResponse, error) +} + +type nodeNetworkServiceClient struct { + cc *grpc.ClientConn +} + +func NewNodeNetworkServiceClient(cc *grpc.ClientConn) NodeNetworkServiceClient { + return &nodeNetworkServiceClient{cc} +} + +func (c *nodeNetworkServiceClient) ConfigureNetworking(ctx context.Context, in *ConfigureNetworkingRequest, opts ...grpc.CallOption) (*ConfigureNetworkingResponse, error) { + out := new(ConfigureNetworkingResponse) + err := c.cc.Invoke(ctx, "/azure.nodenetworkservice.NodeNetworkService/ConfigureNetworking", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeNetworkServiceClient) ConfigureContainerNetworking(ctx context.Context, in *ConfigureContainerNetworkingRequest, opts ...grpc.CallOption) (*ConfigureContainerNetworkingResponse, error) { + out := new(ConfigureContainerNetworkingResponse) + err := c.cc.Invoke(ctx, "/azure.nodenetworkservice.NodeNetworkService/ConfigureContainerNetworking", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeNetworkServiceClient) PingNodeNetworkService(ctx context.Context, in *PingNodeNetworkServiceRequest, opts ...grpc.CallOption) (*PingNodeNetworkServiceResponse, error) { + out := new(PingNodeNetworkServiceResponse) + err := c.cc.Invoke(ctx, "/azure.nodenetworkservice.NodeNetworkService/PingNodeNetworkService", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NodeNetworkServiceServer is the server API for NodeNetworkService service. +type NodeNetworkServiceServer interface { + ConfigureNetworking(context.Context, *ConfigureNetworkingRequest) (*ConfigureNetworkingResponse, error) + ConfigureContainerNetworking(context.Context, *ConfigureContainerNetworkingRequest) (*ConfigureContainerNetworkingResponse, error) + PingNodeNetworkService(context.Context, *PingNodeNetworkServiceRequest) (*PingNodeNetworkServiceResponse, error) +} + +func RegisterNodeNetworkServiceServer(s *grpc.Server, srv NodeNetworkServiceServer) { + s.RegisterService(&_NodeNetworkService_serviceDesc, srv) +} + +func _NodeNetworkService_ConfigureNetworking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfigureNetworkingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeNetworkServiceServer).ConfigureNetworking(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/azure.nodenetworkservice.NodeNetworkService/ConfigureNetworking", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeNetworkServiceServer).ConfigureNetworking(ctx, req.(*ConfigureNetworkingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeNetworkService_ConfigureContainerNetworking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfigureContainerNetworkingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeNetworkServiceServer).ConfigureContainerNetworking(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/azure.nodenetworkservice.NodeNetworkService/ConfigureContainerNetworking", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeNetworkServiceServer).ConfigureContainerNetworking(ctx, req.(*ConfigureContainerNetworkingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeNetworkService_PingNodeNetworkService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PingNodeNetworkServiceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeNetworkServiceServer).PingNodeNetworkService(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/azure.nodenetworkservice.NodeNetworkService/PingNodeNetworkService", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeNetworkServiceServer).PingNodeNetworkService(ctx, req.(*PingNodeNetworkServiceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _NodeNetworkService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "azure.nodenetworkservice.NodeNetworkService", + HandlerType: (*NodeNetworkServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ConfigureNetworking", + Handler: _NodeNetworkService_ConfigureNetworking_Handler, + }, + { + MethodName: "ConfigureContainerNetworking", + Handler: _NodeNetworkService_ConfigureContainerNetworking_Handler, + }, + { + MethodName: "PingNodeNetworkService", + Handler: _NodeNetworkService_PingNodeNetworkService_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/Microsoft/hcsshim/cmd/ncproxy/nodenetsvc/nodenetsvc.proto", +} + +func (m *ConfigureNetworkingRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConfigureNetworkingRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNodenetsvc(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if m.RequestType != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintNodenetsvc(dAtA, i, uint64(m.RequestType)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ConfigureNetworkingResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConfigureNetworkingResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *PingNodeNetworkServiceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PingNodeNetworkServiceRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.PingRequestMessage) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNodenetsvc(dAtA, i, uint64(len(m.PingRequestMessage))) + i += copy(dAtA[i:], m.PingRequestMessage) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *PingNodeNetworkServiceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PingNodeNetworkServiceResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.PingResponseMessage) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNodenetsvc(dAtA, i, uint64(len(m.PingResponseMessage))) + i += copy(dAtA[i:], m.PingResponseMessage) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ConfigureContainerNetworkingRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConfigureContainerNetworkingRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RequestType != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintNodenetsvc(dAtA, i, uint64(m.RequestType)) + } + if len(m.ContainerID) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintNodenetsvc(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if len(m.NetworkNamespace) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintNodenetsvc(dAtA, i, uint64(len(m.NetworkNamespace))) + i += copy(dAtA[i:], m.NetworkNamespace) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ConfigureContainerNetworkingResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConfigureContainerNetworkingResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Success { + dAtA[i] = 0x8 + i++ + if m.Success { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.ResponseJson) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintNodenetsvc(dAtA, i, uint64(len(m.ResponseJson))) + i += copy(dAtA[i:], m.ResponseJson) + } + if len(m.ErrorJson) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintNodenetsvc(dAtA, i, uint64(len(m.ErrorJson))) + i += copy(dAtA[i:], m.ErrorJson) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintNodenetsvc(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *ConfigureNetworkingRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovNodenetsvc(uint64(l)) + } + if m.RequestType != 0 { + n += 1 + sovNodenetsvc(uint64(m.RequestType)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ConfigureNetworkingResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PingNodeNetworkServiceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PingRequestMessage) + if l > 0 { + n += 1 + l + sovNodenetsvc(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PingNodeNetworkServiceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PingResponseMessage) + if l > 0 { + n += 1 + l + sovNodenetsvc(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ConfigureContainerNetworkingRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RequestType != 0 { + n += 1 + sovNodenetsvc(uint64(m.RequestType)) + } + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovNodenetsvc(uint64(l)) + } + l = len(m.NetworkNamespace) + if l > 0 { + n += 1 + l + sovNodenetsvc(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ConfigureContainerNetworkingResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Success { + n += 2 + } + l = len(m.ResponseJson) + if l > 0 { + n += 1 + l + sovNodenetsvc(uint64(l)) + } + l = len(m.ErrorJson) + if l > 0 { + n += 1 + l + sovNodenetsvc(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovNodenetsvc(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozNodenetsvc(x uint64) (n int) { + return sovNodenetsvc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *ConfigureNetworkingRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ConfigureNetworkingRequest{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `RequestType:` + fmt.Sprintf("%v", this.RequestType) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ConfigureNetworkingResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ConfigureNetworkingResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PingNodeNetworkServiceRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PingNodeNetworkServiceRequest{`, + `PingRequestMessage:` + fmt.Sprintf("%v", this.PingRequestMessage) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PingNodeNetworkServiceResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PingNodeNetworkServiceResponse{`, + `PingResponseMessage:` + fmt.Sprintf("%v", this.PingResponseMessage) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ConfigureContainerNetworkingRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ConfigureContainerNetworkingRequest{`, + `RequestType:` + fmt.Sprintf("%v", this.RequestType) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `NetworkNamespace:` + fmt.Sprintf("%v", this.NetworkNamespace) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ConfigureContainerNetworkingResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ConfigureContainerNetworkingResponse{`, + `Success:` + fmt.Sprintf("%v", this.Success) + `,`, + `ResponseJson:` + fmt.Sprintf("%v", this.ResponseJson) + `,`, + `ErrorJson:` + fmt.Sprintf("%v", this.ErrorJson) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringNodenetsvc(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *ConfigureNetworkingRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfigureNetworkingRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfigureNetworkingRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNodenetsvc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNodenetsvc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestType", wireType) + } + m.RequestType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestType |= RequestType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipNodenetsvc(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConfigureNetworkingResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfigureNetworkingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfigureNetworkingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipNodenetsvc(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PingNodeNetworkServiceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PingNodeNetworkServiceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PingNodeNetworkServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PingRequestMessage", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNodenetsvc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNodenetsvc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PingRequestMessage = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNodenetsvc(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PingNodeNetworkServiceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PingNodeNetworkServiceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PingNodeNetworkServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PingResponseMessage", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNodenetsvc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNodenetsvc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PingResponseMessage = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNodenetsvc(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConfigureContainerNetworkingRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfigureContainerNetworkingRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfigureContainerNetworkingRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestType", wireType) + } + m.RequestType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestType |= RequestType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNodenetsvc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNodenetsvc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NetworkNamespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNodenetsvc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNodenetsvc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NetworkNamespace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNodenetsvc(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConfigureContainerNetworkingResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfigureContainerNetworkingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfigureContainerNetworkingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Success = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseJson", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNodenetsvc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNodenetsvc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResponseJson = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorJson", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNodenetsvc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNodenetsvc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ErrorJson = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNodenetsvc(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNodenetsvc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNodenetsvc(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthNodenetsvc + } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthNodenetsvc + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNodenetsvc + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipNodenetsvc(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthNodenetsvc + } + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthNodenetsvc = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNodenetsvc = fmt.Errorf("proto: integer overflow") +) diff --git a/cmd/ncproxy/nodenetsvc/nodenetsvc.proto b/cmd/ncproxy/nodenetsvc/nodenetsvc.proto new file mode 100644 index 0000000000..58d12aa42a --- /dev/null +++ b/cmd/ncproxy/nodenetsvc/nodenetsvc.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; +package azure.nodenetworkservice; +option go_package = "nodenetsvc"; + +service NodeNetworkService { + rpc ConfigureNetworking(ConfigureNetworkingRequest) returns (ConfigureNetworkingResponse); + rpc ConfigureContainerNetworking(ConfigureContainerNetworkingRequest) returns (ConfigureContainerNetworkingResponse); + rpc PingNodeNetworkService(PingNodeNetworkServiceRequest) returns (PingNodeNetworkServiceResponse); +} + +enum RequestType { + Setup = 0; + Teardown = 1; +} + +message ConfigureNetworkingRequest { + string container_id = 1; + RequestType request_type = 2; // Setup for AddNIC and Teardown for DeleteNIC +} + +message ConfigureNetworkingResponse{} + +message PingNodeNetworkServiceRequest { + string pingRequestMessage = 1; +} + +message PingNodeNetworkServiceResponse { + string pingResponseMessage = 1; +} + +message ConfigureContainerNetworkingRequest{ + RequestType request_type = 1; + string container_id = 2; + string network_namespace = 3; +} + +message ConfigureContainerNetworkingResponse { + bool success = 1; + string response_json = 2; + string error_json= 3; +} \ No newline at end of file diff --git a/cmd/ncproxy/server.go b/cmd/ncproxy/server.go new file mode 100644 index 0000000000..8cbee2697e --- /dev/null +++ b/cmd/ncproxy/server.go @@ -0,0 +1,85 @@ +package main + +import ( + "context" + "net" + "strings" + + "github.com/Microsoft/go-winio" + "github.com/Microsoft/hcsshim/cmd/ncproxy/ncproxygrpc" + "github.com/Microsoft/hcsshim/internal/log" + "github.com/Microsoft/hcsshim/internal/ncproxyttrpc" + "github.com/Microsoft/hcsshim/pkg/octtrpc" + "github.com/containerd/ttrpc" + "github.com/sirupsen/logrus" + "google.golang.org/grpc" +) + +type server struct { + ttrpc *ttrpc.Server + grpc *grpc.Server + conf *config +} + +func newServer(ctx context.Context, conf *config) (*server, error) { + ttrpcServer, err := ttrpc.NewServer(ttrpc.WithUnaryServerInterceptor(octtrpc.ServerInterceptor())) + if err != nil { + log.G(ctx).WithError(err).Error("failed to create ttrpc server") + return nil, err + } + return &server{ + grpc: grpc.NewServer(), + ttrpc: ttrpcServer, + conf: conf, + }, nil +} + +func (s *server) setup(ctx context.Context) (net.Listener, net.Listener, error) { + ncproxygrpc.RegisterNetworkConfigProxyServer(s.grpc, &grpcService{}) + ncproxyttrpc.RegisterNetworkConfigProxyService(s.ttrpc, &ttrpcService{}) + + ttrpcListener, err := winio.ListenPipe(s.conf.TTRPCAddr, nil) + if err != nil { + log.G(ctx).WithError(err).Errorf("failed to listen on %s", s.conf.TTRPCAddr) + return nil, nil, err + } + + grpcListener, err := net.Listen("tcp", s.conf.GRPCAddr) + if err != nil { + log.G(ctx).WithError(err).Errorf("failed to listen on %s", s.conf.GRPCAddr) + return nil, nil, err + } + return ttrpcListener, grpcListener, nil +} + +func (s *server) gracefulShutdown(ctx context.Context) error { + s.grpc.GracefulStop() + return s.ttrpc.Shutdown(ctx) +} + +func trapClosedConnErr(err error) error { + if err == nil || strings.Contains(err.Error(), "use of closed network connection") { + return nil + } + return err +} + +func (s *server) serve(ctx context.Context, ttrpcListener net.Listener, grpcListener net.Listener, serveErr chan error) { + go func() { + log.G(ctx).WithFields(logrus.Fields{ + "address": s.conf.TTRPCAddr, + }).Info("Serving ncproxy TTRPC service") + + // No need to defer close the listener as ttrpc.Serve does this internally. + serveErr <- trapClosedConnErr(s.ttrpc.Serve(ctx, ttrpcListener)) + }() + + go func() { + log.G(ctx).WithFields(logrus.Fields{ + "address": s.conf.GRPCAddr, + }).Info("Serving ncproxy GRPC service") + + defer grpcListener.Close() + serveErr <- trapClosedConnErr(s.grpc.Serve(grpcListener)) + }() +} diff --git a/hcn/hcn.go b/hcn/hcn.go index 54c258ed74..c75125e523 100644 --- a/hcn/hcn.go +++ b/hcn/hcn.go @@ -101,6 +101,20 @@ type HostComputeQuery struct { Filter string `json:",omitempty"` } +type ExtraParams struct { + Resources interface{} `json:",omitempty"` + SharedContainers interface{} `json:",omitempty"` + LayeredOn string `json:",omitempty"` + SwitchGuid string `json:",omitempty"` + UtilityVM string `json:",omitempty"` + VirtualMachine string `json:",omitempty"` +} + +type Health struct { + Data interface{} `json:",omitempty"` + Extra ExtraParams `json:",omitempty"` +} + // defaultQuery generates HCN Query. // Passed into get/enumerate calls to filter results. func defaultQuery() HostComputeQuery { diff --git a/hcn/hcnnetwork.go b/hcn/hcnnetwork.go index a95fc1d751..c36b136387 100644 --- a/hcn/hcnnetwork.go +++ b/hcn/hcnnetwork.go @@ -9,21 +9,21 @@ import ( "github.com/sirupsen/logrus" ) -// Route is assoicated with a subnet. +// Route is associated with a subnet. type Route struct { NextHop string `json:",omitempty"` DestinationPrefix string `json:",omitempty"` Metric uint16 `json:",omitempty"` } -// Subnet is assoicated with a Ipam. +// Subnet is associated with a Ipam. type Subnet struct { IpAddressPrefix string `json:",omitempty"` Policies []json.RawMessage `json:",omitempty"` Routes []Route `json:",omitempty"` } -// Ipam (Internet Protocol Addres Management) is assoicated with a network +// Ipam (Internet Protocol Address Management) is associated with a network // and represents the address space(s) of a network. type Ipam struct { Type string `json:",omitempty"` // Ex: Static, DHCP @@ -36,12 +36,12 @@ type MacRange struct { EndMacAddress string `json:",omitempty"` } -// MacPool is assoicated with a network and represents pool of MacRanges. +// MacPool is associated with a network and represents pool of MacRanges. type MacPool struct { Ranges []MacRange `json:",omitempty"` } -// Dns (Domain Name System is associated with a network. +// Dns (Domain Name System is associated with a network). type Dns struct { Domain string `json:",omitempty"` Search []string `json:",omitempty"` @@ -82,6 +82,7 @@ type HostComputeNetwork struct { Dns Dns `json:",omitempty"` Ipams []Ipam `json:",omitempty"` Flags NetworkFlags `json:",omitempty"` // 0: None + Health Health `json:",omitempty"` SchemaVersion SchemaVersion `json:",omitempty"` } diff --git a/hcn/hcnpolicy.go b/hcn/hcnpolicy.go index e52a281c3c..99493a4df4 100644 --- a/hcn/hcnpolicy.go +++ b/hcn/hcnpolicy.go @@ -47,6 +47,7 @@ const ( HostRoute NetworkPolicyType = "HostRoute" SetPolicy NetworkPolicyType = "SetPolicy" NetworkL4Proxy NetworkPolicyType = "L4Proxy" + LayerConstraint NetworkPolicyType = "LayerConstraint" ) // NetworkPolicy is a collection of Policy settings for a Network. @@ -215,6 +216,10 @@ type AutomaticDNSNetworkPolicySetting struct { Enable bool `json:",omitempty"` } +type LayerConstraintNetworkPolicySetting struct { + LayerId string `json:",omitempty"` +} + /// Subnet Policy objects // VlanPolicySetting isolates a subnet with VLAN tagging. diff --git a/internal/computeagent/computeagent.pb.go b/internal/computeagent/computeagent.pb.go new file mode 100644 index 0000000000..4fa9dd36e9 --- /dev/null +++ b/internal/computeagent/computeagent.pb.go @@ -0,0 +1,1058 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: github.com/Microsoft/hcsshim/internal/computeagent/computeagent.proto + +package computeagent + +import ( + context "context" + fmt "fmt" + github_com_containerd_ttrpc "github.com/containerd/ttrpc" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type AddNICInternalRequest struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + NicID string `protobuf:"bytes,2,opt,name=nic_id,json=nicId,proto3" json:"nic_id,omitempty"` + EndpointName string `protobuf:"bytes,3,opt,name=endpoint_name,json=endpointName,proto3" json:"endpoint_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AddNICInternalRequest) Reset() { *m = AddNICInternalRequest{} } +func (*AddNICInternalRequest) ProtoMessage() {} +func (*AddNICInternalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7f2f03dc308add4c, []int{0} +} +func (m *AddNICInternalRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AddNICInternalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AddNICInternalRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AddNICInternalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddNICInternalRequest.Merge(m, src) +} +func (m *AddNICInternalRequest) XXX_Size() int { + return m.Size() +} +func (m *AddNICInternalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AddNICInternalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AddNICInternalRequest proto.InternalMessageInfo + +type AddNICInternalResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AddNICInternalResponse) Reset() { *m = AddNICInternalResponse{} } +func (*AddNICInternalResponse) ProtoMessage() {} +func (*AddNICInternalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7f2f03dc308add4c, []int{1} +} +func (m *AddNICInternalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AddNICInternalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AddNICInternalResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AddNICInternalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddNICInternalResponse.Merge(m, src) +} +func (m *AddNICInternalResponse) XXX_Size() int { + return m.Size() +} +func (m *AddNICInternalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AddNICInternalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AddNICInternalResponse proto.InternalMessageInfo + +type DeleteNICInternalRequest struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + NicID string `protobuf:"bytes,2,opt,name=nic_id,json=nicId,proto3" json:"nic_id,omitempty"` + EndpointName string `protobuf:"bytes,3,opt,name=endpoint_name,json=endpointName,proto3" json:"endpoint_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteNICInternalRequest) Reset() { *m = DeleteNICInternalRequest{} } +func (*DeleteNICInternalRequest) ProtoMessage() {} +func (*DeleteNICInternalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7f2f03dc308add4c, []int{2} +} +func (m *DeleteNICInternalRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteNICInternalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteNICInternalRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteNICInternalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteNICInternalRequest.Merge(m, src) +} +func (m *DeleteNICInternalRequest) XXX_Size() int { + return m.Size() +} +func (m *DeleteNICInternalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteNICInternalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteNICInternalRequest proto.InternalMessageInfo + +type DeleteNICInternalResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteNICInternalResponse) Reset() { *m = DeleteNICInternalResponse{} } +func (*DeleteNICInternalResponse) ProtoMessage() {} +func (*DeleteNICInternalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7f2f03dc308add4c, []int{3} +} +func (m *DeleteNICInternalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteNICInternalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteNICInternalResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteNICInternalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteNICInternalResponse.Merge(m, src) +} +func (m *DeleteNICInternalResponse) XXX_Size() int { + return m.Size() +} +func (m *DeleteNICInternalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteNICInternalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteNICInternalResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*AddNICInternalRequest)(nil), "AddNICInternalRequest") + proto.RegisterType((*AddNICInternalResponse)(nil), "AddNICInternalResponse") + proto.RegisterType((*DeleteNICInternalRequest)(nil), "DeleteNICInternalRequest") + proto.RegisterType((*DeleteNICInternalResponse)(nil), "DeleteNICInternalResponse") +} + +func init() { + proto.RegisterFile("github.com/Microsoft/hcsshim/internal/computeagent/computeagent.proto", fileDescriptor_7f2f03dc308add4c) +} + +var fileDescriptor_7f2f03dc308add4c = []byte{ + // 339 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x92, 0xb1, 0x4f, 0xfa, 0x40, + 0x14, 0xc7, 0x7b, 0xbf, 0x5f, 0x20, 0xe1, 0xc0, 0x98, 0x5c, 0x14, 0x4b, 0x4d, 0x0a, 0xa9, 0x8b, + 0x53, 0x9b, 0xe0, 0xc8, 0x60, 0x80, 0x3a, 0x74, 0x90, 0xa1, 0x93, 0xba, 0x90, 0x72, 0x7d, 0x96, + 0x4b, 0xe8, 0x5d, 0xed, 0x1d, 0xbb, 0xff, 0x82, 0x26, 0xfe, 0x4f, 0x8c, 0x8e, 0x4e, 0x44, 0xee, + 0x2f, 0x31, 0xa5, 0x42, 0xd4, 0xc0, 0xe0, 0xe6, 0xf6, 0xde, 0x37, 0xdf, 0xdc, 0x7d, 0xde, 0xf7, + 0x3d, 0x7c, 0x95, 0x30, 0x35, 0x9d, 0x4f, 0x5c, 0x2a, 0x52, 0xef, 0x9a, 0xd1, 0x5c, 0x48, 0x71, + 0xaf, 0xbc, 0x29, 0x95, 0x72, 0xca, 0x52, 0x8f, 0x71, 0x05, 0x39, 0x8f, 0x66, 0x1e, 0x15, 0x69, + 0x36, 0x57, 0x10, 0x25, 0xc0, 0xd5, 0xb7, 0xc6, 0xcd, 0x72, 0xa1, 0x84, 0x75, 0x94, 0x88, 0x44, + 0xac, 0x4b, 0xaf, 0xa8, 0x4a, 0xd5, 0x79, 0x46, 0xf8, 0xb8, 0x1f, 0xc7, 0xa3, 0x60, 0x18, 0x7c, + 0x3e, 0x14, 0xc2, 0xc3, 0x1c, 0xa4, 0x22, 0x5d, 0xdc, 0xa0, 0x82, 0xab, 0x88, 0x71, 0xc8, 0xc7, + 0x2c, 0x36, 0x51, 0x07, 0x9d, 0xd7, 0x06, 0x87, 0x7a, 0xd9, 0xae, 0x0f, 0x37, 0x7a, 0xe0, 0x87, + 0xf5, 0xad, 0x29, 0x88, 0x49, 0x07, 0x57, 0x39, 0xa3, 0x85, 0xfb, 0xdf, 0xda, 0x5d, 0xd3, 0xcb, + 0x76, 0x65, 0xc4, 0x68, 0xe0, 0x87, 0x15, 0xce, 0x68, 0x10, 0x93, 0x33, 0x7c, 0x00, 0x3c, 0xce, + 0x04, 0xe3, 0x6a, 0xcc, 0xa3, 0x14, 0xcc, 0xff, 0x85, 0x31, 0x6c, 0x6c, 0xc4, 0x51, 0x94, 0x82, + 0x63, 0xe2, 0xe6, 0x4f, 0x26, 0x99, 0x09, 0x2e, 0xc1, 0x79, 0x41, 0xd8, 0xf4, 0x61, 0x06, 0x0a, + 0xfe, 0x16, 0xf1, 0x29, 0x6e, 0xed, 0xc0, 0x2a, 0xa1, 0xbb, 0x4f, 0x08, 0x37, 0x86, 0xe5, 0x42, + 0xfa, 0xc5, 0x42, 0x48, 0x0f, 0x57, 0xcb, 0xf9, 0x48, 0xd3, 0xdd, 0x19, 0xbe, 0x75, 0xe2, 0xee, + 0x09, 0xc0, 0x20, 0x3e, 0xae, 0x6d, 0xbf, 0x22, 0x2d, 0x77, 0x5f, 0x1a, 0x96, 0xe5, 0xee, 0x25, + 0x72, 0x8c, 0xc1, 0xed, 0x62, 0x65, 0x1b, 0x6f, 0x2b, 0xdb, 0x78, 0xd4, 0x36, 0x5a, 0x68, 0x1b, + 0xbd, 0x6a, 0x1b, 0xbd, 0x6b, 0x1b, 0xdd, 0x5d, 0xfe, 0xfe, 0xdc, 0x7a, 0x5f, 0x9b, 0x1b, 0x63, + 0x52, 0x5d, 0xdf, 0xd6, 0xc5, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x77, 0xdb, 0x0e, 0x0a, 0xba, + 0x02, 0x00, 0x00, +} + +func (m *AddNICInternalRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AddNICInternalRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintComputeagent(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if len(m.NicID) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintComputeagent(dAtA, i, uint64(len(m.NicID))) + i += copy(dAtA[i:], m.NicID) + } + if len(m.EndpointName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintComputeagent(dAtA, i, uint64(len(m.EndpointName))) + i += copy(dAtA[i:], m.EndpointName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AddNICInternalResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AddNICInternalResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteNICInternalRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteNICInternalRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintComputeagent(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if len(m.NicID) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintComputeagent(dAtA, i, uint64(len(m.NicID))) + i += copy(dAtA[i:], m.NicID) + } + if len(m.EndpointName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintComputeagent(dAtA, i, uint64(len(m.EndpointName))) + i += copy(dAtA[i:], m.EndpointName) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteNICInternalResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteNICInternalResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintComputeagent(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *AddNICInternalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovComputeagent(uint64(l)) + } + l = len(m.NicID) + if l > 0 { + n += 1 + l + sovComputeagent(uint64(l)) + } + l = len(m.EndpointName) + if l > 0 { + n += 1 + l + sovComputeagent(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AddNICInternalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteNICInternalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovComputeagent(uint64(l)) + } + l = len(m.NicID) + if l > 0 { + n += 1 + l + sovComputeagent(uint64(l)) + } + l = len(m.EndpointName) + if l > 0 { + n += 1 + l + sovComputeagent(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteNICInternalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovComputeagent(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozComputeagent(x uint64) (n int) { + return sovComputeagent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *AddNICInternalRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AddNICInternalRequest{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `NicID:` + fmt.Sprintf("%v", this.NicID) + `,`, + `EndpointName:` + fmt.Sprintf("%v", this.EndpointName) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *AddNICInternalResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AddNICInternalResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *DeleteNICInternalRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeleteNICInternalRequest{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `NicID:` + fmt.Sprintf("%v", this.NicID) + `,`, + `EndpointName:` + fmt.Sprintf("%v", this.EndpointName) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *DeleteNICInternalResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeleteNICInternalResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringComputeagent(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} + +type ComputeAgentService interface { + AddNIC(ctx context.Context, req *AddNICInternalRequest) (*AddNICInternalResponse, error) + DeleteNIC(ctx context.Context, req *DeleteNICInternalRequest) (*DeleteNICInternalResponse, error) +} + +func RegisterComputeAgentService(srv *github_com_containerd_ttrpc.Server, svc ComputeAgentService) { + srv.Register("ComputeAgent", map[string]github_com_containerd_ttrpc.Method{ + "AddNIC": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req AddNICInternalRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.AddNIC(ctx, &req) + }, + "DeleteNIC": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req DeleteNICInternalRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.DeleteNIC(ctx, &req) + }, + }) +} + +type computeAgentClient struct { + client *github_com_containerd_ttrpc.Client +} + +func NewComputeAgentClient(client *github_com_containerd_ttrpc.Client) ComputeAgentService { + return &computeAgentClient{ + client: client, + } +} + +func (c *computeAgentClient) AddNIC(ctx context.Context, req *AddNICInternalRequest) (*AddNICInternalResponse, error) { + var resp AddNICInternalResponse + if err := c.client.Call(ctx, "ComputeAgent", "AddNIC", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *computeAgentClient) DeleteNIC(ctx context.Context, req *DeleteNICInternalRequest) (*DeleteNICInternalResponse, error) { + var resp DeleteNICInternalResponse + if err := c.client.Call(ctx, "ComputeAgent", "DeleteNIC", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} +func (m *AddNICInternalRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowComputeagent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AddNICInternalRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddNICInternalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowComputeagent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthComputeagent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthComputeagent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NicID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowComputeagent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthComputeagent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthComputeagent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NicID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndpointName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowComputeagent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthComputeagent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthComputeagent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndpointName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipComputeagent(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthComputeagent + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthComputeagent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AddNICInternalResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowComputeagent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AddNICInternalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddNICInternalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipComputeagent(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthComputeagent + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthComputeagent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteNICInternalRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowComputeagent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteNICInternalRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteNICInternalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowComputeagent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthComputeagent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthComputeagent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NicID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowComputeagent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthComputeagent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthComputeagent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NicID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndpointName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowComputeagent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthComputeagent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthComputeagent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndpointName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipComputeagent(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthComputeagent + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthComputeagent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteNICInternalResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowComputeagent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteNICInternalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteNICInternalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipComputeagent(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthComputeagent + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthComputeagent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipComputeagent(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowComputeagent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowComputeagent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowComputeagent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthComputeagent + } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthComputeagent + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowComputeagent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipComputeagent(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthComputeagent + } + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthComputeagent = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowComputeagent = fmt.Errorf("proto: integer overflow") +) diff --git a/internal/computeagent/computeagent.proto b/internal/computeagent/computeagent.proto new file mode 100644 index 0000000000..49fa7f36cb --- /dev/null +++ b/internal/computeagent/computeagent.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +option go_package = "github.com/Microsoft/hcsshim/internal/computeagent;computeagent"; + +import weak "gogoproto/gogo.proto"; + +service ComputeAgent{ + rpc AddNIC(AddNICInternalRequest) returns (AddNICInternalResponse) {} + rpc DeleteNIC(DeleteNICInternalRequest) returns (DeleteNICInternalResponse) {} +} + +message AddNICInternalRequest { + string container_id = 1; + string nic_id = 2; + string endpoint_name = 3; +} + +message AddNICInternalResponse {} + +message DeleteNICInternalRequest { + string container_id = 1; + string nic_id = 2; + string endpoint_name = 3; +} + +message DeleteNICInternalResponse {} \ No newline at end of file diff --git a/internal/computeagent/doc.go b/internal/computeagent/doc.go new file mode 100644 index 0000000000..691c3cd137 --- /dev/null +++ b/internal/computeagent/doc.go @@ -0,0 +1 @@ +package computeagent diff --git a/internal/hcsoci/create.go b/internal/hcsoci/create.go index 6132e4e53d..19689e9e01 100644 --- a/internal/hcsoci/create.go +++ b/internal/hcsoci/create.go @@ -35,7 +35,6 @@ var ( // where layer1 is the base read-only layer, layern is the top-most read-only // layer, and scratch is the RW layer. This is for historical reasons only. type CreateOptions struct { - // Common parameters ID string // Identifier for the container Owner string // Specifies the owner. Defaults to executable name. @@ -236,8 +235,19 @@ func configureSandboxNetwork(ctx context.Context, coi *createOptionsInternal, r // container but not a workload container in a sandbox that inherits // the namespace. if ct == oci.KubernetesContainerTypeNone || ct == oci.KubernetesContainerTypeSandbox { - if err := SetupNetworkNamespace(ctx, coi.HostingSystem, coi.actualNetworkNamespace); err != nil { - return err + if err := coi.HostingSystem.ConfigureNetworking(ctx, coi.actualNetworkNamespace); err != nil { + // No network setup type was specified for this UVM. Create and assign one here unless + // we received a different error. + if err == uvm.ErrNoNetworkSetup { + if err := coi.HostingSystem.CreateAndAssignNetworkSetup(ctx, "", ""); err != nil { + return err + } + if err := coi.HostingSystem.ConfigureNetworking(ctx, coi.actualNetworkNamespace); err != nil { + return err + } + } else { + return err + } } r.SetAddedNetNSToVM(true) } diff --git a/internal/hcsoci/network.go b/internal/hcsoci/network.go index dd0ddca374..2afe4109d9 100644 --- a/internal/hcsoci/network.go +++ b/internal/hcsoci/network.go @@ -3,7 +3,6 @@ package hcsoci import ( "context" - "github.com/Microsoft/hcsshim/hcn" "github.com/Microsoft/hcsshim/internal/hns" "github.com/Microsoft/hcsshim/internal/log" "github.com/Microsoft/hcsshim/internal/logfields" @@ -24,12 +23,15 @@ func createNetworkNamespace(ctx context.Context, coi *createOptionsInternal, r * if err != nil { return err } + log.G(ctx).WithFields(logrus.Fields{ "netID": netID, logfields.ContainerID: coi.ID, }).Info("created network namespace for container") + r.SetNetNS(netID) r.SetCreatedNetNS(true) + endpoints := make([]string, 0) for _, endpointID := range coi.Spec.Windows.Network.EndpointList { err = hns.AddNamespaceEndpoint(netID, endpointID) @@ -45,88 +47,3 @@ func createNetworkNamespace(ctx context.Context, coi *createOptionsInternal, r * r.Add(&uvm.NetworkEndpoints{EndpointIDs: endpoints, Namespace: netID}) return nil } - -// GetNamespaceEndpoints gets all endpoints in `netNS` -func GetNamespaceEndpoints(ctx context.Context, netNS string) ([]*hns.HNSEndpoint, error) { - op := "hcsoci::GetNamespaceEndpoints" - l := log.G(ctx).WithField("netns-id", netNS) - l.Debug(op + " - Begin") - defer func() { - l.Debug(op + " - End") - }() - - ids, err := hns.GetNamespaceEndpoints(netNS) - if err != nil { - return nil, err - } - var endpoints []*hns.HNSEndpoint - for _, id := range ids { - endpoint, err := hns.GetHNSEndpointByID(id) - if err != nil { - return nil, err - } - endpoints = append(endpoints, endpoint) - } - return endpoints, nil -} - -// Network namespace setup is a bit different for templates and clones. -// For templates and clones we use a special network namespace ID. -// Details about this can be found in the Networking section of the late-clone wiki page. -// -// In this function we take the namespace ID of the namespace that was created for this -// UVM. We hot add the namespace (with the default ID if this is a template). We get the -// endpoints associated with this namespace and then hot add those endpoints (by changing -// their namespace IDs by the deafult IDs if it is a template). -func SetupNetworkNamespace(ctx context.Context, hostingSystem *uvm.UtilityVM, nsid string) error { - nsidInsideUVM := nsid - if hostingSystem.IsTemplate || hostingSystem.IsClone { - nsidInsideUVM = uvm.DEFAULT_CLONE_NETWORK_NAMESPACE_ID - } - - // Query endpoints with actual nsid - endpoints, err := GetNamespaceEndpoints(ctx, nsid) - if err != nil { - return err - } - - // Add the network namespace inside the UVM if it is not a clone. (Clones will - // inherit the namespace from template) - if !hostingSystem.IsClone { - // Get the namespace struct from the actual nsid. - hcnNamespace, err := hcn.GetNamespaceByID(nsid) - if err != nil { - return err - } - - // All templates should have a special NSID so that it - // will be easier to debug. Override it here. - if hostingSystem.IsTemplate { - hcnNamespace.Id = nsidInsideUVM - } - - if err = hostingSystem.AddNetNS(ctx, hcnNamespace); err != nil { - return err - } - } - - // If adding a network endpoint to clones or a template override nsid associated - // with it. - if hostingSystem.IsClone || hostingSystem.IsTemplate { - // replace nsid for each endpoint - for _, ep := range endpoints { - ep.Namespace = &hns.Namespace{ - ID: nsidInsideUVM, - } - } - } - - if err = hostingSystem.AddEndpointsToNS(ctx, nsidInsideUVM, endpoints); err != nil { - // Best effort clean up the NS - if removeErr := hostingSystem.RemoveNetNS(ctx, nsidInsideUVM); removeErr != nil { - log.G(ctx).Warn(removeErr) - } - return err - } - return nil -} diff --git a/internal/ncproxyttrpc/doc.go b/internal/ncproxyttrpc/doc.go new file mode 100644 index 0000000000..4aa8ad2054 --- /dev/null +++ b/internal/ncproxyttrpc/doc.go @@ -0,0 +1 @@ +package ncproxyttrpc diff --git a/internal/ncproxyttrpc/networkconfigproxy.pb.go b/internal/ncproxyttrpc/networkconfigproxy.pb.go new file mode 100644 index 0000000000..bcf0b91953 --- /dev/null +++ b/internal/ncproxyttrpc/networkconfigproxy.pb.go @@ -0,0 +1,985 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: github.com/Microsoft/hcsshim/internal/ncproxyttrpc/networkconfigproxy.proto + +package ncproxyttrpc + +import ( + context "context" + fmt "fmt" + github_com_containerd_ttrpc "github.com/containerd/ttrpc" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type RequestTypeInternal int32 + +const ( + RequestTypeInternal_Setup RequestTypeInternal = 0 + RequestTypeInternal_Teardown RequestTypeInternal = 1 +) + +var RequestTypeInternal_name = map[int32]string{ + 0: "Setup", + 1: "Teardown", +} + +var RequestTypeInternal_value = map[string]int32{ + "Setup": 0, + "Teardown": 1, +} + +func (x RequestTypeInternal) String() string { + return proto.EnumName(RequestTypeInternal_name, int32(x)) +} + +func (RequestTypeInternal) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_11f9efc6dfbf9b45, []int{0} +} + +type RegisterComputeAgentRequest struct { + AgentAddress string `protobuf:"bytes,1,opt,name=agent_address,json=agentAddress,proto3" json:"agent_address,omitempty"` + ContainerID string `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RegisterComputeAgentRequest) Reset() { *m = RegisterComputeAgentRequest{} } +func (*RegisterComputeAgentRequest) ProtoMessage() {} +func (*RegisterComputeAgentRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_11f9efc6dfbf9b45, []int{0} +} +func (m *RegisterComputeAgentRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RegisterComputeAgentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RegisterComputeAgentRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RegisterComputeAgentRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_RegisterComputeAgentRequest.Merge(m, src) +} +func (m *RegisterComputeAgentRequest) XXX_Size() int { + return m.Size() +} +func (m *RegisterComputeAgentRequest) XXX_DiscardUnknown() { + xxx_messageInfo_RegisterComputeAgentRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_RegisterComputeAgentRequest proto.InternalMessageInfo + +type RegisterComputeAgentResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RegisterComputeAgentResponse) Reset() { *m = RegisterComputeAgentResponse{} } +func (*RegisterComputeAgentResponse) ProtoMessage() {} +func (*RegisterComputeAgentResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_11f9efc6dfbf9b45, []int{1} +} +func (m *RegisterComputeAgentResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RegisterComputeAgentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RegisterComputeAgentResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RegisterComputeAgentResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_RegisterComputeAgentResponse.Merge(m, src) +} +func (m *RegisterComputeAgentResponse) XXX_Size() int { + return m.Size() +} +func (m *RegisterComputeAgentResponse) XXX_DiscardUnknown() { + xxx_messageInfo_RegisterComputeAgentResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_RegisterComputeAgentResponse proto.InternalMessageInfo + +type ConfigureNetworkingInternalRequest struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + RequestType RequestTypeInternal `protobuf:"varint,2,opt,name=request_type,json=requestType,proto3,enum=RequestTypeInternal" json:"request_type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConfigureNetworkingInternalRequest) Reset() { *m = ConfigureNetworkingInternalRequest{} } +func (*ConfigureNetworkingInternalRequest) ProtoMessage() {} +func (*ConfigureNetworkingInternalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_11f9efc6dfbf9b45, []int{2} +} +func (m *ConfigureNetworkingInternalRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConfigureNetworkingInternalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConfigureNetworkingInternalRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConfigureNetworkingInternalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfigureNetworkingInternalRequest.Merge(m, src) +} +func (m *ConfigureNetworkingInternalRequest) XXX_Size() int { + return m.Size() +} +func (m *ConfigureNetworkingInternalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ConfigureNetworkingInternalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ConfigureNetworkingInternalRequest proto.InternalMessageInfo + +type ConfigureNetworkingInternalResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConfigureNetworkingInternalResponse) Reset() { *m = ConfigureNetworkingInternalResponse{} } +func (*ConfigureNetworkingInternalResponse) ProtoMessage() {} +func (*ConfigureNetworkingInternalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_11f9efc6dfbf9b45, []int{3} +} +func (m *ConfigureNetworkingInternalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConfigureNetworkingInternalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConfigureNetworkingInternalResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConfigureNetworkingInternalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfigureNetworkingInternalResponse.Merge(m, src) +} +func (m *ConfigureNetworkingInternalResponse) XXX_Size() int { + return m.Size() +} +func (m *ConfigureNetworkingInternalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ConfigureNetworkingInternalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ConfigureNetworkingInternalResponse proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("RequestTypeInternal", RequestTypeInternal_name, RequestTypeInternal_value) + proto.RegisterType((*RegisterComputeAgentRequest)(nil), "RegisterComputeAgentRequest") + proto.RegisterType((*RegisterComputeAgentResponse)(nil), "RegisterComputeAgentResponse") + proto.RegisterType((*ConfigureNetworkingInternalRequest)(nil), "ConfigureNetworkingInternalRequest") + proto.RegisterType((*ConfigureNetworkingInternalResponse)(nil), "ConfigureNetworkingInternalResponse") +} + +func init() { + proto.RegisterFile("github.com/Microsoft/hcsshim/internal/ncproxyttrpc/networkconfigproxy.proto", fileDescriptor_11f9efc6dfbf9b45) +} + +var fileDescriptor_11f9efc6dfbf9b45 = []byte{ + // 401 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x4f, 0x8f, 0xd2, 0x40, + 0x14, 0xef, 0x98, 0x68, 0x64, 0xa8, 0x4a, 0x06, 0x0e, 0x04, 0xb1, 0x9a, 0xa2, 0x89, 0xf1, 0x30, + 0x4d, 0xf0, 0xe0, 0xc1, 0x8b, 0x80, 0x17, 0x62, 0x34, 0xa6, 0x62, 0x62, 0xb8, 0x90, 0xd2, 0x3e, + 0xca, 0x44, 0x99, 0x19, 0x67, 0xa6, 0x22, 0x37, 0xbf, 0x82, 0xdf, 0x8a, 0xdb, 0xee, 0x71, 0x4f, + 0x9b, 0xa5, 0x9f, 0x64, 0xd3, 0x16, 0xd8, 0xcd, 0xa6, 0x81, 0xcd, 0xde, 0xe6, 0xfd, 0xf2, 0xe6, + 0xf7, 0xe7, 0xbd, 0x87, 0x3f, 0xc5, 0xcc, 0xcc, 0x93, 0x29, 0x0d, 0xc5, 0xc2, 0xfb, 0xcc, 0x42, + 0x25, 0xb4, 0x98, 0x19, 0x6f, 0x1e, 0x6a, 0x3d, 0x67, 0x0b, 0x8f, 0x71, 0x03, 0x8a, 0x07, 0xbf, + 0x3c, 0x1e, 0x4a, 0x25, 0xfe, 0xae, 0x8c, 0x51, 0x32, 0xf4, 0x38, 0x98, 0xa5, 0x50, 0x3f, 0x43, + 0xc1, 0x67, 0x2c, 0xce, 0x71, 0x2a, 0x95, 0x30, 0xa2, 0xd5, 0x88, 0x45, 0x2c, 0xf2, 0xa7, 0x97, + 0xbd, 0x0a, 0xd4, 0xfd, 0x83, 0x9f, 0xfa, 0x10, 0x33, 0x6d, 0x40, 0x0d, 0xc4, 0x42, 0x26, 0x06, + 0x7a, 0x31, 0x70, 0xe3, 0xc3, 0xef, 0x04, 0xb4, 0x21, 0x1d, 0xfc, 0x28, 0xc8, 0xea, 0x49, 0x10, + 0x45, 0x0a, 0xb4, 0x6e, 0xa2, 0x17, 0xe8, 0x75, 0xc5, 0xb7, 0x73, 0xb0, 0x57, 0x60, 0xa4, 0x8b, + 0xed, 0x50, 0x70, 0x13, 0x30, 0x0e, 0x6a, 0xc2, 0xa2, 0xe6, 0xbd, 0xac, 0xa7, 0xff, 0x24, 0x3d, + 0x7f, 0x5e, 0x1d, 0xec, 0xf0, 0xe1, 0x47, 0xbf, 0xba, 0x6f, 0x1a, 0x46, 0xae, 0x83, 0xdb, 0xe5, + 0xba, 0x5a, 0x0a, 0xae, 0xc1, 0xfd, 0x8f, 0xb0, 0x3b, 0xc8, 0x33, 0x24, 0x0a, 0xbe, 0x14, 0x99, + 0x18, 0x8f, 0x87, 0xdb, 0xcc, 0x3b, 0x7f, 0x37, 0xa5, 0xd1, 0x71, 0x69, 0xf2, 0x0e, 0xdb, 0xaa, + 0xf8, 0x3e, 0x31, 0x2b, 0x09, 0xb9, 0xdd, 0xc7, 0xdd, 0x06, 0xdd, 0x72, 0x8e, 0x56, 0x12, 0xf6, + 0x32, 0x55, 0x75, 0x05, 0xba, 0xaf, 0x70, 0xe7, 0xa0, 0xa5, 0xc2, 0xfa, 0x1b, 0x8a, 0xeb, 0x25, + 0x54, 0xa4, 0x82, 0xef, 0x7f, 0x03, 0x93, 0xc8, 0x9a, 0x45, 0x6c, 0xfc, 0x70, 0x04, 0x81, 0x8a, + 0xc4, 0x92, 0xd7, 0x50, 0xf7, 0x04, 0x61, 0xb2, 0xa5, 0x2b, 0xe8, 0xbf, 0x66, 0x5b, 0x23, 0xdf, + 0x71, 0xa3, 0x6c, 0x42, 0xa4, 0x4d, 0x0f, 0x2c, 0xac, 0xf5, 0x8c, 0x1e, 0x1c, 0xab, 0x45, 0xa6, + 0xb8, 0x5e, 0x12, 0x82, 0x74, 0xe8, 0xf1, 0x69, 0xb7, 0x5e, 0xd2, 0x5b, 0xe4, 0x77, 0xad, 0xfe, + 0x78, 0xbd, 0x71, 0xac, 0xb3, 0x8d, 0x63, 0xfd, 0x4b, 0x1d, 0xb4, 0x4e, 0x1d, 0x74, 0x9a, 0x3a, + 0xe8, 0x22, 0x75, 0xd0, 0xf8, 0xc3, 0x1d, 0x2e, 0xfa, 0xfd, 0xf5, 0xea, 0x87, 0x35, 0x7d, 0x90, + 0x5f, 0xee, 0xdb, 0xcb, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9b, 0x7f, 0xad, 0x6c, 0x1e, 0x03, 0x00, + 0x00, +} + +func (m *RegisterComputeAgentRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegisterComputeAgentRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.AgentAddress) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.AgentAddress))) + i += copy(dAtA[i:], m.AgentAddress) + } + if len(m.ContainerID) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RegisterComputeAgentResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegisterComputeAgentResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ConfigureNetworkingInternalRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConfigureNetworkingInternalRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if m.RequestType != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintNetworkconfigproxy(dAtA, i, uint64(m.RequestType)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ConfigureNetworkingInternalResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConfigureNetworkingInternalResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintNetworkconfigproxy(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *RegisterComputeAgentRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AgentAddress) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RegisterComputeAgentResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ConfigureNetworkingInternalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovNetworkconfigproxy(uint64(l)) + } + if m.RequestType != 0 { + n += 1 + sovNetworkconfigproxy(uint64(m.RequestType)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ConfigureNetworkingInternalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovNetworkconfigproxy(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozNetworkconfigproxy(x uint64) (n int) { + return sovNetworkconfigproxy(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *RegisterComputeAgentRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RegisterComputeAgentRequest{`, + `AgentAddress:` + fmt.Sprintf("%v", this.AgentAddress) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *RegisterComputeAgentResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RegisterComputeAgentResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ConfigureNetworkingInternalRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ConfigureNetworkingInternalRequest{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `RequestType:` + fmt.Sprintf("%v", this.RequestType) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ConfigureNetworkingInternalResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ConfigureNetworkingInternalResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringNetworkconfigproxy(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} + +type NetworkConfigProxyService interface { + RegisterComputeAgent(ctx context.Context, req *RegisterComputeAgentRequest) (*RegisterComputeAgentResponse, error) + ConfigureNetworking(ctx context.Context, req *ConfigureNetworkingInternalRequest) (*ConfigureNetworkingInternalResponse, error) +} + +func RegisterNetworkConfigProxyService(srv *github_com_containerd_ttrpc.Server, svc NetworkConfigProxyService) { + srv.Register("NetworkConfigProxy", map[string]github_com_containerd_ttrpc.Method{ + "RegisterComputeAgent": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req RegisterComputeAgentRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.RegisterComputeAgent(ctx, &req) + }, + "ConfigureNetworking": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req ConfigureNetworkingInternalRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.ConfigureNetworking(ctx, &req) + }, + }) +} + +type networkConfigProxyClient struct { + client *github_com_containerd_ttrpc.Client +} + +func NewNetworkConfigProxyClient(client *github_com_containerd_ttrpc.Client) NetworkConfigProxyService { + return &networkConfigProxyClient{ + client: client, + } +} + +func (c *networkConfigProxyClient) RegisterComputeAgent(ctx context.Context, req *RegisterComputeAgentRequest) (*RegisterComputeAgentResponse, error) { + var resp RegisterComputeAgentResponse + if err := c.client.Call(ctx, "NetworkConfigProxy", "RegisterComputeAgent", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *networkConfigProxyClient) ConfigureNetworking(ctx context.Context, req *ConfigureNetworkingInternalRequest) (*ConfigureNetworkingInternalResponse, error) { + var resp ConfigureNetworkingInternalResponse + if err := c.client.Call(ctx, "NetworkConfigProxy", "ConfigureNetworking", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} +func (m *RegisterComputeAgentRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegisterComputeAgentRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisterComputeAgentRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AgentAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AgentAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RegisterComputeAgentResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegisterComputeAgentResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisterComputeAgentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConfigureNetworkingInternalRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfigureNetworkingInternalRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfigureNetworkingInternalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestType", wireType) + } + m.RequestType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestType |= RequestTypeInternal(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConfigureNetworkingInternalResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfigureNetworkingInternalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfigureNetworkingInternalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipNetworkconfigproxy(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthNetworkconfigproxy + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNetworkconfigproxy(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthNetworkconfigproxy + } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthNetworkconfigproxy + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNetworkconfigproxy + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipNetworkconfigproxy(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthNetworkconfigproxy + } + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthNetworkconfigproxy = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNetworkconfigproxy = fmt.Errorf("proto: integer overflow") +) diff --git a/internal/ncproxyttrpc/networkconfigproxy.proto b/internal/ncproxyttrpc/networkconfigproxy.proto new file mode 100644 index 0000000000..9ec8864c3e --- /dev/null +++ b/internal/ncproxyttrpc/networkconfigproxy.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +option go_package = "github.com/Microsoft/hcsshim/internal/ncproxyttrpc/;ncproxyttrpc"; + +import weak "gogoproto/gogo.proto"; + +service NetworkConfigProxy { + rpc RegisterComputeAgent(RegisterComputeAgentRequest) returns (RegisterComputeAgentResponse) {} + rpc ConfigureNetworking(ConfigureNetworkingInternalRequest) returns (ConfigureNetworkingInternalResponse) {} +} + +message RegisterComputeAgentRequest { + string agent_address = 1; + string container_id = 2; +} + +message RegisterComputeAgentResponse {} + +enum RequestTypeInternal { + Setup = 0; + Teardown = 1; +} + +message ConfigureNetworkingInternalRequest{ + string container_id = 1; + RequestTypeInternal request_type = 2; +} + +message ConfigureNetworkingInternalResponse{} \ No newline at end of file diff --git a/internal/oci/uvm.go b/internal/oci/uvm.go index 3d57222804..5c2cb3c3b5 100644 --- a/internal/oci/uvm.go +++ b/internal/oci/uvm.go @@ -154,7 +154,9 @@ const ( // the TemplateID. It is the client's responsibility to make sure that the sandbox // within which a cloned container needs to be created must also be created from the // same template. - annotationTemplateID = "io.microsoft.virtualmachine.templateid" + annotationTemplateID = "io.microsoft.virtualmachine.templateid" + annotationNetworkConfigProxy = "io.microsoft.network.ncproxy" + AnnotationNcproxyContainerID = "io.microsoft.network.ncproxy.containerid" ) // parseAnnotationsBool searches `a` for `key` and if found verifies that the @@ -458,6 +460,7 @@ func SpecToUVMCreateOpts(ctx context.Context, s *specs.Spec, id, owner string) ( lopts.BootFilesPath = parseAnnotationsString(s.Annotations, annotationBootFilesRootPath, lopts.BootFilesPath) lopts.ExternalGuestConnection = parseAnnotationsBool(ctx, s.Annotations, annotationUseExternalGCSBridge, lopts.ExternalGuestConnection) lopts.CPUGroupID = parseAnnotationsString(s.Annotations, annotationCPUGroupID, lopts.CPUGroupID) + lopts.NetworkConfigProxy = parseAnnotationsString(s.Annotations, annotationNetworkConfigProxy, lopts.NetworkConfigProxy) handleAnnotationPreferredRootFSType(ctx, s.Annotations, lopts) handleAnnotationKernelDirectBoot(ctx, s.Annotations, lopts) @@ -481,6 +484,7 @@ func SpecToUVMCreateOpts(ctx context.Context, s *specs.Spec, id, owner string) ( wopts.ExternalGuestConnection = parseAnnotationsBool(ctx, s.Annotations, annotationUseExternalGCSBridge, wopts.ExternalGuestConnection) wopts.DisableCompartmentNamespace = parseAnnotationsBool(ctx, s.Annotations, annotationDisableCompartmentNamespace, wopts.DisableCompartmentNamespace) wopts.CPUGroupID = parseAnnotationsString(s.Annotations, annotationCPUGroupID, wopts.CPUGroupID) + wopts.NetworkConfigProxy = parseAnnotationsString(s.Annotations, annotationNetworkConfigProxy, wopts.NetworkConfigProxy) handleAnnotationFullyPhysicallyBacked(ctx, s.Annotations, wopts) if err := handleCloneAnnotations(ctx, s.Annotations, wopts); err != nil { return nil, err @@ -513,5 +517,9 @@ func UpdateSpecFromOptions(s specs.Spec, opts *runhcsopts.Options) specs.Spec { s.Annotations[AnnotationGPUVHDPath] = opts.GPUVHDPath } + if _, ok := s.Annotations[annotationNetworkConfigProxy]; !ok && opts.NCProxyAddr != "" { + s.Annotations[annotationNetworkConfigProxy] = opts.NCProxyAddr + } + return s } diff --git a/internal/resources/resources.go b/internal/resources/resources.go index 00e7f973ba..89851ae7c3 100644 --- a/internal/resources/resources.go +++ b/internal/resources/resources.go @@ -73,7 +73,7 @@ type Resources struct { addedNetNSToVM bool // layers is a pointer to a struct of the layers paths of a container layers *layers.ImageLayers - // resources is an array of the resources associated with a container + // resources is a slice of the resources associated with a container resources []ResourceCloser } @@ -98,7 +98,7 @@ func NewContainerResources(id string) *Resources { func ReleaseResources(ctx context.Context, r *Resources, vm *uvm.UtilityVM, all bool) error { if vm != nil { if r.addedNetNSToVM { - if err := vm.RemoveNetNS(ctx, r.netNS); err != nil { + if err := vm.TearDownNetworking(ctx, r.netNS); err != nil { log.G(ctx).Warn(err) } r.addedNetNSToVM = false diff --git a/internal/uvm/computeagent.go b/internal/uvm/computeagent.go new file mode 100644 index 0000000000..a2cfc8215f --- /dev/null +++ b/internal/uvm/computeagent.go @@ -0,0 +1,96 @@ +package uvm + +import ( + "context" + "strings" + + "github.com/Microsoft/go-winio" + "github.com/Microsoft/hcsshim/internal/computeagent" + "github.com/Microsoft/hcsshim/internal/hns" + "github.com/Microsoft/hcsshim/pkg/octtrpc" + "github.com/containerd/ttrpc" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + + "github.com/Microsoft/hcsshim/internal/log" +) + +// This file holds the implementation of the Compute Agent service that is exposed for +// external network configuration. + +const ComputeAgentAddrFmt = "\\\\.\\pipe\\computeagent-%s" + +// computeAgent implements the ComputeAgent ttrpc service for adding and deleting NICs to a +// Utility VM. +type computeAgent struct { + uvm *UtilityVM +} + +var _ computeagent.ComputeAgentService = &computeAgent{} + +// AddNIC will add a NIC to the computeagent services hosting UVM. +func (ca *computeAgent) AddNIC(ctx context.Context, req *computeagent.AddNICInternalRequest) (*computeagent.AddNICInternalResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "containerID": req.ContainerID, + "endpointID": req.EndpointName, + "nicID": req.NicID, + }).Info("AddNIC request") + + endpoint, err := hns.GetHNSEndpointByName(req.EndpointName) + if err != nil { + return nil, errors.Wrapf(err, "failed to get endpoint with name %q", req.EndpointName) + } + if err := ca.uvm.AddEndpointToNSWithID(ctx, endpoint.Namespace.ID, req.NicID, endpoint); err != nil { + return nil, err + } + return &computeagent.AddNICInternalResponse{}, nil +} + +// DeleteNIC will delete a NIC from the computeagent services hosting UVM. +func (ca *computeAgent) DeleteNIC(ctx context.Context, req *computeagent.DeleteNICInternalRequest) (*computeagent.DeleteNICInternalResponse, error) { + log.G(ctx).WithFields(logrus.Fields{ + "containerID": req.ContainerID, + "nicID": req.NicID, + "endpointName": req.EndpointName, + }).Info("DeleteNIC request") + + endpoint, err := hns.GetHNSEndpointByName(req.EndpointName) + if err != nil { + return nil, errors.Wrapf(err, "failed to get endpoint with name %q", req.EndpointName) + } + + if err := ca.uvm.RemoveEndpointFromNS(ctx, endpoint.Namespace.ID, endpoint); err != nil { + return nil, err + } + return &computeagent.DeleteNICInternalResponse{}, nil +} + +func setupAndServe(ctx context.Context, caAddr string, vm *UtilityVM) error { + // Setup compute agent service + l, err := winio.ListenPipe(caAddr, nil) + if err != nil { + return errors.Wrapf(err, "failed to listen on %s", caAddr) + } + s, err := ttrpc.NewServer(ttrpc.WithUnaryServerInterceptor(octtrpc.ServerInterceptor())) + if err != nil { + return err + } + computeagent.RegisterComputeAgentService(s, &computeAgent{vm}) + + log.G(ctx).WithField("address", l.Addr().String()).Info("serving compute agent") + go func() { + defer l.Close() + if err := trapClosedConnErr(s.Serve(ctx, l)); err != nil { + log.G(ctx).WithError(err).Fatal("compute agent: serve failure") + } + }() + + return nil +} + +func trapClosedConnErr(err error) error { + if err == nil || strings.Contains(err.Error(), "use of closed network connection") { + return nil + } + return err +} diff --git a/internal/uvm/create.go b/internal/uvm/create.go index 47eda3cca9..cb18835309 100644 --- a/internal/uvm/create.go +++ b/internal/uvm/create.go @@ -85,6 +85,11 @@ type Options struct { // CPUGroupID set the ID of a CPUGroup on the host that the UVM should be added to on start. // Defaults to an empty string which indicates the UVM should not be added to any CPUGroup. CPUGroupID string + // NetworkConfigProxy holds the address of the network config proxy service. + // This != "" determines whether to start the ComputeAgent TTRPC service + // that receives the UVMs set of NICs from this proxy instead of enumerating + // the endpoints locally. + NetworkConfigProxy string } // compares the create opts used during template creation with the create opts diff --git a/internal/uvm/create_lcow.go b/internal/uvm/create_lcow.go index 1b3308e0ba..0c4a301b2a 100644 --- a/internal/uvm/create_lcow.go +++ b/internal/uvm/create_lcow.go @@ -9,6 +9,9 @@ import ( "path/filepath" "strings" + "github.com/Microsoft/hcsshim/internal/ncproxyttrpc" + "github.com/containerd/ttrpc" + "github.com/Microsoft/go-winio" "github.com/Microsoft/go-winio/pkg/guid" "github.com/Microsoft/hcsshim/internal/gcs" @@ -410,6 +413,16 @@ func CreateLCOW(ctx context.Context, opts *OptionsLCOW) (_ *UtilityVM, err error uvm.gcListener = l } + // If network config proxy address passed in, construct a client. + if opts.NetworkConfigProxy != "" { + conn, err := winio.DialPipe(opts.NetworkConfigProxy, nil) + if err != nil { + return nil, errors.Wrap(err, "failed to connect to ncproxy service") + } + client := ttrpc.NewClient(conn, ttrpc.WithOnClose(func() { conn.Close() })) + uvm.ncProxyClient = ncproxyttrpc.NewNetworkConfigProxyClient(client) + } + return uvm, nil } diff --git a/internal/uvm/create_wcow.go b/internal/uvm/create_wcow.go index 79bd93ec7e..8371d5eac2 100644 --- a/internal/uvm/create_wcow.go +++ b/internal/uvm/create_wcow.go @@ -12,6 +12,7 @@ import ( "github.com/Microsoft/hcsshim/internal/log" "github.com/Microsoft/hcsshim/internal/logfields" "github.com/Microsoft/hcsshim/internal/mergemaps" + "github.com/Microsoft/hcsshim/internal/ncproxyttrpc" "github.com/Microsoft/hcsshim/internal/oc" "github.com/Microsoft/hcsshim/internal/processorinfo" hcsschema "github.com/Microsoft/hcsshim/internal/schema2" @@ -19,6 +20,7 @@ import ( "github.com/Microsoft/hcsshim/internal/uvmfolder" "github.com/Microsoft/hcsshim/internal/wclayer" "github.com/Microsoft/hcsshim/internal/wcow" + "github.com/containerd/ttrpc" "github.com/pkg/errors" "go.opencensus.io/trace" ) @@ -330,5 +332,15 @@ func CreateWCOW(ctx context.Context, opts *OptionsWCOW) (_ *UtilityVM, err error } } + // If network config proxy address passed in, construct a client. + if opts.NetworkConfigProxy != "" { + conn, err := winio.DialPipe(opts.NetworkConfigProxy, nil) + if err != nil { + return nil, errors.Wrap(err, "failed to connect to ncproxy service") + } + client := ttrpc.NewClient(conn, ttrpc.WithOnClose(func() { conn.Close() })) + uvm.ncProxyClient = ncproxyttrpc.NewNetworkConfigProxyClient(client) + } + return uvm, nil } diff --git a/internal/uvm/network.go b/internal/uvm/network.go index 4be39676f9..1b72d7ce56 100644 --- a/internal/uvm/network.go +++ b/internal/uvm/network.go @@ -6,6 +6,8 @@ import ( "fmt" "os" + "github.com/Microsoft/hcsshim/internal/ncproxyttrpc" + "github.com/Microsoft/go-winio/pkg/guid" "github.com/Microsoft/hcsshim/hcn" "github.com/Microsoft/hcsshim/internal/guestrequest" @@ -24,8 +26,251 @@ var ( // ErrNetNSNotFound is an error indicating the guest UVM does not have a // network namespace by this id. ErrNetNSNotFound = errors.New("network namespace not found") + // ErrNICNotFound is an error indicating that the guest UVM does not have a NIC + // by this id. + ErrNICNotFound = errors.New("NIC not found in network namespace") +) + +// Network namespace setup is a bit different for templates and clones. +// For templates and clones we use a special network namespace ID. +// Details about this can be found in the Networking section of the late-clone wiki page. +// +// In this function we take the namespace ID of the namespace that was created for this +// UVM. We hot add the namespace (with the default ID if this is a template). We get the +// endpoints associated with this namespace and then hot add those endpoints (by changing +// their namespace IDs by the deafult IDs if it is a template). +func (uvm *UtilityVM) SetupNetworkNamespace(ctx context.Context, nsid string) error { + nsidInsideUVM := nsid + if uvm.IsTemplate || uvm.IsClone { + nsidInsideUVM = DEFAULT_CLONE_NETWORK_NAMESPACE_ID + } + + // Query endpoints with actual nsid + endpoints, err := GetNamespaceEndpoints(ctx, nsid) + if err != nil { + return err + } + + // Add the network namespace inside the UVM if it is not a clone. (Clones will + // inherit the namespace from template) + if !uvm.IsClone { + // Get the namespace struct from the actual nsid. + hcnNamespace, err := hcn.GetNamespaceByID(nsid) + if err != nil { + return err + } + + // All templates should have a special NSID so that it + // will be easier to debug. Override it here. + if uvm.IsTemplate { + hcnNamespace.Id = nsidInsideUVM + } + + if err = uvm.AddNetNS(ctx, hcnNamespace); err != nil { + return err + } + } + + // If adding a network endpoint to clones or a template override nsid associated + // with it. + if uvm.IsClone || uvm.IsTemplate { + // replace nsid for each endpoint + for _, ep := range endpoints { + ep.Namespace = &hns.Namespace{ + ID: nsidInsideUVM, + } + } + } + + if err = uvm.AddEndpointsToNS(ctx, nsidInsideUVM, endpoints); err != nil { + // Best effort clean up the NS + if removeErr := uvm.RemoveNetNS(ctx, nsidInsideUVM); removeErr != nil { + log.G(ctx).Warn(removeErr) + } + return err + } + return nil +} + +// GetNamespaceEndpoints gets all endpoints in `netNS` +func GetNamespaceEndpoints(ctx context.Context, netNS string) ([]*hns.HNSEndpoint, error) { + op := "uvm::GetNamespaceEndpoints" + l := log.G(ctx).WithField("netns-id", netNS) + l.Debug(op + " - Begin") + defer func() { + l.Debug(op + " - End") + }() + + ids, err := hns.GetNamespaceEndpoints(netNS) + if err != nil { + return nil, err + } + var endpoints []*hns.HNSEndpoint + for _, id := range ids { + endpoint, err := hns.GetHNSEndpointByID(id) + if err != nil { + return nil, err + } + endpoints = append(endpoints, endpoint) + } + return endpoints, nil +} + +// NCProxyEnabled returns if there is a network configuration client. +func (uvm *UtilityVM) NCProxyEnabled() bool { + return uvm.ncProxyClient != nil +} + +// NCProxyClient returns the network configuration proxy client. +func (uvm *UtilityVM) NCProxyClient() ncproxyttrpc.NetworkConfigProxyService { + return uvm.ncProxyClient +} + +// NetworkConfigType specifies the action to be performed during network configuration. +// For example: setup or teardown +type NetworkConfigType uint8 + +const ( + NetworkRequestSetup NetworkConfigType = iota + NetworkRequestTearDown ) +var ErrNoNetworkSetup = errors.New("no network setup present for UVM") + +// CreateAndAssignNetworkSetup creates and assigns a new NetworkSetup interface to the Utility VM. +// This can be used to configure the networking (setup and teardown) of the vm. +// +// `addr` is an optional parameter +func (uvm *UtilityVM) CreateAndAssignNetworkSetup(ctx context.Context, addr, containerID string) (err error) { + if uvm.NCProxyEnabled() { + if addr == "" || containerID == "" { + return errors.New("received empty field(s) for external network setup") + } + setup, err := NewExternalNetworkSetup(ctx, uvm, addr, containerID) + if err != nil { + return err + } + uvm.networkSetup = setup + } else { + uvm.networkSetup = NewInternalNetworkSetup(uvm) + } + return nil +} + +// ConfigureNetworking configures the utility VMs networking setup using the namespace ID +// `nsid`. +func (uvm *UtilityVM) ConfigureNetworking(ctx context.Context, nsid string) error { + if uvm.networkSetup != nil { + return uvm.networkSetup.ConfigureNetworking(ctx, nsid, NetworkRequestSetup) + } + return ErrNoNetworkSetup +} + +// TearDownNetworking tears down the utility VMs networking setup using the namespace ID +// `nsid`. +func (uvm *UtilityVM) TearDownNetworking(ctx context.Context, nsid string) error { + if uvm.networkSetup != nil { + return uvm.networkSetup.ConfigureNetworking(ctx, nsid, NetworkRequestTearDown) + } + return ErrNoNetworkSetup +} + +// NetworkSetup is used to abstract away the details of setting up networking +// for a container. +type NetworkSetup interface { + ConfigureNetworking(ctx context.Context, namespaceID string, configType NetworkConfigType) error +} + +// LocalNetworkSetup implements the NetworkSetup interface for configuring container +// networking. +type internalNetworkSetup struct { + vm *UtilityVM +} + +func NewInternalNetworkSetup(vm *UtilityVM) NetworkSetup { + return &internalNetworkSetup{vm} +} + +func (i *internalNetworkSetup) ConfigureNetworking(ctx context.Context, namespaceID string, configType NetworkConfigType) error { + switch configType { + case NetworkRequestSetup: + if err := i.vm.SetupNetworkNamespace(ctx, namespaceID); err != nil { + return err + } + case NetworkRequestTearDown: + if err := i.vm.RemoveNetNS(ctx, namespaceID); err != nil { + return err + } + default: + return fmt.Errorf("network configuration type %d is not known", configType) + } + + return nil +} + +// ExternalNetworkSetup implements the NetworkSetup interface for configuring +// container networking. It will try and communicate with an external network configuration +// proxy service to setup networking. +type externalNetworkSetup struct { + vm *UtilityVM + caAddr string + containerID string +} + +// NewExternalNetworkSetup returns an object implementing the NetworkSetup interface to be +// used for external network configuration. +func NewExternalNetworkSetup(ctx context.Context, vm *UtilityVM, caAddr, containerID string) (NetworkSetup, error) { + if err := setupAndServe(ctx, caAddr, vm); err != nil { + return nil, err + } + + return &externalNetworkSetup{ + vm, + caAddr, + containerID, + }, nil +} + +func (e *externalNetworkSetup) ConfigureNetworking(ctx context.Context, namespaceID string, configType NetworkConfigType) error { + client := e.vm.NCProxyClient() + if client == nil { + return fmt.Errorf("no ncproxy client for UVM %q", e.vm.ID()) + } + + netReq := &ncproxyttrpc.ConfigureNetworkingInternalRequest{ + ContainerID: e.containerID, + } + + switch configType { + case NetworkRequestSetup: + if err := e.vm.AddNetNSByID(ctx, namespaceID); err != nil { + return err + } + + registerReq := &ncproxyttrpc.RegisterComputeAgentRequest{ + ContainerID: e.containerID, + AgentAddress: e.caAddr, + } + if _, err := client.RegisterComputeAgent(ctx, registerReq); err != nil { + return err + } + + netReq.RequestType = ncproxyttrpc.RequestTypeInternal_Setup + if _, err := client.ConfigureNetworking(ctx, netReq); err != nil { + return err + } + case NetworkRequestTearDown: + netReq.RequestType = ncproxyttrpc.RequestTypeInternal_Teardown + if _, err := client.ConfigureNetworking(ctx, netReq); err != nil { + return err + } + default: + return fmt.Errorf("network configuration type %d is not known", configType) + } + + return nil +} + // NetworkEndpoints is a struct containing all of the endpoint IDs of a network // namespace. type NetworkEndpoints struct { @@ -61,7 +306,7 @@ func (endpoints *NetworkEndpoints) Release(ctx context.Context) error { // This function is mostly used when we need to override the values inside the namespace // struct returned by the GetNamespaceByID. For most uses cases AddNetNSByID is more appropriate. // -// If a namespace with the same id already exists returns `ErrNetNSAlreadyAttached`. +// If a namespace with the same id already exists this returns `ErrNetNSAlreadyAttached`. func (uvm *UtilityVM) AddNetNS(ctx context.Context, hcnNamespace *hcn.HostComputeNamespace) error { uvm.m.Lock() defer uvm.m.Unlock() @@ -111,6 +356,36 @@ func (uvm *UtilityVM) AddNetNSByID(ctx context.Context, id string) error { return nil } +// AddEndpointToNSWithID adds an endpoint to the network namespace with the specified +// NIC ID. If nicID is an empty string, a GUID will be generated for the ID instead. +// +// If no network namespace matches `id` returns `ErrNetNSNotFound`. +func (uvm *UtilityVM) AddEndpointToNSWithID(ctx context.Context, nsID, nicID string, endpoint *hns.HNSEndpoint) error { + uvm.m.Lock() + defer uvm.m.Unlock() + ns, ok := uvm.namespaces[nsID] + if !ok { + return ErrNetNSNotFound + } + if _, ok := ns.nics[endpoint.Id]; !ok { + if nicID == "" { + id, err := guid.NewV4() + if err != nil { + return err + } + nicID = id.String() + } + if err := uvm.addNIC(ctx, nicID, endpoint); err != nil { + return err + } + ns.nics[endpoint.Id] = &nicInfo{ + ID: nicID, + Endpoint: endpoint, + } + } + return nil +} + // AddEndpointsToNS adds all unique `endpoints` to the network namespace // matching `id`. On failure does not roll back any previously successfully // added endpoints. @@ -131,11 +406,11 @@ func (uvm *UtilityVM) AddEndpointsToNS(ctx context.Context, id string, endpoints if err != nil { return err } - if err := uvm.addNIC(ctx, nicID, endpoint); err != nil { + if err := uvm.addNIC(ctx, nicID.String(), endpoint); err != nil { return err } ns.nics[endpoint.Id] = &nicInfo{ - ID: nicID, + ID: nicID.String(), Endpoint: endpoint, } } @@ -206,6 +481,31 @@ func (uvm *UtilityVM) RemoveEndpointsFromNS(ctx context.Context, id string, endp return nil } +// RemoveEndpointFromNS removes ``endpoint` in the network +// namespace matching `id`. If no endpoint matching `endpoint.Id` is found in +// the network namespace this command returns `ErrNICNotFound`. +// +// If no network namespace matches `id` this function returns `ErrNetNSNotFound`. +func (uvm *UtilityVM) RemoveEndpointFromNS(ctx context.Context, id string, endpoint *hns.HNSEndpoint) error { + uvm.m.Lock() + defer uvm.m.Unlock() + + ns, ok := uvm.namespaces[id] + if !ok { + return ErrNetNSNotFound + } + + if ninfo, ok := ns.nics[endpoint.Id]; ok && ninfo != nil { + if err := uvm.removeNIC(ctx, ninfo.ID, ninfo.Endpoint); err != nil { + return err + } + delete(ns.nics, endpoint.Id) + } else { + return ErrNICNotFound + } + return nil +} + // IsNetworkNamespaceSupported returns bool value specifying if network namespace is supported inside the guest func (uvm *UtilityVM) isNetworkNamespaceSupported() bool { return uvm.guestCaps.NamespaceAddRequestSupported @@ -226,7 +526,8 @@ func getNetworkModifyRequest(adapterID string, requestType string, settings inte } } -func (uvm *UtilityVM) addNIC(ctx context.Context, id guid.GUID, endpoint *hns.HNSEndpoint) error { +// addNIC adds a nic to the Utility VM. +func (uvm *UtilityVM) addNIC(ctx context.Context, id string, endpoint *hns.HNSEndpoint) error { // First a pre-add. This is a guest-only request and is only done on Windows. if uvm.operatingSystem == "windows" { preAddRequest := hcsschema.ModifySettingRequest{ @@ -234,7 +535,7 @@ func (uvm *UtilityVM) addNIC(ctx context.Context, id guid.GUID, endpoint *hns.HN ResourceType: guestrequest.ResourceTypeNetwork, RequestType: requesttype.Add, Settings: getNetworkModifyRequest( - id.String(), + id, requesttype.PreAdd, endpoint), }, @@ -247,7 +548,7 @@ func (uvm *UtilityVM) addNIC(ctx context.Context, id guid.GUID, endpoint *hns.HN // Then the Add itself request := hcsschema.ModifySettingRequest{ RequestType: requesttype.Add, - ResourcePath: fmt.Sprintf(networkResourceFormat, id.String()), + ResourcePath: fmt.Sprintf(networkResourceFormat, id), Settings: hcsschema.NetworkAdapter{ EndpointId: endpoint.Id, MacAddress: endpoint.MacAddress, @@ -259,7 +560,7 @@ func (uvm *UtilityVM) addNIC(ctx context.Context, id guid.GUID, endpoint *hns.HN ResourceType: guestrequest.ResourceTypeNetwork, RequestType: requesttype.Add, Settings: getNetworkModifyRequest( - id.String(), + id, requesttype.Add, nil), } @@ -271,7 +572,7 @@ func (uvm *UtilityVM) addNIC(ctx context.Context, id guid.GUID, endpoint *hns.HN RequestType: requesttype.Add, Settings: &guestrequest.LCOWNetworkAdapter{ NamespaceID: endpoint.Namespace.ID, - ID: id.String(), + ID: id, MacAddress: endpoint.MacAddress, IPAddress: endpoint.IPAddress.String(), PrefixLength: endpoint.PrefixLength, @@ -292,10 +593,10 @@ func (uvm *UtilityVM) addNIC(ctx context.Context, id guid.GUID, endpoint *hns.HN return nil } -func (uvm *UtilityVM) removeNIC(ctx context.Context, id guid.GUID, endpoint *hns.HNSEndpoint) error { +func (uvm *UtilityVM) removeNIC(ctx context.Context, id string, endpoint *hns.HNSEndpoint) error { request := hcsschema.ModifySettingRequest{ RequestType: requesttype.Remove, - ResourcePath: fmt.Sprintf(networkResourceFormat, id.String()), + ResourcePath: fmt.Sprintf(networkResourceFormat, id), Settings: hcsschema.NetworkAdapter{ EndpointId: endpoint.Id, MacAddress: endpoint.MacAddress, @@ -306,7 +607,7 @@ func (uvm *UtilityVM) removeNIC(ctx context.Context, id guid.GUID, endpoint *hns request.GuestRequest = hcsschema.ModifySettingRequest{ RequestType: requesttype.Remove, Settings: getNetworkModifyRequest( - id.String(), + id, requesttype.Remove, nil), } diff --git a/internal/uvm/types.go b/internal/uvm/types.go index 5f29166edf..7d0b3ccb8b 100644 --- a/internal/uvm/types.go +++ b/internal/uvm/types.go @@ -10,6 +10,7 @@ import ( "github.com/Microsoft/hcsshim/internal/gcs" "github.com/Microsoft/hcsshim/internal/hcs" "github.com/Microsoft/hcsshim/internal/hns" + "github.com/Microsoft/hcsshim/internal/ncproxyttrpc" "github.com/Microsoft/hcsshim/internal/schema1" "golang.org/x/sys/windows" ) @@ -29,7 +30,7 @@ type vpmemInfo struct { } type nicInfo struct { - ID guid.GUID + ID string Endpoint *hns.HNSEndpoint } @@ -110,7 +111,7 @@ type UtilityVM struct { vmmemOnce sync.Once // mountCounter is the number of mounts that have been added to the UVM - // This is used in generating unique mount path inside UVM for every mount. + // This is used in generating a unique mount path inside the UVM for every mount. // Access to this variable should be done atomically. mountCounter uint64 @@ -130,4 +131,11 @@ type UtilityVM struct { // The CreateOpts used to create this uvm. These can be either of type // uvm.OptionsLCOW or uvm.OptionsWCOW createOpts interface{} + // Network config proxy client. If nil then this wasn't requested and the + // uvms network will be configured locally. + ncProxyClient ncproxyttrpc.NetworkConfigProxyService + + // networkSetup handles the logic for setting up and tearing down any network configuration + // for the Utility VM. + networkSetup NetworkSetup }