import org.codehaus.enunciate.jaxrs.TypeHint;
import org.opendaylight.controller.northbound.commons.RestMessages;
import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException;
import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
import org.opendaylight.controller.northbound.commons.exception.UnauthorizedException;
import org.opendaylight.controller.northbound.commons.utils.NorthboundUtils;
return username;
}
- private void handleNameMismatch(String name, String nameinURL) {
- if (name == null || nameinURL == null) {
- throw new BadRequestException(RestMessages.INVALIDDATA.toString() + " : Name is null");
- }
-
- if (name.equalsIgnoreCase(nameinURL)) {
- return;
- }
- throw new ResourceConflictException(RestMessages.INVALIDDATA.toString()
- + " : Table Name in URL does not match the row name in request body");
- }
-
/**
* Create a Row for Open_vSwitch schema
*
OvsdbClient client = connectionService.getConnection(node).getClient();
String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
- Row row = null;
+ Row row;
try {
row = ovsdbTable.getRow(node, bckCompatibleTableName, rowUuid);
} catch (Exception e) {
Node node = connectionService.getNode(nodeId);
OvsdbClient client = connectionService.getConnection(node).getClient();
String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
- Map<String, Row> rows = null;
+ Map<String, Row> rows;
try {
rows = ovsdbTable.getRows(node, bckCompatibleTableName);
} catch (Exception e) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
- Status status = ovsdbTable.updateRow(node, bckCompatibleTableName, localRow.getParentUuid(), rowUuid, localRow.getRow());
+ ovsdbTable.updateRow(node, bckCompatibleTableName, localRow.getParentUuid(), rowUuid, localRow.getRow());
return NorthboundUtils.getResponse(
new org.opendaylight.controller.sal.utils.Status(
org.opendaylight.controller.sal.utils.StatusCode.SUCCESS));
.thenReturn(connectionService)
.thenReturn(connectionService);
- Node node = null;
try {
- node = NodeResource.getOvsdbNode(IDENTIFIER, this);
+ NodeResource.getOvsdbNode(IDENTIFIER, this);
fail("Expected an ServiceUnavailableException to be thrown");
} catch (ServiceUnavailableException e) {
assertSame(ServiceUnavailableException.class, e.getClass());
}
try {
- node = NodeResource.getOvsdbNode(BAD_IDENTIFIER, this);
+ NodeResource.getOvsdbNode(BAD_IDENTIFIER, this);
fail("Expected an ResourceNotFoundException to be thrown");
} catch (ResourceNotFoundException e) {
assertSame(ResourceNotFoundException.class, e.getClass());
}
- node = NodeResource.getOvsdbNode(OVS_IDENTIFIER, this);
+ Node node = NodeResource.getOvsdbNode(OVS_IDENTIFIER, this);
assertNotNull("Node " + OVS_IDENTIFIER + " is null", node);
}
.thenReturn(connectionService)
.thenReturn(connectionService);
- Connection testConnection = null;
try {
- testConnection = NodeResource.getOvsdbConnection(IDENTIFIER, this);
+ NodeResource.getOvsdbConnection(IDENTIFIER, this);
fail("Expected an ServiceUnavailableException to be thrown");
} catch (ServiceUnavailableException e) {
assertSame(ServiceUnavailableException.class, e.getClass());
}
try {
- testConnection = NodeResource.getOvsdbConnection(BAD_IDENTIFIER, this);
+ NodeResource.getOvsdbConnection(BAD_IDENTIFIER, this);
fail("Expected an ResourceNotFoundException to be thrown");
} catch (ResourceNotFoundException e) {
assertSame(ResourceNotFoundException.class, e.getClass());
}
- testConnection = NodeResource.getOvsdbConnection(IDENTIFIER, this);
+ Connection testConnection = NodeResource.getOvsdbConnection(IDENTIFIER, this);
assertNotNull("Connection " + OVS_IDENTIFIER + " is null", testConnection);
}
Response response = nodeResource.getNodes();
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
assertNotNull("entity should not be null", response.getEntity());
- String id = new String();
+ String id = "";
List<String> ids = Lists.newArrayList();
ids.add(id);
assertEquals("there should be no nodes", ids.toString(), response.getEntity());
Response response = nodeResource.getNodes();
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
assertNotNull("entity should not be null", response.getEntity());
- String id = new String("\"" + OVS_IDENTIFIER + "\"");
+ String id = "\"" + OVS_IDENTIFIER + "\"";
List<String> ids = Lists.newArrayList();
ids.add(id);
assertEquals(OVS_IDENTIFIER + " should be found", ids.toString(), response.getEntity());
Response response = nodeResource.getNodes();
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
assertNotNull("entity should not be null", response.getEntity());
- String id = new String("\"" + OVS_IDENTIFIER + "\"");
- String id2 = new String("\"" + OVS_IDENTIFIER2 + "\"");
+ String id = "\"" + OVS_IDENTIFIER + "\"";
+ String id2 = "\"" + OVS_IDENTIFIER2 + "\"";
List<String> ids = Lists.newArrayList();
ids.add(id);
ids.add(id2);
public boolean isBridgeInPipeline (Node node){
String bridgeName = southbound.getBridgeName(node);
- if (bridgeName != null && Constants.INTEGRATION_BRIDGE.equals(bridgeName)) {
- return true;
- }
- return false;
+ return bridgeName != null && Constants.INTEGRATION_BRIDGE.equals(bridgeName);
}
public short getTable() {
return builder;
}
- private static final InstanceIdentifier<Flow> createFlowPath(FlowBuilder flowBuilder, NodeBuilder nodeBuilder) {
+ private static InstanceIdentifier<Flow> createFlowPath(FlowBuilder flowBuilder, NodeBuilder nodeBuilder) {
return InstanceIdentifier.builder(Nodes.class)
.child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class,
nodeBuilder.getKey())
.child(Flow.class, flowBuilder.getKey()).build();
}
- private static final
- InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node>
+ private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node>
createNodePath(NodeBuilder nodeBuilder) {
return InstanceIdentifier.builder(Nodes.class)
.child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class,
return null;
}
- private Long getDpid(Node node) {
- Long dpid = 0L;
- dpid = southbound.getDataPathId(node);
+ private long getDpid(Node node) {
+ long dpid = southbound.getDataPathId(node);
if (dpid == 0) {
LOG.warn("getDpid: dpid not found: {}", node);
}
}
MatchBuilder matchBuilder = new MatchBuilder();
FlowBuilder flowBuilder = new FlowBuilder();
- Long dpid = getDpid(node);
+ long dpid = getDpid(node);
if (dpid == 0L) {
LOG.info("could not find dpid: {}", node.getNodeId());
return;
public PipelineOrchestratorImpl() {
eventHandler = Executors.newSingleThreadExecutor();
- this.queue = new LinkedBlockingQueue<Node>();
+ this.queue = new LinkedBlockingQueue<>();
LOG.info("PipelineOrchestratorImpl constructor");
start();
}
if (write) {
// Create the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
// Instructions List Stores Individual Instructions
List<Instruction> instructions = Lists.newArrayList();
// Append the default pipeline after the first classification
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
instructions.add(ib.build());
package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services;
import java.math.BigInteger;
-import java.net.InetAddress;
-import java.util.Iterator;
import java.util.List;
import org.opendaylight.neutron.spi.NeutronSecurityGroup;
if (write) {
// Instantiate the Builders for the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructionsList = Lists.newArrayList();
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
instructionsList.add(ib.build());
if (write) {
// Instantiate the Builders for the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructionsList = Lists.newArrayList();
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
instructionsList.add(ib.build());
boolean write, String securityRuleIpPrefix, Integer protoPortMatchPriority) {
String nodeName = Constants.OPENFLOW_NODE_PREFIX + dpidLong;
- Ipv4Prefix srcIpPrefix = new Ipv4Prefix(securityRuleIpPrefix);
MatchBuilder matchBuilder = new MatchBuilder();
NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
FlowBuilder flowBuilder = new FlowBuilder();
flowBuilder.setMatch(MatchUtils.createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId))
.build());
if (securityRuleIpPrefix != null) {
+ Ipv4Prefix srcIpPrefix = new Ipv4Prefix(securityRuleIpPrefix);
flowBuilder.setMatch(MatchUtils
.createSmacIpTcpSynMatch(matchBuilder, new MacAddress(attachedMac), null, srcIpPrefix)
.build());
if (write) {
// Instantiate the Builders for the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructionsList = Lists.newArrayList();
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
instructionsList.add(ib.build());
if (write) {
// Instantiate the Builders for the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructionsList = Lists.newArrayList();
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
instructionsList.add(ib.build());
if (write) {
// Instantiate the Builders for the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructionsList = Lists.newArrayList();
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
instructionsList.add(ib.build());
if (write) {
// Instantiate the Builders for the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructionsList = Lists.newArrayList();
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
instructionsList.add(ib.build());
if (write) {
// Instantiate the Builders for the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructionsList = Lists.newArrayList();
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
instructionsList.add(ib.build());
if (write) {
// Instantiate the Builders for the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructionsList = Lists.newArrayList();
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
instructionsList.add(ib.build());
if (write) {
// Instantiate the Builders for the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructionsList = Lists.newArrayList();
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(1);
ib.setKey(new InstructionKey(1));
instructionsList.add(ib.build());
boolean write, String securityRuleIpPrefix, Integer protoPortMatchPriority) {
String nodeName = Constants.OPENFLOW_NODE_PREFIX + dpidLong;
- Ipv4Prefix srcIpPrefix = new Ipv4Prefix(securityRuleIpPrefix);
MatchBuilder matchBuilder = new MatchBuilder();
NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
FlowBuilder flowBuilder = new FlowBuilder();
flowBuilder.setMatch(MatchUtils.createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId))
.build());
if (securityRuleIpPrefix != null) {
+ Ipv4Prefix srcIpPrefix = new Ipv4Prefix(securityRuleIpPrefix);
flowBuilder.setMatch(MatchUtils
.createDmacIpTcpSynMatch(matchBuilder, new MacAddress(attachedMac), null, srcIpPrefix)
.build());
if (write) {
// Instantiate the Builders for the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructionsList = Lists.newArrayList();
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(1);
ib.setKey(new InstructionKey(0));
instructionsList.add(ib.build());
if (write) {
// Instantiate the Builders for the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructionsList = Lists.newArrayList();
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
instructionsList.add(ib.build());
List<Instruction> instructions = Lists.newArrayList();
InstructionBuilder ib = new InstructionBuilder();
- List<Action> actionList = null;
+ List<Action> actionList;
if (write) {
if (existingInstructions == null) {
/* First time called there should be no instructions.
actionList.add(ab.build());
} else {
/* Subsequent calls require appending any new local ports for this tenant. */
- ApplyActionsCase aac = (ApplyActionsCase) ib.getInstruction();
Instruction in = existingInstructions.get(0);
actionList = (((ApplyActionsCase) in.getInstruction()).getApplyActions().getAction());
boolean removeFlow = true;
if (instructions != null) {
- ApplyActionsCase aac = (ApplyActionsCase) ib.getInstruction();
Instruction in = instructions.get(0);
List<Action> oldActionList = (((ApplyActionsCase) in.getInstruction()).getApplyActions().getAction());
NodeConnectorId ncid = new NodeConnectorId(OPENFLOW + dpidLong + ":" + localPort);
OutputActionCase opAction = (OutputActionCase) action.getAction();
if (opAction.getOutputAction().getOutputNodeConnector().equals(new Uri(ncidEth))) {
actionList.add(action);
- } else if (opAction.getOutputAction().getOutputNodeConnector().equals(new Uri(ncid)) == false) {
+ } else if (!opAction.getOutputAction().getOutputNodeConnector().equals(new Uri(ncid))) {
ab.setAction(action.getAction());
ab.setOrder(index);
ab.setKey(new ActionKey(index));
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
}
- if (actionList != null && actionList.size() > 2) {
+ if (actionList.size() > 2) {
// Add InstructionBuilder to the Instruction(s)Builder List
InstructionsBuilder isb = new InstructionsBuilder();
isb.setInstruction(instructions);
if (write) {
// Create the OF Actions and Instructions
- InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
// Instructions List Stores Individual Instructions
List<Instruction> instructions = Lists.newArrayList();
// Call the InstructionBuilder Methods Containing Actions
- ib = this.getMutablePipelineInstructionBuilder();
+ InstructionBuilder ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(0);
ib.setKey(new InstructionKey(0));
instructions.add(ib.build());
* @param status manager status
* @return An error to be returned to neutron API service.
*/
- protected static final int getException(Status status) {
- int result = HttpURLConnection.HTTP_INTERNAL_ERROR;
-
+ protected static int getException(Status status) {
assert !status.isSuccess();
StatusCode code = status.getCode();
LOG.debug(" Exception code - {}, description - {}",
code, status.getDescription());
- if (code == StatusCode.BADREQUEST) {
- result = HttpURLConnection.HTTP_BAD_REQUEST;
- } else if (code == StatusCode.CONFLICT) {
- result = HttpURLConnection.HTTP_CONFLICT;
- } else if (code == StatusCode.NOTACCEPTABLE) {
- result = HttpURLConnection.HTTP_NOT_ACCEPTABLE;
- } else if (code == StatusCode.NOTFOUND) {
- result = HttpURLConnection.HTTP_NOT_FOUND;
- } else {
- result = HttpURLConnection.HTTP_INTERNAL_ERROR;
+ switch(code) {
+ case BADREQUEST:
+ return HttpURLConnection.HTTP_BAD_REQUEST;
+ case CONFLICT:
+ return HttpURLConnection.HTTP_CONFLICT;
+ case NOTACCEPTABLE:
+ return HttpURLConnection.HTTP_NOT_ACCEPTABLE;
+ case NOTFOUND:
+ return HttpURLConnection.HTTP_NOT_FOUND;
+ default:
+ return HttpURLConnection.HTTP_INTERNAL_ERROR;
}
-
- return result;
}
/**
@Override
public void neutronFirewallCreated(NeutronFirewall neutronFirewall) {
LOG.debug("Neutron Firewall created by Neutron: {}", neutronFirewall);
- int result = HttpURLConnection.HTTP_BAD_REQUEST;
- result = canCreateNeutronFirewall(neutronFirewall);
+ int result = canCreateNeutronFirewall(neutronFirewall);
if (result != HttpURLConnection.HTTP_CREATED) {
LOG.error("Neutron Firewall creation failed: {} ", result);
- return;
}
}
@Override
public void neutronFirewallUpdated(NeutronFirewall neutronFirewall) {
LOG.debug("NeutronFirewall updated from Neutron: {}", neutronFirewall);
- return;
}
@Override
int result = canDeleteNeutronFirewall(neutronFirewall);
if (result != HttpURLConnection.HTTP_OK) {
LOG.error(" delete Neutron Firewall validation failed for result - {} ", result);
- return;
}
}
public void neutronFirewallRuleCreated(NeutronFirewallRule neutronFirewallRule) {
LOG.debug("NeutronFirewallRule created by Neutron: {}", neutronFirewallRule);
- int result = HttpURLConnection.HTTP_BAD_REQUEST;
-
- result = canCreateNeutronFirewallRule(neutronFirewallRule);
+ int result = canCreateNeutronFirewallRule(neutronFirewallRule);
if (result != HttpURLConnection.HTTP_CREATED) {
LOG.error("Neutron Firewall Rule creation failed {} ", result);
- return;
}
}
@Override
public void neutronFirewallRuleUpdated(NeutronFirewallRule neutronFirewallRule) {
LOG.debug("Neutron Firewall Rule updated from Neutron: {}", neutronFirewallRule);
- return;
}
@Override
int result = canDeleteNeutronFirewallRule(neutronFirewallRule);
if (result != HttpURLConnection.HTTP_OK) {
LOG.error(" delete Neutron Firewall Rule validation failed for result - {} ", result);
- return;
}
}
public void neutronFirewallPolicyCreated(NeutronFirewallPolicy neutronFirewallPolicy) {
LOG.debug("Neutron Firewall Policy created by Neutron: {}", neutronFirewallPolicy);
- int result = HttpURLConnection.HTTP_BAD_REQUEST;
-
- result = canCreateNeutronFirewallPolicy(neutronFirewallPolicy);
+ int result = canCreateNeutronFirewallPolicy(neutronFirewallPolicy);
if (result != HttpURLConnection.HTTP_CREATED) {
LOG.debug("Neutron Firewall Policy creation failed: {} ", result);
- return;
}
}
@Override
public void neutronFirewallPolicyUpdated(NeutronFirewallPolicy neutronFirewallPolicy) {
LOG.debug("Neutron Firewall Policy updated from Neutron: {}", neutronFirewallPolicy);
- return;
}
@Override
int result = canDeleteNeutronFirewallPolicy(neutronFirewallPolicy);
if (result != HttpURLConnection.HTTP_OK) {
LOG.error(" delete Neutron Firewall Policy validation failed for result - {} ", result);
- return;
}
}
}
lbConfig.setVmac(NeutronCacheUtils.getMacAddress(neutronPortCache, loadBalancerSubnetID, loadBalancerVip));
- String memberID, memberIP, memberMAC, memberProtocol, memberSubnetID;
- Integer memberPort;
- Boolean memberAdminStateIsUp;
-
for (NeutronLoadBalancerPool neutronLBPool: neutronLBPoolCache.getAllNeutronLoadBalancerPools()) {
List<NeutronLoadBalancerPoolMember> members = neutronLBPool.getLoadBalancerPoolMembers();
- memberProtocol = neutronLBPool.getLoadBalancerPoolProtocol();
+ String memberProtocol = neutronLBPool.getLoadBalancerPoolProtocol();
if (memberProtocol == null) {
continue;
}
continue;
}
for (NeutronLoadBalancerPoolMember neutronLBPoolMember: members) {
- memberAdminStateIsUp = neutronLBPoolMember.getPoolMemberAdminStateIsUp();
- memberSubnetID = neutronLBPoolMember.getPoolMemberSubnetID();
- if (memberSubnetID == null || memberAdminStateIsUp == null) {
- continue;
- }
- else if (memberSubnetID.equals(loadBalancerSubnetID) && memberAdminStateIsUp.booleanValue()) {
- memberID = neutronLBPoolMember.getPoolMemberID();
- memberIP = neutronLBPoolMember.getPoolMemberAddress();
- memberPort = neutronLBPoolMember.getPoolMemberProtoPort();
- if (memberSubnetID == null || memberID == null || memberIP == null || memberPort == null) {
+ Boolean memberAdminStateIsUp = neutronLBPoolMember.getPoolMemberAdminStateIsUp();
+ String memberSubnetID = neutronLBPoolMember.getPoolMemberSubnetID();
+ if (memberSubnetID != null && memberAdminStateIsUp != null &&
+ memberSubnetID.equals(loadBalancerSubnetID) && memberAdminStateIsUp) {
+ String memberID = neutronLBPoolMember.getPoolMemberID();
+ String memberIP = neutronLBPoolMember.getPoolMemberAddress();
+ Integer memberPort = neutronLBPoolMember.getPoolMemberProtoPort();
+ if (memberID == null || memberIP == null || memberPort == null) {
LOG.debug("Neutron LB pool member details incomplete: {}", neutronLBPoolMember);
continue;
}
- memberMAC = NeutronCacheUtils.getMacAddress(neutronPortCache, memberSubnetID, memberIP);
+ String memberMAC = NeutronCacheUtils.getMacAddress(neutronPortCache, memberSubnetID, memberIP);
if (memberMAC == null) {
continue;
}
*/
//(type.equals(UpdateType.REMOVED) || type.equals(UpdateType.CHANGED))
- } else {
- continue;
}
}
}
/* Iterate over all the Loadbalancers created so far and identify VIP
*/
- String loadBalancerSubnetID, loadBalancerVip=null, loadBalancerName=null;
for (NeutronLoadBalancer neutronLB: neutronLBCache.getAllNeutronLoadBalancers()) {
- loadBalancerSubnetID = neutronLB.getLoadBalancerVipSubnetID();
- loadBalancerName = neutronLB.getLoadBalancerName();
- loadBalancerVip = neutronLB.getLoadBalancerVipAddress();
+ String loadBalancerSubnetID = neutronLB.getLoadBalancerVipSubnetID();
+ String loadBalancerName = neutronLB.getLoadBalancerName();
+ String loadBalancerVip = neutronLB.getLoadBalancerVipAddress();
LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration(loadBalancerName, loadBalancerVip);
Map.Entry<String,String> providerInfo = NeutronCacheUtils.getProviderInformation(neutronNetworkCache, neutronSubnetCache, loadBalancerSubnetID);
for (NeutronLoadBalancerPoolMember neutronLBPoolMember: neutronLBPool.getLoadBalancerPoolMembers()) {
memberAdminStateIsUp = neutronLBPoolMember.getPoolMemberAdminStateIsUp();
memberSubnetID = neutronLBPoolMember.getPoolMemberSubnetID();
- if (memberSubnetID == null || memberAdminStateIsUp == null) {
- continue;
- } else if (memberSubnetID.equals(loadBalancerSubnetID) && memberAdminStateIsUp.booleanValue()) {
+ if (memberSubnetID != null && memberAdminStateIsUp != null &&
+ memberSubnetID.equals(loadBalancerSubnetID) && memberAdminStateIsUp) {
memberID = neutronLBPoolMember.getPoolMemberID();
memberIP = neutronLBPoolMember.getPoolMemberAddress();
memberPort = neutronLBPoolMember.getPoolMemberProtoPort();
- if (memberSubnetID == null || memberID == null || memberIP == null || memberPort == null) {
+ if (memberID == null || memberIP == null || memberPort == null) {
LOG.debug("Neutron LB pool member details incomplete: {}", neutronLBPoolMember);
continue;
}
String memberSubnetID = neutronLBPoolMember.getPoolMemberSubnetID();
Integer memberPort = neutronLBPoolMember.getPoolMemberProtoPort();
String memberPoolID = neutronLBPoolMember.getPoolID();
- String memberProtocol = null;
if (memberSubnetID == null || memberID == null || memberPoolID == null) {
LOG.debug("Neutron LB pool member details incomplete [id={}, pool_id={},subnet_id={}",
return null;
}
NeutronLoadBalancerPool neutronLBPool = neutronLBPoolCache.getNeutronLoadBalancerPool(memberPoolID);
- memberProtocol = neutronLBPool.getLoadBalancerPoolProtocol();
+ String memberProtocol = neutronLBPool.getLoadBalancerPoolProtocol();
if (!(memberProtocol.equalsIgnoreCase(LoadBalancerConfiguration.PROTOCOL_TCP) ||
memberProtocol.equalsIgnoreCase(LoadBalancerConfiguration.PROTOCOL_HTTP) ||
memberProtocol.equalsIgnoreCase(LoadBalancerConfiguration.PROTOCOL_HTTPS))) {
otherMemberPort = otherMember.getPoolMemberProtoPort();
otherMemberProtocol = memberProtocol;
- if (otherMemberIP == null || otherMemberSubnetID == null || otherMemberAdminStateIsUp == null) {
- continue;
- } else if (otherMemberAdminStateIsUp.booleanValue()) {
+ if (otherMemberIP != null && otherMemberSubnetID != null && otherMemberAdminStateIsUp != null &&
+ otherMemberAdminStateIsUp) {
otherMemberMAC = NeutronCacheUtils.getMacAddress(neutronPortCache, otherMemberSubnetID, otherMemberIP);
if (otherMemberMAC == null) {
continue;
@Override
public void neutronSecurityGroupCreated(NeutronSecurityGroup neutronSecurityGroup) {
- int result = HttpURLConnection.HTTP_BAD_REQUEST;
-
- result = canCreateNeutronSecurityGroup(neutronSecurityGroup);
+ int result = canCreateNeutronSecurityGroup(neutronSecurityGroup);
if (result != HttpURLConnection.HTTP_CREATED) {
LOG.debug("Neutron Security Group creation failed {} ", result);
- return;
}
}
@Override
public void neutronSecurityGroupUpdated(NeutronSecurityGroup neutronSecurityGroup) {
- return;
+ // Nothing to do
}
@Override
int result = canDeleteNeutronSecurityGroup(neutronSecurityGroup);
if (result != HttpURLConnection.HTTP_OK) {
LOG.error(" delete Neutron Security Rule validation failed for result - {} ", result);
- return;
}
}
@Override
public void neutronSecurityRuleCreated(NeutronSecurityRule neutronSecurityRule) {
- int result = HttpURLConnection.HTTP_BAD_REQUEST;
-
- result = canCreateNeutronSecurityRule(neutronSecurityRule);
+ int result = canCreateNeutronSecurityRule(neutronSecurityRule);
if (result != HttpURLConnection.HTTP_CREATED) {
LOG.debug("Neutron Security Group creation failed {} ", result);
- return;
}
}
@Override
public void neutronSecurityRuleUpdated(NeutronSecurityRule neutronSecurityRule) {
- return;
+ // Nothing to do
}
@Override
int result = canDeleteNeutronSecurityRule(neutronSecurityRule);
if (result != HttpURLConnection.HTTP_OK) {
LOG.error(" delete Neutron Security Rule validation failed for result - {} ", result);
- return;
}
}
private void processPortDelete(Node node, OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation,
Object context) {
LOG.debug("processPortDelete <{}> <{}>", node, ovsdbTerminationPointAugmentation);
- NeutronNetwork network = null;
+ NeutronNetwork network;
if (context == null) {
network = tenantNetworkManager.getTenantNetwork(ovsdbTerminationPointAugmentation);
} else {
}
}
- private boolean isMainBridge(Node node, OvsdbBridgeAugmentation bridge) {
- boolean rv = false;
- String nodeIdStr = node.getNodeId().getValue();
- String bridgeName = nodeIdStr.substring(nodeIdStr.lastIndexOf('/') + 1);
- List<TerminationPoint> terminationPoints = southbound.extractTerminationPoints(node);
- if (terminationPoints != null && terminationPoints.size() == 1) {
- // TODO: Either do something or remove this if statement.
- // If there's only one termination point, is it a 1-port bridge?
- }
- OvsdbTerminationPointAugmentation port = southbound.extractTerminationPointAugmentation(node, bridgeName);
- if (port != null) {
- String datapathId = southbound.getDatapathId(bridge);
- // Having a datapathId means the ovsdb node has connected to ODL
- if (datapathId != null) {
- rv = true;
- } else {
- LOG.info("datapathId not found");
- }
- }
- return rv;
- }
-
private void processBridgeCreate(Node node, OvsdbBridgeAugmentation bridge) {
LOG.debug("processBridgeCreate <{}> <{}>", node, bridge);
String datapathId = southbound.getDatapathId(bridge);
private static final Logger LOG = LoggerFactory.getLogger(UuidUtils.class);
+ /**
+ * Private constructor (utility class).
+ */
+ private UuidUtils() {
+ // Nothing to do
+ }
+
/**
* Convert neutron object id to key syntax.
*
@Override
public List<String> getAllPhysicalInterfaceNames(Node node) {
List<String> phyIfName = Lists.newArrayList();
- String phyIf = null;
String providerMaps = southbound.getOtherConfig(node, OvsdbTables.OPENVSWITCH,
configurationService.getProviderMappingsKey());
if (providerMaps == null) {
}
private short getControllerOFPort() {
- Short defaultOpenFlowPort = Constants.OPENFLOW_PORT;
- Short openFlowPort = defaultOpenFlowPort;
+ short openFlowPort = Constants.OPENFLOW_PORT;
String portString = ConfigProperties.getProperty(this.getClass(), "of.listenPort");
if (portString != null) {
try {
- openFlowPort = Short.decode(portString).shortValue();
+ openFlowPort = Short.parseShort(portString);
} catch (NumberFormatException e) {
LOG.warn("Invalid port:{}, use default({})", portString,
openFlowPort);
private String getControllerTarget(Node node) {
String setControllerStr = null;
- String controllerIpStr = null;
short openflowPort = Constants.OPENFLOW_PORT;
//Look at user configuration.
//TODO: In case we move to config subsystem to expose these user facing parameter,
// we will have to modify this code.
- controllerIpStr = getControllerIPAddress();
+ String controllerIpStr = getControllerIPAddress();
if(controllerIpStr == null){
// Check if ovsdb node has connection info
String ipaddress = null;
try{
for (Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces();ifaces.hasMoreElements();){
- NetworkInterface iface = (NetworkInterface) ifaces.nextElement();
+ NetworkInterface iface = ifaces.nextElement();
for (Enumeration<InetAddress> inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) {
- InetAddress inetAddr = (InetAddress) inetAddrs.nextElement();
+ InetAddress inetAddr = inetAddrs.nextElement();
if (!inetAddr.isLoopbackAddress() && inetAddr.isSiteLocalAddress()) {
ipaddress = inetAddr.getHostAddress();
break;
*/
public void handleNeutronSubnetEvent(final NeutronSubnet subnet, Action action) {
LOG.debug("Neutron subnet {} event : {}", action, subnet.toString());
- if (!this.enabled) {
- return;
- }
}
/**
*/
public void handleNeutronRouterEvent(final NeutronRouter neutronRouter, Action action) {
LOG.debug("Neutron router {} event : {}", action, neutronRouter.toString());
- if (!this.enabled) {
- return;
- }
}
/**
}
}
- private final NeutronPort findNeutronPortForFloatingIp(final String floatingIpUuid) {
+ private NeutronPort findNeutronPortForFloatingIp(final String floatingIpUuid) {
for (NeutronPort neutronPort : neutronPortCache.getAllPorts()) {
if (neutronPort.getDeviceOwner().equals(OWNER_FLOATING_IP) &&
neutronPort.getDeviceID().equals(floatingIpUuid)) {
return null;
}
- private final Long findOFPortForExtPatch(Long dpId) {
+ private Long findOFPortForExtPatch(Long dpId) {
final String brInt = configurationService.getIntegrationBridgeName();
final String brExt = configurationService.getExternalBridgeName();
final String portNameInt = configurationService.getPatchPortName(new ImmutablePair<>(brInt, brExt));
Preconditions.checkNotNull(dpId);
Preconditions.checkNotNull(portNameInt);
- final long dpidPrimitive = dpId.longValue();
+ final long dpidPrimitive = dpId;
for (Node node : nodeCacheManager.getBridgeNodes()) {
if (dpidPrimitive == southbound.getDataPathId(node)) {
final OvsdbTerminationPointAugmentation terminationPointOfBridge =
*/
public void handleNeutronNetworkEvent(final NeutronNetwork neutronNetwork, Action action) {
LOG.debug("neutronNetwork {}: network: {}", action, neutronNetwork);
- if (!this.enabled) {
- return;
- }
}
//
programL3ForwardingStage1(node, dpid, providerSegmentationId, tenantMac, tenantIpStr, action);
// Configure distributed ARP responder
- if (true == flgDistributedARPEnabled) {
+ if (flgDistributedARPEnabled) {
programStaticArpStage1(dpid, providerSegmentationId, tenantMac, tenantIpStr, action);
}
}
neutronNetworkCache.getNetwork(subnet.getNetworkUUID()) : null;
final String destinationSegmentationId = neutronNetwork != null ?
neutronNetwork.getProviderSegmentationID() : null;
- final String gatewayIp = subnet != null ? subnet.getGatewayIP() : null;
final Boolean isExternal = neutronNetwork != null ? neutronNetwork.getRouterExternal() : Boolean.TRUE;
final String cidr = subnet != null ? subnet.getCidr() : null;
final int mask = getMaskLenFromCidr(cidr);
@Override
public Map<NodeId,Node> getOvsdbNodes() {
- Map<NodeId,Node> ovsdbNodesMap = new ConcurrentHashMap<NodeId,Node>();
+ Map<NodeId,Node> ovsdbNodesMap = new ConcurrentHashMap<>();
for (Map.Entry<NodeId, Node> ovsdbNodeEntry : nodeCache.entrySet()) {
if (southbound.extractOvsdbNode(ovsdbNodeEntry.getValue()) != null) {
ovsdbNodesMap.put(ovsdbNodeEntry.getKey(), ovsdbNodeEntry.getValue());
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.*;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
neutronPortId);
return false;
}
- String vmPort = southbound.getInterfaceExternalIdsValue(terminationPointAugmentation,
- Constants.EXTERNAL_ID_VM_MAC);
LOG.debug("Security Group Check {} DOES contain a Neutron Security Group", neutronPortId);
return true;
}
List<NeutronSecurityGroup> neutronSecurityGroups = neutronPort.getSecurityGroups();
if (neutronSecurityGroups != null) {
- NeutronSecurityGroup neutronSecurityGroup = (NeutronSecurityGroup) neutronSecurityGroups.toArray()[0];
- return neutronSecurityGroup;
+ return (NeutronSecurityGroup) neutronSecurityGroups.toArray()[0];
} else {
return null;
}
return null;
}
NeutronPort neutronPort = neutronPortCache.getPort(neutronPortId);
- List<Neutron_IPs> fixedIps = neutronPort.getFixedIPs();
- return fixedIps;
+ return neutronPort.getFixedIPs();
}
@Override
private void initializeNodeConfiguration(Node node, String nodeUuid) {
NodeConfiguration nodeConfiguration = new NodeConfiguration();
- Integer vlan = 0;
- String networkId = null;
List<OvsdbTerminationPointAugmentation> ports = southbound.getTerminationPointsOfBridge(node);
for (OvsdbTerminationPointAugmentation port : ports) {
- vlan = port.getVlanTag().getValue();
- networkId = tenantNetworkManager.getTenantNetwork(port).getNetworkUUID();
+ Integer vlan = port.getVlanTag().getValue();
+ String networkId = tenantNetworkManager.getTenantNetwork(port).getNetworkUUID();
if (vlan != 0 && networkId != null) {
internalVlanInUse(nodeConfiguration, vlan);
nodeConfiguration.getTenantVlanMap().put(networkId, vlan);
}
@Override
public Object[] getGlobalImplementations() {
- Object[] res = { ConnectionServiceImpl.class, ConfigurationServiceImpl.class, InventoryServiceImpl.class };
- return res;
+ return new Object[]{ ConnectionServiceImpl.class, ConfigurationServiceImpl.class, InventoryServiceImpl.class };
}
@Override
public void configureGlobalInstance(Component c, Object imp){
if (imp.equals(ConfigurationServiceImpl.class)) {
// export the service to be used by SAL
- Dictionary<String, Object> props = new Hashtable<String, Object>();
+ Dictionary<String, Object> props = new Hashtable<>();
c.setInterface(new String[] { OvsdbConfigurationService.class.getName()}, props);
c.add(createServiceDependency()
.setService(org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService.class)
if (imp.equals(ConnectionServiceImpl.class)) {
// export the service to be used by SAL
- Dictionary<String, Object> props = new Hashtable<String, Object>();
+ Dictionary<String, Object> props = new Hashtable<>();
c.setInterface(
new String[] {OvsdbConnectionService.class.getName()}, props);
c.add(createServiceDependency()
@Deprecated
public Status updateRow (Node node, String tableName, String parentUUID, String rowUUID, Row row) {
String databaseName = OvsVswitchdSchemaConstants.DATABASE_NAME;
- Row<GenericTableSchema> updatedRow = this.updateRow(node, databaseName, tableName, new UUID(rowUUID), row, true);
+ this.updateRow(node, databaseName, tableName, new UUID(rowUUID), row, true);
return new StatusWithUuid(StatusCode.SUCCESS);
}
@Override
@Deprecated
public ConcurrentMap<String, Row> getRows(Node node, String tableName) {
- ConcurrentMap<String, Row> ovsTable = ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
- return ovsTable;
+ return ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
}
@Override
}
private short getControllerOFPort() {
- Short defaultOpenFlowPort = 6633;
- Short openFlowPort = defaultOpenFlowPort;
+ short openFlowPort = (short) 6633;
String portString = ConfigProperties.getProperty(this.getClass(), "of.listenPort");
if (portString != null) {
try {
- openFlowPort = Short.decode(portString).shortValue();
+ openFlowPort = Short.parseShort(portString);
} catch (NumberFormatException e) {
LOG.warn("Invalid port:{}, use default({})", portString,
openFlowPort);
return updateOperationStatus.isSuccess();
}
- Status status = null;
- UUID currControllerUuid = null;
+ Status status;
+ UUID currControllerUuid;
InetAddress ofControllerAddr = this.getControllerIPAddress(connection);
short ofControllerPort = getControllerOFPort();
String newControllerTarget = "tcp:"+ofControllerAddr.getHostAddress()+":"+ofControllerPort;
status = this.insertRow(node, controllerTableName, bridgeUUID, newController.getRow());
}
- if (status != null) {
- return status.isSuccess();
- }
+ return status != null && status.isSuccess();
- return false;
}
}
for (OperationResult result : operationResults) {
if (result.getError() != null) {
- throw new OvsdbPluginException("Insert Operation Failed with Error : "+result.getError().toString());
+ throw new OvsdbPluginException("Insert Operation Failed with Error : " + result.getError());
}
}
return getNormalizedRow(dbSchema, tableName, row, referencedRows, operationResults, referencedRowsInsertIndex);
DatabaseSchema dbSchema = client.getSchema(dbName).get();
GenericTableSchema schema = dbSchema.table(refRowObject.getRefTable(), GenericTableSchema.class);
Row<GenericTableSchema> refRow = schema.createRow((ObjectNode)refRowObject.getJsonNode());
- referencedRows.put(refUuid, new AbstractMap.SimpleEntry<String, Row<GenericTableSchema>>(refRowObject.getRefTable(), refRow));
+ referencedRows.put(refUuid, new AbstractMap.SimpleEntry<>(refRowObject.getRefTable(), refRow));
extractReferencedRows(node, dbName, refRow, referencedRows, namedUuidSuffix);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Exception while extracting multi-level Row references " + e.getLocalizedMessage());
}
} else if (column.getData() instanceof OvsdbSet) {
OvsdbSet<Object> setObject = (OvsdbSet<Object>)column.getData();
- OvsdbSet<Object> modifiedSet = new OvsdbSet<Object>();
+ OvsdbSet<Object> modifiedSet = new OvsdbSet<>();
for (Object obj : setObject) {
if (obj instanceof ReferencedRow) {
ReferencedRow refRowObject = (ReferencedRow)obj;
DatabaseSchema dbSchema = client.getSchema(dbName).get();
GenericTableSchema schema = dbSchema.table(refRowObject.getRefTable(), GenericTableSchema.class);
Row<GenericTableSchema> refRow = schema.createRow((ObjectNode)refRowObject.getJsonNode());
- referencedRows.put(refUuid, new AbstractMap.SimpleEntry<String, Row<GenericTableSchema>>(refRowObject.getRefTable(), refRow));
+ referencedRows.put(refUuid, new AbstractMap.SimpleEntry<>(refRowObject.getRefTable(), refRow));
extractReferencedRows(node, dbName, refRow, referencedRows, namedUuidSuffix);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Exception while extracting multi-level Row references " + e.getLocalizedMessage());
TableSchema<GenericTableSchema> primaryRowTableSchema = dbSchema.table(tableName, GenericTableSchema.class);
ColumnSchema<GenericTableSchema, UUID> uuid = primaryRowTableSchema.column("_uuid", UUID.class);
if (uuid != null) {
- Column<GenericTableSchema, UUID> uuidColumn = new Column<GenericTableSchema, UUID>(uuid, primaryRowUuid);
+ Column<GenericTableSchema, UUID> uuidColumn = new Column<>(uuid, primaryRowUuid);
row.addColumn("_uuid", uuidColumn);
}
if (referencedRows != null) {
Collection<Column<GenericTableSchema, ?>> columns = row.getColumns();
- if (referencedRows != null) {
- for (int idx=0; idx < referencedRows.keySet().size(); idx++) {
- UUID refUuid = (UUID) referencedRows.keySet().toArray()[idx];
- for (Column column : columns) {
- if (column.getData() != null) {
- if ((column.getData() instanceof UUID) && column.getData().equals(refUuid)) {
- column.setData(operationResults.get(referencedRowsInsertIndex + idx).getUuid());
- } else if ((column.getData() instanceof OvsdbSet) && ((OvsdbSet)column.getData()).contains(refUuid)) {
- OvsdbSet<UUID> refSet = (OvsdbSet<UUID>)column.getData();
- refSet.remove(refUuid);
- refSet.add(operationResults.get(referencedRowsInsertIndex + idx).getUuid());
- }
+ Object[] rowKeys = referencedRows.keySet().toArray();
+ for (int idx = 0; idx < rowKeys.length; idx++) {
+ UUID refUuid = (UUID) rowKeys[idx];
+ for (Column column : columns) {
+ if (column.getData() != null) {
+ if ((column.getData() instanceof UUID) && column.getData().equals(refUuid)) {
+ column.setData(operationResults.get(referencedRowsInsertIndex + idx).getUuid());
+ } else if ((column.getData() instanceof OvsdbSet) && ((OvsdbSet)column.getData()).contains(refUuid)) {
+ OvsdbSet<UUID> refSet = (OvsdbSet<UUID>)column.getData();
+ refSet.remove(refUuid);
+ refSet.add(operationResults.get(referencedRowsInsertIndex + idx).getUuid());
}
}
}
}
for (OperationResult result : operationResults) {
if (result.getError() != null) {
- throw new OvsdbPluginException("Delete Operation Failed with Error : "+result.getError().toString());
+ throw new OvsdbPluginException("Delete Operation Failed with Error : " + result.getError());
}
}
} catch (InterruptedException | ExecutionException e) {
if (cache == null) {
return null;
} else {
- return new ArrayList<String>(cache.keySet());
+ return new ArrayList<>(cache.keySet());
}
}
}
String portString = ConfigProperties.getProperty(OvsdbConnectionService.class, OVSDB_LISTENPORT);
int ovsdbListenPort = DEFAULT_OVSDB_PORT;
if (portString != null) {
- ovsdbListenPort = Integer.decode(portString).intValue();
+ ovsdbListenPort = Integer.parseInt(portString);
}
if (!connectionLib.startOvsdbManager(ovsdbListenPort)) {
@Override
public List<Node> getNodes() {
- List<Node> nodes = new ArrayList<Node>();
+ List<Node> nodes = new ArrayList<>();
for (Connection connection : ovsdbConnections.values()) {
nodes.add(connection.getNode());
}
for (UUID uuid : (Set<UUID>)update.getRows().keySet()) {
if (update.getNew(uuid) != null) {
- boolean isNewRow = (tCache == null || tCache.get(uuid.toString()) == null) ? true : false;
+ boolean isNewRow = (tCache == null || tCache.get(uuid.toString()) == null);
db.updateRow(databaseName, tableName, uuid.toString(), update.getNew(uuid));
if (isNewRow) {
this.handleOpenVSwitchSpecialCase(n, databaseName, tableName, uuid);
public static Node getOpenFlowNode (String identifier) {
NodeId nodeId = new NodeId(identifier);
NodeKey nodeKey = new NodeKey(nodeId);
- Node node = new NodeBuilder()
+
+ return new NodeBuilder()
.setId(nodeId)
.setKey(nodeKey)
.build();
-
- return node;
}
}
// If port we are asked to delete is not found, this implementation will leave actions
// alone and not remove the flow, as long as a remaining OutputActionCase is found.
//
- for (int i = 0; i < actionList.size(); i++) {
- if (actionList.get(i).getAction() instanceof OutputActionCase) {
+ for (Action action : actionList) {
+ if (action.getAction() instanceof OutputActionCase) {
removeFlow = false;
break;
}