import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
public class OvsdbRow {
+ private static final Logger LOG = LoggerFactory.getLogger(OvsdbRow.class);
private static final String PARENTUUID = "parent_uuid";
private static final String PARENTTABLE = "parent_table";
private static final String PARENTCOLUMN = "parent_column";
if (rowNode == null) {
return null;
}
- for(Iterator<String> fieldNames = rowNode.fieldNames(); fieldNames.hasNext();) {
+ Iterator<String> fieldNames = rowNode.fieldNames();
+ if (fieldNames.hasNext()) {
String tableName = fieldNames.next();
- Row<GenericTableSchema> row = null;
try {
- row = getRow(client, dbName, tableName, rowNode.get(tableName));
+ Row<GenericTableSchema> row = getRow(client, dbName, tableName, rowNode.get(tableName));
+ return new OvsdbRow(parentTable, parentUuid, parentColumn, tableName, row);
} catch (InterruptedException | ExecutionException | IOException e) {
- e.printStackTrace();
+ LOG.error("Error retrieving the row for {}", tableName, e);
return null;
}
- return new OvsdbRow(parentTable, parentUuid, parentColumn, tableName, row);
}
return null;
}
- public static Row<GenericTableSchema> getRow(OvsdbClient client, String dbName, String tableName, JsonNode rowJson) throws InterruptedException, ExecutionException, JsonParseException, IOException {
+ public static Row<GenericTableSchema> getRow(OvsdbClient client, String dbName, String tableName, JsonNode rowJson) throws InterruptedException, ExecutionException, IOException {
DatabaseSchema dbSchema = client.getSchema(dbName).get();
GenericTableSchema schema = dbSchema.table(tableName, GenericTableSchema.class);
return schema.createRow((ObjectNode)rowJson);
}
}
LOG.debug("createOutputGroupInstructions: addNew {}", addNew);
- if (addNew) {
+ if (addNew && !buckets.getBucket().isEmpty()) {
/* the new output action is not in the bucket, add to bucket */
- if (!buckets.getBucket().isEmpty()) {
- Bucket bucket = buckets.getBucket().get(0);
- List<Action> bucketActionList = Lists.newArrayList();
- bucketActionList.addAll(bucket.getAction());
- /* set order for new action and add to action list */
- ab.setOrder(bucketActionList.size());
- ab.setKey(new ActionKey(bucketActionList.size()));
- bucketActionList.add(ab.build());
-
- /* set bucket and buckets list. Reset groupBuilder with new buckets.*/
- BucketsBuilder bucketsBuilder = new BucketsBuilder();
- List<Bucket> bucketList = Lists.newArrayList();
- BucketBuilder bucketBuilder = new BucketBuilder();
- bucketBuilder.setBucketId(new BucketId((long) 1));
- bucketBuilder.setKey(new BucketKey(new BucketId((long) 1)));
- bucketBuilder.setAction(bucketActionList);
- bucketList.add(bucketBuilder.build());
- bucketsBuilder.setBucket(bucketList);
- groupBuilder.setBuckets(bucketsBuilder.build());
- LOG.debug("createOutputGroupInstructions: bucketList {}", bucketList);
- }
+ Bucket bucket = buckets.getBucket().get(0);
+ List<Action> bucketActionList = Lists.newArrayList();
+ bucketActionList.addAll(bucket.getAction());
+ /* set order for new action and add to action list */
+ ab.setOrder(bucketActionList.size());
+ ab.setKey(new ActionKey(bucketActionList.size()));
+ bucketActionList.add(ab.build());
+
+ /* set bucket and buckets list. Reset groupBuilder with new buckets.*/
+ BucketsBuilder bucketsBuilder = new BucketsBuilder();
+ List<Bucket> bucketList = Lists.newArrayList();
+ BucketBuilder bucketBuilder = new BucketBuilder();
+ bucketBuilder.setBucketId(new BucketId((long) 1));
+ bucketBuilder.setKey(new BucketKey(new BucketId((long) 1)));
+ bucketBuilder.setAction(bucketActionList);
+ bucketList.add(bucketBuilder.build());
+ bucketsBuilder.setBucket(bucketList);
+ groupBuilder.setBuckets(bucketsBuilder.build());
+ LOG.debug("createOutputGroupInstructions: bucketList {}", bucketList);
}
} else {
/* create group */
return serviceRegistry.get(service);
}
- public void start() {
+ public final void start() {
eventHandler.submit(new Runnable() {
@Override
public void run() {
LOG.info(">>>>> dequeue: {}", node);
for (Service service : staticPipeline) {
AbstractServiceInstance serviceInstance = getServiceInstance(service);
- //LOG.info("pipeline: {} - {}", service, serviceInstance);
- if (serviceInstance != null) {
- if (southbound.getBridge(node) != null) {
- serviceInstance.programDefaultPipelineRule(node);
- }
+ if (serviceInstance != null && southbound.getBridge(node) != null) {
+ serviceInstance.programDefaultPipelineRule(node);
}
}
}
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nullable;
-
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.ovsdb.openstack.netvirt.api.GatewayMacResolver;
import org.opendaylight.ovsdb.openstack.netvirt.providers.NetvirtProvidersProvider;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractServiceInstance;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
private SalFlowService flowService;
private final AtomicLong flowCookie = new AtomicLong();
private final ConcurrentMap<Ipv4Address, ArpResolverMetadata> gatewayToArpMetadataMap =
- new ConcurrentHashMap<Ipv4Address, ArpResolverMetadata>();
- private final int ARP_WATCH_BROTHERS = 10;
- private final int WAIT_CYCLES = 3;
- private final int PER_CYCLE_WAIT_DURATION = 1000;
- private final int REFRESH_INTERVAL = 10;
+ new ConcurrentHashMap<>();
+ private static final int ARP_WATCH_BROTHERS = 10;
+ private static final int WAIT_CYCLES = 3;
+ private static final int PER_CYCLE_WAIT_DURATION = 1000;
+ private static final int REFRESH_INTERVAL = 10;
private final ListeningExecutorService arpWatcherWall = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(ARP_WATCH_BROTHERS));
private final ScheduledExecutorService gatewayMacRefresherPool = Executors.newScheduledThreadPool(1);
private final ScheduledExecutorService refreshRequester = Executors.newSingleThreadScheduledExecutor();
* @param sourceMacAddress Source Mac address for the ARP request packet
* @param periodicRefresh Enable/Disable periodic refresh of the Gateway Mac address
* NOTE:Periodic refresh is not supported yet.
- * @param gatewayIp Resolve MAC address of this Gateway Ip
* @return Future object
*/
@Override
});
}
- private static @Nullable Ipv4Address getIPv4Addresses(IpAddress ipAddress) {
- if (ipAddress.getIpv4Address() == null) {
- return null;
- }
- return ipAddress.getIpv4Address();
- }
-
private Flow createArpReplyToControllerFlow(final ArpMessageAddress senderAddress, final Ipv4Address ipForRequestedMac) {
checkNotNull(senderAddress);
checkNotNull(ipForRequestedMac);
arpFlow.setMatch(match);
arpFlow.setInstructions(new InstructionsBuilder().setInstruction(
ImmutableList.of(SEND_TO_CONTROLLER_INSTRUCTION)).build());
- arpFlow.setId(createFlowId(senderAddress, ipForRequestedMac));
+ arpFlow.setId(createFlowId(ipForRequestedMac));
return arpFlow.build();
}
- private FlowId createFlowId(ArpMessageAddress senderAddress, Ipv4Address ipForRequestedMac) {
+ private FlowId createFlowId(Ipv4Address ipForRequestedMac) {
String flowId = ARP_REPLY_TO_CONTROLLER_FLOW_NAME + "|" + ipForRequestedMac.getValue();
return new FlowId(flowId);
}
private void processPortUpdate(Node node, OvsdbTerminationPointAugmentation port) {
LOG.debug("processPortUpdate <{}> <{}>", node, port);
NeutronNetwork network = tenantNetworkManager.getTenantNetwork(port);
- if (network != null ){
- if(!network.getRouterExternal()){
- this.handleInterfaceUpdate(node, port);
- }
+ if (network != null && !network.getRouterExternal()) {
+ this.handleInterfaceUpdate(node, port);
}
}
import org.opendaylight.neutron.spi.NeutronNetwork;
import org.opendaylight.ovsdb.openstack.netvirt.ConfigInterface;
-import org.opendaylight.ovsdb.openstack.netvirt.MdsalHelper;
import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
Preconditions.checkNotNull(portNameExt);
if (southbound.isBridgeOnOvsdbNode(ovsdbNode, brExt)) {
- //this would look better if used a method like isNetworkPatchCreated()
- if (isPortOnBridge(bridgeNode, portNameInt)) {
- Node extBridgeNode = southbound.readBridgeNode(ovsdbNode, brExt);
- if (isPortOnBridge(extBridgeNode, portNameExt)) {
- ready = true;
- } else {
- LOG.trace("isNodeL3Ready: node: {}, {} missing",
- bridgeNode, portNameExt);
- }
- } else {
- LOG.trace("isNodeL3Ready: node: {}, {} missing",
- bridgeNode, portNameInt);
- }
+ ready = isNetworkPatchCreated(bridgeNode, southbound.readBridgeNode(ovsdbNode, brExt));
} else {
LOG.trace("isNodeL3Ready: node: {}, {} missing",
bridgeNode, brExt);
/**
* Returns true if a patch port exists between the Integration Bridge and Network Bridge
*/
- private boolean isNetworkPatchCreated(Node node, Node intBridge, Node netBridge) {
+ private boolean isNetworkPatchCreated(Node intBridge, Node netBridge) {
Preconditions.checkNotNull(configurationService);
boolean isPatchCreated = false;
/**
* Creates the Integration Bridge
*/
- private boolean createIntegrationBridge(Node ovsdbNode) throws Exception {
+ private boolean createIntegrationBridge(Node ovsdbNode) {
Preconditions.checkNotNull(configurationService);
if (!addBridge(ovsdbNode, configurationService.getIntegrationBridgeName())) {
return true;
}
- private boolean createExternalBridge(Node ovsdbNode) throws Exception {
+ private boolean createExternalBridge(Node ovsdbNode) {
Preconditions.checkNotNull(configurationService);
if (!addBridge(ovsdbNode, configurationService.getExternalBridgeName())) {
Interface br-int
type: internal
*/
- private boolean createBridges(Node bridgeNode, Node ovsdbNode, NeutronNetwork network) throws Exception {
+ private boolean createBridges(Node bridgeNode, Node ovsdbNode, NeutronNetwork network) {
Preconditions.checkNotNull(configurationService);
Preconditions.checkNotNull(networkingProviderManager);
/**
* Add a Port to a Bridge
*/
- private boolean addPortToBridge (Node node, String bridgeName, String portName) throws Exception {
+ private boolean addPortToBridge (Node node, String bridgeName, String portName) {
boolean rv = true;
if (southbound.extractTerminationPointAugmentation(node, portName) == null) {
/**
* Add a Patch Port to a Bridge
*/
- private boolean addPatchPort (Node node, String bridgeName, String portName, String peerPortName) throws Exception {
+ private boolean addPatchPort (Node node, String bridgeName, String portName, String peerPortName) {
boolean rv = true;
if (southbound.extractTerminationPointAugmentation(node, portName) == null) {
/**
* Add Bridge to a Node
*/
- private boolean addBridge(Node ovsdbNode, String bridgeName) throws Exception {
+ private boolean addBridge(Node ovsdbNode, String bridgeName) {
boolean rv = true;
if ((!southbound.isBridgeOnOvsdbNode(ovsdbNode, bridgeName)) ||
(southbound.getBridgeFromConfig(ovsdbNode, bridgeName) == null)) {
}
private String getControllerIPAddress() {
- InetAddress controllerIP = null;
-
String addressString = ConfigProperties.getProperty(this.getClass(), "ovsdb.controller.address");
if (addressString != null) {
try {
- controllerIP = InetAddress.getByName(addressString);
- if (controllerIP != null) {
+ if (InetAddress.getByName(addressString) != null) {
return addressString;
}
} catch (UnknownHostException e) {
addressString = ConfigProperties.getProperty(this.getClass(), "of.address");
if (addressString != null) {
try {
- controllerIP = InetAddress.getByName(addressString);
- if (controllerIP != null) {
+ if (InetAddress.getByName(addressString) != null) {
return addressString;
}
} catch (UnknownHostException e) {
private volatile GatewayMacResolver gatewayMacResolver;
private class FloatIpData {
- private final Long dpid; // br-int of node where floating ip is associated with tenant port
- private final Long ofPort; // patch port in br-int used to reach br-ex
- private final String segId; // segmentation id of the net where fixed ip is instantiated
- private final String macAddress; // mac address assigned to neutron port of floating ip
+ // br-int of node where floating ip is associated with tenant port
+ private final Long dpid;
+ // patch port in br-int used to reach br-ex
+ private final Long ofPort;
+ // segmentation id of the net where fixed ip is instantiated
+ private final String segId;
+ // mac address assigned to neutron port of floating ip
+ private final String macAddress;
private final String floatingIpAddress;
- private final String fixedIpAddress; // ip address given to tenant vm
+ // ip address given to tenant vm
+ private final String fixedIpAddress;
private final String neutronRouterMac;
FloatIpData(final Long dpid, final Long ofPort, final String segId, final String macAddress,
}else{
NeutronNetwork externalNetwork = neutronNetworkCache.getNetwork(neutronPort.getNetworkUUID());
- if(externalNetwork != null){
- if(externalNetwork.isRouterExternal()){
- final NeutronSubnet externalSubnet = getExternalNetworkSubnet(neutronPort);
- // TODO support IPv6
- if (externalSubnet != null &&
+ if (externalNetwork != null && externalNetwork.isRouterExternal()) {
+ final NeutronSubnet externalSubnet = getExternalNetworkSubnet(neutronPort);
+ // TODO support IPv6
+ if (externalSubnet != null &&
externalSubnet.getIpVersion() == 4) {
- gatewayMacResolver.stopPeriodicRefresh(new Ipv4Address(externalSubnet.getGatewayIP()));
- }
+ gatewayMacResolver.stopPeriodicRefresh(new Ipv4Address(externalSubnet.getGatewayIP()));
}
}
}
for (Neutron_IPs neutronIP : neutronPort.getFixedIPs()) {
NeutronRouter_Interface neutronRouterInterface =
new NeutronRouter_Interface(neutronIP.getSubnetUUID(), neutronPort.getPortUUID());
- neutronRouterInterface.setID(neutronIP.getSubnetUUID()); // id of router interface to be same as subnet
+ // id of router interface to be same as subnet
+ neutronRouterInterface.setID(neutronIP.getSubnetUUID());
neutronRouterInterface.setTenantID(neutronPort.getTenantID());
this.handleNeutronRouterInterfaceEvent(null /*neutronRouter*/, neutronRouterInterface, action);
// need to do this check here because a router interface is not added to a node until tenant becomes needed
// there.
//
- if (!isDelete) {
- if (neutronPort.getFixedIPs() != null) {
- for (Neutron_IPs neutronIP : neutronPort.getFixedIPs()) {
- NeutronRouter_Interface neutronRouterInterface =
+ if (!isDelete && neutronPort.getFixedIPs() != null) {
+ for (Neutron_IPs neutronIP : neutronPort.getFixedIPs()) {
+ NeutronRouter_Interface neutronRouterInterface =
subnetIdToRouterInterfaceCache.get(neutronIP.getSubnetUUID());
- if (neutronRouterInterface != null) {
- this.handleNeutronRouterInterfaceEvent(null /*neutronRouter*/, neutronRouterInterface, action);
- }
+ if (neutronRouterInterface != null) {
+ this.handleNeutronRouterInterfaceEvent(null /*neutronRouter*/, neutronRouterInterface, action);
}
}
}
// this.programFlowsForFloatingIP(neutronFloatingIP, action == Action.DELETE);
if (action != Action.DELETE) {
- programFlowsForFloatingIPArpAdd(neutronFloatingIP); // must be first, as it updates floatIpDataMapCache
+ // must be first, as it updates floatIpDataMapCache
+ programFlowsForFloatingIPArpAdd(neutronFloatingIP);
programFlowsForFloatingIPInbound(neutronFloatingIP, Action.ADD);
programFlowsForFloatingIPOutbound(neutronFloatingIP, Action.ADD);
programFlowsForFloatingIPOutbound(neutronFloatingIP, Action.DELETE);
programFlowsForFloatingIPInbound(neutronFloatingIP, Action.DELETE);
- programFlowsForFloatingIPArpDelete(neutronFloatingIP.getID()); // must be last, as it updates floatIpDataMapCache
+ // must be last, as it updates floatIpDataMapCache
+ programFlowsForFloatingIPArpDelete(neutronFloatingIP.getID());
}
}
// will look at desired action for node.
final String cacheKey = node.getNodeId().getValue() + ":" + providerSegmentationId + ":" + ipStr;
- final Boolean isProgrammed = l3ForwardingCache.contains(cacheKey);
+ final boolean isProgrammed = l3ForwardingCache.contains(cacheKey);
- if (actionForNode == Action.DELETE && isProgrammed == Boolean.FALSE) {
+ if (actionForNode == Action.DELETE && !isProgrammed) {
LOG.trace("programL3ForwardingStage1 for node {} providerId {} mac {} ip {} action {} is already done",
node.getNodeId().getValue(), providerSegmentationId, macAddress, ipStr, actionForNode);
return;
}
- if (actionForNode == Action.ADD && isProgrammed == Boolean.TRUE) {
+ if (actionForNode == Action.ADD && isProgrammed) {
LOG.trace("programL3ForwardingStage1 for node {} providerId {} mac {} ip {} action {} is already done",
node.getNodeId().getValue(), providerSegmentationId, macAddress, ipStr, actionForNode);
return;
final String cacheKey = node.getNodeId().getValue() + ":" +
sourceSegmentationId + ":" + destinationSegmentationId + ":" +
ipStr + "/" + Integer.toString(mask);
- final Boolean isProgrammed = routerInterfacesCache.contains(cacheKey);
+ final boolean isProgrammed = routerInterfacesCache.contains(cacheKey);
- if (actionForNode == Action.DELETE && isProgrammed == Boolean.FALSE) {
+ if (actionForNode == Action.DELETE && !isProgrammed) {
LOG.trace("programRouterInterfaceStage1 for node {} sourceSegId {} destSegId {} mac {} ip {} mask {}" +
" action {} is already done",
node.getNodeId().getValue(), sourceSegmentationId, destinationSegmentationId,
macAddress, ipStr, mask, actionForNode);
return;
}
- if (actionForNode == Action.ADD && isProgrammed == Boolean.TRUE) {
+ if (actionForNode == Action.ADD && isProgrammed) {
LOG.trace("programRouterInterfaceStage1 for node {} sourceSegId {} destSegId {} mac {} ip {} mask {}" +
" action {} is already done",
node.getNodeId().getValue(), sourceSegmentationId, destinationSegmentationId,
// will look at desired action for node.
//
final String cacheKey = dpid + ":" + segOrOfPort + ":" + ipStr;
- final Boolean isProgrammed = staticArpEntryCache.contains(cacheKey);
+ final boolean isProgrammed = staticArpEntryCache.contains(cacheKey);
- if (action == Action.DELETE && isProgrammed == Boolean.FALSE) {
+ if (action == Action.DELETE && !isProgrammed) {
LOG.trace("programStaticArpStage1 dpid {} segOrOfPort {} mac {} ip {} action {} is already done",
dpid, segOrOfPort, macAddress, ipStr, action);
return true;
}
- if (action == Action.ADD && isProgrammed == Boolean.TRUE) {
+ if (action == Action.ADD && isProgrammed) {
LOG.trace("programStaticArpStage1 dpid {} segOrOfPort {} mac {} ip {} action {} is already done",
dpid, segOrOfPort, macAddress, ipStr, action);
return true;
// will look at desired action for node.
//
final String cacheKey = dpid + ":" + inboundOFPort + ":" + providerSegmentationId + ":" + matchAddress;
- final Boolean isProgrammed = inboundIpRewriteCache.contains(cacheKey);
+ final boolean isProgrammed = inboundIpRewriteCache.contains(cacheKey);
- if (action == Action.DELETE && isProgrammed == Boolean.FALSE) {
+ if (action == Action.DELETE && !isProgrammed) {
LOG.trace("programInboundIpRewriteStage1 dpid {} OFPort {} seg {} matchAddress {} rewriteAddress {}" +
" action {} is already done",
dpid, inboundOFPort, providerSegmentationId, matchAddress, rewriteAddress, action);
return true;
}
- if (action == Action.ADD && isProgrammed == Boolean.TRUE) {
+ if (action == Action.ADD && isProgrammed) {
LOG.trace("programInboundIpRewriteStage1 dpid {} OFPort {} seg {} matchAddress {} rewriteAddress {}" +
" action is already done",
dpid, inboundOFPort, providerSegmentationId, matchAddress, rewriteAddress, action);
// will look at desired action for node.
//
final String cacheKey = node.getNodeId().getValue() + ":" + providerSegmentationId + ":" + cidr;
- final Boolean isProgrammed = outboundIpRewriteExclusionCache.contains(cacheKey);
+ final boolean isProgrammed = outboundIpRewriteExclusionCache.contains(cacheKey);
- if (actionForRewriteExclusion == Action.DELETE && isProgrammed == Boolean.FALSE) {
+ if (actionForRewriteExclusion == Action.DELETE && !isProgrammed) {
LOG.trace("programIpRewriteExclusionStage1 node {} providerId {} cidr {} action {} is already done",
node.getNodeId().getValue(), providerSegmentationId, cidr, actionForRewriteExclusion);
return;
}
- if (actionForRewriteExclusion == Action.ADD && isProgrammed == Boolean.TRUE) {
+ if (actionForRewriteExclusion == Action.ADD && isProgrammed) {
LOG.trace("programIpRewriteExclusionStage1 node {} providerId {} cidr {} action {} is already done",
node.getNodeId().getValue(), providerSegmentationId, cidr, actionForRewriteExclusion);
return;
// will look at desired action for node.
//
final String cacheKey = fid.dpid + ":" + fid.segId + ":" + fid.fixedIpAddress;
- final Boolean isProgrammed = outboundIpRewriteCache.contains(cacheKey);
+ final boolean isProgrammed = outboundIpRewriteCache.contains(cacheKey);
- if (action == Action.DELETE && isProgrammed == Boolean.FALSE) {
+ if (action == Action.DELETE && !isProgrammed) {
LOG.trace("programOutboundIpRewriteStage1 dpid {} seg {} fixedIpAddress {} floatIp {} action {} " +
"is already done",
fid.dpid, fid.segId, fid.fixedIpAddress, fid.floatingIpAddress, action);
return;
}
- if (action == Action.ADD && isProgrammed == Boolean.TRUE) {
+ if (action == Action.ADD && isProgrammed) {
LOG.trace("programOutboundIpRewriteStage1 dpid {} seg {} fixedIpAddress {} floatIp {} action {} " +
"is already done",
fid.dpid, fid.segId, fid.fixedIpAddress, fid.floatingIpAddress, action);
Constants.EXTERNAL_ID_INTERFACE_ID);
if (null != portId) {
NeutronPort port = neutronPortCache.getPort(portId);
- if (null != port) {
- if (!(port.getID().equals(neutronPort.getID()))
- && port.getDeviceOwner().contains("compute")) {
- List<Neutron_IPs> portFixedIp = port.getFixedIPs();
- if (null == portFixedIp || portFixedIp.isEmpty()) {
- return false;
- }
- if (portFixedIp.iterator().next().getSubnetUUID()
- .equals(neutronPort.getFixedIPs().iterator().next().getSubnetUUID())) {
- LOG.trace("isLastPortinSubnet: Port is not the only port.");
- return false;
- }
+ if (null != port && !(port.getID().equals(neutronPort.getID()))
+ && port.getDeviceOwner().contains("compute")) {
+ List<Neutron_IPs> portFixedIp = port.getFixedIPs();
+ if (null == portFixedIp || portFixedIp.isEmpty()) {
+ return false;
+ }
+ if (portFixedIp.iterator().next().getSubnetUUID()
+ .equals(neutronPort.getFixedIPs().iterator().next().getSubnetUUID())) {
+ LOG.trace("isLastPortinSubnet: Port is not the only port.");
+ return false;
}
}
}
for (TerminationPoint tp : terminationPoints) {
OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
tp.getAugmentation(OvsdbTerminationPointAugmentation.class);
- if (null != ovsdbTerminationPointAugmentation) {
- if (!(ovsdbTerminationPointAugmentation.getName().equals(Constants.INTEGRATION_BRIDGE))
- && !(terminationPointAugmentation.getInterfaceUuid()
- .equals(ovsdbTerminationPointAugmentation.getInterfaceUuid()))) {
- LOG.debug("isLastPortinBridge: it the last port in bridge {}",
- terminationPointAugmentation.getName());
- return false;
- }
+ if (null != ovsdbTerminationPointAugmentation
+ && !(ovsdbTerminationPointAugmentation.getName().equals(Constants.INTEGRATION_BRIDGE))
+ && !(terminationPointAugmentation.getInterfaceUuid()
+ .equals(ovsdbTerminationPointAugmentation.getInterfaceUuid()))) {
+ LOG.debug("isLastPortinBridge: it the last port in bridge {}",
+ terminationPointAugmentation.getName());
+ return false;
}
}
}