Skip to content

Commit

Permalink
Update types to support DeviceInfo spec to 1.1.0
Browse files Browse the repository at this point in the history
Signed-off-by: Yury Kulazhenkov <[email protected]>
  • Loading branch information
ykulazhenkov committed Dec 2, 2022
1 parent 9679314 commit a72507f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
22 changes: 12 additions & 10 deletions pkg/apis/k8s.cni.cncf.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (
DeviceInfoTypeVHostUser = "vhost-user"
DeviceInfoTypeMemif = "memif"
DeviceInfoTypeVDPA = "vdpa"
DeviceInfoVersion = "1.0.0"
DeviceInfoVersion = "1.1.0"
)

// DeviceInfo contains the information of the device associated
Expand All @@ -58,18 +58,20 @@ type DeviceInfo struct {
}

type PciDevice struct {
PciAddress string `json:"pci-address,omitempty"`
Vhostnet string `json:"vhost-net,omitempty"`
RdmaDevice string `json:"rdma-device,omitempty"`
PfPciAddress string `json:"pf-pci-address,omitempty"`
PciAddress string `json:"pci-address,omitempty"`
Vhostnet string `json:"vhost-net,omitempty"`
RdmaDevice string `json:"rdma-device,omitempty"`
PfPciAddress string `json:"pf-pci-address,omitempty"`
RepresentorDevice string `json:"representor-device,omitempty"`
}

type VdpaDevice struct {
ParentDevice string `json:"parent-device,omitempty"`
Driver string `json:"driver,omitempty"`
Path string `json:"path,omitempty"`
PciAddress string `json:"pci-address,omitempty"`
PfPciAddress string `json:"pf-pci-address,omitempty"`
ParentDevice string `json:"parent-device,omitempty"`
Driver string `json:"driver,omitempty"`
Path string `json:"path,omitempty"`
PciAddress string `json:"pci-address,omitempty"`
PfPciAddress string `json:"pf-pci-address,omitempty"`
RepresentorDevice string `json:"representor-device,omitempty"`
}

const (
Expand Down
10 changes: 6 additions & 4 deletions pkg/utils/net-attach-def_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,11 @@ var _ = Describe("Netwok Attachment Definition manipulations", func() {
BeforeEach(func() {
deviceInfo = &v1.DeviceInfo{
Type: "pci",
Version: "v1.0.0",
Version: "v1.1.0",
Pci: &v1.PciDevice{
PciAddress: "0000:01:02.2",
PfPciAddress: "0000:01:02.0",
PciAddress: "0000:01:02.2",
PfPciAddress: "0000:01:02.0",
RepresentorDevice: "eth3",
},
}
var err error
Expand All @@ -158,9 +159,10 @@ var _ = Describe("Netwok Attachment Definition manipulations", func() {

It("create network status from cni result", func() {
Expect(networkStatus.DeviceInfo.Type).To(Equal("pci"))
Expect(networkStatus.DeviceInfo.Version).To(Equal("v1.0.0"))
Expect(networkStatus.DeviceInfo.Version).To(Equal("v1.1.0"))
Expect(networkStatus.DeviceInfo.Pci.PciAddress).To(Equal("0000:01:02.2"))
Expect(networkStatus.DeviceInfo.Pci.PfPciAddress).To(Equal("0000:01:02.0"))
Expect(networkStatus.DeviceInfo.Pci.RepresentorDevice).To(Equal("eth3"))
})
})

Expand Down

0 comments on commit a72507f

Please sign in to comment.