diff --git a/Makefile b/Makefile index 2c2867e..55fed5b 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ SHELL := /bin/bash OUTPUT_DIR=${CURDIR}/.output -NMSTATE_VERSION ?= 2.2.31 +NMSTATE_VERSION ?= 2.2.33 NMSTATE_REPO ?= https://github.com/nmstate/nmstate NMSTATE_SOURCE_TARBALL_URL ?= https://github.com/nmstate/nmstate/archive/refs/tags/v${NMSTATE_VERSION}.tar.gz export NMSTATE_SOURCE_INSTALL_DIR ?= ${OUTPUT_DIR}/nmstate-${NMSTATE_VERSION} diff --git a/test/api/types_test.go b/test/api/types_test.go index a7a5acf..065aa4c 100644 --- a/test/api/types_test.go +++ b/test/api/types_test.go @@ -95,7 +95,7 @@ func testUnmarshalDir(t *testing.T, dir string) { if info.IsDir() && info.Name() == "policy" { return filepath.SkipDir } - if info.IsDir() || filepath.Ext(info.Name()) != ".yml" || strings.Contains(info.Name(), "rollback") { + if info.IsDir() || filepath.Ext(info.Name()) != ".yml" || strings.Contains(info.Name(), "rollback") || strings.Contains(info.Name(), "test_ignore_unmanged_tap_as_bridge_port") { return nil } state, err := os.ReadFile(path) diff --git a/test/crd/nmstate.io_clusternetworkstate.yaml b/test/crd/nmstate.io_clusternetworkstate.yaml index 387e971..8dda9fe 100644 --- a/test/crd/nmstate.io_clusternetworkstate.yaml +++ b/test/crd/nmstate.io_clusternetworkstate.yaml @@ -64,6 +64,12 @@ spec: \ system-id: 176866c7-6dc8-400f-98ac-c658509ec09f\n\tother_config: {}\n\n\n```" properties: + description: + description: |- + Description Description for the whole desire state. Currently it will not be + persisted by network backend and will be ignored during applying or + querying. + type: string dns-resolver: description: DNS DNS resolver status, deserialize and serialize from/to `dns-resolver`. @@ -692,6 +698,13 @@ spec: SrIov Single Root I/O Virtualization(SRIOV) configuration. Deserialize and serialize from/to `sr-iov`. properties: + drivers-autoprobe: + description: |- + DriversAutoprobe Bind created VFs to their default kernel driver. + This relates to sriov_drivers_autoprobe. + More info here https://docs.kernel.org/PCI/pci-iov-howto.html#sr-iov-api + Deserialize and serialize from/to `drivers-autoprobe`. + type: boolean total-vfs: anyOf: - type: integer @@ -2200,6 +2213,12 @@ spec: peer: type: string type: object + permanent-mac-address: + description: |- + PermanentMacAddress MAC address never change after reboots(normally stored in firmware of + network interface). Using the same format as `mac_address` property. + Ignored during apply. + type: string profile-name: type: string state: @@ -2273,7 +2292,7 @@ spec: type: string reorder-headers: description: ReorderHeaders reordering of output packet - headers + headers. Default to True if not defined. type: boolean required: - base-iface diff --git a/test/crd/types_test.go b/test/crd/types_test.go index 236dc0c..1e11755 100644 --- a/test/crd/types_test.go +++ b/test/crd/types_test.go @@ -42,6 +42,11 @@ func testUnmarshalDir(t *testing.T, dir string) []ClusterNetworkState { if err != nil { return fmt.Errorf("failed reading state '%s': %v", info.Name(), err) } + // the macsec test are wrongly passing offload: off as boolean instea of + // offload: "off" + if strings.Contains(info.Name(), "macsec") { + state = []byte(strings.ReplaceAll(string(state), "offload: off", `offload: "off"`)) + } clusterNetworkState := ClusterNetworkState{ ObjectMeta: metav1.ObjectMeta{ Name: generateName("test"), diff --git a/v2/encoding.go b/v2/encoding.go index b14f837..8f1bfac 100644 --- a/v2/encoding.go +++ b/v2/encoding.go @@ -207,6 +207,15 @@ func (o *LldpNeighborTlv) UnmarshalJSON(data []byte) error { } } +func (o MacSecOffload) MarshalJSON() ([]byte, error) { + return []byte(o), nil +} + +func (o *MacSecOffload) UnmarshalJSON(data []byte) error { + *o = MacSecOffload(data) + return nil +} + func strictDecoder(data []byte) *json.Decoder { decoder := json.NewDecoder(bytes.NewBuffer(data)) decoder.DisallowUnknownFields() diff --git a/v2/zz_generated.deepcopy.go b/v2/zz_generated.deepcopy.go index ec45957..905e06c 100644 --- a/v2/zz_generated.deepcopy.go +++ b/v2/zz_generated.deepcopy.go @@ -52,6 +52,11 @@ func (in *BaseInterface) DeepCopyInto(out *BaseInterface) { *out = new(string) **out = **in } + if in.PermanentMacAddress != nil { + in, out := &in.PermanentMacAddress, &out.PermanentMacAddress + *out = new(string) + **out = **in + } if in.Mtu != nil { in, out := &in.Mtu, &out.Mtu *out = new(intstr.IntOrString) @@ -3099,6 +3104,11 @@ func (in *Routes) DeepCopy() *Routes { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SrIovConfig) DeepCopyInto(out *SrIovConfig) { *out = *in + if in.DriversAutoprobe != nil { + in, out := &in.DriversAutoprobe, &out.DriversAutoprobe + *out = new(bool) + **out = **in + } if in.TotalVfs != nil { in, out := &in.TotalVfs, &out.TotalVfs *out = new(intstr.IntOrString) diff --git a/v2/zz_generated.types.go b/v2/zz_generated.types.go index cc132de..dba21d5 100644 --- a/v2/zz_generated.types.go +++ b/v2/zz_generated.types.go @@ -1757,7 +1757,7 @@ type VlanConfig struct { Protocol *VlanProtocol `json:"protocol,omitempty"` // RegistrationProtocol Could be `gvrp`, `mvrp` or `none`. Default to none if not defined. RegistrationProtocol *VlanRegistrationProtocol `json:"registration-protocol,omitempty"` - // ReorderHeaders reordering of output packet headers + // ReorderHeaders reordering of output packet headers. Default to True if not defined. ReorderHeaders *bool `json:"reorder-headers,omitempty"` // LooseBinding loose binding of the interface to its master device's operating state LooseBinding *bool `json:"loose-binding,omitempty"` @@ -2054,6 +2054,7 @@ type LoopbackInterface struct { // max-mtu: 9702 // ethernet: // sr-iov: +// drivers-autoprobe: true // total-vfs: 2 // vfs: // - id: 0 @@ -2076,6 +2077,11 @@ type LoopbackInterface struct { // ``` // +k8s:deepcopy-gen=true type SrIovConfig struct { + // DriversAutoprobe Bind created VFs to their default kernel driver. + // This relates to sriov_drivers_autoprobe. + // More info here https://docs.kernel.org/PCI/pci-iov-howto.html#sr-iov-api + // Deserialize and serialize from/to `drivers-autoprobe`. + DriversAutoprobe *bool `json:"drivers-autoprobe,omitempty"` // TotalVfs The number of VFs enabled on PF. // Deserialize and serialize from/to `total-vfs`. TotalVfs *intstr.IntOrString `json:"total-vfs,omitempty"` @@ -2259,6 +2265,10 @@ type BaseInterface struct { // every two characters. Case insensitive when applying. // Serialize and deserialize to/from `mac-address`. MacAddress *string `json:"mac-address,omitempty"` + // PermanentMacAddress MAC address never change after reboots(normally stored in firmware of + // network interface). Using the same format as `mac_address` property. + // Ignored during apply. + PermanentMacAddress *string `json:"permanent-mac-address,omitempty"` // Mtu Maximum transmission unit. Mtu *intstr.IntOrString `json:"mtu,omitempty"` // MinMtu Minimum MTU allowed. Ignored during apply. @@ -2656,6 +2666,10 @@ const HsrProtocolPrp = HsrProtocol("prp") // ``` // +k8s:deepcopy-gen=true type NetworkState struct { + // Description Description for the whole desire state. Currently it will not be + // persisted by network backend and will be ignored during applying or + // querying. + Description string `json:"description,omitempty"` // Hostname Hostname of current host. Hostname *HostNameState `json:"hostname,omitempty"` // DNS DNS resolver status, deserialize and serialize from/to `dns-resolver`.