Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Network MTU writable assuming that the net-mtu-writable extension is enabled #1261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,11 @@ public interface NetworkUpdate extends ModelEntity, Buildable<NetworkUpdateBuild
* @return true if this network is shared
*/
boolean isShared();


/**
* Requires the net-mtu-writable extension
*
* @return the MTU value to update on the network
*/
Integer getMTU();
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,11 @@ public interface NetworkBuilder extends Builder<NetworkBuilder, Network> {
* @see Network#getAvailabilityZoneHints()
*/
NetworkBuilder addAvailabilityZoneHints(String availabilityZone);

/**
* Requires the net-mtu-writable extension
*
* @see Network#getMTU()
*/
NetworkBuilder mtu(Integer mtu);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,12 @@ public interface NetworkUpdateBuilder extends Builder<NetworkUpdateBuilder, Netw
* @return the builder
*/
NetworkUpdateBuilder shared(boolean shared);

/**
* Requires the net-mtu-writable extension
*
* @param mtu MTU integer
* @return the builder
*/
NetworkUpdateBuilder mtu(Integer mtu);
}
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@ public NetworkBuilder isRouterExternal(boolean routerExternal) {
return this;
}

@Override
public NetworkBuilder mtu(Integer mtu) {
m.mtu = mtu;
return this;
}

@Override
public Network build() {
return m;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class NeutronNetworkUpdate implements NetworkUpdate {
@JsonProperty("admin_state_up")
private Boolean adminStateUp;

@JsonProperty("mtu")
private Integer mtu;

public static NetworkUpdateBuilder builder() {
return new NetworkUpdateConcreteBuilder();
}
Expand All @@ -51,6 +54,12 @@ public boolean isShared() {
return shared == null ? false : shared;
}

@JsonIgnore
@Override
public Integer getMTU() {
return mtu;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this).omitNullValues()
Expand Down Expand Up @@ -99,5 +108,10 @@ public NetworkUpdateBuilder shared(boolean shared) {
return this;
}

@Override
public NetworkUpdateBuilder mtu(Integer mtu) {
model.mtu = mtu;
return this;
}
}
}