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.genius.interfacemanager.rev160406.IfL2vlan;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.SplitHorizon;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.SplitHorizonBuilder;
// in order to validate the supported vnic types from the hostconfig
if (input.getFixedIps() != null
&& !input.getFixedIps().isEmpty()
- && !(isPortTypeSwitchdev(input) && !isPortBound(input))) {
+ && (!isPortTypeSwitchdev(input) || isPortBound(input))) {
handleNeutronPortCreated(input);
}
NeutronUtils.createPortStatus(input.getUuid().getValue(), portStatus, dataBroker);
handleFloatingIpPortUpdated(original, update);
}
} else {
- Set<FixedIps> oldIPs = getFixedIpSet(new ArrayList<FixedIps>(original.nonnullFixedIps().values()));
- Set<FixedIps> newIPs = getFixedIpSet(new ArrayList<FixedIps>(update.nonnullFixedIps().values()));
+ Set<FixedIps> oldIPs = getFixedIpSet(new ArrayList<>(original.nonnullFixedIps().values()));
+ Set<FixedIps> newIPs = getFixedIpSet(new ArrayList<>(update.nonnullFixedIps().values()));
if (!oldIPs.equals(newIPs)) {
handleNeutronPortUpdated(original, update);
}
if (origSecurityEnabled || updatedSecurityEnabled) {
InterfaceAcl infAcl = handlePortSecurityUpdated(original, update, origSecurityEnabled,
updatedSecurityEnabled, interfaceBuilder).build();
- interfaceBuilder.addAugmentation(InterfaceAcl.class, infAcl);
+ interfaceBuilder.addAugmentation(infAcl);
} else if (isDhcpServerPort) {
Set<FixedIps> oldIPs = getFixedIpSet(
- new ArrayList<FixedIps>(original.nonnullFixedIps().values()));
+ new ArrayList<>(original.nonnullFixedIps().values()));
Set<FixedIps> newIPs = getFixedIpSet(
- new ArrayList<FixedIps>(update.nonnullFixedIps().values()));
+ new ArrayList<>(update.nonnullFixedIps().values()));
if (!oldIPs.equals(newIPs)) {
InterfaceAcl infAcl = neutronvpnUtils.getDhcpInterfaceAcl(update);
- interfaceBuilder.addAugmentation(InterfaceAcl.class, infAcl);
+ interfaceBuilder.addAugmentation(infAcl);
}
}
LOG.info("update: Of-port-interface updation for port {}", portName);
// populate floating-ip uuid and floating-ip port attributes (uuid, mac and subnet id for the ONLY
// fixed IP) to be used by NAT, depopulated in NATService once mac is retrieved in the removal path
addToFloatingIpPortInfo(new Uuid(update.getDeviceId()), update.getUuid(),
- new ArrayList<FixedIps>(update.nonnullFixedIps().values()).get(0)
+ new ArrayList<>(update.nonnullFixedIps().values()).get(0)
.getSubnetId(), update.getMacAddress().getValue());
elanService.addKnownL3DmacAddress(update.getMacAddress().getValue(), update.getNetworkId().getValue());
}
if (NeutronConstants.IS_ODL_DHCP_PORT.test(port)) {
return;
}
- if (!(NeutronUtils.isPortVnicTypeNormal(port)
- || isPortTypeSwitchdev(port)
- && isSupportedVnicTypeByHost(port, NeutronConstants.VNIC_TYPE_DIRECT))) {
+ if (!NeutronUtils.isPortVnicTypeNormal(port)
+ && (!isPortTypeSwitchdev(port) || !isSupportedVnicTypeByHost(port, NeutronConstants.VNIC_TYPE_DIRECT))) {
for (FixedIps ip: keyFixedIpsMap.values()) {
nvpnManager.updateSubnetmapNodeWithPorts(ip.getSubnetId(), null, portId);
}
final String portName = port.getUuid().getValue();
final Uuid portId = port.getUuid();
final Map<FixedIpsKey, FixedIps> keyFixedIpsMap = port.nonnullFixedIps();
- if (!(NeutronUtils.isPortVnicTypeNormal(port) || isPortTypeSwitchdev(port))) {
+ if (!NeutronUtils.isPortVnicTypeNormal(port) && !isPortTypeSwitchdev(port)) {
for (FixedIps ip : keyFixedIpsMap.values()) {
// remove direct port from subnetMaps config DS
// TODO: for direct port as well, operations should be carried out per subnet based on port IP
NeutronvpnUtils.getUpdatedSecurityGroups(interfaceAcl.getSecurityGroups(),
portOriginal.getSecurityGroups(), portUpdated.getSecurityGroups()));
List<AllowedAddressPairs> updatedAddressPairs = NeutronvpnUtils.getUpdatedAllowedAddressPairs(
- new ArrayList<AllowedAddressPairs>(interfaceAcl.nonnullAllowedAddressPairs().values()),
+ new ArrayList<>(interfaceAcl.nonnullAllowedAddressPairs().values()),
new ArrayList<>(portOriginal.nonnullAllowedAddressPairs().values()),
- new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port
- .attributes.AllowedAddressPairs>(portUpdated.nonnullAllowedAddressPairs().values()));
+ new ArrayList<>(portUpdated.nonnullAllowedAddressPairs().values()));
interfaceAclBuilder.setAllowedAddressPairs(NeutronvpnUtils.getAllowedAddressPairsForFixedIps(
updatedAddressPairs, portOriginal.getMacAddress(), portOriginal.getFixedIps(),
portUpdated.nonnullFixedIps().values()));
ifL2vlanBuilder.setVlanId(new VlanId(portIdToSubport.getVlanId().intValue()));
String parentRefName = portIdToSubport.getTrunkPortId().getValue();
ParentRefsBuilder parentRefsBuilder = new ParentRefsBuilder().setParentInterface(parentRefName);
- interfaceBuilder.addAugmentation(ParentRefs.class, parentRefsBuilder.build());
+ interfaceBuilder.addAugmentation(parentRefsBuilder.build());
SplitHorizon splitHorizon =
new SplitHorizonBuilder().setOverrideSplitHorizonProtection(true).build();
- interfaceBuilder.addAugmentation(SplitHorizon.class, splitHorizon);
+ interfaceBuilder.addAugmentation(splitHorizon);
}
}
ifL2vlanBuilder.setL2vlanMode(l2VlanMode);
interfaceBuilder.setEnabled(true).setName(interfaceName).setType(L2vlan.class)
- .addAugmentation(IfL2vlan.class, ifL2vlanBuilder.build());
+ .addAugmentation(ifL2vlanBuilder.build());
if (NeutronvpnUtils.getPortSecurityEnabled(port)) {
InterfaceAclBuilder interfaceAclBuilder = new InterfaceAclBuilder();
interfaceAclBuilder.setPortSecurityEnabled(true);
neutronvpnUtils.populateInterfaceAclBuilder(interfaceAclBuilder, port);
- interfaceBuilder.addAugmentation(InterfaceAcl.class, interfaceAclBuilder.build());
+ interfaceBuilder.addAugmentation(interfaceAclBuilder.build());
} else if (neutronvpnConfig.isLimitBumtrafficToDhcpserver() && NeutronvpnUtils.isDhcpServerPort(port)) {
- interfaceBuilder.addAugmentation(InterfaceAcl.class, neutronvpnUtils.getDhcpInterfaceAcl(port));
+ interfaceBuilder.addAugmentation(neutronvpnUtils.getDhcpInterfaceAcl(port));
}
return interfaceBuilder.build();
}