return null;
}
- protected Long getDpid(Node node) {
+ private Long getDpid(Node node) {
Long dpid = 0L;
dpid = southbound.getDataPathId(node);
if (dpid == 0) {
/**
* Program Default Pipeline Flow.
*
- * @param Node on which the default pipeline flow is programmed.
+ * @param node on which the default pipeline flow is programmed.
*/
protected void programDefaultPipelineRule(Node node) {
if (!isBridgeInPipeline(node)) {
import org.opendaylight.ovsdb.utils.mdsal.openflow.MatchUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg3;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxRegCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
public class InboundNatService extends AbstractServiceInstance implements ConfigInterface, InboundNatProvider {
- public final static long REG_VALUE_NO_INBOUND_REWRITE = 0x0L;
public static final Class<? extends NxmNxReg> REG_FIELD = NxmNxReg3.class;
public InboundNatService() {
return new Status(StatusCode.SUCCESS);
}
- /**
- * Program Default Pipeline Flow for Inbound NAT.
- *
- * @param node on which the default pipeline flow is programmed.
- */
- @Override
- protected void programDefaultPipelineRule(Node node) {
- if (!isBridgeInPipeline(node)) {
- //logger.trace("Bridge is not in pipeline {} ", node);
- return;
- }
- MatchBuilder matchBuilder = new MatchBuilder();
- FlowBuilder flowBuilder = new FlowBuilder();
- Long dpid = getDpid(node);
- if (dpid == 0L) {
- return;
- }
- String nodeName = OPENFLOW + getDpid(node);
- NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
-
- // Create the OF Actions and Instructions
- InstructionsBuilder isb = new InstructionsBuilder();
-
- // Instructions List Stores Individual Instructions
- List<Instruction> instructions = Lists.newArrayList();
-
- // Set register to indicate that rewrite did _not_ take place
- InstructionBuilder ib = new InstructionBuilder();
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionList =
- Lists.newArrayList();
- ActionBuilder ab = new ActionBuilder();
- ab.setAction(ActionUtils.nxLoadRegAction(new DstNxRegCaseBuilder().setNxReg(REG_FIELD).build(),
- BigInteger.valueOf(REG_VALUE_NO_INBOUND_REWRITE)));
- ab.setOrder(1);
- ab.setKey(new ActionKey(1));
- actionList.add(ab.build());
-
- ApplyActionsBuilder aab = new ApplyActionsBuilder();
- aab.setAction(actionList);
-
- ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
- ib.setOrder(0);
- ib.setKey(new InstructionKey(0));
- instructions.add(ib.build());
-
- // Call the InstructionBuilder Methods Containing Actions
- ib = getMutablePipelineInstructionBuilder();
- ib.setOrder(1);
- ib.setKey(new InstructionKey(1));
- instructions.add(ib.build());
-
- // Add InstructionBuilder to the Instruction(s)Builder List
- isb.setInstruction(instructions);
-
- // Add InstructionsBuilder to FlowBuilder
- flowBuilder.setInstructions(isb.build());
-
- String flowId = "CUSTOM_DEFAULT_PIPELINE_FLOW_"+getTable();
- flowBuilder.setId(new FlowId(flowId));
- FlowKey key = new FlowKey(new FlowId(flowId));
- flowBuilder.setMatch(matchBuilder.build());
- flowBuilder.setPriority(0);
- flowBuilder.setBarrier(true);
- flowBuilder.setTableId(getTable());
- flowBuilder.setKey(key);
- flowBuilder.setFlowName(flowId);
- flowBuilder.setHardTimeout(0);
- flowBuilder.setIdleTimeout(0);
- writeFlow(flowBuilder, nodeBuilder);
- }
-
@Override
public void setDependencies(BundleContext bundleContext, ServiceReference serviceReference) {
super.setDependencies(bundleContext.getServiceReference(InboundNatProvider.class.getName()), this);
/**
* Returns the name configured name of the Integration Bridge
*/
- public String getIntegrationBridgeName();
+ String getIntegrationBridgeName();
/**
* Configures the name of the Integration Bridge
*/
- public void setIntegrationBridgeName(String integrationBridgeName);
+ void setIntegrationBridgeName(String integrationBridgeName);
/**
* Returns the name configured name of the Network Bridge
*/
- public String getNetworkBridgeName();
+ String getNetworkBridgeName();
/**
* Configures the name of the Network Bridge
*/
- public void setNetworkBridgeName(String networkBridgeName);
+ void setNetworkBridgeName(String networkBridgeName);
/**
* Returns the name configured name of the ExternalBridge
*/
- public String getExternalBridgeName();
+ String getExternalBridgeName();
/**
* Configures the name of the External Bridge
*/
- public void setExternalBridgeName(String externalBridgeName);
+ void setExternalBridgeName(String externalBridgeName);
/**
* Returns the key used to access the Tunnel Endpoint configuration from Open vSwitch
*/
- public String getTunnelEndpointKey();
+ String getTunnelEndpointKey();
/**
* Sets the key used to access the Tunnel Endpoint configuration from Open vSwitch
*/
- public void setTunnelEndpointKey(String tunnelEndpointKey);
+ void setTunnelEndpointKey(String tunnelEndpointKey);
/**
* Returns a Map of patch port names where the key is a tuple of source bridge and destination bridge
*/
- public Map<Pair<String, String>, String> getPatchPortNames();
+ Map<Pair<String, String>, String> getPatchPortNames();
/**
* Sets the Map of source/destination bridges to patch port name
*/
- public void setPatchPortNames(Map<Pair<String, String>, String> patchPortNames);
+ void setPatchPortNames(Map<Pair<String, String>, String> patchPortNames);
/**
* Get the name of a patch port
* is the source bridge and R the destination bridge
* @return the name of the patch port
*/
- public String getPatchPortName(Pair portTuple);
+ String getPatchPortName(Pair portTuple);
/**
* Returns the key used to access the Tunnel Endpoint configuration from Open vSwitch
*/
- public String getProviderMappingsKey();
+ String getProviderMappingsKey();
/**
* Sets the key used to access the Tunnel Endpoint configuration from Open vSwitch
*/
- public void setProviderMappingsKey(String providerMappingsKey);
+ void setProviderMappingsKey(String providerMappingsKey);
/**
* Gets the default provider mapping
*/
- public String getDefaultProviderMapping();
+ String getDefaultProviderMapping();
/**
* Sets the default provider mapping
*/
- public void setDefaultProviderMapping(String providerMapping);
+ void setDefaultProviderMapping(String providerMapping);
/**
* Gets the tunnel endpoint address for a given Node
* @return the tunnel endpoint
* @see java.net.InetAddress
*/
- public InetAddress getTunnelEndPoint(Node node);
+ InetAddress getTunnelEndPoint(Node node);
/**
* Returns the OpenFlow version to be used by the {@link NetworkingProvider}
* @param node the node to query
* @return the OpenFlow version to use
*/
- public String getOpenflowVersion(Node node);
+ String getOpenflowVersion(Node node);
/**
* Determine if L3 forwarding is enabled
* @return true if ovsdb net-virt is configured to perform L3 forwarding
*/
- public boolean isL3ForwardingEnabled();
+ boolean isL3ForwardingEnabled();
/**
* Determine if Distributed ARP Responder is enabled
* @return true if ovsdb net-virt is configured for distributed arp responder
*/
- public boolean isDistributedArpDisabled();
+ boolean isDistributedArpDisabled();
/**
* Returns the MacAddress to be used for the default gateway by the {@link L3ForwardingProvider}
* @param node the node to query
* @return the MacAddress to use for the default gateway; or null if none is configured.
*/
- public String getDefaultGatewayMacAddress(Node node);
+ String getDefaultGatewayMacAddress(Node node);
}
/**
* Program port security ACL.
*
- * @param node the node
* @param dpid the dpid
* @param segmentationId the segmentation id
* @param attachedMac the attached mac
/**
* Program port security ACL.
*
- * @param node the node
* @param dpid the dpid
* @param segmentationId the segmentation id
* @param attachedMac the attached mac
if (neutronNetwork != null) {
logger.debug("mapped to {}", neutronNetwork);
} else {
- logger.debug("getTenantNetwork: did not find neutronNetwork in cache");
+ logger.debug("getTenantNetwork: did not find neutronNetwork in cache from neutronPort {}",
+ neutronPortId);
}
} else {
- logger.debug("getTenantNetwork: did not find neutronPort in cache");
+ logger.info("getTenantNetwork did not find neutronPort {} from termination point {}",
+ neutronPortId, terminationPointAugmentation.getName());
}
} else {
logger.debug("getTenantNetwork: did not find {} in external_ids", Constants.EXTERNAL_ID_INTERFACE_ID);
}
- if (neutronNetwork != null) {
- logger.debug("mapped to {}", neutronNetwork);
- } else {
- logger.warn("getTenantNetwork did not find network for {}", terminationPointAugmentation.getName());
- }
return neutronNetwork;
}