Skip to content

Commit

Permalink
wip: add pci/socketpath
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Zappa <michaelzappa@microsoft.com>
  • Loading branch information
MikeZappa87 committed Feb 26, 2024
1 parent b62753a commit 5c95907
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
8 changes: 5 additions & 3 deletions pkg/types/100/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,11 @@ func (r *Result) PrintTo(writer io.Writer) error {

// Interface contains values about the created interfaces
type Interface struct {
Name string `json:"name"`
Mac string `json:"mac,omitempty"`
Sandbox string `json:"sandbox,omitempty"`
Name string `json:"name"`
Mac string `json:"mac,omitempty"`
Sandbox string `json:"sandbox,omitempty"`
SocketPath string `json:"socket_path,omitempty"`
PCIID string `json:"pci_id,omitempty"`
}

func (i *Interface) String() string {
Expand Down
7 changes: 5 additions & 2 deletions pkg/types/100/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func testResult() *current.Result {
Expect(err).NotTo(HaveOccurred())
Expect(routev6).NotTo(BeNil())
Expect(routegwv6).NotTo(BeNil())

// Set every field of the struct to ensure source compatibility
return &current.Result{
CNIVersion: current.ImplementedSpecVersion,
Expand All @@ -54,6 +53,8 @@ func testResult() *current.Result {
Name: "eth0",
Mac: "00:11:22:33:44:55",
Sandbox: "/proc/3553/ns/net",
PCIID: "8086:9a01",
SocketPath: "/path/to/vhost/fd",
},
},
IPs: []*current.IPConfig{
Expand Down Expand Up @@ -106,7 +107,9 @@ var _ = Describe("Current types operations", func() {
{
"name": "eth0",
"mac": "00:11:22:33:44:55",
"sandbox": "/proc/3553/ns/net"
"sandbox": "/proc/3553/ns/net",
"pci_id": "8086:9a01",
"socket_path": "/path/to/vhost/fd"
}
],
"ips": [
Expand Down
3 changes: 2 additions & 1 deletion pkg/types/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,15 @@ var _ = Describe("Types", func() {
ipv6, err := types.ParseCIDR("abcd:1234:ffff::cdde/64")
Expect(err).NotTo(HaveOccurred())
Expect(ipv6).NotTo(BeNil())

result = &current.Result{
CNIVersion: "1.0.0",
Interfaces: []*current.Interface{
{
Name: "eth0",
Mac: "00:11:22:33:44:55",
Sandbox: "/proc/3553/ns/net",
PCIID: "8086:9a01",
SocketPath: "/path/to/vhost/fd",
},
},
IPs: []*current.IPConfig{
Expand Down
8 changes: 6 additions & 2 deletions pkg/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ var _ = Describe("Version operations", func() {
{
"name": "eth0",
"mac": "00:11:22:33:44:55",
"sandbox": "/proc/3553/ns/net"
"sandbox": "/proc/3553/ns/net",
"pci_id": "8086:9a01",
"socket_path": "/path/to/vhost/fd",
"mtu": "1500"
}
],
"ips": [
Expand All @@ -66,14 +69,15 @@ var _ = Describe("Version operations", func() {

err = version.ParsePrevResult(conf)
Expect(err).NotTo(HaveOccurred())

expectedResult := &cniv1.Result{
CNIVersion: "1.0.0",
Interfaces: []*cniv1.Interface{
{
Name: "eth0",
Mac: "00:11:22:33:44:55",
Sandbox: "/proc/3553/ns/net",
PCIID: "8086:9a01",
SocketPath: "/path/to/vhost/fd",
},
},
IPs: []*cniv1.IPConfig{
Expand Down

0 comments on commit 5c95907

Please sign in to comment.