1)adds the model for Neutron MTU.
2)Populates a the MTU extension and augment it to neutron network
Change-Id: Ib11a78eeed7cda529197164e42b3b9f94dbc4366
Signed-off-by: Aswin Suryanarayanan <asuryana@redhat.com>
--- /dev/null
+/*
+ * Copyright (c) 2018 Redhat Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+module neutron-mtu-ext {
+
+ yang-version 1;
+
+ namespace "urn:opendaylight:neutron-mtu-ext";
+
+ prefix neutron-mtu-ext;
+
+ import neutron { prefix "neutron"; }
+ import neutron-mtu { prefix "mtu"; }
+ import yang-ext { prefix "ext"; }
+
+ organization "OpenDaylight Neutron Group";
+
+ description "This YANG module defines Openstack Neutron mtu extensions model";
+
+ revision "2018-11-14" {
+ description
+ "OpenDaylight Neon release";
+ }
+
+ augment "/neutron:neutron/neutron:networks/neutron:network"{
+ description "This module augments the networks container
+ in the neutron-networks module with mtu information.";
+ ext:augment-identifier "network-mtu-extension";
+ uses mtu:mtu-attributes;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Redhat Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+module neutron-mtu {
+
+ yang-version 1;
+
+ namespace "urn:opendaylight:neutron-mtu";
+
+ prefix neutron-mtu;
+
+ import neutron-networks { prefix "networks"; }
+
+ organization "OpenDaylight Neutron Group";
+
+ description "This YANG module defines Openstack Neutron mtu extension attributes";
+
+ revision "2018-11-14";
+
+ grouping mtu-attributes {
+ leaf mtu {
+ type uint16;
+ description "The maximum transmission unit (MTU) value to address fragmentation.
+ Minimum value is 68 for IPv4, and 1280 for IPv6.";
+ }
+ }
+}
import org.opendaylight.neutron.spi.NeutronNetworkSegment;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.ext.rev150712.NetworkL3Extension;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.ext.rev150712.NetworkL3ExtensionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.mtu.ext.rev181114.NetworkMtuExtension;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.mtu.ext.rev181114.NetworkMtuExtensionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeFlat;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeGre;
if (qos != null && qos.getQosPolicyId() != null) {
result.setQosPolicyId(qos.getQosPolicyId().getValue());
}
+ final NetworkMtuExtension mtu = network.augmentation(NetworkMtuExtension.class);
+ if (mtu != null && mtu.getMtu() != null) {
+ result.setMtu(mtu.getMtu());
+ }
result.setSegments(segments);
return result;
}
}
networkBuilder.addAugmentation(NetworkL3Extension.class, l3ExtensionBuilder.build());
networkBuilder.addAugmentation(NetworkProviderExtension.class, providerExtensionBuilder.build());
+ if (network.getMtu() != null) {
+ final NetworkMtuExtensionBuilder mtuExtensionBuilder = new NetworkMtuExtensionBuilder();
+ mtuExtensionBuilder.setMtu(network.getMtu());
+ networkBuilder.addAugmentation(NetworkMtuExtension.class, mtuExtensionBuilder.build());
+ }
}
@Override