}
grouping L3-floatingip-attributes {
- leaf uuid {
- type yang:uuid;
- description "UUID to index this object.";
- }
- leaf tenant-id {
- type yang:uuid;
- description "The Tenant ID of this object.";
- }
leaf router-id {
description "Contains the Router ID of this floatingip object.";
type yang:uuid;
attached to an internal network.";
key "uuid";
+ uses attrs:id-attributes;
uses L3-floatingip-attributes;
}
}
"OpenDaylight Beryllium release";
}
- grouping base-attributes {
-
+ grouping id-attributes {
leaf uuid {
type yang:uuid;
description "UUID to index this neutron object.";
}
-
- leaf name {
- type string;
- description "Human-readable name for the item. Might not be unique.";
- }
-
leaf tenant-id {
status deprecated;
type yang:uuid;
}
}
+ grouping base-attributes {
+ uses id-attributes;
+ leaf name {
+ type string;
+ description "Human-readable name for the item. Might not be unique.";
+ }
+ }
+
grouping admin-attributes {
leaf admin-state-up {
type boolean;
}
grouping l2gateway-attributes {
- leaf l2gateway-name {
- type string;
- }
list devices {
description "Description of devices.";
key "uuid";
}
}
grouping member-attributes {
- leaf uuid {
- type yang:uuid;
- description "The unique ID for the member.";
- }
- leaf tenant-id {
- type yang:uuid;
- description "Owner of the member. Only an administrative user can specify
- a tenant ID other than its own.";
- }
leaf subnet-id {
type yang:uuid;
description "Subnet in which to access this member.";
}
}
grouping healthmonitor-attributes {
- leaf uuid {
- type yang:uuid;
- description "The unique ID for the healthmonitor.";
- }
- leaf tenant-id {
- type yang:uuid;
- description "Owner of the VIP. Only an administrative user can specify
- a tenant ID other than its own.";
- }
leaf type {
description "The type of probe, which is PING, TCP, HTTP, or HTTPS, that
is sent by the load balancer to verify the member state.";
description "Container for pool members.";
list member {
key "uuid";
+ uses attrs:id-attributes;
uses member-attributes;
description "List of members.";
}
description "Container for LBaaSV2.0 healthmonitors.";
list healthmonitor {
key "uuid";
+ uses attrs:id-attributes;
uses healthmonitor-attributes;
description "List of healthmonitors.";
}
grouping metering-rule-attributes {
description "OpenStack Layer3 Metering label rules.";
- leaf uuid {
- type yang:uuid;
- description "Metering Rule ID.";
- }
- leaf tenant-id {
- type yang:uuid;
- description "The UUID of the tenant that will own the object.";
- }
leaf direction {
type identityref {
base "constants:direction-base";
description " Container for metering rules.";
list metering-rule {
key "uuid";
+ uses attrs:id-attributes;
uses metering-rule-attributes;
description "List of Metering Rules.";
}
}
grouping bandwidthlimit-rule-attributes {
- leaf uuid {
- type yang:uuid;
- description "The rule id of the associated rule";
- }
- leaf tenant-id {
- type yang:uuid;
- description "The tenant id of OpenStack Tenant";
- }
leaf max-kbps {
type uint64;
description "The maximum KBPS value";
}
grouping dscpmarking-rule-attributes {
- leaf uuid {
- type yang:uuid;
- description "The rule id of the associated rule";
- }
- leaf tenant-id {
- type yang:uuid;
- description "The tenant id of OpenStack Tenant";
- }
leaf dscp-mark {
type uint8 {
range "0 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36
uses qos-policy-attributes;
list bandwidth-limit-rules {
key "uuid";
+ uses attrs:id-attributes;
uses bandwidthlimit-rule-attributes;
}
list dscpmarking-rules {
key "uuid";
+ uses attrs:id-attributes;
uses dscpmarking-rule-attributes;
}
}
}
grouping security-rule-attributes {
description "OpenStack Layer3 Security Group rules.";
- leaf uuid {
- type yang:uuid;
- description "Security Rule ID.";
- }
- leaf tenant-id {
- type yang:uuid;
- description "UUID of the tenant.";
- }
leaf direction {
type identityref {
base "constants:direction-base";
description "Container for security group rules.";
list security-rule {
key "uuid";
+ uses attrs:id-attributes;
uses security-rule-attributes;
description "List of Security Group Rules.";
}
@XmlRootElement(name = "l2gatewayConnection")
@XmlAccessorType(XmlAccessType.NONE)
-public final class NeutronL2gatewayConnection extends NeutronObject<NeutronL2gatewayConnection>
- implements Serializable, INeutronObject<NeutronL2gatewayConnection> {
+public final class NeutronL2gatewayConnection extends NeutronBaseAttributes<NeutronL2gatewayConnection>
+ implements Serializable {
private static final long serialVersionUID = 1L;
@XmlElement(name = "gateway_id")
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.attrs.rev150712.AdminAttributes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.attrs.rev150712.BaseAttributes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.attrs.rev150712.IdAttributes;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.Augmentable;
import org.opendaylight.yangtools.yang.binding.ChildOf;
try {
setUuid = builderClass.getDeclaredMethod("setUuid", Uuid.class);
setTenantId = builderClass.getDeclaredMethod("setTenantId", Uuid.class);
+ setProjectId = builderClass.getDeclaredMethod("setProjectId", String.class);
+ setRevisionNumber = builderClass.getDeclaredMethod("setRevisionNumber", Long.class);
if (INeutronBaseAttributes.class.isAssignableFrom(neutronObjectClass)) {
setName = builderClass.getDeclaredMethod("setName", String.class);
- setProjectId = builderClass.getDeclaredMethod("setProjectId", String.class);
- setRevisionNumber = builderClass.getDeclaredMethod("setRevisionNumber", Long.class);
} else {
setName = null;
- setProjectId = null;
- setRevisionNumber = null;
}
if (INeutronAdminAttributes.class.isAssignableFrom(neutronObjectClass)) {
return InstanceIdentifier.create(mdParentClass).child(mdContainerClass);
}
- protected <S1 extends INeutronBaseAttributes<S1>, M extends BaseAttributes, B extends Builder<M>>
+ protected <S1 extends INeutronObject<S1>, M extends IdAttributes, B extends Builder<M>>
+ B toMdIds(INeutronObject<S1> neutronObject, Class<B> builderClass) {
+ B builder;
+ try {
+ builder = builderClass.newInstance();
+
+ if (neutronObject.getID() != null) {
+ final Method setUuid = builderClass.getMethod("setUuid", Uuid.class);
+ setUuid.invoke(builder, toUuid(neutronObject.getID()));
+ }
+ if (neutronObject.getTenantID() != null && !neutronObject.getTenantID().isEmpty()) {
+ final Method setTenantId = builderClass.getMethod("setTenantId", Uuid.class);
+ setTenantId.invoke(builder, toUuid(neutronObject.getTenantID()));
+ }
+ if (neutronObject.getProjectID() != null) {
+ final Method setProjectId = builderClass.getMethod("setProjectId", String.class);
+ setProjectId.invoke(builder, neutronObject.getTenantID());
+ }
+ if (neutronObject.getRevisionNumber() != null) {
+ final Method setRevisionNumber = builderClass.getMethod("setRevisionNumber", Long.class);
+ setRevisionNumber.invoke(builder, neutronObject.getRevisionNumber());
+ }
+ } catch (IllegalAccessException | InstantiationException | InvocationTargetException
+ | NoSuchMethodException e) {
+ throw new IllegalArgumentException(e);
+ }
+ return builder;
+ }
+
+ protected <S1 extends INeutronObject<S1>, M extends IdAttributes, B extends Builder<M>>
void toMdIds(INeutronObject<S1> neutronObject, B builder) {
try {
if (neutronObject.getID() != null) {
if (neutronObject.getProjectID() != null) {
setProjectId.invoke(builder, neutronObject.getTenantID());
}
+ if (neutronObject.getRevisionNumber() != null) {
+ setRevisionNumber.invoke(builder, neutronObject.getRevisionNumber());
+ }
} catch (IllegalAccessException | InvocationTargetException e) {
throw new IllegalArgumentException(e);
}
}
- protected <S1 extends INeutronBaseAttributes<S1>>
- void fromMdIds(BaseAttributes baseAttributes, INeutronObject<S1> answer) {
- if (baseAttributes.getUuid() != null) {
- answer.setID(baseAttributes.getUuid().getValue());
+ protected <S1 extends INeutronObject<S1>>
+ void fromMdIds(IdAttributes idAttributes, INeutronObject<S1> answer) {
+ if (idAttributes.getUuid() != null) {
+ answer.setID(idAttributes.getUuid().getValue());
}
- if (baseAttributes.getTenantId() != null) {
- answer.setTenantID(baseAttributes.getTenantId());
+ if (idAttributes.getTenantId() != null) {
+ answer.setTenantID(idAttributes.getTenantId());
}
- if (baseAttributes.getProjectId() != null) {
- answer.setProjectID(baseAttributes.getProjectId());
+ if (idAttributes.getProjectId() != null) {
+ answer.setProjectID(idAttributes.getProjectId());
+ }
+ if (idAttributes.getRevisionNumber() != null) {
+ answer.setRevisionNumber(idAttributes.getRevisionNumber());
}
}
if (neutronObject.getName() != null) {
setName.invoke(builder, neutronObject.getName());
}
- if (neutronObject.getRevisionNumber() != null) {
- setRevisionNumber.invoke(builder, neutronObject.getRevisionNumber());
- }
} catch (IllegalAccessException | InvocationTargetException e) {
throw new IllegalArgumentException(e);
}
if (baseAttributes.getName() != null) {
answer.setName(baseAttributes.getName());
}
- if (baseAttributes.getRevisionNumber() != null) {
- answer.setRevisionNumber(baseAttributes.getRevisionNumber());
- }
}
protected <S1 extends INeutronAdminAttributes<S1>, M extends BaseAttributes & AdminAttributes, B extends Builder<M>>
@Override
protected Floatingip toMd(NeutronFloatingIp floatingIp) {
final FloatingipBuilder floatingipBuilder = new FloatingipBuilder();
+ toMdIds(floatingIp, floatingipBuilder);
if (floatingIp.getFixedIpAddress() != null) {
floatingipBuilder.setFixedIpAddress(new IpAddress(floatingIp.getFixedIpAddress().toCharArray()));
}
if (floatingIp.getStatus() != null) {
floatingipBuilder.setStatus(floatingIp.getStatus());
}
- if (floatingIp.getTenantID() != null) {
- floatingipBuilder.setTenantId(toUuid(floatingIp.getTenantID()));
- }
- if (floatingIp.getID() != null) {
- floatingipBuilder.setUuid(toUuid(floatingIp.getID()));
- } else {
- LOG.warn("Attempting to write neutron floating IP without UUID");
- }
return floatingipBuilder.build();
}
@Override
protected NeutronFloatingIp fromMd(Floatingip fip) {
final NeutronFloatingIp result = new NeutronFloatingIp();
- result.setID(fip.getUuid().getValue());
+ fromMdIds(fip, result);
if (fip.getFloatingNetworkId() != null) {
result.setFloatingNetworkUUID(String.valueOf(fip.getFloatingNetworkId().getValue()));
}
if (fip.getFloatingIpAddress() != null) {
result.setFloatingIpAddress(String.valueOf(fip.getFloatingIpAddress().getValue()));
}
- if (fip.getTenantId() != null) {
- result.setTenantID(fip.getTenantId());
- }
if (fip.getRouterId() != null) {
result.setRouterUUID(String.valueOf(fip.getRouterId().getValue()));
}
@Override
protected NeutronL2gatewayConnection fromMd(L2gatewayConnection l2gatewayConnection) {
final NeutronL2gatewayConnection result = new NeutronL2gatewayConnection();
- if (l2gatewayConnection.getUuid() != null) {
- result.setID(l2gatewayConnection.getUuid().getValue());
- }
+ fromMdBaseAttributes(l2gatewayConnection, result);
+
if (l2gatewayConnection.getL2gatewayId().getValue() != null) {
result.setL2gatewayID(String.valueOf(l2gatewayConnection.getL2gatewayId().getValue()));
}
- if (l2gatewayConnection.getTenantId() != null) {
- result.setTenantID(l2gatewayConnection.getTenantId());
- }
if (l2gatewayConnection.getNetworkId().getValue() != null) {
result.setNetworkID(String.valueOf(l2gatewayConnection.getNetworkId().getValue()));
}
@Override
protected L2gatewayConnection toMd(NeutronL2gatewayConnection neutronObject) {
final L2gatewayConnectionBuilder l2gatewayConnectionBuilder = new L2gatewayConnectionBuilder();
- if (neutronObject.getID() != null) {
- l2gatewayConnectionBuilder.setUuid(toUuid(neutronObject.getID()));
- }
+ toMdBaseAttributes(neutronObject, l2gatewayConnectionBuilder);
+
if (neutronObject.getL2gatewayID() != null) {
l2gatewayConnectionBuilder.setL2gatewayId(toUuid(neutronObject.getL2gatewayID()));
}
if (neutronObject.getSegmentID() != null) {
l2gatewayConnectionBuilder.setSegmentId((neutronObject.getSegmentID()));
}
- if (neutronObject.getTenantID() != null) {
- l2gatewayConnectionBuilder.setTenantId(toUuid(neutronObject.getTenantID()));
- }
if (neutronObject.getPortID() != null) {
l2gatewayConnectionBuilder.setPortId(toUuid(neutronObject.getPortID()));
}
@Override
protected NeutronL2gateway fromMd(L2gateway l2gateway) {
final NeutronL2gateway result = new NeutronL2gateway();
+ fromMdBaseAttributes(l2gateway, result);
final List<NeutronL2gatewayDevice> neutronL2gatewayDevices = new ArrayList<>();
- if (l2gateway.getUuid() != null) {
- result.setID(l2gateway.getUuid().getValue());
- }
- if (l2gateway.getL2gatewayName() != null) {
- result.setName(String.valueOf(l2gateway.getL2gatewayName()));
- }
- if (l2gateway.getTenantId() != null) {
- result.setTenantID(l2gateway.getTenantId());
- }
if (l2gateway.getDevices() != null) {
for (final Devices device : l2gateway.getDevices()) {
final NeutronL2gatewayDevice neutronL2gatewayDevice = new NeutronL2gatewayDevice();
@Override
protected L2gateway toMd(NeutronL2gateway neutronObject) {
final L2gatewayBuilder l2gatewayBuilder = new L2gatewayBuilder();
- if (neutronObject.getName() != null) {
- l2gatewayBuilder.setL2gatewayName(neutronObject.getName());
- }
- if (neutronObject.getID() != null) {
- l2gatewayBuilder.setUuid(toUuid(neutronObject.getID()));
- }
- if (neutronObject.getTenantID() != null) {
- l2gatewayBuilder.setTenantId(toUuid(neutronObject.getTenantID()));
- }
+ toMdBaseAttributes(neutronObject, l2gatewayBuilder);
if (neutronObject.getNeutronL2gatewayDevices() != null) {
final List<Devices> devices = new ArrayList<>();
@Override
protected Healthmonitor toMd(NeutronLoadBalancerHealthMonitor healthMonitor) {
final HealthmonitorBuilder healthmonitorBuilder = new HealthmonitorBuilder();
+ toMdIds(healthMonitor, healthmonitorBuilder);
healthmonitorBuilder.setAdminStateUp(healthMonitor.getLoadBalancerHealthMonitorAdminStateIsUp());
if (healthMonitor.getLoadBalancerHealthMonitorDelay() != null) {
healthmonitorBuilder.setDelay(Long.valueOf(healthMonitor.getLoadBalancerHealthMonitorDelay()));
}
healthmonitorBuilder.setPools(listUuid);
}
- if (healthMonitor.getTenantID() != null) {
- healthmonitorBuilder.setTenantId(toUuid(healthMonitor.getTenantID()));
- }
if (healthMonitor.getLoadBalancerHealthMonitorTimeout() != null) {
healthmonitorBuilder.setTimeout(Long.valueOf(healthMonitor.getLoadBalancerHealthMonitorTimeout()));
}
if (healthMonitor.getLoadBalancerHealthMonitorUrlPath() != null) {
healthmonitorBuilder.setUrlPath(healthMonitor.getLoadBalancerHealthMonitorUrlPath());
}
- if (healthMonitor.getID() != null) {
- healthmonitorBuilder.setUuid(toUuid(healthMonitor.getID()));
- } else {
- LOG.warn("Attempting to write neutron laod balancer health monitor without UUID");
- }
return healthmonitorBuilder.build();
}
@Override
protected NeutronLoadBalancerHealthMonitor fromMd(Healthmonitor healthMonitor) {
final NeutronLoadBalancerHealthMonitor answer = new NeutronLoadBalancerHealthMonitor();
+ fromMdIds(healthMonitor, answer);
if (healthMonitor.isAdminStateUp() != null) {
answer.setLoadBalancerHealthMonitorAdminStateIsUp(healthMonitor.isAdminStateUp());
}
}
answer.setLoadBalancerHealthMonitorPools(list);
}
- if (healthMonitor.getTenantId() != null) {
- answer.setTenantID(healthMonitor.getTenantId());
- }
if (healthMonitor.getTimeout() != null) {
answer.setLoadBalancerHealthMonitorTimeout(healthMonitor.getTimeout().intValue());
}
if (healthMonitor.getUrlPath() != null) {
answer.setLoadBalancerHealthMonitorUrlPath(healthMonitor.getUrlPath());
}
- if (healthMonitor.getUuid() != null) {
- answer.setID(healthMonitor.getUuid().getValue());
- } else {
- LOG.warn("Attempting to write neutron laod balancer health monitor without UUID");
- }
return answer;
}
}
@Override
protected Pool toMd(NeutronLoadBalancerPool pool) {
final PoolBuilder poolBuilder = new PoolBuilder();
+ toMdBaseAttributes(pool, poolBuilder);
poolBuilder.setAdminStateUp(pool.getLoadBalancerPoolAdminIsStateIsUp());
if (pool.getLoadBalancerPoolHealthMonitorID() != null) {
poolBuilder.setHealthmonitorId(toUuid(pool.getLoadBalancerPoolHealthMonitorID()));
}
// because members are another container, we don't want to copy
// it over, so just skip it here
- if (pool.getName() != null) {
- poolBuilder.setName(pool.getName());
- }
if (pool.getLoadBalancerPoolProtocol() != null) {
final ImmutableBiMap<String, Class<? extends ProtocolBase>> mapper = PROTOCOL_MAP.inverse();
poolBuilder.setProtocol(mapper.get(pool.getLoadBalancerPoolProtocol()));
sessionPersistenceBuilder.setType(sessionPersistence.getType());
poolBuilder.setSessionPersistence(sessionPersistenceBuilder.build());
}
- if (pool.getTenantID() != null) {
- poolBuilder.setTenantId(toUuid(pool.getTenantID()));
- }
- if (pool.getID() != null) {
- poolBuilder.setUuid(toUuid(pool.getID()));
- } else {
- LOG.warn("Attempting to write neutron load balancer pool without UUID");
- }
return poolBuilder.build();
}
@Override
protected NeutronLoadBalancerPool fromMd(Pool pool) {
final NeutronLoadBalancerPool answer = new NeutronLoadBalancerPool();
+ fromMdBaseAttributes(pool, answer);
if (pool.isAdminStateUp() != null) {
answer.setLoadBalancerPoolAdminStateIsUp(pool.isAdminStateUp());
}
}
answer.setLoadBalancerPoolMembers(members);
}
- if (pool.getName() != null) {
- answer.setName(pool.getName());
- }
if (pool.getProtocol() != null) {
answer.setLoadBalancerPoolProtocol(PROTOCOL_MAP.get(pool.getProtocol()));
}
answer.setLoadBalancerSessionPersistence(sessionPersistence);
}
- if (pool.getTenantId() != null) {
- answer.setTenantID(pool.getTenantId());
- }
- if (pool.getUuid() != null) {
- answer.setID(pool.getUuid().getValue());
- }
return answer;
}
.child(Members.class);
}
- static NeutronLoadBalancerPoolMember fromMemberMd(Member member) {
+ protected NeutronLoadBalancerPoolMember fromMemberMd(Member member) {
final NeutronLoadBalancerPoolMember answer = new NeutronLoadBalancerPoolMember();
+ fromMdIds(member, answer);
if (member.isAdminStateUp() != null) {
answer.setPoolMemberAdminStateIsUp(member.isAdminStateUp());
}
if (member.getProtocolPort() != null) {
answer.setPoolMemberProtoPort(member.getProtocolPort());
}
- if (member.getUuid() != null) {
- answer.setID(member.getUuid().getValue());
- answer.setPoolID(member.getUuid().getValue());
- }
if (member.getSubnetId() != null) {
answer.setPoolMemberSubnetID(member.getSubnetId().getValue());
}
- if (member.getTenantId() != null) {
- answer.setTenantID(member.getTenantId());
- }
if (member.getWeight() != null) {
answer.setPoolMemberWeight(member.getWeight());
}
}
protected Member toMemberMd(NeutronLoadBalancerPoolMember member) {
- final MemberBuilder memberBuilder = new MemberBuilder();
+ final MemberBuilder memberBuilder = toMdIds(member, MemberBuilder.class);
memberBuilder.setAdminStateUp(member.getPoolMemberAdminStateIsUp());
if (member.getPoolMemberAddress() != null) {
final IpAddress ipAddress = new IpAddress(member.getPoolMemberAddress().toCharArray());
if (member.getPoolMemberProtoPort() != null) {
memberBuilder.setProtocolPort(member.getPoolMemberProtoPort());
}
- if (member.getID() != null) {
- memberBuilder.setUuid(toUuid(member.getID()));
- }
if (member.getPoolMemberSubnetID() != null) {
memberBuilder.setSubnetId(toUuid(member.getPoolMemberSubnetID()));
}
- if (member.getTenantID() != null) {
- memberBuilder.setTenantId(toUuid(member.getTenantID()));
- }
if (member.getPoolMemberWeight() != null) {
memberBuilder.setWeight(member.getPoolMemberWeight());
}
@Override
protected MeteringRule toMd(NeutronMeteringLabelRule meteringLabelRule) {
final MeteringRuleBuilder meteringRuleBuilder = new MeteringRuleBuilder();
- if (meteringLabelRule.getID() != null) {
- meteringRuleBuilder.setUuid(toUuid(meteringLabelRule.getID()));
- }
- if (meteringLabelRule.getTenantID() != null) {
- meteringRuleBuilder.setTenantId(toUuid(meteringLabelRule.getTenantID()));
- }
+ toMdIds(meteringLabelRule, meteringRuleBuilder);
if (meteringLabelRule.getMeteringLabelRuleLabelID() != null) {
meteringRuleBuilder.setMeteringLabelId(toUuid(meteringLabelRule.getMeteringLabelRuleLabelID()));
}
@Override
protected NeutronMeteringLabelRule fromMd(MeteringRule rule) {
final NeutronMeteringLabelRule answer = new NeutronMeteringLabelRule();
- if (rule.getUuid() != null) {
- answer.setID(rule.getUuid().getValue());
- }
- if (rule.getTenantId() != null) {
- answer.setTenantID(rule.getTenantId());
- }
+ fromMdIds(rule, answer);
if (rule.getMeteringLabelId() != null) {
answer.setMeteringLabelRuleLabelID(rule.getMeteringLabelId().getValue());
}
if (qosPolicy.getBandwidthLimitRules() != null) {
final List<BandwidthLimitRules> listBandwith = new ArrayList<>();
for (final NeutronQosBandwidthLimitRule bandwidthLimitRule : qosPolicy.getBandwidthLimitRules()) {
- final BandwidthLimitRulesBuilder bandwidthLimitRulesBuilder = new BandwidthLimitRulesBuilder();
- bandwidthLimitRulesBuilder.setUuid(toUuid(bandwidthLimitRule.getID()));
- bandwidthLimitRulesBuilder.setTenantId(toUuid(bandwidthLimitRule.getTenantID()));
+ final BandwidthLimitRulesBuilder bandwidthLimitRulesBuilder =
+ toMdIds(bandwidthLimitRule, BandwidthLimitRulesBuilder.class);
bandwidthLimitRulesBuilder.setMaxKbps(bandwidthLimitRule.getMaxKbps());
bandwidthLimitRulesBuilder.setMaxBurstKbps(bandwidthLimitRule.getMaxBurstKbps());
listBandwith.add(bandwidthLimitRulesBuilder.build());
}
qosPolicyBuilder.setBandwidthLimitRules(listBandwith);
}
+
if (qosPolicy.getDscpMarkingRules() != null) {
final List<DscpmarkingRules> listDscpMarking = new ArrayList<>();
for (final NeutronQosDscpMarkingRule dscpMarkingRule : qosPolicy.getDscpMarkingRules()) {
- final DscpmarkingRulesBuilder dscpmarkingRulesBuilder = new DscpmarkingRulesBuilder();
- dscpmarkingRulesBuilder.setUuid(toUuid(dscpMarkingRule.getID()));
- dscpmarkingRulesBuilder.setTenantId(toUuid(dscpMarkingRule.getTenantID()));
+ final DscpmarkingRulesBuilder dscpmarkingRulesBuilder =
+ toMdIds(dscpMarkingRule, DscpmarkingRulesBuilder.class);
dscpmarkingRulesBuilder.setDscpMark(dscpMarkingRule.getDscpMark());
listDscpMarking.add(dscpmarkingRulesBuilder.build());
}
final List<NeutronQosBandwidthLimitRule> bandwidthLimitRules = new ArrayList<>();
for (final BandwidthLimitRules rule : qosPolicy.getBandwidthLimitRules()) {
NeutronQosBandwidthLimitRule opt = new NeutronQosBandwidthLimitRule();
- opt.setID(rule.getUuid().getValue());
- opt.setTenantID(rule.getTenantId().getValue());
opt.setMaxKbps(rule.getMaxKbps());
opt.setMaxBurstKbps(rule.getMaxBurstKbps());
bandwidthLimitRules.add(opt);
final List<NeutronQosDscpMarkingRule> dscpMarkingRules = new ArrayList<>();
for (final DscpmarkingRules rule : qosPolicy.getDscpmarkingRules()) {
NeutronQosDscpMarkingRule opt = new NeutronQosDscpMarkingRule();
- opt.setID(rule.getUuid().getValue());
- opt.setTenantID(rule.getTenantId().getValue());
opt.setDscpMark(rule.getDscpMark());
dscpMarkingRules.add(opt);
}
@Override
protected NeutronSecurityRule fromMd(SecurityRule rule) {
final NeutronSecurityRule answer = new NeutronSecurityRule();
- if (rule.getTenantId() != null) {
- answer.setTenantID(rule.getTenantId());
- }
+ fromMdIds(rule, answer);
if (rule.getDirection() != null) {
answer.setSecurityRuleDirection(DIRECTION_MAP.get(rule.getDirection()));
}
if (rule.getPortRangeMax() != null) {
answer.setSecurityRulePortMax(Integer.valueOf(rule.getPortRangeMax()));
}
- if (rule.getUuid() != null) {
- answer.setID(rule.getUuid().getValue());
- }
return answer;
}
@Override
protected SecurityRule toMd(NeutronSecurityRule securityRule) {
final SecurityRuleBuilder securityRuleBuilder = new SecurityRuleBuilder();
-
- if (securityRule.getTenantID() != null) {
- securityRuleBuilder.setTenantId(toUuid(securityRule.getTenantID()));
- }
+ toMdIds(securityRule, securityRuleBuilder);
if (securityRule.getSecurityRuleDirection() != null) {
final ImmutableBiMap<String, Class<? extends DirectionBase>> mapper = DIRECTION_MAP.inverse();
securityRuleBuilder
if (securityRule.getSecurityRulePortMax() != null) {
securityRuleBuilder.setPortRangeMax(Integer.valueOf(securityRule.getSecurityRulePortMax()));
}
- if (securityRule.getID() != null) {
- securityRuleBuilder.setUuid(toUuid(securityRule.getID()));
- } else {
- LOG.warn("Attempting to write neutron securityRule without UUID");
- }
return securityRuleBuilder.build();
}
}