diff --git a/ocp_resources/network_attachment_definition.py b/ocp_resources/network_attachment_definition.py index 36b49f2746..c43fec2b9c 100644 --- a/ocp_resources/network_attachment_definition.py +++ b/ocp_resources/network_attachment_definition.py @@ -202,6 +202,8 @@ def __init__( self, network_name=None, topology=None, + vlan=None, + mtu=None, **kwargs, ): """ @@ -211,8 +213,11 @@ def __init__( https://docs.openshift.com/container-platform/4.14/networking/multiple_networks/configuring-additional-network.html#configuration-ovnk-additional-networks_configuring-additional-network Args: - network_name (str): The name of the network. This field is mandatory when not using yaml - file. + network_name (str, optional): The name of the network, used to connect + resources created in different namespaces to the same network. + vlan (int, optional): A vlan tag ID that will be assigned to traffic from this + additional network. + mtu (str, optional): The maximum transmission unit (MTU). topology (str): The secondary network topology to be created. """ super().__init__( @@ -221,6 +226,8 @@ def __init__( ) self.network_name = network_name self.topology = topology + self.vlan = vlan + self.mtu = mtu def to_dict(self): super().to_dict() @@ -230,6 +237,10 @@ def to_dict(self): if not self.topology: raise ValueError("topology is required") spec_config = self.res["spec"]["config"] + if self.vlan: + spec_config["vlanID"] = self.vlan + if self.mtu: + spec_config["mtu"] = self.mtu spec_config["name"] = self.network_name spec_config["topology"] = self.topology spec_config["netAttachDefName"] = f"{self.namespace}/{self.name}"